/* =========================================================
   Staragain — author site
   Literary, warm-dark. Mobile-first. Light & fast.
   ========================================================= */

:root {
  --ink:        #14100d;
  --ink-2:      #1c1713;
  --panel:      #221b16;
  --cream:      #f2e9db;
  --cream-dim:  #d8cbb6;
  --muted:      #a8977f;
  --gold:       #caa15c;
  --gold-soft:  #e0c288;
  --rust:       #b23b2c;
  --line:       rgba(202,161,92,.22);
  --maxw:       1120px;
  --serif:      "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body:       "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* soft warm ambience + fine grain, both cheap and fixed */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 800px at 78% -8%, rgba(178,59,44,.10), transparent 60%),
    radial-gradient(1000px 700px at 12% 108%, rgba(202,161,92,.10), transparent 60%),
    linear-gradient(180deg, #17120e 0%, #14100d 40%, #120d0a 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold-soft); text-decoration: none; }
a:hover { color: var(--cream); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.08; margin: 0; }
.kicker {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .32em;
  font-size: .72rem;
  color: var(--gold);
  margin: 0 0 1.1rem;
}
.lede { font-size: 1.22rem; color: var(--cream-dim); }

/* ---------- Header / nav ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(9px);
  background: rgba(18,13,10,.72);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.5rem; letter-spacing: .06em;
  color: var(--cream);
}
.brand span { color: var(--gold); }
.nav a {
  color: var(--cream-dim);
  font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
  margin-left: 1.4rem;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--gold-soft); }
.nav a.first { margin-left: 0; }
@media (max-width: 719px) {
  .site-head .wrap { height: auto; min-height: 62px; flex-wrap: wrap; padding: .6rem 22px; row-gap: .2rem; }
  .nav a { margin-left: 1rem; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(4rem, 12vh, 9rem) 0 clamp(3rem, 8vh, 6rem); }
.hero .glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(720px 460px at 30% 30%, rgba(202,161,92,.14), transparent 62%);
  animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); opacity: .8; }
  to   { transform: translate3d(4%, 3%, 0) scale(1.08); opacity: 1; }
}
.hero h1 { font-size: clamp(2.8rem, 8vw, 5.4rem); letter-spacing: .01em; }
.hero h1 .rust { color: var(--rust); }
.hero .lede { max-width: 40ch; margin-top: 1.4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--body);
  font-size: .82rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .85em 1.7em;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  border-radius: 2px;
  transition: background .25s, color .25s, transform .25s;
}
.btn:hover { background: var(--gold); color: #16110c; transform: translateY(-2px); }
.btn.solid { background: var(--gold); color: #16110c; }
.btn.solid:hover { background: var(--gold-soft); color: #16110c; }
.btn.ghost { border-color: var(--line); color: var(--cream-dim); }
.btn.ghost:hover { border-color: var(--gold); color: var(--cream); background: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }

/* ---------- Sections ---------- */
section { padding: clamp(3rem, 8vh, 6rem) 0; }
.section-head { max-width: 60ch; margin-bottom: 2.6rem; }
.section-head h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
.rule { width: 46px; height: 2px; background: var(--gold); margin: 1.2rem 0; }

/* ---------- Featured book ---------- */
.featured { display: grid; grid-template-columns: 1fr; gap: 2.4rem; align-items: center; }
.featured .cover-frame { justify-self: center; }
.cover-frame {
  position: relative; width: min(320px, 78vw);
  border-radius: 3px; overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(202,161,92,.16);
  transition: transform .5s;
}
.cover-frame:hover { transform: translateY(-6px) rotate(-.4deg); }
.tag { color: var(--gold); font-size: .74rem; letter-spacing: .26em; text-transform: uppercase; }

/* ---------- Bibliography grid ---------- */
.books { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.book-card {
  background: linear-gradient(180deg, var(--ink-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
.book-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: 0 24px 40px -24px rgba(0,0,0,.7); }
.book-card .thumb { aspect-ratio: 2 / 3; background: #0f0b08; overflow: hidden; }
.book-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-card .body { padding: 1.3rem 1.4rem 1.6rem; display: flex; flex-direction: column; flex: 1; }
.book-card h3 { font-size: 1.7rem; }
.book-card .meta { color: var(--muted); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin: .5rem 0 .9rem; }
.book-card p { color: var(--cream-dim); font-size: 1rem; margin: 0 0 1.3rem; flex: 1; }
.badge {
  display: inline-block; font-size: .66rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .3em .7em; border-radius: 999px; border: 1px solid var(--gold);
  color: var(--gold-soft); margin-left: .6rem; vertical-align: middle;
}
.badge.soon { border-color: var(--rust); color: #e6897c; }

/* ---------- Book detail page ---------- */
.book-detail { display: grid; grid-template-columns: 1fr; gap: 2.6rem; }
.book-detail .cover-frame { justify-self: center; }
.book-detail h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.pull {
  font-family: var(--serif); font-size: 1.5rem; font-style: italic;
  color: var(--gold-soft); border-left: 2px solid var(--gold);
  padding-left: 1.1rem; margin: 2rem 0;
}
.synopsis p { margin: 0 0 1.1rem; }

/* ---------- Quotes ---------- */
.quotes { display: grid; grid-template-columns: 1fr; gap: 1.6rem; }
.quote {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1.6rem 1.7rem; font-family: var(--serif); font-style: italic; font-size: 1.3rem;
  color: var(--cream);
}
.quote cite { display: block; margin-top: .9rem; font-family: var(--body); font-style: normal; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- Waitlist ---------- */
.waitlist { background: linear-gradient(180deg, var(--panel), var(--ink-2)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.waitlist .inner { max-width: 640px; margin: 0 auto; text-align: center; }
.waitlist h2 { font-size: clamp(2rem, 5vw, 3.2rem); }
.waitlist p { color: var(--cream-dim); }
.flodesk-slot { margin-top: 2rem; }

/* fallback form (visual placeholder until Flodesk embed is pasted) */
.fd-fallback { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1.4rem; }
.fd-fallback input {
  flex: 1 1 260px; max-width: 340px;
  background: #0f0b08; border: 1px solid var(--line); color: var(--cream);
  padding: .9em 1em; border-radius: 3px; font-family: var(--body); font-size: 1rem;
}
.fd-fallback input::placeholder { color: var(--muted); }
.fd-note { margin-top: 1rem; font-size: .8rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 2.6rem 0 3.2rem; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-foot .brand { font-size: 1.2rem; }
.foot-links a { color: var(--cream-dim); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin-left: 1.4rem; }
.foot-links a:first-child { margin-left: 0; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .books { grid-template-columns: repeat(3, 1fr); }
  .quotes { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 860px) {
  .featured { grid-template-columns: 320px 1fr; gap: 3.6rem; }
  .featured .cover-frame { justify-self: start; }
  .book-detail { grid-template-columns: 340px 1fr; gap: 3.6rem; align-items: start; }
  .book-detail .cover-frame { justify-self: start; position: sticky; top: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero .glow { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
