/* dreamblock.net: the home page, the legal pages and the 404, in the game's design (Slab, at night).
   Every page links this one stylesheet; the CSP allows nothing inline. */

@font-face {
  font-family: "Silkscreen";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/silkscreen-bold.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/space-grotesk.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
  --accent: #52d06c;
  --on-accent: #07210f;
  --outline: #03060a;
  --raised: #141c24;
  --text: #e6edf3;
  --text-dim: #9aa6b2;
  --text-faint: #66737f;
  --lit: rgb(230 237 243 / 0.07);
  --card: linear-gradient(180deg, color-mix(in oklab, #141c24 70%, #0e141a), #0e141a);
  --night: radial-gradient(70% 62% at 50% 48%, #111a22, #0b1015 64%, #080c10);
  --font-pixel: "Silkscreen", monospace;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: #080c10;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night) fixed;
  color: var(--text);
  font: 400 16px / 1.55 var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ───────────── Wordmark ───────────── */

.wordmark {
  position: relative;
  display: inline-block;
  margin: 0;
  font: 700 var(--wordmark-size, 40px) / 1 var(--font-pixel);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 var(--outline);
  text-decoration: none;
}
/* BETA hangs off the wordmark's top right, so the word itself stays centred. */
.beta {
  position: absolute;
  left: 100%;
  top: 0;
  translate: -10px -70%;
  /* Letter-spacing trails the last letter too, so the right side gives that much back. */
  padding: 3px calc(6px - 0.16em) 2px 6px;
  font: 500 10px / 1.2 var(--font-mono);
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-shadow: none;
  background: var(--card);
  box-shadow:
    inset 0 1px 0 var(--lit),
    0 0 0 1px var(--outline);
}

/* ───────────── Keys: the game's buttons ───────────── */

.key {
  --side: color-mix(in oklab, var(--raised) 55%, black);
  --bg: linear-gradient(180deg, color-mix(in oklab, var(--raised), white 6%), var(--raised));
  --key-lit: rgb(230 237 243 / 0.1);
  --hover: rgb(230 237 243 / 0.04);
  --press: rgb(0 0 0 / 0.12);
  --depth: 4px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  min-width: 212px;
  margin-bottom: var(--depth);
  padding: 0 calc(22px - 0.08em) 0 22px;
  border: 1px solid var(--outline);
  border-bottom-color: var(--side);
  background: var(--bg);
  color: var(--text);
  font: 700 12px / 1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow:
    inset 0 1px 0 var(--key-lit),
    inset 0 -2px 0 rgb(0 0 0 / 0.16),
    0 var(--depth) 0 -1px var(--side),
    0 var(--depth) 0 0 var(--outline);
  transition:
    translate 220ms cubic-bezier(0.3, 1.6, 0.5, 1),
    box-shadow 220ms cubic-bezier(0.3, 1.6, 0.5, 1);
}
.key--primary {
  --side: color-mix(in oklab, var(--accent) 62%, black);
  --bg: linear-gradient(180deg, color-mix(in oklab, var(--accent), white 12%), var(--accent));
  --key-lit: rgb(255 255 255 / 0.42);
  --hover: rgb(255 255 255 / 0.1);
  --press: rgb(0 0 0 / 0.06);
  color: var(--on-accent);
}
.key::before,
.key::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
}
.key::before {
  background: var(--hover);
  transition: opacity 100ms ease-out;
}
.key::after {
  background: var(--press);
}
.key:hover::before {
  opacity: 1;
  transition-duration: 0s;
}
/* Pressed: the cap goes down into its side. */
.key:active {
  translate: 0 var(--depth);
  box-shadow:
    inset 0 1px 0 var(--key-lit),
    inset 0 -2px 0 rgb(0 0 0 / 0.16),
    0 0 0 -1px var(--side),
    0 0 0 0 var(--outline);
  transition-duration: 60ms;
  transition-timing-function: ease-out;
}
.key:active::after {
  opacity: 1;
}
.key svg {
  flex: none;
  display: block;
}

/* ───────────── Home ───────────── */

.home {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  justify-items: center;
  gap: 2vh;
  padding: calc(env(safe-area-inset-top) + 7vh) 24px calc(env(safe-area-inset-bottom) + 22px);
  overflow: hidden;
  overscroll-behavior: none;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}
.home .wordmark {
  --wordmark-size: clamp(30px, 4.2vw, 58px);
}
.head {
  position: relative;
  z-index: 1;
}
.tag {
  margin: 14px 0 0;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.45;
  color: var(--text-dim);
}
.world {
  position: relative;
  width: 100%;
  min-height: 0;
}
.world canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  margin-bottom: 3.5vh;
}
/* The keys wait for the WebGPU check (a few milliseconds), then fade in. */
.actions.ready > * {
  animation: arrive 240ms ease-out both;
}
@keyframes arrive {
  from {
    opacity: 0;
    translate: 0 4px;
  }
}
.keys {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.keys:empty {
  display: none;
}
.also {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font: 500 10.5px / 1.4 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.also i {
  font-style: normal;
  opacity: 0.6;
}
.also a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 2px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 150ms ease;
}
.also a:hover {
  color: var(--text);
}
.also svg {
  scale: 0.8;
}
/* Why there's no Play now: plain words in the tagline's face, quieter than the tagline. */
.note {
  max-width: 36em;
  margin: 0;
  font: 400 14px / 1.5 var(--font-body);
  color: var(--text-dim);
  text-align: center;
  text-wrap: balance;
}
.foot {
  display: flex;
  justify-content: center;
  gap: 22px;
}
.foot a {
  font: 400 11px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-decoration: none;
  transition: color 150ms ease;
}
.foot a:hover {
  color: var(--text);
}

/* A few lit pixels for stars. */
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.stars b {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--c);
  box-shadow: 0 0 10px var(--c);
  animation: twinkle 3.6s var(--d) infinite ease-in-out;
}
.stars b:nth-child(1) {
  --c: #52d06c;
  --d: 0s;
  left: 4.7%;
  top: 34.7%;
}
.stars b:nth-child(2) {
  --c: #f2d14b;
  --d: 0.9s;
  left: 92.2%;
  top: 11.1%;
}
.stars b:nth-child(3) {
  --c: #52d06c;
  --d: 1.8s;
  left: 94.8%;
  top: 65.3%;
}
.stars b:nth-child(4) {
  --c: #7cc7e8;
  --d: 2.7s;
  left: 7%;
  top: 86.1%;
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.25;
    scale: 0.7;
  }
  45% {
    opacity: 1;
    scale: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stars b {
    animation: none;
    opacity: 0.7;
  }
}

/* Phones: full-width keys, stacked. */
@media (max-width: 640px) {
  .home {
    padding-top: calc(env(safe-area-inset-top) + 9vh);
  }
  .home .wordmark {
    --wordmark-size: 31px;
  }
  .actions {
    align-self: stretch;
    justify-self: stretch;
  }
  .keys {
    flex-direction: column;
    align-self: stretch;
  }
  .key {
    width: 100%;
    min-width: 0;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .home {
    padding-top: calc(env(safe-area-inset-top) + 20px);
  }
  .actions {
    margin-bottom: 0;
  }
}

/* ───────────── Legal pages and the 404 ───────────── */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 40px) 24px calc(env(safe-area-inset-bottom) + 48px);
}
.page > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 56px;
}
.page > header .wordmark {
  --wordmark-size: 22px;
  text-shadow: none;
}
.page > header .wordmark .beta {
  display: none;
}
.page > header nav {
  display: flex;
  gap: 20px;
}
.page > header nav a,
.page > footer a {
  font: 400 11px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-decoration: none;
}
.page > header nav a:hover,
.page > footer a:hover,
.page > header nav a[aria-current="page"] {
  color: var(--text);
}
.page h1 {
  margin: 0;
  font: 700 clamp(26px, 5vw, 34px) / 1.15 var(--font-pixel);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 var(--outline);
}
.page .updated {
  margin: 12px 0 40px;
  font: 500 11px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.page h2 {
  margin: 40px 0 12px;
  font: 700 13px / 1.4 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.page p,
.page li {
  color: var(--text-dim);
}
.page p {
  margin: 0 0 14px;
}
.page ul {
  margin: 0 0 14px;
  padding-left: 1.2em;
}
.page li {
  margin-bottom: 6px;
}
.page li::marker {
  color: var(--text-faint);
}
.page strong {
  color: var(--text);
  font-weight: 600;
}
.page main a {
  color: var(--text);
  text-decoration-color: color-mix(in oklab, var(--accent) 70%, transparent);
  text-underline-offset: 3px;
}
.page > footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--outline);
  box-shadow: inset 0 1px 0 var(--lit);
  display: flex;
  gap: 22px;
}

.lost {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
.lost .wordmark {
  --wordmark-size: clamp(30px, 6vw, 44px);
}
.lost p {
  margin: 0 0 14px;
  color: var(--text-dim);
}
