:root {
  color-scheme: dark;
  --page: #07101f;
  --surface: #101b2e;
  --surface-strong: #15233a;
  --line: #2a3a55;
  --text: #f8fafc;
  --muted: #b5c1d3;
  --accent: var(--subject-accent, #38bdf8);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(circle at 20% 0, color-mix(in srgb, var(--accent) 12%, transparent), transparent 32rem), var(--page); color: var(--text); line-height: 1.65; }
a { color: #7dd3fc; text-underline-offset: 0.2em; }
a:hover { color: #bae6fd; }
img { max-width: 100%; }
.skip-link { position: fixed; z-index: 20; top: 0.5rem; left: 0.5rem; transform: translateY(-160%); padding: 0.65rem 0.9rem; border-radius: 0.5rem; background: white; color: #07101f; }
.skip-link:focus { transform: none; }
.lesson-header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 4.4rem; padding: 0.65rem max(1rem, calc((100vw - 1180px) / 2)); border-bottom: 1px solid rgba(148, 163, 184, 0.2); background: rgba(7, 16, 31, 0.9); backdrop-filter: blur(16px); }
.lesson-brand { display: inline-flex; align-items: center; gap: 0.65rem; color: white; font-weight: 800; text-decoration: none; }
.lesson-brand img { width: 2.5rem; height: 2.5rem; object-fit: contain; border-radius: 0.65rem; }
.lesson-header nav { display: flex; align-items: center; gap: 0.5rem; }
.lesson-header nav a { min-height: 2.75rem; display: inline-flex; align-items: center; padding: 0.5rem 0.75rem; border-radius: 0.65rem; color: var(--muted); font-weight: 700; text-decoration: none; }
.lesson-header nav a:hover, .lesson-header nav a:focus-visible { background: var(--surface); color: white; }
.lesson-header .language-link { border: 1px solid var(--line); color: #e2e8f0; }
.lesson-shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 1.25rem 0 0; color: var(--muted); font-size: 0.9rem; }
.breadcrumbs a { color: inherit; }
.lesson-hero, .library-hero { padding: clamp(2rem, 6vw, 5rem) 0 2.5rem; }
.eyebrow { margin: 0 0 0.55rem; color: var(--accent); font-size: 0.82rem; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
h1 { max-width: 950px; margin: 0; font-size: clamp(2.1rem, 6vw, 4.8rem); line-height: 1.06; letter-spacing: -0.045em; }
.lesson-summary, .library-hero > p:not(.eyebrow) { max-width: 800px; margin: 1.25rem 0; color: #cfdaea; font-size: clamp(1.05rem, 2.2vw, 1.35rem); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.lesson-meta > * { padding: 0.35rem 0.65rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.84rem; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.primary-action, .secondary-action { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: 0.7rem 1rem; border-radius: 0.75rem; font-weight: 800; text-decoration: none; }
.primary-action { background: var(--accent); color: #04111f; box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 22%, transparent); }
.primary-action:hover { color: #020617; filter: brightness(1.1); }
.secondary-action { border: 1px solid var(--line); background: var(--surface); color: white; }
.inline-action { margin-top: 0.7rem; }
.lesson-section { margin: 0 0 1.25rem; padding: clamp(1.25rem, 4vw, 2.25rem); border: 1px solid var(--line); border-radius: 1.25rem; background: linear-gradient(145deg, rgba(21, 35, 58, 0.96), rgba(12, 24, 42, 0.96)); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18); }
.lesson-section h2 { margin: 0 0 1rem; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.2; }
.lesson-section h3 { margin: 1.25rem 0 0.45rem; font-size: 1.05rem; }
.lesson-section p { color: #d4deeb; }
.lesson-section li + li { margin-top: 0.55rem; }
.lesson-section ul, .lesson-section ol { padding-left: 1.3rem; color: #d4deeb; }
.callout, .worked-example { padding: 1rem 1.1rem; border-left: 0.25rem solid var(--accent); border-radius: 0.65rem; background: rgba(2, 6, 23, 0.42); font-size: 1.05rem; }
.two-column, .concept-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.two-column > div, .concept-card { padding: 1rem; border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 0.85rem; background: rgba(2, 6, 23, 0.28); }
.concept-card h3 { margin-top: 0; color: #fff; }
.question-list { display: grid; gap: 1rem; }
.question-card { padding: 1rem; border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 0.85rem; background: rgba(2, 6, 23, 0.32); }
.question-card h3 { margin-top: 0; }
.answer-options { margin-bottom: 0.7rem; }
details { border-top: 1px solid rgba(148, 163, 184, 0.2); padding-top: 0.7rem; }
summary { min-height: 2.75rem; display: flex; align-items: center; color: #7dd3fc; cursor: pointer; font-weight: 750; }
.reference-list a { overflow-wrap: anywhere; }
.transparency-note { margin-top: 1.4rem; padding: 1rem; border-radius: 0.7rem; background: rgba(56, 189, 248, 0.08); }
.publisher-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.publisher-info div { padding: 0.8rem; border-radius: 0.65rem; background: rgba(2, 6, 23, 0.3); }
.publisher-info dt { color: var(--muted); font-size: 0.8rem; }
.publisher-info dd { margin: 0.2rem 0 0; font-weight: 700; }
.lesson-pagination { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0 4rem; }
.lesson-pagination a { display: flex; flex-direction: column; min-height: 5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 0.85rem; background: var(--surface); text-decoration: none; }
.lesson-pagination a:last-child { text-align: right; }
.lesson-pagination span { color: var(--muted); font-size: 0.82rem; }
.lesson-pagination strong { color: white; }
.library-hero { text-align: center; }
.library-hero h1, .library-hero > p { margin-left: auto; margin-right: auto; }
.library-subject { margin: 1.5rem 0 3rem; }
.library-subject > header { display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.library-subject h2 { flex: 1 1 60%; margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.library-subject .eyebrow { flex-basis: 100%; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.library-grid article { padding: 1.15rem; border: 1px solid var(--line); border-top: 0.2rem solid var(--subject-accent); border-radius: 0.9rem; background: var(--surface); }
.library-grid article > p:first-child, .library-grid article > span { color: var(--muted); font-size: 0.82rem; }
.library-grid h3 { margin: 0.35rem 0; line-height: 1.25; }
.library-grid h3 a { color: white; text-decoration: none; }
.library-grid h3 a:hover { color: var(--subject-accent); }
.library-grid article > p:not(:first-child) { color: #c7d2e2; }
footer { padding: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .lesson-header { position: static; align-items: flex-start; }
  .lesson-header nav { flex-wrap: wrap; justify-content: flex-end; }
  .lesson-header nav a:not(.language-link) { display: none; }
  .lesson-shell { width: min(100% - 1rem, 1120px); }
  .two-column, .concept-grid, .library-grid { grid-template-columns: 1fr; }
  .publisher-info { grid-template-columns: 1fr; }
  .lesson-section { border-radius: 0.9rem; }
  .lesson-actions > a { width: 100%; }
  .lesson-pagination { gap: 0.5rem; }
  .lesson-pagination a { padding: 0.75rem; }
}

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