/* mathfinch.com: the public website. Same Goldfinch tokens as the app (src/ui/styles.css), so the two look like one product. */
@font-face { font-family: "Lexend"; font-weight: 400; font-display: swap; src: url("/fonts/lexend-400.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-weight: 600; font-display: swap; src: url("/fonts/lexend-600.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url("/fonts/atkinson-400.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url("/fonts/atkinson-700.woff2") format("woff2"); }

:root {
  --paper: #faf7ef; --grid: #ece4d0; --surface: #ffffff; --ink: #1d2621; --ink-soft: #4d5a52; --rule: #ddd4bf;
  --pine: #1f3a2e; --pine-ink: #f6eccb; --rod: #0f6e78; --rod-soft: #d6eeee; --sun: #f2b705; --on-sun: #1d2621;
  --finch: #d7263d; --leaf: #17784c; --leaf-bg: #e3f4ea; --amber-bg: #fff4d6; --amber-line: #d9a300; --focus: #9a6a00;
  --font-head: "Lexend", system-ui, sans-serif; --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --radius-lg: 24px; --radius: 14px; --shadow: 0 1px 2px rgba(31, 58, 46, .06), 0 8px 24px rgba(31, 58, 46, .08);
  --wrap: 1120px; --mark: color-mix(in srgb, var(--sun) 70%, transparent); color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111714; --grid: #1c241f; --surface: #18201b; --ink: #eef2ec; --ink-soft: #b5c0b8; --rule: #2f3b34;
    --pine: #0c1511; --rod: #5cc8cf; --rod-soft: #173a3c; --leaf: #6fd3a1; --leaf-bg: #133326; --amber-bg: #3a300f;
    --focus: #f2b705; --mark: color-mix(in srgb, #f2b705 32%, transparent); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
html { background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 5.2vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--rod); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: .925rem; }
.eyebrow { font-family: var(--font-head); font-size: .85rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--rod); margin-bottom: .75rem; }

/* header */
.site-head { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--font-head); font-weight: 600; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand svg { width: 46px; height: 31px; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { white-space: nowrap; }
.nav a:not(.btn) { color: var(--ink); text-decoration: none; font-family: var(--font-head); font-size: .95rem; padding: .5rem .75rem; border-radius: 10px; }
.nav a:not(.btn):hover, .nav a[aria-current="page"] { background: var(--rod-soft); }
@media (max-width: 720px) {
  .site-head .wrap { flex-wrap: wrap; gap: .25rem .75rem; padding-top: .5rem; padding-bottom: .4rem; }
  .head-cta { margin-left: auto; min-height: 44px; padding: .5rem 1rem; font-size: .95rem; }
  .nav { order: 3; width: 100%; margin: 0 -.5rem; }
  .nav a:not(.btn) { padding: .4rem .5rem; font-size: .95rem; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .75rem 1.35rem; border-radius: 999px; font-family: var(--font-head); font-weight: 600; font-size: 1rem; text-decoration: none; border: 2px solid var(--pine); color: var(--ink); background: var(--surface); transition: transform .15s ease, filter .15s ease; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn.primary { background: var(--sun); color: var(--on-sun); border-color: var(--pine); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { min-height: 56px; padding: .9rem 1.75rem; font-size: 1.1rem; }
@media (prefers-color-scheme: dark) { .btn { border-color: var(--sun); } .btn.primary { border-color: var(--sun); } }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

/* sections */
section { padding: clamp(56px, 8vw, 104px) 0; }
.band { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.dark { background: var(--pine); color: var(--pine-ink); background-image: none; }
.dark h2, .dark h3 { color: #fff; }
.dark .eyebrow { color: var(--sun); }
.dark a:not(.btn) { color: #fff; }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-soft); max-width: 40em; }
.dark .lead { color: var(--pine-ink); }
.section-head { max-width: 46rem; margin-bottom: 2.5rem; }

/* hero */
.hero { padding-top: clamp(40px, 6vw, 80px); overflow: hidden; }
.hero .wrap:not(.stages-wrap) { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero .lead { max-width: 30em; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--mark) 62%); }
.hero .note { margin-top: 1.25rem; }
.hero-art { position: relative; display: flex; justify-content: center; isolation: isolate; }
.phone { width: min(330px, 78vw); border-radius: 44px; padding: 10px; background: #0f1a14; box-shadow: 0 30px 60px rgba(31, 58, 46, .25), 0 0 0 1px rgba(0, 0, 0, .2); }
.phone img { border-radius: 34px; }
.hero-art .phone.back { position: absolute; transform: translate(-30%, 7%) rotate(-7deg) scale(.84); opacity: .95; z-index: -1; }
.hero-art .finch { position: absolute; right: -6px; top: -14px; width: 112px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .18)); transform: rotate(8deg); }
@media (max-width: 860px) {
  .hero .wrap:not(.stages-wrap) { grid-template-columns: 1fr; }
  .hero-art { margin-top: 1.5rem; }
  .hero-art .phone.back { display: none; }
}

/* stage strip */
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: clamp(40px, 6vw, 72px); }
.stage { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s ease; }
.stage:hover { transform: translateY(-2px); }
.stage b { display: block; font-family: var(--font-head); font-size: 2rem; line-height: 1.1; color: var(--rod); }
.stage span { font-family: var(--font-head); font-weight: 600; }
.stage small { display: block; color: var(--ink-soft); font-size: .9rem; }
@media (max-width: 720px) { .stages { grid-template-columns: repeat(2, 1fr); } }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; }
.step { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; flex-direction: column; }
.step .shot { margin-top: auto; padding-top: 1rem; }
.step .shot img { border-radius: 18px; border: 1px solid var(--rule); }
.step h3::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-right: .6rem; border-radius: 50%; background: var(--sun); color: var(--on-sun); font-size: 1rem; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } .step .shot img { max-width: 320px; margin: 0 auto; } }

/* feature grid */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.feature { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.35rem; }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--rod-soft); color: var(--rod); margin-bottom: .85rem; }
.feature .ico svg { width: 24px; height: 24px; }
.feature p { margin: 0; color: var(--ink-soft); }
@media (max-width: 860px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* promise list (privacy band) */
.promises { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2rem; }
.promises div { border-top: 3px solid var(--sun); padding-top: 1rem; }
.promises p { margin: 0; }
@media (max-width: 760px) { .promises { grid-template-columns: 1fr; } }

/* split */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.callout { background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.callout p:last-child { margin-bottom: 0; }

/* gallery */
.gallery { display: flex; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x mandatory; padding: .5rem 20px 1.5rem; margin: 0 -20px; }
.gallery figure { flex: 0 0 auto; width: 240px; margin: 0; scroll-snap-align: start; }
.gallery img { border-radius: 28px; box-shadow: var(--shadow); border: 1px solid var(--rule); }
.gallery figcaption { font-size: .925rem; color: var(--ink-soft); margin-top: .6rem; text-align: center; }

/* cta */
.cta { text-align: center; }
.cta .actions { justify-content: center; }
.cta h2 { max-width: 20em; margin-left: auto; margin-right: auto; }

/* page hero (inner pages) */
.page-hero { padding: clamp(40px, 6vw, 72px) 0 clamp(24px, 4vw, 40px); }
.page-hero .lead { margin-bottom: 0; }

/* prose */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.6rem; margin-top: 2.2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: .4em; }
.prose-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: clamp(20px, 4vw, 48px); box-shadow: var(--shadow); }
.prose-card > :first-child { margin-top: 0; }
.toc { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.toc a { display: inline-block; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); text-decoration: none; font-size: .925rem; }

/* faq */
.faq { max-width: 46rem; }
.faq details { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: .75rem; }
.faq summary { cursor: pointer; padding: 1rem 1.25rem; font-family: var(--font-head); font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--rod); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 1.25rem 1rem; }
.faq details > div p:last-child { margin-bottom: 0; }

/* lessons catalogue */
.catalogue-tools { position: sticky; top: 68px; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: .9rem 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 720px) { .catalogue-tools { top: 0; position: static; } }
.catalogue-tools .wrap { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.search { flex: 1 1 260px; min-height: 48px; border: 2px solid var(--rule); border-radius: 999px; padding: .6rem 1.1rem; font: inherit; color: var(--ink); background: var(--surface); }
.search:focus { border-color: var(--rod); outline: none; box-shadow: 0 0 0 3px var(--rod-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips a { padding: .4rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); text-decoration: none; font-family: var(--font-head); font-size: .9rem; color: var(--ink); }
.chips a:hover { border-color: var(--rod); }
.stage-block { padding: 2.5rem 0 1rem; }
.stage-block > h2 { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.stage-block > h2 small { font-family: var(--font-body); font-weight: 400; font-size: 1rem; color: var(--ink-soft); letter-spacing: 0; }
.year { margin: 1.5rem 0 2rem; }
.year > h3 { font-size: 1.1rem; color: var(--rod); margin-bottom: .75rem; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; list-style: none; margin: 0; padding: 0; }
.lesson { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1rem; }
.lesson h4 { font-family: var(--font-head); font-weight: 600; font-size: 1rem; margin: 0 0 .3rem; letter-spacing: -0.01em; }
.lesson p { margin: 0; font-size: .925rem; color: var(--ink-soft); line-height: 1.5; }
.tag { display: inline-block; margin-top: .55rem; font-size: .78rem; font-family: var(--font-head); padding: .15rem .55rem; border-radius: 999px; background: var(--rod-soft); color: var(--ink); }
.empty { padding: 2rem 0; }

/* footer */
.site-foot { background: var(--pine); color: var(--pine-ink); padding: 48px 0 40px; background-image: none; }
.site-foot a { color: #fff; }
.site-foot .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-foot .brand { color: #fff; }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li { margin-bottom: .45rem; }
.site-foot .legal { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 2rem; padding-top: 1.25rem; font-size: .9rem; }
@media (max-width: 720px) { .site-foot .cols { grid-template-columns: 1fr 1fr; } .site-foot .cols > :first-child { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
