/* =========================================================================
   Olivine — botanical docs for a streaming ETL framework.
   Signature: pipeline stages drawn as leaf-shaped nodes joined by a curved
   vine (hero) and a vine that runs down the sidebar margin.
   ========================================================================= */

:root {
  /* palette — light */
  --bg: #f7f9f4;
  --surface: #eaf0e2;
  --fg: #1d221a;
  --muted: #5c6653;
  --accent: #15803d;
  --accent-fg: #ffffff;

  --border: color-mix(in srgb, var(--fg) 13%, transparent);
  --border-soft: color-mix(in srgb, var(--fg) 8%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --accent-line: color-mix(in srgb, var(--accent) 45%, var(--border));

  /* code surfaces stay light in both themes so the github highlight
     theme (a light theme) is always legible */
  --code-bg: #eef3e6;
  --code-fg: #24292e;
  --code-border: #dbe4cf;

  /* fonts */
  --font-text: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* fluid type scale */
  --text-xs: clamp(0.72rem, 0.7rem + 0.1vw, 0.78rem);
  --text-sm: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  --text-lg: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
  --text-xl: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem);
  --text-2xl: clamp(1.8rem, 1.45rem + 1.6vw, 2.7rem);
  --text-hero: clamp(2.3rem, 1.7rem + 3vw, 4rem);

  /* spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --sidebar-w: 272px;
  --wrap: 1240px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f130e;
  --surface: #171c15;
  --fg: #e3e8df;
  --muted: #9aa691;
  --accent: #6ee7b7;
  --accent-fg: #052e1b;
  --border: color-mix(in srgb, var(--fg) 16%, transparent);
  --border-soft: color-mix(in srgb, var(--fg) 10%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 40%, var(--border));
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f130e;
    --surface: #171c15;
    --fg: #e3e8df;
    --muted: #9aa691;
    --accent: #6ee7b7;
    --accent-fg: #052e1b;
    --border: color-mix(in srgb, var(--fg) 16%, transparent);
    --border-soft: color-mix(in srgb, var(--fg) 10%, transparent);
    --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
    --accent-line: color-mix(in srgb, var(--accent) 40%, var(--border));
    color-scheme: dark;
  }
}

/* ---------- reset & base ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  font-family: var(--font-text);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 38%, transparent); text-underline-offset: 3px; transition: color .16s ease, text-decoration-color .16s ease; }
a:hover { text-decoration-color: currentColor; }

img, svg { max-width: 100%; height: auto; }

code, pre, kbd { font-family: var(--font-mono); }

/* ---------- a11y -------------------------------------------------------- */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--accent-fg);
  padding: .55rem 1rem; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none; font-weight: 600;
  transition: top .16s ease;
}
.skip-link:focus { top: 0; }

.kbd {
  font-family: var(--font-mono);
  font-size: 0.72em;
  padding: 0.1em 0.42em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- topbar ------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.7rem clamp(1rem, 3vw, 1.75rem);
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--fg); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-ver { font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.4rem; letter-spacing: 0; }
.topnav { display: flex; gap: 0.4rem; margin-left: 0.5rem; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--text-sm); padding: 0.4rem 0.7rem; border-radius: var(--radius-sm); transition: color .16s ease, background-color .16s ease; }
.topnav a:hover { color: var(--fg); background: var(--surface); }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.search-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.42rem 0.7rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--muted);
  font: inherit; font-size: var(--text-sm); cursor: pointer;
  transition: border-color .16s ease, color .16s ease;
}
.search-btn:hover { border-color: var(--accent-line); color: var(--fg); }
.search-btn svg { width: 16px; height: 16px; }
.search-btn .kbd { background: var(--bg); }

.theme-btn, .nav-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-width: 40px; min-height: 40px; padding: 0.4rem 0.55rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--fg); cursor: pointer; font: inherit;
  transition: border-color .16s ease, color .16s ease;
}
.theme-btn:hover, .nav-btn:hover { border-color: var(--accent-line); }
.theme-btn svg { width: 18px; height: 18px; }
.nav-btn { display: none; font-weight: 600; font-size: var(--text-sm); }
.nav-btn svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

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

/* homepage goes full-bleed — no docs sidebar */
body.is-home .shell { grid-template-columns: minmax(0, 1fr); }
body.is-home .sidebar { display: none; }

.sidebar {
  position: sticky; top: 3.6rem;
  align-self: start;
  height: calc(100vh - 3.6rem);
  overflow-y: auto;
  padding: var(--space-4) var(--space-3) var(--space-5) clamp(1rem, 3vw, 1.75rem);
  border-right: 1px solid var(--border-soft);
}

.sidebar-nav { position: relative; }
/* the vine: a stalk running down the sidebar margin */
.sidebar-nav::before {
  content: ""; position: absolute; left: 9px; top: 0.6rem; bottom: 0.6rem;
  width: 2px; border-radius: 2px;
  background: var(--accent-line);
}

.sidebar-group {
  position: relative; padding-left: 30px;
  margin: var(--space-4) 0 0.4rem;
  font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
}
.sidebar-group:first-child { margin-top: 0; }
.sidebar-group a { color: var(--fg); text-decoration: none; }
.sidebar-group a:hover { color: var(--accent); }
/* leaf node on the vine at each section */
.leaf-node {
  position: absolute; left: 2px; top: -1px;
  width: 15px; height: 15px; background: var(--accent);
  border-radius: 0 100% 0 100%;
  box-shadow: 0 0 0 4px var(--bg);
}

.tree { list-style: none; padding: 0 0 0.4rem 30px; position: relative; }
.tree-link {
  position: relative; display: block;
  padding: 0.36rem 0.6rem; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none;
  font-size: var(--text-sm); font-weight: 500; line-height: 1.4;
  transition: color .16s ease, background-color .16s ease;
}
/* a small leaf budding off the vine for each page */
.tree-link::before {
  content: ""; position: absolute; left: -20px; top: 0.85em;
  width: 9px; height: 9px; background: var(--muted); opacity: 0.55;
  border-radius: 0 100% 0 100%;
  transition: background-color .16s ease, opacity .16s ease;
}
.tree-link:hover { color: var(--fg); background: var(--surface); }
.tree-link:hover::before { opacity: 0.9; }
.tree-link.is-current { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.tree-link.is-current::before { background: var(--accent); opacity: 1; box-shadow: 0 0 0 3px var(--bg); }

/* ---------- main / prose ----------------------------------------------- */
.main {
  min-height: 60vh;
  padding: var(--space-5) clamp(1.25rem, 4vw, 3.5rem) var(--space-6);
}
.main-home { padding-top: var(--space-4); }

.prose { font-size: var(--text-base); }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-size: var(--text-xl); margin-top: 2.2em; padding-top: 0.2em; scroll-margin-top: 5rem; }
.prose h3 { font-size: var(--text-lg); margin-top: 1.8em; scroll-margin-top: 5rem; }
.prose p, .prose li { max-width: 68ch; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose a { font-weight: 500; }
.prose strong { font-weight: 700; color: var(--fg); }
.prose-narrow p, .prose-narrow li { max-width: 62ch; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1.1rem; margin-left: 0;
  color: var(--muted); font-style: italic;
}

/* inline + block code */
.prose :not(pre) > code, .hero-install code, .quickstart-copy code {
  font-size: 0.86em; background: var(--code-bg); color: var(--code-fg);
  padding: 0.12em 0.42em; border-radius: 5px; border: 1px solid var(--code-border);
}
pre {
  background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--code-border); border-radius: var(--radius);
  padding: 1.05rem 1.2rem; overflow-x: auto;
  line-height: 1.55; font-size: var(--text-sm);
  box-shadow: 0 1px 0 var(--border-soft);
}
pre code, pre code.hljs { background: transparent; padding: 0; border: 0; font-size: inherit; color: inherit; }

/* tables */
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); margin: 0.4rem 0; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose thead th { border-bottom: 2px solid var(--accent-line); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.prose td code { white-space: nowrap; }

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4rem 0; }

/* ---------- buttons / links -------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.2rem; border-radius: 999px;
  font-weight: 700; font-size: var(--text-sm); text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .12s ease, background-color .16s ease, border-color .16s ease, color .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
:root[data-theme="dark"] .btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn-ghost { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent-line); }

.link-arrow { font-weight: 700; font-size: var(--text-sm); text-decoration: none; color: var(--accent); white-space: nowrap; }
.link-arrow:hover span { padding-left: 3px; }
.link-arrow span { transition: padding-left .16s ease; }

.eyebrow {
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted);
}

.section-title { font-size: var(--text-xl); letter-spacing: -0.02em; }

.chip {
  display: inline-block; font-family: var(--font-mono); font-size: 0.72em;
  padding: 0.14em 0.55em; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  text-transform: none; letter-spacing: 0;
}
:root[data-theme="dark"] .chip { color: var(--fg); }

/* ---------- home: hero + vine figure ----------------------------------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.5rem, 5vw, 4rem); align-items: center;
  padding: clamp(1.5rem, 5vw, 4rem) 0 var(--space-5);
}
.hero-copy { display: flex; flex-direction: column; gap: var(--space-3); }
.hero-title { font-size: var(--text-hero); font-weight: 800; letter-spacing: -0.035em; }
.hero-title em { font-style: normal; color: var(--accent); }
.hero-lede { font-size: var(--text-lg); color: var(--muted); max-width: 40ch; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.4rem; }
.hero-install { margin-top: 0.3rem; }
.hero-install code { font-size: 0.9rem; }
.hero-install code::before { content: "$ "; color: var(--accent); }

.vine-figure { position: relative; justify-self: center; width: 100%; max-width: 380px; }
.vine-svg { width: 100%; height: auto; display: block; overflow: visible; }

.vine-stem { stroke: var(--accent-line); stroke-width: 3.5; stroke-linecap: round; }
.vine-flow { stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 1 26; opacity: 0.9; animation: vine-run 3.2s linear infinite; }
.leaf-body { fill: var(--accent); }
.leaf-vein { stroke: var(--accent-fg); stroke-width: 1.6; stroke-linecap: round; opacity: 0.85; }
.node { transform-box: fill-box; transform-origin: center; animation: leaf-sway 6s ease-in-out infinite; }
.node--2 { animation-delay: -2s; }
.node--3 { animation-delay: -4s; }
.bud .leaf-body { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }

.vine-tag {
  position: absolute; display: flex; flex-direction: column; line-height: 1.25;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.4rem 0.7rem;
  box-shadow: 0 6px 20px -12px color-mix(in srgb, var(--fg) 40%, transparent);
}
.vine-kicker { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-weight: 500; }
:root[data-theme="dark"] .vine-kicker { color: var(--fg); }
.vine-name { font-size: var(--text-sm); font-weight: 700; color: var(--fg); }
.vine-tag--source { left: -2%; top: 6%; }
.vine-tag--transform { right: -4%; top: 46%; }
.vine-tag--sink { left: -2%; bottom: 4%; }

/* ---------- home: stage cards ------------------------------------------ */
.stages { padding: var(--space-5) 0; border-top: 1px solid var(--border-soft); }
.stage-grid { list-style: none; padding: 0; margin-top: var(--space-4); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.stage-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: var(--space-4);
  display: flex; flex-direction: column; gap: 0.5rem;
}
.stage-card h3 { font-size: var(--text-lg); }
.stage-card p { color: var(--muted); font-size: var(--text-sm); }
.stage-mark { width: 20px; height: 20px; background: var(--accent); border-radius: 0 100% 0 100%; }

/* ---------- home: quickstart ------------------------------------------- */
.quickstart { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: var(--space-5); align-items: center; padding: var(--space-5) 0; border-top: 1px solid var(--border-soft); }
.quickstart-copy { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.quickstart-copy p { color: var(--muted); }
.quickstart-code { margin: 0; }

/* ---------- listings / doc cards --------------------------------------- */
.listing { padding: var(--space-5) 0; border-top: 1px solid var(--border-soft); }
.listing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: var(--space-4); }
.doc-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-3); }
.doc-card { position: relative; }
.doc-link {
  display: flex; flex-direction: column; gap: 0.4rem; height: 100%;
  padding: var(--space-4); border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg); text-decoration: none;
  transition: border-color .16s ease, transform .12s ease, background-color .16s ease;
}
.doc-link:hover { border-color: var(--accent-line); transform: translateY(-2px); background: var(--surface); }
.doc-num { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); font-weight: 500; }
.doc-title { font-size: var(--text-lg); color: var(--fg); letter-spacing: -0.015em; }
.doc-desc { color: var(--muted); font-size: var(--text-sm); flex: 1; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: var(--text-xs); color: var(--muted); margin-top: 0.3rem; }
.doc-mins { font-family: var(--font-mono); }

.why { padding: var(--space-5) 0 0; border-top: 1px solid var(--border-soft); }
.why .prose { margin-top: var(--space-4); }

/* ---------- interior: page grid + toc ---------------------------------- */
.page-grid { display: block; }
.page-grid.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.article { min-width: 0; max-width: 760px; }
.article-head { margin-bottom: var(--space-4); }
.article-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: var(--text-xs); margin-bottom: 0.9rem; }
.kicker-link { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; text-decoration: none; color: var(--accent); font-weight: 500; }
.kicker-mins { color: var(--muted); font-family: var(--font-mono); }
.article-head h1 { font-size: var(--text-2xl); }
.lede { font-size: var(--text-lg); color: var(--muted); margin-top: 0.7rem; line-height: 1.5; max-width: 60ch; }
.article-meta { font-size: var(--text-xs); color: var(--muted); font-family: var(--font-mono); margin-top: 0.8rem; }

.toc { position: sticky; top: 5rem; align-self: start; font-size: var(--text-sm); }
.toc-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; margin-bottom: 0.6rem; padding-left: 0.85rem; }
.toc ul { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.toc li { line-height: 1.35; }
.toc ul ul { margin-left: 0.8rem; border-left: 0; }
.toc a { display: block; padding: 0.28rem 0.85rem; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; margin-left: -2px; transition: color .16s ease, border-color .16s ease; }
.toc a:hover { color: var(--accent); border-color: var(--accent-line); }

/* pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-6); }
.pager-link {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease;
}
.pager-link:hover { border-color: var(--accent-line); background: var(--surface); }
.pager-next { text-align: right; }
.pager-label { font-size: var(--text-xs); color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.pager-title { font-weight: 700; color: var(--fg); }

/* ---------- section head ----------------------------------------------- */
.section-head { max-width: 760px; margin-bottom: var(--space-5); }
.section-head h1 { font-size: var(--text-2xl); margin-top: 0.5rem; }

/* ---------- 404 -------------------------------------------------------- */
.notfound { max-width: 620px; margin: var(--space-6) auto; text-align: center; }
.notfound-art { width: 160px; height: 160px; margin: 0 auto var(--space-4); }
.notfound h1 { font-size: var(--text-2xl); }
.notfound p { color: var(--muted); margin-top: var(--space-3); }
.notfound-actions { display: flex; gap: 0.75rem; justify-content: center; margin-top: var(--space-4); flex-wrap: wrap; }

/* ---------- command palette -------------------------------------------- */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--fg) 40%, transparent);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(2rem, 12vh, 8rem) 1rem 2rem;
}
.palette-backdrop[hidden] { display: none; }
.palette {
  width: 100%; max-width: 560px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 30px 70px -30px color-mix(in srgb, var(--fg) 60%, transparent);
  animation: palette-in .16s ease-out;
}
.palette-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-soft); }
.palette-head svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette-head input { flex: 1; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: var(--text-lg); outline: none; }
.palette-head input::placeholder { color: var(--muted); }
.palette-results { list-style: none; margin: 0; padding: 0.4rem; max-height: 46vh; overflow-y: auto; }
.palette-item a { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); text-decoration: none; }
.palette-item.is-active a { background: var(--accent-soft); }
.palette-item-title { color: var(--fg); font-weight: 600; font-size: var(--text-sm); }
.palette-item-path { color: var(--muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.palette-status { padding: 0.4rem 1.1rem 0.7rem; color: var(--muted); font-size: var(--text-xs); }
.palette-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.6rem 1rem; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: var(--text-xs); }
:root[data-modal="open"] { overflow: hidden; }

/* ---------- footer ----------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border-soft); background: var(--surface); }
.footer-inner { max-width: var(--wrap); margin: 0 auto; padding: var(--space-5) clamp(1.25rem, 4vw, 3.5rem); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }
.footer-mark { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--accent); font-size: var(--text-sm); }
.footer-mark svg { width: 22px; height: 22px; flex: none; }
.footer-mark span { color: var(--muted); }
.footer-mark strong { color: var(--fg); }
.footer-nav { display: flex; gap: var(--space-3); }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: var(--text-sm); font-weight: 600; }
.footer-nav a:hover { color: var(--accent); }
.footer-fine { width: 100%; color: var(--muted); font-size: var(--text-xs); border-top: 1px solid var(--border-soft); padding-top: var(--space-3); }

/* ---------- animation -------------------------------------------------- */
@keyframes vine-run { to { stroke-dashoffset: -27; } }
@keyframes leaf-sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes palette-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ------------------------------------------------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .vine-figure { order: -1; max-width: 320px; margin-bottom: var(--space-3); }
  .quickstart { grid-template-columns: 1fr; }
  .page-grid.has-toc { grid-template-columns: 1fr; }
  .toc { display: none; }
}

@media (max-width: 920px) {
  .nav-btn { display: inline-flex; }
  body.is-home .nav-btn { display: none; }
  .topnav { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 90;
    width: min(320px, 84vw); height: 100vh;
    background: var(--bg); border-right: 1px solid var(--border);
    transform: translateX(-100%); transition: transform .2s ease;
    padding-top: 4.5rem;
    box-shadow: 0 0 60px -20px color-mix(in srgb, var(--fg) 50%, transparent);
  }
  :root[data-nav="open"] .sidebar { transform: translateX(0); }
  .search-btn-label { display: none; }
  .search-btn .kbd { display: none; }
}

@media (max-width: 640px) {
  .stage-grid { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .vine-tag { position: static; margin: 0.3rem 0; }
  .vine-figure { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; }
  .brand-ver { display: none; }
  .footer-inner { gap: var(--space-3); }
}

/* ---------- reduced motion --------------------------------------------- */
@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;
  }
}
