/* ==========================================================================
   LearnMandarinStream — site.css
   A self-contained, responsive stylesheet for the 学中文 streaming brand.
   Palette: imperial red (#c1272d) + gold (#e6b422) on a warm paper ground.
   No external fonts, no CDNs — system font stack only.
   ========================================================================== */

:root {
  --red: #c1272d;
  --red-dark: #9c1f24;
  --red-soft: #f6e3e3;
  --gold: #e6b422;
  --gold-dark: #b78a12;
  --ink: #20242b;
  --ink-soft: #555c66;
  --paper: #fdf9f3;
  --paper-2: #f4ece0;
  --white: #ffffff;
  --line: #e7ddcf;
  --shadow: 0 8px 30px rgba(40, 20, 10, 0.12);
  --shadow-sm: 0 3px 12px rgba(40, 20, 10, 0.10);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1160px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
video { max-width: 100%; display: block; }

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; color: var(--ink); }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.hanzi { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", serif; }
.pinyin { color: var(--ink-soft); font-style: italic; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* ----- Buttons ----- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0.7em 1.5em;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--red); color: var(--white); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--red-dark); color: var(--white); }
.btn--gold { background: var(--gold); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn--gold:hover { background: var(--gold-dark); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--white); border-color: rgba(255, 255, 255, 0.7); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.btn--block { display: block; width: 100%; text-align: center; }

/* ----- Header / nav ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(253, 249, 243, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand__logo { width: 38px; height: 38px; }
.brand__name span { color: var(--red); }

.nav__links {
  display: flex;
  gap: 6px;
  margin-left: auto;
  list-style: none;
  padding: 0;
}
.nav__links a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
}
.nav__links a:hover,
.nav__links a[aria-current="page"] {
  background: var(--red-soft);
  color: var(--red-dark);
  text-decoration: none;
}
.nav__cta { margin-left: 6px; }

.nav__toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  width: 44px; height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav__toggle span,
.nav__toggle span::before,
.nav__toggle span::after {
  content: "";
  display: block;
  width: 20px; height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease;
}
.nav__toggle span::before { position: absolute; top: -6px; }
.nav__toggle span::after { position: absolute; top: 6px; }

/* ----- Hero ----- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(230, 180, 34, 0.18), transparent 60%),
    linear-gradient(135deg, #fff 0%, var(--paper-2) 100%);
  border-bottom: 1px solid var(--line);
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
  padding: 64px 0 56px;
}
.hero__eyebrow {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--red);
  background: var(--red-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.hero h1 { margin-bottom: 0.4em; }
.hero__lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 46ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.hero__art { position: relative; }
.hero__art img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.hero__stats {
  display: flex;
  gap: 28px;
  margin-top: 34px;
  flex-wrap: wrap;
}
.hero__stat strong { display: block; font-size: 1.7rem; color: var(--red); }
.hero__stat span { font-size: 0.9rem; color: var(--ink-soft); }

/* ----- Section scaffolding ----- */
.section { padding: 64px 0; }
.section--alt { background: var(--paper-2); border-block: 1px solid var(--line); }
.section__head { max-width: 60ch; margin-bottom: 36px; }
.section__head.center { margin-inline: auto; }
.section__kicker {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--gold-dark);
}

/* ----- Continue watching widget ----- */
.continue {
  display: none;
  margin-top: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.continue.is-visible { display: block; }
.continue__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.continue__label { font-weight: 700; }
.continue__title { color: var(--ink-soft); }
.progress {
  height: 10px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--red));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ----- Video grid ----- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}
.video-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.video-card video,
.video-card .poster {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  object-fit: cover;
}
.video-card__body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.video-card__tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red-dark);
  background: var(--red-soft);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.video-card h3 { margin-bottom: 6px; }
.video-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 14px; }
.video-card .btn { margin-top: auto; align-self: flex-start; }
.video-card__meta {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

/* ----- Audio drills ----- */
.audio-list { display: grid; gap: 16px; }
.audio-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.audio-item__char {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--red);
  min-width: 72px;
  text-align: center;
}
.audio-item__meta .pinyin { font-size: 1.05rem; }
.audio-item audio { width: 100%; margin-top: 8px; }

/* ----- Vocabulary table ----- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table.vocab {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  min-width: 460px;
}
table.vocab caption {
  text-align: left;
  padding: 14px 16px;
  font-weight: 700;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
table.vocab th,
table.vocab td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
table.vocab thead th {
  background: var(--red);
  color: var(--white);
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}
table.vocab tbody tr:nth-child(even) { background: var(--paper); }
table.vocab tbody tr:hover { background: var(--red-soft); }
table.vocab .col-hanzi { font-size: 1.4rem; color: var(--red); font-weight: 600; }
table.vocab .col-pinyin { color: var(--ink-soft); font-style: italic; white-space: nowrap; }

/* ----- Example sentences ----- */
.examples { list-style: none; padding: 0; display: grid; gap: 14px; }
.examples li {
  background: var(--white);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.examples .ex-hanzi { font-size: 1.3rem; color: var(--ink); font-weight: 600; }
.examples .ex-pinyin { color: var(--ink-soft); font-style: italic; }
.examples .ex-en { color: var(--ink); }

/* ----- Tone chips ----- */
.tone-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0; }
.tone-chip {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  min-width: 130px;
  box-shadow: var(--shadow-sm);
}
.tone-chip b { font-size: 1.6rem; color: var(--red); display: block; }
.tone-chip span { font-size: 0.85rem; color: var(--ink-soft); }

/* ----- Quiz ----- */
.quiz {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.quiz__list { list-style: none; counter-reset: q; padding: 0; margin: 0 0 18px; display: grid; gap: 22px; }
.quiz__q { counter-increment: q; }
.quiz__prompt { font-weight: 600; margin-bottom: 10px; }
.quiz__prompt::before {
  content: counter(q);
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  margin-right: 10px;
  background: var(--red);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.85rem;
}
.quiz__options { display: grid; gap: 8px; }
.quiz__options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.quiz__options label:hover { border-color: var(--gold); background: var(--paper); }
.quiz__q.is-correct label.is-picked { border-color: #2e7d32; background: #e8f5e9; }
.quiz__q.is-wrong label.is-picked { border-color: var(--red); background: var(--red-soft); }
.quiz__q.is-wrong label.is-answer { border-color: #2e7d32; background: #e8f5e9; }
.quiz__result { font-weight: 700; margin: 6px 0 0; min-height: 1.4em; }
.quiz__result.is-pass { color: #2e7d32; }
.quiz__result.is-partial { color: var(--gold-dark); }

/* ----- Lesson layout ----- */
.lesson-hero {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: var(--white);
  padding: 40px 0;
}
.lesson-hero .crumbs, .lesson-hero .crumbs a { color: rgba(255,255,255,0.85); }
.lesson-hero h1 { color: var(--white); margin: 8px 0 6px; }
.lesson-hero p { color: rgba(255, 255, 255, 0.9); margin: 0; max-width: 60ch; }
.lesson-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.lesson-badge {
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
}
.crumbs { font-size: 0.85rem; }
.crumbs a:hover { color: #fff; }

.lesson-body { display: grid; grid-template-columns: 1fr; gap: 38px; padding: 48px 0; }
.lesson-section h2 { display: flex; align-items: center; gap: 10px; }
.lesson-player {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #000;
}
.lesson-player video { width: 100%; aspect-ratio: 16 / 9; display: block; }
.lesson-note {
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.95rem;
}

/* ----- Prev / next ----- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
  margin-top: 8px;
}
.lesson-nav a {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
  max-width: 48%;
}
.lesson-nav a:hover { text-decoration: none; border-color: var(--gold); }
.lesson-nav .lbl { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.lesson-nav .ttl { font-weight: 600; color: var(--ink); }
.lesson-nav .next { text-align: right; margin-left: auto; }

/* ----- Testimonials ----- */
.testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.testimonial {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.testimonial p { font-size: 1.02rem; }
.testimonial .stars { color: var(--gold); letter-spacing: 2px; margin-bottom: 8px; }
.testimonial__who { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.testimonial__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.testimonial__name { font-weight: 700; }
.testimonial__role { font-size: 0.85rem; color: var(--ink-soft); }

/* ----- Feature row ----- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; }
.feature {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.feature__icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ----- Lesson index list (on home) ----- */
.lesson-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.lesson-pills a {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  color: var(--ink);
}
.lesson-pills a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

/* ----- CTA banner ----- */
.cta-banner {
  background: linear-gradient(135deg, var(--gold) 0%, var(--red) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
}
.cta-banner h2 { color: #fff; }
.cta-banner p { color: rgba(255, 255, 255, 0.95); max-width: 50ch; margin-inline: auto; }

/* ----- Footer ----- */
.site-footer {
  background: var(--ink);
  color: #cfd4dc;
  padding: 48px 0 28px;
  margin-top: 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}
.site-footer h4 { color: #fff; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer a { color: #cfd4dc; }
.site-footer a:hover { color: #fff; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: #fff; font-weight: 800; }
.footer-brand img { width: 34px; height: 34px; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 32px;
  padding-top: 18px;
  font-size: 0.85rem;
  color: #9aa2ad;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ----- Responsive ----- */
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; padding: 44px 0; }
  .hero__art { order: -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute;
    left: 0; right: 0;
    top: 66px;
    flex-direction: column;
    gap: 2px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 12px 20px;
    display: none;
    box-shadow: var(--shadow-sm);
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 12px; }
  .nav__cta { margin: 6px 0 0; }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .lesson-nav { flex-direction: column; }
  .lesson-nav a { max-width: 100%; }
  .cta-banner { padding: 28px 20px; }
  .audio-item { grid-template-columns: 1fr; text-align: center; }
}

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