/* HAQZED. A split-flap board in a dark hall, letters turned over once. */

@font-face { font-family: "Overpass Mono"; src: url("fonts/overpass-mono-latin.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Overpass"; src: url("fonts/overpass-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --hall: #1B1E20;
  --hall-2: #23272A;
  --board: #14171A;
  --tile: #2B3034;
  --tile-2: #333A3F;
  --tile-line: #0E1012;
  --letters: #F1EDE3;
  --amber: #E0A526;
  --on-dark: #EDEAE2;
  --on-dark-muted: #A7AAA6;
  --ink: #1B1E20;
  --muted: #5C605E;
  --line: rgba(27, 30, 32, 0.18);
  --paper: #ECE8DF;
  --paper-2: #E3DED3;
  --error: #A3141B;
  --error-light: #FFC2B8;

  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: "Overpass", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--hall);
  color: var(--on-dark);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd { margin: 0; }
h1, h2 { font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
a { color: inherit; }

.wrap { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: clamp(20px, 5vw, 48px); }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; top: 12px; left: 12px; z-index: 10; padding: 10px 14px; background: var(--amber); color: var(--hall); border-radius: 3px; transform: translateY(-160%); }
.skip:focus { transform: none; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

/* ---------- bar ---------- */
.bar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px; }
.brand { font-family: var(--mono); font-weight: 700; font-size: 1.25rem; line-height: 1; letter-spacing: 0.16em; text-decoration: none; color: var(--on-dark); }
.bar-go { font-size: 1rem; font-weight: 600; text-underline-offset: 4px; text-decoration-thickness: 2px; color: var(--amber); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(8px, 3vh, 32px) clamp(64px, 10vh, 112px); }
.hero-text { max-width: 44rem; margin: clamp(36px, 6vh, 56px) auto 0; text-align: center; }

/* the board */
.board {
  max-width: 46rem;
  margin-inline: auto;
  padding: clamp(14px, 2.6vw, 26px);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--hall-2), var(--board));
  box-shadow: 0 36px 60px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(255, 255, 255, 0.04);
  container-type: inline-size;
}
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.6cqw; }

.tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 3cqw;
  background: var(--tile);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1cqw 0 #0A0C0D;
  perspective: 300px;
  overflow: hidden;
}
.tile .top,
.tile .bot,
.tile .flap {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14cqw;
  line-height: 1;
  color: var(--letters);
  background: linear-gradient(180deg, var(--tile-2), var(--tile) 90%);
}
.tile .top { top: 0; border-radius: 3cqw 3cqw 0 0; clip-path: inset(0 0 0 0); }
.tile .bot { bottom: 0; border-radius: 0 0 3cqw 3cqw; background: linear-gradient(180deg, var(--tile), #25292D); }
.tile .flap {
  top: 0;
  z-index: 2;
  border-radius: 3cqw 3cqw 0 0;
  transform-origin: 50% 100%;
  background: linear-gradient(180deg, var(--tile-2), var(--tile) 90%);
  backface-visibility: hidden;
}
/* the seam across the middle of every tile */
.tile::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 1px);
  height: 2px;
  z-index: 3;
  background: var(--tile-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* One motion: each tile turns over once, left to right. */
.js .tile .flap { animation: turn 0.34s cubic-bezier(.5, 0, .7, 1) both; }
.js .tile:nth-child(1) .flap { animation-delay: 0.25s; }
.js .tile:nth-child(2) .flap { animation-delay: 0.45s; }
.js .tile:nth-child(3) .flap { animation-delay: 0.65s; }
.js .tile:nth-child(4) .flap { animation-delay: 0.85s; }
.js .tile:nth-child(5) .flap { animation-delay: 1.05s; }
.js .tile:nth-child(6) .flap { animation-delay: 1.25s; }
@keyframes turn {
  0% { transform: rotateX(0); }
  100% { transform: rotateX(-180deg); }
}

.hero h1 { font-size: clamp(1.625rem, 1rem + 2.1vw, 2.625rem); line-height: 1.15; color: var(--on-dark); }
.hero .lede { margin-top: 16px; max-width: 32rem; margin-inline: auto; font-size: 1.1875rem; line-height: 1.5; color: var(--on-dark-muted); }
.hero .join { margin-top: 30px; margin-inline: auto; max-width: 32rem; }

/* ---------- form ---------- */
.row { display: flex; gap: 8px; }
.field {
  flex: 1 1 auto; min-width: 0; height: 54px; padding: 0 16px;
  font: inherit; font-size: 1.0625rem; color: var(--ink);
  background: var(--paper); border: 2px solid transparent; border-radius: 3px;
}
.field::placeholder { color: #636764; }
.field:focus-visible { outline-offset: 2px; }
.field[aria-invalid="true"] { border-color: var(--error); }
.btn {
  flex: none; height: 54px; padding: 0 22px;
  font: inherit; font-size: 1rem; font-weight: 600;
  color: var(--hall); background: var(--amber); border: 0; border-radius: 3px; cursor: pointer;
}
.btn:hover { background: #F2B63A; }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: progress; opacity: 0.8; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.fine { margin-top: 14px; font-size: 0.9375rem; color: var(--on-dark-muted); }
.oops { margin-top: 10px; font-size: 0.9375rem; font-weight: 600; color: var(--error-light); }
.oops:empty { display: none; }
.nojs { display: none; margin-top: 8px; font-size: 0.9375rem; font-weight: 600; color: var(--error-light); }
html:not(.js) .nojs { display: block; }
.done-line { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.125rem; }
.done-line b { font-weight: 600; }
.tick { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--amber); stroke-width: 1.8; }
.tick path { stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.again { padding: 0; font: inherit; color: inherit; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.when-joined { display: none; }
.is-joined .when-open { display: none; }
.is-joined .when-joined { display: inline; }

/* ---------- facts and questions: paper ---------- */
.band { padding-block: clamp(72px, 11vw, 136px); background: var(--paper); color: var(--ink); }
#facts { background: var(--paper-2); }
.band h2 { font-size: clamp(1.5rem, 1rem + 1.4vw, 2.125rem); line-height: 1.15; }
.cols { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 40rem); justify-content: space-between; gap: 40px; }

.facts { border-top: 2px solid var(--ink); }
.fact { display: grid; grid-template-columns: 8.5rem 1fr; gap: 16px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.fact dt { font-family: var(--mono); font-size: 0.875rem; color: var(--muted); padding-top: 2px; }
.fact dd { font-weight: 600; }

.qs { border-top: 2px solid var(--ink); }
.q { border-bottom: 1px solid var(--line); }
.q summary { position: relative; padding: 20px 44px 20px 0; font-weight: 600; cursor: pointer; list-style: none; }
.q summary::-webkit-details-marker { display: none; }
.q summary::before, .q summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 16px; height: 2px; background: var(--ink); transition: transform 0.2s ease; }
.q summary::after { transform: rotate(90deg); }
.q[open] summary::after { transform: rotate(0deg); }
.q p { padding-bottom: 22px; max-width: 36rem; color: var(--muted); }

/* ---------- close ---------- */
.close { padding-block: clamp(80px, 12vw, 144px); background: var(--board); color: var(--on-dark); }
.close-in { text-align: center; display: grid; justify-items: center; }
.close h2 { color: var(--on-dark); font-size: clamp(1.5rem, 1rem + 1.4vw, 2.125rem); line-height: 1.15; max-width: 20em; }
.close .lede { color: var(--on-dark-muted); }
.close .join { margin-top: 32px; width: min(100%, 32rem); }
.close .field { color: var(--ink); background: var(--paper); }
.close .fine { color: var(--on-dark-muted); }
.close .oops, .close .nojs { color: var(--error-light); }
.close :focus-visible { outline-color: var(--amber); }

.foot { background: var(--board); color: var(--on-dark-muted); font-size: 0.9375rem; }
.foot-in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; padding-block: 26px 34px; border-top: 1px solid rgba(237, 234, 226, 0.12); }
.foot .brand-name { font-family: var(--mono); font-weight: 700; letter-spacing: 0.16em; color: var(--on-dark); }
.foot a { text-underline-offset: 3px; }

/* ---------- smaller screens ---------- */
@media (max-width: 860px) {
  .cols { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 460px) {
  .row { flex-direction: column; }
  .btn { width: 100%; }
  .hero h1 { font-size: 1.5rem; }
  .hero .lede { font-size: 1.0625rem; }
  .fact { grid-template-columns: 6.5rem 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .tile .flap { animation: none; transform: rotateX(-180deg); }
  .q summary::before, .q summary::after { transition: none; }
  .btn:active { transform: none; }
}
