/* Chinese reading practice: four full-width bands (intro, reading stage, offer, transcripts) on one
   column. The column is 962px because the Reader's desktop layout needs a 960px frame, and the card's
   borders add two; every band aligns to it. Type follows the homepage (home.css). */

.practice [hidden] { display: none !important; }

.practice-inner { width: min(100%, 1002px); margin: 0 auto; padding-inline: 20px; }
.practice > section + section { border-top: 1px solid var(--border); }
main.practice + footer { margin-top: 0; }

.practice-eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--brand-dark);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.3;
  text-transform: uppercase;
}

.practice h1,
.practice h2 { font-weight: var(--font-weight-bold); letter-spacing: -0.045em; line-height: 1.04; margin: 0; }
.practice h1 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); text-wrap: balance; }
.practice h2 { font-size: clamp(2rem, 4vw, 3rem); }

/* Intro: title and instruction side by side on wide screens, so the Reader stays on the first screen. */
.practice-intro .practice-inner { display: grid; gap: var(--space-3); padding-block: clamp(20px, 2.6vw, 32px) clamp(18px, 2vw, 24px); }
.practice-lede { max-width: 440px; text-wrap: pretty; margin: 0; color: var(--muted); font-size: clamp(1.05rem, 1.8vw, 1.2rem); line-height: 1.65; }
@media (min-width: 800px) {
  .practice-intro .practice-inner { grid-template-columns: 1fr minmax(0, 340px); align-items: end; gap: var(--space-5); }
}

/* Opening: the intro and the reading stage share one off-white band, as the homepage hero does, so the
   title stands apart from the cream navbar and leads straight into the Reader. */
.practice-intro { background: var(--overlay-surface); }
.practice > .practice-intro + .practice-stage { border-top: 0; }
.practice-stage { --reader-h: 560px; background: var(--overlay-surface); padding-block: 0 clamp(18px, 3vw, 32px); }

/* Scene heading, with a margin note beside the Reader on wide screens. */
.practice-stage__head { position: relative; display: flex; align-items: end; justify-content: space-between; gap: var(--space-4); padding: clamp(6px, 1vw, 12px) 0 clamp(12px, 1.6vw, 18px); border-top: 1px solid var(--border); }
.practice-stage .practice-eyebrow { margin-bottom: 4px; }
.practice-stage h2 { font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: -0.03em; }
.practice-teaser { max-width: 560px; margin: 6px 0 0; color: var(--muted); font-size: var(--font-size-sm); line-height: 1.5; }
.practice-callout { flex: 0 1 300px; color: var(--accent); }
.practice-callout p { margin: 0; font-size: var(--font-size-sm); font-style: italic; line-height: 1.45; }
.practice-callout strong { font-style: normal; }
.practice-callout__arrow { display: none; }
@media (min-width: 1400px) {
  .practice-stage .practice-inner { position: relative; }
  /* Arrow on the left pointing back into the Reader, the note running on from the arrow's tail. */
  .practice-callout { position: absolute; top: 200px; left: calc(100% + 4px); z-index: 3; display: flex; align-items: flex-start; gap: 6px; width: 212px; transform: rotate(-2deg); }
  .practice-callout__arrow { display: block; flex: none; width: 46px; height: 38px; margin-top: 0; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
}
@media (max-width: 799px) { .practice-stage { --reader-h: min(540px, calc(100svh - 144px)); } }
/* On phones the header, intro, scene heading and tabs take about 330px of the first screen. */
@media (max-width: 500px) { .practice-stage { --reader-h: max(440px, min(540px, calc(100svh - 330px))); } }
/* On desktop the header, intro, scene heading and tabs take about 400px; the Reader fills the rest of the first screen, within 500-560px. */
@media (min-width: 800px) { .practice-stage { --reader-h: max(500px, min(560px, calc(100svh - 400px))); } }

.practice-fan { display: flex; position: relative; z-index: 2; gap: 4px; padding: 0 12px; margin-bottom: -1px; align-items: end; }
/* Inactive tabs: 80% text ink on the tab grey passes 4.5:1 in both themes (5.3:1 light, 6.2:1 dark). */
.practice-fan { --tab-grey: color-mix(in srgb, var(--bg) 84%, var(--text)); --tab-ink: color-mix(in srgb, var(--text) 80%, var(--tab-grey)); }
.practice-tab {
  display: flex; flex: 0 1 132px; align-items: center; justify-content: center; min-width: 0; min-height: 44px;
  padding: 10px 14px 9px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--tab-grey); color: var(--tab-ink);
  font-size: 15px; font-weight: 600; text-decoration: none; box-shadow: inset 0 -6px 8px -6px #0000001c;
}
.practice-tab:visited { color: var(--tab-ink); }
.practice-tab:hover { color: var(--text); background: color-mix(in srgb, var(--bg) 92%, var(--text)); }
.practice-tab[aria-selected="true"] { min-height: 50px; background: var(--bg); color: var(--text); box-shadow: none; }
.practice-tab:not([href="#for-you"]) { flex-basis: 122px; }
.practice-tab[href="#for-you"] { margin-left: auto; font-style: italic; }
.practice-tab:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

#practice-reader,
.practice-personal { position: relative; z-index: 1; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; box-shadow: var(--shadow); }
#demo-reader { display: block; width: 100%; height: var(--reader-h); border: 0; }
.practice-personal { height: calc(var(--reader-h) + 2px); }

.practice-caption { margin: 14px 0 0; color: var(--muted); font-size: var(--font-size-xs); text-align: center; }

/* "For you": an infographic in the Reader's place and at its height, so choosing it moves nothing below.
   The argument sits beside the chart on wide screens and above it on phones. */
.practice-personal:not([hidden]) { display: flex; flex-direction: column; }
.practice-personal:focus:not(:focus-visible), #practice-reader:focus:not(:focus-visible) { outline: none; }
.fy { flex: 1; min-height: 0; overflow: auto; display: grid; align-content: center; gap: 20px; padding: 24px 16px; }
.fy-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.fy h3 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.25rem); letter-spacing: -0.045em; line-height: 1.04; text-wrap: balance; }
.fy-body { margin: 0; color: var(--muted); line-height: 1.6; }
.fy-kicker { margin: 0; padding-left: 12px; border-left: 3px solid var(--brand); font-weight: 600; line-height: 1.45; }
.fy-copy .btn { margin-top: 6px; }
.fy-figure { margin: 0; }
.fy-graph { display: block; width: 100%; height: auto; overflow: visible; }
.fy-axis { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.fy-dot--k { fill: var(--brand); }
.fy-dot--u { fill: none; stroke: color-mix(in srgb, var(--text) 22%, transparent); stroke-width: 1.4; }
.fy-dot--gap { fill: none; stroke: var(--accent); stroke-width: 2.2; }
.fy-box { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 5 4; }
.fy-area { fill: color-mix(in srgb, var(--brand) 13%, transparent); }
.fy-edge { fill: none; stroke: var(--brand-dark); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.fy-label { font-size: 13px; font-weight: 600; }
.fy-label--box { fill: var(--muted); }
.fy-label--edge { fill: var(--brand-dark); }
.fy-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.fy-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fy-legend__note { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; font-style: italic; text-align: center; }
.fy-key { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.fy-key--k { background: var(--brand); }
.fy-key--gap { border: 2px solid var(--accent); }
@media (min-width: 720px) {
  .fy { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 64px); padding: 28px clamp(28px, 5vw, 56px); }
}
/* Phones: hook, chart, kicker, button, in one column; the paragraph gives way to the chart. */
@media (max-width: 500px) {
  .fy { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 10px 14px; }
  .fy-copy { display: contents; }
  .fy h3 { order: 1; font-size: clamp(19px, 5.6vw, 22px); }
  .fy-body { display: none; }
  .fy-figure { order: 2; }
  .fy-kicker { order: 3; font-size: 14px; line-height: 1.35; }
  .fy-copy .btn { order: 4; align-self: stretch; justify-content: center; margin-top: 2px; }
  .fy-legend { margin-top: 2px; font-size: 11.5px; }
  .fy-legend__note { margin-top: 2px; }
}
@media (max-width: 400px) {
  .fy-glyph { display: none; }
}

/* The "For you" tab stands out in brand teal; once selected it turns to the page colour with a teal stripe. */
/* Dark ink on the teal in both themes: 5.1:1 on light-mode teal, 10:1 on dark-mode teal. */
.practice-tab[href="#for-you"] { gap: 6px; font-style: normal; background: var(--brand); border-color: var(--brand); color: var(--darker); box-shadow: 0 -4px 14px -4px color-mix(in srgb, var(--brand) 60%, transparent); }
.practice-tab[href="#for-you"]:visited { color: var(--darker); }
.practice-tab[href="#for-you"]:hover { color: var(--darker); background: color-mix(in srgb, var(--brand) 85%, var(--bg)); }
.practice-tab[href="#for-you"][aria-selected="true"] { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-bottom: 0; box-shadow: inset 0 3px 0 var(--brand); }
.fy-glyph::before { content: "\2726"; font-size: 0.9em; }

/* Offer and transcripts: homepage-style sections. */
.practice-after,
.practice-versions { padding-block: clamp(76px, 10vw, 126px); }
.practice-versions { background: var(--overlay-surface); }

.practice-copy { max-width: 560px; }
.practice-copy > p:not(.practice-eyebrow) { margin: var(--space-3) 0 0; color: var(--muted); font-size: clamp(1rem, 1.65vw, 1.16rem); line-height: 1.72; }

.practice-split { display: grid; gap: var(--space-5); align-items: center; }
@media (min-width: 800px) { .practice-split { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: clamp(var(--space-5), 7vw, 96px); } }

/* The offer card borrows the homepage's Plus card: brand-tinted border and an inset brand stripe. */
.practice-offer { padding: clamp(var(--space-3), 4vw, var(--space-4)); border: 1px solid color-mix(in srgb, var(--brand) 62%, var(--border)); border-radius: var(--radius); background: var(--overlay-surface); box-shadow: inset 0 4px var(--brand); }
.practice-offer .btn { display: flex; justify-content: center; width: 100%; }
.practice-offer ul { display: grid; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; line-height: 1.5; }
.practice-offer li { color: var(--muted); }
.practice-offer strong { color: var(--text); }
.practice-offer__note { margin: var(--space-3) 0 0; padding-top: var(--space-2); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--font-size-xs); }

.practice-transcripts { display: grid; gap: 10px; margin-top: var(--space-5); }
.practice-transcript details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.practice-transcript summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; font-size: 1.05rem; font-weight: 600; cursor: pointer; list-style: none; }
.practice-transcript summary::-webkit-details-marker { display: none; }
.practice-transcript summary::after { content: "+"; color: var(--brand-dark); font-size: 1.5rem; font-weight: 400; line-height: 1; }
.practice-transcript details[open] summary::after { content: "\2212"; }
.practice-transcript summary:hover { color: var(--brand-dark); }
.practice-transcript details > p { max-width: 760px; margin: 0; padding: 0 20px 20px; white-space: pre-wrap; }
.practice-transcript p[lang="zh-Hans"] { font-family: "Noto Sans SC", "IBM Plex Sans", sans-serif; font-size: 22px; line-height: 1.9; }
.practice-transcript .practice-pinyin { color: var(--muted); font-size: 15px; line-height: 1.8; }
.practice-transcript details > p:last-child { line-height: 1.7; }

@media (max-width: 500px) {
  .practice-inner { padding-inline: 12px; }
  .practice-eyebrow { margin-bottom: 6px; }
  .practice-intro .practice-inner { gap: 6px; padding-block: 12px 12px; }
  .practice h1 { font-size: 26px; letter-spacing: -0.03em; }
  .practice-lede { font-size: 14px; line-height: 1.4; }
  .practice-stage { padding-block: 0 18px; }
  .practice-stage__head { display: block; padding: 8px 0 10px; }
  .practice-teaser { display: none; }
  .practice-stage .practice-eyebrow { margin-bottom: 2px; }
  .practice-stage h2 { font-size: 18px; }
  .practice-callout p { margin-top: 2px; font-size: 13px; }
  .practice-fan { padding: 0; gap: 3px; }
  .practice-tab { flex: 1 1 0; min-height: 40px; padding: 8px 2px; font-size: 13px; }
  .practice-tab[aria-selected="true"] { min-height: 44px; }
  .practice-tab[href="#for-you"] { margin-left: 6px; }
  #practice-reader, .practice-personal { margin-inline: -4px; }
  .practice-caption { margin-top: 10px; font-size: 11px; line-height: 1.3; }
  .practice-offer { padding: var(--space-3); }
  .practice-transcript summary { padding: 14px 16px; }
  .practice-transcript details > p { padding: 0 16px 16px; }
}

/* Six levels and "For you" on a phone: the row says HSK once and each level tab carries its number. */
.practice-fan::before { content: none; }
@media (max-width: 500px) {
  .practice-fan::before { content: "HSK"; align-self: center; margin: 0 4px 0 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
  .practice-tab { padding: 8px 0; }
  .practice-tab__hsk { display: none; }
  .practice-tab[href="#for-you"] { flex: 0 0 auto; padding-inline: 10px; }
}
