/* Theme tokens consumed by tailwind.config.js (space-separated RGB for alpha support). */
:root {
  --c-canvas: 248 250 252;   /* slate-50  */
  --c-surface: 255 255 255;
  --c-raised: 241 245 249;   /* slate-100 */
  --c-line: 226 232 240;     /* slate-200 */
  --c-ink: 15 23 42;         /* slate-900 */
  --c-muted: 71 85 105;      /* slate-600 */
  color-scheme: light;
}

.dark {
  --c-canvas: 2 6 23;        /* slate-950 */
  --c-surface: 15 23 42;     /* slate-900 */
  --c-raised: 30 41 59;      /* slate-800 */
  --c-line: 30 41 59;        /* slate-800 */
  --c-ink: 241 245 249;      /* slate-100 */
  --c-muted: 148 163 184;    /* slate-400 */
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Faint engineering grid behind the hero, faded out at the edges. */
.bg-grid {
  background-image:
    linear-gradient(to right, rgb(var(--c-line) / 0.7) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(var(--c-line) / 0.7) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
}

.text-gradient {
  background: linear-gradient(100deg, #818cf8 0%, #34d399 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
:root:not(.dark) .text-gradient {
  background: linear-gradient(100deg, #4f46e5 0%, #059669 90%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Diff panel lines */
.diff-line { display: block; padding: 0 1rem 0 2.25rem; position: relative; white-space: pre; }
.diff-line::before { position: absolute; left: 0.9rem; opacity: 0.7; }
.diff-del { background: rgb(244 63 94 / 0.10); color: rgb(253 164 175); }
.diff-del::before { content: "-"; }
.diff-add { background: rgb(16 185 129 / 0.12); color: rgb(110 231 183); }
.diff-add::before { content: "+"; }
.diff-ctx { color: rgb(148 163 184); }

/* Header gets a border and stronger backdrop once the page scrolls. */
[data-header].is-scrolled { border-color: rgb(var(--c-line)); box-shadow: 0 8px 30px -12px rgb(0 0 0 / 0.25); }

.nav-link { position: relative; }
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #6366f1, #10b981);
  transform: scaleX(0);
  transition: transform .25s ease;
}
.nav-link[aria-current="true"] { color: rgb(var(--c-ink)); }
.nav-link[aria-current="true"]::after { transform: scaleX(1); }

/* Form controls */
.field {
  width: 100%;
  border-radius: 0.625rem;
  border: 1px solid rgb(var(--c-line));
  background: rgb(var(--c-canvas));
  color: rgb(var(--c-ink));
  padding: 0.7rem 0.9rem;
  font-size: 0.9375rem;
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: rgb(var(--c-muted) / 0.7); }
.field:focus { outline: none; border-color: rgb(99 102 241); box-shadow: 0 0 0 3px rgb(99 102 241 / 0.25); }
.field[aria-invalid="true"] { border-color: rgb(244 63 94); }
.field[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgb(244 63 94 / 0.25); }
select.field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1.1rem;
  padding-right: 2.25rem;
}

/* Fade-in on scroll (enabled only when JS adds .js to <html>). */
.js [data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* Show code exactly as typed (no "->" / "|>" ligatures). */
pre, code, .font-mono { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
