/* GuideTutor: a structured learning-platform design. Deep purple and lavender on white and
   soft neutral reading surfaces; subject markers carry their own accessible accent colors. */
:root {
  --p900: #241046;
  --p800: #3b1f78;
  --p700: #4b2a99;
  --p600: #5b38bd;
  --l50: #f8f6ff;
  --l100: #f0ebff;
  --l200: #e0d7ff;
  --l300: #c4b2ff;
  --ink: #1f1640;
  --text: #39324f;
  --muted: #5f5779;
  --line: #e5e0f2;
  --line-2: #d3cbea;
  --bg: #ffffff;
  --paper: #fbfaf7;
  --ok: #1d6b4a;
  --ok-soft: #e3f4ec;
  --warn: #8a4b00;
  --warn-soft: #fff3e0;
  --focus: #e8590c;
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-head: "Avenir Next", Avenir, "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --hue: var(--p700);
  --hue-soft: var(--l100);
}
[data-hue="violet"] { --hue: #5b34c4; --hue-soft: #efe9ff; }
[data-hue="blue"] { --hue: #2a54b3; --hue-soft: #e7eefc; }
[data-hue="plum"] { --hue: #8a2a8c; --hue-soft: #f8e9f8; }
[data-hue="teal"] { --hue: #0f6d67; --hue-soft: #e0f3f1; }
[data-hue="green"] { --hue: #2b6a2e; --hue-soft: #e6f2e2; }
[data-hue="rose"] { --hue: #a3304f; --hue-soft: #fbe9ee; }
[data-hue="amber"] { --hue: #865000; --hue-soft: #fbefd9; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.65; color: var(--text); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--p600); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--p900); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-head); color: var(--ink); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.95rem, 4vw, 2.75rem); margin: 0 0 .6rem; font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); margin: 0 0 .75rem; font-weight: 750; }
h3 { font-size: 1.12rem; margin: 0 0 .35rem; font-weight: 700; }
p { margin: 0 0 1rem; }
.icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.2em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(800px, 100% - 32px); }
.center { text-align: center; }
.small { font-size: .88rem; color: var(--muted); }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--p800); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 700; z-index: 100; }
.skip-link:focus { top: 10px; color: #fff; }
main:focus { outline: none; }

/* ---------- Header ---------- */
.masthead { position: relative; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); }
.masthead-top { background: var(--l50); border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand .logo-mark { width: 38px; height: 38px; }
.brand-word { font-family: var(--font-head); font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1; }
.bw-1 { color: var(--p800); font-weight: 800; }
.bw-2 { color: var(--p600); font-weight: 600; }
.head-search { display: none; flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.head-search input { width: 100%; height: 42px; border-radius: 10px; border: 1.5px solid var(--line-2); background: #fff; color: var(--ink); padding: 0 46px 0 14px; font: inherit; font-size: .95rem; }
.head-search input::placeholder { color: #7a7296; }
.head-search input:focus { border-color: var(--p700); outline: 3px solid var(--l300); outline-offset: 0; }
.head-search button { position: absolute; right: 5px; top: 5px; width: 32px; height: 32px; border-radius: 7px; border: 0; background: var(--p800); color: #fff; display: grid; place-items: center; cursor: pointer; }
.head-search button:hover { background: var(--p900); }
.head-search-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--p800); font-weight: 700; text-decoration: none; padding: 8px 10px; border-radius: 9px; }
.head-search-link:hover { background: var(--l100); color: var(--p900); }
.menu-toggle { display: inline-flex; align-items: center; gap: 8px; background: var(--p800); color: #fff; border: 0; border-radius: 9px; padding: 9px 13px; font: inherit; font-weight: 700; cursor: pointer; }
.menu-toggle:hover { background: var(--p900); }
.menu-toggle .icon-close { display: none; }
.masthead.is-open .menu-toggle .icon-open { display: none; }
.masthead.is-open .menu-toggle .icon-close { display: inline; }
.primary-nav { display: none; }
.masthead.is-open .primary-nav { display: block; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 3px solid var(--p800); box-shadow: 0 18px 30px -18px rgba(36, 16, 70, .45); padding: 8px 0 16px; max-height: calc(100dvh - 70px); overflow: auto; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; }
.primary-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 4px; color: var(--ink); text-decoration: none; font-weight: 650; border-bottom: 1px solid var(--line); }
.primary-nav a[data-hue]::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--hue); flex: none; }
.primary-nav a[aria-current] { color: var(--p700); }
.site-links { margin-top: 10px !important; display: flex; gap: 10px; }
.site-links li { flex: 1; }
.site-links a { justify-content: center; border: 1.5px solid var(--line-2); border-radius: 9px; }
@media (min-width: 1080px) {
  .menu-toggle, .head-search-link { display: none; }
  .head-search { display: block; }
  .primary-nav { display: block; }
  .primary-nav-inner { display: flex; align-items: stretch; justify-content: space-between; gap: 16px; }
  .subject-tabs { display: flex; gap: 2px; }
  .primary-nav a { border: 0; padding: 12px 11px 10px; font-size: .95rem; border-bottom: 3px solid transparent; gap: 7px; }
  .primary-nav a[data-hue]::before { width: 8px; height: 8px; border-radius: 2px; }
  .primary-nav a:hover { color: var(--p700); border-bottom-color: var(--l300); }
  .primary-nav a[aria-current] { border-bottom-color: var(--p800); color: var(--p800); }
  .site-links { margin: 0 !important; gap: 4px; align-items: center; }
  .site-links a { border: 0; border-radius: 0; color: var(--muted); font-weight: 600; }
}

/* ---------- Buttons, labels ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 12px 20px; font: inherit; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; line-height: 1.2; }
.btn-primary { background: var(--p800); color: #fff; }
.btn-primary:hover { background: var(--p900); color: #fff; }
.eyebrow { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--p600); margin: 0 0 .5rem; }
.lede { font-size: 1.14rem; color: var(--muted); }
.subject-tag { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 .6rem; font-size: .8rem; font-weight: 700; color: var(--hue); text-decoration: none; }
.tag-code { display: inline-grid; place-items: center; min-width: 2.4em; padding: 2px 6px; border-radius: 6px; background: var(--hue); color: #fff; font-size: .72rem; letter-spacing: .06em; }
a.subject-tag:hover { color: var(--ink); }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .84rem !important; color: var(--muted); font-weight: 600; margin: 0 !important; }
.lesson-meta .icon { width: 1em; height: 1em; color: var(--p600); }
.lesson-meta span + .icon { margin-left: 8px; }
.more-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--p700); }
.more-link-wrap { margin: 22px 0 0; }

/* ---------- Hero ---------- */
.hero { background-color: var(--l50); background-image: linear-gradient(var(--l100) 1px, transparent 1px), linear-gradient(90deg, var(--l100) 1px, transparent 1px); background-size: 32px 32px; border-bottom: 1px solid var(--line); padding: 48px 0 56px; }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.5rem); max-width: 14ch; color: var(--p900); }
.hero .lede { max-width: 54ch; color: var(--text); }
.hero-grid { display: grid; gap: 32px; align-items: center; }
.hero-grid > * { min-width: 0; }
@media (min-width: 940px) { .hero-grid { grid-template-columns: 1.35fr 1fr; gap: 48px; } }
.search-form { margin: 22px 0 0; }
.search-label { display: block; color: var(--ink); font-weight: 700; margin-bottom: 8px; }
.search-row { display: flex; align-items: center; background: #fff; border: 2px solid var(--p800); border-radius: 12px; padding: 5px; gap: 6px; max-width: 640px; box-shadow: 0 10px 0 -4px var(--l200); }
.search-row-icon { color: var(--p700); margin-left: 8px; }
.search-row input { flex: 1; min-width: 0; border: 0; font: inherit; font-size: 1.05rem; padding: 11px 4px; color: var(--ink); background: transparent; }
.search-row input::placeholder { color: #7a7296; }
.search-row input:focus { outline: none; }
.search-row:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.chips p { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 700; }
.chips ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 5px 12px; border-radius: 8px; background: #fff; border: 1.5px solid var(--line-2); color: var(--p800); text-decoration: none; font-size: .9rem; font-weight: 600; }
.chips a:hover { border-color: var(--p700); background: var(--l100); }
.start-card { background: var(--p800); color: #e9e2ff; border-radius: 18px; padding: 26px 24px 18px; box-shadow: 12px 12px 0 var(--l200); }
.start-kicker { margin: 0 0 .2rem; font-size: .85rem; font-weight: 700; color: var(--l300); }
.start-card h2 { color: #fff; font-size: 1.6rem; margin-bottom: 14px; }
.start-list { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.start-list li { counter-increment: s; border-top: 1px solid rgba(255,255,255,.14); }
.start-list a { display: grid; grid-template-columns: 2.2rem 1fr; column-gap: 12px; padding: 13px 0; color: #fff; text-decoration: none; }
.start-list a::before { content: counter(s); grid-row: span 2; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--l300); color: var(--p900); font-weight: 800; display: grid; place-items: center; }
.start-title { font-weight: 700; line-height: 1.35; }
.start-time { display: inline-flex; align-items: center; gap: 5px; font-size: .84rem; color: var(--l300); margin-top: 3px; }
.start-time .icon { width: 1em; height: 1em; }
.start-list a:hover .start-title { text-decoration: underline; }

/* ---------- Sections ---------- */
.section { padding: 60px 0; }
.section-soft { background: var(--paper); border-top: 1px solid #efece4; border-bottom: 1px solid #efece4; }
.section-deep { background: var(--p900); color: #d9d0f5; }
.section-deep h2 { color: #fff; }
.section-deep .eyebrow { color: var(--l300); }
.section-deep .section-head p:last-child { color: #d9d0f5; }
.section-deep a { color: #fff; }
.section-head { max-width: 740px; margin-bottom: 28px; }
.section-head p:last-child { color: var(--muted); }

.subject-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (min-width: 820px) { .subject-grid { grid-template-columns: repeat(2, 1fr); } .subject-tile-wide { order: -1; } }
@media (min-width: 1080px) { .subject-grid { grid-template-columns: repeat(10, 1fr); } .subject-tile { grid-column: span 2; } .subject-tile-wide { grid-column: span 5; } }
.subject-tile { position: relative; border: 1px solid var(--line); border-top: 5px solid var(--hue); border-radius: var(--radius); padding: 18px 20px; background: #fff; }
.subject-tile p { margin: 10px 0 0; font-size: .95rem; color: var(--muted); }
.subject-head { display: flex; align-items: center; gap: 12px; }
.subject-head h3 { margin: 0; font-size: 1.08rem; }
.subject-head h3 a { color: var(--ink); text-decoration: none; }
.subject-tile:not(.subject-tile-wide) h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.subject-tile:not(.subject-tile-wide):hover { border-color: var(--hue); box-shadow: 0 10px 24px -18px rgba(36,16,70,.55); }
.subject-head h3 a:hover { color: var(--hue); text-decoration: underline; }
.subject-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--hue-soft); color: var(--hue); display: grid; place-items: center; flex: none; }
.subject-icon .icon { width: 24px; height: 24px; }
.subject-count { margin: 0 !important; font-size: .82rem !important; font-weight: 700; color: var(--hue) !important; }
.subject-tile-wide { background: linear-gradient(180deg, var(--hue-soft), #fff 70%); }
.subject-links { list-style: none; margin: 14px 0 14px; padding: 0; display: grid; gap: 6px; }
.subject-links a { display: block; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.subject-links a:hover { border-color: var(--hue); color: var(--hue); }
.subject-tile .more-link { color: var(--hue); }

.track { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.track a { display: flex; flex-direction: column; height: 100%; padding: 16px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); text-decoration: none; color: #fff; }
.track a:hover { background: rgba(255,255,255,.12); border-color: var(--l300); }
.track-no { width: 2rem; height: 2rem; border-radius: 50%; background: var(--l300); color: var(--p900); font-weight: 800; display: grid; place-items: center; margin-bottom: 10px; }
.track-label { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; }
.track-title { font-size: .88rem; color: #d9d0f5; margin-top: 4px; line-height: 1.4; }
.track-fixes { margin: 22px 0 0; font-size: .95rem; }
.track-fixes a { color: #fff; }

.path-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.path-card { border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 22px; background: #fff; }
.path-no { display: inline-block; margin: 0 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--p700); background: var(--l100); border-radius: 6px; padding: 3px 8px; }
.path-card > p:not(.path-no) { color: var(--muted); font-size: .95rem; }
.path-card ol { margin: 0; padding: 0; list-style: none; counter-reset: p; border-left: 2px dashed var(--l300); margin-left: 12px; }
.path-card li { counter-increment: p; position: relative; padding: 0 0 12px 22px; }
.path-card li:last-child { padding-bottom: 0; }
.path-card li::before { content: counter(p); position: absolute; left: -13px; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--p800); color: #fff; font-size: .78rem; font-weight: 800; display: grid; place-items: center; }
.path-card li a { font-weight: 600; color: var(--ink); }
.path-card li a:hover { color: var(--p600); }

.lesson-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 380px) { .lesson-grid { grid-template-columns: 1fr; } }
.lesson-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--hue); border-radius: var(--radius); padding: 18px 20px; }
.lesson-card h3 a, .lesson-card h2 a { color: var(--ink); text-decoration: none; }
.lesson-card h3 a:hover { color: var(--hue); text-decoration: underline; }
.lesson-card > p:not(.subject-tag):not(.lesson-meta) { font-size: .95rem; color: var(--muted); flex: 1; margin-bottom: .8rem; }

.latest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 32px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 400px) { .latest-list { grid-template-columns: 1fr; } }
.latest-list li { display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid var(--line); }
.latest-list a { font-weight: 650; color: var(--ink); text-decoration: none; }
.latest-list a:hover { color: var(--p600); text-decoration: underline; }
.latest-list span { font-size: .85rem; color: var(--muted); }

.about-band { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) { .about-band { grid-template-columns: 1.5fr 1fr; } }
.promise { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 14px; }
.promise li { display: flex; gap: 12px; }
.promise .icon { color: var(--p700); margin-top: 3px; }
.contact-tile { background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 22px; }
.contact-tile-h { font-weight: 800; color: var(--ink); font-family: var(--font-head); font-size: 1.1rem; }
.email-big { display: inline-flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; word-break: break-word; margin-bottom: 10px; }

/* ---------- Page heroes ---------- */
.page-hero { background: var(--l50); border-bottom: 1px solid var(--line); padding: 24px 0 32px; }
.crumbs ol { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .88rem; color: var(--muted); }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--line-2); }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.byline { font-size: .9rem; color: var(--muted); margin: 0; }

.jump-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.jump-list a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.jump-list a .icon { color: var(--hue); }
.jump-list a:hover { border-color: var(--hue); }
.all-list { padding: 28px 0 56px; }
.all-group { padding-top: 26px; }
.all-group > h2 { display: flex; align-items: center; gap: 12px; font-size: 1.4rem; }
.all-group > h2 a { color: var(--ink); text-decoration: none; }
.all-group > h2 a:hover { color: var(--hue); text-decoration: underline; }

.lesson-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lesson-row { display: flex; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.lesson-no { flex: none; font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; color: var(--p700); background: var(--l100); width: 2.6rem; height: 2.6rem; border-radius: 10px; display: grid; place-items: center; }
.lesson-row-text { min-width: 0; }
.lesson-row h2, .lesson-row h3, .h3-like { font-size: 1.1rem; margin: 0 0 .3rem; }
.lesson-row h2 a, .lesson-row h3 a { color: var(--ink); text-decoration: none; }
.lesson-row h2 a:hover, .lesson-row h3 a:hover { color: var(--p600); text-decoration: underline; }
.lesson-row-text > p:not(.subject-tag):not(.lesson-meta) { margin: 0 0 .45rem; font-size: .95rem; }
.search-results .lesson-row { padding-left: 18px; }
mark { background: var(--l200); color: inherit; border-radius: 3px; padding: 0 2px; }

.cat-hero { border-top: 5px solid var(--hue); }
.cat-hero-row { display: flex; align-items: center; gap: 16px; }
.cat-hero-row > div { min-width: 0; }
.cat-hero-row h1 { margin: 0; }
.cat-badge { position: relative; flex: none; width: 64px; height: 64px; border-radius: 16px; background: var(--hue); color: #fff; display: grid; place-items: center; }
.cat-badge .icon { width: 32px; height: 32px; }
.cat-badge-code { position: absolute; right: -8px; bottom: -8px; background: #fff; color: var(--hue); border: 2px solid var(--hue); border-radius: 6px; font-size: .66rem; font-weight: 800; padding: 1px 4px; letter-spacing: .05em; }
.count { margin: 0; font-weight: 700; color: var(--hue); }
.cat-intro { max-width: 760px; margin-top: 18px; }
.cat-layout { display: grid; gap: 28px; padding: 36px 0 60px; }
@media (min-width: 960px) { .cat-layout { grid-template-columns: 1fr 320px; } }
.cat-main > h2 { font-size: 1.35rem; }
.aside-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; margin-bottom: 16px; }
.aside-box h2 { font-size: 1.08rem; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; font-size: .95rem; }
.checks .icon { color: var(--ok); margin-top: 3px; }
.other-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.other-cats a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.other-cats a .icon { color: var(--hue); }
.other-cats a:hover { background: var(--hue-soft); color: var(--hue); }
.other-cats-row { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.aside-note { font-size: .88rem; color: var(--muted); }

/* ---------- Tutorial page ---------- */
.lesson-hero { border-top: 5px solid var(--hue); }
.lesson-hero h1 { max-width: 30ch; }
.lesson-hero .lede { max-width: 70ch; }
.guide-facts { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; color: var(--muted); }
.guide-facts li:first-child { font-weight: 700; color: var(--ink); }
.lesson-facts { margin: 0; display: grid; gap: 10px; grid-template-columns: 1fr 1fr; max-width: 860px; }
@media (min-width: 760px) { .lesson-facts { grid-template-columns: 160px 180px 1fr; } }
.lesson-facts > div { background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 14px; min-width: 0; }
.lesson-facts .lf-wide { grid-column: 1 / -1; }
@media (min-width: 760px) { .lesson-facts .lf-wide { grid-column: auto; } }
.lesson-facts dt { display: flex; align-items: center; gap: 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--p700); }
.lesson-facts dt .icon { width: 1.05em; height: 1.05em; }
.lesson-facts dd { margin: 2px 0 0; font-weight: 650; color: var(--ink); font-size: .95rem; line-height: 1.4; }
.lesson-layout { display: grid; gap: 28px; padding: 32px 0 56px; }
.lesson-layout > * { min-width: 0; }
@media (min-width: 1000px) { .lesson-layout { grid-template-columns: 260px minmax(0, 760px); gap: 48px; } }
.toc { align-self: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--l50); }
@media (min-width: 1000px) { .toc { position: sticky; top: 16px; } }
.toc h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--p700); margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.toc li { counter-increment: t; }
.toc a { display: grid; grid-template-columns: 1.8rem 1fr; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: .93rem; font-weight: 600; line-height: 1.35; }
.toc a::before { content: counter(t, decimal-leading-zero); color: var(--p600); font-weight: 800; font-size: .8rem; padding-top: 2px; }
.toc a:hover { color: var(--p600); text-decoration: underline; }
.needs { border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 28px; background: #fff; }
.needs h2 { font-size: 1.1rem; }
@media (min-width: 640px) { .needs .checks { grid-template-columns: 1fr 1fr; column-gap: 20px; } }

.prose { color: var(--text); }
.prose h2 { margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.prose > h2:first-child, .prose > section:first-child h2 { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { margin-top: 1.5rem; color: var(--ink); }
.prose ul { padding-left: 1.3rem; }
.prose li { margin: .4rem 0; }
.prose li::marker { color: var(--p600); }
.prose ol { list-style: none; padding: 0; margin: 0 0 1.2rem; counter-reset: step; }
.prose ol > li { counter-increment: step; position: relative; padding: 2px 0 8px 3rem; margin: 0 0 6px; min-height: 2.2rem; }
.prose ol > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--p800); color: #fff; font-weight: 800; font-size: .95rem; display: grid; place-items: center; }
.prose ol > li:not(:last-child)::after { content: ""; position: absolute; left: calc(1.05rem - 1px); top: 2.3rem; bottom: -4px; width: 2px; background: var(--l200); }
.prose ol[start] { counter-reset: none; }
.prose li p { margin: .5rem 0 0; }
.prose em { color: var(--ink); font-style: normal; font-weight: 600; background: var(--l100); border-radius: 4px; padding: 0 4px; }
.prose strong { color: var(--ink); }
.checkpoint { display: inline-block; background: var(--ok-soft); color: var(--ok) !important; border-radius: 5px; padding: 0 6px; font-size: .88em; letter-spacing: .02em; }
#key-terms + ul { list-style: none; padding: 16px 18px; background: var(--l50); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 4px; }
#key-terms + ul li { margin: 0; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
#key-terms + ul li:last-child { border-bottom: 0; }
#if-something-goes-wrong + ul { list-style: none; padding: 0; display: grid; gap: 10px; }
#if-something-goes-wrong + ul li { margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); border-left: 4px solid #d98a1e; }
#check-that-it-worked + p, #check-that-it-worked + ul { background: var(--ok-soft); border-radius: 10px; padding: 12px 16px; }
#check-that-it-worked + ul { list-style: none; }
#faq ~ h3 { font-size: 1.05rem; }
.diagram { margin: 1.4rem 0 1.6rem; padding: 0; }
.diagram-svg { display: block; width: 100%; height: auto; }
.diagram figcaption { font-size: .88rem; color: var(--muted); margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--l300); }
.sources { margin-top: 32px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; }
.sources h2 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.sources h2 .icon { color: var(--p700); }
.sources ul { margin: 0 0 10px; padding-left: 1.2rem; }
.sources li { margin: 4px 0; }
.ext::after { content: " ↗"; font-size: .85em; }
.independence { margin-top: 20px; border-radius: var(--radius); padding: 16px 20px; background: var(--l100); font-size: .93rem; }
.independence p:last-child { margin: 0; display: flex; gap: 10px; }
.independence .icon { color: var(--p700); margin-top: 3px; }
.related h2 { margin-bottom: 20px; }

/* ---------- Search ---------- */
.search-results-wrap { padding: 28px 0 56px; }
.search-status { font-weight: 600; color: var(--ink); }
.search-results { margin-bottom: 28px; }
.notice-inline { background: var(--warn-soft); border-radius: 10px; padding: 12px 16px; }
.nf-body { padding: 28px 0 56px; }

/* ---------- Document pages ---------- */
.doc-layout { display: grid; gap: 28px; padding: 32px 0 60px; }
.doc-layout > * { min-width: 0; }
@media (min-width: 1000px) { .doc-layout { grid-template-columns: 260px minmax(0, 760px); gap: 48px; } .doc-layout-single { grid-template-columns: minmax(0, 800px); } }
.doc-body section + section h2 { margin-top: 2rem; }
.doc-body h2 { border-top: 0; padding-top: 0; }
.contact-layout { display: grid; gap: 28px; padding: 32px 0 60px; }
@media (min-width: 900px) { .contact-layout { grid-template-columns: 360px 1fr; align-items: start; } }
.contact-card { border: 2px solid var(--p800); border-radius: var(--radius); padding: 22px; box-shadow: 8px 8px 0 var(--l200); }
.contact-card h2 { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--p900); color: #d6cdf2; padding: 48px 0 0; font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--l300); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (min-width: 1000px) { .footer-grid { grid-template-columns: 1.6fr 1.2fr 1fr 1fr; } }
.footer-brand .brand { background: #fff; padding: 8px 12px; border-radius: 10px; margin-bottom: 14px; }
.footer-brand p { color: #d6cdf2; }
.footer-email { display: flex; gap: 8px; }
.footer-email .icon { margin-top: 4px; color: var(--l300); }
.footer-col h2 { color: #fff; font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.footer-base { border-top: 1px solid rgba(255,255,255,.14); margin-top: 36px; padding: 18px 0 28px; font-size: .85rem; color: #bfb4e3; }
.footer-base p { margin: 0; }

@media (max-width: 520px) {
  body { font-size: 16.5px; }
  .section { padding: 44px 0; }
  .hero { padding: 32px 0 40px; }
  .search-row .btn { padding: 11px 14px; }
  .brand-word { font-size: 1.2rem; }
  .start-card { box-shadow: 6px 6px 0 var(--l200); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .masthead, .site-footer, .toc, .related, .skip-link { display: none !important; }
  .prose ol > li::before { background: #fff; color: #000; border: 1px solid #000; }
}
@media (max-width: 479px) {
  .masthead-inner { gap: 6px; }
  .brand { gap: 8px; }
  .brand .logo-mark { width: 34px; height: 34px; }
  .brand-word { font-size: 1.12rem; }
  .head-search-link { padding: 8px; }
  .head-search-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .menu-toggle { padding: 9px 11px; }
}
@media (max-width: 599px) {
  .diagram-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .diagram-svg { min-width: 560px; }
}
