/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');

/* ── Color System ── */
:root {
  --black:  #000000;
  --white:  #FFFFFF;
  --red:    #EF3A3A;

  --bg:          var(--white);
  --text:        var(--black);
  --accent:      var(--red);
  --interactive: var(--red);

  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--white);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: 56px;
  transition: background 1200ms ease;
  overflow-x: hidden;
}

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

/* ── Universal image fade-in ── */
img {
  opacity: 0;
  transition: opacity 350ms ease-out;
}
img.img-loaded,
img.loaded { opacity: 1; }

/* Stagger for grid children */
.img-grid .img-card:nth-child(1) img,
.img-grid-8 .img-card:nth-child(1) img,
.img-grid-6 .img-card:nth-child(1) img,
.img-grid-9 .img-card:nth-child(1) img { transition-delay: 0ms; }
.img-grid .img-card:nth-child(2) img,
.img-grid-8 .img-card:nth-child(2) img,
.img-grid-6 .img-card:nth-child(2) img,
.img-grid-9 .img-card:nth-child(2) img { transition-delay: 50ms; }
.img-grid .img-card:nth-child(3) img,
.img-grid-8 .img-card:nth-child(3) img,
.img-grid-6 .img-card:nth-child(3) img,
.img-grid-9 .img-card:nth-child(3) img { transition-delay: 100ms; }
.img-grid .img-card:nth-child(4) img,
.img-grid-8 .img-card:nth-child(4) img,
.img-grid-6 .img-card:nth-child(4) img,
.img-grid-9 .img-card:nth-child(4) img { transition-delay: 150ms; }
.img-grid .img-card:nth-child(5) img,
.img-grid-8 .img-card:nth-child(5) img,
.img-grid-6 .img-card:nth-child(5) img,
.img-grid-9 .img-card:nth-child(5) img { transition-delay: 200ms; }
.img-grid .img-card:nth-child(6) img,
.img-grid-8 .img-card:nth-child(6) img,
.img-grid-6 .img-card:nth-child(6) img,
.img-grid-9 .img-card:nth-child(6) img { transition-delay: 250ms; }
.img-grid .img-card:nth-child(7) img,
.img-grid-8 .img-card:nth-child(7) img,
.img-grid-9 .img-card:nth-child(7) img { transition-delay: 300ms; }
.img-grid .img-card:nth-child(8) img,
.img-grid-8 .img-card:nth-child(8) img,
.img-grid-9 .img-card:nth-child(8) img { transition-delay: 350ms; }
.img-grid .img-card:nth-child(9) img,
.img-grid-9 .img-card:nth-child(9) img { transition-delay: 400ms; }

button {
  font-family: inherit;
  cursor: pointer;
}

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

/* ── Typography — Anton group (headings, labels, UI controls) ── */
h1, h2, h3, h4, h5, h6,
.nav-wordmark,
.question-text, .phase-label,
.section-label, .ui-label,
.counter, .selection-counter,
.continue-btn-inline, .btn-start,
.btn-primary, .btn-secondary,
.occ-cluster-label, .occ-btn,
.intro-label, .loading-status,
.beat-text, .quad-number, .quad-label,
.quad-hint, .quad-close, .dl-btn,
.output-card-label, .step-title,
.ref-column-title,
.footer-wordmark, .footer-bottom,
.refresh-btn, .bool-status,
.kit-section-number, .kit-section-label,
.tag-pill, .style-tag, .output-tag,
.eco-node-title, .cta-btn,
.q-number-deco,
.hero-q1, .hero-q2, .hero-start,
.name-input,
.continue-link, .continue-link-p2,
.back-link, .q-number-decorative,
.cluster-card-title, .beat-brand-name,
.beat-label, .p2-q-text, .p1-q-text,
/* Round 7 classes */
.tool-tag, .tool-name, .tool-copy,
.prompts-header-title, .section-label-sm,
.panel-number, .panel-label, .panel-open-hint,
/* Round 8 classes */
.fw-box-h, .fw-engine-title, .fw-out-title,
.fw-dim-letter, .about-cta-btn,
.page-back {
  font-family: 'Anton', sans-serif !important;
  font-weight: 400;
}

/* ── Typography — body / UI sans (system stack) ── */
p, li,
.description, .rationale,
.prompt-content, .kit-body,
.card-description, .tag-label,
.slider-label, .slider-desc,
.slider-description, .p2-slider-desc,
.img-caption, .intro-hint,
.brand-name-hint,
.section-sub, .eco-node-sub,
.footer-sub, .footer-right a,
.corrections-note, .dl-sub,
.ref-item, .occ-btn-label,
.hero-body-text, .step-body,
.hero-about,
/* Round 7 classes */
.tool-desc, .tool-where, .tool-prompt-text,
.prompts-header-sub,
/* Round 8 classes */
.fw-box-tag, .fw-locks-display,
.fw-dim-name, .fw-dim-axis,
.fw-dim-detail-label, .fw-ctrl-tag,
.fw-arrow-text, .fw-engine-body,
.fw-tension, .fw-out-params,
.framework-intro {
  font-family: var(--font-body) !important;
}

/* ── Font size overrides ── */

/* ── Halftone Dot Patterns ── */
.dot-field {
  position: relative;
  overflow: hidden;
}

.dot-field::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 12px 12px;
  opacity: 0.25;
  pointer-events: none;
  z-index: 1;
}

.dot-field-dense {
  position: relative;
  overflow: hidden;
}

.dot-field-dense::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

.dot-field-large {
  position: relative;
  overflow: hidden;
}

.dot-field-large::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #000 2.5px, transparent 2.5px);
  background-size: 18px 18px;
  opacity: 0.20;
  pointer-events: none;
  z-index: 1;
}

.dot-field-white {
  position: relative;
  overflow: hidden;
}

.dot-field-white::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: 0.30;
  pointer-events: none;
  z-index: 1;
}

/* ── Global viewfinder cursor ── */
.viewfinder {
  position: fixed;
  width: 80px;
  height: 60px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 150ms cubic-bezier(.22,1,.36,1), height 150ms cubic-bezier(.22,1,.36,1), opacity 180ms ease, background 200ms ease;
  opacity: 0;
  will-change: left, top, width, height;
}

.vf-corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--red);
  border-style: solid;
  transition: width 150ms ease, height 150ms ease, border-color 150ms;
}

.vf-corner.vf-tl { top: 0;    left: 0;  border-width: 1.5px 0 0 1.5px; }
.vf-corner.vf-tr { top: 0;    right: 0; border-width: 1.5px 1.5px 0 0; }
.vf-corner.vf-bl { bottom: 0; left: 0;  border-width: 0 0 1.5px 1.5px; }
.vf-corner.vf-br { bottom: 0; right: 0; border-width: 0 1.5px 1.5px 0; }

.viewfinder.over-card .vf-corner { width: 14px; height: 14px; }
.viewfinder.over-card { background: rgba(239, 58, 58, 0.05); }

.viewfinder.snapped {
  background: rgba(239, 58, 58, 0.14);
  border: 1.5px solid var(--red);
  border-radius: 0;
  transition: width 120ms cubic-bezier(.22,1,.36,1), height 120ms cubic-bezier(.22,1,.36,1), background 100ms ease;
}
.viewfinder.snapped .vf-corner { display: none; }

body.vf-global-active,
body.phase1-active {
  cursor: none;
}
body.vf-global-active *,
body.phase1-active * {
  cursor: none !important;
}

@media (max-width: 600px) {
  .viewfinder { display: none; }
  body.vf-global-active,
  body.phase1-active { cursor: auto; }
  body.vf-global-active *,
  body.phase1-active * { cursor: auto !important; }
}

/* Home uses white frame + subtle red fill */
body.page-home .vf-corner,
body.page-about.vf-on-red .vf-corner {
  border-color: rgba(255, 255, 255, 0.95);
}
body.page-home .viewfinder.over-card,
body.page-about.vf-on-red .viewfinder.over-card {
  background: rgba(239, 58, 58, 0.08);
}
body.page-home .viewfinder.snapped,
body.page-about.vf-on-red .viewfinder.snapped {
  border-color: rgba(255, 255, 255, 0.95);
  background: rgba(239, 58, 58, 0.12);
}

/* ── Utility ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Page padding (accounts for fixed nav) ── */
.page-body {
  padding-top: 4rem;
}

/* ── Font size overrides ── */
.question-text, .p1-q-text { font-size: clamp(1.4rem, 3vw, 2rem); }
.p2-q-text { font-size: clamp(1.5rem, 3vw, 2.4rem); }
.instruction-text, .transparency-line  { font-size: 1rem; }
.word-tag      { font-size: 0.95rem; }
.img-caption   { font-size: 0.94rem; }
.slider-label  { font-size: 0.95rem; }
.slider-desc, .slider-description, .p2-slider-desc { font-size: 1.05rem; }
.occ-btn       { font-size: 0.98rem; }
.continue-link, .continue-link-p2 { font-size: 1rem; }
.ref-item      { font-size: 0.94rem; }
.prompt-content { font-size: 0.98rem; }
