/* Math Discover site — mirrors the app's design tokens (DesignSystem/Tokens.swift). */
@font-face { font-family: "Bebas Neue"; src: url("/assets/fonts/BebasNeue-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/IBMPlexMono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/IBMPlexMono-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --forest: #1B4332;   /* accentGreen500 */
  --pine: #12332A;     /* accentGreen600 */
  --sage: #4C7A67;     /* accentGreen300 */
  --paper: #F4F6F4;    /* grey50 */
  --mist: #E7EBE8;     /* grey100 */
  --rule: #D5DCD8;     /* grey300 */
  --muted: #616B67;    /* grey500 */
  --ink-2: #48524E;    /* grey700 */
  --ink: #161A18;      /* grey900 */
  --error: #B3413B;
  --display: "Bebas Neue", "Oswald", "Arial Narrow", sans-serif;
  --text: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 66ch;
  --gutter: clamp(16px, 4vw, 40px);
  --grid: 24px;
}
/* Bebas Neue and Plex Mono have no Arabic/CJK (Bebas: no Cyrillic either) — use the system faces there. */
:lang(uk) { --display: system-ui, -apple-system, "Segoe UI", sans-serif; }
:lang(zh-Hans) { --display: "PingFang SC", "Noto Sans SC", system-ui, sans-serif; --text: "PingFang SC", "Noto Sans SC", system-ui, sans-serif; }
:lang(ar) { --display: "SF Arabic", "Geeza Pro", "Noto Sans Arabic", system-ui, sans-serif; --text: "SF Arabic", "Geeza Pro", "Noto Sans Arabic", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.65 var(--text);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--forest); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--pine); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--sage); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1; color: var(--forest); margin: 0 0 .4em; }
:lang(uk) :is(h1, h2, h3), :lang(zh-Hans) :is(h1, h2, h3), :lang(ar) :is(h1, h2, h3) { font-weight: 700; line-height: 1.15; }
h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); letter-spacing: .01em; }
h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
h3 { font-size: 1.75rem; }
:lang(uk) h1, :lang(zh-Hans) h1, :lang(ar) h1 { font-size: clamp(2rem, 5.2vw, 3.6rem); }
:lang(uk) h2, :lang(zh-Hans) h2, :lang(ar) h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
:lang(uk) h3, :lang(zh-Hans) h3, :lang(ar) h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

/* Header / footer */
.site-header, .site-footer, main > * { padding-inline: var(--gutter); }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 16px; border-bottom: 1px solid var(--rule); background: var(--paper);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest); }
.wordmark img { border-radius: 8px; }
.wordmark span { font: 400 1.6rem/1 "Bebas Neue", sans-serif; letter-spacing: .02em; }
.site-header nav, .footer-links { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: .9rem; }
.site-header nav a, .footer-links a { color: var(--ink-2); text-decoration: none; }
.site-header nav a:hover, .footer-links a:hover { color: var(--forest); text-decoration: underline; }
[aria-current="page"] { color: var(--forest) !important; text-decoration: underline !important; }
.site-footer { border-top: 1px solid var(--rule); padding-block: 32px 40px; display: grid; gap: 16px; font-size: .85rem; color: var(--muted); }
.languages { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.languages a { color: var(--ink-2); }
.languages a[aria-current] { color: var(--forest); font-weight: 700; text-decoration: none; }
.copy { margin: 0; }
.social { margin: 0; }
.social a { display: inline-flex; align-items: center; gap: 8px; color: var(--forest); font-weight: 600; text-decoration: none; }
.social a:hover { text-decoration: underline; }

/* Home: the one loud moment — a sheet of squared exercise paper with the Genius at the board. */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; gap: clamp(16px, 4vw, 56px);
  padding-block: clamp(40px, 8vw, 96px);
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(76, 122, 103, .14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(76, 122, 103, .14) 1px, transparent 1px);
  background-size: var(--grid) var(--grid);
  border-bottom: 2px solid var(--forest);
}
.hero h1 { max-width: 13ch; }
:lang(uk) .hero h1, :lang(zh-Hans) .hero h1, :lang(ar) .hero h1 { max-width: 18ch; }
.hero .lead { max-width: 52ch; color: var(--ink-2); }
.cta-row { margin: 1em 0 .5em; display: flex; align-items: center; gap: 1.25em; flex-wrap: wrap; }
.qr-box { display: none; align-items: center; gap: .75em; font-size: .85rem; max-width: 16em; }
.qr-box svg { width: 88px; height: 88px; flex: none; }
@media (min-width: 900px) { .qr-box { display: inline-flex; } }
.store-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 64px; padding: 0 36px; border-radius: 18px;
  background: var(--forest); color: var(--paper); font-weight: 700; font-size: 1.2rem;
  text-decoration: none; box-shadow: 0 8px 24px rgba(27, 67, 50, .28);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.store-button:hover { color: var(--paper); text-decoration: none; background: var(--pine); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(27, 67, 50, .34); }
.store-button:focus-visible { outline: 3px solid var(--sage); outline-offset: 3px; }
@media (max-width: 560px) { .store-button { width: 100%; padding: 0 20px; font-size: 1.05rem; text-align: center; } }
.platform { color: var(--muted); font-size: .9rem; }
.hero-art { width: min(100%, 460px); justify-self: center; }

section, aside { padding-block: clamp(48px, 7vw, 88px); }
.flow h2, .modes h2 { max-width: var(--measure); }
.steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; counter-reset: step; }
.step { counter-increment: step; position: relative; padding-top: 8px; border-top: 2px solid var(--forest); }
.step::before { content: counter(step); display: block; font: 400 2.4rem/1 "Bebas Neue", sans-serif; color: var(--sage); margin: 8px 0 4px; }
.step-art { width: 132px; margin: 4px 0 12px; }
.step h3 { margin-bottom: .3em; }
.step p { color: var(--ink-2); font-size: .95rem; }

.modes { background: var(--mist); }
.section-lead { max-width: var(--measure); color: var(--ink-2); }
.mode-pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); margin-top: 24px; }
.mode-art { width: 180px; margin-bottom: 12px; }
.mode p { max-width: 40ch; color: var(--ink-2); }

.library { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px); }
.library p { max-width: var(--measure); color: var(--ink-2); }

.ai-note { border-top: 1px solid var(--rule); }
.ai-note h2 { font-size: 1.6rem; }
.ai-note p { max-width: var(--measure); color: var(--ink-2); }

/* Legal + contact: a quiet reading column */
.legal, .contact, .not-found { max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; padding-block: clamp(32px, 6vw, 72px); }
.legal h1, .contact h1 { font-size: clamp(2.4rem, 6vw, 3.8rem); }
.legal h2 { font-size: 1.8rem; margin-top: 1.6em; }
:lang(uk) .legal h2, :lang(zh-Hans) .legal h2, :lang(ar) .legal h2 { font-size: 1.25rem; }
.legal h3 { font-size: 1.3rem; margin-top: 1.2em; }
:lang(uk) .legal h3, :lang(zh-Hans) .legal h3, :lang(ar) .legal h3 { font-size: 1.05rem; }
.legal ul { padding-inline-start: 1.2em; }
.legal li { margin-bottom: .5em; }
.updated { color: var(--muted); font-size: .9rem; }
.translation-note { background: var(--mist); padding: 12px 16px; border-inline-start: 3px solid var(--sage); font-size: .9rem; }
.lead { font-size: 1.05rem; }

.contact form { display: grid; gap: 6px; margin: 24px 0; }
.contact label { font-weight: 700; font-size: .9rem; margin-top: 10px; }
.contact input, .contact textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 12px;
  padding: 12px 14px; width: 100%;
}
.contact input:focus, .contact textarea:focus { outline: 3px solid var(--sage); outline-offset: 1px; border-color: var(--sage); }
.contact button {
  justify-self: start; margin-top: 16px; font: 700 1rem var(--text); color: var(--paper); background: var(--forest);
  border: 0; border-radius: 14px; padding: 14px 24px; cursor: pointer;
}
.contact button:hover { background: var(--pine); }
.contact button[disabled] { opacity: .6; cursor: progress; }
.form-status { min-height: 1.6em; margin-top: 8px; }
.form-status.error { color: var(--error); }
.form-status.ok { color: var(--forest); font-weight: 700; }
.fine { font-size: .85rem; color: var(--muted); }
.hp { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
.lost-art { width: 200px; margin-bottom: 16px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { width: min(70%, 320px); grid-row: 1; justify-self: start; }
  .steps { grid-template-columns: 1fr 1fr; }
  .library { grid-template-columns: 1fr; }
  .library img { width: 160px; }
}
@media (max-width: 520px) {
  .steps, .mode-pair { grid-template-columns: 1fr; }
  .site-header nav { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
