/* slivingdoc — design system (tokens + shared structure, see
   STYLEGUIDE.md). Section content lives in sections.js; each diagram
   carries its own keyframes in an inline <style>, so nothing here is
   specific to a single section. */
:root {
  --ink: #0e1726;
  --body: #42506b;
  --muted: #7385a3;
  --blue: #1a5cff;
  --blue-deep: #0f3ecc;
  --blue-soft: #e8efff;
  --glow: #5aa2ff;
  --panel: #0b1220;
  --panel-edge: #1c2a45;
  --bg: #f6f8fc;
  --card: rgba(255, 255, 255, 0.72);
  --ok: #19b876;
  --warn: #f0a03c;
  --shadow: 0 8px 30px rgba(16, 50, 120, 0.08);
  --radius: 16px;
  --sans:
    "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --mono:
    "SF Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas,
    monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  font-family: var(--sans);
  background:
    radial-gradient(
      1100px 500px at 85% -10%,
      rgba(26, 92, 255, 0.06),
      transparent 60%
    ),
    radial-gradient(
      900px 420px at -10% 30%,
      rgba(90, 162, 255, 0.05),
      transparent 55%
    ),
    var(--bg);
  color: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  color: var(--blue-deep);
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

.brand {
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- scroll-snap sections ----------
   Every section is a .snap: one viewport tall (or taller — a section
   that overflows a small screen scrolls freely inside), settling on
   the next section per scroll. The JS scroll loop drives --focus
   (1 = centered) on desktop; without JS everything stays visible. */
.snap {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 56px 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.snap > .wrap {
  flex: 1;
  opacity: var(--focus, 1);
}
footer {
  scroll-snap-align: end;
}

/* Desktop with JS: main.js pages between sections with an
   ease-in-out animation, so native snap must not fight it.
   Mobile, no-JS, and reduced motion keep the native behavior. */
@media (min-width: 941px) {
  html.js {
    scroll-snap-type: none;
  }
}

/* ---------- intro: the dominant title, morphed into the dock by JS ---------- */
.intro {
  height: 100svh;
  padding: 0;
  position: relative;
  justify-content: center;
}
.intro-title {
  width: max-content;
  z-index: 30;
  will-change: transform;
}
.intro-title h1 {
  font-size: clamp(64px, 9vw, 112px);
  font-weight: 800;
}
.intro-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}
.intro-icon {
  width: 84px;
  height: 84px;
  flex: none;
  will-change: transform;
}
.intro-sub {
  margin: 8px 0 0 102px;
  font-size: 32px;
  color: var(--muted);
}
/* The name, spelled out: s + living + doc. */
.intro-sub .hl {
  color: var(--blue);
  font-weight: 700;
}
.title-dock {
  height: 84px;
}

/* ---------- hero (overview) ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 48px;
  align-items: center;
}
.hero .sub {
  margin-top: 12px;
  max-width: 46ch;
}
.hero-meta {
  margin: 16px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.hero-meta code {
  background: var(--blue-soft);
  color: var(--blue-deep);
  padding: 2px 7px;
  border-radius: 6px;
}
.tool-chip {
  position: relative;
}
.tool-chip code {
  transition:
    background 0.15s,
    color 0.15s;
}
.tool-chip:hover code,
.tool-chip:focus-visible code {
  background: var(--blue);
  color: #fff;
}
.tool-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  z-index: 60;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  color: #cfe0ff;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    visibility 0.16s;
}
.tool-chip:hover .tool-tip,
.tool-chip:focus-visible .tool-tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- dark diagram panel ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(28, 42, 69, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 42, 69, 0.55) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(80% 80% at 50% 45%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(
    80% 80% at 50% 45%,
    #000 30%,
    transparent 100%
  );
}
.panel svg {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
}
.panel figcaption {
  position: relative;
  text-align: center;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #6f87b5;
  padding: 8px 6px 4px;
}

/* SVG vocabulary, shared by every diagram */
.node {
  fill: rgba(26, 92, 255, 0.1);
  stroke: var(--glow);
  stroke-width: 1.5;
  rx: 8;
}
.node-hero {
  fill: url(#hero-node);
  stroke: #7db4ff;
  stroke-width: 1.8;
  filter: drop-shadow(0 0 14px rgba(90, 162, 255, 0.55));
}
.node-dim {
  fill: rgba(26, 92, 255, 0.04);
  stroke: #33507f;
  stroke-width: 1.2;
}
.lbl {
  font-family: var(--mono);
  font-size: 13px;
  fill: #9db6e4;
}
.lbl-dim {
  fill: #52688f;
}
.lbl-strong {
  fill: #dbe8ff;
  font-weight: 600;
}

.lbl-brand {
  font-family: var(--sans);
  font-weight: 800;
  fill: #eef4ff;
}
.chip {
  fill: rgba(90, 162, 255, 0.14);
  stroke: #3d6bb8;
  stroke-width: 1;
  rx: 5;
}
.fileline {
  stroke: #7ba7e8;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.85;
}
.wire {
  stroke: #2c4570;
  stroke-width: 1.5;
  fill: none;
}
.dot {
  fill: var(--c, #8fc0ff);
  filter: drop-shadow(0 0 6px rgba(90, 162, 255, 0.9));
}
.swatch {
  fill: var(--c);
}
.ok-mark {
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.warn-mark {
  fill: none;
  stroke: var(--warn);
  stroke-width: 2.5;
  stroke-linecap: round;
}
.ok-text {
  fill: var(--ok);
  font-family: var(--mono);
  font-size: 12px;
}
.warn-text {
  fill: var(--warn);
  font-family: var(--mono);
  font-size: 12px;
}

/* Diagram loops (keyframes live with each diagram) run only while
   their section has .play, toggled by an IntersectionObserver. */
.anim {
  animation-play-state: paused !important;
}
.play .anim {
  animation-play-state: running !important;
}

/* ---------- phases ---------- */
.phase-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 56px;
  align-items: center;
}
.phase-grid.flip {
  grid-template-columns: 1.35fr 1fr;
}
.phase-grid.flip .phase-copy {
  order: 2;
}
.phase-grid.flip .panel {
  order: 1;
}
.phase-index {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.phase h2 {
  font-size: 34px;
  margin: 16px 0 14px;
}
.phase p {
  max-width: 56ch;
}
.phase p + p {
  margin-top: 12px;
}
.call-chip {
  display: inline-block;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 14px;
  background: var(--panel);
  color: #cfe0ff;
  border: 1px solid var(--panel-edge);
  padding: 8px 14px;
  border-radius: 10px;
}
.fn {
  color: var(--glow);
}
.res {
  color: var(--ok);
}
.err {
  color: var(--warn);
}

html.js .phase-copy,
html.js .panel,
html.js .hero-copy {
  will-change: transform;
}

/* ---------- progress rail (generated by main.js) ---------- */
.rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 40;
}
.rail a {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(26, 92, 255, 0.22);
  transition:
    background 0.2s,
    transform 0.2s;
  position: relative;
}
/* Section titles, always visible: the rail is the table of contents. */
.rail a::after {
  content: attr(data-label);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--muted);
  opacity: 0.75;
  transition:
    color 0.2s,
    opacity 0.2s;
}
.rail a:hover::after {
  color: var(--blue-deep);
  opacity: 1;
}
.rail a.active {
  background: var(--blue);
  transform: scale(1.35);
}
.rail a.active::after {
  color: var(--blue-deep);
  opacity: 1;
  font-weight: 700;
}
.rail .rail-gh {
  width: auto;
  height: auto;
  border-radius: 6px;
  margin-top: 8px;
  padding: 1px 4px;
  background: none;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: rgba(26, 92, 255, 0.45);
  text-align: center;
  border-top: 1px solid rgba(26, 92, 255, 0.18);
}
.rail .rail-gh:hover {
  color: var(--blue);
}

/* ---------- get started ---------- */
.start h2 {
  font-size: 34px;
  margin-bottom: 10px;
}
.start-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 34px;
}
.step {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(26, 92, 255, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.step .n {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--blue);
  font-size: 13px;
}
.step h3 {
  font-size: 18px;
  margin: 8px 0 8px;
}
.step p {
  font-size: 15px;
}
.codeblock {
  margin-top: 26px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  box-shadow: var(--shadow);
  position: relative;
}
.codeblock pre {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: #cfe0ff;
}
.codeblock .k {
  color: var(--glow);
}
.codeblock .s {
  color: #a5d6a7;
}
.codeblock .ph {
  color: var(--warn);
}
.codeblock .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* Notes under code: quiet, one line each. */
.start-note,
.host-note {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}
.start-note code,
.host-note code {
  background: var(--blue-soft);
  color: var(--blue-deep);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.88em;
}

/* Per-host installation tabs. Without JS every pane is visible. */
.hosts {
  margin-top: 26px;
}
.host-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.host-tab {
  border: 1px solid rgba(26, 92, 255, 0.18);
  cursor: pointer;
  background: var(--card);
  color: var(--body);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.host-tab:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}
.host-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.host-pane .codeblock {
  margin-top: 14px;
}
html.js .host-pane {
  display: none;
}
html.js .host-pane.active {
  display: block;
}

.copy-btn {
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 11px;
  background: rgba(90, 162, 255, 0.16);
  color: var(--glow);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.copy-btn:hover {
  background: rgba(90, 162, 255, 0.3);
}

/* ---------- footer ---------- */
footer {
  margin-top: 70px;
  padding: 30px 0 40px;
  border-top: 1px solid rgba(26, 92, 255, 0.12);
  font-size: 14px;
  color: var(--muted);
}
.foot-inner {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}
.foot-inner .spacer {
  margin-left: auto;
}

/* ---------- responsive: same snap, one column, diagram first ---------- */
@media (max-width: 940px) {
  .snap {
    padding: 40px 0;
  }
  .intro {
    padding: 0;
  }
  .hero-grid,
  .phase-grid,
  .phase-grid.flip {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .hero-grid .panel,
  .phase-grid .panel {
    order: 1;
  }
  .hero-copy,
  .phase-copy {
    order: 2;
  }
  .intro-title {
    position: static !important;
    transform: none !important;
    width: auto;
  }
  .intro-title h1 {
    font-size: clamp(44px, 12vw, 72px);
  }
  .intro-icon {
    width: 44px;
    height: 44px;
    transform: none !important;
  }
  .intro-sub {
    margin-left: 62px;
    font-size: 17px;
  }
  .title-dock {
    display: none;
  }
  .rail {
    display: none;
  }
  .phase h2,
  .start h2 {
    font-size: 26px;
  }
  .start-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }
  .snap > .wrap {
    opacity: 1;
  }
  .anim {
    animation: none !important;
  }
}
