/* ==========================================================================
   base.css — design tokens, reset, typography, layout primitives, utilities
   Everything visual starts here. Components must only use the semantic
   custom properties (--c-*, --fs-*, --sp-*, --r-*) declared in this file,
   never raw hex values, so light/dark stay in sync automatically.
   ========================================================================== */

/* --------------------------------------------------------------- 1. Tokens */

:root {
  color-scheme: light dark;

  /* Brand palette — derived from the logo disc (#094550) */
  --p-brand-950: #041c22;
  --p-brand-900: #062b34;
  --p-brand-800: #073844;
  --p-brand-700: #094550;
  --p-brand-600: #0c5a69;
  --p-brand-500: #107a8c;
  --p-brand-400: #2e9caa;
  --p-brand-300: #7fd0d3;
  --p-brand-200: #b6e5e3;
  --p-brand-100: #dcf2f0;

  --p-flux-600: #039e88;
  --p-flux-500: #06b6a0;
  --p-flux-400: #22d3b8;
  --p-flux-300: #56e6cd;

  --p-solder-600: #e2691a;
  --p-solder-500: #ff8a3d;
  --p-solder-400: #ffab6e;

  /* Typography — system stacks only: zero network cost, native rendering */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-2xs: 0.6875rem;
  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: clamp(1.02rem, 0.98rem + 0.2vw, 1.12rem);
  --fs-lg: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --fs-xl: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  --fs-2xl: clamp(1.85rem, 1.4rem + 2.2vw, 2.9rem);
  --fs-3xl: clamp(2.3rem, 1.6rem + 3.4vw, 4rem);
  --fs-hero: clamp(2.7rem, 1.4rem + 8.4vw, 6.4rem);

  --lh-tight: 1.04;
  --lh-snug: 1.2;
  --lh-normal: 1.55;
  --lh-relaxed: 1.68;

  --tracking-label: 0.16em;
  --tracking-tight: -0.02em;
  --tracking-tighter: -0.035em;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --section-y: clamp(4rem, 2.8rem + 5vw, 7rem);
  --container: 78rem;
  --container-narrow: 46rem;
  --gutter: clamp(1.15rem, 0.6rem + 2.4vw, 2.5rem);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --r-full: 999px;

  /* Motion */
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 520ms;
  --ease: cubic-bezier(0.22, 0.68, 0.28, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --header-h: 4.5rem;
  --z-bg: 0;
  --z-content: 1;
  --z-fab: 40;
  --z-header: 60;
  --z-overlay: 80;
  --z-toast: 90;
}

/* Light theme (default) */
:root,
[data-theme="light"] {
  --c-bg: #eff4f5;
  --c-bg-deep: #e4ecec;
  --c-surface: #ffffff;
  --c-surface-2: #f6fafa;
  --c-surface-inset: #eaf1f2;
  --c-ink-panel: var(--p-brand-900);

  --c-text: #06232c;
  --c-text-muted: #46646c;
  --c-text-faint: #718d94;
  --c-text-on-brand: #f2fbfa;

  --c-border: rgb(9 69 80 / 12%);
  --c-border-strong: rgb(9 69 80 / 22%);

  --c-brand: var(--p-brand-700);
  --c-brand-hover: var(--p-brand-600);
  --c-brand-soft: rgb(9 69 80 / 6%);
  --c-brand-fg: var(--p-brand-700);

  --c-accent: var(--p-flux-600);
  --c-accent-bright: var(--p-flux-500);
  --c-accent-soft: rgb(6 182 160 / 12%);
  --c-accent-fg: #046a5c;
  --c-warm: var(--p-solder-600);

  --c-shadow-sm: 0 1px 2px rgb(6 35 44 / 6%), 0 2px 8px rgb(6 35 44 / 5%);
  --c-shadow-md: 0 2px 6px rgb(6 35 44 / 6%), 0 14px 34px -12px rgb(6 35 44 / 18%);
  --c-shadow-lg: 0 30px 70px -28px rgb(6 35 44 / 30%);
  --c-glow: 0 0 0 1px rgb(6 182 160 / 30%), 0 12px 40px -14px rgb(6 182 160 / 40%);

  --grid-line: rgb(9 69 80 / 6%);
  --spot-alpha: 0.1;
  --scrim: rgb(239 244 245 / 82%);
}

/* Dark theme */
[data-theme="dark"] {
  --c-bg: #041a20;
  --c-bg-deep: #020f13;
  --c-surface: #08262f;
  --c-surface-2: #0b3039;
  --c-surface-inset: #052029;
  --c-ink-panel: #041a20;

  --c-text: #e2f1f0;
  --c-text-muted: #a3c2c6;
  --c-text-faint: #7ca1a7;
  --c-text-on-brand: #f2fbfa;

  --c-border: rgb(142 219 214 / 14%);
  --c-border-strong: rgb(142 219 214 / 26%);

  --c-brand: var(--p-brand-500);
  --c-brand-hover: var(--p-brand-400);
  --c-brand-soft: rgb(16 122 140 / 16%);
  --c-brand-fg: var(--p-brand-300);

  --c-accent: var(--p-flux-400);
  --c-accent-bright: var(--p-flux-300);
  --c-accent-soft: rgb(34 211 184 / 14%);
  --c-accent-fg: var(--p-flux-300);
  --c-warm: var(--p-solder-500);

  --c-shadow-sm: 0 1px 2px rgb(0 0 0 / 30%), 0 2px 10px rgb(0 0 0 / 24%);
  --c-shadow-md: 0 2px 6px rgb(0 0 0 / 30%), 0 18px 40px -14px rgb(0 0 0 / 60%);
  --c-shadow-lg: 0 34px 80px -30px rgb(0 0 0 / 78%);
  --c-glow: 0 0 0 1px rgb(34 211 184 / 34%), 0 14px 46px -14px rgb(34 211 184 / 32%);

  --grid-line: rgb(142 219 214 / 6%);
  --spot-alpha: 0.16;
  --scrim: rgb(4 26 32 / 78%);
}

/* ---------------------------------------------------------------- 2. Reset */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

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

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 650;
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

address {
  font-style: normal;
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--c-accent);
  color: #032b26;
}

/* Native form controls should follow the active theme, not the OS */
[data-theme="dark"] {
  color-scheme: dark;
}

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

/* ---------------------------------------------------- 3. Layout primitives */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem);
}

.section__head {
  display: grid;
  gap: var(--sp-4);
  max-width: 46rem;
  margin-bottom: clamp(2.25rem, 1.5rem + 2.4vw, 3.75rem);
}

.section__head--center {
  margin-inline: auto;
  text-align: center;
  justify-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--c-accent-fg);
}

.eyebrow::before {
  content: "";
  width: 1.6rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--c-accent));
}

.section__title {
  font-size: var(--fs-2xl);
  letter-spacing: var(--tracking-tighter);
}

.section__lead {
  font-size: var(--fs-md);
  color: var(--c-text-muted);
  max-width: 42rem;
}

.grid {
  display: grid;
  gap: var(--sp-5);
}

/* ------------------------------------------------------------ 4. Utilities */

.u-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.u-accent {
  color: var(--c-accent-fg);
}

.u-muted {
  color: var(--c-text-muted);
}

.u-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  pointer-events: none;
}

.skip-link {
  position: fixed;
  top: 0;
  left: 50%;
  translate: -50% -120%;
  z-index: var(--z-toast);
  padding: 0.7rem 1.2rem;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: var(--c-accent);
  color: #032b26;
  font-weight: 600;
  transition: translate var(--dur) var(--ease);
}

.skip-link:focus-visible {
  translate: -50% 0;
  outline-offset: -4px;
}

/* ------------------------------------------------- 5. Ambient background */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  overflow: hidden;
}

.backdrop__grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
}

.backdrop__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
}

.backdrop__glow--a {
  top: -18vh;
  right: -10vw;
  width: 52vw;
  height: 52vw;
  background: radial-gradient(circle, var(--c-accent) 0%, transparent 68%);
  opacity: 0.16;
}

.backdrop__glow--b {
  top: 32vh;
  left: -18vw;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle, var(--c-brand) 0%, transparent 70%);
  opacity: 0.14;
}

/* ------------------------------------------- 6. Reveal-on-scroll behaviour */

[data-reveal] {
  opacity: 0;
  translate: 0 18px;
  transition:
    opacity var(--dur-slow) var(--ease-out),
    translate var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--reveal-i, 0) * 60ms);
}

[data-reveal].is-revealed {
  opacity: 1;
  translate: 0 0;
}

/* Content is rendered from JSON: fade the page in once the first paint of
   real text is ready, so visitors never see empty scaffolding. */
html.is-booting body {
  opacity: 0;
}

body {
  opacity: 1;
  transition: opacity 260ms var(--ease);
}

/* --------------------------------------------------- 7. Reduced motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal] {
    opacity: 1;
    translate: none;
  }
}

@media print {
  .backdrop,
  .site-header,
  .fab-stack,
  .to-top {
    display: none !important;
  }
}
