/* ============================================================
   American Language Center — Shared Stylesheet
   ALC purple-on-light brand. Used by every page.
   Colour/type tokens below are the canonical set from the
   ALC Brand Kit (§3). Legacy navy/blue token slots are kept
   and remapped to brand purples so older selectors keep working.
   ============================================================ */

/* Brand fonts — imported here so every page that links this file
   gets Montserrat/Poppins (+ Yellowtail accent) with no <head> edits.
   (For production you may later move this to <link rel="preconnect">
   + <link> in a shared head for slightly faster first paint.) */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800;900&family=Poppins:ital,wght@0,300;0,400;0,500;0,600;1,400&family=Yellowtail&display=swap');

/* ---------- Design tokens ---------- */
:root {
  /* Brand colours (ALC Brand Kit) */
  --plum-deep:  #1C0830;  /* gradient anchor (darkest) */
  --plum:       #2A0E45;  /* Deep Plum — base/dark, headings on light */
  --deep-royal: #3A1463;  /* hover/pressed dark */
  --royal:      #6A3FA0;  /* Royal Purple — PRIMARY */
  --magenta:    #8A2D87;  /* Magenta — secondary, gradient end */
  --gold:       #F6B74E;  /* Amber Gold — accent / CTA only */
  --gold-light: #FBCF63;  /* Light Gold — hover/highlight */

  /* Light fills */
  --purple-tint:    #E9DFF3;
  --lightest-purple:#F6F1FA;

  /* Legacy slots remapped to brand purples (keep older selectors working) */
  --navy-900: #2A0E45;  --navy-800: #3A1463;  --navy-700: #6A3FA0;
  --blue-600: #6A3FA0;  --blue-500: #8A2D87;
  --blue-100: #E9DFF3;  --blue-50:  #F6F1FA;

  --ink-900:  #241333;
  --ink-700:  #4A3A5C;
  --ink-500:  #75688A;
  --ink-300:  #D4CCDF;
  --ink-200:  #E5DFEC;
  --ink-100:  #F2EEF6;
  --paper:    #ffffff;
  --canvas:   #FAF8FC;

  /* Functional — gold-as-text uses the accessibility-safe darkened gold */
  --accent-amber: #A8730E;
  --accent-amber-soft: #FCEFD4;
  --accent-green: #047857;
  --accent-green-soft: #D1FAE5;
  --accent-red:   #B91C1C;
  --accent-red-soft: #FEE2E2;

  /* Typography — Montserrat (display, 600+) / Poppins (body).
     NOTE: --font-serif now maps to Montserrat per the Brand Kit, so
     legacy selectors that used --font-serif become the display face. */
  --font-sans:  "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI",
                system-ui, sans-serif;
  --font-serif: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI",
                system-ui, sans-serif;
  --font-mono:  "SF Mono", "Menlo", "Consolas", monospace;
  --font-script:"Yellowtail", cursive;  /* brand signature accent (extension) */

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;
  --sp-10: 4rem;

  /* Layout */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(42, 14, 69, 0.08);
  --shadow:    0 4px 12px rgba(42, 14, 69, 0.10);
  --shadow-lg: 0 8px 24px rgba(42, 14, 69, 0.14);
  --maxw:      1080px;
  --maxw-prose: 760px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--canvas);
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-600); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy-800); }
button { font-family: inherit; }

/* Visible keyboard focus (brand) + reduced-motion guard */
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 3px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--navy-900);
  line-height: 1.25;
  margin: 0 0 var(--sp-4);
  font-weight: 700;
}
h1 { font-size: clamp(1.75rem, 2.4vw + 1rem, 2.5rem); }
h2 { font-size: 1.5rem; margin-top: var(--sp-8); }
h3 { font-size: 1.2rem; margin-top: var(--sp-6); }
h4 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em;
     color: var(--navy-700); margin-top: var(--sp-5); }

p { margin: 0 0 var(--sp-4); }
ul, ol { padding-left: 1.4rem; margin: 0 0 var(--sp-4); }
li { margin-bottom: var(--sp-2); }
strong { color: var(--navy-900); }

code, kbd {
  font-family: var(--font-mono);
  background: var(--ink-100);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.92em;
}

hr {
  border: none;
  border-top: 1px solid var(--ink-200);
  margin: var(--sp-6) 0;
}

/* ---------- Top nav ---------- */
.site-nav {
  background: var(--navy-900);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.site-nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.site-nav__brand {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.site-nav__brand-mark {
  display: inline-flex;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  background: var(--gold);
  color: var(--plum);
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-family: var(--font-serif);
}
.site-nav__links {
  display: flex;
  gap: var(--sp-5);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: var(--sp-2) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav__links a:hover,
.site-nav__links a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--blue-500);
}
.site-nav__right {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.site-nav__action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--royal);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.18);
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.site-nav__action:hover {
  background: var(--deep-royal);
  transform: translateY(-1px);
}

/* ---------- Page shell ---------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5);
}
.page--prose { max-width: var(--maxw-prose); }

/* ---------- Crumbs ---------- */
.crumbs {
  font-size: 0.875rem;
  color: var(--ink-500);
  margin-bottom: var(--sp-5);
}
.crumbs a { color: var(--ink-500); text-decoration: none; }
.crumbs a:hover { color: var(--navy-700); text-decoration: underline; }
.crumbs__sep { margin: 0 var(--sp-2); color: var(--ink-300); }

/* ---------- Hero (landing page) ---------- */
.hero {
  background: linear-gradient(135deg, var(--plum-deep) 0%, var(--plum) 32%, var(--royal) 72%, var(--magenta) 100%);
  color: #fff;
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
}
.hero__inner { max-width: 800px; margin: 0 auto; }
.hero h1 { color: #fff; font-size: clamp(2rem, 3vw + 1rem, 3rem); margin-bottom: var(--sp-4); }
.hero p {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: var(--sp-5);
}
.hero__meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: 0.9rem;
}
.hero__meta-item {
  background: rgba(255, 255, 255, 0.12);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---------- Module cards (landing & module index) ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-5);
  margin: var(--sp-6) 0;
}
.module-card {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  text-decoration: none;
  color: var(--ink-900);
  display: block;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  border-top: 4px solid var(--royal);
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--blue-100);
  border-top-color: var(--magenta);
}
.module-card__num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue-600);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.module-card h3 {
  margin: var(--sp-2) 0 var(--sp-2);
  color: var(--navy-900);
}
.module-card p {
  font-size: 0.92rem;
  color: var(--ink-700);
  margin: 0;
}
.module-card__cta {
  margin-top: var(--sp-4);
  font-size: 0.88rem;
  color: var(--blue-600);
  font-weight: 600;
}

/* ---------- Day list (module index) ---------- */
.day-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-5) 0;
  display: grid;
  gap: var(--sp-3);
}
.day-list__item {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  margin: 0;
}
.day-list__badge {
  background: var(--blue-100);
  color: var(--navy-800);
  font-weight: 600;
  font-size: 0.85rem;
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  white-space: nowrap;
}
.day-list__title {
  font-weight: 600;
  color: var(--navy-900);
}
.day-list__sub {
  font-size: 0.88rem;
  color: var(--ink-500);
  display: block;
  margin-top: 2px;
  font-weight: 400;
}
.day-list__actions {
  display: flex;
  gap: var(--sp-3);
  white-space: nowrap;
}
.day-list__actions a {
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--blue-600);
  font-weight: 500;
  padding: var(--sp-1) var(--sp-2);
}
.day-list__actions a:hover { text-decoration: underline; }
.day-list__actions a + a { border-left: 1px solid var(--ink-200); padding-left: var(--sp-3); }

@media (max-width: 600px) {
  .day-list__item {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
}

/* ---------- Session header (handout & homework) ---------- */
.session-header {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-left: 4px solid var(--blue-500);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin-bottom: var(--sp-6);
}
/* Reserve room on the right when a linked-file button is present */
.session-header--has-link { padding-right: 12rem; }
.session-header__linked-file {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
}
@media (max-width: 640px) {
  .session-header--has-link { padding-right: var(--sp-5); }
  .session-header__linked-file {
    position: static;
    display: inline-flex;
    margin-bottom: var(--sp-4);
  }
}
.session-header__eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--blue-600);
  text-transform: uppercase;
  margin: 0 0 var(--sp-2);
}
.session-header h1 { margin: 0 0 var(--sp-3); }
.session-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  font-size: 0.9rem;
  color: var(--ink-700);
}
.session-header__meta strong {
  color: var(--navy-800);
  margin-right: var(--sp-1);
}

/* ---------- Time block (🕒 markers) ---------- */
.time-block {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin: var(--sp-5) 0;
  position: relative;
}
.time-block__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--ink-200);
  flex-wrap: wrap;
}
.time-block__clock {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--navy-900);
  color: #fff;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.time-block__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy-900);
  margin: 0;
}

/* ---------- Boxes / callouts ---------- */
.callout {
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-4) 0;
  border-left: 4px solid var(--blue-500);
  background: var(--blue-50);
}
.callout__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy-700);
  margin-bottom: var(--sp-2);
  display: block;
}
.callout p:last-child { margin-bottom: 0; }

.callout--tip { background: var(--accent-amber-soft); border-color: var(--accent-amber); }
.callout--tip .callout__label { color: var(--accent-amber); }

.callout--note { background: var(--blue-50); border-color: var(--blue-500); }
.callout--note .callout__label { color: var(--navy-700); }

.callout--warning { background: var(--accent-red-soft); border-color: var(--accent-red); }
.callout--warning .callout__label { color: var(--accent-red); }

.callout--success { background: var(--accent-green-soft); border-color: var(--accent-green); }
.callout--success .callout__label { color: var(--accent-green); }

/* ---------- Vocab list ---------- */
.vocab-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-3);
}
.vocab-list li { margin: 0; }
.vocab-list details {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
}
.vocab-list summary {
  font-weight: 600;
  color: var(--navy-800);
  cursor: pointer;
  list-style: none;
}
.vocab-list summary::-webkit-details-marker { display: none; }
.vocab-list summary::after {
  content: " ▸";
  font-size: 0.8em;
  color: var(--blue-500);
}
.vocab-list details[open] summary::after { content: " ▾"; }
.vocab-list details > div, .vocab-list details > p {
  margin: var(--sp-3) 0 0;
  font-size: 0.92rem;
  color: var(--ink-700);
}

/* ---------- Exercises ---------- */
.exercise {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin: var(--sp-5) 0;
}
.exercise__title {
  margin: 0 0 var(--sp-3);
  font-size: 1.05rem;
  color: var(--navy-900);
}
.exercise__intro {
  font-style: italic;
  color: var(--ink-700);
  margin-bottom: var(--sp-4);
}
.exercise ol, .exercise ul { margin-bottom: var(--sp-4); }
.exercise input[type="text"], .exercise textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.exercise input[type="text"]:focus, .exercise textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(63, 136, 197, 0.2);
}

/* Answer reveal */
.answer-reveal {
  margin-top: var(--sp-4);
}
.answer-reveal__content {
  display: none;
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  background: var(--accent-green-soft);
  border-left: 3px solid var(--accent-green);
  border-radius: var(--radius-sm);
}
.answer-reveal.is-open .answer-reveal__content { display: block; }
.answer-reveal__content p:last-child { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--navy-700);
  color: #fff;
  border: 1px solid var(--navy-700);
  font-size: 0.95rem;
  font-weight: 500;
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.btn:active { transform: translateY(1px); }
.btn--gold {
  background: var(--gold);
  color: var(--plum);
  border-color: var(--gold);
  font-weight: 600;
}
.btn--gold:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  color: var(--plum-deep);
}
.btn--secondary {
  background: var(--paper);
  color: var(--navy-700);
  border-color: var(--ink-300);
}
.btn--secondary:hover {
  background: var(--blue-50);
  color: var(--navy-800);
  border-color: var(--blue-500);
}
.btn--ghost {
  background: transparent;
  color: var(--blue-600);
  border-color: transparent;
  padding: var(--sp-2) var(--sp-3);
}
.btn--ghost:hover { background: var(--blue-50); color: var(--navy-800); }
.btn--ghost-on-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.btn--ghost-on-dark:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: #fff;
  color: #fff;
}
.btn--small { font-size: 0.85rem; padding: var(--sp-1) var(--sp-3); }
.btn-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-4) 0; }

/* ---------- Audio embed ---------- */
.audio-embed {
  background: var(--navy-900);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-4) 0;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.audio-embed__label {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.audio-embed__player { flex: 1; min-width: 260px; }
.audio-embed audio { width: 100%; }

/* ---------- Timer widget ---------- */
.timer {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-4) 0;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.timer__display {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--navy-900);
  min-width: 100px;
  font-variant-numeric: tabular-nums;
}
.timer__display.is-warning { color: var(--accent-amber); }
.timer__display.is-critical { color: var(--accent-red); }
.timer__display.is-done { color: var(--accent-green); }
.timer__label {
  font-size: 0.88rem;
  color: var(--ink-500);
  margin-right: auto;
}
.timer__controls { display: flex; gap: var(--sp-2); }

/* ---------- Writing response (the big one) ---------- */
.writing-response {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin: var(--sp-5) 0;
  box-shadow: var(--shadow-sm);
}
.writing-response__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.writing-response__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--navy-900);
  margin: 0;
}
.writing-response__target {
  font-size: 0.85rem;
  color: var(--ink-500);
}
.writing-response__textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: var(--sp-4);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-900);
  background: #fdfdfd;
}
.writing-response__textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(63, 136, 197, 0.18);
}
.writing-response__statusbar {
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--ink-700);
}
.writing-response__count {
  font-family: var(--font-mono);
  font-weight: 600;
}
.writing-response__count.is-below { color: var(--accent-amber); }
.writing-response__count.is-met { color: var(--accent-green); }
.writing-response__saved {
  font-size: 0.85rem;
  color: var(--ink-500);
  font-style: italic;
}
.writing-response__actions {
  margin-top: var(--sp-4);
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* ---------- Homework status / submit ---------- */
.submit-box {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin: var(--sp-6) 0 var(--sp-4);
}
.submit-box h3 { margin-top: 0; }
.submit-box p { margin-bottom: var(--sp-3); }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-4) 0;
  font-size: 0.95rem;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--ink-200);
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--blue-50);
  color: var(--navy-800);
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }

/* ---------- Page footer ---------- */
.site-footer {
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--sp-6) var(--sp-5);
  margin-top: var(--sp-10);
  text-align: center;
  font-size: 0.88rem;
}
.site-footer a { color: rgba(255, 255, 255, 0.9); }

/* Prev/next nav at bottom of handout & homework pages */
.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--ink-200);
}
.pager a {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--blue-600);
  font-size: 0.95rem;
}
.pager a span:first-child {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
}
.pager a:hover span:last-child { text-decoration: underline; color: var(--navy-800); }

/* ---------- Print ---------- */
@media print {
  .site-nav, .site-footer, .pager, .btn, .timer__controls, .writing-response__actions,
  .homework-only-screen, .answer-sheet__controls, .answer-sheet__config { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .session-header, .time-block, .exercise, .writing-response {
    box-shadow: none;
    page-break-inside: avoid;
    border-color: #ddd;
  }
  a { color: #000; text-decoration: none; }

  /* Answer sheet prints as a clean exam form on its own page */
  .answer-sheet { box-shadow: none; border: 1px solid #000; page-break-inside: avoid; }
  .answer-sheet__head { background: #fff !important; color: #000 !important; border-bottom: 2px solid #000; }
  .answer-sheet__row { break-inside: avoid; }
  .answer-sheet__input { border-bottom: 1px solid #000; }
  .answer-sheet__num { color: #000; }
}

/* ---------- Current-focus banner (home page) ---------- */
.focus-banner {
  background: linear-gradient(135deg, var(--plum-deep) 0%, var(--plum) 32%, var(--royal) 72%, var(--magenta) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow);
}
.focus-banner__label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: var(--sp-2);
}
.focus-banner__text { margin: 0; font-size: 1.05rem; color: #fff; }
.focus-banner__module { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
#current-focus[data-current-focus="none"] { display: none; }

/* Highlight the module card that matches the current focus */
.module-card.is-current {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
}
.module-card.is-current .module-card__num {
  color: var(--accent-green);
}
.module-card.is-current .module-card__num::after {
  content: " · in focus now";
  color: var(--accent-green);
}

/* ============================================================
   Answer Sheet component
   Reusable, exam-style answer grid. Used by:
   - /practice/answer-sheet/      (generic, configurable)
   - /listening/answer-sheet/     (preset: Listening, 40)
   - /reading/answer-sheet/       (preset: Reading, 40)
   - any handout via a sized link  (?n=NN&module=...)
   Markup: a single <div data-answer-sheet ...></div> — app.js
   renders the fields, grid, controls and footer into it.
   ============================================================ */
.answer-sheet {
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: var(--sp-5) 0;
  overflow: hidden;
}
.answer-sheet__head {
  background: var(--navy-900);
  color: #fff;
  padding: var(--sp-4) var(--sp-5);
}
.answer-sheet__head h2 {
  color: #fff;
  margin: 0;
  font-size: 1.15rem;
}
.answer-sheet__head p {
  margin: var(--sp-1) 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
}

/* Configurable controls (generic page only) */
.answer-sheet__config {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: flex-end;
  padding: var(--sp-4) var(--sp-5);
  background: var(--blue-50);
  border-bottom: 1px solid var(--ink-200);
}
.answer-sheet__config label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.answer-sheet__config select,
.answer-sheet__config input {
  font: inherit;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  background: #fff;
  min-width: 9rem;
}

/* Candidate fields */
.answer-sheet__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--ink-200);
}
.answer-sheet__field {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: 0.9rem;
}
.answer-sheet__field strong { color: var(--navy-800); white-space: nowrap; }
.answer-sheet__field input {
  font: inherit;
  border: none;
  border-bottom: 1px solid var(--ink-300);
  padding: 2px 4px;
  min-width: 8rem;
  background: transparent;
}
.answer-sheet__field input:focus { outline: none; border-bottom-color: var(--blue-500); }

/* The numbered grid */
.answer-sheet__grid {
  column-count: 2;
  column-gap: var(--sp-8);
  padding: var(--sp-5);
}
@media (max-width: 560px) { .answer-sheet__grid { column-count: 1; } }
.answer-sheet__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-1) 0;
  break-inside: avoid;
}
.answer-sheet__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-700);
  width: 2.2rem;
  text-align: right;
  flex-shrink: 0;
}
.answer-sheet__input {
  flex: 1;
  font: inherit;
  border: none;
  border-bottom: 1px solid var(--ink-300);
  padding: 3px 4px;
  background: transparent;
  min-width: 0;
}
.answer-sheet__input:focus { outline: none; border-bottom-color: var(--blue-500); background: var(--blue-50); }
.answer-sheet__mark {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  display: none;            /* hidden in exam mode */
  text-align: center;
  font: inherit;
  padding: 0;
  background: #fff;
}

/* Footer: controls + score */
.answer-sheet__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--ink-200);
  background: var(--canvas);
}
.answer-sheet__foot {
  display: none;            /* shown in review mode */
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--ink-200);
  font-size: 0.95rem;
}
.answer-sheet__foot strong { color: var(--navy-800); }
.answer-sheet__foot input {
  font: inherit;
  width: 4rem;
  padding: 2px 6px;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  text-align: center;
}
.answer-sheet__note {
  font-size: 0.8rem;
  color: var(--ink-500);
}

/* Review mode reveals self-marking + score footer */
.answer-sheet--review .answer-sheet__mark { display: inline-block; }
.answer-sheet--review .answer-sheet__foot { display: flex; }

/* ===== Homework: free practice resources box ===== */
.resource-box {
  background: #f0f6fc;
  border: 1px solid #cfe0f4;
  border-left: 4px solid var(--blue-600);
  border-radius: var(--radius, 10px);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}
.resource-box > h2 { margin-top: 0; color: var(--navy-800); }
.resource-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.resource-item { padding: 0.85rem 0; border-top: 1px solid #d8e6f5; }
.resource-item:first-child { border-top: none; padding-top: 0; }
.resource-item__link { font-weight: 600; color: var(--navy-700); text-decoration: none; font-size: 1.02rem; }
.resource-item__link:hover { text-decoration: underline; }
.resource-item__source { display: inline-block; margin-left: 0.5rem; font-size: 0.78rem; font-weight: 600; color: var(--blue-600); background: #e1edfa; padding: 0.1rem 0.5rem; border-radius: 999px; vertical-align: middle; }
.resource-item__note { margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--ink-500); line-height: 1.5; }

/* Writing Day 1 chart figure */
.chart-figure { margin: 1.25rem 0; }

/* ===== Legacy mock: one-click self-mark ===== */
.mark-cta { background: #f0f6fc; border: 1px solid #cfe0f4; border-left: 4px solid var(--blue-600); border-radius: var(--radius, 10px); padding: 1.25rem 1.5rem; margin: 1rem 0 1.5rem; }
.mark-cta__lead { margin: 0 0 1rem; }
.btn--big { font-size: 1.05rem; padding: 0.75rem 1.5rem; }
.mark-result { margin-top: 1rem; }
.legacy-score { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; text-align: center; }
.legacy-score__big { font-size: 2.4rem; font-weight: 800; color: var(--navy-800); line-height: 1.1; }
.legacy-score__band { font-size: 1.1rem; color: var(--blue-600); margin-top: 0.25rem; }
.legacy-score__note { font-size: 0.85rem; color: var(--ink-500); margin: 0.75rem 0 0; line-height: 1.5; }
/* marked input states */
input.is-right { background: #d1fae5 !important; border-color: #047857 !important; color: #065f46; font-weight: 600; }
input.is-wrong { background: #fee2e2 !important; border-color: #b91c1c !important; color: #991b1b; }
.legacy-key-tag { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; background: #d1fae5; color: #065f46; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }

/* ===== Exercise diagram figures (listening handout images) ===== */
.exercise-figure { margin: 1rem 0; text-align: center; }
.exercise-figure img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ===== Day-page "Practice online" links (in homework section) ===== */
.practice-box { margin-top: 1rem; }
.practice-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.practice-item { padding: 0.35rem 0; }
.practice-item a { font-weight: 600; color: var(--navy-700); text-decoration: none; }
.practice-item a:hover { text-decoration: underline; }
.practice-src { display: inline-block; margin-left: 0.4rem; font-size: 0.76rem; color: var(--blue-600); background: #e1edfa; padding: 0.05rem 0.45rem; border-radius: 999px; vertical-align: middle; }

/* ==========================================================================
   AI Evaluation feedback panel  (rendered by assets/js/writing-mark.js)
   Additive component — uses existing brand tokens, overrides nothing.
   ========================================================================== */
[data-ai-result][hidden] { display: none; }
.aimark {
  margin-top: var(--sp-4);
  border: 1px solid var(--blue-100);
  border-left: 4px solid var(--blue-600);
  border-radius: var(--radius);
  background: var(--blue-50);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
}
.aimark__head {
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: 0.01em;
  margin-bottom: var(--sp-3);
}
.aimark__taskband {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--blue-100);
  color: var(--navy-900);
  font-size: 1.05rem;
}
.aimark__taskband strong { font-size: 1.25rem; color: var(--blue-600); }
.aimark__wc { font-size: 0.8rem; font-weight: 500; color: var(--ink-500); }
.aimark__crit {
  display: grid;
  grid-template-columns: minmax(8.5rem, max-content) 2.5rem 1fr;
  gap: var(--sp-2) var(--sp-3);
  align-items: baseline;
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--ink-200);
}
.aimark__crit:last-of-type { border-bottom: 0; }
.aimark__crit-name { font-weight: 600; color: var(--ink-700); }
.aimark__crit-band {
  font-weight: 700;
  color: #fff;
  background: var(--blue-600);
  border-radius: 999px;
  text-align: center;
  padding: 0.05rem 0;
  font-variant-numeric: tabular-nums;
}
.aimark__crit-fb { color: var(--ink-700); line-height: 1.45; }
.aimark__summary {
  margin: var(--sp-3) 0 0;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--blue-100);
  color: var(--ink-700);
  font-style: italic;
}
.aimark__disclaimer { margin: var(--sp-3) 0 0; font-size: 0.8rem; color: var(--ink-500); }
.aimark--loading { color: var(--navy-700); }
.aimark--loading::before {
  content: ""; display: inline-block; width: 0.9em; height: 0.9em;
  margin-right: 0.5em; vertical-align: -0.1em;
  border: 2px solid var(--blue-100); border-top-color: var(--blue-600);
  border-radius: 50%; animation: aimark-spin 0.7s linear infinite;
}
.aimark--note {
  border-left-color: var(--accent-amber);
  background: var(--accent-amber-soft);
}
.aimark--note strong { color: #7c4a03; }
@keyframes aimark-spin { to { transform: rotate(360deg); } }

@media (max-width: 540px) {
  .aimark__crit { grid-template-columns: 1fr auto; }
  .aimark__crit-fb { grid-column: 1 / -1; }
}
