/* habloop.com styles. System fonts only, no external resources (plan: issue #33).
   Colours, type sizes, radii and spacing are copied from app/src/theme.js (PALETTE, TYPE, R, SP)
   so site and app look like one brand. Change them there first, then here.
   Colours carry meaning: -ar blue, -er green, -ir purple, irregular orange. Never decoration. */

:root {
  /* PALETTE.light */
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface2: #E9EBEF;
  --text: #12151A;
  --muted: #5E6778;
  --line: #E4E7EC;
  --accent: #12151A;
  --on-accent: #FFFFFF;
  --ok: #137639;
  --bad: #C81E1E;
  --mid: #C08400;
  --ok-bg: #ECFDF3;
  --bad-bg: #FEF2F2;
  --ar: #1D4ED8;
  --er: #137639;
  --ir: #7C3AED;
  --irr: #B54708;

  /* R */
  --r-s: 12px;
  --r-l: 20px;

  /* SP */
  --sp-xs: 4px;
  --sp-s: 8px;
  --sp-m: 12px;
  --sp-l: 16px;
  --sp-xl: 24px;
  --sp-xxl: 32px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 38rem; /* about 68 characters a line at 17px: the reading width */
}

@media (prefers-color-scheme: dark) {
  :root {
    /* PALETTE.dark */
    --bg: #0C0F14;
    --surface: #171B22;
    --surface2: #222833;
    --text: #F2F4F7;
    --muted: #98A2B3;
    --line: #2B323D;
    --accent: #F2F4F7;
    --on-accent: #0C0F14;
    --ok: #4ADE80;
    --bad: #F87171;
    --mid: #FACC15;
    --ok-bg: #12301F;
    --bad-bg: #3A1717;
    --ar: #60A5FA;
    --er: #4ADE80;
    --ir: #A78BFA;
    --irr: #FB923C;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  /* TYPE.body: 17/24 */
  font-size: 1.0625rem;
  line-height: 1.5;
}

.site-header,
.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--sp-l);
}

.site-header {
  padding-top: var(--sp-l);
  padding-bottom: var(--sp-s);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-s);
}

.lang-switch { display: flex; gap: var(--sp-xs); }

.lang-switch a {
  /* TYPE.sub: 15/20 */
  font-size: 0.9375rem;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}

.lang-switch a[aria-current="page"] { font-weight: 700; border-color: var(--text); }

.brand {
  /* TYPE.headline: 20/26 */
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

/* The logo (#71): logo.svg / logo-on-dark.svg, 32px high (brand minimum 20px). Magenta lives only in
   these files and the favicon: never as a CSS colour for text, buttons or meaning. */
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: var(--r-s);
}

.brand img { display: block; height: 32px; width: auto; }

.page { padding-bottom: var(--sp-xxl); }

h1 {
  /* TYPE.title: 28/34 */
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: var(--sp-xxl) 0 var(--sp-m);
}

a { color: var(--text); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Language choice at / */
.choices {
  list-style: none;
  margin: var(--sp-xl) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-m);
}

.choice {
  display: block;
  min-height: 48px;
  padding: var(--sp-l);
  background: var(--surface);
  border-radius: var(--r-s);
  font-weight: 600;
  text-decoration: none;
}

/* Home and How it works (#35) */
p { margin: 0 0 var(--sp-l); }

.lead {
  /* TYPE.headline: 20/26 */
  font-size: 1.25rem;
  line-height: 1.3;
}

.more { font-weight: 600; }

/* Children's book word page (#158): the Spanish word large, the reader's word under it. */
.kids-word { font-size: 3rem; line-height: 1.1; margin-bottom: var(--sp-m); }
.kids-words li { font-size: 1.25rem; margin-bottom: var(--sp-s); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: var(--sp-l);
  margin: var(--sp-xl) 0 0;
}

.card p { margin: 0; }

/* The address must stay readable at 375px: break it rather than overflow. */
.feedback a { overflow-wrap: anywhere; }

.steps {
  margin: 0 0 var(--sp-xl);
  padding-left: var(--sp-xl);
}

.steps li { margin-bottom: var(--sp-s); }

/* Privacy (#36) */
h2 {
  /* TYPE.headline: 20/26 */
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
  text-wrap: balance;
  margin: var(--sp-xxl) 0 var(--sp-s);
}

h3 {
  /* TYPE.body: 17/24, semibold: a sub-heading inside a section */
  font-size: 1.0625rem;
  line-height: 1.3;
  font-weight: 600;
  margin: var(--sp-xl) 0 var(--sp-xs);
}

/* The address must stay readable at 375px: break it rather than overflow. */
.email { overflow-wrap: anywhere; }

/* 404 (#36): one card per language. */
.not-found { margin-top: var(--sp-m); }

/* Footer on every page (#36): the privacy link. */
.site-footer {
  max-width: var(--measure);
  margin: var(--sp-xxl) auto 0;
  padding: var(--sp-m) var(--sp-l) var(--sp-xxl);
  border-top: 1px solid var(--line);
  /* TYPE.sub: 15/20 */
  font-size: 0.9375rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--sp-xl);
}

.site-footer a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-footer a[aria-current="page"] { color: var(--text); }

/* Company line (#89): wraps at 375px, links stay readable. */
.site-footer .company { margin: var(--sp-s) 0 0; color: var(--muted); overflow-wrap: anywhere; }
.site-footer .company a { display: inline; min-height: 0; text-decoration: underline; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Books (#80). The buy button is not active until a book is out: a plain outlined label, not a link. */
.book-list { list-style: none; margin: 0; padding: 0; }
.book-item { display: flex; gap: var(--sp-m); align-items: flex-start; }
.book-item p { margin: var(--sp-xs) 0 0; }
.cover-thumb { flex: 0 0 auto; width: 6rem; border: 1px solid var(--line); }
.book-bullets { padding-left: var(--sp-xl); }
.book-bullets li { margin-bottom: var(--sp-xs); }
/* App page (#80): the level list and a quiet note. */
.levels, .method { list-style: none; margin: 0; padding: 0; }
.levels .card, .method .card { margin-top: var(--sp-m); }
.note { color: var(--muted); font-size: 0.9375rem; margin-top: var(--sp-m); }
.cover { max-width: 100%; height: auto; border-radius: var(--r-s); }
.button-off {
  display: inline-block;
  padding: var(--sp-s) var(--sp-l);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--muted);
}

/* Learn pages (#80, part 5): verb tables. Colours carry meaning: -ar blue, -er green, -ir purple, irregular orange. */
.fam-ar { color: var(--ar); }
.fam-er { color: var(--er); }
.fam-ir { color: var(--ir); }
.irr { color: var(--irr); font-weight: 700; }
.table-wrap { overflow-x: auto; margin: var(--sp-m) 0 var(--sp-l); background: var(--surface); border-radius: var(--r-s); }
.table-wrap:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.verbs { border-collapse: collapse; width: 100%; font-size: 0.9375rem; line-height: 1.3; }
.verbs caption { text-align: left; font-weight: 600; padding: var(--sp-m) var(--sp-m) var(--sp-xs); }
.verbs th, .verbs td { padding: var(--sp-s) var(--sp-m); text-align: left; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
.verbs thead th { border-top: 0; font-weight: 600; }
.verbs tbody th { font-weight: 600; }
.verbs b { font-weight: 700; }
.gloss { color: var(--muted); font-weight: 400; font-size: 0.8125rem; }
.short { color: var(--muted); font-weight: 400; }
.verbs tbody th { white-space: normal; }
.verbs th, .verbs td { padding-left: 10px; padding-right: 10px; }

/* Home: the app, coming soon (#89). A quiet label, no colour meaning. */
.app-soon { margin-bottom: var(--sp-l); }
.app-soon h2 { margin-top: 0; }
.badge { display: inline-block; font-size: 0.8125rem; font-weight: 600; padding: 2px var(--sp-s); border: 1px solid var(--line); border-radius: var(--r-s); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.app-soon p { margin-bottom: var(--sp-m); }
.app-soon p:last-child { margin-bottom: 0; }
/* Early users who give feedback (#172): the same quiet card, no new colour. */
.early-users h2 { margin-top: 0; }
.early-users p { margin-bottom: var(--sp-m); }
.early-users p:last-child { margin-bottom: 0; }
.early-users a { overflow-wrap: anywhere; }
.legal-updated { margin-top: 0; }

/* Home: real app screenshots (#89) */
.shots { margin: var(--sp-m) 0; }
.shots-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-s); }
.shots img { width: 100%; height: auto; border-radius: var(--r-s); border: 1px solid var(--line); }
.shots figcaption { font-size: 0.8125rem; color: var(--muted); margin-top: var(--sp-s); }

/* Main menu in the header (#101): four plain links under the logo; wraps on a narrow screen, every link 44px high. */
.site-nav { flex-basis: 100%; display: flex; flex-wrap: wrap; column-gap: var(--sp-xl); }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 700; }
.site-nav a:focus-visible, .lang-switch a:focus-visible, .site-footer a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Method and Teachers (#101): sections separated by a hairline, calm lists, the honest notes set apart. No game look, no colour meaning. */
.concept + .concept { border-top: 1px solid var(--line); margin-top: var(--sp-xl); }
.concept h2 { margin-top: var(--sp-xl); }
.concept > :last-child { margin-bottom: 0; }
.plan { margin: 0 0 var(--sp-m); padding-left: var(--sp-xl); }
.plan li { margin-bottom: var(--sp-xs); }
.note-strong { border-left: 3px solid var(--line); padding-left: var(--sp-m); margin: var(--sp-l) 0; }
.refs { margin: var(--sp-s) 0 0; padding-left: var(--sp-l); font-size: 0.9375rem; }
.refs li { margin-bottom: var(--sp-m); overflow-wrap: anywhere; }
.can, .use { margin: var(--sp-s) 0 var(--sp-m); padding-left: var(--sp-xl); }
.use { padding-left: var(--sp-l); }
.can li, .use li { margin-bottom: var(--sp-s); }
.levels .card p { margin-bottom: var(--sp-s); }
.levels .card .note { margin-top: 0; }
.links { margin-top: var(--sp-xxl); }

/* AI tutor waiting list (#102): the one form of the site. Plain controls, 44px targets, colours from the palette only. The honeypot
   is moved off screen (not display:none) so people never see it and simple bots still fill it in. */
.tutor-soon { margin: var(--sp-xl) 0; }
.tutor-soon h2 { margin-top: 0; }
.tutor-soon p { margin-bottom: var(--sp-m); }
.tutor-soon p:last-child { margin-bottom: 0; }
.waitlist-card h2 { margin-top: 0; }
.waitlist label { display: block; font-weight: 600; margin-bottom: var(--sp-xs); }
.waitlist input[type="email"] { width: 100%; box-sizing: border-box; min-height: 44px; padding: var(--sp-s) var(--sp-m); font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--muted); border-radius: var(--r-s); }
.waitlist .wl-consent { display: flex; gap: var(--sp-m); align-items: flex-start; }
.waitlist .wl-consent input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; }
.waitlist .wl-consent label { font-weight: 400; margin: 0; }
.waitlist button { min-height: 44px; padding: var(--sp-s) var(--sp-xl); font: inherit; font-weight: 600; color: var(--on-accent); background: var(--accent); border: 0; border-radius: var(--r-s); cursor: pointer; }
.waitlist input:focus-visible, .waitlist button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.wl-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Book pages (#118): a typographic cover until the design team delivers the real one, the facts, the contents and the sample chapter.
   Existing colours only; no art that does not exist. */
.cover-text { display: flex; flex-direction: column; justify-content: space-between; box-sizing: border-box; width: 12rem; max-width: 100%; aspect-ratio: 2 / 3; margin: var(--sp-l) 0; padding: var(--sp-l); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); color: var(--text); }
.cover-text span { font-size: 1.125rem; font-weight: 700; line-height: 1.25; }
.cover-text small { color: var(--muted); font-size: 0.8125rem; }
.book-facts { list-style: none; margin: 0; padding: 0; }
.book-facts li { margin-bottom: var(--sp-s); }
.toc { margin: 0; padding-left: var(--sp-xl); }
.toc li { margin-bottom: var(--sp-xs); }
.sample { max-width: var(--measure); }
.sample em { font-style: italic; }
.sample-table { border-collapse: collapse; width: 100%; margin: var(--sp-l) 0; }
.table-wrap > .sample-table { margin: 0; } /* the wrapper carries the spacing (#175) */
.sample-table th, .sample-table td { border: 1px solid var(--line); padding: var(--sp-s) var(--sp-m); text-align: left; vertical-align: top; }
.sample-table thead th { background: var(--surface2); }

/* Learning articles (#147): example tables wrap (sentences are long), the wrong form is struck through, the link list is plain. Text only, no new colours. */
.verbs.wrap td { white-space: normal; min-width: 8rem; }
.mistake h2 { margin-top: 0; }
.wrong { text-decoration: line-through; }
.more-list { list-style: none; padding-left: 0; }
.more-list li { margin-bottom: var(--sp-s); }

/* The sample's exercises (#171), as the book prints them: number, instruction, prompt with a blank, answer options. No answer key. */
.sample s { text-decoration: line-through; }
.sample-ex { list-style: none; margin: 0; padding: 0; }
.sample-ex li { margin-bottom: var(--sp-l); }
.sample-ex .ex-no { font-weight: 700; margin-right: var(--sp-s); }
.sample-ex .ex-instr { color: var(--muted); }
.sample-ex .ex-prompt { display: block; }
.sample-ex .ex-blank { display: inline-block; width: 5em; border-bottom: 1px solid var(--text); height: 1em; vertical-align: baseline; }
.sample-ex .ex-options { display: flex; flex-wrap: wrap; gap: var(--sp-s); margin-top: var(--sp-xs); }
.sample-ex .ex-options span { padding: 0 var(--sp-s); border: 1px solid var(--line); border-radius: var(--r-s); }

/* Two apps on the start page (habloop-kids#3): stacked on a phone, side by side from 40rem. */
.two-apps { margin-top: var(--sp-l); }
.two-apps-grid { display: grid; grid-template-columns: 1fr; gap: 0 var(--sp-m); }
@media (min-width: 40rem) { .two-apps-grid { grid-template-columns: 1fr 1fr; } }
.two-apps h3 { margin: var(--sp-s) 0; }
.two-apps .card p { margin-bottom: var(--sp-s); }
.two-apps .card p:last-child { margin-bottom: 0; }
.app-mark { display: block; height: 56px; width: auto; }
.app-adult .app-mark { height: 32px; margin: 12px 0; }
