/* Landing pages (web/l/). The Calm tokens from lib/theme/app_skin.dart, as in
   web/index.html's splash; a variant restyles by overriding the tokens on
   :root (see /l/ink/). Fonts are the app's own files from the Flutter build. */

@font-face { font-family: Figtree; font-weight: 400; font-display: swap; src: url(/assets/assets/fonts/Figtree-Regular.ttf) format("truetype"); }
@font-face { font-family: Figtree; font-weight: 600; font-display: swap; src: url(/assets/assets/fonts/Figtree-SemiBold.ttf) format("truetype"); }
@font-face { font-family: Literata; font-weight: 400; font-display: swap; src: url(/assets/assets/fonts/Literata-Regular.ttf) format("truetype"); }
@font-face { font-family: Literata; font-weight: 600; font-display: swap; src: url(/assets/assets/fonts/Literata-SemiBold.ttf) format("truetype"); }
@font-face { font-family: Literata; font-style: italic; font-display: swap; src: url(/assets/assets/fonts/Literata-Italic.ttf) format("truetype"); }
/* Vietnamese pages (web/vi/, web/l/vi/): Figtree lacks most Vietnamese letters, so the
   interface face swaps whole, as in the app (AppFonts.uiVietnamese). */
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url(/assets/assets/fonts/ui/BeVietnamPro-Regular.ttf) format("truetype"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url(/assets/assets/fonts/ui/BeVietnamPro-SemiBold.ttf) format("truetype"); }

:root {
  --paper: #F3F6F2; --card: #FFFFFF; --sunken: #E8EEE9; --hairline: #D3DED6;
  --ink: #16211C; --ink2: #4B5B53; --ink3: #7A8A82;
  --accent: #2E6B5B; --on-accent: #FFFFFF; --accent-soft: #D6EAE1; --on-accent-soft: #173F35;
  --new: #B4532A; --new-soft: #F6E3D8;
  --ui: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Literata, "Noto Serif", Cambria, "Times New Roman", serif;
  --hanzi: "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", STSong, SimSun, serif;
  --radius: 20px;
  color-scheme: light;
}
:root[lang="vi"] { --ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1411; --card: #151D19; --sunken: #111915; --hairline: #2A3731;
    --ink: #E3EBE5; --ink2: #A2B2A9; --ink3: #74847B;
    --accent: #7FC4AE; --on-accent: #0E1411; --accent-soft: #1D3A31; --on-accent-soft: #BFE3D5;
    --new: #F0A07A; --new-soft: #3A2419;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1411; --card: #151D19; --sunken: #111915; --hairline: #2A3731;
  --ink: #E3EBE5; --ink2: #A2B2A9; --ink3: #74847B;
  --accent: #7FC4AE; --on-accent: #0E1411; --accent-soft: #1D3A31; --on-accent-soft: #BFE3D5;
  --new: #F0A07A; --new-soft: #3A2419;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--ui); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img, svg { display: block; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 600px) { .wrap { padding: 0 24px; } }
@media (min-width: 1024px) { .wrap { padding: 0 32px; } }

/* Top bar ---------------------------------------------------------------- */
.bar { height: 64px; display: flex; align-items: center; gap: 10px; }
.bar .brand { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 20px/1.25 var(--serif); }
.bar .lang { display: inline-flex; align-items: center; min-height: 48px; padding: 0 8px; color: var(--ink2); text-decoration: none; font-size: 14px; }
.bar .signin { display: inline-flex; align-items: center; min-height: 48px; padding: 0 12px; font-weight: 600; text-decoration: none; }
.m-box { fill: none; stroke: var(--ink); }
.m-glyph { fill: var(--ink); }
.m-rule { stroke: var(--ink2); opacity: .6; }

/* Type ------------------------------------------------------------------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 34px; line-height: 1.12; letter-spacing: -0.3px; }
h2 { font-size: 26px; line-height: 1.2; }
h3 { font-size: 18px; line-height: 1.3; }
.lede { margin: 14px 0 0; font-size: 17px; line-height: 1.55; color: var(--ink2); max-width: 560px; }
.eyebrow { font: 600 12px/1.2 var(--ui); letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
@media (min-width: 960px) {
  h1 { font-size: 50px; line-height: 1.06; letter-spacing: -0.6px; }
  h2 { font-size: 32px; }
  .lede { font-size: 19px; }
}

/* Buttons ---------------------------------------------------------------- */
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px;
  border-radius: 14px; background: var(--accent); color: var(--on-accent); font: 600 16px/1.2 var(--ui); text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease; }
.cta:hover { box-shadow: 0 6px 18px -8px var(--accent); }
.cta:active { transform: translateY(1px); }
.cta-row { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.cta-note { margin: 0; font-size: 14px; color: var(--ink2); text-align: center; }
@media (min-width: 600px) { .cta-row { align-items: flex-start; } .cta-note { text-align: left; } }
/* The CTA arm: /go can send a visitor to a page with ?cta=signup. */
[data-when="signup"] { display: none; }
.cta-signup [data-when="guest"] { display: none; }
.cta-signup [data-when="signup"] { display: revert; }

/* Sections --------------------------------------------------------------- */
.hero { display: grid; gap: 28px; padding: 12px 0 48px; }
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr) 520px; align-items: center; gap: 56px; padding: 40px 0 72px; }
}
section.band { padding: 48px 0; border-top: 1px solid var(--hairline); }
.steps { display: grid; gap: 20px; margin-top: 24px; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 32px; } }
.step { display: flex; gap: 14px; }
.step .num { flex: none; width: 44px; height: 44px; border: 1px solid var(--ink3); border-radius: 8px; background: var(--card);
  display: grid; place-items: center; font: 400 24px/1 var(--hanzi); color: var(--accent); }
.step p { margin: 4px 0 0; color: var(--ink2); }
.faq { margin-top: 20px; display: grid; gap: 10px; max-width: 760px; }
.faq details { background: var(--card); border: 1px solid var(--hairline); border-radius: 14px; padding: 0 16px; }
.faq summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; font-weight: 600; }
.faq details p { margin: 0 0 16px; color: var(--ink2); }
.closing { text-align: center; padding: 56px 0 64px; border-top: 1px solid var(--hairline); }
.closing .cta-row { align-items: center; }
.closing .cta-note { text-align: center; }
footer { padding: 24px 0 40px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--ink2); }
footer .links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; }
footer a { color: var(--ink2); }

/* The reading sample (sample.js) ----------------------------------------- */
.sample { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px; min-width: 0; }
@media (min-width: 600px) { .sample { padding: 20px 22px; } }
.sample-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sample-head .eyebrow { flex: 1; }
.sample-src { font-size: 13px; color: var(--ink2); }
.sample-tools { display: flex; gap: 8px; margin-top: 12px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--paper);
  color: var(--ink2); font: 600 13px/1 var(--ui); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--on-accent-soft); }
.text { margin: 12px 0 0; font: 400 22px/1.4 var(--hanzi); }
.text p { margin: 0 0 6px; }
.text .w { display: inline-block; line-height: 1.25; margin-top: 6px; cursor: pointer; border-radius: 6px; padding: 0 1px; -webkit-tap-highlight-color: transparent; }
.text .w:hover { background: var(--sunken); }
.text .w.open { background: var(--ink); color: var(--paper); }
.text .w.open rt { color: inherit; opacity: .85; }
.text .w.new { box-shadow: inset 0 -2px 0 var(--new); }
.text .w.new.open { box-shadow: none; }
.text ruby rt { font: 400 12px/1.2 var(--serif); color: var(--ink2); }
.text.no-pinyin ruby rt { visibility: hidden; }
.text .s-open { background: var(--accent-soft); border-radius: 6px; }
.gloss { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); min-height: 88px; }
.gloss-word { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gloss .zh { font: 400 30px/1.15 var(--hanzi); }
.gloss .py { font: 600 17px/1.3 var(--serif); }
.gloss .en { margin: 8px 0 0; font: italic 400 14px/1.55 var(--serif); color: var(--on-accent-soft); }
.gloss .hint { margin: 0; color: var(--on-accent-soft); font-size: 14px; }
.tag-new { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--new-soft); color: var(--new); font: 600 12px/1.4 var(--ui); }
.play { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px;
  background: var(--card); color: var(--accent); font: 600 13px/1 var(--ui); cursor: pointer; margin-top: 8px; }
@media (min-width: 960px) { .text { font-size: 25px; } .text ruby rt { font-size: 13.5px; } }

/* The example chapters (examples.js, the levels page) --------------------- */
.sample-tools { flex-wrap: wrap; }
.text rt.off { visibility: hidden; }
.stat { margin: 12px 0 0; font: 600 14px/1.4 var(--ui); color: var(--accent); }
.grid { margin-top: 18px; border-collapse: separate; border-spacing: 4px; width: 100%; font: 600 13px/1.2 var(--ui); }
.grid th { color: var(--ink2); font-weight: 600; text-align: center; padding: 4px; }
.grid th[scope="row"] { text-align: left; }
.grid td button { width: 100%; min-height: 40px; border: 0; border-radius: 10px; background: var(--sunken); color: var(--ink);
  font: 600 14px/1 var(--ui); cursor: pointer; }
.grid td.own button { background: var(--accent-soft); color: var(--on-accent-soft); }
.grid td.on button { box-shadow: inset 0 0 0 2px var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ex-label { margin-top: 14px; }
.text .en-para { margin: 2px 0 14px; font: italic 400 15px/1.55 var(--serif); color: var(--ink2); }
.text .en-para .en-open { background: var(--accent-soft); color: var(--on-accent-soft); border-radius: 4px; }
.ex-note { margin-top: 0; font-size: 15px; }

/* The example chapters (examples.js) ------------------------------------ */
/* The app's three reading styles (HanziStyle), cut to the examples'
   characters by tool/build_landing_data.py examples. */
@font-face { font-family: ExKai; font-display: swap; src: url(/l/fonts/ex-kai.woff) format("woff"); }
@font-face { font-family: ExSong; font-display: swap; src: url(/l/fonts/ex-song.woff) format("woff"); }
@font-face { font-family: ExHei; font-display: swap; src: url(/l/fonts/ex-hei.woff) format("woff"); }
.ex-style-kai, .text.ex-style-kai { font-family: ExKai, "Kaiti SC", STKaiti, KaiTi, var(--hanzi); }
.ex-style-song, .text.ex-style-song { font-family: ExSong, var(--hanzi); }
.ex-style-hei, .text.ex-style-hei { font-family: ExHei, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; }

.ex-you { display: grid; gap: 4px; }
.ex-you .sample-tools { margin-top: 4px; }
.ex-cards { display: grid; gap: 14px; margin-top: 18px; }
@media (min-width: 900px) { .ex-cards { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); } }
.ex-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--hairline); background: var(--card); cursor: pointer; }
.ex-card:hover { border-color: var(--accent); }
.ex-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ex-badge { font: 600 12px/1.3 var(--ui); padding: 4px 10px; border-radius: 999px; background: var(--sunken); color: var(--ink2); }
.ex-badge.own { background: var(--accent-soft); color: var(--on-accent-soft); }
.ex-badge.harder { background: var(--new-soft); color: var(--new); }
.ex-card-note { font-size: 13px; color: var(--ink2); }
.text.ex-preview { margin-top: 4px; font-size: 20px; }
.text.ex-preview .w { cursor: inherit; }
.text.ex-preview .w:hover { background: none; }
.ex-card-read { align-self: flex-start; margin-top: auto; min-height: 48px; padding: 0; border: 0; background: none;
  color: var(--accent); font: 600 15px/1.2 var(--ui); cursor: pointer; }
.ex-card-read:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ex-why { margin-top: 16px; max-width: 760px; }
.ex-why summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; font-weight: 600; }
.ex-why p { margin: 0 0 8px; color: var(--ink2); }

/* The reading view: full screen on phones, a panel on wider screens. */
html:has(dialog.ex-reader[open]) { overflow: hidden; }
.ex-reader { padding: 0; border: 0; margin: 0; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh;
  max-height: 100vh; max-height: 100dvh; background: var(--paper); color: var(--ink); overflow: hidden; }
.ex-reader[open] { display: flex; flex-direction: column; }
.ex-reader::backdrop { background: rgba(0, 0, 0, .45); }
@media (min-width: 800px) {
  .ex-reader { width: 760px; max-width: calc(100vw - 48px); height: calc(100vh - 48px); height: calc(100dvh - 48px);
    max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); margin: 24px auto; border-radius: var(--radius);
    border: 1px solid var(--hairline); }
}
.ex-head { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--card); border-bottom: 1px solid var(--hairline); }
.ex-title { flex: 1; min-width: 0; }
.ex-title h2 { font-size: 16px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-icon { min-width: 48px; min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--ink);
  font: 600 18px/1 var(--ui); cursor: pointer; }
.ex-icon:hover, .ex-icon[aria-expanded="true"] { background: var(--sunken); }
.ex-listen { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font: 600 14px/1 var(--ui); cursor: pointer; white-space: nowrap; }
.ex-aa-panel { padding: 4px 16px 12px; background: var(--card); border-bottom: 1px solid var(--hairline); }
.ex-row { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; margin-top: 8px; }
.ex-row .sample-tools { margin-top: 0; }
.ex-row-label { min-width: 84px; font: 600 13px/1.2 var(--ui); color: var(--ink2); }
.ex-style-note { margin: 6px 0 0; font-size: 13px; color: var(--ink2); }
.ex-controls { padding: 2px 16px 10px; border-bottom: 1px solid var(--hairline); }
.ex-controls .sample-tools { margin-top: 8px; }
.ex-for { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: var(--ink2); }
.ex-for select { min-height: 40px; max-width: 100%; padding: 0 10px; border-radius: 10px; border: 1px solid var(--hairline);
  background: var(--paper); color: var(--ink); font: inherit; }
.ex-controls .stat { margin-top: 8px; }
.ex-body { flex: 1; overflow-y: auto; padding: 4px 16px 200px; -webkit-overflow-scrolling: touch; }
.text .ex-chtitle { font-size: 1.15em; margin-bottom: 12px; }
.text .s.playing { background: var(--accent-soft); border-radius: 6px; }
.text .g { white-space: nowrap; }
.ex-end { margin: 28px 0 8px; padding: 18px; display: grid; gap: 10px; justify-items: start; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--hairline); }
.ex-end-title { margin: 0; font: 600 20px/1.3 var(--serif); }
.ex-end-body { margin: 0; color: var(--ink2); }
.ex-compare { min-height: 48px; padding: 0; border: 0; background: none; color: var(--accent); font: 600 15px/1.2 var(--ui); cursor: pointer; }
.ex-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 60%; overflow-y: auto;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--hairline);
  border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .35); }
.ex-sheet-word { display: flex; align-items: flex-start; gap: 12px; }
.ex-sheet-word .zh { font-size: 34px; line-height: 1.2; }
.ex-sheet-mean { flex: 1; min-width: 0; padding-top: 4px; }
.ex-sheet-mean .py { font: 600 17px/1.3 var(--serif); }
.ex-hsk { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--sunken); color: var(--ink2); font: 600 12px/1.4 var(--ui); }
.ex-sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-sheet .play { min-height: 40px; background: var(--accent-soft); color: var(--on-accent-soft); }
.ex-sheet .en { margin: 8px 0 0; font: italic 400 15px/1.55 var(--serif); color: var(--ink2); }
