/*
  blastomino.com - the game's own site.

  It wears the game's home screen, Neon Marquee: a purple sky with scanlines,
  a cyan grid running to the horizon, the block-letter title and pill buttons
  in the seven piece colours. Always dark, like the game - there is no light
  version of Blastomino to match.

  No web fonts: the game's buttons are the system face at its heaviest, widely
  tracked, and so is everything here.
*/

:root {
  color-scheme: dark;

  /* The Neon theme's piece colours, from the game's constants.ts. */
  --cyan: #22d3ee;
  --amber: #fbbf24;
  --purple: #a855f7;
  --green: #4ade80;
  --red: #f87171;
  --blue: #60a5fa;
  --orange: #fb923c;

  --ground: #0b0e1a;
  --board: #111527;
  --line: #1c2238;
  --wall: #2a3357;
  --sky-top: #2b1a4a;
  --sky-low: #1a1233;
  --ink: #e2e8f0;
  --dim: #a3aec2;
  --on-pill: #0b0e1a;
  --trajectory: #7dd3fc;

  --face: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 72rem;
  --gutter: 1rem;
}

* { box-sizing: border-box; }

/* challenge.js shows and hides by the attribute, and a pill's display would beat it. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.6 var(--face);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

img, video, svg { max-width: 100%; display: block; }
a { color: var(--cyan); }
a:hover { color: #67e8f9; }
p { margin: 0 0 1rem; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
@media (min-width: 640px) {
  :root { --gutter: 1.5rem; }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: .5rem;
  background: var(--cyan);
  color: var(--on-pill);
  padding: .5rem 1rem;
  border-radius: 999px;
  z-index: 10;
  font-weight: 800;
}
.skip-link:focus { left: .5rem; }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- header */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 14, 26, .82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .95rem;
}
.brand img { width: 2rem; height: 2rem; border-radius: .5rem; }
.brand:hover { color: var(--ink); }
.top nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.top nav a:not(.pill) {
  color: var(--dim);
  text-decoration: none;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .06em;
}
.top nav a:not(.pill):hover { color: var(--ink); }
/* On a phone the header keeps the brand and the one button that matters. */
@media (max-width: 719px) {
  .top nav a:not(.pill) { display: none; }
}

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 3rem;
  padding: .7rem 1.6rem;
  border-radius: 999px;
  border: 0;
  background: var(--pill, var(--cyan));
  color: var(--on-pill);
  font: 900 .95rem/1.1 var(--face);
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /* The game's buttons have a lit top edge and sit on a soft shadow. */
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .35),
    0 10px 24px -8px var(--pill, var(--cyan));
  transition: transform .12s ease, filter .12s ease;
}
.pill:hover { color: var(--on-pill); filter: brightness(1.08); transform: translateY(-1px); }
.pill:active { transform: translateY(1px); }
.pill.is-small { min-height: 2.4rem; padding: .45rem 1.1rem; font-size: .78rem; }
.pill.is-huge {
  min-height: 4.75rem;
  padding: 1rem 2.4rem;
  font-size: clamp(1.05rem, 3.6vw, 1.45rem);
  letter-spacing: .18em;
  width: min(100%, 34rem);
}
@media (max-width: 479px) {
  /* One line on a phone: PLAY IN YOUR BROWSER at full tracking wraps under 400px. */
  .pill.is-huge { padding: 1rem 1.1rem; letter-spacing: .1em; font-size: 1rem; min-height: 4rem; }
}
.pill.is-amber { --pill: var(--amber); }
.pill.is-purple { --pill: var(--purple); }
.pill.is-green { --pill: var(--green); }
.pill .arrow { font-size: 1.2em; line-height: 1; }
/* The two pills under the big one: side by side where they fit, stacked where they do not. */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  text-align: center;
}
/* The sky ends where the floor begins, so the horizon is one line whatever the width. */
.sky {
  padding: clamp(3rem, 9vw, 6rem) 0 clamp(2rem, 6vw, 3.5rem);
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 3px, transparent 3px 7px),
    linear-gradient(to bottom, var(--sky-top), var(--sky-low));
}
.hero .wordmark {
  width: min(100%, 46rem);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, .25));
}
.hero h1 {
  /* The title is the wordmark; the words are for screen readers and search. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.hero .tagline {
  margin: 1.1rem 0 0;
  color: #b6a9d6;
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  letter-spacing: .04em;
}

/* The floor: a grid in perspective, running to the horizon. */
.floor {
  position: relative;
  height: clamp(9rem, 26vw, 15rem);
  overflow: hidden;
  perspective: 22rem;
  perspective-origin: 50% 0;
  pointer-events: none;
}
.floor::before {
  content: "";
  position: absolute;
  left: -60%;
  right: -60%;
  top: 0;
  height: 300%;
  transform-origin: 50% 0;
  transform: rotateX(62deg);
  background-image:
    linear-gradient(to right, rgba(125, 211, 252, .45) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(125, 211, 252, .45) 2px, transparent 2px);
  background-size: 3.5rem 3.5rem;
  background-position: center top;
  animation: run 2.4s linear infinite;
}
.floor::after {
  /* The horizon glow, and a fade so the grid melts into the page below. */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 40% at 50% 0, rgba(125, 211, 252, .35), transparent 70%),
    linear-gradient(to bottom, transparent 15%, var(--ground) 80%);
}
@keyframes run {
  from { background-position: center 0; }
  to { background-position: center 3.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .floor::before { animation: none; }
}

.hero-actions {
  position: relative;
  z-index: 1;
  margin-top: clamp(-6rem, -12vw, -3rem);
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.hero-actions .note {
  margin: .25rem 0 0;
  color: var(--dim);
  font-size: .95rem;
  max-width: 34rem;
  text-shadow: 0 0 6px var(--ground), 0 0 12px var(--ground);
}

/* ---------------------------------------------------------------- sections */

.section { padding: clamp(3rem, 8vw, 5.5rem) 0; }
/* Clear of the sticky header when the nav jumps to one. */
.section[id] { scroll-margin-top: 3.5rem; }
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  margin: 0 0 .6rem;
  color: var(--accent, var(--cyan));
  font-weight: 900;
  font-size: .8rem;
  letter-spacing: .24em;
  text-transform: uppercase;
}
h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -.01em;
}
h3 {
  margin: 0 0 .4rem;
  font-size: 1.1rem;
  font-weight: 800;
}
.lead {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: #cbd5e1;
  max-width: 44rem;
}
.intro { margin-bottom: clamp(2rem, 5vw, 3rem); }

/* ---------------------------------------------------------------- replays */

.replays {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  grid-template-columns: 1fr;
}
/* Three replays: a column on a phone, a row anywhere wider - never two and a straggler. */
@media (min-width: 640px) { .replays { grid-template-columns: repeat(3, 1fr); } }
.replays figure { margin: 0; }
.replays figcaption { margin-top: 1rem; }
.replays figcaption b {
  display: block;
  font-size: 1.05rem;
  letter-spacing: .02em;
}
.replays figcaption span { color: var(--dim); font-size: .95rem; }

/* A phone, roughly: the replays are recorded straight off one. */
.phone {
  position: relative;
  max-width: 21rem;
  margin: 0 auto;
  border-radius: 2rem;
  padding: .55rem;
  background: linear-gradient(145deg, #2a3357, #151a2e);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .06),
    0 30px 60px -20px rgba(0, 0, 0, .8),
    0 0 50px -10px var(--glow, rgba(34, 211, 238, .35));
}
.phone video, .phone img {
  width: 100%;
  height: auto;
  border-radius: 1.5rem;
  background: var(--board);
}

/* ---------------------------------------------------------------- how */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  counter-reset: step;
}
/* Four steps: one column, then two by two, then a row - never three and a straggler. */
@media (min-width: 560px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li {
  counter-increment: step;
  background: var(--board);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 1rem;
  padding: 1.4rem 1.4rem 1.2rem;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: .8rem;
  border-radius: .55rem;
  background: var(--accent);
  color: var(--on-pill);
  font-weight: 900;
}
.steps p { color: var(--dim); margin: 0; }

.shots {
  list-style: none;
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}
.shots figure { margin: 0; }
.shots img {
  width: 100%;
  height: auto;
  border-radius: 1rem;
  border: 1px solid var(--line);
}
.shots figcaption { margin-top: .7rem; color: var(--dim); font-size: .92rem; }

/* ---------------------------------------------------------------- modes */

.modes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.modes li {
  position: relative;
  background: var(--board);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.4rem;
  overflow: hidden;
}
.modes li::before {
  /* One block of the mode's colour in the corner, like a piece. */
  content: "";
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: .25rem;
  background: var(--accent);
  box-shadow: 1.25rem 0 0 var(--accent), 0 1.25rem 0 var(--accent);
  opacity: .9;
}
.modes h3 { color: var(--accent); padding-right: 3.5rem; }
.modes p { color: var(--dim); margin: 0; }

/* ---------------------------------------------------------------- themes */

.themes {
  list-style: none;
  margin: 0;
  padding: 0 0 1rem;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(9.5rem, 12rem);
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.themes li { scroll-snap-align: start; }
.themes figure { margin: 0; }
.themes img {
  width: 100%;
  height: auto;
  border-radius: .9rem;
  border: 1px solid var(--line);
}
.themes figcaption { margin-top: .6rem; font-size: .9rem; color: var(--dim); }
.themes figcaption b { display: block; color: var(--ink); }

.tiers {
  list-style: none;
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.tiers li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  align-items: center;
  background: var(--board);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}
.tiers img { width: 4.5rem; height: 4.5rem; }
.tiers h3 { margin: 0 0 .2rem; }
.tiers p { margin: 0; color: var(--dim); font-size: .92rem; }

.promise {
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  padding: 0;
  list-style: none;
}
.promise li {
  border: 1px solid var(--wall);
  border-radius: 999px;
  padding: .35rem .9rem;
  font-size: .9rem;
  font-weight: 700;
  color: #cbd5e1;
}

/* ---------------------------------------------------------------- final call */

.again {
  text-align: center;
  background:
    radial-gradient(50% 60% at 50% 100%, rgba(168, 85, 247, .25), transparent 70%);
}
.again .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}
.again .lead { margin: 0 auto; }

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

.foot {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 3rem;
  color: var(--dim);
  font-size: .92rem;
}
.foot .wrap {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 720px) {
  .foot .wrap { grid-template-columns: 1fr auto; align-items: start; }
}
.maker {
  display: flex;
  gap: .9rem;
  align-items: center;
}
.maker p { margin: 0; }
.maker strong { color: var(--ink); }
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.25rem;
}
.foot nav a { color: var(--dim); }
.foot nav a:hover { color: var(--ink); }
.foot small { display: block; margin-top: .4rem; }

/* ---------------------------------------------------------------- challenge page */

.challenge {
  text-align: center;
  padding: clamp(3rem, 9vw, 5rem) 0 clamp(2.5rem, 6vw, 4rem);
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 3px, transparent 3px 7px),
    linear-gradient(to bottom, var(--sky-top), var(--sky-low) 80%, var(--ground));
}
.challenge h1 {
  margin: 0 auto .6rem;
  max-width: 44rem;
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  line-height: 1.12;
  font-weight: 900;
}
.challenge #challenge-score { color: var(--amber); }
.challenge .tagline { color: #b6a9d6; font-size: 1.15rem; margin-bottom: 2rem; }
.challenge .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.challenge .note { color: var(--dim); font-size: .92rem; margin-top: 1rem; }

.specs {
  margin: 0;
  display: grid;
  gap: 1px;
  /* Six facts: two columns or three, so no row is left with a hole in it. */
  grid-template-columns: repeat(2, 1fr);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 1rem;
  overflow: hidden;
}
@media (min-width: 720px) { .specs { grid-template-columns: repeat(3, 1fr); } }
.specs div { background: var(--board); padding: 1rem 1.2rem; }
.specs dt {
  color: var(--dim);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.specs dd { margin: .25rem 0 0; font-weight: 700; overflow-wrap: anywhere; }

.prose { max-width: 44rem; }
.prose h2 { font-size: 1.4rem; margin-top: 2.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: #cbd5e1; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  overflow-wrap: anywhere;
  color: var(--trajectory);
}
