:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --sidebar: #f5f5f4;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --radius: 14px;
  --detail-bg: rgb(225, 225, 225);
  --about-chip: var(--detail-bg);   /* light: About chips match the grey backdrop */  /* light only: grey backdrop so cards stand out on detail pages */
  color-scheme: light;
}

/* Dark: follow the system unless the visitor picked light with the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a09;
    --surface: #1c1917;
    --sidebar: #141210;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --border: #292524;
    --accent: #60a5fa;
    --accent-soft: #172554;
    --detail-bg: var(--bg);
    --about-chip: var(--accent-soft);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --sidebar: #141210;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --border: #292524;
  --accent: #60a5fa;
  --accent-soft: #172554;
  --detail-bg: var(--bg);
  --about-chip: var(--accent-soft);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.7;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* Layout: fixed sidebar + content filling the rest */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.profile { display: flex; flex-direction: column; color: var(--text); padding: 0 12px; }
.profile:hover { text-decoration: none; }
.name { font-size: 1.4rem; font-weight: 800; }
.handle { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.08em; }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  opacity: 0;
  animation: slide-in 0.5s ease-out forwards;
}
.menu a:nth-child(1) { animation-delay: 0.1s; }
.menu a:nth-child(2) { animation-delay: 0.2s; }
.menu a:nth-child(3) { animation-delay: 0.3s; }
.menu a:nth-child(4) { animation-delay: 0.4s; }
.menu a:hover, .menu a.active { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.ext { color: var(--muted); font-size: 0.85rem; transition: transform 0.2s ease; }
.menu a:hover .ext { transform: translate(2px, -2px); }

/* Theme toggle at the bottom of the sidebar */
.theme-toggle {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-icon { font-size: 1rem; line-height: 1; }

/* Content: fills the right side, everything centered */
.content {
  min-width: 0;
  padding: 0 clamp(24px, 5vw, 80px) 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Home: intro + projects together on the first screen */
.home {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  justify-content: center;
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 48px;
}

/* Hero */
.hero {
  position: relative;
  width: 100%;
  text-align: center;
}
.intro {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  opacity: 0;
  animation: fade-up 0.8s 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
h1 {
  position: relative;
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.hero h1 .line { display: block; opacity: 0; animation: fade-up 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.hero h1 .line:nth-child(2) { animation-delay: 0.35s; }
h1 strong {
  position: relative;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), #8b5cf6, var(--accent));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
h1 strong::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0.05em;
  height: 0.08em;
  width: 100%;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  animation: draw 0.7s 1.1s ease-out forwards;
}

/* Background orbs */
.orbs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: drift 14s ease-in-out infinite alternate;
}
.orb-1 { width: 320px; height: 320px; background: var(--accent); top: 8%; left: 15%; }
.orb-2 { width: 260px; height: 260px; background: #8b5cf6; bottom: 10%; right: 15%; animation-duration: 18s; animation-delay: -4s; }
.orb-3 { width: 180px; height: 180px; background: #06b6d4; top: 35%; left: 46%; animation-duration: 22s; animation-delay: -8s; opacity: 0.25; }

/* Projects */
.projects { position: relative; width: 100%; max-width: 1100px; text-align: center; }
h2 { font-size: 1.6rem; margin: 0 0 24px; }
h3 { font-size: 1.2rem; margin: 0 0 8px; }

.cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.card {
  flex: 0 1 440px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  color: var(--text);
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card.visible { opacity: 1; transform: translateY(0); }
.card.visible:hover {
  transform: translateY(-6px);
  transition-delay: 0s !important;
  border-color: var(--accent);
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration: none;
}
.card p { margin: 0 0 8px; color: var(--muted); }
.card .subtitle { margin-top: -4px; font-size: 0.85rem; font-weight: 600; }
.card .link { margin-top: auto; }
.card:hover .link { text-decoration: underline; }

.eyebrow { color: var(--accent) !important; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em; margin: 0 0 4px !important; }

.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.tags li {
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.link { font-weight: 600; font-size: 0.95rem; }

/* Detail pages (About me, project): tinted backdrop in light mode */
.detail, .about { background: var(--detail-bg); }

/* Project detail page */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 30;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transform: scaleX(0);
  transform-origin: left;
}
.detail { padding-top: 0; padding-bottom: 0; }
.detail > * { width: 100%; max-width: 1000px; }
.back { color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.back:hover { color: var(--accent); text-decoration: none; }
.detail-head .back { position: absolute; top: 32px; left: 0; }

/* Full-screen sections, one per wheel step */
.page { min-height: 100vh; }

.detail-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.detail-head > * { opacity: 0; animation: fade-up 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.detail-head h1 { animation-delay: 0.1s; }
.detail-head .detail-sub { animation-delay: 0.25s; }
.detail-head .tags { justify-content: center; animation-delay: 0.4s; }
.detail-sub { color: var(--muted); font-weight: 600; margin: 8px 0 0; }

.scroll-cue {
  position: absolute;
  bottom: 32px;
  width: 1px;
  height: 56px;
  overflow: hidden;
  background: var(--border);
  animation-delay: 0.8s !important;
}
.scroll-cue span {
  display: block;
  width: 100%;
  height: 50%;
  background: var(--accent);
  animation: cue 1.8s ease-in-out infinite;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 0.4s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  transition-delay: var(--d, 0s);
}
.reveal.from-left { transform: translateX(-60px); }
.reveal.from-right { transform: translateX(60px); }
.reveal.in { opacity: 1; transform: none; }

/* Chapters: one idea per screen */
.chapter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 24px;
  padding: 64px 0;
}
.big {
  margin: 0;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  line-height: 1.6;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.big strong { color: var(--accent); font-weight: 700; }

.scrolly, .scrub {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

/* RAG stages */
.captions { display: grid; text-align: center; }
.captions h2 {
  grid-area: 1 / 1;
  margin: 0;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  font-weight: 500;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.captions h2 strong { color: var(--accent); font-weight: 700; }
.scrolly[data-stage="0"] [data-for="0"],
.scrolly[data-stage="1"] [data-for="1"],
.scrolly[data-stage="2"] [data-for="2"] { opacity: 1; transform: none; }

.rag-cases { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; width: 100%; }
.rag-case {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}
.rag-case .num { font-size: 0.85rem; font-weight: 800; color: var(--accent); letter-spacing: 0.08em; }
.rag-case h3 { margin: 8px 0; font-size: clamp(1.05rem, 1.6vw, 1.3rem); }
.rag-case p { margin: 0; color: var(--muted); }
.rag-case .note,
.rag-case .filters {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.45s ease, opacity 0.4s ease, margin 0.45s ease;
}
.rag-case .note { font-weight: 600; font-size: 0.9rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters span {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  transform: translateY(12px);
  transition: transform 0.4s ease;
}
.filters span:nth-child(2) { transition-delay: 0.1s; }

/* Stage 1+: case 01 fades back, case 02 comes forward */
.scrolly:not([data-stage="0"]) .case-a.in { opacity: 0.4; filter: grayscale(1); transform: scale(0.96); }
.scrolly:not([data-stage="0"]) .case-a .note { max-height: 60px; opacity: 1; margin-top: 12px; }
.scrolly:not([data-stage="0"]) .case-b.in {
  border-color: var(--accent);
  box-shadow: 0 16px 40px -16px color-mix(in srgb, var(--accent) 45%, transparent);
}
/* Stage 2: case 02 narrows down to what's worth a RAG */
.scrolly[data-stage="2"] .case-a.in { opacity: 0.25; }
.scrolly[data-stage="2"] .case-b.in { transform: scale(1.03); }
.scrolly[data-stage="2"] .case-b .filters { max-height: 140px; opacity: 1; margin-top: 16px; }
.scrolly[data-stage="2"] .case-b .filters span { transform: none; }

.stage-dots { display: flex; gap: 8px; }
.stage-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}
.stage-dots button:hover { background: var(--muted); }
.scrolly[data-stage="0"] .stage-dots button:nth-child(1),
.scrolly[data-stage="1"] .stage-dots button:nth-child(2),
.scrolly[data-stage="2"] .stage-dots button:nth-child(3) { width: 24px; background: var(--accent); }

/* Section pager and next button */
.pager {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
}
.pager button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: height 0.3s ease, background 0.3s ease;
}
.pager button:hover { background: var(--muted); }
.pager button.on { height: 24px; background: var(--accent); }

.next-btn {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: opacity 0.3s ease, border-color 0.2s ease, color 0.2s ease;
}
.next-btn:hover { border-color: var(--accent); color: var(--accent); }
.next-btn.hidden { opacity: 0; pointer-events: none; }

/* Words light up one by one */
.scrub { gap: 12px; text-align: center; }
.scrub-line { margin: 0; font-size: clamp(1.5rem, 3.6vw, 2.8rem); font-weight: 700; line-height: 1.45; letter-spacing: -0.02em; }
.scrub-line .w { opacity: 0.12; transition: opacity 0.35s ease; }
.scrub-line .w.lit { opacity: 1; }
.scrub-line.accent .w.lit { color: var(--accent); }

/* Sequenced steps (data-seq / data-step) */
[data-step] { opacity: 0; transform: translateY(12px); transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s ease, border-color 0.3s ease; }
[data-step].on { opacity: 1; transform: none; }

/* How it works: overview flow */
.flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0; width: 100%; }
.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 96px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.flow-node strong { font-size: 1.05rem; }
.flow-kind { font-size: 0.75rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.flow-node.judge { border-color: #8b5cf6; }
.flow-node.judge .flow-kind { color: #8b5cf6; }
.flow-node.llm { border-color: var(--accent); }
.flow-node.llm .flow-kind { color: var(--accent); }
.flow-node.on { box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 60%, transparent); }
.flow-link[data-step] { opacity: 1; transform: none; position: relative; width: 36px; height: 2px; background: var(--border); }
.flow-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.flow-link.on::after { transform: scaleX(1); }
.flow-loop {
  flex-basis: 100%;
  margin: 24px 0 0;
  padding: 12px 18px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.95rem;
}
.flow-loop strong { color: var(--text); }
.legend { margin: 0; color: var(--muted); font-size: 0.9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.dot.judge { background: #8b5cf6; }
.dot.llm { background: var(--accent); margin-left: 12px; }

/* How it works 1: embedding */
.embed { display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; flex-wrap: wrap; }
.embed-doc {
  width: 130px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}
.embed-doc-title { font-size: 0.8rem; font-weight: 700; }
.embed-doc .line { height: 5px; border-radius: 3px; background: var(--border); }
.embed-doc .line.short { width: 60%; }
.embed-arrow { color: var(--muted); font-size: 1.3rem; }
.embed-chips { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.chip {
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}
.chip em { font-style: normal; color: var(--accent); margin-right: 4px; }
.embed-db {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 22px;
  border-radius: 50% / 22%;
  border: 2px solid var(--accent);
  background: var(--surface);
}
.embed-db span { font-size: 0.8rem; color: var(--muted); }
.points { margin: 0; padding: 0; list-style: none; text-align: left; max-width: 760px; display: flex; flex-direction: column; gap: 6px; }
.points li { color: var(--muted); padding-left: 16px; position: relative; }
.points li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.points strong { color: var(--text); }
.stats-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 14px 22px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.stat-value { font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }

/* How it works 2: Jev gates */
.example { margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.gates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; text-align: left; }
.gate { padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.gate-head { display: flex; flex-direction: column; }
.gate-head strong { color: #8b5cf6; }
.gate-head span { font-size: 0.85rem; color: var(--muted); }
.gauge { position: relative; height: 8px; border-radius: 999px; background: var(--border); }
.gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, var(--accent));
  transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s;
}
.gate.on .gauge-fill { width: var(--v); }
.gauge-mark { position: absolute; top: -4px; bottom: -4px; left: var(--t); width: 2px; background: var(--text); opacity: 0.5; }
.gate-foot { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.95rem; }
.gate-foot small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.pass { color: var(--accent); }
.notes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; text-align: left; }
.note-card { margin: 0; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.9rem; }
.note-card strong { display: block; color: var(--text); font-size: 0.95rem; margin-bottom: 4px; }

/* How it works 3: answer */
.chat { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 640px; text-align: left; }
.bubble { margin: 0; padding: 12px 16px; border-radius: 16px; max-width: 85%; }
.bubble p { margin: 0; }
.bubble.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.progress-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.progress-steps span { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.progress-steps span.on::before { content: "✓ "; color: var(--accent); }
.cite { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 700; }
.evidence { margin-top: 10px !important; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.caption { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* About me (single short page) */
.about { min-height: 100vh; justify-content: center; padding-top: 48px; padding-bottom: 48px; }
.about-card { width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 32px; }
.about-card > * { opacity: 0; animation: fade-up 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.about-card > :nth-child(2) { animation-delay: 0.12s; }
.about-card > :nth-child(3) { animation-delay: 0.24s; }
.about-card > :nth-child(4) { animation-delay: 0.36s; }
.about-card > :nth-child(5) { animation-delay: 0.48s; }
.about-card > :nth-child(6) { animation-delay: 0.6s; }
.about-card > :nth-child(7) { animation-delay: 0.72s; }
.about-card > :nth-child(8) { animation-delay: 0.84s; }
.about-block .tags { margin: 4px 0 0; }
.about-block .tags li { background: var(--about-chip); }
.about-cta { text-align: center; }
.about-block .strengths { margin-top: 12px; }
.about-block .strength { padding: 20px; }
.about-block .strength h3 { font-size: 1rem; }
.about-block .strength p { font-size: 0.9rem; }
.about-intro h1 { margin: 0 0 12px; }
.about-intro p:not(.eyebrow) { margin: 0; color: var(--muted); }
.about-block h2 { font-size: 0.85rem; color: var(--muted); letter-spacing: 0.08em; margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.about-block.info { padding: 20px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.kv { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.kv li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.kv li > span { color: var(--muted); font-size: 0.9rem; }
.kv small { color: var(--muted); font-size: 0.85rem; }

.accent-text { color: var(--accent); }
.chapter h2 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 2rem); }

.strengths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; text-align: left; }
.strength { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; }
.strength .num { font-size: 0.85rem; font-weight: 800; color: var(--accent); letter-spacing: 0.08em; }
.strength h3 { margin: 8px 0; }
.strength p { margin: 0; color: var(--muted); }

.job {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.job-meta { display: flex; flex-direction: column; gap: 4px; }
.job-meta .period { font-weight: 700; color: var(--accent); font-size: 0.9rem; }
.job-meta h2 { font-size: 1.3rem; }
.job-body ul { padding-left: 1.1em; margin: 8px 0 0; }
.job-body li { margin: 8px 0; color: var(--muted); }
.job-body li strong { display: block; color: var(--text); }

.bars { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 720px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 72px; align-items: center; gap: 12px; text-align: left; }
.bar-label { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.bar-value { font-weight: 700; text-align: right; }
.bar { height: 14px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 1.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
.bar-fill.before { background: var(--muted); transition-delay: 0.3s; }
.bar-fill.after { background: linear-gradient(90deg, var(--accent), #8b5cf6); transition-delay: 0.9s; }
.bars.in .bar-fill { width: var(--w); }

.case-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; text-align: left; }
.case-step { border-top: 2px solid var(--accent); padding-top: 12px; }
.case-step h3 { font-size: 1rem; margin: 0 0 6px; }
.case-step p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.plain { list-style: none; padding: 0; margin: 0; }
.plain li { margin: 12px 0; }
.btn-link {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}
.btn-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Structure */
.structure h2 { margin: 0; }
.parts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; width: 100%; text-align: left; }
.part { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.part p { color: var(--muted); margin: 0 0 12px; }
.part .eyebrow { margin-bottom: 4px; }

/* Keyframes */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes draw { to { transform: scaleX(1); } }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-60px, 40px) scale(1.15); }
}
@keyframes cue {
  from { transform: translateY(-100%); }
  to { transform: translateY(200%); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Mobile: sidebar becomes a top bar */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    height: auto;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .profile { padding: 0; }
  .name { font-size: 1.1rem; }
  .handle { display: none; }
  .menu { flex-direction: row; }
  .menu a { padding: 6px 8px; font-size: 0.9rem; }
  .ext { display: none; }
  .theme-toggle { margin-top: 0; padding: 6px 8px; border: 0; }
  .theme-label { display: none; }
  .content { padding: 0 16px 56px; }
  .home { min-height: calc(100svh - 56px); gap: 32px; padding-top: 32px; padding-bottom: 32px; }
  .intro br { display: none; }
  .orb-1 { width: 200px; height: 200px; }
  .orb-2 { width: 160px; height: 160px; }
  .orb-3 { display: none; }
  .card { padding: 20px; }
  .page { min-height: calc(100svh - 56px); }
  .detail-head .back { top: 16px; }
  .chapter { padding: 48px 0; }
  .big br, .captions br { display: none; }
  .scrolly { gap: 20px; padding: 32px 0; }
  .pager, .next-btn { display: none; }
  .rag-cases, .parts, .strengths, .case-steps { grid-template-columns: 1fr; gap: 12px; }
  .job { grid-template-columns: 1fr; gap: 12px; padding: 20px; }
  .gates, .notes { grid-template-columns: 1fr; gap: 10px; }
  .about { min-height: calc(100svh - 56px); }
  .kv li { grid-template-columns: 1fr; gap: 0; }
  .flow { flex-direction: column; flex-wrap: nowrap; }
  .flow-node { flex-direction: row; justify-content: center; gap: 8px; padding: 8px 14px; width: 220px; }
  .flow-link[data-step] { width: 2px; height: 14px; }
  .flow-link::after { transform: scaleY(0); transform-origin: top; }
  .flow-link.on::after { transform: scaleY(1); }
  .flow-loop { flex-basis: auto; width: 100%; margin-top: 14px; font-size: 0.85rem; }
  .embed { flex-direction: column; gap: 8px; }
  .embed-arrow, .embed-arrow.on { transform: rotate(90deg); }
  .embed-doc { display: none; }
  .embed-arrow[data-step="1"] { display: none; }
  .strength { padding: 18px 20px; }
  .rag-case { padding: 18px 20px; }
  .rag-case p { font-size: 0.9rem; }
  .reveal.from-left, .reveal.from-right { transform: translateY(40px); }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero h1 .line, .intro, .menu a, .card, .reveal, .detail-head > * { opacity: 1; transform: none; }
  h1 strong::after { transform: scaleX(1); }
  .bar-fill { width: var(--w); }
  [data-step], .about-card > * { opacity: 1; transform: none; }
  .gauge-fill { width: var(--v); }
  html { scroll-behavior: auto; }
}
