:root {
  /* Palette — swap these to rebrand. sketch.js reads --bg and --ink too. */
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b6b;
  --line: rgba(10, 10, 10, 0.18);
  --panel: rgba(255, 255, 255, 0.82);

  --display: "Archivo Black", "Arial Black", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

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

html, body { margin: 0; }
html { overflow-x: clip; }

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  /* Fallback shown before p5 loads, or if it never does */
  background:
    radial-gradient(circle at center, rgba(10, 10, 10, 0.12) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--bg);
}

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#bg canvas {
  display: block;
  image-rendering: pixelated;
}

.wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 5vw, 56px);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Wordmark + typewriter ---------- */

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.75rem, 8.4vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.line {
  display: block;
  white-space: nowrap;
}

/* The block is sized by "Culture Shock"; the typed word starts at its left
   edge and is free to run past the right edge, so nothing re-centers mid-type. */
.wordmark > [aria-hidden] {
  display: inline-block;
  min-width: var(--typed-max, 0);
  text-align: left;
}
.typed {
  width: 0;
  min-height: 0.95em;
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.78em;
  margin-left: 0.06em;
  vertical-align: baseline;
  background: var(--ink);
  animation: blink 1.05s steps(1) infinite;
}
.cursor.busy { animation: none; }

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

/* ---------- Learn More ---------- */

.reveal,
.submit {
  font: inherit;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--ink);
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.reveal:hover,
.submit:hover {
  color: var(--ink);
  background: var(--bg);
}
.reveal:active,
.submit:active { transform: translateY(1px); }

.reveal {
  padding: 0.9em 2.4em;
  font-size: clamp(1.2rem, 2.8vw, 1.75rem);
}

/* ---------- Form panel ---------- */

.panel {
  width: 100%;
  max-width: 520px;
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--ink);
  padding: clamp(20px, 4vw, 36px);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Hidden until Learn More is clicked; always visible without JS */
.js .panel { display: none; }
.js .panel.open {
  display: block;
  animation: panel-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(16px); }
}

.panel h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  text-transform: uppercase;
}

.intro {
  margin: 0 0 24px;
  color: var(--muted);
}

.field { margin: 0 0 16px; }

fieldset.field { border: 0; padding: 0; }

label, legend {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}
legend { padding: 0; }

.opt { color: var(--muted); font-weight: 400; }

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 0;
  transition: border-color 0.15s;
}
textarea { resize: vertical; }

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus { border-color: var(--ink); }

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
.chip input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  padding: 7px 12px;
  font-size: 0.85rem;
  border: 1.5px solid var(--line);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover span { border-color: var(--ink); }
.chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.submit {
  width: 100%;
  margin-top: 4px;
  padding: 14px 20px;
  font-size: 1.05rem;
}
.submit[disabled] { opacity: 0.6; cursor: progress; }

.status { margin: 12px 0 0; min-height: 1.5em; font-size: 0.95rem; }
.status.error { color: #c0150a; }

.done h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.75rem;
  text-transform: uppercase;
}
.done p { margin: 0; color: var(--muted); }
.done:focus { outline: none; }

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.foot {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  white-space: nowrap;
}

.tagline {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
}

.back {
  color: var(--ink);
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
