/* ==========================================================================
   Avyeni — component layer
   Built entirely on tokens.css. Nothing here hardcodes a colour or a size.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }

::selection { background: var(--brand-200); color: var(--n-900); }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ---- type --------------------------------------------------------------
   Display text uses Fraunces's variable axes: a lower optical size and a
   little "wonk" gives large headings warmth that a static face cannot.    */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); line-height: var(--lh-snug); }
h4 { font-size: var(--t-md); line-height: var(--lh-snug); }

p { margin: 0 0 var(--s-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-color: var(--brand-400); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--brand-600); }

small, .t-xs { font-size: var(--t-xs); }
.t-sm { font-size: var(--t-sm); }
.t-md { font-size: var(--t-md); }
.t-lg { font-size: var(--t-lg); }
.lead {
  font-size: var(--t-md);
  line-height: var(--lh-loose);
  color: var(--ink-soft);
  max-width: var(--measure);
}
.display {
  font-family: var(--font-display);
  font-size: var(--t-4xl);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: var(--tr-tight);
  text-wrap: balance;
}
.serif { font-family: var(--font-display); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-mute); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: var(--tr-caps);
  color: var(--brand-600);
  margin: 0 0 var(--s-3);
  font-weight: 500;
}

/* A gradient wash on a word or two. Used sparingly it reads as emphasis;
   used on a whole heading it reads as a template. */
.grad {
  background: linear-gradient(100deg, var(--brand-500), var(--accent-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- layout ------------------------------------------------------------ */

.wrap { width: min(100% - var(--gutter) * 2, var(--page)); margin-inline: auto; }
.wrap-wide { width: min(100% - var(--gutter) * 2, var(--page-wide)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.section { padding-block: clamp(var(--s-7), 9vw, var(--s-10)); }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: var(--s-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }
.center { text-align: center; }
.center .lead { margin-inline: auto; }

/* ---- buttons ----------------------------------------------------------- */

.btn {
  --btn-bg: var(--brand-500);
  --btn-ink: var(--ink-on-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.72em 1.35em;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--d-fast) var(--ease-out),
              box-shadow var(--d-enter) var(--ease-out),
              background-color var(--d-fast) var(--ease-out);
  box-shadow: var(--shadow-1);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--glow-brand); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-1); }

.btn-lg { font-size: var(--t-base); padding: 0.85em 1.7em; }
.btn-secondary {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}
.btn-secondary:hover { box-shadow: var(--shadow-2); border-color: var(--brand-400); }
.btn-ghost {
  --btn-bg: transparent;
  --btn-ink: var(--ink);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-alt); box-shadow: none; }

/* ---- surfaces ---------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  box-shadow: var(--shadow-1);
  transition: transform var(--d-enter) var(--ease-out),
              box-shadow var(--d-enter) var(--ease-out),
              border-color var(--d-enter) var(--ease-out);
}
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3);
  border-color: var(--brand-300);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.3em 0.85em;
  border-radius: var(--r-full);
  background: var(--brand-100);
  color: var(--brand-800);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.pill-quiet { background: var(--surface-alt); color: var(--ink-soft); border: 1px solid var(--line); }
.pill-live::before {
  content: "";
  width: 0.5em; height: 0.5em; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 oklch(65% 0.16 150 / 0.7);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 0.55em oklch(65% 0.16 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(65% 0.16 150 / 0); }
}

.rule { border: 0; border-top: 1px solid var(--line); margin-block: var(--s-6); }

/* ---- form -------------------------------------------------------------- */

.input {
  width: 100%;
  padding: 0.7em 0.9em;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-sm);
  transition: border-color var(--d-fast) var(--ease-out),
              box-shadow var(--d-fast) var(--ease-out);
}
.input::placeholder { color: var(--ink-mute); }
.input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px oklch(68% 0.195 var(--hue-brand) / 0.18);
}

/* ---- nav --------------------------------------------------------------- */

.nav {
  /* Full-bleed bar, wrapped content. A blurred backdrop that stops at the
     content width reads as a stray rectangle floating over the page. */
  position: sticky; top: 0; z-index: 50;
  padding-block: var(--s-3);
  background: color-mix(in oklab, var(--canvas) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color var(--d-enter) var(--ease-out);
}
.nav[data-stuck] { border-bottom-color: var(--line); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
}
.brand {
  /* Set in the interface face, not the display one: the mark has to hold at
     16px in a nav bar, and DM Serif Display's thin strokes disappear there. */
  font-family: var(--font-sans);
  font-size: var(--t-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  text-decoration: none;
  white-space: nowrap;
  /* letter-spacing appends a trailing gap after the final letter; pulling it
     back is what makes the mark optically flush with the content beneath. */
  margin-right: -0.26em;
}
.brand .dot { display: none; }
.nav-links { display: flex; gap: var(--s-5); align-items: center; }
.nav-links a {
  font-size: var(--t-sm);
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--d-fast) var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }

/* ---- code -------------------------------------------------------------- */

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--sunken);
  padding: 0.15em 0.4em;
  border-radius: var(--r-sm);
}
pre {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  overflow-x: auto;
  font-size: var(--t-sm);
  line-height: 1.65;
}
pre code { background: none; padding: 0; }

/* ---- entrance ----------------------------------------------------------
   Opt-in, and inert until JS adds .in — so with JS off, nothing is hidden. */

.js .reveal { opacity: 0; transform: translateY(14px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity var(--d-slow) var(--ease-out),
              transform var(--d-slow) var(--ease-out);
}
