/* pixfix docs — Catppuccin Mocha, matching the pixfix app. */

:root {
  --rosewater: #f5e0dc;
  --pink: #f5c2e7;
  --mauve: #cba6f7;
  --red: #f38ba8;
  --peach: #fab387;
  --yellow: #f9e2af;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --blue: #89b4fa;
  --lavender: #b4befe;
  --text: #cdd6f4;
  --subtext1: #bac2de;
  --subtext0: #a6adc8;
  --overlay0: #6c7086;
  --surface2: #585b70;
  --surface1: #45475a;
  --surface0: #313244;
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--base);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--surface2); }

a { color: var(--blue); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.18s ease, color 0.18s ease; }
a:hover { color: var(--lavender); border-bottom-color: var(--lavender); }

code {
  font-family: var(--mono);
  background: var(--surface0);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.92em;
  white-space: nowrap;
}

pre {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 14px 18px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; white-space: pre; }

.prompt { color: var(--green); user-select: none; }
.out { color: var(--subtext0); }
.dim { color: var(--overlay0); }
.accent { color: var(--mauve); }

/* ── Nav ─────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--mantle) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface0);
}

.nav-brand { color: var(--mauve); font-weight: 700; border: none; }
.nav-brand:hover { color: var(--pink); }

.nav-links { display: flex; gap: 18px; flex-wrap: wrap; }
.nav-links a {
  color: var(--subtext0);
  font-size: 13px;
  border: none;
  position: relative;
  padding-bottom: 2px;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--mauve);
  transition: right 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after, .nav-links a.active::after { right: 0; }
.nav-links a.active { color: var(--mauve); }
.nav-gh { color: var(--subtext1); }

/* ── Hero ────────────────────────────────────────────────────────────── */

.hero {
  max-width: 880px;
  margin: 0 auto;
  padding: 72px 24px 48px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  color: var(--mauve);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.tagline {
  max-width: 640px;
  margin: 0 auto 32px;
  color: var(--subtext1);
  text-align: left;
}

.hero-install {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.install-line {
  display: block;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 10px 18px;
  white-space: pre;
  transition: border-color 0.2s ease;
}
.install-line:hover { border-color: var(--surface2); }

/* The pixel-snap demo: cells scatter, then settle onto the grid. */
.hero-grid-wrap { margin: 0 auto 40px; width: fit-content; }
.hero-grid {
  display: grid;
  grid-template-columns: repeat(10, 22px);
  grid-auto-rows: 22px;
  gap: 2px;
  padding: 14px;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 10px;
}
.cell { border-radius: 2px; }
.cell.on {
  opacity: 0.35;
  filter: blur(1.5px);
  transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0)) scale(0.8);
  animation: settle 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.cell.on.settled { animation: none; opacity: 1; filter: none; transform: none; }

@keyframes settle {
  60% { opacity: 1; }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(0, 0) rotate(0) scale(1);
  }
}

.hero-caption {
  margin-top: 10px;
  font-size: 12px;
  color: var(--overlay0);
}

/* ── Sections ────────────────────────────────────────────────────────── */

main { max-width: 880px; margin: 0 auto; padding: 0 24px; }

.section { padding: 40px 0; border-top: 1px solid var(--surface0); }

.section h2 {
  font-size: 21px;
  color: var(--lavender);
  margin-bottom: 14px;
}
.section h2.mt { margin-top: 36px; }
.h-mark { color: var(--surface2); margin-right: 8px; }

.section > p { max-width: 680px; color: var(--subtext1); margin-bottom: 18px; }
.fine { font-size: 13px; color: var(--subtext0); }

/* Scroll reveal — gentle, once, disabled under reduced motion. */
.section, .stage, .example {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease-out, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .section, .stage, .example { opacity: 1; transform: none; transition: none; }
  .cell.on { animation: none; opacity: 1; filter: none; transform: none; }
  .nav-links a::after { transition: none; }
}

/* Pipeline stages: a connected vertical list. */
.stages { list-style: none; counter-reset: stage; }
.stage {
  counter-increment: stage;
  position: relative;
  padding: 0 0 26px 52px;
}
.stage::before {
  content: counter(stage);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--surface0);
  color: var(--mauve);
  font-weight: 700;
  border-radius: 8px;
  font-size: 14px;
}
.stage:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 38px;
  bottom: 4px;
  width: 2px;
  background: var(--surface0);
}
.stage h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }
.stage p { color: var(--subtext0); font-size: 14px; max-width: 640px; }
.opt {
  font-size: 11px;
  color: var(--peach);
  background: color-mix(in srgb, var(--peach) 12%, transparent);
  border-radius: 4px;
  padding: 2px 7px;
  vertical-align: 2px;
  margin-left: 6px;
}

/* Examples */
.example { margin-bottom: 20px; }
.example-label { color: var(--subtext1); font-size: 14px; margin-bottom: 8px; }

/* Reference tables */
.ref { width: 100%; border-collapse: collapse; font-size: 14px; }
.ref td {
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--surface0);
  vertical-align: top;
  color: var(--subtext1);
}
.ref td:first-child { white-space: nowrap; color: var(--text); }
.ref tr { transition: background 0.15s ease; }
.ref tr:hover { background: color-mix(in srgb, var(--surface0) 40%, transparent); }

.exit-codes td:first-child, .exit-codes td:nth-child(3) {
  font-weight: 700;
  width: 3em;
}
.code-ok { color: var(--green); }
.code-warn { color: var(--peach); }

/* JSON demo highlighting */
.json-demo { margin-bottom: 20px; }
.j { color: var(--overlay0); }
.jk { color: var(--blue); }
.jv { color: var(--peach); }
.js { color: var(--green); }

/* ── Try-it demo ─────────────────────────────────────────────────────── */

.demo-drop {
  display: grid;
  place-items: center;
  min-height: 110px;
  padding: 24px;
  background: var(--mantle);
  border: 2px dashed var(--surface2);
  border-radius: 10px;
  color: var(--subtext0);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.demo-drop:hover,
.demo-drop:focus-visible,
.demo-drop.drag {
  border-color: var(--mauve);
  color: var(--text);
  background: color-mix(in srgb, var(--mauve) 6%, var(--mantle));
  outline: none;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--subtext1);
}
.demo-controls label { display: inline-flex; align-items: center; gap: 8px; }
.demo-controls input[type="number"],
.demo-controls select {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 6px;
  padding: 4px 8px;
  transition: border-color 0.18s ease;
}
.demo-controls input[type="number"] { width: 5em; }
.demo-controls input[type="number"]:focus,
.demo-controls select:focus {
  border-color: var(--mauve);
  outline: none;
}
.demo-note { color: var(--overlay0); font-size: 12px; }

.demo-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
/* display: grid above would defeat the hidden attribute. */
.demo-result[hidden] { display: none; }
.demo-panel {
  margin: 0;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 10px;
}
.demo-panel img {
  display: block;
  width: 100%;
  image-rendering: pixelated;
  border-radius: 4px;
  /* Checkerboard so transparent results read as transparent. */
  background: repeating-conic-gradient(var(--surface0) 0% 25%, var(--mantle) 0% 50%) 0 0 / 16px 16px;
}
.demo-panel figcaption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--overlay0);
  text-align: center;
}

.demo-meta { margin-top: 12px; font-size: 13px; color: var(--subtext0); }
.demo-fallback { margin-top: 4px; }

/* ── Footer ──────────────────────────────────────────────────────────── */

.footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 24px 44px;
  border-top: 1px solid var(--surface0);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--overlay0);
  font-size: 13px;
}

@media (max-width: 560px) {
  .nav { padding: 10px 14px; }
  .nav-links { gap: 12px; }
  .hero { padding-top: 48px; }
  .hero-grid { grid-template-columns: repeat(10, 16px); grid-auto-rows: 16px; }
  .demo-result { grid-template-columns: 1fr; }
}
