/* ==========================================================================
   Kildaris design system — "instrument panel"
   Dark-committed by deliberate art direction, not omission. The whole visual
   argument is that this firm reads instruments for a living; a light theme
   would undercut it.
   Accent pair validated for CVD separation (ΔE 27+ protan/deutan).
   ========================================================================== */

:root {
  /* --- ground: cooler, deeper than before so the neon reads hotter --- */
  --void:        #04060b;
  --bg:          #070a12;
  --surface:     #0c1120;
  --surface-2:   #121828;
  --surface-3:   #1a2235;
  --line:        #1f2942;
  --line-soft:   #161d31;
  --line-bright: #2d3a5c;

  /* --- ink --- */
  --ink:    #e8edf8;
  --ink-2:  #a2b0cc;
  --ink-3:  #6a7996;
  --ink-4:  #46536e;

  /* --- accent: electric cyan. Brand use — validated for contrast + CVD
         separation against violet at ΔE 21.5 (deutan). --- */
  --ember:     #22d3ee;   /* names kept: too many call sites to churn */
  --ember-hi:  #67e8f9;
  --ember-lo:  #0e7490;
  --ember-glow: rgba(34, 211, 238, 0.22);

  /* --- secondary: violet --- */
  --signal:    #a855f7;
  --signal-hi: #c084fc;

  /* --- data marks: darker validated steps of the same two hues.
         The neon versions fail the chart lightness band. --- */
  --data-cyan:   #0ea5c4;
  --data-violet: #8b46e8;

  --good:      #34d399;
  --warn:      #fbbf24;
  --bad:       #fb7185;

  /* --- type --- */
  --sans: "Segoe UI Variable Display", "SF Pro Display", -apple-system,
          BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono",
          "JetBrains Mono", Menlo, Consolas, monospace;

  /* --- scale --- */
  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.15vw, 1.03rem);
  --step-1:  clamp(1.15rem, 1.08rem + 0.35vw, 1.4rem);
  --step-2:  clamp(1.45rem, 1.3rem + 0.75vw, 2rem);
  /* Minimums are sized so the longest single word in the copy
     ("Infrastructure", 14 chars) still fits a 360px viewport inside the
     gutters. Set them higher and the page overflows horizontally — which
     then cascades into every grid below it. */
  --step-3:  clamp(1.6rem, 1.2rem + 1.9vw, 3rem);
  --step-4:  clamp(2rem, 1.5rem + 2.6vw, 4.6rem);
  --step-5:  clamp(2.35rem, 1.5rem + 4.4vw, 6.8rem);

  /* --- rhythm --- */
  --gut: clamp(1.25rem, 4vw, 2.5rem);
  --sec: clamp(4rem, 10vw, 8.5rem);
  --max: 1180px;
  --r:   4px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--ember-hi);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--ember); color: #fff; }

/* --- shared primitives ------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gut);
}

.eyebrow {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember-hi);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.eyebrow::before {
  content: "";
  width: 1.6em;
  height: 1px;
  background: linear-gradient(90deg, var(--ember), var(--signal));
  flex-shrink: 0;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.08;
  text-wrap: balance;
  /* Last-resort guard: a long unbreakable word must never widen the page. */
  overflow-wrap: break-word;
  max-width: 100%;
}
h1 { font-size: var(--step-5); letter-spacing: -0.035em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -0.012em; }

p { margin: 0; max-width: 62ch; }
.lede { font-size: var(--step-1); color: var(--ink-2); line-height: 1.55; }

/* --- buttons ----------------------------------------------------------- */

.btn {
  --btn-bg: var(--ember);
  --btn-fg: #04121a;   /* dark ink on neon — far more legible than white */
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.5em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bg);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.24s var(--ease),
              background 0.18s var(--ease);
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%,
              rgba(255,255,255,0.22) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform 0.62s var(--ease-out);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -8px var(--ember-glow),
              0 0 0 1px var(--ember-hi);
  background: var(--ember-hi);
}
.btn:hover::after { transform: translateX(120%); }
.btn:active { transform: translateY(0); }

.btn.ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line-bright);
}
.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
  box-shadow: none;
}

.btn .arw { transition: transform 0.22s var(--ease); }
.btn:hover .arw { transform: translateX(3px); }

/* --- rules & labels ---------------------------------------------------- */

.rule {
  height: 1px;
  background: linear-gradient(90deg, var(--line-bright), transparent);
  border: 0;
  margin: 0;
}

.mono-label {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* --- reveal animation -------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
[data-reveal].in { opacity: 1; transform: none; }

/* Hard bypass for reduced-motion and for ?nomotion QA screenshots. Adding the
   .in class alone is not enough — the transition still plays out over ~1s,
   which is exactly what a screenshot catches mid-flight. */
.no-anim [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 50%; top: 0.5rem;
  transform: translate(-50%, -220%);
  background: var(--ember); color: #fff;
  padding: 0.6em 1.2em; border-radius: var(--r);
  font-family: var(--mono); font-size: var(--step--1);
  z-index: 999; transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }
