/* ============================================================================
   P2 · Audit Kinerja — Design System "Flat Illustration"
   Palet terbatas & fungsional (ANTI-SLOP §2.2):
     - netral + 5 warna sprint (flat) + 2 warna status.
     - Merah = gagal validasi, Hijau = lulus. Warna sprint = identitas S1..S5.
   Ilustrasi: SVG garis-minimal (stroke rata, tanpa gradient, tanpa bayangan berat).
   ============================================================================ */
:root {
  --bg: #f7f6f3; --surface: #ffffff; --ink: #23272b; --muted: #6b7280; --line: #e4e1da;
  --s1: #3d8bfd; --s2: #12a594; --s3: #8b5cf6; --s4: #f59e0b; --s5: #ef6461;
  --ok: #1a7f37; --fail: #cf222e;
  --warn-bg: #fff6e5; --warn-line: #e0a92e;
  --s1-t: #e7f0fe; --s2-t: #e0f5f2; --s3-t: #efeafe; --s4-t: #fdeed3; --s5-t: #fde7e6;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --surface: #1c2126; --ink: #e8eaec; --muted: #9aa3ab; --line: #2c3339;
    --s1-t: #1c2c44; --s2-t: #123b36; --s3-t: #2c2344; --s4-t: #40300f; --s5-t: #462423;
    --warn-bg: #3a2f10; --warn-line: #c8942a;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.62; font-size: 16.5px; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem 5rem; }
a { color: var(--s1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 1.3rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; margin: 1.6rem 0 .3rem; }
p { margin: .55rem 0; }
code, pre, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
pre { background: #262b31; color: #e8eaec; border-radius: 10px; padding: .9rem 1rem; overflow-x: auto; font-size: .84rem; }

nav.top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; margin-bottom: 1.75rem; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.navlinks { display: flex; gap: 1.1rem; font-size: .92rem; }
.navlinks a { color: var(--muted); font-weight: 600; }
.navlinks a:hover { color: var(--ink); text-decoration: none; }

.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; padding: 1.5rem 0 2rem; }
.hero .lede { color: var(--muted); font-size: 1.05rem; max-width: 34rem; }
.hero .art { width: 100%; height: auto; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero .art { max-width: 280px; } }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: .18rem .55rem; border-radius: 999px; border: 1.5px solid currentColor; line-height: 1; }
.badge.wajib { color: var(--ink); }
.badge.pendukung { color: var(--muted); }
.badge.sprint { border: none; color: #fff; }
.badge.s1 { background: var(--s1); } .badge.s2 { background: var(--s2); } .badge.s3 { background: var(--s3); } .badge.s4 { background: var(--s4); } .badge.s5 { background: var(--s5); }

.sprint { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1.4rem 1.5rem; margin: 1.25rem 0; position: relative; overflow: hidden; }
.sprint::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--sc, var(--s1)); }
.sprint .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.sprint .head .meta { color: var(--muted); font-size: .85rem; }
.sprint .art-mini { width: 84px; height: 84px; flex: none; }
.sprint .count { font-family: var(--mono); font-size: .8rem; color: var(--muted); }

.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: .85rem; margin-top: 1rem; }
.unit { display: block; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: .9rem 1rem; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; color: var(--ink); }
a.unit:hover { transform: translateY(-3px); border-color: var(--sc, var(--s1)); box-shadow: 0 8px 20px -12px rgba(0,0,0,.35); text-decoration: none; }
.unit .id { font-family: var(--mono); font-size: .75rem; font-weight: 700; color: var(--sc, var(--s1)); }
.unit .topik { font-weight: 600; font-size: .95rem; margin: .3rem 0 .5rem; line-height: 1.35; }
.unit .foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.unit .wtype { font-size: .72rem; color: var(--muted); }
.unit .state { font-family: var(--mono); font-size: .78rem; }
.unit .state.done { color: var(--ok); font-weight: 700; }
.unit.soon { opacity: .72; }

table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--line); }
td.num, th.num, output { font-family: var(--mono); font-variant-numeric: tabular-nums; }
thead th { color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); }

.pitfall { background: var(--warn-bg); border: 1.5px solid var(--warn-line); border-left-width: 6px; border-radius: 10px; padding: .9rem 1.1rem; margin: 1.4rem 0; }
.pitfall strong { color: var(--warn-line); }
.verdict { font-family: var(--mono); font-weight: 700; padding: .5rem .8rem; border-radius: 8px; display: inline-block; }
.verdict.pass { color: #fff; background: var(--ok); }
.verdict.fail { color: #fff; background: var(--fail); }

.widget { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.3rem; margin: 1.6rem 0; }
.widget h4 { margin: 0 0 .2rem; font-size: 1rem; }
.widget .sub { font-size: .85rem; color: var(--muted); margin: 0 0 .4rem; }
.widget .src { font-size: .74rem; color: var(--muted); margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .7rem; }
label { display: block; font-size: .83rem; margin: .7rem 0 .25rem; color: var(--muted); font-weight: 600; }
input[type="number"], input[type="text"], select { font-family: var(--mono); font-variant-numeric: tabular-nums; background: var(--bg); color: var(--ink); border: 1.5px solid var(--line); border-radius: 9px; padding: .5rem .65rem; width: 100%; max-width: 15rem; font-size: .9rem; }
input[type="range"] { width: 100%; max-width: 22rem; accent-color: var(--s1); }
button { background: var(--ink); color: var(--bg); border: 0; border-radius: 9px; padding: .55rem 1.05rem; font-size: .9rem; font-weight: 700; cursor: pointer; transition: opacity .12s; }
button:hover { opacity: .85; }
button.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
button:disabled { opacity: .5; cursor: not-allowed; }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--sc, var(--s1)); border-radius: 999px; }

.lesson-head { display: flex; align-items: center; gap: 1.1rem; padding: .5rem 0 1rem; }
.lesson-head .art-mini { width: 76px; height: 76px; flex: none; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.footer-note { color: var(--muted); font-size: .8rem; margin-top: 3.5rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.katex { font-size: 1.05em; }

/* ============================================================================
   ANIMASI (ringan; hormati prefers-reduced-motion)
   ============================================================================ */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }
@keyframes drawline { to { stroke-dashoffset: 0; } }
.art .draw, .chart .draw { stroke-dasharray: 300; stroke-dashoffset: 300; }
.reveal.in .draw, .chart.in .draw { animation: drawline 1.1s .15s ease forwards; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.reveal.in .pop { animation: pop .5s .35s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes growbar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart .bar-rect { transform-origin: bottom; transform-box: fill-box; }
.chart.in .bar-rect { animation: growbar .6s cubic-bezier(.22,1,.36,1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================================================
   CHART (SVG flat dari data)
   ============================================================================ */
.chart { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; margin: 1.6rem 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .cap { font-size: .8rem; color: var(--muted); margin-top: .6rem; border-top: 1px dashed var(--line); padding-top: .55rem; }
.chart .axis { stroke: var(--line); stroke-width: 1.5; }
.chart .tick { font-family: var(--mono); font-size: 9.5px; fill: var(--muted); }
.chart .lbl { font-size: 11px; fill: var(--muted); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .55rem; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* tooltip chart */
.ct-tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: .74rem; padding: .35rem .55rem; border-radius: 7px; opacity: 0; transition: opacity .12s; z-index: 50; white-space: nowrap; }

/* ============================================================================
   EQUATION (KaTeX block bernomor)
   ============================================================================ */
.eq { display: flex; align-items: baseline; gap: 1rem; margin: 1.4rem 0; overflow-x: auto; }
.eq .body { flex: 1; text-align: center; }
.eq .no { font-family: var(--mono); font-size: .8rem; color: var(--muted); flex: none; }

/* ============================================================================
   CODE BLOCK (Python, copy, line numbers)
   ============================================================================ */
.codeblock { background: #262b31; border-radius: 12px; margin: 1.5rem 0; overflow: hidden; border: 1.5px solid var(--line); }
.codeblock .cb-head { display: flex; align-items: center; justify-content: space-between; padding: .5rem .9rem; background: #1f2429; border-bottom: 1px solid #33393f; }
.codeblock .cb-head .lang { font-family: var(--mono); font-size: .72rem; color: #8b98a5; text-transform: uppercase; letter-spacing: .05em; }
.codeblock .copy { background: transparent; color: #c9d1d9; border: 1px solid #3a4149; font-size: .72rem; padding: .25rem .6rem; border-radius: 6px; }
.codeblock .copy:hover { border-color: #6b7280; opacity: 1; }
.codeblock pre { margin: 0; border-radius: 0; counter-reset: ln; background: transparent; }
.codeblock pre code { display: block; padding-left: 3.2em; position: relative; }
.codeblock pre code::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 2.2em; text-align: right; color: #5b6672; padding-right: .8em; border-right: 1px solid #33393f; }
.codeblock .tok-k { color: #ff7b72; } .codeblock .tok-s { color: #a5d6ff; } .codeblock .tok-c { color: #8b949e; font-style: italic; }
.codeblock .tok-n { color: #79c0ff; } .codeblock .tok-f { color: #d2a8ff; }

/* ============================================================================
   QUIZ interaktif
   ============================================================================ */
.quiz { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.3rem; margin: 1.6rem 0; }
.quiz .q { font-weight: 600; margin: 0 0 .9rem; }
.quiz .opt { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: 10px; margin: .5rem 0; cursor: pointer; transition: border-color .12s, background .12s; background: var(--bg); }
.quiz .opt:hover { border-color: var(--s1); }
.quiz .opt input { margin-top: .25rem; accent-color: var(--s1); }
.quiz .opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, var(--bg)); }
.quiz .opt.wrong { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 9%, var(--bg)); }
.quiz .fb { font-size: .85rem; margin: .4rem 0 .2rem; padding: .6rem .8rem; border-radius: 9px; display: none; }
.quiz .fb.show { display: block; }
.quiz .fb.ok { background: color-mix(in srgb, var(--ok) 12%, var(--bg)); color: var(--ok); }
.quiz .fb.no { background: color-mix(in srgb, var(--fail) 12%, var(--bg)); color: var(--fail); }
.quiz .q-foot { display: flex; align-items: center; gap: .8rem; margin-top: .9rem; }
.quiz .score { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

/* ============================================================================
   EXERCISE (tugas coding terpandu + checker)
   ============================================================================ */
.exercise { border: 1.5px solid var(--s1); border-radius: var(--r); padding: 1.2rem 1.3rem; margin: 1.6rem 0; background: color-mix(in srgb, var(--s1) 5%, var(--surface)); }
.exercise .ex-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.exercise .ex-tag { background: var(--s1); color: #fff; font-size: .68rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.exercise textarea { width: 100%; min-height: 110px; font-family: var(--mono); font-size: .85rem; background: #262b31; color: #e8eaec; border: 1.5px solid var(--line); border-radius: 10px; padding: .7rem .9rem; resize: vertical; }
.exercise .ex-out { font-family: var(--mono); font-size: .8rem; margin-top: .7rem; padding: .7rem .9rem; border-radius: 9px; background: var(--bg); border: 1.5px solid var(--line); white-space: pre-wrap; display: none; }
.exercise .ex-out.show { display: block; }
.exercise .hint { font-size: .8rem; color: var(--muted); }
.exercise details { margin-top: .6rem; }
.exercise summary { cursor: pointer; font-size: .83rem; color: var(--s1); font-weight: 600; }
