/*
  style.css - the shared look of englishcadence.com and the practice library.
  This file is the SAME on the main site and the practice site: change one, copy it to the other.
  (Each site adds its own file on top: home.css on the main site,
  library.css on the practice site.)

  November 12, 2026 (v19): the course's redesign (Tuned., v26-v29: direction A "Editorial", palette P1
  graphite and cobalt; claude/redesign-design-doc.md in the Project). What keeps the three sites apart:
    - the course has its "Tuned." wordmark and works like an app (step bar, Back / Continue);
    - the main site keeps the English Cadence logo and reads like a page: a dark welcome panel,
      "What I work on", lesson details and the contact form;
    - the practice library keeps "Practice library" beside the logo and its own layout (a wider column).

  THE DESIGN RULES (the course's; keep to them when adding anything new)
    STRUCTURE No cards. Content sits on the page; type, small capital labels, hairlines and space make
             the structure. To break up text, change the form (the dark panel, an icon beside a label,
             the tinted band, large numerals, more space between groups than inside them), not more lines.
    COLOUR   Cobalt = press to play, and "you are here" (the next lesson, the current page). Nothing else.
             (The logo's full stop is cobalt too: the brand, as on "Tuned.".)
             Dark panel = a summary (the welcome block, a sound's facts, "Start here").
             One per screen at most. Red = record only (and form errors). Green = done / right answer.
             Tinted band = set-aside content (tips, your recordings, notes from the teacher's tools).
    SHAPES   Circles = something you press, or a status (play, record, the "you are here" ring).
             Icons sit bare beside labels (no icon tiles). Corners 3 px on anything rectangular
             (buttons, boxes, panels, bands). Hairlines 1 px.
    TYPE     Inter for text, labels and buttons; Source Serif 4 for titles, example words, practice
             lines and numerals. Page titles: serif 300, 36 px on phones, 46 on computers. Section
             titles serif 24, weight 400. Labels: Inter 11.5 px, 600, capitals, letter spacing 0.14em.
             Body 16 px on phones, 17 on computers.
    LIGHT ON DARK  Serif text shown light on dark looks heavier: serif paragraphs in the dark panel are
             weight 300; serif practice lines on the page in dark mode are weight 300, #DDE1E6.
    TAPPING  Anything you tap is at least 44 px tall to the finger, even if it looks smaller.
    CONTRAST Text at least 4.5:1; control edges (outlines of boxes and buttons) at least 3:1.
    MOTION   Only opacity and transform move, about 0.2 s; none when the device asks for reduced motion.
    HOVER    Change background-COLOR only, never the "background" shorthand, on anything with a
             see-through tap border (it would reset background-clip and the control would grow: v18b bug).

  Fonts (Inter and Source Serif 4) are stored on this site, in the fonts folder, like the course.
  Nothing is loaded from other websites, which keeps the site fast, private and working in China.
*/

@font-face { font-family: "Inter"; src: url("fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-600.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-300.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-600.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-300i.woff2") format("woff2"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/source-serif-4-500i.woff2") format("woff2"); font-weight: 500 700; font-style: italic; font-display: swap; }

/* ---- Colours, light (P1 graphite and cobalt: the course's values) ---- */
:root {
  --ground: #F8F9FA;      /* the page */
  --card: #FFFFFF;        /* the few surfaces that still need one: boxes you type into, word boxes, pop-ups */
  --line: #DDE0E4;        /* hairlines */
  --edge: #878E96;        /* control edges: outlines of boxes and buttons (3:1) */
  --band: #ECEFF3;        /* the tinted band: set-aside content */
  --ink: #14171A;         /* main text and headings */
  --body: #2C3137;        /* body text */
  --muted: #59616A;       /* muted text */
  --accent: #2447C6;      /* cobalt: press to play, and "you are here". Nothing else. */
  --on-accent: #FFFFFF;
  --accent-text: #2447C6; /* cobalt used as text */
  --btn: #14171A; --btn-hover: #2C3137; --btn-text: #FFFFFF;   /* the main button */
  --good: #2F6B43; --good-text: #2F6B43;
  --bad: #B8432F; --bad-text: #A33A27;   /* a warning edge, and form error messages */
  --rec: #B8432F; --rec-glow: rgba(184, 67, 47, 0.2);
  --mark: rgba(36, 71, 198, 0.12);       /* highlighted letters in words */
  --focus: #2447C6;
  --link-line: rgba(20, 23, 26, 0.35);   /* the underline of links in text */
  --shadow: 0 1px 2px rgba(20, 23, 26, 0.05), 0 4px 14px rgba(20, 23, 26, 0.04);
  --pop-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  --danger-tint: #F7E4DF;
  /* the dark panel (a summary): dark in both modes */
  --panel: #14171A; --panel-ink: #F4F5F7; --panel-soft: #E3E6EA; --panel-muted: #A9B0BA;
  --panel-line: #2E343C; --panel-accent: #8FA8FF; --on-panel-accent: #14171A; --panel-edge: transparent;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --page-w: 720px;        /* the reading column (library.css widens it for the practice pages) */
  --t: 200ms; --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Older names (v18 and before), kept so older rules, the teacher pages and the take-home sheet keep working */
  --bar: var(--ground); --heading: var(--ink); --faint: var(--muted); --soft: var(--band); --tint: var(--band);
  --tint-ink: var(--ink); --edge-strong: var(--edge); --field-edge: var(--edge); --card-edge: var(--line);
  --clay: var(--accent); --on-clay: var(--on-accent); --step-text: var(--accent-text); --peach: var(--panel-accent);
  --pale: var(--mark); --hero: var(--panel); --hero-ink: var(--panel-ink); --hero-soft: var(--panel-muted);
  --hero-edge: var(--panel-edge); --link: var(--ink);
  --paper: var(--ground); --navy: var(--ink); --navy-deep: var(--btn-hover); --rule: var(--line);
  --field: var(--card); --clay-deep: var(--accent-text); --error: var(--bad-text);
  color-scheme: light dark;
}
/* ---- Colours, dark (used when <html data-theme="dark">, set by theme.js). Same roles. ---- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0D0F12; --card: #151A20; --line: #252A31; --edge: #5E6772; --band: #151A20;
  --ink: #ECEEF1; --body: #C4C9D0; --muted: #969EA8;
  --accent: #7C9BFF; --on-accent: #0D0F12; --accent-text: #9DB4FF;
  --btn: #ECEEF1; --btn-hover: #C4C9D0; --btn-text: #0D0F12;
  --good: #7CC592; --good-text: #7CC592; --bad: #E8705A; --bad-text: #F2A08C; --rec: #E8705A; --rec-glow: rgba(232, 112, 90, 0.25);
  --mark: rgba(124, 155, 255, 0.2); --focus: #9DB4FF;
  --link-line: rgba(236, 238, 241, 0.45);
  --shadow: 0 0 0 0 transparent;
  --pop-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --danger-tint: #3A2227;
  --panel: #181C22; --panel-ink: #ECEEF1; --panel-soft: #DDE1E6; --panel-muted: #A3ABB6;
  --panel-line: #2C323B; --panel-accent: #9DB4FF; --on-panel-accent: #0D0F12; --panel-edge: #2C323B;   /* the edge is needed: the panel is close to the page */
}
:root[data-theme="light"] { color-scheme: light; }

/* ---- Basics ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
@media (min-width: 1000px) { body { font-size: 17px; line-height: 1.55; } }
[lang="zh"] { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", sans-serif; }
[hidden] { display: none !important; }
p { margin: 0 0 1rem; }
strong { font-weight: 600; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--ink); margin: 0 0 12px; }
h1 { font-size: 36px; font-weight: 300; line-height: 1.06; letter-spacing: -0.015em; max-width: 20em; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 20px; line-height: 1.25; }
em { font-family: var(--serif); font-size: 1.06em; line-height: 1; }   /* example words: serif italic */
main a { color: var(--ink); text-decoration-color: var(--link-line); text-underline-offset: 3px; }
main a:hover { color: var(--ink); text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.lead { font-size: 17px; line-height: 1.5; color: var(--body); max-width: 36em; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; line-height: 1.4; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.stop { color: var(--accent); }
@media (min-width: 1000px) { h1 { font-size: 46px; } .lead { font-size: 18px; } }

/* ---- Header: the course's top bar (logo, then bare text buttons and the light/dark switch) ---- */
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  padding: 10px 20px; background: var(--ground); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.2; letter-spacing: -0.005em; color: var(--ink); text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; flex: none; display: block; }
.logo-box { fill: var(--card); stroke: var(--ink); }
.logo-line { stroke: var(--ink); fill: none; }
.logo-dot { fill: var(--accent); }   /* the full stop: cobalt, as on "Tuned." */
/* "Practice library" beside the logo: small capitals after a thin rule, like the course's "Beta" */
.sitetag { padding-left: 11px; font-family: var(--sans); font-size: 11px; font-weight: 600; line-height: 18px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--edge); white-space: nowrap; }
.barend { display: inline-flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
/* header links and buttons: bare text, 44 px to the finger */
.top .pill {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; margin: 0; padding: 0 8px;
  font: 500 14px/1 var(--sans); color: var(--body); text-decoration: none; white-space: nowrap;
  background: none; border: 0; border-radius: 0; cursor: pointer;
}
.top .pill:hover { color: var(--ink); background-color: transparent; text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 5px; }
@media (min-width: 1000px) { .top { padding: 12px 40px; min-height: 72px; } .barend { gap: 12px; } .brand { font-size: 21px; } }
@media (max-width: 439px) { .top.busy .brand span { display: none; } .top .pill { padding: 0 6px; } }

/* Light / dark switch (theme.js fills it in): a bare icon, with "Auto" / "Light" / "Dark" on wider screens */
.themebtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; min-width: 44px; margin: 0; padding: 0 4px; flex: none;
  font: 400 13px/1 var(--sans); color: var(--body); background: none; border: 0; border-radius: 0; cursor: pointer;
}
.themebtn svg { width: 18px; height: 18px; flex: none; }
.themebtn:hover { color: var(--ink); background-color: transparent; }
button.themebtn { margin-top: 0; }
@media (max-width: 439px) { .themebtn { width: 44px; padding: 0; margin-right: -10px; } .themebtn .thl { display: none; } }

/* ---- Page column ---- */
main { max-width: calc(var(--page-w) + 40px); margin: 0 auto; padding: 0 20px 56px; }
section { padding: 48px 0 0; }
section > h2:first-child { margin-bottom: 12px; }
.hero { padding: 40px 0 8px; }
.hero h1 + .lead { margin-top: 14px; }
@media (min-width: 1000px) { .hero { padding-top: 56px; } section { padding-top: 56px; } }

/* ---- No cards: .card, .panel and .icotile keep their names but lose their boxes ---- */
.card { padding: 0; background: none; border-radius: 0; box-shadow: none; }
.card > :last-child { margin-bottom: 0; }
.panel { padding: 16px 18px; background: var(--band); border-radius: 3px; }   /* = the tinted band */
.icotile, .icotile.sm { width: 20px; height: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: none; border-radius: 0; }
.icotile svg { width: 20px; height: 20px; }
.icotile.sm svg { width: 16px; height: 16px; }

/* The dark panel (the course's "At a glance", Continue and Lesson complete). One per screen at most.
   (.navy is its old name.) The full stop inside it is the panel's cobalt. */
.navy {
  color: var(--panel-ink); background: var(--panel); border-radius: 3px; box-shadow: inset 0 0 0 1px var(--panel-edge);
}
.navy h1, .navy h2, .navy h3 { color: var(--panel-ink); }
.navy .eyebrow { color: var(--panel-accent); }
.navy .lead, .navy p { color: var(--panel-muted); }
.navy .stop { color: var(--panel-accent); }
.navy a:not(.btn) { color: var(--panel-ink); text-decoration-color: var(--panel-muted); }
.navy :focus-visible { outline-color: var(--panel-accent); }

/* ---- Definition lists (lesson details, privacy): rows divided by hairlines ---- */
.plain { margin: 0; border-bottom: 1px solid var(--line); }
.plain dt { margin: 0; padding-top: 14px; font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.3; color: var(--ink); border-top: 1px solid var(--line); }
.plain dd { margin: 4px 0 0; padding-bottom: 14px; color: var(--body); }
.plain + p { margin-top: 1.5rem; }
@media (min-width: 640px) {
  .plain { display: grid; grid-template-columns: 11rem 1fr; }
  .plain dt, .plain dd { margin: 0; padding-top: 15px; padding-bottom: 15px; border-top: 1px solid var(--line); }
  .plain dd { padding-left: 24px; }
  .plain dt { padding-top: 14px; }
}

/* ---- Buttons: 3 px corners; the main one ink, the second an outline ---- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  font: 600 15px/1.3 var(--sans); color: var(--btn-text); background: var(--btn); border: 0; border-radius: 3px;
  text-decoration: none; cursor: pointer; transition: background-color 0.15s ease, transform calc(var(--t) * 0.5) ease-out;
}
button { margin-top: 1.5rem; }
/* hover changes only the colour (not the whole background), so buttons with a see-through tap area keep their size */
button:hover, .btn:hover { background-color: var(--btn-hover); color: var(--btn-text); }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; }
button:disabled:active { transform: none; }

/* secondary: an outline */
.btn.sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 18px;
  font: 500 15px/1.3 var(--sans); color: var(--ink); background-color: transparent; border: 1px solid var(--edge); border-radius: 3px; text-decoration: none; cursor: pointer;
}
.btn.sec:hover { background-color: var(--band); color: var(--ink); }
/* the light button inside the dark panel */
.btn.onhero { color: var(--panel); background-color: var(--panel-ink); }
.btn.onhero:hover { color: var(--panel); background-color: #DDE1E6; }
:root[data-theme="dark"] .btn.onhero:hover { background-color: #FFFFFF; }
.btn svg { width: 14px; height: 14px; flex: none; }

/* ---- Form ---- */
form { margin-top: 8px; }
label { display: block; margin: 18px 0 6px; font-size: 15px; font-weight: 500; color: var(--ink); }
form > label:first-child, form > label:first-of-type { margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; font: inherit; font-size: 16px; line-height: 1.4; color: var(--ink);
  background: var(--card); border: 1px solid var(--edge); border-radius: 3px;
}
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }

#form-status { margin: 1rem 0 0; min-height: 1.5rem; color: var(--ink); }
#form-status.error { color: var(--bad-text); }
#form-status.good { color: var(--good-text); font-weight: 600; }

/* Spam trap: invisible to people */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.cta { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
/* small grey note, such as the privacy line under the contact form */
.aside { color: var(--muted); font-size: 14px; }
.cta + .aside { margin-top: 12px; }

/* ---- Footer: the course's footer ---- */
.bottom {
  max-width: calc(var(--page-w) + 40px); margin: 32px auto 0; padding: 24px 20px 40px;
  font-size: 14px; color: var(--muted); border-top: 1px solid var(--line);
}
.bottom p { margin: 0; }
.bottom p + p { margin-top: 6px; }
.bottom a { display: inline-block; margin: -12px 0; padding: 12px 0; color: var(--muted); text-decoration-color: var(--line); text-underline-offset: 3px; }
.bottom a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---- Toast (short messages at the bottom of the screen) ---- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  padding: 10px 16px; font-size: 14px; color: var(--btn-text); background: var(--btn); border-radius: 3px;
  opacity: 0; pointer-events: none; transition: opacity var(--t) ease;
}
#toast.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { --t: 0ms; }
  button, .btn, #toast { transition: none; }
  button:active, .btn:active { transform: none; }
}
