/* ============================================================================
   Alicorn design system
   Three ramps, role-named semantics, dark-first.
   Primitives are named by hue and are NEVER used in a component.
   Components reference the semantic tier only.
   Every contrast pair below was computed from these declared values, not estimated.
   ========================================================================== */

:root {
  /* ── Primitives ──────────────────────────────────────────────────────────
     Neutral: 12 steps, hue 264, chroma peaks mid-ramp and falls at both ends.
     Steps sit denser at the DARK end, because in a dark theme that is where the
     surfaces live and where two adjacent steps must read as two surfaces.
     Both ends stop short of pure black and white. */
  --neutral-1: oklch(0.145 0.004 264);
  --neutral-2: oklch(0.178 0.005 264);
  --neutral-3: oklch(0.213 0.006 264);
  --neutral-4: oklch(0.243 0.007 264);
  --neutral-5: oklch(0.271 0.008 264);
  --neutral-6: oklch(0.305 0.009 264);
  --neutral-7: oklch(0.349 0.01 264);
  --neutral-8: oklch(0.424 0.011 264);
  --neutral-9: oklch(0.551 0.01 264);
  --neutral-10: oklch(0.611 0.009 264);
  --neutral-11: oklch(0.742 0.007 264);
  --neutral-12: oklch(0.955 0.003 264);

  /* Amber: the ONE status ramp this product renders. Means: a human is required.
     Only the steps a role consumes are generated. */
  --amber-3: oklch(0.272 0.052 73);
  --amber-6: oklch(0.392 0.084 73);
  --amber-9: oklch(0.774 0.162 73);
  --amber-11: oklch(0.842 0.13 73);

  /* Red: destructive and failed only. */
  --red-3: oklch(0.262 0.062 22);
  --red-6: oklch(0.386 0.112 22);
  --red-9: oklch(0.64 0.212 22);
  --red-11: oklch(0.752 0.148 22);

  /* ── Semantics. The only tier a component may reference. ──────────────────
     There is no separate accent hue: this product spends colour exclusively on
     status, so the accent role is filled by the top of the neutral ramp. A white
     solid fill reads as primary from across the room and never competes with the
     one hue that means "you are needed". */
  --color-bg-page: var(--neutral-1);
  --color-bg-subtle: var(--neutral-2);
  --color-bg-surface: var(--neutral-3);
  --color-bg-hover: var(--neutral-4);
  --color-bg-active: var(--neutral-5);

  --color-border-subtle: var(--neutral-6);
  --color-border: var(--neutral-7);
  --color-border-strong: var(--neutral-8);

  --color-text-primary: var(--neutral-12); /* 17.37:1 on page */
  --color-text-secondary: var(--neutral-11); /*  8.62:1 on page */
  --color-text-tertiary: var(--neutral-10); /*  5.23:1 on page */

  --color-solid: var(--neutral-12);
  --color-solid-hover: var(--neutral-11);
  --color-on-solid: var(--neutral-1); /* 17.37:1 on solid */
  --color-focus-ring: var(--neutral-11); /*  8.62:1 on page  */

  --color-attention-bg: var(--amber-3);
  --color-attention-border: var(--amber-6);
  --color-attention-solid: var(--amber-9);
  --color-attention-text: var(--amber-11); /* 11.99:1 on page */

  --color-danger-bg: var(--red-3);
  --color-danger-border: var(--red-6);
  --color-danger-solid: var(--red-9);
  --color-danger-text: var(--red-11); /*  8.39:1 on page */

  /* ── Type ────────────────────────────────────────────────────────────────
     One family. Sizes named by use so the rules survive other people.
     Line-height by role: headings tight, body 1.5-1.6. */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --text-label: 0.6875rem; /* 11px, uppercase meta */
  --text-caption: 0.75rem; /* 12px */
  --text-body-sm: 0.875rem; /* 14px */
  --text-body: 1rem; /* 16px */
  --text-body-lg: 1.125rem; /* 18px, lede */
  --text-title-sm: 1.25rem; /* 20px */
  --text-title: 1.75rem; /* 28px */
  --text-display: clamp(2.25rem, 5.2vw, 4rem);

  --leading-tight: 1.08;
  --leading-snug: 1.3;
  --leading-body: 1.6;

  --tracking-display: -0.035em;
  --tracking-title: -0.02em;
  --tracking-body: 0.005em;
  --tracking-label: 0.06em;

  /* ── Space, radius, motion ──────────────────────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 620ms;

  --measure: 68ch;
  color-scheme: dark;
}

/* ============================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--color-bg-page);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
}

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

h1,
h2,
h3,
h4 {
  color: var(--color-text-primary);
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}
h1 {
  font-size: var(--text-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}
h2 {
  font-size: var(--text-title);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-title);
}
h3 {
  font-size: var(--text-title-sm);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-title);
}
h4 {
  font-size: var(--text-body);
  line-height: var(--leading-snug);
}
p {
  margin: 0;
  max-width: var(--measure);
  text-wrap: pretty;
}
strong {
  color: var(--color-text-primary);
  font-weight: 600;
}
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--color-text-primary);
}

.label {
  font-size: var(--text-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
}
.lede {
  font-size: var(--text-body-lg);
  color: var(--color-text-secondary);
  max-width: 58ch;
}
.num {
  font-variant-numeric: tabular-nums;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.section {
  padding-block: var(--space-24);
  border-top: 1px solid var(--color-border-subtle);
}
.section:first-of-type {
  border-top: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stack-6 {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.stack-8 {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}
.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--color-bg-page) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-subtle);
}
.nav__in {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--color-text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand svg,
.brand img {
  width: 20px;
  height: 20px;
}
.nav__links {
  display: flex;
  gap: var(--space-1);
  margin-inline-start: var(--space-4);
}
.nav__links a {
  font-size: var(--text-body-sm);
  color: var(--color-text-tertiary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease);
}
.nav__links a:hover {
  color: var(--color-text-primary);
}
.nav__links a[aria-current='page'] {
  color: var(--color-text-primary);
}
.nav__end {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
@media (max-width: 820px) {
  .nav__links {
    display: none;
  }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding-inline: 16px;
  border-radius: var(--radius);
  font-size: var(--text-body-sm);
  font-weight: 550;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn--primary {
  background: var(--color-solid);
  color: var(--color-on-solid);
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--color-solid-hover);
}
.btn--ghost {
  color: var(--color-text-secondary);
}
.btn--ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}
.btn--outline {
  border-color: var(--color-border);
  color: var(--color-text-primary);
  background: var(--color-bg-surface);
}
.btn--outline:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}
.btn--sm {
  height: 32px;
  padding-inline: 12px;
  font-size: var(--text-caption);
}

/* ── Surfaces ───────────────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card--flush {
  padding: 0;
  overflow: hidden;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding-inline: 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-surface);
  color: var(--color-text-tertiary);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
}
.pill--attn {
  background: var(--color-attention-bg);
  border-color: var(--color-attention-border);
  color: var(--color-attention-text);
}
.pill--solid {
  background: var(--color-solid);
  border-color: var(--color-solid);
  color: var(--color-on-solid);
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-sm);
  min-width: 560px;
}
thead th {
  text-align: start;
  padding: 11px 16px;
  background: var(--color-bg-subtle);
  font-size: var(--text-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border-subtle);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td strong {
  color: var(--color-text-primary);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--color-border-subtle);
  padding-block: var(--space-12);
  margin-top: var(--space-16);
}
.foot__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-8);
}
.foot h4 {
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}
.foot ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.foot a {
  font-size: var(--text-body-sm);
  color: var(--color-text-tertiary);
}
.foot a:hover {
  color: var(--color-text-primary);
}
.foot__base {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-caption);
  color: var(--color-text-tertiary);
}
@media (max-width: 760px) {
  .foot__grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Motion ─────────────────────────────────────────────────────────────
   Every animated element is legible at rest. .reveal only adds a lift. */
.reveal {
  opacity: 0;
  transform: translateY(14px);
}
.reveal.in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
}
.reveal.in[data-d='1'] {
  transition-delay: 70ms;
}
.reveal.in[data-d='2'] {
  transition-delay: 140ms;
}
.reveal.in[data-d='3'] {
  transition-delay: 210ms;
}
.reveal.in[data-d='4'] {
  transition-delay: 280ms;
}

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