/* ==========================================================================
   QR Studio — styles
   Dark-first; [data-theme="light"] overrides the tokens. One accent: amber.
   ========================================================================== */

/* ---------- fonts (self-hosted, @fontsource-variable 5.3.0, OFL-1.1) ---------- */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Metric-matched fallback so the swap to Inter doesn't reflow text. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica");
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
  size-adjust: 107.12%;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;

  --bg: #09090b;
  --surface: #111114;
  --surface-2: #17171b;
  --text: #ededf0;
  --dim: #b4b4bc;
  --muted: #7c7c86;
  --line: rgb(255 255 255 / 0.08);
  --line-2: rgb(255 255 255 / 0.16);

  --accent: #ffb224;
  --accent-rgb: 255 178 36;
  --accent-ink: #09090b;             /* text on accent fills */
  --accent-soft: rgb(255 178 36 / 0.12);
  --accent-line: rgb(255 178 36 / 0.38);
  --accent-glow: rgb(255 178 36 / 0.45);

  --live: #4ade80;
  --warn: #ff9463;
  --danger: #ff6b70;

  --checker: rgb(255 255 255 / 0.035);
  --shadow-lift: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 24px 48px -20px rgb(0 0 0 / 0.7), 0 8px 16px -8px rgb(0 0 0 / 0.5);
  --shadow-pop: 0 30px 80px -20px rgb(0 0 0 / 0.8), 0 0 0 1px var(--line-2);

  --radius: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --sans: "Inter Variable", "Inter Fallback", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --nav-h: 60px;
  --gutter: clamp(16px, 4vw, 32px);
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f2f2ee;
  --text: #111113;
  --dim: #45454d;
  --muted: #6c6c75;
  --line: rgb(0 0 0 / 0.08);
  --line-2: rgb(0 0 0 / 0.16);

  --accent: #a15c00;
  --accent-rgb: 161 92 0;
  --accent-ink: #ffffff;
  --accent-soft: rgb(161 92 0 / 0.1);
  --accent-line: rgb(161 92 0 / 0.35);
  --accent-glow: rgb(161 92 0 / 0.3);

  --live: #15803d;
  --warn: #b4460b;
  --danger: #c4262e;

  --checker: rgb(0 0 0 / 0.035);
  --shadow-lift: 0 24px 48px -24px rgb(20 20 10 / 0.22), 0 8px 16px -10px rgb(20 20 10 / 0.12);
  --shadow-pop: 0 30px 80px -20px rgb(20 20 10 / 0.3), 0 0 0 1px var(--line-2);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: inherit; }
img, svg, canvas { display: block; }
button { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); }

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

code {
  font-size: 0.86em;
  padding: 0.08em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--dim);
  white-space: nowrap;
}

/* Numbers-as-data: mono, tabular, soft accent tint. */
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.88em;
  padding: 0.06em 0.42em;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.muted { color: var(--muted); }
.accent { color: var(--accent); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus-visible { top: 12px; }

.shell {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Faint 80px grid, faded out with a radial mask. */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  background-position: calc(50% + 40px) -1px;
  opacity: 0.7;
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 20%, transparent 75%);
}

/* ---------- shared bits ---------- */
.prompt { color: var(--muted); white-space: nowrap; }
.prompt b { color: var(--accent); font-weight: 500; }

.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: -0.2em;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: blink 1.1s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px 3px 9px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dim);
}

/* Status pills with a small glowing dot. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px 0 9px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
  --dot: var(--muted);
}
.pill[data-state="live"] { --dot: var(--live); }
.pill[data-state="wip"] { --dot: var(--accent); }
.pill[data-state="down"] { --dot: var(--danger); }
.pill[data-state="archived"] { --dot: var(--muted); }
a.pill:hover { border-color: var(--line-2); color: var(--text); }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot, var(--live));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--live)) 18%, transparent), 0 0 10px var(--dot, var(--live));
  flex-shrink: 0;
}
.dot-live { --dot: var(--live); }
.pill[data-state="live"] .dot, .dot-live { animation: pulse 2.4s var(--ease) infinite; }
.pill[data-state="checking"] .dot { animation: blink 0.9s steps(1, end) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 18%, transparent), 0 0 10px var(--dot); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--dot) 6%, transparent), 0 0 4px var(--dot); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.4s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 28px -10px var(--accent-glow);
}
.btn-primary:focus-visible { outline-offset: 3px; }

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--muted); }

.btn.copied, .copy-btn.copied { color: var(--live); border-color: color-mix(in srgb, var(--live) 45%, transparent); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--surface); }
.icon-btn svg { width: 16px; height: 16px; }

[data-theme="dark"] .icon-moon,
[data-theme="light"] .icon-sun { display: none; }

/* ---------- nav ---------- */
#nav-sentinel { position: absolute; top: 0; left: 0; height: 8px; width: 1px; }

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease), -webkit-backdrop-filter 0.5s var(--ease), backdrop-filter 0.5s var(--ease);
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
          backdrop-filter: blur(14px) saturate(1.5);
  border-bottom-color: var(--line);
}
.nav-inner {
  max-width: 1180px;
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-size: 1rem;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--accent);
  flex-shrink: 0;
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-mark .brand-dim { fill: var(--text); }

.nav-links {
  display: flex;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.76rem;
}
.nav-links a {
  position: relative;
  padding: 6px 11px;
  border-radius: var(--pill);
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="true"] { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="true"]::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 7px;
  vertical-align: 2px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status { min-width: 66px; }
.nav-api-link {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 8px;
}
.nav-api-link:hover { color: var(--text); }

@media (max-width: 860px) { .nav-api-link { display: none; } }
@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* ---------- tool header ---------- */
.section-tool { padding-block: clamp(28px, 4vw, 44px) clamp(56px, 8vw, 96px); }
.tool-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 24px;
}
.tool-title {
  margin: 0;
  font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.9rem);
  font-weight: 660;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.tool-sub {
  margin: 8px 0 0;
  max-width: 62ch;
  font-size: 0.92rem;
  color: var(--dim);
}
.tool-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- sections ---------- */
.section {
  padding-block: clamp(48px, 6vw, 80px);
  scroll-margin-top: var(--nav-h);
}
.section + .section { border-top: 1px solid var(--line); }

.section-head { margin-bottom: 24px; max-width: 760px; }
.section-label {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.section-label span { color: var(--accent); }
.section-title {
  margin: 0;
  font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.6rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-wrap: balance;
}
.section-sub {
  margin: 18px 0 0;
  max-width: 60ch;
  color: var(--dim);
}

/* ---------- cards + cursor effects ---------- */
.card {
  --mx: 50%;
  --my: 50%;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.4s var(--ease), box-shadow 0.6s var(--ease), transform 0.6s var(--ease);
}
/* Spotlight (under content) */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgb(var(--accent-rgb) / 0.07), transparent 45%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
/* Border glow: a gradient masked to the 1px ring. */
.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgb(var(--accent-rgb) / 0.75), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover { border-color: var(--line-2); }
  .card:hover::before,
  .card:hover::after { opacity: 1; }
  .card.tilt {
    transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    will-change: transform;
  }
  .card.tilt:hover {
    transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-3px);
    box-shadow: var(--shadow-lift);
    transition: border-color 0.4s var(--ease), box-shadow 0.6s var(--ease), transform 0.25s var(--ease);
  }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 620;
  letter-spacing: -0.02em;
}
.card-header .hint { font-size: 0.7rem; color: var(--muted); }
.card-body { padding: 20px; }

/* ---------- generator ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 20px;
  align-items: start;
}
.controls { display: grid; gap: 20px; min-width: 0; }
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

.field { margin-bottom: 22px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.field label, .field .label {
  font-size: 0.84rem;
  font-weight: 560;
  letter-spacing: -0.01em;
  color: var(--text);
}
code.param {
  font-size: 0.68rem;
  padding: 1px 8px;
  border-radius: var(--pill);
  color: var(--muted);
}
.field-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

textarea, input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.86rem;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
textarea {
  min-height: 5.2rem;
  resize: vertical;
  line-height: 1.55;
}
textarea::placeholder, input::placeholder { color: var(--muted); }
textarea:hover, input[type="text"]:hover { border-color: var(--line-2); }
textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row { display: flex; gap: 16px; }
.row > .field { flex: 1; }
@media (max-width: 480px) {
  .row { flex-direction: column; gap: 0; }
  .row > .field:not(:last-child) { margin-bottom: 22px; }
}

/* Segmented pill control */
.segmented {
  display: flex;
  gap: 2px;
  width: 100%;
  padding: 3px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--bg);
}
.segmented button {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 560;
  cursor: pointer;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 4px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 560;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.shape-btn:hover { color: var(--text); border-color: var(--line-2); }
.shape-btn svg { width: 22px; height: 22px; transition: transform 0.5s var(--ease); }
.shape-btn:hover svg { transform: scale(1.1) rotate(-4deg); }
.shape-btn[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--bg);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.color-field:hover { border-color: var(--line-2); }
.color-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.color-field input[type="color"] {
  -webkit-appearance: none;
          appearance: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color-field input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.color-field input[type="text"] {
  border: 0;
  background: none;
  padding: 6px 0;
  box-shadow: none;
  font-size: 0.84rem;
}
.color-field input[type="text"]:focus { box-shadow: none; }

/* Range slider with an accent fill (--pct set from JS) */
.slider-row { display: flex; align-items: center; gap: 14px; }
input[type="range"] {
  --pct: 50%;
  flex: 1;
  min-width: 0;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
          appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--pill);
  background: linear-gradient(to right, var(--accent) var(--pct), var(--line-2) var(--pct));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: var(--pill);
  background: linear-gradient(to right, var(--accent) var(--pct), var(--line-2) var(--pct));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent-line), 0 0 12px var(--accent-glow);
  transition: transform 0.3s var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent-line), 0 0 12px var(--accent-glow);
}
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]:focus-visible { outline-offset: 4px; }
.slider-value {
  flex-shrink: 0;
  min-width: 7.2em;
  text-align: center;
  padding: 3px 8px;
  font-size: 0.76rem;
}

/* Preview */
.preview-col { position: sticky; top: calc(var(--nav-h) + 16px); min-width: 0; }
@media (max-width: 920px) {
  .preview-col { position: static; width: 100%; max-width: 480px; justify-self: center; }
}

.preview-surface {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  border-bottom: 1px solid var(--line);
  background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}
#preview {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 20px 50px -18px rgb(0 0 0 / 0.55), 0 0 0 1px var(--line);
  transition: opacity 0.3s var(--ease), scale 0.5s var(--ease);
}
#preview.loading { opacity: 0.35; scale: 0.985; }
/* Nothing rendered yet: dashed placeholder instead of a broken image. */
#preview:not([src]) { visibility: hidden; }
.preview-surface:has(#preview:not([src]))::before {
  content: "no image yet";
  position: absolute;
  inset: 28px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.spinner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.spinner.show { display: block; }
@keyframes spin { to { rotate: 360deg; } }

.preview-actions { display: flex; gap: 10px; padding: 18px 20px; }
.preview-actions .btn { flex: 1; min-width: 0; }

.banner {
  display: none;
  gap: 9px;
  align-items: flex-start;
  margin: 18px 20px 0;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.45;
}
.banner.show { display: flex; }
.banner svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.banner.warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent);
}
.banner.error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}
.banner + .preview-actions { padding-top: 14px; }

.snippet-head { padding: 0 20px; border-top: 1px solid var(--line); }
.prompt-line {
  margin: 14px 0 2px;
  font-size: 0.72rem;
  color: var(--dim);
}
.tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  position: relative;
  padding: 10px 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s var(--ease);
}
.tabs button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  scale: 0 1;
  transition: scale 0.4s var(--ease);
}
.tabs button:hover { color: var(--dim); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { scale: 1 1; }

.snippet-wrap { position: relative; padding: 14px 20px 20px; }
.snippet {
  display: none;
  margin: 0;
  max-height: 9rem;
  overflow-y: auto;
  padding: 12px 64px 12px 13px;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--dim);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-all;
}
.snippet.show { display: block; }
.copy-btn {
  position: absolute;
  top: 22px;
  right: 28px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.68rem;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.copy-btn:hover { color: var(--text); border-color: var(--muted); }

/* ---------- api ---------- */
.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.endpoint { padding: 20px; }
.endpoint p { margin: 14px 0 0; font-size: 0.88rem; color: var(--dim); }
.endpoint p code { white-space: normal; }
.endpoint .muted-p { color: var(--muted); font-size: 0.82rem; }
.endpoint-head { display: flex; align-items: center; gap: 10px; }
.endpoint-head .pill { margin-left: auto; }
.method {
  padding: 2px 8px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.path {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.95rem;
  color: var(--text);
}

.param-list { margin: 0; }
.param-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 8px 20px;
  padding: 14px 20px;
  font-size: 0.88rem;
}
.param-row + .param-row { border-top: 1px solid var(--line); }
.param-row dt { display: flex; align-items: center; gap: 10px; }
.param-row dt code.param { font-size: 0.76rem; color: var(--text); padding: 2px 9px; }
.param-row dd { margin: 0; color: var(--dim); }
.param-row dd code { white-space: nowrap; }
.def, .req { font-size: 0.68rem; color: var(--muted); }
.req { color: var(--accent); }
@media (max-width: 640px) {
  .param-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
}
@media (max-width: 860px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }
.about-card { padding: clamp(20px, 3vw, 30px); }
.about-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--dim);
  max-width: 68ch;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 3px 11px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dim);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  min-height: 108px;
}
.stat-num.num {
  align-self: flex-start;
  padding: 0;
  background: none;
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text);
}
.stat:hover .stat-num { color: var(--accent); }
.stat-label { font-size: 0.72rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-block: 28px 44px;
}
.footer-inner .prompt-line { margin: 0; font-size: 0.76rem; }
.footer-meta { margin: 0; font-size: 0.72rem; color: var(--muted); }
.footer-meta a { color: var(--dim); text-decoration: none; }
.footer-meta a:hover { color: var(--accent); }

/* ---------- motion: entrance + scroll reveals ---------- */
@media (prefers-reduced-motion: no-preference) {
  .enter {
    animation: enter 0.8s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 90ms + 50ms);
  }
  @keyframes enter {
    from { opacity: 0; translate: 0 14px; filter: blur(6px); }
    to { opacity: 1; translate: 0 0; filter: none; }
  }

  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0px entry 260px;
    }
    @keyframes reveal {
      from { opacity: 0; translate: 0 28px; filter: blur(6px); }
      to { opacity: 1; translate: 0 0; filter: none; }
    }
  }
}

/* Reduced motion: neutralize everything that moves. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
  .caret { animation: none !important; }
  .card.tilt, .card.tilt:hover { transform: none !important; }
  .shape-btn:hover svg { transform: none; }
}
