:root {
  --ink: #17233b;
  --muted: #536078;
  --paper: #fffdf8;
  --surface: #ffffff;
  --brand: #175c4c;
  --brand-dark: #0f4338;
  --accent: #f1b24b;
  --line: #dbe2dd;
  --focus: #8a3ffc;
  --shadow: 0 14px 36px rgba(23, 35, 59, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

/* English Lab keeps its application components inside the original Samuel shell. */
.skip-link { z-index: 1000; }
.related-links,
.category-links { position: static; background: transparent; box-shadow: none; }
.related-links a,
.category-links a { color: var(--brand-dark); }
.home-nav { position: sticky; }
.home-nav .nav-links { flex-wrap: nowrap; }
.home-footer a { color: inherit; }

@media (max-width: 980px) {
  body:not(.home-page) .home-nav .nav-links { display: none; }
  body:not(.home-page) .home-nav .hamburger { display: flex; }
  body:not(.home-page) .home-nav .nav-inner { padding: 12px 18px; }
  body:not(.home-page) .home-nav .mobile-menu.is-open { display: grid; }
}

@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .home-footer .footer-links { align-items: flex-start; flex-direction: column; }
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.65; overflow-wrap: break-word; }
a { color: var(--brand-dark); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.14em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: 0.7rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }
.container { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: rgba(255, 253, 248, 0.96); }
.nav { min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { color: var(--ink); font-weight: 850; text-decoration: none; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav-links a[aria-current="page"] { font-weight: 750; text-decoration-thickness: 0.16em; }
.hero { padding: clamp(4rem, 10vw, 8rem) 0; background: radial-gradient(circle at 80% 10%, #d9efe5 0, transparent 35%), linear-gradient(135deg, #fffdf8, #f6fbf8); }
.eyebrow { color: var(--brand); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.025em; }
h1 { max-width: 16ch; font-size: clamp(2.4rem, 7vw, 5rem); margin: 0.25rem 0 1rem; }
h2 { font-size: clamp(1.65rem, 4vw, 2.5rem); }
.lede { max-width: 65ch; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.25rem); }
.button { display: inline-block; margin-top: 1rem; padding: 0.8rem 1.1rem; border: 0; border-radius: 0.6rem; background: var(--brand); color: white; font: inherit; font-weight: 760; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-dark); }
.button--secondary { background: var(--ink); }
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section--tint { background: #edf6f1; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card { padding: 1.4rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0.4rem; }
.resource-family-card { overflow: hidden; padding: 0; transition: transform 180ms ease, box-shadow 180ms ease; }
.resource-family-card:hover { transform: translateY(-4px); box-shadow: 0 18px 42px rgba(20, 76, 58, 0.14); }
.resource-family-media { display: block; overflow: hidden; aspect-ratio: 16 / 9; background: #e9f8ef; }
.resource-family-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 260ms ease; }
.resource-family-card:hover .resource-family-media img { transform: scale(1.025); }
.resource-family-body { padding: 1.35rem; }
.resource-family-body > :first-child { margin-top: 0; }
.resource-family-body > :last-child { margin-bottom: 0; }
.meta { color: var(--muted); font-size: 0.92rem; }
.filters { display: grid; grid-template-columns: minmax(12rem, 2fr) repeat(2, minmax(9rem, 1fr)); gap: 0.8rem; margin: 2rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 0.8rem; background: white; }
.field { display: grid; gap: 0.35rem; font-weight: 700; }
input, select { width: 100%; min-height: 2.8rem; padding: 0.55rem 0.7rem; border: 1px solid #98a49d; border-radius: 0.45rem; color: var(--ink); background: white; font: inherit; }
.results-status { min-height: 1.7em; color: var(--muted); }
.category-links { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.5rem 0; }
.category-links a { padding: 0.45rem 0.75rem; border: 1px solid var(--brand); border-radius: 999px; font-weight: 750; text-decoration: none; }
.related-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.related-links a { font-weight: 750; }
.article { width: min(760px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(3rem, 7vw, 6rem) 0; }
.article h1 { max-width: 20ch; font-size: clamp(2.2rem, 6vw, 4rem); }
.article h2 { margin-top: 2.6rem; }
.article-intro { font-size: 1.2rem; color: var(--muted); }
.callout { margin: 2rem 0; padding: 1rem 1.2rem; border-left: 5px solid var(--accent); background: #fff6e5; }
.practice-shell { width: min(840px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 6vw, 5rem) 0; }
.practice { display: grid; gap: 1.25rem; }
.practice-level-picker { max-width: 18rem; }
.practice-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 18rem)); gap: 1rem; }
.progress-table { width: 100%; border-collapse: collapse; background: white; }
.progress-table th, .progress-table td { padding: 0.8rem; border: 1px solid var(--line); text-align: left; }
.progress-table th { background: #edf6f1; }
.progress-table-region { max-width: 100%; }
.progress-table-hint { display: none; margin: 0; color: var(--muted); font-size: 0.92rem; }
.progress-recommendations { margin-top: 1rem; }
.progress-recommendation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.progress-filters { grid-template-columns: repeat(2, minmax(10rem, 18rem)); margin: 0; }
.practice-instructions { font-weight: 700; }
.reading-passage, .gap-text { padding: clamp(1rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: 1rem; background: white; }
.reading-passage h2 { margin-top: 0; }
.gap-text { font-size: 1.12rem; line-height: 2.2; }
.gap-marker { display: inline-block; min-width: 2.4rem; margin: 0 0.2rem; padding: 0 0.35rem; border-bottom: 3px solid var(--brand); text-align: center; }
.question { display: grid; gap: 0.65rem; min-width: 0; margin: 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 0.75rem; background: white; }
.question legend { padding: 0 0.35rem; font-weight: 800; }
.option { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.65rem; border-radius: 0.45rem; cursor: pointer; }
.option:hover { background: #edf6f1; }
.option input { flex: 0 0 auto; width: 1.15rem; min-height: 1.15rem; margin-top: 0.25rem; }
.feedback { margin: 0.3rem 0 0; padding: 0.7rem; border-radius: 0.4rem; }
.feedback--correct { background: #e5f6ed; color: #174c35; }
.feedback--incorrect { background: #fff0eb; color: #7a2d18; }
.practice-result { min-height: 1.8rem; font-weight: 850; }
.practice-state { padding: 1rem; border: 1px solid var(--line); border-radius: 0.6rem; background: white; }
.practice-state--error { border-color: #b1482c; color: #7a2d18; }
.exam-start, .exam-session, .exam-result { display: grid; gap: 1.2rem; margin: 2rem 0; }
.exam-toolbar { display: grid; gap: 0.35rem; padding: 1rem; border: 1px solid var(--line); border-radius: 0.8rem; background: #edf6f1; }
.exam-toolbar p { margin: 0; }
.exam-toolbar progress { width: 100%; min-height: 1rem; accent-color: var(--brand); }
.exam-timer { font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 850; }
.exam-section-nav, .exam-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.exam-section-nav .button, .exam-actions .button { margin-top: 0; }
.exam-section-nav [aria-current="step"] { background: var(--brand); box-shadow: 0 0 0 3px var(--accent); }
.exam-section { display: grid; gap: 1.1rem; }
.confirm-panel { position: sticky; bottom: 1rem; z-index: 5; padding: 1.2rem; border: 3px solid var(--brand); border-radius: 0.8rem; background: white; box-shadow: var(--shadow); }
.confirm-panel h3 { margin-top: 0; }
.score-total { margin: 0; color: var(--brand-dark); font-size: clamp(2rem, 7vw, 3.5rem); font-weight: 900; }
.section-scores, .error-summary { display: grid; gap: 0.65rem; }
.site-footer { padding: 2.5rem 0; border-top: 1px solid var(--line); color: var(--muted); }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .nav { align-items: flex-start; flex-direction: column; padding: 1rem 0; gap: 0.65rem; }
  .grid, .filters { grid-template-columns: 1fr; }
  .practice-picker-grid { grid-template-columns: 1fr; }
  .progress-recommendation-grid { grid-template-columns: 1fr; }
  .progress-table-region { overflow-x: auto; }
  .progress-table { min-width: 40rem; }
  .progress-table-hint { display: block; }
  .exam-section-nav, .exam-actions { align-items: stretch; flex-direction: column; }
  .related-links { flex-direction: column; }
  .exam-section-nav .button, .exam-actions .button { width: 100%; }
  .hero { padding-top: 3rem; }
  h1 { font-size: clamp(2.25rem, 13vw, 3.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
