/* ==========================================================================
   Base — reset, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchors from the video chips must not land under the fixed header */
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: var(--leading-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
ul,
ol,
dl {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

/* The hidden attribute has to win. Any class that sets display — .btn, the
   film layers — would otherwise keep the element on screen. */
[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

/* --- Focus -----------------------------------------------------------------
   Never removed, only restyled. Colour comes from the section theme. */
:focus-visible {
  outline: var(--focus-ring) solid var(--focus-color, var(--gen-light));
  outline-offset: var(--focus-offset);
  border-radius: 0.25rem;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  z-index: 200;
  padding: var(--space-2) var(--space-3);
  background: var(--catch);
  color: var(--ink);
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: top var(--dur) var(--ease);
}

.skip-link:focus-visible {
  top: var(--space-2);
}

/* ==========================================================================
   Typography
   ========================================================================== */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-h1);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}

.section__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-h2);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-h2);
  text-wrap: balance;
  margin-bottom: var(--space-3);
}

.section__lead {
  font-size: var(--step-lead);
  color: var(--fg-muted);
  max-width: 46ch;
  margin-bottom: var(--space-5);
}

.prose p + p {
  margin-top: var(--space-3);
}

.prose {
  max-width: 62ch;
}

/* --- The machine voice ------------------------------------------------------
   Mono, violet, always prefixed. If text looks like this, a neural net wrote
   it. That rule holds across the entire page without exception. */
.machine {
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--fg-machine);
  font-weight: 400;
}

.machine::before {
  content: "> ";
  opacity: 0.6;
}

/* Caret shows only while a line is typing itself out. */
.machine[data-typing="running"]::after {
  content: "▍";
  animation: caret-blink 900ms steps(1, end) infinite;
}

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

/* Eyebrow labels are machine-side too, but they are not prompts, so no caret */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}

.pull {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.375rem, 2.4vw, 2rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--fg);
  border-left: 2px solid var(--fg-accent);
  padding-left: var(--space-3);
  max-width: 34ch;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.section {
  background: var(--bg);
  color: var(--fg);
  padding-block: var(--section-y);
}

.wrap {
  width: min(100% - var(--gutter) * 2, var(--page-max));
  margin-inline: auto;
}

/* The signature grid: narrow rail for prompts and labels, wide column for
   everything a person reads. */
.grid-rail {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--space-5) var(--space-6);
  align-items: start;
}

/* Grid items default to min-width:auto, which lets wide children push the
   track past the viewport. This is the guard against that. */
.grid-rail > * {
  min-width: 0;
}

.grid-rail__rail {
  position: sticky;
  top: 7rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

@media (max-width: 60rem) {
  .grid-rail {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }

  .grid-rail__rail {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
  }
}

.cards {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

/* ==========================================================================
   Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--catch);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  border-color: currentColor;
  color: var(--fg);
}

.btn--ghost:hover {
  background: color-mix(in srgb, var(--fg) 10%, transparent);
}

/* Prompt chip — the navigation device. Same shape in the hero video, in the
   direction cards and in the rail, so the pattern is learnable. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid color-mix(in srgb, var(--gen-light) 45%, transparent);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  letter-spacing: 0.03em;
  color: var(--gen-light);
  cursor: pointer;
  text-align: left;
  transition:
    border-color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.chip:hover {
  border-color: var(--gen-light);
  transform: translateY(-1px);
}

.chip__target {
  font-family: var(--font-body);
  font-size: var(--step-small);
  letter-spacing: 0;
  color: var(--paper);
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

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

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

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