:root {
  --bg: #F3EEE6;
  --surface: #FBF8F3;
  --ink: #2B2824;
  --muted: #7A7166;
  --rule: #E2D9CC;
  --stone: #D9D0C3;
  --accent: #A65A3A;
  --accent-soft: #F1E1D7;
  --sage: #5F6F57;
  --sage-soft: #E3E8DD;
  --amber: #9A6B12;
  --amber-soft: #F4E7C8;
  --red: #A23B2F;
  --red-soft: #F4DCD7;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px; --s7: 64px;
  --radius: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(32px, 4.5vw, 52px); line-height: 1.05; margin: 0 0 var(--s3); }
h2 { font-size: 26px; line-height: 1.15; margin: 0 0 var(--s3); }
h3 { font-size: 19px; margin: 0 0 var(--s2); }
p { text-wrap: pretty; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.kicker { font: 600 11px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--s3); }
.nowrap { white-space: nowrap; }

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s4);
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { font: 400 21px/1 var(--serif); text-decoration: none; white-space: nowrap; }
.brand small { font: 500 11px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-left: 10px; }
.topbar nav { display: flex; gap: var(--s1); margin-left: auto; align-items: center; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; padding: 6px 12px; border-radius: 99px; color: var(--muted); font-size: 14px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--ink); background: var(--surface); }
.who { font-size: 13px; color: var(--muted); }

main { padding: var(--s5) clamp(16px, 4vw, 40px) var(--s7); max-width: 1240px; margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 99px; font-weight: 500; font-size: 14px; text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--stone); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

/* ---------- landing ---------- */
.landing {
  min-height: calc(100svh - 60px);
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s6); align-items: center;
  max-width: 1240px; margin: 0 auto; padding: var(--s6) clamp(16px, 4vw, 40px);
}
.landing h1 { font-size: clamp(44px, 6.5vw, 84px); }
.landing h1 em { font-style: italic; color: var(--accent); }
.landing .lede { font-size: 18px; color: var(--muted); max-width: 46ch; margin-bottom: var(--s5); }
.plan-art { width: 100%; height: auto; }
.plan-art .draw { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.4s cubic-bezier(.6,.1,.2,1) forwards; }
.plan-art .draw.d2 { animation-delay: .5s; }
.plan-art .draw.d3 { animation-delay: 1s; }
.plan-art .fade { opacity: 0; animation: fade .8s ease forwards 1.6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

.entry { display: grid; gap: var(--s3); max-width: 520px; }
.entry-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
select, input, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--stone); border-radius: var(--radius); padding: 10px 12px; min-width: 0;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.entry select { flex: 1 1 260px; }
.demo-note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--rule); padding-top: var(--s3); margin-top: var(--s3); }

/* ---------- reveal motion ---------- */
.reveal > * { opacity: 0; transform: translateY(8px); animation: rise .5s ease forwards; }
.reveal > *:nth-child(2) { animation-delay: .06s; }
.reveal > *:nth-child(3) { animation-delay: .12s; }
.reveal > *:nth-child(4) { animation-delay: .18s; }
.reveal > *:nth-child(5) { animation-delay: .24s; }
.reveal > *:nth-child(n+6) { animation-delay: .3s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal > *, .plan-art .draw, .plan-art .fade { animation: none; opacity: 1; transform: none; stroke-dashoffset: 0; }
}

/* ---------- learner home ---------- */
.hello { display: grid; grid-template-columns: 1fr auto; gap: var(--s5); align-items: end; padding-bottom: var(--s5); border-bottom: 1px solid var(--rule); margin-bottom: var(--s5); }
.hello p { margin: 0; color: var(--muted); max-width: 60ch; }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--stone) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--bg); }
.ring span { position: relative; font: 400 34px/1 var(--serif); }
.ring small { display: block; font: 500 11px/1.4 var(--sans); color: var(--muted); text-align: center; letter-spacing: .08em; text-transform: uppercase; }

.next-up { display: flex; justify-content: space-between; gap: var(--s4); align-items: center; padding: var(--s4); background: var(--ink); color: var(--bg); border-radius: var(--radius); margin-bottom: var(--s6); flex-wrap: wrap; }
.next-up .kicker { color: #E5B79F; margin-bottom: var(--s2); }
.next-up h3 { margin: 0; font-size: 22px; }
.next-up .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.section-head h2 { margin: 0; }
.mod-list { border-top: 1px solid var(--ink); }
.mod-row {
  display: grid; grid-template-columns: 44px 1fr 170px 120px; gap: var(--s4); align-items: center;
  padding: var(--s4) var(--s2); border-bottom: 1px solid var(--rule); text-decoration: none;
  transition: background .15s ease, padding .15s ease;
}
.mod-row:hover { background: var(--surface); padding-left: var(--s3); }
.mod-row .num { font: 400 22px/1 var(--serif); color: var(--muted); }
.mod-row h3 { margin: 0 0 2px; }
.mod-row p { margin: 0; color: var(--muted); font-size: 14px; }
.media-icons { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: 500 11px/1 var(--sans); letter-spacing: .04em; padding: 5px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; }
.bar { height: 6px; background: var(--stone); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar.sage i { background: var(--sage); }
.mod-state { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.done-mark { color: var(--sage); font-weight: 600; }

/* ---------- module player ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: var(--s3); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.player { display: grid; grid-template-columns: 290px 1fr; gap: var(--s5); align-items: start; }
.steps { position: sticky; top: 84px; border-top: 1px solid var(--ink); }
.steps button {
  width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 10px; text-align: left; align-items: start;
  padding: 14px 6px; background: none; border: 0; border-bottom: 1px solid var(--rule);
}
.steps button:hover { background: var(--surface); }
.steps button.on { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.steps .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--stone); display: grid; place-items: center; font-size: 12px; margin-top: 1px; }
.steps .tick.ok { background: var(--sage); border-color: var(--sage); color: #fff; }
.steps .label { font-size: 14px; line-height: 1.35; }
.steps .type { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.stage { min-width: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: end; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.stage-head h2 { margin: 0; }
.stage-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--rule); flex-wrap: wrap; }

.prose { background: var(--surface); padding: clamp(20px, 4vw, 48px); border-radius: var(--radius); max-width: 760px; }
.prose h1 { font-size: 34px; }
.prose h2 { font-size: 23px; margin-top: var(--s5); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose blockquote { margin: var(--s4) 0; padding: var(--s3) var(--s4); border-left: 3px solid var(--accent); background: var(--accent-soft); font-family: var(--serif); font-size: 18px; }
.prose blockquote p { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: var(--s3) 0; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { border-bottom: 1px solid var(--ink); font-weight: 600; }
.prose code { font-family: var(--mono); font-size: 13px; background: var(--bg); padding: 2px 5px; border-radius: 3px; }

.pdf-frame { width: 100%; height: min(78vh, 900px); border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; }
.video-wrap { background: #111; border-radius: var(--radius); overflow: hidden; }
.video-wrap video { width: 100%; display: block; aspect-ratio: 16 / 9; }
.transcript { margin-top: var(--s3); font-size: 14px; color: var(--muted); }
.transcript summary { cursor: pointer; color: var(--ink); }
.watch-meter { font-size: 13px; color: var(--muted); }

.quiz { display: grid; gap: var(--s4); max-width: 760px; }
.q { background: var(--surface); padding: var(--s4); border-radius: var(--radius); border: 1px solid transparent; }
.q.right { border-color: var(--sage); }
.q.wrong { border-color: var(--red); }
.q legend { font-family: var(--serif); font-size: 19px; margin-bottom: var(--s3); padding: 0; }
.q fieldset { border: 0; padding: 0; margin: 0; }
.q label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; border: 1px solid var(--rule); margin-bottom: 8px; background: var(--bg); }
.q label:hover { border-color: var(--stone); }
.q input { margin-top: 4px; accent-color: var(--accent); }
.q .explain { font-size: 14px; margin: var(--s2) 0 0; }
.result { padding: var(--s4); border-radius: var(--radius); display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.result.pass { background: var(--sage-soft); }
.result.fail { background: var(--red-soft); }
.result .score { font: 400 44px/1 var(--serif); }

.ack { background: var(--surface); padding: clamp(20px, 4vw, 40px); border-radius: var(--radius); max-width: 760px; }
.ack blockquote { font: 400 21px/1.45 var(--serif); margin: 0 0 var(--s4); padding-left: var(--s4); border-left: 3px solid var(--accent); }
.ack .sig { font: italic 400 28px/1 var(--serif); color: var(--accent); }

.celebrate { text-align: center; padding: var(--s6) var(--s4); background: var(--surface); border-radius: var(--radius); }

/* ---------- HR ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); margin-bottom: var(--s6); }
.kpi { padding: var(--s4) var(--s3); border-right: 1px solid var(--rule); }
.kpi:last-child { border-right: 0; }
.kpi .v { font: 400 40px/1 var(--serif); }
.kpi .l { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.kpi .v.warn { color: var(--red); }

.toolbar { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s3); }
.toolbar input[type=search] { flex: 1 1 220px; }
.seg { display: inline-flex; border: 1px solid var(--stone); border-radius: 99px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 12px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--bg); }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
table.data th { text-align: left; font: 600 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; cursor: pointer; user-select: none; }
table.data th.sorted::after { content: " ↓"; }
table.data th.sorted.asc::after { content: " ↑"; }
table.data td { padding: 12px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.data tbody tr { cursor: pointer; transition: background .12s ease; }
table.data tbody tr:hover { background: var(--surface); }
.person { display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 500 13px/1 var(--sans); color: #fff; flex: none; }
.person b { font-weight: 600; display: block; }
.person small { color: var(--muted); }
.pct-cell { display: grid; grid-template-columns: 1fr 40px; gap: 10px; align-items: center; min-width: 140px; }
.status { font: 600 11px/1 var(--sans); letter-spacing: .05em; padding: 6px 9px; border-radius: 99px; white-space: nowrap; }
.status.complete { background: var(--sage-soft); color: var(--sage); }
.status.on-track { background: #E6E9EF; color: #44506A; }
.status.behind { background: var(--amber-soft); color: var(--amber); }
.status.not-started { background: var(--amber-soft); color: var(--amber); }
.status.overdue { background: var(--red-soft); color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); margin-top: var(--s6); }
.dept-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: var(--s3); align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.dept-row .bar { height: 10px; }
.feed { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.feed li { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.feed .ev-fail { color: var(--red); }
.feed .ev-pass { color: var(--sage); }

.mod-table td:first-child { min-width: 220px; }
.hard { font-size: 13px; color: var(--muted); max-width: 320px; }

.profile { display: grid; grid-template-columns: 300px 1fr; gap: var(--s6); align-items: start; }
.profile aside { position: sticky; top: 84px; }
.profile dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: var(--s4) 0; }
.profile dt { color: var(--muted); }
.profile dd { margin: 0; }
.mod-detail { border-bottom: 1px solid var(--rule); padding: var(--s3) 0; }
.mod-detail summary { display: grid; grid-template-columns: 1fr 160px 90px; gap: var(--s3); align-items: center; cursor: pointer; list-style: none; }
.mod-detail summary::-webkit-details-marker { display: none; }
.comp-list { list-style: none; margin: var(--s3) 0 0; padding: 0 0 0 var(--s3); font-size: 14px; }
.comp-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 5px 0; color: var(--muted); }
.comp-list li.ok { color: var(--ink); }

/* modal */
dialog { border: 0; border-radius: var(--radius); padding: var(--s5); background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(43,40,36,.25); }
dialog::backdrop { background: rgba(43,40,36,.35); backdrop-filter: blur(2px); }
.form { display: grid; gap: var(--s3); }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 99px; font-size: 14px; transition: all .3s ease; z-index: 50; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

.lib-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.lib-items { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.lib-items li { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }
.lib-items a { text-decoration: none; border-bottom: 1px solid var(--stone); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .landing { grid-template-columns: 1fr; min-height: auto; }
  .landing .art { order: -1; max-width: 360px; }
  .player, .profile { grid-template-columns: 1fr; }
  .steps, .profile aside { position: static; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3) { border-right: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .mod-row { grid-template-columns: 36px 1fr 110px; }
  .mod-row .media-icons { display: none; }
}
@media (max-width: 600px) {
  .topbar { gap: var(--s2); flex-wrap: wrap; }
  .brand small { display: none; }
  .hello { grid-template-columns: 1fr; }
  .ring { width: 104px; height: 104px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-right: 0; border-bottom: 1px solid var(--rule); }
  .mod-row { grid-template-columns: 1fr; gap: var(--s2); }
  .mod-row .num { display: none; }
  .dept-row { grid-template-columns: 110px 1fr 40px; }
  .mod-detail summary { grid-template-columns: 1fr 70px; }
  .mod-detail summary .bar { display: none; }
  .lib-row { grid-template-columns: 1fr; gap: var(--s2); }
  .form .row2 { grid-template-columns: 1fr; }
}

/* The step header already shows the title; drop the document's own H1. */
.prose > h1:first-child { display: none; }
