:root {
  /* Backgrounds — derived from shader-colors.json body.backgroundColor: rgb(0, 0, 0)
     Shader uses a flat single-surface dark theme with no card elevations,
     so surface/elevated are subtle increments from pure black */
  --bg-primary: rgb(0, 0, 0);
  --bg-surface: rgb(12, 12, 12);
  --bg-elevated: rgb(24, 24, 24);

  /* Text — derived from shader-colors.json body.color: rgb(252, 249, 243)
     Warm off-white primary; secondary is reduced opacity for muted hierarchy */
  --text-primary: rgb(252, 249, 243);
  --text-secondary: rgba(252, 249, 243, 0.6);
  --text-accent: rgb(252, 249, 243);

  /* Accent — derived from shader-colors.json customProperties --foreground: #fcf9f3
     Shader's accent IS the warm off-white foreground against pure black */
  --accent: #fcf9f3;
  --accent-hover: rgb(255, 255, 255);
  --accent-glow: rgba(252, 249, 243, 0.15);

  /* Borders — derived from shader-surfaces.json (no visible borders in source,
     so derived as opacity variants of the text color for subtle/strong hierarchy) */
  --border-subtle: rgba(252, 249, 243, 0.08);
  --border-strong: rgba(252, 249, 243, 0.2);

  /* Font families — derived from shader-typography.json
     Shader uses "STIX Two Text" exclusively (serif) with Times New Roman fallback.
     Body and heading share the same stack; mono added for code/terminal elements. */
  --font-heading: "STIX Two Text", "STIX Two Text Fallback", serif;
  --font-body: "STIX Two Text", "STIX Two Text Fallback", serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;

  /* Type scale — derived from shader-typography.json base fontSize: 16px (1rem)
     Shader renders all elements at 16px; scale built around that base
     using a ~1.25 ratio for heading progression */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-hero: 3rem;

  /* Spacing scale — derived from suero-spacing.json
     Base unit: 16px (grid gap), section padding: 64px, container margin: ~20.64px.
     Scale built from grid gap as anchor with 2x progression */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-section: 4rem;

  /* Layout — derived from suero-spacing.json
     maxWidth: 1920px (container[0-19]), grid gap: 16px (all grids) */
  --max-width: 1920px;
  --grid-gap: 1rem;

  /* Button component tokens — derived from accent + spacing primitives */
  --btn-bg: var(--accent);
  --btn-text: var(--bg-primary);
  --btn-radius: 0.25rem;
  --btn-padding: var(--space-sm) var(--space-md);

  /* Card component tokens — derived from surface + border + spacing primitives */
  --card-bg: var(--bg-surface);
  --card-border: var(--border-subtle);
  --card-radius: 0.5rem;
  --card-padding: var(--space-lg);

  /* Badge tokens — spec type variants derived from accent palette
     Three distinct hues against the dark theme: blue (BUILD), green (WORKSPACE), amber (OPERATE) */
  --badge-build-bg: rgba(96, 165, 250, 0.15);
  --badge-build-text: rgb(147, 197, 253);
  --badge-workspace-bg: rgba(74, 222, 128, 0.15);
  --badge-workspace-text: rgb(134, 239, 172);
  --badge-operate-bg: rgba(251, 191, 36, 0.15);
  --badge-operate-text: rgb(253, 224, 71);
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

#seed, #growth, #self-extension, #this-page, #provenance {
  scroll-margin-top: 60px;
}

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

* {
  margin: 0;
  padding: 0;
}

/* Base */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  background: radial-gradient(ellipse at 50% 0%, rgb(10, 10, 14) 0%, rgb(0, 0, 0) 70%);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

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

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section {
  padding: var(--space-section) 0;
}

.grid {
  display: grid;
  gap: var(--grid-gap);
}

/* Nav */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav__logo {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.2em;
}

.nav__links {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
}

.nav__links a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
  position: relative;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 200ms ease, left 200ms ease;
}

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

.nav__links a:hover::after {
  width: 100%;
  left: 0;
}

.attested-counter a {
  color: rgba(134, 239, 172, 0.7);
  font-size: var(--text-xs);
}

.attested-counter a:hover {
  color: rgb(134, 239, 172);
}

.counter-number {
  font-weight: 700;
}

.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
}

.nav__hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.2s ease;
}

/* Footer */
footer {
  padding: clamp(4rem, 8vh, 6rem) var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  max-width: 1000px;
  margin: 0 auto;
}

.footer__col-header {
  font-family: var(--font-mono);
  font-variant: all-small-caps;
  letter-spacing: 0.1em;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.footer__col p,
.footer__col a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.8;
}

.footer__col a {
  color: var(--accent);
  display: block;
}

.footer__col a:hover {
  text-decoration: underline;
}

/* Hero */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
}

#hero h1 {
  font-size: clamp(4rem, 9vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.0;
  background: linear-gradient(180deg, #fcf9f3 0%, #dcdce8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding-bottom: 0.05em;
  margin-bottom: var(--space-md);
}

#hero h2 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 50ch;
  margin-bottom: var(--space-sm);
}

#hero p {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 55ch;
  margin-bottom: var(--space-lg);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 0.875rem 1.75rem;
  border-radius: var(--btn-radius);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background 0.2s ease;
}

.hero__cta:hover {
  background: var(--accent-hover);
}

.hero__cta .arrow {
  display: inline-block;
  transition: transform 200ms ease;
}

.hero__cta:hover .arrow {
  transform: rotate(-45deg);
}

.hero__scroll-caption {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  margin-top: var(--space-md);
  margin-bottom: clamp(4rem, 8vh, 8rem);
}

/* Anchor Sections */
.anchor-section {
  padding: clamp(8rem, 18vh, 18rem) var(--space-md);
  max-width: 1000px;
  margin: 0 auto;
}

.anchor-section__number {
  font-family: var(--font-mono);
  font-size: clamp(5rem, 12vw, 11rem);
  font-weight: 700;
  color: rgba(252, 249, 243, 0.08);
  line-height: 0.85;
  margin-bottom: 0.5rem;
}

.anchor-section__title {
  font-size: clamp(2.75rem, 5.5vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.0;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.anchor-section__subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  max-width: 50ch;
}

.anchor-section__narrative {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 65ch;
  line-height: 1.8;
  margin-bottom: var(--space-xl);
}

.anchor-section__narrative strong {
  font-weight: 700;
  color: var(--text-primary);
}

.anchor-section__content {
  margin-top: var(--space-lg);
}

/* Evidence Grid */
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--grid-gap);
}

.evidence-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  transition: transform 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}

.evidence-card:hover {
  transform: translateY(-2px);
  border-color: rgba(252, 249, 243, 0.3);
  box-shadow: 0 4px 24px rgba(252, 249, 243, 0.06);
}

.card-tags {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant: all-small-caps;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.evidence-card h3 {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.evidence-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.evidence-stat {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.capability-card-list {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.capability-card-more {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  opacity: 0.6;
  margin-top: var(--space-sm);
  font-style: italic;
}

/* This Page — reveal section */
#this-page {
  text-align: center;
}

.reveal-text {
  font-size: clamp(2.75rem, 5.5vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.0;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

#this-page .anchor-section__narrative {
  margin-left: auto;
  margin-right: auto;
}

/* Chain List */
.chain-list {
  list-style: none;
  counter-reset: chain;
  max-width: 500px;
  margin: 0 auto;
  text-align: left;
}

.chain-list li {
  counter-increment: chain;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  border-left: 1px solid var(--border-subtle);
  position: relative;
  margin-bottom: 0;
  line-height: 2.4;
}

.chain-list li::before {
  content: counter(chain) ".";
  color: var(--text-secondary);
  margin-right: var(--space-sm);
  font-weight: 600;
}

.chain-list li:last-child {
  border-left: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chain-closing {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: clamp(4rem, 8vh, 7rem);
}

.chain-note {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  opacity: 0.6;
  margin-left: var(--space-sm);
}

.chain-list li:last-child .chain-note {
  color: var(--accent);
  opacity: 0.8;
}

/* Provenance */
#provenance {
  padding: var(--space-xl) var(--space-md);
}

.provenance-container {
  max-width: 1000px;
  margin: 0 auto;
}

.provenance-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  color: var(--text-secondary);
  max-width: 60ch;
}

.attestation-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
  margin-top: var(--space-lg);
}

.attestation-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  transition: transform 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}

.attestation-card:hover {
  transform: translateY(-2px);
  border-color: rgba(252, 249, 243, 0.3);
  box-shadow: 0 4px 24px rgba(252, 249, 243, 0.06);
}

@keyframes badge-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1.0; }
}

.verification-badge--verified {
  background: var(--badge-workspace-bg);
  color: var(--badge-workspace-text);
  animation: badge-pulse 1.5s ease-in-out infinite;
}

.intent-text {
  font-size: var(--text-lg);
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: var(--space-md);
  text-transform: capitalize;
}

.attestation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.verification-badge {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--btn-radius);
  display: inline-block;
  margin-bottom: var(--space-md);
}

.verification-badge--verified {
  background: var(--badge-workspace-bg);
  color: var(--badge-workspace-text);
}

.verification-badge--pending {
  background: var(--badge-operate-bg);
  color: var(--badge-operate-text);
}

.attestation-actions {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.attestation-actions a,
.attestation-actions button {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--border-subtle);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.attestation-actions a:hover,
.attestation-actions button:hover {
  border-color: var(--accent);
}

.bundle-viewer {
  display: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--btn-radius);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  margin-top: var(--space-sm);
  white-space: pre;
}

.bundle-viewer.open {
  display: block;
}

/* ==========================================
   V2 — Terminal, Scroll Reveals, Parallax
   ========================================== */

/* Floating Terminal */
.terminal {
  width: min(600px, 90vw);
  background: rgb(18, 18, 22);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(252, 249, 243, 0.03);
  transform: perspective(1200px) rotateX(2deg) rotateY(-1deg);
  animation: terminal-float 5s ease-in-out infinite;
  margin-top: var(--space-xl);
}

@keyframes terminal-float {
  0%, 100% { transform: perspective(1200px) rotateX(2deg) rotateY(-1deg) translateY(0); }
  50% { transform: perspective(1200px) rotateX(2deg) rotateY(-1deg) translateY(-8px); }
}

.terminal__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgb(30, 30, 36);
  border-bottom: 1px solid var(--border-subtle);
}

.terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal__dot--red { background: #ff5f57; }
.terminal__dot--yellow { background: #febc2e; }
.terminal__dot--green { background: #28c840; }

.terminal__title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-left: 8px;
}

.terminal__body {
  padding: var(--space-md);
  height: 420px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--text-secondary);
  text-align: left;
}

.terminal__line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.8em;
}

.terminal__line--prompt {
  color: var(--accent);
}

.terminal__line--success {
  color: var(--badge-workspace-text);
}

.terminal__line--emphasis {
  color: var(--text-primary);
  font-weight: 600;
}

.terminal__cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--accent);
  animation: cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > .reveal {
  transition-delay: calc(var(--stagger-index, 0) * 120ms);
}

/* Parallax container */
.parallax-section {
  position: relative;
}

.parallax-number {
  will-change: transform;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .terminal { animation: none; transform: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .terminal__cursor { animation: none; opacity: 1; }
  .parallax-number { transform: none !important; }
}

/* Large desktop and below */
@media (max-width: 1400px) {
}

/* Tablet and below */
@media (max-width: 991px) {
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .attestation-cards {
    grid-template-columns: 1fr;
  }

  .footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 767px) {
  .terminal {
    transform: none;
    animation: terminal-float-mobile 5s ease-in-out infinite;
  }

  @keyframes terminal-float-mobile {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
  }

  .reveal {
    transform: translateY(20px);
  }

  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.95);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav__links--open {
    display: flex;
  }

  .nav__hamburger {
    display: flex;
  }

  .chain-list {
    max-width: 100%;
  }

  .attestation-meta {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .footer__grid {
    grid-template-columns: 1fr;
  }
}

/* Small mobile */
@media (max-width: 479px) {
  #hero {
    padding: var(--space-lg) var(--space-sm);
  }

  .anchor-section {
    padding: var(--space-lg) var(--space-sm);
  }

}
