/* Motion: everything that moves. Without scripts, or with reduced motion, everything is
   simply there in its final place. */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

html, body { overflow-x: clip; }

/* Film grain over everything, very faint. */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 300;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -2%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Header: stays at the top, steps aside while scrolling down, back on the way up. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  transition: transform 0.5s var(--ease-out), border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header.away { transform: translateY(-100%); }

.brand img { transition: transform 0.6s var(--ease-out); }
.brand:hover img { transform: rotate(-12deg) scale(1.08); }

.site-nav a { position: relative; }
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.site-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* Words that rise out of a mask, one after another. */
.split-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.split-word > span { display: inline-block; }
html.js .split .split-word > span { transform: translateY(105%); }
html.js .split.in .split-word > span {
  transform: none;
  transition: transform 1s var(--ease-out);
  transition-delay: calc(var(--i) * 70ms + var(--delay, 0ms));
}

/* Anything that fades up as it comes into view. */
html.js .reveal { opacity: 0; transform: translateY(28px); }
html.js .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

/* ---------------------------------------------------------------- Hero */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 24px;
  min-height: min(78vh, 720px);
  padding: 56px 0 40px;
}
.hero-copy h1 { margin-bottom: 22px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.hero-tags span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* The stage: a field of pixels that keeps forming game shapes (the logo, a gamepad, a d-pad,
   a heart, a cube) and scatters from the pointer. */
.stage {
  position: relative;
  height: 460px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s;
}
html.js .stage { opacity: 0; transition: opacity 1.2s var(--ease-out) 0.3s; }
html.js .stage.in { opacity: 1; }

/* ---------------------------------------------------------------- Marquee */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  margin: 24px 0 88px;
  user-select: none;
}
.marquee-row { display: flex; width: max-content; will-change: transform; }
.marquee-row + .marquee-row { margin-top: 6px; }
.marquee-row span {
  font-size: clamp(36px, 7vw, 84px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  white-space: nowrap;
  padding-right: 0.5em;
}
.marquee-row.outline span { color: transparent; -webkit-text-stroke: 1.5px var(--fg); }
.marquee-row span i { font-style: normal; display: inline-block; transform: translateY(-0.08em); padding: 0 0.15em; }

/* ---------------------------------------------------------------- Tabs and cards */

.tabs { position: relative; }
.tabs button { position: relative; z-index: 1; transition: color 0.35s var(--ease-out); }
.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--fg);
  transition: transform 0.55s var(--ease-out), width 0.55s var(--ease-out);
}
html.js .tabs.ready button[aria-selected="true"] { background: transparent; }

html.js .panel:not([hidden]) { animation: panel-in 0.7s var(--ease-out); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.game {
  position: relative;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.5s var(--ease-out), border-color 0.3s;
  transform-style: preserve-3d;
  overflow: hidden;
}
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), color-mix(in srgb, var(--fg) 7%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}
.game:hover { border-color: var(--fg); }
.game:hover::before { opacity: 1; }
.game-top img { transition: filter 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
/* With a mouse, icons wait in grey and take their color on hover; on touch they show it. */
@media (hover: hover) and (pointer: fine) {
  .game-top img { filter: grayscale(1) contrast(1.1); }
  .game:hover .game-top img { filter: none; transform: scale(1.06) rotate(-4deg); }
}

/* Buttons drift toward the pointer. */
.magnetic { transition: transform 0.5s var(--ease-out), background 0.3s, color 0.3s, border-color 0.3s; }
.pill:not(.solid):hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ---------------------------------------------------------------- Principles */

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 112px; border-top: 1px solid var(--line); }
.principles li { list-style: none; padding: 28px 24px 8px 0; }
.principles li + li { padding-left: 24px; border-left: 1px solid var(--line); }
.principles .num { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; }
.principles h3 { font-size: 26px; margin: 10px 0 8px; }
.principles p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.principles { padding: 0; }

/* ---------------------------------------------------------------- Footer */

.big-footer { margin-top: 128px; border-top: 1px solid var(--line); padding: 64px 0 32px; overflow: hidden; }
.big-footer .cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.big-footer .cta h2 { font-size: clamp(32px, 5vw, 56px); margin: 0; max-width: 620px; }
.round-button {
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  line-height: 1.25;
  flex: none;
}
.wordmark {
  margin: 72px 0 0;
  font-size: min(12.8vw, 140px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.85;
  white-space: nowrap;
}
.wordmark .split-word { padding-bottom: 0.12em; }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 28px; color: var(--muted); font-size: 14px; }
.footer-meta nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-meta a { color: var(--muted); }

/* ---------------------------------------------------------------- Phones */

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 40px 0 8px; }
  .stage { height: 340px; }
  .principles { grid-template-columns: 1fr; }
  .principles li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .round-button { width: 120px; height: 120px; font-size: 15px; }
}

/* ---------------------------------------------------------------- Calm */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.js .split .split-word > span, html.js .reveal, html.js .stage { opacity: 1 !important; transform: none !important; }
  .site-header.away { transform: none; }
}

/* ---------------------------------------------------------------- Studio */

.studio { margin-top: 128px; }
.studio-head h2 { font-size: clamp(32px, 5.4vw, 60px); margin: 12px 0 0; max-width: 820px; }
.studio .principles { margin-top: 48px; }

@media (max-width: 440px) {
  .site-nav .nav-extra { display: none; }
}

.section-label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- Intro */

/* Covers the page from the very first paint until the intro takes over. */
html.intro-on:not(.intro-ready)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--fg);
}
html.intro-on body { overflow: hidden; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1);
}
/* The curved edge it lifts away with. */
.intro::after {
  content: "";
  position: absolute;
  left: -15%;
  right: -15%;
  top: calc(100% - 1px);
  height: 16vh;
  background: var(--fg);
  border-radius: 0 0 50% 50%;
}
.intro.lift { transform: translateY(calc(-100% - 16vh)); }
.intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro canvas, .intro p { transition: opacity 0.35s ease, transform 0.8s cubic-bezier(0.76, 0, 0.24, 1); }
.intro.lift canvas, .intro.lift p { opacity: 0; transform: translateY(-40px); }

.intro-word {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + min(15vh, 130px));
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 3.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.intro-word .split-word > span { transform: translateY(105%); }
.intro-word.in .split-word > span {
  transform: none;
  transition: transform 0.8s var(--ease-out);
  transition-delay: calc(var(--i) * 28ms);
}
.intro-count {
  position: absolute;
  right: 24px;
  bottom: 16px;
  margin: 0;
  font-size: clamp(56px, 11vw, 136px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
