/* JumbleVolt Games
   Palette: deep indigo, volt yellow, cool white, with shock pink and arc cyan in small doses.
   Type: Archivo, one variable family. Width and weight do the work:
   wide heavy italics for display, normal width for reading. */

:root {
  --base: #1a1147;
  --deep: #0e0930;
  --volt: #ffe01a;
  --paper: #f4f1ff;
  --shock: #ff3d7f;
  --arc: #3ddcff;

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pad: clamp(20px, 5vw, 64px);
}

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

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  background: var(--base);
  color: var(--paper);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

/* display type: wide, heavy, slanted */
h2,
.title,
.rule h3,
.lost h1 {
  font-style: italic;
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

h2 { font-size: clamp(2.2rem, 5.4vw, 4.4rem); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--volt);
  color: var(--deep);
}
.skip:focus { top: 12px; }

/* ---------- top: nav + hero ---------- */

.top {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 78% 8%, #2f1c7a 0%, transparent 60%),
    var(--base);
  color: var(--paper);
}

/* the zap: a flash across the whole hero when the letters snap home */
.top::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.top.zap::after { animation: flash 0.4s ease-out; }
@keyframes flash {
  0% { opacity: 0; }
  10% { opacity: 0.5; }
  24% { opacity: 0.05; }
  36% { opacity: 0.3; }
  100% { opacity: 0; }
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 22px;
}

.logo { display: block; width: 38px; height: 38px; }
.logo svg { display: block; width: 100%; height: 100%; }

.bar nav {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  font-weight: 600;
  font-size: 1rem;
}
.bar nav a {
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.bar nav a:hover { border-bottom-color: var(--volt); }

.hero {
  padding-block: clamp(28px, 5vw, 64px) clamp(84px, 12vw, 170px);
}

/* The wordmark. Each letter carries its own width, weight, lean and lift so it
   can be thrown out of line and pulled back; see main.js. */
.mark {
  position: relative;
  display: grid;
  font-size: min(15.6vw, 204px);
  font-weight: 900;
  line-height: 0.86;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}
.line {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}
.line.volt { color: var(--volt); }
.mark .ch {
  display: inline-block;
  font-style: italic;
  font-variation-settings: 'wdth' var(--w, 125), 'wght' var(--g, 900);
  transform: translateY(var(--y, 0)) rotate(var(--r, 0deg));
  transition:
    font-variation-settings 0.5s cubic-bezier(0.2, 1.3, 0.4, 1),
    transform 0.5s cubic-bezier(0.2, 1.3, 0.4, 1);
  will-change: transform;
}
.mark.still .ch { transition: none; }
.games {
  margin-left: 0.5em;
  font-size: 0.26em;
  font-style: italic;
  font-weight: 500;
  font-stretch: 125%;
  letter-spacing: 0.02em;
  color: var(--paper);
}

.bolt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
}
.bolt polyline {
  fill: none;
  stroke-linejoin: miter;
}
.bolt-glow { stroke: var(--volt); stroke-width: 12; filter: blur(8px); }
.bolt-core { stroke: #fff; stroke-width: 3; }
.bolt.strike { animation: strike 0.42s linear; }
@keyframes strike {
  0% { opacity: 1; }
  18% { opacity: 0.15; }
  30% { opacity: 1; }
  55% { opacity: 0.5; }
  100% { opacity: 0; }
}

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 34rem) auto;
  align-items: end;
  justify-content: space-between;
  gap: 28px 48px;
  margin-top: clamp(36px, 5vw, 64px);
}

.lede {
  font-size: clamp(1.2rem, 2.1vw, 1.55rem);
  line-height: 1.4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-block;
  padding: 14px 22px;
  font: 700 1rem/1.2 var(--font);
  text-decoration: none;
  color: var(--deep);
  background: var(--volt);
  border: 2px solid var(--volt);
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--paper); border-color: var(--paper); }
.btn-line {
  background: transparent;
  color: var(--paper);
  border-color: rgb(244 241 255 / 0.45);
}
.btn-line:hover { background: transparent; border-color: var(--volt); color: var(--volt); }
.btn-dark {
  background: var(--deep);
  color: var(--paper);
  border-color: var(--deep);
}
.btn-dark:hover { background: var(--base); border-color: var(--base); }

/* ---------- band of game names ---------- */

.band {
  position: relative;
  z-index: 2;
  width: 106vw;
  margin: clamp(-64px, -5vw, -36px) -3vw clamp(-40px, -3vw, -20px);
  padding-block: clamp(10px, 1.3vw, 16px);
  background: var(--volt);
  color: var(--deep);
  transform: rotate(-2.5deg);
  overflow: hidden;
}
.band-track {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 44px);
  width: max-content;
  padding-left: clamp(20px, 3vw, 44px);
  font-style: italic;
  font-weight: 900;
  font-stretch: 125%;
  font-size: clamp(1.3rem, 3vw, 2.5rem);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  will-change: transform;
}
.band-track i {
  flex: none;
  width: 0.5em;
  height: 0.85em;
  background: var(--deep);
  clip-path: polygon(62% 0, 8% 56%, 44% 56%, 30% 100%, 92% 40%, 56% 40%);
}

/* ---------- page colour ----------
   Without scripting each section paints its own colour. With scripting (html.fx)
   the sections go transparent and the page behind them fades from one colour to
   the next as you scroll; see main.js. */

.tint {
  background: var(--bg);
  color: var(--fg);
}
.fx body { transition: color 0.25s; }
.fx .tint {
  background: transparent;
  color: inherit;
}

/* ---------- games ---------- */

.intro { padding-block: clamp(100px, 13vw, 180px) 0; }

.head {
  display: grid;
  grid-template-columns: auto minmax(0, 28rem);
  align-items: end;
  justify-content: space-between;
  gap: 16px 48px;
}
.head p { opacity: 0.85; }

.game {
  display: grid;
  align-items: center;
  min-height: 92vh;
  padding-block: clamp(56px, 8vw, 110px);
  overflow-x: clip;
}

.game-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 36px clamp(36px, 6vw, 88px);
}
.game.flip .art { order: 2; }

.art {
  perspective: 1100px;
  will-change: transform;
}
.frame {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 0.16),
    0 40px 80px -30px rgb(0 0 0 / 0.75);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.frame.is-tilting { transition: transform 0.06s linear; }
.frame img,
.frame svg {
  position: absolute;
  left: 0;
  top: -8%;
  width: 100%;
  height: 116%;
  object-fit: cover;
  will-change: transform;
}
/* a sheen that follows the pointer while the card tilts */
.frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 0.22), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.frame.is-tilting::after { opacity: 1; }

.kind {
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent);
}

.title {
  margin: 10px 0 20px;
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  line-height: 0.95;
}
.title .word { display: inline-block; white-space: nowrap; }
.title .ch { display: inline-block; will-change: transform; }

.copy > p:last-child { max-width: 31rem; opacity: 0.9; }

/* ---------- studio ---------- */

.studio { padding-block: clamp(90px, 12vw, 170px); }

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px clamp(32px, 6vw, 96px);
  align-items: start;
}

.rules { display: grid; gap: 38px; }

.rule {
  padding-left: 24px;
  border-left: 3px solid var(--volt);
}
.rule:nth-child(2) { border-left-color: var(--shock); }
.rule:nth-child(3) { border-left-color: var(--arc); }
.rule h3 {
  margin-bottom: 8px;
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.rule p { max-width: 36rem; opacity: 0.9; }

/* ---------- contact ---------- */

.contact { padding-block: clamp(90px, 11vw, 160px); }
.contact-inner { display: grid; justify-items: start; gap: 20px; }
.contact h2 { max-width: 18ch; }
.contact p { max-width: 38rem; font-weight: 500; }
.contact .btn { margin-top: 10px; }

/* ---------- footer ---------- */

.foot {
  background: var(--deep);
  color: var(--paper);
  padding-block: 28px;
  font-size: 1rem;
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

/* ---------- 404 ---------- */

.lost {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 22px;
}
.lost h1 { font-size: clamp(2.8rem, 10vw, 7rem); color: var(--volt); }
.lost p { max-width: 30rem; font-size: 1.25rem; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .hero-foot,
  .head,
  .studio-grid,
  .game-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-foot { justify-content: start; }
  .game { min-height: 0; }
  .game.flip .art { order: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mark .ch, .frame, .btn { transition: none; }
  .top.zap::after, .bolt.strike { animation: none; }
}
