/* Tassanara — Leoshine series site. Tokens per DESIGN.md (Midnight Sapphire default). */
@font-face {
  font-family: 'Tassanara';
  src: url('../fonts/Tassanara.ttf') format('truetype');
  font-display: swap;
}
:root, [data-theme="sapphire"] {
  --ink: #112250; --surface: #F5F0E9; --accent: #E0C58F;
  --muted: #3C507D; --soft: #D9CBC2; --on-ink: #F5F0E9;
  --accent-ink: #112250; --drench: #E0C58F; --on-drench: #112250;
  /* on-dark accent guardrail: a tone that always reads on --ink */
  --accent-on-dark: #E0C58F;
  --success: #4A7C59; --error: #B33A3A;
}
[data-theme="twilight"] {
  --ink: #414B9E; --surface: #E2C99E; --accent: #852736;
  --muted: #9792CB; --soft: #AA74A0; --on-ink: #E2C99E;
  --accent-ink: #E2C99E; --drench: #852736; --on-drench: #E2C99E;
  --accent-on-dark: #E2C99E; /* ruby fails on blue; sand carries accents on dark */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 17px; line-height: 1.6;
  background: var(--surface); color: var(--ink);
}
img { max-width: 100%; height: auto; }
.promo-video { display: block; width: 100%; height: auto; background: var(--ink); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.dark-band :focus-visible { outline-color: var(--accent-on-dark); }

/* --- type roles --- */
h1, h2, h3.display { font-family: 'Fraunces', serif; font-weight: 600; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(34px, 5.2vw, 60px); }
h2 { font-size: clamp(28px, 3.6vw, 44px); }
.eyebrow {
  font-family: 'Marcellus', serif; letter-spacing: .26em; text-transform: uppercase;
  font-size: 13px; color: color-mix(in srgb, var(--ink) 72%, var(--muted));
}
.dark-band .eyebrow { color: var(--accent-on-dark); }
.lede { font-size: 19px; max-width: 54ch; text-wrap: pretty; }
.tassanara { font-family: 'Tassanara', 'Fraunces', serif; }

/* --- buttons: 5 states (default/hover/focus/active/disabled) --- */
.btn {
  display: inline-block; font-family: 'Marcellus', serif; letter-spacing: .12em;
  text-transform: uppercase; font-size: 13px; padding: 15px 30px;
  text-decoration: none; cursor: pointer; border: none; text-align: center;
  transition: transform .2s cubic-bezier(.22,1,.36,1), box-shadow .2s cubic-bezier(.22,1,.36,1), background .2s ease-out;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.28); }
.btn:active { transform: translateY(0); box-shadow: 0 3px 8px rgba(0,0,0,.24); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white 12%); }
.btn-ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.dark-band .btn-ghost { border-color: var(--accent-on-dark); color: var(--on-ink); }

/* --- cartographic route motif --- */
.route { border: none; border-top: 1px dashed var(--accent); position: relative; }
.dark-band .route { border-color: var(--accent-on-dark); }
.route::after { content: "◆"; position: absolute; right: 0; top: -10px; font-size: 11px; color: var(--accent); }
.dark-band .route::after { color: var(--accent-on-dark); }

/* --- bands --- */
.dark-band { background: var(--ink); color: var(--on-ink); position: relative; }
.glow-band {
  background: radial-gradient(120% 90% at 50% 118%,
    color-mix(in srgb, var(--accent) 26%, var(--ink)) 0%, var(--ink) 55%);
}
.grain::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
.soft-band {
  background:
    radial-gradient(90% 70% at 12% 0%, color-mix(in srgb, var(--soft) 32%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 84%, var(--soft) 16%);
}
.drench-band {
  background:
    radial-gradient(110% 85% at 85% 110%, color-mix(in srgb, var(--on-drench) 14%, transparent), transparent 55%),
    var(--drench);
  color: var(--on-drench); position: relative;
}
.drench-band .eyebrow { color: var(--on-drench); opacity: .72; }

/* --- nav --- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(20px, 5vw, 72px);
  background: color-mix(in srgb, var(--ink) 94%, black 6%); color: var(--on-ink);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.seal { font-family: 'Tassanara', 'Fraunces', serif; font-size: 30px; color: var(--accent-on-dark); line-height: 1; }
.brand .name { font-family: 'Marcellus', serif; letter-spacing: .22em; font-size: 14px; color: var(--on-ink); text-transform: uppercase; }
.site-nav ul { display: flex; gap: 26px; list-style: none; }
.site-nav a.link {
  font-family: 'Marcellus', serif; letter-spacing: .14em; font-size: 12.5px;
  text-transform: uppercase; color: var(--on-ink); text-decoration: none; opacity: .85;
  padding: 6px 2px; transition: color .2s ease-out, opacity .2s ease-out;
}
.site-nav a.link:hover, .site-nav a.link[aria-current="page"] { opacity: 1; color: var(--accent-on-dark); }
.site-nav a.link[aria-current="page"] { border-bottom: 1px solid var(--accent-on-dark); }
.nav-cta { padding: 10px 20px; font-size: 11.5px; }
.site-nav ul .nav-cta-mobile { display: none; } /* CTA lives in the bar on desktop; moves into the menu on mobile */
.nav-toggle { display: none; background: none; border: 1px solid var(--accent-on-dark); color: var(--on-ink); font-family: 'Marcellus', serif; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 8px 12px; cursor: pointer; }

/* --- hero --- */
.hero { padding: clamp(70px, 10vw, 120px) clamp(20px, 6vw, 96px) 90px; overflow: hidden; position: relative; }
.hero > * { position: relative; z-index: 1; }
.hero-mark {
  position: absolute; z-index: 0; right: -1%; top: 4%;
  font-family: 'Tassanara', 'Fraunces', serif;
  font-size: clamp(150px, 24vw, 340px); line-height: 1;
  color: color-mix(in srgb, var(--accent-on-dark) 11%, transparent);
  pointer-events: none; user-select: none; white-space: nowrap;
  transform: rotate(-4deg);
}
.hero-cover {
  position: absolute; z-index: 1; right: clamp(24px, 7vw, 110px); top: 44%;
  width: clamp(160px, 14vw, 215px); translate: 0 -55%; rotate: 3deg;
  border: 1px solid var(--accent-on-dark);
  box-shadow: 22px 30px 60px rgba(0,0,0,.5);
}
.hero-cover img { display: block; width: 100%; }
@media (max-width: 1180px) { .hero-cover { display: none; } }
@media (max-width: 780px) { .hero-mark { font-size: 150px; opacity: .7; top: auto; bottom: 4%; } }
.hero h1 { max-width: 20ch; overflow-wrap: normal; word-break: keep-all; hyphens: none; }
.hero h1 .g {
  display: inline-block;
  transition: opacity .6s ease-out, transform .6s cubic-bezier(.22,1,.36,1),
    color .6s ease-out, text-shadow .6s ease-out, filter .35s ease-out;
}
.hero h1 .w { display: inline-block; } /* wrap by word, never mid-word */
.hero h1 .g.glyph {
  font-family: 'Tassanara', 'Fraunces', serif; color: var(--accent-on-dark);
  opacity: .72; transform: translateY(-.08em) scale(1.035);
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent-on-dark) 58%, transparent);
}
.hero h1 .g.decoding { opacity: .25; transform: translateY(.08em) scale(.97); filter: blur(1px); }
.hero .sub { font-size: 19px; max-width: 52ch; margin-top: 22px; opacity: .92; text-wrap: pretty; }
.cta-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 36px; }
.hero .route { margin-top: 72px; }

/* --- sections --- */
.section { padding: clamp(64px, 9vw, 120px) clamp(20px, 6vw, 96px); }
.section.tight { padding-top: clamp(48px, 6vw, 80px); padding-bottom: clamp(48px, 6vw, 80px); }
.two-col { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.two-col.rev { grid-template-columns: .9fr 1.1fr; }

/* --- frames (artifact treatment) --- */
.frame { border: 1px solid var(--accent); box-shadow: 16px 20px 44px rgba(0,0,0,.32); }
.frame.pad { padding: 12px; background: #fff; }
.dark-band .frame.pad { background: color-mix(in srgb, var(--ink) 80%, black 20%); }
.frame.tilt-l { transform: rotate(-1.2deg); }
.frame.tilt-r { transform: rotate(1.2deg); }
figcaption {
  font-family: 'Marcellus', serif; font-size: 11.5px; letter-spacing: .15em;
  text-transform: uppercase; text-align: center; padding: 11px 4px 3px; opacity: .78;
}
.dark-band figcaption { color: var(--accent-on-dark); opacity: 1; }

/* --- kit forms --- */
.kit-form { display: flex; max-width: 480px; margin-top: 22px; }
.kit-form input {
  flex: 1; padding: 15px 16px; font-family: inherit; font-size: 15px;
  border: 1px solid var(--muted); border-right: none; background: #fff; color: #1a1a1a;
}
.kit-form input:focus-visible { outline-offset: -2px; }
.micro { font-size: 12.5px; opacity: .72; margin-top: 12px; }

/* --- books --- */
.shelf { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 48px; }
.book .cover { align-self: flex-start; display: inline-block; margin-bottom: 24px; }
.book .cover img { display: block; width: 210px; }
.book h3 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 24px; margin: 6px 0 10px; }
.tag { font-family: 'Marcellus', serif; font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 70%, var(--muted)); }
.book p { font-size: 15.5px; max-width: 40ch; }
.formats { font-size: 13.5px; margin-top: 12px; font-style: italic; opacity: .82; }
.book .row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.book .btn { padding: 12px 22px; font-size: 12px; }

/* --- glossary --- */
.glossary-hero { padding-bottom: clamp(64px, 8vw, 96px); }
.glossary-hero h1 { max-width: 17ch; }
.glossary-byline {
  margin-top: 22px; font-family: 'Marcellus', serif; font-size: 12.5px;
  letter-spacing: .17em; text-transform: uppercase; color: var(--accent-on-dark);
}
.glossary-page { max-width: 1200px; margin: 0 auto; }
.glossary-intro { max-width: 68ch; }
.glossary-intro blockquote {
  margin-top: 36px; padding: 8px 0 8px 24px; border-left: 2px solid var(--accent);
  font-size: 18px; font-style: italic;
}
.book-two-key { margin-top: 28px; font-size: 14px; }
.book-two-badge {
  display: inline-block; vertical-align: .12em; margin-left: 5px; padding: 3px 7px;
  background: var(--ink); color: var(--accent-on-dark); font-family: 'Marcellus', serif;
  font-size: 9px; line-height: 1; letter-spacing: .12em; text-transform: uppercase;
}
.book-two-key .book-two-badge { margin: 0 7px 0 0; }
.glossary-jump {
  display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 48px 0 24px;
  padding: 20px 0; border-top: 1px solid var(--soft); border-bottom: 1px solid var(--soft);
}
.glossary-jump a {
  color: var(--ink); font-family: 'Marcellus', serif; font-size: 11.5px;
  letter-spacing: .14em; text-transform: uppercase; text-underline-offset: 4px;
}
.glossary-section { max-width: 76ch; padding: 68px 0 0; scroll-margin-top: 82px; }
.glossary-section h2 { margin: 10px 0 28px; }
.glossary-section h3 { margin: 52px 0 18px; font-size: clamp(25px, 3vw, 34px); }
.glossary-section h4 {
  margin: 28px 0 6px; font-family: 'Marcellus', serif; font-size: 12px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.glossary-section dl { margin: 0; }
.glossary-section dt {
  margin-top: 24px; font-family: 'Fraunces', serif; font-weight: 600;
  font-size: 19px; line-height: 1.35; color: var(--ink);
}
.glossary-section dt .term-name .w { display: inline-block; }
.glossary-section dt .term-name .g {
  display: inline-block;
  transition: opacity .6s ease-out, transform .6s cubic-bezier(.22,1,.36,1),
    color .6s ease-out, text-shadow .6s ease-out, filter .35s ease-out;
}
.glossary-section dt .term-name .g.glyph {
  font-family: 'Tassanara', 'Fraunces', serif; color: var(--accent);
  opacity: .68; transform: translateY(-.12em) scale(1.06);
  text-shadow: 0 0 13px color-mix(in srgb, var(--accent) 62%, transparent);
}
.glossary-section dt .term-name .g.decoding {
  opacity: .18; transform: translateY(.1em) scale(.95); filter: blur(.8px);
}
.glossary-section dd { margin: 7px 0 0; padding-bottom: 22px; border-bottom: 1px solid var(--soft); }
.pronunciation { font-family: 'Source Serif 4', serif; font-size: .82em; font-style: italic; font-weight: 400; color: var(--muted); }
.glossary-dedication {
  max-width: 68ch; margin-top: 80px; padding: 34px; border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--surface) 82%, var(--soft) 18%);
}
.glossary-dedication p:last-child { margin-top: 14px; font-size: 18px; font-style: italic; }

/* --- buy panel (books page) --- */
.buy-panel { border: 1px solid var(--muted); padding: 26px; background: #fff; }
.buy-panel h4 { font-family: 'Marcellus', serif; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 10px; }
.buy-panel ul { list-style: none; }
.buy-panel li { padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--soft) 60%, transparent); font-size: 15px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.buy-panel li:last-child { border-bottom: none; }
.buy-panel a { color: var(--ink); font-weight: 600; }
.detail-line { font-size: 13px; opacity: .7; margin-top: 14px; }

/* --- reviews --- */
.quote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; margin-top: 44px; }
blockquote.review {
  border-left: 2px solid var(--accent); padding: 6px 0 6px 22px;
  font-size: 16px; font-style: italic;
}
blockquote.review cite { display: block; margin-top: 12px; font-style: normal; font-family: 'Marcellus', serif; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }

/* --- footer --- */
.site-footer { background: color-mix(in srgb, var(--ink) 94%, black 6%); color: var(--on-ink); padding: 72px clamp(20px, 6vw, 96px) 36px; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; }
.site-footer .seal { font-size: 44px; }
.site-footer p.line { margin-top: 14px; font-size: 14.5px; opacity: .8; max-width: 34ch; }
.site-footer h4 { font-family: 'Marcellus', serif; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent-on-dark); margin-bottom: 14px; }
.site-footer ul { list-style: none; }
.site-footer ul li { line-height: 2.1; }
.site-footer ul a { color: var(--on-ink); text-decoration: none; font-size: 14.5px; opacity: .85; }
.site-footer ul a:hover { color: var(--accent-on-dark); opacity: 1; }
.site-footer .mini input { width: 100%; padding: 12px; border: 1px solid var(--muted); background: transparent; color: var(--on-ink); font-family: inherit; margin: 8px 0; }
.site-footer .mini .btn { width: 100%; padding: 12px; }
.site-footer .legal { margin-top: 56px; padding-top: 20px; border-top: 1px solid color-mix(in srgb, var(--on-ink) 18%, transparent); font-size: 12.5px; opacity: .6; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.site-footer .legal a { color: inherit; }

/* --- Patreon (serialized-reading invitation; site tokens, not Patreon coral) --- */
.patreon-ornament { display: flex; align-items: center; justify-content: center; }
.patreon-ornament .tassanara {
  font-size: clamp(72px, 13vw, 168px); line-height: 1;
  color: color-mix(in srgb, var(--accent-on-dark) 80%, transparent);
  text-shadow: 0 2px 34px color-mix(in srgb, var(--accent-on-dark) 26%, transparent);
  transform: rotate(-3deg);
}
.footer-patreon {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 18px;
  font-family: 'Marcellus', serif; letter-spacing: .16em; text-transform: uppercase;
  font-size: 12.5px; color: var(--accent-on-dark); text-decoration: none;
}
.footer-patreon::before { content: "◆"; font-size: 9px; opacity: .85; }
.footer-patreon:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 960px) { .patreon-ornament { display: none; } }

/* --- decode eyebrow ornament --- */
.script-ornament { font-family: 'Tassanara', serif; color: var(--accent); font-size: 22px; letter-spacing: .08em; }
.dark-band .script-ornament { color: var(--accent-on-dark); }

/* --- reveal animations (GSAP adds .in; static without JS) --- */
.reveal { opacity: 1; }
html.js .reveal { opacity: 0; transform: translateY(26px); }
html.js .reveal.in { opacity: 1; transform: none; transition: opacity .6s ease-out, transform .6s ease-out; }

/* --- responsive --- */
@media (max-width: 960px) {
  .two-col, .two-col.rev { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .site-nav ul { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; background: color-mix(in srgb, var(--ink) 94%, black 6%); padding: 10px 24px 20px; }
  .site-nav ul.open { display: flex; }
  .site-nav ul a.link { display: block; padding: 12px 0; font-size: 14px; }
  .nav-toggle { display: block; }
  .nav-cta { display: none; } /* avoid brand+Menu+CTA colliding in one row */
  .site-nav ul .nav-cta-mobile { display: block; margin-top: 8px; }
  .site-nav ul .nav-cta-mobile .btn { display: block; text-align: center; }
  .book .cover img { width: 170px; }
  .glossary-section { padding-top: 52px; }
  .glossary-dedication { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero h1 .g.glyph { font-family: 'Fraunces', serif; color: inherit; }
  .glossary-section dt .term-name .g.glyph { font-family: 'Fraunces', serif; color: inherit; }
  .hero h1 .g, .glossary-section dt .term-name .g { transition: none; }
  html.js .reveal { opacity: 1; transform: none; }
  .btn { transition: none; }
  .btn:hover { transform: none; }
}
