/* © 2026 Giuseppe Della Corte — All rights reserved
   Learn Embedded Security. Standalone design: nothing shared with the rest of the site. */

:root {
  --paper: #ffffff; --paper-2: #f4f4f1; --card: #ffffff;
  --ink: #141a17; --ink-2: #2b3430; --muted: #5d6762;
  --line: #e3e1db; --line-2: #c8c5bc;
  --acc: #e4611a; --acc-ink: #b84a0e; --acc-soft: #fbe5d6;
  --copper: #8c4a1a; --copper-soft: #f3e3d3;
  --red: #b23c2a; --red-soft: #f6ddd6; --ok: #2a7a4b; --ok-soft: #dcefe4;
  --term: #15110d; --term-fg: #f3c9a6; --term-dim: #8c6a52;
  --radius: 10px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 64ch; --side-w: 264px; --gutter: clamp(16px, 4vw, 44px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12100d; --paper-2: #1a1713; --card: #1e1a15; --ink: #ebe6dc; --ink-2: #d3cdc2; --muted: #a29a8e;
    --line: #2e2922; --line-2: #3f382f; --acc: #ff8a47; --acc-ink: #ffa26e; --acc-soft: #33200f;
    --copper: #d9975f; --copper-soft: #2c1f14; --red: #ef8a79; --red-soft: #35191a; --ok: #5fcf8f; --ok-soft: #15291f;
    --term: #0b0906; --term-fg: #f3c9a6; --term-dim: #7a604b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12100d; --paper-2: #1a1713; --card: #1e1a15; --ink: #ebe6dc; --ink-2: #d3cdc2; --muted: #a29a8e;
  --line: #2e2922; --line-2: #3f382f; --acc: #ff8a47; --acc-ink: #ffa26e; --acc-soft: #33200f;
  --copper: #d9975f; --copper-soft: #2c1f14; --red: #ef8a79; --red-soft: #35191a; --ok: #5fcf8f; --ok-soft: #15291f;
  --term: #0b0906; --term-fg: #f3c9a6; --term-dim: #7a604b; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.58;
  background-image: radial-gradient(color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px); background-size: 22px 22px; -webkit-font-smoothing: antialiased; }
img, svg, video, iframe, canvas { max-width: 100%; }
html, body { overflow-x: clip; }
.tbl { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.tbl table { min-width: 100%; }
a { color: var(--acc-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--acc); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); font-stretch: 62%; font-weight: 300; letter-spacing: 0; line-height: 1.04; margin: 0; }
p { margin: 0 0 0.9em; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--paper-2); padding: 0.06em 0.36em; border-radius: 4px; border: 1px solid var(--line); }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.4em; background: var(--card); font-size: 0.8em; }
.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; }
[hidden] { display: none !important; }
.label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* top bar */
.c-top { position: sticky; top: 0; z-index: 50; height: 52px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.c-top .brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em; white-space: nowrap; }
.c-top .brand > a { color: var(--ink); text-decoration: none; }
.c-top .brand b { font-weight: 600; }
.c-top .crumb { color: var(--muted); }
.c-top .crumb a { color: var(--muted); text-decoration: none; }
.c-top .crumb a:hover { color: var(--acc); }
@media (max-width: 640px) { .c-top .brand .crumb { display: none; } }
.c-top .pos { justify-self: center; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; margin: 0; }
.c-top .pos b { color: var(--ink); font-weight: 500; }
@media (max-width: 1100px) { .c-top .pos { display: none; } }
.c-top .tools { display: flex; gap: 8px; align-items: center; }
.tbtn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.tbtn:hover { border-color: var(--acc); color: var(--acc-ink); }
.c-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; }
.c-progress i { display: block; height: 100%; width: 0; background: var(--acc); transition: width 0.25s ease; }

/* layout */
.c-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.c-side { position: sticky; top: 52px; height: calc(100vh - 52px); height: calc(100dvh - 52px); overflow: auto; padding: 24px 16px 40px var(--gutter); border-right: 1px solid var(--line); scrollbar-width: thin; }
.c-main { min-width: 0; padding: 0 var(--gutter) 80px; }
@media (max-width: 1100px) {
  .c-shell { grid-template-columns: 1fr; }
  .c-side { position: fixed; inset: 52px auto 0 0; width: min(88vw, 360px); height: auto; background: var(--paper); z-index: 60; transform: translateX(-104%); transition: transform 0.25s ease; border-right: 1px solid var(--line-2); }
  .c-side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,0.35); }
  html:not(.js) .c-side { position: static; transform: none; width: auto; height: auto; }
}
.map-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.map { list-style: none; margin: 0; padding: 0; }
.map > li { margin: 0 0 4px; }
.map a { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: 0.9rem; line-height: 1.3; border: 1px solid transparent; }
.map a:hover { background: var(--card); border-color: var(--line); color: var(--ink); }
.map a.is-current { background: var(--card); border-color: var(--acc); color: var(--ink); }
.map .ring { width: 24px; height: 24px; border-radius: 50%; position: relative; background: conic-gradient(var(--acc) calc(var(--p, 0) * 1%), var(--line) 0); }
.map .ring::after { content: attr(data-n); position: absolute; inset: 3px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-family: var(--mono); font-size: 0.62rem; color: var(--muted); }
.map a.is-current .ring::after { background: var(--card); }
.map .ring.done { background: var(--acc); }
.map .ring.done::after { content: "✓"; color: var(--acc-ink); }
.map .sub { list-style: none; margin: 2px 0 8px 36px; padding: 0; border-left: 1px solid var(--line); }
.map .sub a { display: block; grid-template-columns: none; padding: 4px 10px; font-size: 0.78rem; color: var(--muted); border-radius: 0 6px 6px 0; border: 0; }
.map .sub a.is-done { color: var(--acc-ink); }
.map .sub a.is-done::before { content: "✓ "; }
.map .sub a.is-current { color: var(--ink); background: transparent; box-shadow: inset 2px 0 0 var(--acc); }
.map-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.mbtn { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-size: 0.76rem; color: var(--muted); }
.mbtn:hover { border-color: var(--red); color: var(--red); }
.map-toggle { display: none; }
@media (max-width: 1100px) { .map-toggle { display: inline-flex; } }

/* hero */
.c-hero { position: relative; padding: clamp(36px, 6vw, 80px) 0 clamp(28px, 4vw, 48px); border-bottom: 1px solid var(--line); overflow: hidden; }
.c-hero .hero-in { position: relative; z-index: 1; }
.c-hero h1 { font-size: clamp(2.6rem, 6.4vw, 5.6rem); font-weight: 300; letter-spacing: -0.005em; line-height: 0.96; max-width: 15ch; }
.c-hero h1 em { font-style: normal; color: var(--acc); }
.c-hero .lede { font-size: clamp(1.02rem, 1.5vw, 1.22rem); line-height: 1.5; max-width: 58ch; margin: 20px 0 0; color: var(--ink-2); }
.c-hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); text-decoration: none; cursor: pointer; font-family: var(--cond); font-weight: 600; font-size: 1rem; }
.btn:hover { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--card); color: var(--acc-ink); border-color: var(--acc); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 0.9rem; }
.resume-note { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.hero-trace { position: absolute; right: -40px; top: 0; width: min(46vw, 680px); height: 100%; opacity: 0.7; pointer-events: none; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 38%); mask-image: linear-gradient(90deg, transparent 0, #000 38%); }
@media (max-width: 900px) { .hero-trace { width: 110vw; right: -40vw; opacity: 0.22; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 60%); mask-image: linear-gradient(180deg, transparent 0, #000 60%); } }
.hero-trace path { fill: none; stroke: var(--acc); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }
.hero-trace circle { fill: var(--copper); }
.hero-trace .pad { fill: none; stroke: var(--copper); stroke-width: 1.4; }
.js .hero-trace path { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: trace 4s ease-out forwards; }
.js .hero-trace path:nth-child(2n) { animation-delay: 0.6s; }
@keyframes trace { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .js .hero-trace path { animation: none; stroke-dashoffset: 0; } }
.hero-modules { list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 22px; max-width: 980px; }
.hero-modules a { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 6px 0; text-decoration: none; color: var(--ink-2); font-size: 0.92rem; border-bottom: 1px solid var(--line); }
.hero-modules a:hover { color: var(--acc-ink); }
.hero-modules .n { font-family: var(--mono); font-size: 0.7rem; color: var(--acc-ink); padding-top: 4px; }

/* module */
.module-head { padding: clamp(40px, 6vw, 72px) 0 18px; border-bottom: 2px solid var(--ink); }
.module-head .mnum { font-family: var(--cond); font-weight: 700; font-size: clamp(3rem, 7vw, 5.5rem); line-height: 0.85; letter-spacing: -0.04em; color: var(--acc); }
.module-head h2 { font-size: clamp(1.9rem, 4.2vw, 3.2rem); font-weight: 300; letter-spacing: 0; margin-top: 10px; max-width: 22ch; }
.module-head .goal { font-size: 1.02rem; color: var(--ink-2); max-width: 60ch; margin: 10px 0 0; }

/* lesson: question → explanation → check */
.lesson { padding: clamp(32px, 4.5vw, 56px) 0; border-bottom: 1px solid var(--line); scroll-margin-top: 66px; }
.lesson h3.q { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 400; max-width: 26ch; }
.lesson h3.q::before { content: "Q"; display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; margin-right: 0.4em; border-radius: 6px; background: var(--acc); color: #fff; font-family: var(--mono); font-size: 0.5em; vertical-align: 0.35em; }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 400px); gap: clamp(20px, 3.5vw, 48px); align-items: start; margin-top: 18px; }
@media (max-width: 980px) { .lesson-grid { grid-template-columns: 1fr; } }
.prose { min-width: 0; }
.prose > p, .prose > ul, .prose > ol, .prose > dl, .prose > blockquote, .prose > pre, .prose > .note { max-width: var(--measure); }
.prose p, .prose li { color: var(--ink-2); }
.answer { font-size: 1.1rem; line-height: 1.5; color: var(--ink); padding: 2px 0 2px 16px; border-left: 3px solid var(--acc); margin-bottom: 1.1em; }
.answer strong { font-weight: 600; }
.prose h4 { font-size: 1.1rem; margin: 1.4em 0 0.45em; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--acc); font-family: var(--mono); font-size: 0.85em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose blockquote { margin: 1.1em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--line-2); color: var(--ink); font-size: 1rem; }
.prose blockquote p { margin: 0 0 0.3em; color: var(--ink); }
.prose blockquote cite { font-style: normal; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 1em 0 1.2em; background: var(--card); border: 1px solid var(--line); }
.prose th, .prose td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--paper-2); }
.prose td.num, .prose th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.82rem; white-space: nowrap; }
.s { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; white-space: nowrap; vertical-align: 0.15em; margin-left: 4px; }
.s:hover { color: var(--acc-ink); border-color: var(--acc); }
.s::before { content: "↗ "; }
.def { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0.6em 0 1.1em; }
@media (max-width: 560px) { .def { grid-template-columns: 1fr; gap: 2px 0; } .def dd { margin-bottom: 8px; } }
.def dt { font-family: var(--cond); font-weight: 600; font-size: 1rem; color: var(--ink); padding-top: 1px; }
.def dd { margin: 0; font-size: 0.93rem; color: var(--ink-2); }
.note { margin: 1em 0; padding: 12px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 0.93rem; color: var(--ink-2); }
.note.warn { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.note b { color: var(--ink); }
.term { background: var(--term); color: var(--term-fg); border-radius: var(--radius); padding: 14px 16px; font-family: var(--mono); font-size: 0.8rem; line-height: 1.55; overflow-x: auto; margin: 1em 0 1.2em; }
.term .c { color: var(--term-dim); }
.term b { color: #fff; font-weight: 500; }

/* diagrams */
.diagram { margin: 1.2em 0; padding: 14px 14px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.diagram svg { display: block; width: 100%; height: auto; font-family: var(--sans); }
.diagram figcaption { margin-top: 8px; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.diagram .t { font-size: 13px; fill: var(--ink); }
.diagram .m { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); letter-spacing: 0.04em; }
.diagram .b { font-size: 13px; fill: var(--ink); font-weight: 600; }
.diagram .w { fill: #fff; }
.diagram .box { fill: var(--paper); stroke: var(--line-2); stroke-width: 1.2; }
.diagram .box-acc { fill: var(--acc-soft); stroke: var(--acc); stroke-width: 1.4; }
.diagram .box-ink { fill: var(--ink); stroke: var(--ink); }
.diagram .box-red { fill: var(--red-soft); stroke: var(--red); stroke-width: 1.2; }
.diagram .box-ok { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 1.2; }
.diagram .ln { stroke: var(--ink-2); stroke-width: 1.4; fill: none; }
.diagram .ln-acc { stroke: var(--acc); stroke-width: 1.8; fill: none; }
.diagram .ln-red { stroke: var(--red); stroke-width: 1.6; fill: none; stroke-dasharray: 4 3; }
.diagram .ln-dim { stroke: var(--line-2); stroke-width: 1.2; fill: none; }
.diagram .fill-acc { fill: var(--acc); }
.diagram .fill-red { fill: var(--red); }
.diagram .fill-ok { fill: var(--ok); }
.diagram .fill-dim { fill: var(--line-2); }
.diagram .tw { font-size: 13px; fill: var(--paper); font-weight: 600; }

/* 3D scenes */
.scene { margin: 1.2em 0; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.scene .sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.scene .sc-head .label { margin: 0; color: var(--ink); }
.scene .sc-head .label::before { content: "◈ "; color: var(--acc); }
.scene .sc-view { position: relative; aspect-ratio: 16 / 10; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--paper-2) 60%, var(--card)) 0, var(--card) 70%); touch-action: none; cursor: grab; }
.scene .sc-view:active { cursor: grabbing; }
.scene canvas { display: block; width: 100% !important; height: 100% !important; }
.scene .lbl { position: absolute; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); background: color-mix(in srgb, var(--card) 85%, transparent); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; pointer-events: none; white-space: nowrap; transition: opacity 0.2s; }
.scene .lbl.hot { border-color: var(--acc); color: var(--acc-ink); pointer-events: auto; cursor: pointer; }
.scene .lbl.on { background: var(--acc); color: #fff; border-color: var(--acc); }
.scene .sc-hint { position: absolute; left: 12px; bottom: 10px; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.scene .sc-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.scene .sc-info { padding: 12px 14px 14px; border-top: 1px solid var(--line); font-size: 0.93rem; color: var(--ink-2); min-height: 48px; }
.scene .sc-info b { color: var(--ink); font-family: var(--cond); font-size: 1.05rem; }
.scene .sc-info dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0 0; }
.scene .sc-info dt { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.scene .sc-info dd { margin: 0; }
.scene .sc-fallback { padding: 14px; }
.scene .sc-fallback svg { width: 100%; height: auto; }
.chip { height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font-size: 0.84rem; }
.chip:hover { border-color: var(--acc); }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.red { border-color: color-mix(in srgb, var(--red) 50%, var(--line-2)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* widgets (2D) */
.widget { margin: 1.2em 0; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.widget .w-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.widget .w-head .label { margin: 0; color: var(--ink); }
.widget .w-head .label::before { content: "▣ "; color: var(--acc); }
.widget .w-body { padding: 14px; }
.widget .w-body p { font-size: 0.93rem; }
.w-row { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.w-row:last-of-type { border-bottom: 0; }
.w-row > .label { color: var(--ink); }
@media (max-width: 640px) { .w-row { grid-template-columns: 1fr; gap: 6px; } }
.w-out { margin-top: 12px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 0.93rem; }
.w-out b.big { display: block; font-family: var(--cond); font-weight: 700; font-size: 1.7rem; line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 4px; }
.w-out.act b.big { color: var(--red); }
.w-out.attend b.big { color: var(--acc-ink); }
.w-out.track b.big { color: var(--ok); }
.w-out .why { color: var(--ink-2); font-size: 0.9rem; margin: 0; }
.stepper { display: grid; grid-template-columns: 210px 1fr; }
@media (max-width: 760px) { .stepper { grid-template-columns: 1fr; } .stepper ol { border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; } .stepper ol li { flex: 0 0 auto; } }
.stepper ol { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--line); }
.stepper ol button { display: block; width: 100%; text-align: left; padding: 9px 14px; border: 0; background: transparent; cursor: pointer; font-size: 0.86rem; border-left: 3px solid transparent; }
.stepper ol button:hover { background: var(--paper-2); }
.stepper ol button[aria-selected="true"] { border-left-color: var(--acc); background: var(--paper-2); font-weight: 600; }
.stepper ol button .n { font-family: var(--mono); font-size: 0.64rem; color: var(--acc-ink); margin-right: 8px; }
.stepper .pane { padding: 14px 16px; }
.stepper .pane h4 { font-size: 1.08rem; margin: 0 0 6px; }
.stepper .pane p { font-size: 0.92rem; }
.stepper .pane .tools { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.timeline { position: relative; list-style: none; margin: 8px 0 0; padding: 0 0 0 20px; border-left: 2px solid var(--line-2); }
.timeline li { position: relative; padding: 0 0 14px; }
.timeline li::before { content: ""; position: absolute; left: -27px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--acc); }
.timeline li.past::before { background: var(--acc); }
.timeline li.key::before { border-color: var(--ink); background: var(--ink); }
.timeline time { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--acc-ink); display: block; }
.timeline b { display: block; font-family: var(--cond); font-size: 1.02rem; font-weight: 600; }
.timeline p { margin: 2px 0 0; font-size: 0.88rem; color: var(--ink-2); }
.clock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; }
.clock { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--paper); }
.clock .label { color: var(--acc-ink); }
.clock b { display: block; font-family: var(--cond); font-size: 1.4rem; font-weight: 600; margin: 4px 0; line-height: 1.1; }
.clock span { font-size: 0.82rem; color: var(--ink-2); }
input[type="datetime-local"], select { font: inherit; font-size: 0.88rem; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); }
.matcher { display: grid; gap: 8px; }
.matcher .q { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.matcher .q p { margin: 0 0 8px; font-size: 0.92rem; color: var(--ink); }
.matcher .q .chip { height: 28px; font-size: 0.78rem; }
.matcher .q.ok { border-color: var(--ok); }
.matcher .q.ok .chip[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.matcher .q.ko { border-color: var(--red); }
.matcher .q.ko .chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.matcher .fb { font-size: 0.82rem; color: var(--muted); margin: 8px 0 0; }
.compare { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.compare th, .compare td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare th { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.compare td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare tr.hi td { background: color-mix(in srgb, var(--acc-soft) 60%, transparent); }
[data-triage] .compare { min-width: 860px; }
[data-triage] .compare td:last-child { min-width: 220px; font-size: 0.82rem; color: var(--ink-2); }
.meter { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; display: inline-block; width: 60px; vertical-align: middle; }
.meter i { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: var(--acc); }
.pill-kev { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--red); color: var(--red); white-space: nowrap; }

/* aside */
.lesson-aside { position: sticky; top: 66px; display: grid; gap: 14px; }
@media (max-width: 980px) { .lesson-aside { position: static; } }
.aside-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.aside-card .cap { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.aside-card .cap .label { margin: 0; }
.aside-card .body { padding: 10px 12px; }
.aside-card .body p { margin: 0; font-size: 0.86rem; color: var(--ink-2); }
.srcs { list-style: none; margin: 0; padding: 0; }
.srcs li { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 0.84rem; line-height: 1.35; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.srcs li:last-child { border-bottom: 0; }
.srcs a { text-decoration: none; color: var(--ink); }
.srcs a:hover { color: var(--acc-ink); text-decoration: underline; }
.srcs small { display: block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.srcs .star { color: var(--acc); font-size: 0.9rem; }
.srcs .kind { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.yt { position: relative; aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; overflow: hidden; display: block; }
.yt button.play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.72)); cursor: pointer; display: flex; align-items: flex-end; padding: 12px; text-align: left; color: #fff; }
.yt button.play:hover .tri { background: var(--acc); }
.yt .tri { position: absolute; left: 50%; top: 50%; width: 62px; height: 44px; margin: -22px 0 0 -31px; background: rgba(20,18,14,0.85); border-radius: 12px; display: grid; place-items: center; transition: background 0.15s; }
.yt .tri::after { content: ""; border-style: solid; border-width: 10px 0 10px 18px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.yt .vt { font-size: 0.84rem; line-height: 1.3; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.yt .vt small { display: block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; margin-top: 3px; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vid { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.yt-note { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); padding: 7px 12px; border-top: 1px solid var(--line); margin: 0; }
.yt-note a { color: var(--muted); }
html:not(.js) .yt button.play { display: none; }
/* video summary: read instead of watching */
.vsum { border-top: 1px solid var(--line); }
.vsum summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--acc-ink); }
.vsum summary::-webkit-details-marker { display: none; }
.vsum summary::after { content: "+"; font-size: 0.9rem; line-height: 1; color: var(--muted); }
.vsum[open] summary::after { content: "\2212"; }
.vsum summary:hover { color: var(--acc); }
.vs-body { padding: 0 12px 12px; font-size: 0.86rem; line-height: 1.5; color: var(--ink-2); }
.vs-body p { margin: 0 0 8px; }
.vs-body ul { margin: 0 0 8px; padding-left: 18px; }
.vs-body li { margin-bottom: 4px; }
.vs-body li::marker { color: var(--acc); }
.vs-body .vs-skip { font-size: 0.78rem; color: var(--muted); margin: 0; }
.vs-body .vs-src { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 0; }
@media print { .vsum { border-top: 0; } .vsum summary { display: none; } .vsum:not([open]) .vs-body { display: block; } }
.watch-list { list-style: none; margin: 0; padding: 0; }
.watch-list li { border-bottom: 1px solid var(--line); }
.watch-list li:last-child { border-bottom: 0; }

/* inline check */
.check { margin-top: 26px; border: 1px solid var(--ink); border-radius: 12px; background: var(--card); overflow: hidden; scroll-margin-top: 66px; }
.check .ck-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; }
.check .ck-head .state { opacity: 0.8; }
.check .ck-head .state.done { color: var(--acc); opacity: 1; }
.ck-q { padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.ck-q:last-child { border-bottom: 0; }
.ck-q .q-text { font-family: var(--cond); font-weight: 600; font-size: 1.12rem; line-height: 1.3; margin: 0 0 10px; }
.opts { display: grid; gap: 6px; }
.opt { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; text-align: left; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--paper); cursor: pointer; font-size: 0.93rem; line-height: 1.35; }
.opt:hover { border-color: var(--acc); }
.opt .k { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--mono); font-size: 0.66rem; }
.opt[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt[aria-checked="true"] .k { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.opt[data-state="correct"] { border-color: var(--ok); background: var(--ok-soft); box-shadow: inset 0 0 0 1px var(--ok); }
.opt[data-state="correct"] .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt[data-state="wrong"] { border-color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.opt[data-state="wrong"] .k { background: var(--red); border-color: var(--red); color: #fff; }
.opt[disabled] { cursor: default; }
.q-fb { margin-top: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 0.9rem; }
.q-fb b { font-family: var(--cond); font-size: 1rem; }
.q-fb.ok { border-color: var(--ok); }
.q-fb.ko { border-color: var(--red); }
.q-fb .src { display: block; margin-top: 4px; font-family: var(--mono); font-size: 0.66rem; color: var(--muted); }
.q-fb .q-x { margin: 10px 0 6px; padding: 10px 12px; border-left: 3px solid var(--acc); background: var(--card); color: var(--ink-2); font-size: 0.92rem; line-height: 1.55; }
.q-fb .q-x a { font-family: var(--mono); font-size: 0.7rem; margin-left: 6px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.q-hint { font-family: var(--mono); font-size: 0.64rem; color: var(--muted); margin-left: auto; }
html:not(.js) .check::after { content: "The check needs JavaScript."; display: block; padding: 12px 14px; color: var(--muted); font-size: 0.86rem; }

/* exam */
.quiz { margin: 18px 0 0; border: 2px solid var(--ink); border-radius: 14px; background: var(--card); overflow: hidden; scroll-margin-top: 66px; }
.quiz-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--ink); color: var(--paper); }
.quiz-head h3 { font-size: 1.4rem; font-weight: 400; color: inherit; }
.quiz-head .score { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; }
.quiz-body { padding: 18px; }
.q-prog { display: flex; gap: 4px; margin-bottom: 16px; }
.q-prog i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.q-prog i.ok { background: var(--ok); }
.q-prog i.ko { background: var(--red); }
.q-prog i.now { background: var(--ink); }
.quiz .q-text { font-family: var(--cond); font-weight: 600; font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.25; margin: 0 0 14px; max-width: 60ch; }
.quiz .q-text .qn { font-family: var(--mono); font-weight: 400; font-size: 0.7rem; letter-spacing: 0.1em; color: var(--acc-ink); display: block; margin-bottom: 6px; }
.q-result .big { font-family: var(--cond); font-weight: 700; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; letter-spacing: -0.03em; }
.q-result .big small { font-size: 0.45em; color: var(--muted); font-weight: 600; margin-left: 6px; }
.q-result p { margin: 8px 0 0; max-width: 60ch; color: var(--ink-2); }
.q-result .review { margin-top: 12px; padding: 0; list-style: none; display: grid; gap: 6px; }
.q-result .review li { font-size: 0.88rem; padding: 7px 12px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); }
.q-result .review li.ko { border-color: color-mix(in srgb, var(--red) 50%, var(--line)); }
.q-result .review li a { font-family: var(--mono); font-size: 0.68rem; margin-left: 6px; }
.exam-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: 22px; align-items: start; }
@media (max-width: 860px) { .exam-intro { grid-template-columns: 1fr; } }
.scorecard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.scorecard ul { list-style: none; margin: 8px 0 0; padding: 0; }
.scorecard li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.scorecard li:last-child { border-bottom: 0; }
.scorecard li b { font-family: var(--mono); font-weight: 500; font-size: 0.76rem; }
.scorecard .m { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; grid-column: 1 / -1; }
.scorecard .m i { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: var(--acc); }

/* sections */
.c-section { padding: clamp(32px, 4.5vw, 56px) 0; border-bottom: 1px solid var(--line); }
.c-section > .label { margin-bottom: 8px; }
.c-section h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.c-section .intro { max-width: var(--measure); color: var(--ink-2); font-size: 1rem; margin-top: 10px; }
.gloss { columns: 2; column-gap: 32px; margin-top: 16px; }
@media (max-width: 760px) { .gloss { columns: 1; } }
.gloss div { break-inside: avoid; padding: 8px 0; border-bottom: 1px solid var(--line); }
.gloss dt { font-family: var(--cond); font-weight: 600; font-size: 1rem; }
.gloss dd { margin: 2px 0 0; font-size: 0.88rem; color: var(--ink-2); }
.srcgroups { display: grid; gap: 18px; margin-top: 18px; }
.srcgroup h3 { font-size: 1.25rem; font-weight: 400; margin-bottom: 6px; }
.srcgroup ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 28px; }
@media (max-width: 820px) { .srcgroup ul { columns: 1; } }
.srcgroup li { break-inside: avoid; font-size: 0.88rem; padding: 4px 0; display: flex; gap: 8px; align-items: baseline; }
.srcgroup li .star { color: var(--acc); width: 12px; flex: 0 0 12px; }
.srcgroup li .kind { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.srcgroup a { color: var(--ink); text-decoration-color: var(--line-2); }
.srcgroup a:hover { color: var(--acc-ink); }
.c-foot { padding: 22px 0 0; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 20px; }
.c-foot a { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--paper); padding: 9px 14px; border-radius: 999px; font-family: var(--mono); font-size: 0.72rem; z-index: 80; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.js .lesson, .js .module-head { opacity: 0; transform: translateY(10px); transition: opacity 0.5s ease, transform 0.5s ease; }
.js .lesson.in, .js .module-head.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .lesson, .js .module-head { opacity: 1; transform: none; transition: none; } }
@media print { .c-top, .c-side, .yt, .widget, .scene, .check, .quiz, .toast, .cta-row { display: none !important; } .c-shell { display: block; } body { background: #fff; color: #000; font-size: 11pt; } .lesson-grid { display: block; } a { color: #000; } }

/* flashcards, inline per lesson */
.aside-card.fc .cap { gap: 8px; }
.fc-modes { display: flex; gap: 4px; }
.fc-modes .chip { height: 24px; padding: 0 9px; font-size: 0.7rem; }
.fc-body { padding: 10px 12px 6px; display: grid; gap: 8px; }
.fc-prog { display: flex; gap: 2px; }
.fc-prog i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.fc-prog i.seen { background: var(--line-2); }
.fc-prog i.ok { background: var(--ok); }
.fc-prog i.again { background: var(--red); }
.fc-prog i.now { background: var(--ink); }
.fc-card { perspective: 1200px; min-height: 170px; cursor: pointer; outline-offset: 4px; }
.fc-inner { position: relative; width: 100%; min-height: 170px; transition: transform 0.45s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) { .fc-inner { transition: none; } }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); padding: 12px 14px; display: grid; grid-template-rows: auto 1fr auto; gap: 6px; overflow: auto; }
.fc-face.back { transform: rotateY(180deg); border-color: var(--acc); }
.fc-face .label { margin: 0; font-size: 0.62rem; }
.fc-face .fc-text { font-family: var(--cond); font-weight: 600; font-size: 1.1rem; line-height: 1.25; align-self: center; }
.fc-face.back .fc-text { font-family: var(--sans); font-weight: 400; font-size: 0.86rem; line-height: 1.45; color: var(--ink-2); }
.fc-face .fc-foot { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
.fc-actions { display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; }
.fc-actions .chip { height: 28px; padding: 0 11px; font-size: 0.78rem; }
.fc-actions .chip.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.fc-actions .chip.again { background: var(--red); border-color: var(--red); color: #fff; }
.fc-actions .hint { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); margin-left: auto; }
.fc-summary { text-align: center; padding: 18px 8px; }
.fc-summary .big { font-family: var(--cond); font-weight: 700; font-size: 2rem; line-height: 1; letter-spacing: -0.03em; }
.fc-summary p { color: var(--ink-2); margin: 6px 0 0; font-size: 0.86rem; }

/* glossary hover explainers */
.gl { text-decoration: underline dotted var(--acc); text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: help; border-radius: 2px; }
.gl:hover, .gl:focus-visible { background: var(--acc-soft); outline: none; }
.gl-pop { position: absolute; z-index: 70; max-width: 320px; padding: 10px 12px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 0.86rem; line-height: 1.45; box-shadow: 0 12px 30px rgba(0,0,0,0.25); pointer-events: auto; }
.gl-pop b { display: block; font-family: var(--cond); font-size: 1rem; margin-bottom: 3px; }
.gl-pop a { color: var(--acc); font-family: var(--mono); font-size: 0.68rem; text-decoration: none; display: inline-block; margin-top: 6px; }
.gl-pop::before { content: ""; position: absolute; left: var(--ax, 16px); top: -6px; width: 12px; height: 12px; background: var(--ink); transform: rotate(45deg); }
.gl-pop.up::before { top: auto; bottom: -6px; }
