/* Base reset, typography, global background, focus, utilities. */

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

html,
body {
  height: 100%;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(49, 169, 0, 0.16), transparent 60%),
    radial-gradient(1000px 700px at 10% 110%, rgba(255, 59, 48, 0.1), transparent 60%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 55%, var(--bg-2) 100%);
  background-attachment: fixed;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: var(--brand-3);
}

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

:focus-visible {
  outline: 3px solid var(--brand-3);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Step headings (and the processing terminal) are focused ONLY so assistive tech announces
   the new step (see a11y.focusStep). They are not keyboard-operable controls, so the green
   focus ring is suppressed there. Interactive controls (buttons, links, answer cards) keep
   their visible focus styles. */
.step__title:focus,
.step__title:focus-visible,
[data-focus]:focus,
[data-focus]:focus-visible {
  outline: none;
}

::selection {
  background: rgba(49, 169, 0, 0.5);
  color: #fff;
}

.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;
}

/* Elements that are revealed by the enter choreography start hidden so they
   never paint before their animation (prevents the initial-load flash). */
.pre-hidden {
  opacity: 0;
}

/* No-JS fallback (D15) */
.noscript {
  position: relative;
  z-index: 5;
  max-width: 680px;
  margin: 0 auto;
  padding: 32px var(--gutter) 48px;
  overflow-y: auto;
  height: 100%;
}
.noscript h1 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(28px, 8vw, 44px);
  color: #fff;
  margin-bottom: 12px;
}
.noscript p {
  color: var(--text-dim);
  margin: 10px 0;
}
.noscript ul {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  margin: 16px 0;
}
.noscript strong {
  color: var(--gold);
}

/* Type scale */
.step__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 7vw, 52px);
  line-height: 1.04;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  color: #fff;
  text-shadow: 0 2px 30px rgba(49, 169, 0, 0.25);
}

.step__lead {
  font-size: clamp(15px, 3.7vw, 19px);
  color: var(--text-dim);
  max-width: 58ch;
}

.step__body {
  font-size: clamp(15px, 3.6vw, 18px);
  color: var(--text);
  max-width: 62ch;
}

.step__micro {
  font-size: 13.5px;
  color: var(--text-dim);
  font-style: italic;
  max-width: 48ch;
}

.is-typing::after {
  content: '_';
  margin-left: 2px;
  animation: caret 1s steps(2, jump-none) infinite;
  color: var(--brand-3);
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

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

body.motion-reduced *,
body.motion-reduced *::before,
body.motion-reduced *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
