/* ============================================================================
   base.css — reset, typography primitives, ambient background, a11y.
   Depends on tokens.css.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  /* keep anchor targets clear of the fixed nav pill */
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: calc(var(--lh-body) / var(--fs-body));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; }

/* Visible focus ring on keyboard nav only. */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: var(--radius-full);
}

/* Screen-reader-only, still focusable (used by the skip link). */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: var(--space-sm); left: var(--space-sm);
  z-index: 100; width: auto; height: auto; margin: 0;
  clip-path: none; white-space: normal;
  padding: var(--space-xs) var(--space-md);
  background: var(--text-primary); color: var(--text-inverse);
  border-radius: var(--radius-full); font-weight: 600;
}

/* ── type primitives ──────────────────────────────────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  line-height: var(--lh-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow--cyan { color: var(--accent-cyan); }

.lead {
  font-size: var(--fs-lead);
  line-height: calc(var(--lh-lead) / var(--fs-lead));
  color: var(--text-secondary);
}
.lead b { color: var(--text-primary); font-weight: 600; }

/* Mono/Tag pill — used for skills, categories and case meta. */
.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-tag);
  line-height: var(--lh-tag);
  letter-spacing: var(--ls-tag);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: var(--space-3xs) var(--space-xs);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}
.tag-row { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2xs); }

/* Pulsing "live" dot, shared by the eyebrow and the showreel header. */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulse 2.4s var(--ease) infinite;
  flex: none;
}
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.35 } }

/* ── ambient mesh + grain (decorative, behind everything) ─────────────── */

.mesh { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.55; will-change: transform;
}
.orb--violet {
  width: 46vw; height: 46vw; top: -8vw; left: -6vw;
  background: radial-gradient(circle at center, var(--glow-violet), transparent 68%);
  animation: drift-a 22s var(--ease) infinite alternate;
}
.orb--cyan {
  width: 40vw; height: 40vw; bottom: -10vw; right: -4vw;
  background: radial-gradient(circle at center, var(--glow-cyan), transparent 68%);
  animation: drift-b 26s var(--ease) infinite alternate;
}
.orb--white {
  width: 30vw; height: 30vw; top: 34%; left: 44%;
  background: radial-gradient(circle at center, rgba(255,255,255,0.10), transparent 70%);
  animation: drift-c 30s var(--ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate3d( 8vw,  6vh, 0) scale(1.12) } }
@keyframes drift-b { to { transform: translate3d(-7vw, -5vh, 0) scale(1.08) } }
@keyframes drift-c { to { transform: translate3d(-5vw,  4vh, 0) scale(1.15) } }

/* Inline SVG noise — no extra request, no layout cost. */
.grain {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── reveal animations ────────────────────────────────────────────────── */

/* Hero entrance: staggered fade + rise, fired on load (no observer needed —
   it is above the fold by definition). --i sets the stagger index. */
.hero-reveal {
  opacity: 0;
  transform: translateY(22px);
  animation: rise 0.9s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 90ms + 120ms);
}
@keyframes rise { to { opacity: 1; transform: none } }

/* Scroll reveal: .is-visible is added by main.js via IntersectionObserver. */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition:
    opacity   var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease),
    filter    var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; filter: blur(0); }

/* ── reduced motion: everything static, nothing hidden ────────────────── */
@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;
  }
  .hero-reveal { opacity: 1; transform: none; }
  .reveal { opacity: 1; transform: none; filter: none; }
}
