/* ==========================================================================
   Skrip Cure Dolly — Bahasa Indonesia
   Sistem warna, tipografi, dan tata letak untuk pembaca kursus yang panjang.
   ========================================================================== */

/* ------------------------------------------------------------------ token */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-jp: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;

  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.88rem);
  --step-0: clamp(1rem, 0.97rem + 0.16vw, 1.08rem);
  --step-1: clamp(1.18rem, 1.1rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.25rem + 0.85vw, 1.95rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.7rem);
  --step-4: clamp(2.2rem, 1.5rem + 3.2vw, 4rem);

  --measure: 68ch;
  --radius: 10px;
  --radius-lg: 16px;

  --sidebar-w: 296px;
  --toc-w: 220px;
  --topbar-h: 60px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* terang — kertas hangat, tinta biru-tua */
:root,
[data-theme='light'] {
  --bg: #fbf9f5;
  --bg-soft: #f4f0e9;
  --surface: #ffffff;
  --surface-2: #f7f3ec;
  --ink: #1b1a17;
  --ink-2: #4a463f;
  --ink-3: #7a746a;
  --line: #e6e0d6;
  --line-strong: #d5cdbf;
  --accent: #1f6f5c;
  --accent-ink: #14503f;
  --accent-soft: #e3f0eb;
  --jp-bg: #f0ece3;
  --warn: #a35a00;
  --warn-soft: #fdf1e0;
  --tip: #1f6f5c;
  --tip-soft: #e6f2ee;
  --info: #2c5c96;
  --info-soft: #e8f0fa;
  --shadow: 0 1px 2px rgba(27, 26, 23, 0.05), 0 8px 24px -12px rgba(27, 26, 23, 0.18);
}

/* gelap — arang hangat, bukan hitam pekat */
[data-theme='dark'] {
  --bg: #161714;
  --bg-soft: #1c1d19;
  --surface: #1e1f1b;
  --surface-2: #242520;
  --ink: #ebe7de;
  --ink-2: #b7b2a6;
  --ink-3: #857f73;
  --line: #2e2f29;
  --line-strong: #3b3c34;
  --accent: #6fc7ab;
  --accent-ink: #8fdcbf;
  --accent-soft: #1d2f29;
  --jp-bg: #262720;
  --warn: #e0a05a;
  --warn-soft: #2e2519;
  --tip: #6fc7ab;
  --tip-soft: #1d2f29;
  --info: #8ab4e8;
  --info-soft: #1c2532;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------- reset */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 20px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.72;
  font-feature-settings: 'kern', 'liga', 'calt';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in oklab, var(--accent) 26%, transparent); }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--line); transition: top 0.2s var(--ease);
}
.skip:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); margin-right: auto;
}
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff;
  font-family: var(--font-jp); font-size: 17px; font-weight: 700;
  line-height: 1;
}
[data-theme='dark'] .brand-mark { color: #10201b; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 650; font-size: 0.94rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.02em; }

.topbar-actions { display: flex; gap: 4px; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.menu-btn { display: none; }

[data-theme='light'] .i-sun, [data-theme='dark'] .i-moon { display: none; }
[data-theme='light'] .i-moon, [data-theme='dark'] .i-sun { display: block; }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
}

/* --------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  padding: 18px 10px 40px;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }

.side-about {
  display: block; padding: 8px 12px; border-radius: 8px;
  font-size: 0.88rem; font-weight: 550; text-decoration: none;
  color: var(--ink-2); margin-bottom: 12px;
}
.side-about:hover { background: var(--surface-2); color: var(--ink); }

.side-group { margin-bottom: 4px; }
.side-group-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; background: none; border: 0; border-radius: 8px;
  font-size: 0.76rem; font-weight: 650; letter-spacing: 0.045em; text-transform: uppercase;
  color: var(--ink-3); cursor: pointer; text-align: left;
  transition: color 0.15s, background 0.15s;
}
.side-group-btn:hover { color: var(--ink-2); background: var(--surface-2); }
.chev { flex: none; transition: transform 0.24s var(--ease); opacity: 0.7; }
.side-group.open .chev { transform: rotate(90deg); }

.side-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s var(--ease);
}
.side-group.open .side-list { grid-template-rows: 1fr; }
.side-list > li { overflow: hidden; }
.side-list > li:first-child { min-height: 0; }

.side-list a {
  display: flex; gap: 9px; align-items: baseline;
  padding: 7px 12px 7px 12px; margin: 1px 0;
  border-radius: 8px; text-decoration: none;
  font-size: 0.865rem; line-height: 1.45; color: var(--ink-2);
  border-left: 2px solid transparent;
  transition: background 0.13s, color 0.13s;
}
.side-list a:hover { background: var(--surface-2); color: var(--ink); }
.side-list a.active {
  background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 550; border-left-color: var(--accent);
}
.side-num {
  flex: none; min-width: 1.9em; font-variant-numeric: tabular-nums;
  font-size: 0.74rem; color: var(--ink-3); font-weight: 600;
}
.side-list a.active .side-num { color: var(--accent); }
.side-title { text-wrap: pretty; }

/* ------------------------------------------------------------------ main */
.main { min-width: 0; padding: 0 clamp(18px, 4vw, 56px); }

.reader {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) 0 40px;
}
.reader[aria-busy='true'] { opacity: 0.6; }

/* kerangka memuat */
.reader-skeleton { display: grid; gap: 14px; padding-top: 20px; }
.sk { background: var(--surface-2); border-radius: 6px; height: 14px; animation: pulse 1.4s ease-in-out infinite; }
.sk-title { height: 34px; width: 62%; margin-bottom: 14px; }
.sk-line.short { width: 70%; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ------------------------------------------------------------------ toc */
.toc {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: 40px 16px 40px 8px;
  font-size: 0.8rem;
  scrollbar-width: none;
}
.toc-title {
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
}
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-item a {
  display: block; padding: 4px 0 4px 12px; margin-left: -1px;
  color: var(--ink-3); text-decoration: none; line-height: 1.4;
  border-left: 2px solid transparent;
  transition: color 0.14s, border-color 0.14s;
  text-wrap: pretty;
}
.toc-item a:hover { color: var(--ink); }
.toc-item a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 550; }
.toc-item.lvl-3 a { padding-left: 24px; font-size: 0.76rem; }

/* --------------------------------------------------------------- artikel */
.page { animation: rise 0.4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.page-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-size: 0.78rem; color: var(--ink-3); margin-bottom: 18px;
  flex-wrap: wrap;
}
.crumbs { display: flex; gap: 8px; align-items: center; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.read-time {
  padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.lesson-title {
  font-size: var(--step-3);
  line-height: 1.18;
  letter-spacing: -0.022em;
  font-weight: 700;
  margin: 0 0 28px;
  text-wrap: balance;
  color: var(--ink);
}

/* teks badan */
.page p {
  margin: 0 0 1.05em;
  text-wrap: pretty;
  hyphens: auto;
}

.page h2 {
  font-size: var(--step-2);
  line-height: 1.25;
  letter-spacing: -0.017em;
  font-weight: 680;
  margin: 2.1em 0 0.7em;
  padding-top: 0.6em;
  border-top: 1px solid var(--line);
  text-wrap: balance;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.page h3 {
  font-size: var(--step-1);
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 650;
  margin: 1.7em 0 0.5em;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.page strong { font-weight: 660; color: var(--ink); }
.page em { font-style: italic; color: var(--ink-2); }

/* Jepang: font khusus + sedikit lebih besar agar terbaca */
.page :is(p, li, blockquote, td) {
  font-feature-settings: 'kern', 'liga', 'calt';
}

/* Furigana */
ruby { ruby-position: over; }
rt {
  font-size: 0.52em;
  color: var(--ink-3);
  font-family: var(--font-jp);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
}

/* Inline code — istilah, partikel, kalimat contoh */
.page code {
  font-family: var(--font-sans);
  font-size: 0.93em;
  font-feature-settings: 'kern';
  background: var(--jp-bg);
  color: var(--ink);
  padding: 0.14em 0.42em;
  border-radius: 5px;
  border: 1px solid color-mix(in oklab, var(--line-strong) 60%, transparent);
  white-space: normal;
  overflow-wrap: break-word;
}
.page code b { font-weight: 700; color: var(--accent-ink); }
[data-theme='dark'] .page code b { color: var(--accent); }
.page code:has(ruby),
.page code:has([\u3040-\u30ff]) { font-family: var(--font-jp); }

/* kutipan */
.page q {
  quotes: '«' '»';
  color: var(--ink-2);
  background: color-mix(in oklab, var(--accent) 9%, transparent);
  padding: 0.05em 0.3em;
  border-radius: 4px;
}

/* blockquote — contoh kalimat Jepang */
.page blockquote {
  margin: 1.4em 0;
  padding: 14px 18px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.page blockquote p {
  margin: 0;
  font-family: var(--font-jp);
  font-size: 1.06em;
  line-height: 1.9;
  color: var(--ink);
}
.page blockquote p + p { margin-top: 0.35em; }

/* daftar */
.page .list { margin: 0 0 1.2em; padding-left: 1.35em; }
.page .list li { margin-bottom: 0.4em; text-wrap: pretty; }
.page .list li::marker { color: var(--ink-3); }

.rule {
  border: 0; height: 1px; margin: 2.2em 0;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

/* gambar diagram */
.fig { margin: 1.6em 0; }
.fig-zoom {
  display: block; width: 100%; max-width: 100%; margin-inline: auto; padding: 0; cursor: zoom-in;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.fig-zoom:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.fig img {
  display: block; width: 100%; height: auto;
  background: #fff;
}
/* diagram kecil tetap di ukuran aslinya, tidak dipaksa melebar */
.fig-zoom[style*='max-width'] { width: auto; }
[data-theme='dark'] .fig img { filter: contrast(0.94) brightness(0.94); }

.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 4vmin;
  background: color-mix(in oklab, var(--bg) 92%, black);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: fade 0.18s ease;
}
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px; background: #fff;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
@keyframes fade { from { opacity: 0; } }

/* tautan video */
.video-link {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 1.8em; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--ink);
  transition: border-color 0.16s, transform 0.16s var(--ease), box-shadow 0.16s;
}
.video-link:hover {
  border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow);
}
.video-icon {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink);
}
.video-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.video-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 650; color: var(--ink-3);
}
.video-title {
  font-size: 0.875rem; font-weight: 520; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* callout */
.callout {
  margin: 1.6em 0; padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.96em;
}
.callout > .callout-body > :last-child { margin-bottom: 0; }
.callout-title {
  font-weight: 650; font-size: 0.86rem; letter-spacing: 0.01em;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 7px;
}
.callout-title::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.callout-info { background: var(--info-soft); border-color: color-mix(in oklab, var(--info) 22%, transparent); color: var(--ink); }
.callout-info .callout-title { color: var(--info); }
.callout-tip { background: var(--tip-soft); border-color: color-mix(in oklab, var(--tip) 22%, transparent); }
.callout-tip .callout-title { color: var(--tip); }
.callout-warning { background: var(--warn-soft); border-color: color-mix(in oklab, var(--warn) 24%, transparent); }
.callout-warning .callout-title { color: var(--warn); }
.callout-details { background: var(--surface-2); padding: 0; overflow: hidden; }
.callout-details details > summary {
  cursor: pointer; padding: 12px 16px;
  font-size: 0.88rem; font-weight: 560; color: var(--ink-2);
  list-style: none; display: flex; gap: 8px; align-items: center;
}
.callout-details details > summary::-webkit-details-marker { display: none; }
.callout-details details > summary::before {
  content: '+'; font-family: var(--font-mono); font-weight: 600;
  color: var(--accent); width: 1em;
}
.callout-details details[open] > summary::before { content: '−'; }
.callout-details details > summary:hover { background: var(--surface); color: var(--ink); }
.callout-details .callout-body { padding: 0 16px 14px; }

/* referensi pelajaran */
.lesson-ref {
  color: var(--accent-ink); text-decoration: none;
  border-bottom: 1px dashed color-mix(in oklab, var(--accent) 50%, transparent);
}
.lesson-ref:hover { border-bottom-style: solid; }

/* pager */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 4em; padding-top: 2em; border-top: 1px solid var(--line);
}
.pager-link {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; color: var(--ink);
  transition: border-color 0.16s, transform 0.16s var(--ease), box-shadow 0.16s;
}
.pager-link:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.pager-link.next { text-align: right; align-items: flex-end; }
.pager-dir { font-size: 0.72rem; color: var(--ink-3); font-weight: 550; letter-spacing: 0.02em; }
.pager-title { font-size: 0.9rem; font-weight: 550; line-height: 1.35; text-wrap: pretty; }
@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { text-align: left; align-items: flex-start; }
}

/* ---------------------------------------------------------------- footer */
.site-footer {
  max-width: var(--measure); margin: 0 auto;
  padding: 28px 0 60px; border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--ink-3);
}
.site-footer p { margin: 0 0 8px; }
.site-footer .muted { color: var(--ink-3); opacity: 0.85; }

/* ------------------------------------------------------------------ home */
.hero {
  padding: clamp(20px, 6vw, 64px) 0 clamp(30px, 5vw, 52px);
  border-bottom: 1px solid var(--line);
}
.hero-kicker {
  margin: 0 0 14px;
  font-size: 0.74rem; font-weight: 650; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.hero-title {
  font-size: var(--step-4);
  line-height: 1.08;
  letter-spacing: -0.032em;
  font-weight: 730;
  margin: 0 0 20px;
  max-width: 17ch;
  text-wrap: balance;
}
.hero-dot { color: var(--accent); }
.hero-lead {
  font-size: var(--step-0);
  color: var(--ink-2);
  max-width: 54ch;
  margin: 0 0 28px;
  text-wrap: pretty;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 580;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong);
  text-decoration: none; cursor: pointer;
  transition: transform 0.16s var(--ease), box-shadow 0.16s, background 0.16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); color: var(--ink); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
[data-theme='dark'] .btn-primary { color: #0e1f1a; }
.btn-primary:hover { background: var(--accent); color: #fff; }
[data-theme='dark'] .btn-primary:hover { color: #0e1f1a; }

.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats strong {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero-stats span { font-size: 0.76rem; color: var(--ink-3); letter-spacing: 0.02em; }

.home-groups { padding: 20px 0 40px; }
.home-group { padding: 26px 0; border-bottom: 1px solid var(--line); }
.home-group:last-child { border-bottom: 0; }
.home-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 14px;
}
.home-group-head h2 {
  font-size: var(--step-1);
  letter-spacing: -0.015em;
  font-weight: 660;
  margin: 0;
}
.home-group-count { font-size: 0.76rem; color: var(--ink-3); white-space: nowrap; }
.home-list { list-style: none; margin: 0; padding: 0; }
.home-list li { border-bottom: 1px solid color-mix(in oklab, var(--line) 55%, transparent); }
.home-list li:last-child { border-bottom: 0; }
.home-list a {
  display: grid; grid-template-columns: 2.6em 1fr auto;
  gap: 12px; align-items: baseline;
  padding: 10px 12px 10px 4px; border-radius: 8px;
  text-decoration: none; color: var(--ink);
  transition: background 0.13s;
}
.home-list a:hover { background: var(--surface-2); }
.home-num {
  font-variant-numeric: tabular-nums; font-size: 0.8rem;
  color: var(--ink-3); font-weight: 600;
}
.home-title { text-wrap: pretty; font-size: 0.945rem; }
.home-time {
  font-size: 0.74rem; color: var(--ink-3); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- search */
.search {
  width: min(620px, 92vw);
  max-height: min(78vh, 640px);
  padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.search::backdrop { background: rgba(10, 10, 8, 0.42); backdrop-filter: blur(3px); }
.search-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.search-head input {
  flex: 1; border: 0; background: none; outline: none;
  font: inherit; font-size: 0.98rem; color: var(--ink);
}
.search-head kbd {
  font: 600 0.68rem var(--font-mono);
  padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--line-strong); color: var(--ink-3);
}
.search-results {
  list-style: none; margin: 0; padding: 8px;
  overflow-y: auto; max-height: min(60vh, 480px);
}
.search-results a {
  display: flex; gap: 12px; padding: 10px 12px;
  border-radius: 8px; text-decoration: none; color: var(--ink);
}
.search-results a:hover, .search-results a:focus-visible { background: var(--surface-2); }
.sr-num {
  flex: none; min-width: 2em; font-size: 0.78rem; font-weight: 600;
  color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 2px;
}
.sr-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sr-title { font-size: 0.92rem; font-weight: 550; line-height: 1.35; }
.sr-snip {
  font-size: 0.79rem; color: var(--ink-3); line-height: 1.45;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.sr-snip mark { background: color-mix(in oklab, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.search-empty { padding: 22px; text-align: center; color: var(--ink-3); font-size: 0.9rem; }
.search-foot {
  padding: 10px 16px; border-top: 1px solid var(--line);
  font-size: 0.74rem; color: var(--ink-3); background: var(--surface-2);
}

/* ----------------------------------------------------------------- 404 */
.notfound { padding: 12vh 0; text-align: center; }
.nf-code {
  font-size: 4rem; font-weight: 750; letter-spacing: -0.04em;
  color: var(--line-strong); margin: 0; line-height: 1;
}
.notfound h1 { font-size: var(--step-2); margin: 10px 0 8px; letter-spacing: -0.02em; }
.notfound p { color: var(--ink-2); margin-bottom: 24px; }

/* ---------------------------------------------------------------- progres */
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
  z-index: 60; transition: transform 0.1s linear;
}

.scrim { position: fixed; inset: 0; background: rgba(10, 10, 8, 0.4); z-index: 45; }
.noscript { padding: 40px; text-align: center; }

/* ------------------------------------------------------------- responsif */
@media (max-width: 1240px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: grid; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 46;
    width: min(88vw, var(--sidebar-w));
    background: var(--bg);
    transform: translateX(-102%);
    transition: transform 0.3s var(--ease);
    box-shadow: 20px 0 50px -30px rgba(0, 0, 0, 0.4);
  }
  body.menu-open .sidebar { transform: none; }
  .main { padding: 0 clamp(16px, 5vw, 32px); }
  .brand-sub { display: none; }
  .page-meta { margin-bottom: 12px; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; line-height: 1.7; }
  .topbar { padding: 0 12px; }
  .home-list a { grid-template-columns: 2.2em 1fr; }
  .home-time { display: none; }
  .hero-stats { gap: 24px; }
  .lesson-title { margin-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .site-footer, .progress, .video-link { display: none !important; }
  .layout { display: block; }
  .reader { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .page h2 { break-after: avoid; }
  .fig { break-inside: avoid; }
}
