/* ============================================================
   Phantom Lab — BASE
   Reset, body, typography, container, section scaffolding,
   decorative page background, preloader, custom cursor.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  /* fallback for Safari < 16 — see the `overflow: clip` block below */
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* `clip` (unlike `hidden`) does NOT turn the element into a scroll container,
   so ScrollTrigger's pinning and `position: sticky` keep working while the
   decorative layers can no longer produce a horizontal scrollbar on iOS. */
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}

::selection { background: rgba(124, 58, 237, 0.45); color: #fff; }

.container {
  width: min(var(--container-w), 100% - var(--container-gutter));
  margin-inline: auto;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; }

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

button { font-family: inherit; cursor: pointer; }

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

/* ============ Decorative page background ============
   One continuous background for the whole document: a dot
   grid tile plus two large, very soft colour blobs. Sits
   behind everything (z-index -1), never interactive. */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  /* belt and braces: the grid tile and both blobs are deliberately wider than
     the viewport, so this layer must clip them itself and never contribute to
     the document's scroll width. */
  overflow: hidden;
  /* isolate paint so the oversized children can never be reported as
     document overflow, even on engines that hoist composited layers */
  contain: paint;
  pointer-events: none;
}
.bg-grid {
  position: absolute;
  inset: -25% -10%;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: var(--grid-opacity);
  -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 45%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 55% at 50% 45%, #000 25%, transparent 78%);
  will-change: transform;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.bg-blob-1 {
  width: min(760px, 90vw);
  aspect-ratio: 1;
  top: -12vh;
  right: -14vw;
  background: radial-gradient(circle, var(--blob-1) 0%, transparent 68%);
}
.bg-blob-2 {
  width: min(680px, 85vw);
  aspect-ratio: 1;
  bottom: -18vh;
  left: -16vw;
  background: radial-gradient(circle, var(--blob-2) 0%, transparent 68%);
}

/* ============ Section scaffolding ============ */
.section {
  padding: var(--section-pad-y) 0;
  position: relative;
}
.section > .container { position: relative; z-index: 1; }

/* Soft radial "zones" that bleed across section boundaries,
   replacing the old alternating flat backgrounds. */
.section-zone::before {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 130%;
  top: -15%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.zone-a::before { background: radial-gradient(ellipse at center, var(--zone-1) 0%, transparent 62%); }
.zone-b::before { background: radial-gradient(ellipse at center, var(--zone-2) 0%, transparent 62%); }
.zone-c::before { background: radial-gradient(ellipse at center, var(--zone-3) 0%, transparent 62%); }

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--section-head-gap);
}
.section-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-3);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
}
.section-title {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  margin-bottom: 14px;
}
.section-sub { color: var(--text-muted); font-size: 1.05rem; }

@media (max-width: 820px) {
  :root { --section-pad-y: 80px; --section-head-gap: var(--space-6); }
}
@media (max-width: 560px) {
  :root {
    --section-pad-y: 60px;
    --container-gutter: 36px;
  }
}

/* ============ Preloader ============ */
.preloader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.preloader-inner { text-align: center; }
.preloader-logo {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex; justify-content: center;
}
.preloader-logo span { display: inline-block; }
.preloader-logo .preloader-space { width: 0.35em; }
.preloader-counter {
  margin-top: var(--space-3);
  font-family: var(--font-display);
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.15em;
}
.preloader.is-hidden { display: none; }

/* ============ Custom cursor ============ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 150;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
}
.cursor-dot {
  width: 8px; height: 8px;
  background: var(--accent-3);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px solid rgba(124, 58, 237, 0.7);
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease;
}
body.cursor-active .cursor-dot, body.cursor-active .cursor-ring { opacity: 1; }
body.cursor-hover .cursor-ring {
  width: 56px; height: 56px;
  border-color: var(--accent-3);
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}
