:root {
  --bg: #faf8f2;
  --bg-alt: #f2eee2;
  --surface: #ffffff;
  --ink: #1c1a14;
  --muted: #6a6454;
  --border: #1c1a14;
  --soft-border: #e2dccb;
  --main: #f6c90e;
  --main-ink: #1c1a14;
  --topic: #fff2bf;
  --topic-hover: #ffe680;
  --partial: #ffb44c;
  --done: #2f9e5b;
  --done-bg: #d9f2e1;
  --spine: #2f6fd6;
  --branch: #2f6fd6;
  --accent: #2f6fd6;
  --shadow: 0 1px 0 rgba(28, 26, 20, 0.9);
  --radius: 10px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #13120e;
    --bg-alt: #1b1a14;
    --surface: #1f1d17;
    --ink: #f2eee3;
    --muted: #a69f8c;
    --border: #e9e2cc;
    --soft-border: #37342a;
    --main: #f6c90e;
    --main-ink: #1c1a14;
    --topic: #2c2817;
    --topic-hover: #3b351c;
    --partial: #e89a2c;
    --done: #49c47a;
    --done-bg: #17321f;
    --spine: #6c9cf0;
    --branch: #6c9cf0;
    --accent: #7ea8f3;
    --shadow: 0 1px 0 rgba(233, 226, 204, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #13120e;
  --bg-alt: #1b1a14;
  --surface: #1f1d17;
  --ink: #f2eee3;
  --muted: #a69f8c;
  --border: #e9e2cc;
  --soft-border: #37342a;
  --topic: #2c2817;
  --topic-hover: #3b351c;
  --partial: #e89a2c;
  --done: #49c47a;
  --done-bg: #17321f;
  --spine: #6c9cf0;
  --branch: #6c9cf0;
  --accent: #7ea8f3;
  --shadow: 0 1px 0 rgba(233, 226, 204, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 780px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--main); color: var(--main-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--soft-border); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 19px; }
.logo b { color: var(--accent); font-weight: 800; }
.nav { display: flex; gap: 20px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover { color: var(--accent); }
.site-footer { border-top: 1px solid var(--soft-border); margin-top: 48px; padding: 28px 0; font-size: 14px; }
.footer-inner p { margin: 0 0 4px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 18px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer;
  box-shadow: 0 3px 0 var(--border); transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--border); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.btn-primary { background: var(--main); color: var(--main-ink); }
.btn-ghost { background: transparent; }
.btn-small { font-size: 13px; padding: 6px 12px; border-radius: 8px; box-shadow: 0 2px 0 var(--border); }
.btn-quiet { border-color: var(--soft-border); box-shadow: none; color: var(--muted); }
.btn-quiet:hover { box-shadow: none; color: var(--ink); }
.icon-btn { font: inherit; font-size: 18px; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--soft-border); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--bg-alt); }

/* hero */
.hero { padding: 56px 0 40px; }
.hero-inner { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 12px; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); font-weight: 800; max-width: 820px; margin: 0 auto 16px; }
.hl { background: linear-gradient(transparent 58%, var(--main) 58%); padding: 0 4px; }
.lead { font-size: 18px; color: var(--muted); max-width: 680px; margin: 0 auto 24px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-preview { display: flex; justify-content: center; gap: 28px; margin: 44px auto 0; max-width: 640px; }
.pv-col { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.pv-center { align-items: center; gap: 0; }
.pv-node { display: block; padding: 8px 14px; border: 2px solid var(--border); border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.pv-main { background: var(--main); color: var(--main-ink); font-weight: 800; }
.pv-sub { background: var(--topic); }
.pv-sub.is-done { background: var(--done-bg); border-color: var(--done); text-decoration: line-through; text-decoration-color: var(--done); }
.pv-spine { width: 4px; height: 28px; background: var(--spine); }

/* sections */
.section { padding: 48px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: clamp(24px, 3.2vw, 32px); font-weight: 800; }
.section-lead { margin: 0 0 28px; }
.kelas-block { margin-bottom: 28px; }
.kelas-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface); color: var(--ink); text-decoration: none;
  min-height: 108px;
}
.card.is-live { background: var(--topic); box-shadow: 0 3px 0 var(--border); transition: transform .08s, box-shadow .08s; }
.card.is-live:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--border); }
.card.is-soon { border-style: dashed; border-color: var(--soft-border); color: var(--muted); }
.card-mapel { font-weight: 800; font-size: 18px; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-badge { font-size: 12px; font-weight: 700; align-self: flex-start; padding: 2px 8px; border-radius: 99px; background: var(--bg-alt); }
.card-progress { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 13px; font-weight: 700; }
.card-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.card-bar i { display: block; height: 100%; background: var(--done); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--soft-border); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: 50%; background: var(--main); color: var(--main-ink); font-weight: 800; display: grid; place-items: center; margin-bottom: 8px; border: 2px solid var(--border); }
.steps span { color: var(--muted); font-size: 15px; }

/* roadmap header */
.rm-head { padding: 28px 0 8px; text-align: center; }
.rm-head h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; }
.crumbs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.rm-stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0 0 20px; }
.rm-stats span { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--bg-alt); border: 1px solid var(--soft-border); }
.progress-card { max-width: 560px; margin: 0 auto; text-align: left; background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: 0 3px 0 var(--border); }
.progress-top { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 8px; }
.progress-pct { font-weight: 800; }
.progress-bar { height: 12px; border-radius: 99px; background: var(--bg-alt); border: 1px solid var(--soft-border); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--done); transition: width .3s; }
.progress-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.legend { list-style: none; padding: 0; margin: 18px 0 0; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.lg { width: 18px; height: 12px; border-radius: 3px; border: 2px solid var(--border); display: inline-block; }
.lg-main { background: var(--main); }
.lg-topic { background: var(--topic); }
.lg-partial { background: var(--topic); box-shadow: inset 0 -4px 0 var(--partial); }
.lg-done { background: var(--done-bg); border-color: var(--done); }

/* roadmap diagram */
.rm-wrap { padding: 12px 16px 24px; }
.rm { position: relative; max-width: 1040px; margin: 0 auto; padding: 16px 0; }
.rm-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.rm-lines .spine { stroke: var(--spine); stroke-width: 4; fill: none; stroke-linecap: round; }
.rm-lines .branch { stroke: var(--branch); stroke-width: 2.5; fill: none; stroke-dasharray: 2 7; stroke-linecap: round; }
.rm-lines .branch.is-done { stroke: var(--done); stroke-dasharray: none; }
.rm-center { display: flex; justify-content: center; position: relative; z-index: 1; margin: 26px 0; }
.rm-center:first-of-type { margin-top: 0; }
.rm-row { display: grid; grid-template-columns: 1fr minmax(220px, 270px) 1fr; column-gap: 64px; align-items: center; margin: 30px 0; position: relative; z-index: 1; }
.rm-side { display: flex; flex-direction: column; gap: 10px; }
.rm-side.left { align-items: flex-end; }
.rm-side.right { align-items: flex-start; }
.rm-main { display: flex; justify-content: center; }

.node {
  font: inherit; color: var(--ink); text-align: center; cursor: pointer;
  border: 2px solid var(--border); border-radius: var(--radius); position: relative;
  transition: background .12s, transform .08s;
}
.node:hover { transform: translateY(-1px); }
.title-node {
  cursor: default; font-weight: 800; font-size: 22px; padding: 10px 22px;
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.title-node:hover, .end-node:hover { transform: none; }
.sem-pill { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; padding: 5px 14px; border-radius: 99px; background: var(--bg); border: 2px solid var(--spine); color: var(--spine); }
.node.main { width: 100%; padding: 14px 16px; background: var(--main); color: var(--main-ink); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 var(--border); }
.node.main:hover { filter: brightness(1.04); }
.node.main.is-done { background: var(--done-bg); color: var(--ink); border-color: var(--done); box-shadow: 0 3px 0 var(--done); }
.node.main.is-done .node-label::after { content: ' ✓'; color: var(--done); }
.node.topic {
  width: min(100%, 270px); padding: 10px 12px 12px; background: var(--topic); font-weight: 600; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
}
.node.topic:hover { background: var(--topic-hover); }
.node-count { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.node-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0 0 8px 8px; overflow: hidden; }
.node-bar i { display: block; height: 100%; width: 0; background: var(--partial); transition: width .3s; }
.node.topic.is-done { background: var(--done-bg); border-color: var(--done); }
.node.topic.is-done .node-label { text-decoration: line-through; text-decoration-color: var(--done); text-decoration-thickness: 2px; }
.node.topic.is-done .node-count { color: var(--done); }
.node.topic.is-done .node-bar i { background: var(--done); }
.end-node { cursor: default; padding: 12px 20px; background: var(--surface); font-weight: 800; display: flex; flex-direction: column; gap: 2px; }
.end-node small { font-weight: 500; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .rm { padding-left: 0; }
  .rm::before { content: ''; position: absolute; left: 17px; top: 30px; bottom: 40px; width: 4px; background: var(--spine); border-radius: 2px; z-index: 0; }
  .rm-lines { display: none; }
  .rm-center { justify-content: flex-start; margin: 18px 0; }
  .rm-row { display: flex; flex-direction: column; align-items: stretch; margin: 18px 0; gap: 8px; }
  .rm-main { order: -1; justify-content: flex-start; }
  .rm-side { display: contents; }
  .node.main { margin-bottom: 4px; }
  .rm .node.topic { width: auto; margin-left: 44px; }
  .rm .node.topic::before { content: ''; position: absolute; left: -27px; width: 24px; top: 50%; border-top: 2px dashed var(--branch); }
  .rm .node.topic.is-done::before { border-top-style: solid; border-color: var(--done); }
  .title-node { font-size: 19px; }
  .sem-pill { margin-left: 2px; }
  .end-node { margin-left: 0; }
  .hero-preview { display: none; }
}

/* outline */
.outline { border-top: 1px solid var(--soft-border); margin-top: 24px; }
.ol-sem { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--spine); margin: 28px 0 10px; }
.ol-bab { border: 1px solid var(--soft-border); background: var(--surface); border-radius: 12px; padding: 0 16px; margin-bottom: 10px; }
.ol-bab summary { cursor: pointer; padding: 14px 0; font-weight: 800; display: flex; justify-content: space-between; gap: 12px; list-style: none; }
.ol-bab summary::-webkit-details-marker { display: none; }
.ol-bab summary::before { content: '▸'; color: var(--muted); margin-right: 4px; transition: transform .15s; }
.ol-bab[open] summary::before { transform: rotate(90deg); }
.ol-bab summary span { flex: 1; }
.ol-bab summary small { color: var(--muted); font-weight: 600; }
.ol-bab h4 { margin: 16px 0 6px; font-size: 16px; }
.ol-subs { margin: 0 0 12px; padding-left: 20px; }
.ol-subs li { margin-bottom: 6px; }
.ol-rumus { display: block; font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); }
.source { font-size: 14px; margin-top: 24px; }

/* drawer */
.backdrop { position: fixed; inset: 0; background: rgba(15, 14, 10, .45); z-index: 40; opacity: 0; transition: opacity .2s; }
.backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); z-index: 50;
  background: var(--bg); border-left: 2px solid var(--border); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease-out;
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--soft-border); }
.drawer-crumb { font-size: 13px; font-weight: 700; color: var(--muted); }
.drawer-body { overflow-y: auto; padding: 20px 20px 40px; flex: 1; overscroll-behavior: contain; }
.drawer-body h2 { font-size: 26px; font-weight: 800; }
.d-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 20px; }
.d-progress .progress-bar { flex: 1; min-width: 140px; }
.d-progress-text { font-size: 14px; font-weight: 700; }
.sub { border: 1px solid var(--soft-border); background: var(--surface); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; transition: border-color .15s, background .15s; }
.sub.is-done { border-color: var(--done); background: var(--done-bg); }
.sub-head { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.sub-head input { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 1px 0 0; border: 2px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.sub-head input:checked { background: var(--done); border-color: var(--done); }
.sub-head input:checked::after { content: '✓'; color: #fff; font-size: 14px; font-weight: 800; line-height: 1; }
.sub-title { font-weight: 800; font-size: 16px; }
.sub-isi { margin: 8px 0 0 34px; font-size: 15px; }
.rumus { margin: 10px 0 0 34px; display: flex; flex-wrap: wrap; gap: 6px; }
.rumus code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 14px; padding: 4px 8px; border-radius: 6px; background: var(--bg-alt); border: 1px solid var(--soft-border); }
.d-section { margin-top: 26px; }
.d-section h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.res { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.res a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--soft-border); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.res a:hover { border-color: var(--accent); }
.res-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: var(--bg-alt); color: var(--muted); }
.d-topics { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.d-topics button { width: 100%; }
.d-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; }
.d-nav .btn { flex: 1; font-size: 14px; }
.d-nav .btn[disabled] { visibility: hidden; }
body.no-scroll { overflow: hidden; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 60; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .rm-wrap, .progress-card, .legend, .drawer, .backdrop, .site-footer { display: none !important; }
  .ol-bab { break-inside: avoid; }
  .ol-bab:not([open]) > *:not(summary) { display: block; }
}
