@font-face {
  font-family: Qiming;
  src: url("/design-assets/qiming-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: QimingSerif;
  src: url("/design-assets/qiming-serif-edition.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f3efe2;
  --leaf: #1b4233;
  --muted: #45574c;
  --cream: #fcf8e9;
  --gold: #f3d67d;
  --rule: #c9cfba;
  --heading: QimingSerif, "Songti SC", SimSun, "Noto Serif CJK SC", serif;
  background: var(--paper);
  color: var(--leaf);
  font-family: Qiming, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .23em; }
a:focus-visible { outline: 3px solid #a14e15; outline-offset: 4px; }
::selection { background: var(--gold); color: var(--leaf); }
[id] { scroll-margin-top: 18px; }
.layout { width: min(1144px, calc(100% - 72px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 3; top: 8px; left: 12px; padding: 8px 14px; background: var(--cream); transform: translateY(-170%); }
.skip-link:focus { transform: none; }

.site-header { min-height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 10px 24px; }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 9px; font: 650 23px/1.2 var(--heading); text-decoration: none; white-space: nowrap; }
.site-header nav, .subject-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 0 22px; }
.site-header nav a, .subject-tabs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; }
.site-header nav a:hover, .subject-tabs a:hover { color: var(--leaf); text-decoration: underline; }

.cover { display: grid; grid-template-columns: 48% 52%; background: var(--leaf); color: var(--cream); border-radius: 14px; overflow: hidden; }
.cover-copy { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 20px; padding: clamp(28px, 4vw, 54px); }
h1, h2, .chapter h3, .chapter-hook { font-family: var(--heading); font-weight: 680; text-wrap: balance; }
h1 { font-size: clamp(34px, 4vw, 54px); line-height: 1.14; letter-spacing: -.034em; }
h1 span { display: block; }
h1 span:first-child { color: var(--gold); font-size: .61em; line-height: 1.3; margin-bottom: 9px; letter-spacing: 0; }
.cover-copy p { color: #eee9d4; max-width: 24em; font-size: clamp(16px, 1.5vw, 18px); }
.cover-art { width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: 50% 49%; }
.cover-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 17px; }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 14px; border-radius: 7px; background: var(--gold); color: var(--leaf); font-size: 15px; font-weight: 750; text-decoration: none; }
.button:hover { background: #ffe29a; }
.cover a:focus-visible { outline-color: var(--gold); }
.cover-contents { grid-column: 1 / -1; background: #13352a; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; padding: 21px clamp(20px, 4vw, 54px) 23px; }
.cover-contents dt { color: var(--gold); font-size: 15px; font-weight: 750; }
.cover-contents dd { font-weight: 650; }
.cover-contents dd strong { color: var(--cream); font-family: var(--heading); font-size: clamp(28px, 3vw, 40px); font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.cover-contents dd:last-child { font-size: 14px; color: #eee9d4; font-weight: 400; }
.text-link { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; font-size: 15px; font-weight: 750; }
.text-link:hover { text-decoration-thickness: 2px; }

.routine { padding: 31px 36px 32px; margin-block: 24px 68px; border-radius: 14px; background: #e4eadb; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 18px; }
.section-heading p { color: var(--muted); }
h2 { font-size: clamp(26px, 3.1vw, 41px); line-height: 1.26; letter-spacing: -.025em; }
.steps { list-style: none; padding: 0; margin-top: 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 34px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 5px 8px; align-content: start; counter-increment: step; }
.steps li::before { content: counter(step) "."; grid-row: span 2; color: #456850; font-family: var(--heading); font-size: 24px; line-height: 1.2; font-weight: 650; }
.steps h3 { font-size: 18px; line-height: 1.4; }
.steps p { color: var(--muted); }

.subjects > .section-heading { margin-bottom: 12px; }
.subject-tabs { gap: 2px 20px; }
.subject-tabs a { color: var(--leaf); text-decoration: underline; }
.chapter { --chapter-ink: var(--leaf); --chapter-paper: #e6eada; --chapter-rule: #bdc8ad; color: var(--chapter-ink); background: var(--chapter-paper); padding: 31px 36px; border-radius: 14px; }
.chapter + .chapter { margin-top: 15px; }
.chapter.chinese { --chapter-ink: #613d2b; --chapter-paper: #efe5d5; --chapter-rule: #d3bea4; }
.chapter.math { --chapter-ink: #22495c; --chapter-paper: #e2ebee; --chapter-rule: #bacbd1; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1fr); gap: 30px; align-items: center; }
.chapter-lead { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; gap: 20px 34px; }
.chapter-lead > img { width: 100%; height: auto; max-height: 240px; aspect-ratio: 1.9; object-fit: cover; border-radius: 8px; }
.chapter-lead > .poem-art { aspect-ratio: 2.1; object-position: 50% 23%; }
.chapter h3 { font-size: 24px; line-height: 1.3; }
.chapter .chapter-hook { font-size: clamp(25px, 3vw, 34px); line-height: 1.25; margin-block: 8px 10px; letter-spacing: -.025em; }
.chapter .text-link { margin-top: 4px; }
.chapter-lead p:not(.chapter-hook), .math-lead p:not(.chapter-hook) { max-width: 38em; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; list-style: none; padding: 0; margin-top: 16px; }
.chapter.chinese .feature-list, .chapter.math .feature-list { grid-template-columns: minmax(0, 1fr); }
.chapter.math .feature-list { margin: 0; }
.feature-list li { display: grid; grid-template-columns: 7em minmax(0, 1fr); align-items: baseline; gap: 1px 9px; padding-block: 8px; border-top: 1px solid var(--chapter-rule); }
.feature-list a { display: inline-flex; align-items: center; min-height: 44px; width: fit-content; font-weight: 750; }
.feature-list a:hover { text-decoration-thickness: 2px; }
.chapter.chinese .feature-list li { grid-template-columns: 7em minmax(0, 1fr); }

.records { margin-block: 58px 38px; }
.records .section-heading { margin-bottom: 16px; }
.record-list { border-top: 1px solid var(--rule); }
.record-list > div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); align-items: center; gap: 5px 13px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.record-list a { display: inline-flex; align-items: center; gap: 7px; font-size: 17px; font-weight: 750; min-height: 44px; }
.record-list dd, .account-note { color: var(--muted); }
.account-note { margin-top: 20px; }
.account-note strong { color: var(--leaf); }
@media (max-width: 900px) {
  .layout { width: calc(100% - 48px); }
  .cover { grid-template-columns: 48% 52%; }
  .cover-copy { padding: 30px 25px; gap: 15px; }
  .routine, .chapter { padding: 24px; }
  .feature-list li { grid-template-columns: minmax(0, 1fr); gap: 0; padding-block: 3px 10px; }
}

@media (max-width: 640px) {
  .layout { width: calc(100% - 32px); }
  .site-header { padding-block: 8px 5px; min-height: auto; flex-wrap: wrap; gap: 0 10px; }
  .site-header nav { gap: 0 18px; }
  .brand { font-size: 20px; }
  .brand img { width: 31px; height: 29px; }
  .cover { display: flex; flex-direction: column; min-height: 0; }
  .cover-copy { padding: 21px 17px 15px; gap: 12px; }
  h1 { font-size: clamp(34px, 9vw, 44px); }
  .cover-copy p { max-width: 22em; }
  .cover-art { aspect-ratio: 1.42; width: 100%; height: auto; object-position: 50% 51%; }
  .cover-actions { gap: 1px 12px; }
  .cover-contents { gap: 0 10px; padding: 13px 15px 16px; }
  .cover-contents dd { line-height: 1.5; font-size: 14px; }
  .cover-contents dd strong { display: block; font-size: clamp(25px, 7.4vw, 36px); }
  .cover-contents dd:last-child { margin-top: 3px; font-size: 13px; }
  .button, .text-link { font-size: 14px; }
  .button { padding-inline: 11px; gap: 7px; }
  .routine { margin-block: 15px 37px; }
  .routine, .chapter { padding: 21px 16px; }
  .steps { grid-template-columns: 1fr; margin-top: 15px; gap: 17px; }
  .steps li { column-gap: 2px; }
  .chapter-lead, .chapter.math { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .chapter-lead > img { aspect-ratio: 2; }
  .chapter .chapter-hook { margin-top: 5px; }
  .subject-tabs { gap: 0 14px; }
  .feature-list { grid-template-columns: minmax(0, 1fr); margin-top: 17px; }
  .feature-list li, .chapter.chinese .feature-list li { grid-template-columns: 5em minmax(0, 1fr); align-items: start; gap: 7px; padding-block: 7px; }
  .feature-list p { padding-top: 10px; }
  .feature-list a { white-space: nowrap; }
  .records { margin-block: 38px 27px; }
  .records .section-heading { margin-bottom: 11px; }
  .record-list > div { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 0 10px; }
}

@media (max-width: 350px) {
  .cover-actions { gap: 0 9px; }
  .cover-actions .button { gap: 3px; padding-inline: 8px; }
  .feature-list li, .chapter.chinese .feature-list li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .feature-list p { padding-top: 0; }
}
