:root {
  --bg: #1b1b1b;
  --ink: #fcf8f7;
  --accent: #e5ff03;
  --purple: #5c36fe;
  --error: #ffc2bb;
  --error-border: #d92d20;
  --mono: "Geist Mono", ui-monospace, monospace;
  --sans: "Bricolage Grotesque", system-ui, sans-serif;
  /* Design frame is 1920px wide; badge is 239px. */
  --badge-size: clamp(130px, 12.44vw, 300px);
}

* { box-sizing: border-box; }

/* Stop iOS/Android from enlarging text on their own (e.g. on rotate). */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

/* Desktop: logo + copy on the left, form card on the right, the pair
   centred in the window (1011x401 group in the design). */
.page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 16px;
}

.layout {
  display: flex;
  gap: 100px;
}

.intro {
  width: 461px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.logo { margin: 0; }

.logo img {
  display: block;
  width: 100%;
  height: auto;
}

.intro__copy {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  font-variation-settings: "opsz" 14, "wdth" 100;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* ---------- Badge ---------- */

/* 239px box in the design: 195px star tilted 15deg, text centred on it. */
.badge {
  position: fixed;
  top: 2px;
  right: 2px;
  width: var(--badge-size);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  z-index: 3;
  pointer-events: none;
}

.badge__star {
  grid-area: 1 / 1;
  width: 81.6%;
  height: auto;
  transform: rotate(15deg);
  animation: spin 40s linear infinite;
}

.badge__text {
  grid-area: 1 / 1;
  transform: rotate(15deg);
  color: var(--bg);
  font-weight: 800;
  font-variation-settings: "opsz" 96, "wdth" 100;
  font-size: calc(var(--badge-size) * 0.1339);
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-align: center;
}

/* ---------- Card + flip ---------- */

.card {
  width: 450px;
  flex: none;
  align-self: stretch;
  display: flex;
  perspective: 1600px;
}

.card__inner {
  position: relative;
  flex: 1;
  display: flex;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.3, 1.25, 0.4, 1);
}

.card.is-flipped .card__inner { transform: rotateY(180deg); }

.card__face {
  background: var(--purple);
  color: var(--ink);
  border-radius: 20px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Back sits on top of the front, pre-rotated, so the flip reveals it. */
.card__back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.card__back-title {
  margin: 0;
  color: var(--accent);
  font-size: 80px;
  font-weight: 800;
  font-variation-settings: "opsz" 96, "wdth" 100;
  line-height: normal;
  letter-spacing: -0.02em;
  outline: none;
}

.card__back-copy {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  font-variation-settings: "opsz" 14, "wdth" 100;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

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

/* Fields at the top, button at the bottom, matching the intro's height. */
.card__front {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.fields__row {
  display: flex;
  gap: 8px;
}

.fields__row .field { flex: 1 1 0; min-width: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Trim to cap height like the design, so labels sit 12px above inputs. */
.field__head > * { text-box: trim-both cap alphabetic; }

.field__head label { cursor: pointer; }

/* Errors share the label row so showing one never shifts the layout. */
.field__error {
  color: var(--error);
  overflow: hidden;
  text-overflow: ellipsis;
}

.field input,
.field textarea {
  width: 100%;
  margin: 0;
  padding: 14px;
  border: 2px solid var(--bg);
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-size: 16px; /* 16px+ stops iOS zooming in on focus */
  font-weight: 600;
  font-variation-settings: "opsz" 14, "wdth" 100;
  line-height: 1.1;
  letter-spacing: -0.02em;
  caret-color: var(--purple);
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Long values scroll while typing and show an ellipsis once you move on. */
.field input {
  height: 50px;
  text-overflow: ellipsis;
}

.field textarea {
  display: block;
  height: 187px;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a3a09e;
  opacity: 1;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--error-border); }

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* 16px so iOS never zooms if autofill ever focuses it. */
.trap input { font-size: 16px; }

.send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 14px 20px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  font-variation-settings: "opsz" 96, "wdth" 100;
  line-height: 0.9;
  letter-spacing: -0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

/* Arcade button: lifts up-left off a hard shadow on hover, and slams flat
   when pressed. Hover only where there's a real pointer, so it doesn't
   stick on after a tap. */
@media (hover: hover) {
  .send:hover {
    transform: translate(-4px, -5px);
    box-shadow: 4px 5px 0 var(--bg);
  }
}

.send:active {
  transform: translate(0, 0);
  box-shadow: 0 0 0 var(--bg);
  transition-duration: 0.04s;
}

.send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.send[aria-busy="true"] {
  cursor: progress;
  transform: none;
  box-shadow: none;
  opacity: 0.75;
}

.form-status {
  margin: -12px 0 0;
  font-size: 14px;
  font-weight: 600;
  font-variation-settings: "opsz" 14, "wdth" 100;
  color: var(--error);
  text-align: center;
}

.form-status:empty { display: none; }

/* ---------- Marquees ---------- */

.marquee {
  position: fixed;
  left: 0;
  right: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-weight: 300;
  font-size: clamp(12px, 0.94vw, 18px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  z-index: 1;
  pointer-events: none;
}

.marquee--top { top: clamp(10px, 0.83vw, 16px); }
.marquee--bottom { bottom: clamp(10px, 0.83vw, 16px); }

.marquee__track {
  display: inline-flex;
  animation: scroll 60s linear infinite;
}

.marquee__track--reverse { animation-direction: reverse; }

/* Track holds two identical halves, so -50% loops seamlessly. */
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes spin {
  from { transform: rotate(15deg); }
  to { transform: rotate(375deg); }
}

/* ---------- Smaller screens ---------- */

/* Below the two-column width: horizontal logo on top, copy, then the form,
   with enough of the form above the fold to invite a scroll. */
@media (max-width: 1099px) {
  .page {
    align-items: flex-start;
    padding: 108px 16px 48px;
  }

  .layout {
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }

  .intro {
    width: 100%;
    max-width: 560px;
    gap: 20px;
  }

  .logo { width: min(100%, 420px); }

  .card { width: 100%; max-width: 560px; align-self: center; }

  .desktop-break { display: none; }

  /* Marquees join the page flow so they never sit on top of the form. */
  .marquee { position: static; padding: 12px 0; }
  .marquee--top { margin-bottom: -44px; }

  .badge { position: absolute; }
}

@media (max-width: 767px) {
  :root { --badge-size: 84px; }

  .page { padding-top: 100px; }
  .layout { gap: 40px; }
  .intro { gap: 16px; }

  /* Logo and copy sit inset and centred; the form keeps the full width. */
  .intro {
    padding: 0 24px;
    align-items: center;
    text-align: center;
  }
  .logo { width: min(100%, 280px); }
  .intro__copy { font-size: 20px; }

  /* Shorter message box keeps at least half the form above the fold. */
  .field textarea { height: 150px; }
}

@media (max-width: 479px) {
  .fields__row { flex-direction: column; gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track, .badge__star { animation: none; }

  /* Swap faces with a quick fade instead of a 3D turn. */
  .card__inner { transition: none; }
  .card.is-flipped .card__inner { transform: none; }
  .card__face { transition: opacity 0.3s; }
  .card__back { transform: none; opacity: 0; }
  .card.is-flipped .card__front { opacity: 0; }
  .card.is-flipped .card__back { opacity: 1; }
}

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