/* HSK Dragon website. Colours, radii and type are the app's D2 night theme
   (ui/theme/ExtendedColors.kt DarkExtendedColors, Shapes.kt, Type.kt), named by role. */

@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url(../fonts/baloo2-semibold.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(../fonts/baloo2-bold.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(../fonts/baloo2-extrabold.woff2) format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 400; font-display: swap; src: url(../fonts/nunito-sans-regular.woff2) format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 600; font-display: swap; src: url(../fonts/nunito-sans-semibold.woff2) format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 700; font-display: swap; src: url(../fonts/nunito-sans-bold.woff2) format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 800; font-display: swap; src: url(../fonts/nunito-sans-extrabold.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --paper: #101c26;
  --surface: #1f3140;
  --inset: #182937;
  --ink: #f0ebe0;
  --ink-muted: #a3b6c7;
  --line: #2b4153;
  --card-edge: rgb(240 235 224 / 0.15);
  --accent: #f2b680;
  --accent-soft: #33302f;
  --on-accent: #2a1606;
  --selected: #2a4155;
  --correct: #93bfaf;
  --correct-soft: #1c3236;
  --correct-text: #a9d4c8;
  --highlight: #e3c27e;
  --highlight-soft: #33302a;
  --wrong: #e08a7a;
  --wrong-soft: #2b2830;
  --link: #96b9d9;
  --link-soft: #243848;
  --nav: #0b151d;
  --seal: #b8382f;

  --listening: #93bfaf;
  --reading: #e3c27e;
  --writing: #e8a27c;
  --speaking: #b4c9e3;

  --r-chip: 8px;
  --r-tile: 12px;
  --r-card: 16px;
  --r-dialog: 24px;

  --display: "Baloo 2", "Nunito Sans", system-ui, sans-serif;
  --body: "Nunito Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --hanzi: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --measure: 1312px; /* 1232px of content: three 384px screenshots with 40px gaps */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* The app's paper grain (d2_grain), laid over everything at low strength. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url(../img/grain.webp) repeat;
  background-size: 384px;
  opacity: 0.05;
  pointer-events: none;
  z-index: 100;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 800; line-height: 1.12; margin: 0; text-wrap: balance; }
p { margin: 0; }
.hz { font-family: var(--hanzi); }
.muted { color: var(--ink-muted); }
.eyebrow {
  font: 800 12px/16px var(--body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Buttons ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--r-card);
  border: 0;
  font: 800 16px/22px var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn-cta { background: var(--accent); color: var(--on-accent); }
.btn-cta:hover { background: #f6c697; color: var(--on-accent); }
.btn-quiet { background: var(--selected); color: var(--ink); }
.btn-quiet:hover { background: #33506a; color: var(--ink); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: var(--r-tile); }
.btn svg { flex: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-chip);
  background: var(--inset);
  font: 700 12px/1 var(--body);
  color: var(--ink-muted);
  white-space: nowrap;
}

/* --- Top bar ----------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(16 28 38 / 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.brand span { font: 800 20px/1 var(--display); padding-top: 3px; }
.topbar nav { display: flex; gap: 24px; margin-left: auto; }
.topbar nav a { color: var(--ink-muted); text-decoration: none; font-weight: 700; font-size: 15px; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--ink); }
@media (max-width: 720px) { .topbar nav { display: none; } .topbar .btn { margin-left: auto; } }

/* --- Footer ------------------------------------------------------------------------------ */
.footer { border-top: 1px solid var(--line); margin-top: 96px; padding: 40px 0 56px; background: var(--nav); }
.footer .wrap { display: grid; gap: 24px; grid-template-columns: 1fr auto; align-items: start; }
.footer p { color: var(--ink-muted); font-size: 14px; max-width: 62ch; }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; }
@media (max-width: 720px) { .footer .wrap { grid-template-columns: 1fr; } }

/* --- Shared bits --------------------------------------------------------------------------- */
.tile { width: 44px; height: 44px; border-radius: var(--r-tile); flex: none; }
.section-kind { display: inline-flex; align-items: center; gap: 6px; }
.section-kind::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--k, var(--ink-muted)); }
.k-listening { --k: var(--listening); }
.k-reading { --k: var(--reading); }
.k-writing { --k: var(--writing); }
.k-speaking { --k: var(--speaking); }

.play-badge { display: inline-flex; align-items: center; gap: 12px; }
.play-badge svg { width: 22px; height: 22px; }

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