/* GT AFRIK — reset, base typography, shared motion utilities */

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--color-bg);
}

body {
  position: relative;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── film grain ──
   A fixed noise plane over the whole page. Two jobs: it gives the dark
   surfaces tooth so they read as material rather than as #05070d, and it
   dithers the large radial glows, which band badly on 8-bit displays once
   a gradient runs past ~400px. Overlay blending means mid-grey noise is a
   no-op and only the deviation lands, so it lifts nothing. Sits at z-index 1
   — above page content, below the nav (1000), cursor (5500) and boot (6000). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* Tabular figures everywhere data is rendered, so counters, clocks and
   telemetry readouts stop reflowing as digits change width. */
.mono,
[data-count],
[data-clock],
code,
kbd,
samp {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

a {
  color: var(--color-accent-soft);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent);
}

img {
  max-width: 100%;
}

button {
  font: inherit;
}

::selection {
  background: rgba(56, 102, 255, 0.55);
  color: var(--color-text);
}

/* Two-ring focus: a dark halo first so the accent ring stays legible when it
   lands on an accent-coloured button, then the accent ring itself. */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(5, 7, 13, 0.9);
}

/* Headlines wrap on meaning, not on the last available pixel. */
h1,
h2,
h3,
.page-title,
.closing__title,
.section-head__title,
.card__title {
  text-wrap: balance;
}

p,
.lead,
.page-sub,
.card__text {
  text-wrap: pretty;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 5000;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  transition: top var(--duration-fast) var(--ease-out-expo);
}

.skip-link:focus-visible {
  top: 16px;
  color: var(--color-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── shared type helpers ── */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
}

.eyebrow__index {
  font-family: var(--font-mono);
  font-size: var(--text-eyebrow);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--color-accent);
}

.eyebrow__rule {
  width: 44px;
  height: 1px;
  background: var(--color-accent);
}

.eyebrow__label {
  font-family: var(--font-mono);
  font-size: var(--text-eyebrow);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

.eyebrow--green .eyebrow__index,
.eyebrow--green .eyebrow__rule {
  color: var(--color-running);
  background: var(--color-running);
}

.outline-text {
  color: transparent;
  -webkit-text-stroke: 1.2px rgba(255, 255, 255, 0.5);
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.7;
  color: var(--color-text-muted);
  margin: 0;
  border-left: 1px solid rgba(56, 102, 255, 0.5);
  padding-left: 22px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: gtPulse 2s infinite;
  flex-shrink: 0;
}

/* ── motion primitives ── */
@keyframes gtPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@keyframes gtRise {
  to {
    transform: none;
  }
}

@keyframes ldRing {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

@keyframes ldAlert {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Scroll reveal — gt-motion.js adds .gt-in via IntersectionObserver.
   Gated on .js so content is never hidden when scripting is unavailable. */
.js .gt-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
    transform var(--duration-slow) var(--ease-out-expo);
  will-change: opacity, transform;
}

.js .gt-reveal.gt-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Line-mask reveal for display headings */
.gt-mask {
  display: block;
  overflow: hidden;
}

.js .gt-mask > span,
.js .gt-mask > div {
  display: block;
  transform: translateY(115%);
  animation: gtRise 1.2s var(--ease-out-expo) forwards;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js .gt-reveal {
    opacity: 1;
    transform: none;
  }

  .js .gt-mask > span,
  .js .gt-mask > div {
    transform: none;
  }
}
