/* ==========================================================================
   Base: fonts, tokens, reset, typography, shared components
   ========================================================================== */

@font-face { font-family: 'Space Grotesk'; src: url('../assets/fonts/space-grotesk-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../assets/fonts/inter-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../assets/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations'); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #04070d;
  --bg-2: #070d18;
  --navy: #0b1526;
  --surface: rgba(14, 22, 38, 0.62);
  --surface-strong: rgba(16, 26, 44, 0.86);
  --line: rgba(160, 190, 225, 0.12);
  --line-strong: rgba(160, 190, 225, 0.24);
  --text: #edf2f8;
  --muted: #9aa8bb;
  --dim: #66758a;
  --accent: #3cc8f0;
  --accent-2: #2f7cf6;
  --accent-soft: rgba(60, 200, 240, 0.14);
  --project-accent: var(--accent);

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --radius: 18px;
  --radius-sm: 10px;
  --container: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
html.smooth { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--accent); color: #031018; }

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

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 200; padding: 10px 16px; background: var(--text); color: var(--bg); border-radius: 8px; font-weight: 600; transition: top .2s; }
.skip-link:focus { top: 16px; }

/* ---------- World canvas ---------- */
.world { position: fixed; inset: 0; z-index: 0; pointer-events: none; background:
  radial-gradient(1200px 700px at 70% 30%, rgba(47, 124, 246, 0.10), transparent 60%),
  radial-gradient(900px 600px at 15% 80%, rgba(60, 200, 240, 0.06), transparent 60%),
  linear-gradient(180deg, #050a14 0%, var(--bg) 100%); }
.world canvas { width: 100%; height: 100%; opacity: 0; transition: opacity 1.4s var(--ease-out); }
.world.is-ready canvas { opacity: 1; }
.world-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(2, 4, 9, 0.75) 100%); }
.no-webgl .world canvas { display: none; }

.scene-loader { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 8px 14px; font: 500 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: opacity .6s, transform .6s var(--ease-out); }
.scene-loader__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite alternate; }
.scene-loader.is-done { opacity: 0; transform: translateY(8px); pointer-events: none; }
@keyframes blink { to { opacity: .2; } }

main { position: relative; z-index: 1; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.section { position: relative; padding: clamp(110px, 16vh, 180px) 0; }

.eyebrow { display: inline-flex; align-items: center; gap: 12px; font: 500 12px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 22px; }
.eyebrow span { color: var(--accent); }
.eyebrow::after { content: ''; width: 44px; height: 1px; background: var(--line-strong); }
.section-title { font: 600 clamp(2.4rem, 5.6vw, 4.6rem)/1.02 var(--font-display); letter-spacing: -0.035em; }
.section-sub { margin-top: 18px; color: var(--muted); max-width: 52ch; font-size: 1.05rem; }
.section-head { margin-bottom: clamp(48px, 7vw, 88px); }
.sub-label { font: 500 12px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 18px; }

/* Text reveal helpers (JS adds .line-inner wrappers) */
.reveal-lines .rl { display: block; overflow: hidden; padding-bottom: .06em; }
.reveal-lines .rl > span { display: inline-block; will-change: transform; }

/* ---------- Glass ---------- */
.glass { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }

/* ---------- Buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 26px; border-radius: 999px; font: 600 15px/1 var(--font-body); letter-spacing: .01em; transition: background .3s, color .3s, border-color .3s, box-shadow .3s; isolation: isolate; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease-out); }
.btn:hover svg { transform: translateX(4px); }
.btn--primary { background: var(--text); color: #050a12; }
.btn--primary:hover { background: #fff; box-shadow: 0 10px 40px -10px rgba(60, 200, 240, .55); }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--text); background: rgba(255,255,255,.04); }
.btn--block { width: 100%; }
.btn--sm { height: 42px; padding: 0 18px; font-size: 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font: 500 12px/1 var(--font-mono); padding: 7px 10px; border-radius: 6px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); }

/* ---------- Navigation ---------- */
.nav { position: fixed; top: 16px; left: 0; right: 0; z-index: 90; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; transition: transform .5s var(--ease-out); }
.nav.is-hidden { transform: translateY(-120%); }
.nav__bar { pointer-events: auto; display: flex; align-items: center; gap: 8px; height: var(--nav-h); padding: 0 8px 0 10px; border-radius: 999px; background: rgba(8, 14, 26, 0.62); border: 1px solid var(--line); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%); box-shadow: 0 20px 50px -20px rgba(0,0,0,.6); }
.nav__logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(140deg, #e9f6ff, #8fdcf5 60%, #3c8df0); color: #04101c; font: 700 14px/1 var(--font-display); letter-spacing: -.02em; }
.nav__links { position: relative; display: flex; gap: 2px; margin: 0 6px; }
.nav__links a { position: relative; z-index: 1; display: block; padding: 10px 14px; font-size: 14px; font-weight: 500; color: var(--muted); border-radius: 999px; transition: color .3s; }
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__indicator { position: absolute; top: 0; left: 0; height: 100%; width: 0; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); transition: transform .5s var(--ease-out), width .5s var(--ease-out), opacity .3s; opacity: 0; pointer-events: none; }
.nav__cta { display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border-radius: 999px; background: var(--text); color: #050a12; font-size: 14px; font-weight: 600; }
.nav__menu { display: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); position: relative; }
.nav__menu span { position: absolute; left: 13px; right: 13px; height: 1.5px; background: var(--text); transition: transform .35s var(--ease-out); }
.nav__menu span:first-child { top: 18px; } .nav__menu span:last-child { top: 25px; }
.nav__menu[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav__menu[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
.nav__sheet { pointer-events: auto; position: fixed; inset: 0; z-index: -1; display: flex; flex-direction: column; justify-content: center; padding: 100px 28px 40px; background: rgba(4, 7, 13, 0.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.nav__sheet[hidden] { display: none; }
.nav__sheet ul a { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; font: 600 clamp(2rem, 9vw, 3rem)/1.1 var(--font-display); letter-spacing: -.03em; border-bottom: 1px solid var(--line); }
.nav__sheet small { font: 500 12px/1 var(--font-mono); color: var(--accent); }
.nav__sheet-foot { margin-top: 36px; display: grid; gap: 14px; color: var(--muted); }
.nav__sheet-foot .socials { display: flex; gap: 20px; }

@media (max-width: 1100px) {
  .nav__links, .nav__cta { display: none; }
  .nav__menu { display: block; }
  .nav__bar { width: 100%; justify-content: space-between; height: 58px; }
  .nav { top: 12px; }
}

/* ---------- Magnetic ---------- */
.magnetic { transition: transform .4s var(--ease-out), background .3s, box-shadow .3s; will-change: transform; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
