/* ==========================================================================
   ICOSIOR — base layer
   Tokens (from the live icosior.com palette), reset, background, type,
   buttons, glass cards and the single reveal/motion system.
   ========================================================================== */

:root {
  /* Brand palette — source of truth: live icosior.com */
  --bg: #030305;
  --bg-raised: #070910;
  --surface: rgba(12, 15, 23, 0.78);
  --surface-strong: rgba(14, 18, 28, 0.92);
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.4);
  --cyan-soft: rgba(0, 240, 255, 0.08);
  --violet: #8b5cf6;
  --violet-glow: rgba(139, 92, 246, 0.4);
  --violet-soft: rgba(139, 92, 246, 0.1);
  --lime: #c8ff35;
  --lime-soft: rgba(200, 255, 53, 0.08);
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-hover: rgba(0, 240, 255, 0.45);

  /* Type */
  --font-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --container: 1280px;
  --pad: clamp(18px, 4vw, 56px);
  --section-y: clamp(88px, 12vw, 160px);
  --radius: 22px;
  --radius-sm: 14px;

  /* Motion — ONE easing and ONE duration scale for the whole site */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 0.3s;
  --dur-2: 0.6s;
  --dur-3: 0.9s;
  --stagger: 60ms;

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  /* NOTE: no `scroll-behavior: smooth` — Lenis is the single smoothing stage */
}
body {
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
  line-height: 1.6;
}
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; }
::selection { background: var(--cyan); color: #000; }

/* Scrollbar (matches live site) */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }
html { scrollbar-color: rgba(0, 240, 255, 0.3) var(--bg); scrollbar-width: thin; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: fixed; left: 16px; top: 12px; z-index: 100000;
  padding: 10px 16px; border-radius: 10px;
  background: var(--cyan); color: #000; font-weight: 700; text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur-1) var(--ease);
}
.skip-link:focus { transform: none; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Custom cursor (ported from live icosior.com) ---------- */
/* Only display custom cursor elements when fine pointer is active */
html:not(.has-cursor) .cursor-dot,
html:not(.has-cursor) .cursor-ring,
html:not(.has-cursor) #cursorDot,
html:not(.has-cursor) #cursorRing {
  display: none !important;
}

@media (hover: none), (pointer: coarse) {
  .cursor-dot,
  .cursor-ring,
  #cursorDot,
  #cursorRing {
    display: none !important;
  }
}

html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 999999;
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--cyan);
}
.cursor-dot__core {
  position: absolute; inset: 0; border-radius: inherit; background: inherit;
  transition: transform var(--dur-1) var(--ease), background-color 0.2s;
}
.cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
}
.cursor-ring__shape {
  position: absolute; inset: 0;
  border: 1.5px solid rgba(0, 240, 255, 0.45);
  border-radius: 50%;
  display: grid; place-items: center;
  transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, border-radius 0.25s ease, opacity 0.25s ease;
}
.cursor-crosshair {
  width: 100%; height: 100%; position: absolute;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.3;
  transition: opacity 0.25s ease;
}
.cursor-crosshair::before { content: ""; position: absolute; width: 6px; height: 1px; background: var(--cyan); }
.cursor-crosshair::after { content: ""; position: absolute; width: 1px; height: 6px; background: var(--cyan); }

/* Hover on links / buttons — identical look to live site (60px rounded square) */
.cursor-hover .cursor-ring__shape {
  transform: scale(1.58);
  border-color: var(--cyan);
  background-color: rgba(0, 240, 255, 0.08);
  border-radius: 9px; /* 14px at 60px ÷ 1.58 scale */
}
.cursor-hover .cursor-dot__core { transform: scale(1.33); background: #fff; }
.cursor-hover .cursor-crosshair { opacity: 0; }
/* Hover on cards — larger, softer halo */
.cursor-card .cursor-ring__shape {
  transform: scale(2.1);
  border-color: rgba(0, 240, 255, 0.25);
  background-color: rgba(0, 240, 255, 0.035);
}
.cursor-card .cursor-crosshair { opacity: 0; }
/* Text fields — slim caret */
.cursor-text .cursor-ring__shape { transform: scale(0.45, 0.9); border-radius: 4px; border-color: rgba(0, 240, 255, 0.7); }
.cursor-text .cursor-dot__core { transform: scale(0); }
/* Press */
.cursor-press .cursor-ring__shape { transform: scale(0.82); }
.cursor-hover.cursor-press .cursor-ring__shape { transform: scale(1.35); }
/* Pointer left the window */
.cursor-hidden .cursor-dot, .cursor-hidden .cursor-ring { opacity: 0; }

/* ---------- Atmosphere: grid + glows (static / composited only) ---------- */
.atmos {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.atmos__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 85%);
          mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 85%);
}
.atmos__glow {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  opacity: 0.55;
  will-change: transform;
}
.atmos__glow--a {
  top: -20vmax; right: -18vmax;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.10) 0%, transparent 62%);
  animation: drift-a 26s var(--ease) infinite alternate;
}
.atmos__glow--b {
  bottom: -24vmax; left: -20vmax;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 62%);
  animation: drift-b 32s var(--ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(-8vmax, 10vmax, 0); } }
@keyframes drift-b { to { transform: translate3d(10vmax, -8vmax, 0); } }

/* ---------- Layout ---------- */
main { position: relative; z-index: 1; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--pad); }
.section { position: relative; padding: var(--section-y) 0; }
.section + .section { padding-top: calc(var(--section-y) * 0.6); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--cyan);
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: currentColor; opacity: 0.7;
}
.h-display {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700; line-height: 1.04; letter-spacing: -0.04em;
  text-wrap: balance;
}
.h-display em, .grad {
  font-style: normal;
  background: linear-gradient(120deg, #fff 0%, var(--cyan) 45%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.lead {
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  color: var(--muted); max-width: 42rem; line-height: 1.7;
}
.sec-head { display: grid; gap: 18px; margin-bottom: clamp(36px, 5vw, 64px); max-width: 52rem; }
.sec-head--center { margin-inline: auto; text-align: center; justify-items: center; }
.mono { font-family: var(--font-mono); }

/* ---------- Buttons (live-site styles, magnetic-ready) ---------- */
.btn {
  --b-bg: transparent;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 28px; border-radius: 100px;
  font-family: var(--font-sans); font-size: 0.92rem; font-weight: 700;
  text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  will-change: transform;
}
.btn svg { width: 18px; height: 18px; flex: none; transition: transform var(--dur-1) var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--solid { background: var(--cyan); color: #020204; box-shadow: 0 0 25px var(--cyan-glow); }
.btn--solid:hover { background: #fff; box-shadow: 0 0 35px rgba(255, 255, 255, 0.45); }
.btn--ghost {
  border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.03); color: #fff;
}
.btn--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }
.btn--sm { min-height: 40px; padding: 0 20px; font-size: 0.82rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Glass cards (live-site glass panel, lighter for perf) ---------- */
.card {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12), 0 20px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-2) var(--ease);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 30px rgba(0, 240, 255, 0.14);
}
/* Spotlight: a composited child moved with transform (no background repaint) */
.card__spot {
  position: absolute; z-index: -1; top: 0; left: 0;
  width: 420px; height: 420px; margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.13) 0%, rgba(139, 92, 246, 0.06) 40%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-1) var(--ease);
  will-change: transform, opacity;
}
.card.is-lit .card__spot { opacity: 1; }
.card[data-tilt] { transform-style: preserve-3d; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1;
  padding: 7px 10px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-2);
}
.icon-badge {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: var(--cyan-soft); border: 1px solid rgba(0, 240, 255, 0.25); color: var(--cyan);
}
.icon-badge svg { width: 22px; height: 22px; }
.icon-badge--violet { background: var(--violet-soft); border-color: rgba(139, 92, 246, 0.3); color: var(--violet); }
.icon-badge--lime { background: var(--lime-soft); border-color: rgba(200, 255, 53, 0.3); color: var(--lime); }

/* Placeholder flag for unverified content — easy to find & replace */
.edit-flag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.78em; font-weight: 500;
  color: var(--lime);
  border: 1px dashed rgba(200, 255, 53, 0.55); border-radius: 6px;
  padding: 0 6px;
}

/* ---------- Reveal system (IntersectionObserver adds .is-in) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity var(--dur-2) var(--ease) calc(var(--i, 0) * var(--stagger)),
    transform var(--dur-3) var(--ease) calc(var(--i, 0) * var(--stagger));
}
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="scale"] { transform: scale(0.96); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Reduced motion: honour everywhere ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .atmos__glow { animation: none; }
}
