/* MetaScholar — landing page
   Zero dependencies, zero external requests (self-contained by design: no CDN fonts,
   no analytics, no trackers). Award-craft per 00_CEO kb/ai-design-and-frontend-craft.md §5:
   modular type scale, 4/8 spacing, WCAG AA contrast, full keyboard operability,
   prefers-reduced-motion honoured, LCP element is text (no hero image to block paint). */

/* ── tokens ─────────────────────────────────────────────── */
:root {
  --paper:      #fbfaf7;   /* warm off-white — reads as paper, not screen */
  --paper-2:    #f2efe9;
  --ink:        #171c24;
  --ink-2:      #414b58;   /* 7.0:1 on --paper */
  --ink-3:      #626d7c;   /* 4.8:1 on --paper — smallest text still AA */
  --rule:       #e2ddd3;
  --accent:     #8a5a1c;   /* burnt amber — 5.6:1 on --paper */
  --accent-ink: #6d4715;
  --card:       #ffffff;
  --shadow:     0 1px 2px rgba(23,28,36,.05), 0 8px 24px -12px rgba(23,28,36,.14);

  --serif: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;

  /* fluid modular scale ≈1.25 */
  --s1: clamp(.82rem, .8rem + .1vw, .875rem);
  --s2: clamp(.95rem, .92rem + .15vw, 1.02rem);
  --s3: clamp(1.06rem, 1rem + .3vw, 1.2rem);
  --s4: clamp(1.3rem, 1.18rem + .55vw, 1.6rem);
  --s5: clamp(1.7rem, 1.45rem + 1.1vw, 2.3rem);
  --s6: clamp(2.1rem, 1.6rem + 2.1vw, 3.3rem);

  --gap: 8px;
  --pad: clamp(20px, 5vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #12151a;
    --paper-2: #171b22;
    --ink:     #e8ecf2;
    --ink-2:   #b3bcc9;
    --ink-3:   #8b95a3;
    --rule:    #262c36;
    --accent:  #e0a758;   /* 8.3:1 on --paper */
    --accent-ink: #eebd7c;
    --card:    #191e26;
    --shadow:  0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}

/* ── base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font: var(--s3)/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.015em; }
p { text-wrap: pretty; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip:focus { left: 0; top: 0; }

.wrap { width: min(1080px, 100% - var(--pad) * 2); margin-inline: auto; }
.wrap.narrow { width: min(720px, 100% - var(--pad) * 2); }
.reset { list-style: none; padding: 0; }
.center { text-align: center; }
.dim { color: var(--ink-3); }

section { padding-block: clamp(56px, 9vw, 104px); }
.band { background: var(--paper-2); border-block: 1px solid var(--rule); }

.section-title {
  font-size: var(--s5);
  margin-bottom: clamp(28px, 4vw, 44px);
}

/* ── nav ────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.navrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: var(--s4); font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: -.02em;
}
.mark { width: 27px; height: 27px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linejoin: round; }
.mark .thin { stroke-width: 1.6; }
.mark .dot { fill: var(--accent); stroke: none; }
.nav nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 26px); }
.nav nav a { color: var(--ink-2); text-decoration: none; font-size: var(--s2); }
.nav nav a:hover { color: var(--ink); }
/* The nav link rule (0,2,1) outranks .btn (0,1,0), which silently stripped the button's
   white label down to --ink-2 — 1.50:1 on the amber, a hard WCAG failure that looked
   plausible in a screenshot. Restate it at matching specificity. */
.nav nav a.btn { color: #fff; }
.nav nav a.btn:hover { color: #fff; }
@media (max-width: 640px) { .nav nav a:not(.btn) { display: none; } }

/* ── buttons ────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: var(--accent); color: #fff;
  padding: 13px 24px; border-radius: 7px;
  font-size: var(--s2); font-weight: 600; text-decoration: none;
  border: 1px solid transparent;
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--accent-ink); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 8px 15px; font-size: var(--s1); box-shadow: none; }
.btn-lg { padding: 16px 30px; font-size: var(--s3); }
@media (prefers-color-scheme: dark) {
  .btn, .btn:hover,
  .nav nav a.btn, .nav nav a.btn:hover { color: #17130c; }
}

.btn-ghost {
  display: inline-block; padding: 13px 4px;
  color: var(--ink-2); font-size: var(--s2); text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--accent); }

/* ── hero ───────────────────────────────────────────────── */
/* Top padding stays modest so the primary CTA clears the fold on a laptop —
   the landing rule in kb/ai-design-and-frontend-craft.md §6. */
.hero { padding-block: clamp(40px, 6vw, 72px) clamp(48px, 7vw, 88px); }
.eyebrow {
  font-size: var(--s1); letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent-ink); font-weight: 600; margin-bottom: 20px;
}
.hero h1 { font-size: var(--s6); max-width: 20ch; }
.hero h1 em { font-style: italic; color: var(--accent-ink); }
.lede {
  font-size: var(--s4); line-height: 1.55; color: var(--ink-2);
  max-width: 62ch; margin-top: clamp(20px, 3vw, 30px);
}
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(14px, 3vw, 28px); margin-top: 36px; }
.micro { font-size: var(--s1); color: var(--ink-3); margin-top: 16px; }

/* ── the bind ───────────────────────────────────────────── */
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(20px, 3.5vw, 40px); }
.cols-2.tight { gap: clamp(24px, 4vw, 52px); }
.bind {
  border-left: 3px solid var(--rule);
  padding-left: clamp(18px, 2.4vw, 26px);
}
.bind h3 { font-size: var(--s4); margin-bottom: 10px; }
.bind p { color: var(--ink-2); font-size: var(--s2); }
.pull {
  margin-top: clamp(30px, 4.5vw, 50px);
  font-family: var(--serif); font-size: var(--s4); line-height: 1.5;
  max-width: 60ch; color: var(--ink);
}
.pull strong { color: var(--accent-ink); font-weight: 600; }

/* ── cards ──────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: var(--gap); gap: clamp(14px, 2vw, 22px); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); gap: clamp(16px, 2vw, 24px); align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 11px;
  padding: clamp(20px, 2.6vw, 28px);
  box-shadow: var(--shadow);
}
.card h3 { font-size: var(--s3); margin-bottom: 9px; }
.card p { font-size: var(--s2); color: var(--ink-2); }
.num {
  display: block; font-family: var(--serif); font-size: var(--s2);
  color: var(--accent); letter-spacing: .1em; margin-bottom: 12px;
}

/* ── steps ──────────────────────────────────────────────── */
.steps { display: grid; gap: clamp(24px, 3.4vw, 38px); max-width: 780px; }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: clamp(16px, 2.4vw, 26px); align-items: start; }
.step-n {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent-ink); font-family: var(--serif); font-size: var(--s3);
}
.steps h3 { font-size: var(--s4); margin-bottom: 7px; }
.steps p { color: var(--ink-2); font-size: var(--s2); }

/* ── pricing ────────────────────────────────────────────── */
.price { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.price.featured { border-color: var(--accent); border-width: 1.5px; }
.badge {
  align-self: flex-start;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-ink);
  font-size: var(--s1); font-weight: 600;
  padding: 4px 11px; border-radius: 99px;
}
.amount { font-family: var(--serif); font-size: var(--s4); color: var(--ink) !important; }
.card-lede { font-size: var(--s2); }

.ticks li, .crosses li {
  position: relative; padding-left: 27px; margin-bottom: 9px;
  font-size: var(--s2); color: var(--ink-2);
}
.ticks li::before {
  content: ""; position: absolute; left: 4px; top: .55em;
  width: 11px; height: 6px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.crosses li::before {
  content: "×"; position: absolute; left: 4px; top: -.05em;
  color: var(--ink-3); font-size: 1.25em;
}
.mini { font-size: var(--s3); margin-bottom: 14px; }

/* ── about ──────────────────────────────────────────────── */
.bio { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 3.4vw, 36px); align-items: start; }
.portrait {
  width: clamp(112px, 14vw, 168px); height: auto; aspect-ratio: 1;
  border-radius: 50%; object-fit: cover; object-position: center 22%;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--rule), var(--shadow);
}
.bio-name { font-family: var(--serif); font-size: var(--s4); color: var(--ink) !important; line-height: 1.2; }
.bio-role {
  font-size: var(--s1); text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-ink) !important; font-weight: 600; margin: 5px 0 16px !important;
}
@media (max-width: 560px) { .bio { grid-template-columns: 1fr; } }

.about p { color: var(--ink-2); max-width: 64ch; }
.about p + p { margin-top: 18px; }
.about-lede { font-size: var(--s4); line-height: 1.55; color: var(--ink) !important; font-family: var(--serif); }

.credential {
  font-size: var(--s2); color: var(--ink-2); margin-top: 18px;
  padding-top: 16px; border-top: 1px solid var(--rule); max-width: 46ch;
}
.credential cite { font-style: italic; color: var(--accent-ink); }

/* ── book ───────────────────────────────────────────────── */
.book {
  display: grid; grid-template-columns: auto 1fr;
  gap: clamp(18px, 3vw, 30px); align-items: center;
  margin-top: clamp(30px, 4vw, 44px);
  padding: clamp(20px, 2.8vw, 28px);
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 11px; box-shadow: var(--shadow);
}
.book-cover {
  display: grid; place-items: center; text-align: center;
  width: 94px; height: 130px; flex-shrink: 0;
  background: linear-gradient(150deg, var(--ink) 0%, #2c3542 100%);
  border-radius: 3px 7px 7px 3px;
  border-left: 4px solid var(--accent);
  font-family: var(--serif); font-size: var(--s2); line-height: 1.3;
  color: var(--paper); padding: 10px;
}
@media (prefers-color-scheme: dark) {
  .book-cover { background: linear-gradient(150deg, #2c3542 0%, #3a4553 100%); color: #f2f5f9; }
}
.book-kicker {
  font-size: var(--s1); text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-ink); font-weight: 600; margin-bottom: 7px;
}
.book h3 { font-size: var(--s3); margin-bottom: 9px; }
.book h3 cite { font-style: italic; }
.book p { font-size: var(--s2); }
@media (max-width: 520px) {
  .book { grid-template-columns: 1fr; justify-items: start; }
}

/* ── faq ────────────────────────────────────────────────── */
details { border-bottom: 1px solid var(--rule); }
details:first-of-type { border-top: 1px solid var(--rule); }
summary {
  cursor: pointer; list-style: none;
  padding: 21px 40px 21px 0; position: relative;
  font-family: var(--serif); font-size: var(--s4); line-height: 1.35;
  transition: color .18s ease;
}
summary::-webkit-details-marker { display: none; }
summary:hover { color: var(--accent-ink); }
summary::after {
  content: ""; position: absolute; right: 8px; top: 50%;
  width: 10px; height: 10px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .22s ease;
}
details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
details p { padding-bottom: 24px; color: var(--ink-2); font-size: var(--s2); max-width: 68ch; }

/* ── final ──────────────────────────────────────────────── */
/* This section INVERTS in light mode (dark panel, light text) but not in dark mode, so its
   children must derive from the section's own foreground — never from --paper directly.
   Referencing --paper here shipped dark-on-dark text in dark mode (1.05:1, invisible). */
.final { background: var(--ink); color: var(--paper); --on-final: var(--paper); }
.final h2 { font-size: var(--s5); margin-bottom: 16px; }
.final .lede { color: color-mix(in srgb, var(--on-final) 78%, transparent); margin-inline: auto; margin-bottom: 34px; }
.final .micro { color: color-mix(in srgb, var(--on-final) 62%, transparent); margin-top: 24px; }
.final .micro a { color: var(--on-final); }
@media (prefers-color-scheme: dark) {
  .final { background: var(--paper-2); color: var(--ink); --on-final: var(--ink); }
}

/* ── footer ─────────────────────────────────────────────── */
footer { padding-block: 32px; border-top: 1px solid var(--rule); }
.footrow { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: var(--s1); color: var(--ink-3); }
