/* ============================================================================
   ARDEVELL · reset, typography, shell, shared atoms
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink-1);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.62;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  color: var(--ink-0);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 { font-size: var(--t-hero); line-height: 0.98; letter-spacing: -0.035em; }
h2 { font-size: var(--t-h2); line-height: 1.06; letter-spacing: -0.03em; }
h3 { font-size: var(--t-h3); line-height: 1.2; letter-spacing: -0.015em; }
p  { margin: 0; }

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

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

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--accent-a55); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- shell ---------------------------------------------------------------- */

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 16px;
  color: var(--ink-0);
}
.skip:focus { left: var(--gut); top: 12px; }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- eyebrow / kicker ----------------------------------------------------- */

.eyebrow {
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  flex: none;
}
.eyebrow--plain::before { display: none; }

.lead {
  font-size: var(--t-lead);
  line-height: 1.58;
  color: var(--ink-2);
  max-width: 62ch;
}

.hairline {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, var(--line-strong) 18%, var(--line-strong) 82%, transparent);
}

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

.btn {
  --btn-bg: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-0);
  background: var(--btn-bg);
  border: 1px solid var(--line-strong);
  transition: transform var(--d-fast) var(--e-out),
              border-color var(--d-fast) var(--e-out),
              background-color var(--d-fast) var(--e-out),
              box-shadow var(--d-fast) var(--e-out);
  will-change: transform;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent-a55); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: linear-gradient(180deg, #5b98ff, var(--accent-deep));
  border-color: rgba(160, 200, 255, 0.5);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 8px 26px -12px var(--accent-a55);
}
.btn--primary:hover {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 14px 34px -12px var(--accent-a55);
}
.btn--ghost { background: rgba(160, 190, 240, 0.04); }
.btn--ghost:hover { background: rgba(160, 190, 240, 0.09); }

.btn__arrow { transition: transform var(--d-mid) var(--e-out); }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* --- status chips --------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.chip--live    { color: var(--live);    border-color: rgba(85, 214, 160, 0.3); }
.chip--proto   { color: var(--proto);   border-color: rgba(143, 180, 255, 0.3); }
.chip--concept { color: var(--concept); border-color: rgba(154, 166, 187, 0.26); }
.chip--concept::before, .chip--ambition::before { opacity: 0.55; }
.chip--ambition { color: var(--ink-3);   border-color: var(--line); }
.chip--ambition::before { background: none; border: 1px dashed currentColor; }

/* --- reveal system (JS adds .is-in; no-JS keeps everything visible) -------- */

.js .reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 760ms var(--e-out) var(--rv-delay, 0ms),
              transform 760ms var(--e-out) var(--rv-delay, 0ms),
              filter 760ms var(--e-out) var(--rv-delay, 0ms);
  filter: blur(6px);
}
.js .reveal.is-in { opacity: 1; transform: none; filter: none; }

.js .reveal--mask { clip-path: inset(0 0 105% 0); opacity: 1; transform: none; filter: none;
  transition: clip-path 900ms var(--e-out) var(--rv-delay, 0ms); }
.js .reveal--mask.is-in { clip-path: inset(-12% 0 -12% 0); }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal--mask {
    opacity: 1 !important; transform: none !important; filter: none !important;
    clip-path: none !important; transition: none !important;
  }
  /* the blanket stop: every decorative keyframe (orbit flow, drifting labels,
     halo spin) is switched off, and the canvases render one static frame */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- atmosphere: one fixed lighting layer the whole page shares ------------ */

.atmos {
  position: fixed;
  inset: -10% -10% -10% -10%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at var(--atm-x) var(--atm-y),
      hsla(var(--atm-hue), 88%, 58%, calc(0.20 * var(--atm-alpha))) 0%,
      hsla(var(--atm-hue), 90%, 46%, calc(0.07 * var(--atm-alpha))) 34%,
      transparent 70%),
    radial-gradient(44% 38% at 18% 92%, hsla(212, 80%, 52%, 0.10) 0%, transparent 66%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 55%, var(--bg-0) 100%);
  transition: background 240ms linear;
}

/* film grain keeps large gradients from banding on cheap panels */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.34'/%3E%3C/svg%3E");
}

/* --- generic panel -------------------------------------------------------- */

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

/* --- pointer light: a soft highlight that follows the cursor -------------- */

[data-spot] { position: relative; }
[data-spot]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--d-mid) var(--e-out);
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
              rgba(124, 184, 255, 0.10), transparent 70%);
}
[data-spot]:hover::before { opacity: 1; }
@media (prefers-reduced-motion: reduce), (hover: none) {
  [data-spot]::before { display: none; }
}

/* --- no-canvas fallback: a composed CSS globe, so the hero never reads as
       broken on a device without canvas -------------------------------------- */

.no-canvas .hero__globe { display: none; }
.no-canvas .hero__stage::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px solid rgba(140, 185, 255, 0.28);
  background:
    radial-gradient(circle at 34% 30%, rgba(124, 184, 255, 0.34), rgba(12, 24, 52, 0.9) 58%, rgba(3, 6, 13, 0.95) 78%),
    repeating-radial-gradient(circle at 50% 50%, rgba(130, 175, 240, 0.16) 0 1px, transparent 1px 8px),
    radial-gradient(closest-side, rgba(76, 141, 255, 0.28), transparent 74%);
}
.no-canvas .core__viz { display: grid; place-items: center; }
.no-canvas .core__viz::after {
  content: "Maxwell research pipeline";
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* --- anchor offsets so the fixed header never covers a section ------------ */

section[id] { scroll-margin-top: 84px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
