/* Nuight Cat. Pixel world: everything steps, nothing eases. Faces: Pixelify Sans, VT323 for the address. */
@font-face { font-family: "Pixelify Sans"; src: url(/fonts/pixelify-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url(/fonts/pixelify-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "VT323"; src: url(/fonts/vt323-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
:root {
  --bg: #2A2365; --ink: #E6DFF0; --accent: #F0CE7C; --deep: #171238; --lilac: #D9D0EC; --purple: #7A45D8;
  --font-display: "Pixelify Sans", system-ui, sans-serif; --font-body: "Pixelify Sans", system-ui, sans-serif;
  --container: min(1240px, 100% - 2 * var(--s3));
  --machine-w: clamp(280px, min(35vw, 62svh), 720px);
}
html { background: var(--deep); scroll-behavior: smooth; }
body { font-weight: 500; }
img { image-rendering: pixelated; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }

/* ---- title screen ---- */
.title { position: relative; height: 100svh; min-height: 560px; overflow: hidden; background: var(--bg) url(/img/world/fallback.webp) center / cover no-repeat; image-rendering: pixelated; }
.world { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; }
.world-on .world { opacity: 1; }
.no-3d .world { display: none; }

.mark { position: absolute; left: 4vw; top: clamp(16px, 5svh, 64px); width: min(44vw, 900px); pointer-events: none; }
.logo { width: 100%; height: auto; }
.plate { display: inline-block; margin-top: var(--s1); padding: 20px 32px; background: url(/img/ui/plate.webp) center / 100% 100% no-repeat; image-rendering: pixelated; }
.ticker { font: 700 clamp(28px, 2.3vw, 32px)/1 var(--font-display); color: var(--accent); letter-spacing: .03em;
  }
.line { margin-top: 4px; font-size: clamp(18px, 1.5vw, 26px); line-height: 1.2; color: var(--ink); }

/* the vending machine: art and controls share one box */
.machine { position: absolute; left: clamp(0px, 2vw, 40px); bottom: 0; width: var(--machine-w); aspect-ratio: 720 / 536; container-type: inline-size; }
.machine-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.display { position: absolute; left: 5.5%; top: 33%; width: 89%; height: 18.5%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 0 2cqw; align-items: center; color: var(--accent); }
.address { grid-column: 1; grid-row: 1 / 3; align-self: center; font: 400 clamp(16px, 4.6cqw, 34px)/1.05 "VT323", ui-monospace, monospace; color: var(--accent); opacity: 1; }
.display .key-copy { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: clamp(16px, 3cqw, 20px); min-height: 48px; }
.controls { position: absolute; inset: 0; pointer-events: none; }
.controls > * { pointer-events: auto; }
.buy, .key { display: inline-flex; align-items: center; justify-content: center; gap: .45em; text-decoration: none; border: 0; cursor: pointer; font-family: var(--font-display); font-weight: 700; color: var(--deep);
  transition: transform 40ms steps(1); background-color: transparent; background-repeat: no-repeat; background-size: 100% 100%; image-rendering: pixelated; }
.buy { position: absolute; left: 6%; top: 58.5%; width: 88%; height: 18%; background-image: url(/img/ui/btn.webp); min-height: 48px; padding: 0 1em; font-size: clamp(16px, 5.2cqw, 40px); line-height: 1; text-align: center; }
.buy img { width: 1.2em; height: 1.2em; }
.key { background-image: url(/img/ui/key.webp); min-height: 44px; padding: 0 1em; font-size: clamp(16px, 4.2cqw, 28px); line-height: 1; }
.keys { position: absolute; left: 6%; right: 6%; top: 80.5%; bottom: 3%; display: flex; gap: 2cqw; }
.keys .key { flex: 1 1 0; padding: 0 .4em; min-height: 44px; }
.keys .key:nth-child(1) { flex: 1 1 0; }
.keys .key:nth-child(2) { flex: 0 0 auto; padding: 0 1.15em; white-space: nowrap; }
.keys .key-x { flex: 0 0 clamp(44px, 13cqw, 84px); }
.buy:hover, .key:hover { transform: translateY(-2px); }
.buy:active, .key:active { transform: translateY(2px); }
.buy.is-off { opacity: .8; filter: none; }
.key.is-off { opacity: .6; }
.buy.is-off, .key.is-off { transform: none; }

/* ---- memory card ---- */
.card { background: var(--deep) url(/img/ui/card-plate.webp) center top / 1280px auto; image-rendering: pixelated; padding-block: var(--s6); }
.card h2 { font: 700 clamp(40px, 6vw, 88px)/1 var(--font-display); color: var(--lilac); text-shadow: 4px 4px 0 var(--purple); margin-bottom: var(--s4); }
.blocks { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.block { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; font-family: var(--font-display); font-weight: 700; transition: transform 40ms steps(1); }
.block img { width: 100%; height: auto; aspect-ratio: 1; border: 8px solid transparent; border-image: url(/img/ui/key.webp) 14 / 8px stretch; image-rendering: pixelated; }
.block span { display: block; padding: .3em 0 0; font-size: clamp(18px, 1.5vw, 24px); line-height: 1.2; text-transform: uppercase; }
.block:hover { transform: translateY(-3px); }
.block:active { transform: translateY(2px); }
.diary { margin: var(--s5) auto var(--s4); width: var(--reading); padding: var(--s4) var(--s5); background: url(/img/ui/plate.webp) center / 100% 100% no-repeat; image-rendering: pixelated; font-size: 24px; line-height: 1.3; text-align: center; }
.risk { margin-top: var(--s2); font-size: 16px; color: var(--lilac); opacity: .85; }
.key-back { display: flex; margin-inline: auto; width: min(360px, 100%); font-size: 18px; }

/* ---- viewer ---- */
.viewer { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: var(--s2); background: var(--deep); }
.viewer[hidden] { display: none; }
.viewer-box { width: min(100%, 68svh); display: grid; gap: var(--s2); }
.viewer-box img { width: 100%; height: auto; aspect-ratio: 1; border: 10px solid transparent; border-image: url(/img/ui/key.webp) 14 / 10px stretch; image-rendering: pixelated; }
.viewer-cap { text-align: center; font: 700 28px/1.1 var(--font-display); color: var(--accent); text-transform: uppercase; }
.viewer-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s1); }
.viewing { overflow: hidden; }

/* ---- 404 ---- */
.lost { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: var(--s3); padding: var(--s3); text-align: center; background: var(--deep) url(/img/ui/card-plate.webp) center top / 1280px auto; image-rendering: pixelated; }
.lost h1 { font: 700 clamp(44px, 7vw, 96px)/1 var(--font-display); color: var(--lilac); text-shadow: 4px 4px 0 var(--purple); }
.lost img { width: min(240px, 60vw); height: auto; }
.lost p { font-size: 24px; line-height: 1.3; max-width: 22em; }
.lost .key { width: min(360px, 100%); font-size: 18px; }

/* ---- phones: name on top, cat in the middle, machine under it ---- */
@media (max-width: 760px), (orientation: portrait) {
  .mark { left: 50%; transform: translateX(-50%); top: 10px; width: min(94vw, 600px); text-align: center; }
  .plate { padding: 12px 1em; margin-top: 2px; }
  .line { font-size: clamp(16px, 4.2vw, 26px); }
  .ticker { font-size: clamp(22px, 6vw, 40px); margin-top: 2px; }
  .machine { left: 50%; transform: translateX(-50%); width: min(96vw, 620px, 48svh / .92); aspect-ratio: 1 / .92; }
  .blocks { grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
}
