/* Rat World Assets — $RWA */

@font-face {
  font-family: "Switzer";
  src: url("assets/font/switzer-900.woff2") format("woff2");
  font-weight: 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("assets/font/switzer-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Azeret";
  src: url("assets/font/azeret-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Azeret";
  src: url("assets/font/azeret-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --lime: #C4F621;
  --lime-deep: #A6D40F;
  --ink: #0A0A0A;
  --cream: #E8E4CE;
  --cream-dark: #C6C1A4;
  --paper: #F6F3E4;
  --hot: #E50914;
  --dark: #101006;

  --display: "Switzer", "Helvetica Neue", Arial, sans-serif;
  --mono: "Azeret", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

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

body {
  background: var(--dark);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skiplink {
  position: fixed; left: 12px; top: -60px; z-index: 90;
  background: var(--lime); color: var(--ink); font-weight: 900;
  padding: 10px 16px; border-radius: 10px; text-decoration: none;
  transition: top .15s ease;
}
.skiplink:focus { top: 12px; }

:where(a, button, [tabindex], input):focus-visible {
  outline: 4px solid var(--lime);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- the living world behind everything ---------- */

.world { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.world__vid {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(9px) saturate(1.45) brightness(.8) contrast(1.05);
  transform: scale(1.1);
}
.world__tint {
  position: absolute; inset: 0;
  background:
    radial-gradient(130% 100% at 50% 45%, rgba(196,246,33,.14), transparent 62%),
    linear-gradient(180deg, rgba(10,10,6,.34), rgba(10,10,6,.68));
}

main { position: relative; z-index: 1; }

/* ---------- screen 1: the wall ---------- */

.stage {
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(14px, 2.2vw, 26px);
  padding: clamp(14px, 3vw, 40px) clamp(12px, 3vw, 40px) clamp(90px, 12vw, 120px);
}

.rig {
  /* the third term keeps the masthead, wall, shelf and dock inside a short screen */
  width: min(1440px, 100%, calc((100svh - 460px) * 1.78 + 352px));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-areas: "mast receipt" "wall receipt" "shelf receipt";
  gap: 0 22px;
  align-items: start;
}

/* the name in its own window, off the busy wall */

.mast {
  grid-area: mast;
  position: relative;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-bottom: none;
  border-radius: var(--r) var(--r) 0 0;
  padding: clamp(12px, 2.2cqi, 26px) clamp(14px, 3cqi, 34px) clamp(12px, 2cqi, 22px);
  text-align: center;
  container-type: inline-size;
  box-shadow: 0 -6px 40px rgba(0,0,0,.4);
}

.wordmark {
  margin: 0;
  font-weight: 900;
  font-size: clamp(24px, 9.4cqi, 92px);
  line-height: .92;
  letter-spacing: -.045em;
  color: var(--lime);
  text-wrap: balance;
}

.tag {
  margin: .7em auto 0;
  max-width: 46ch;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(11px, 2cqi, 16px);
  line-height: 1.4;
  color: #d6d6c2;
  text-wrap: balance;
}

.mast__tick {
  position: absolute; top: 10px; right: 12px;
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(12px, 1.8cqi, 17px);
  background: var(--lime); color: var(--ink);
  padding: .2em .5em .26em;
  border-radius: 6px;
  rotate: -4deg;
  box-shadow: 3px 3px 0 rgba(196,246,33,.28);
}

/* the way down to the memes */

.down {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 24px; min-height: 52px;
  font-weight: 900; font-size: clamp(14px, 1.6vw, 19px);
  text-decoration: none; color: var(--ink);
  background: var(--lime);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 5px 5px 0 var(--ink);
}
.down:active { translate: 3px 3px; box-shadow: 2px 2px 0 var(--ink); }
.down__arrow {
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid var(--ink);
  animation: nudge 1.3s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { translate: 0 -2px; }
  50% { translate: 0 4px; }
}

.wallwrap { grid-area: wall; position: relative; container-type: inline-size; }

.wall {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--lime);
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
}

.wall__vid {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
/* Chrome stops muted video-only media it considers hidden, so exactly one of the
   two clips is visible and playing at a time; the other is fully out of the way. */
.wall__vid--off { visibility: hidden; pointer-events: none; }

/* the assets scattered on his wall */

.chips { position: absolute; inset: 0; pointer-events: none; }
.chip { pointer-events: auto; }

.chip {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  appearance: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(10px, 2.35cqi, 19px);
  letter-spacing: .02em;
  padding: .45em .7em .5em;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 4px 5px 0 var(--ink);
  transition: transform .12s cubic-bezier(.3,1.6,.5,1), box-shadow .12s ease, background .12s ease, opacity .3s ease;
  white-space: nowrap;
}
.chip:hover { background: var(--lime); transform: translate(-50%, -50%) rotate(var(--rot,0deg)) scale(1.09); }
.chip:active { box-shadow: 1px 2px 0 var(--ink); transform: translate(-50%,-50%) rotate(var(--rot,0deg)) scale(.96); }
.chip[data-eaten="1"] { background: var(--lime); }
.chip.is-gone {
  opacity: 0;
  transform: translate(-50%,-50%) rotate(140deg) scale(.2);
  transition: opacity .3s ease-in, transform .3s ease-in;
}

.burst { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* the cream parapet he grips: identity, contract and the two required actions */

.shelf {
  grid-area: shelf;
  background: linear-gradient(180deg, #F2EEDA 0 14px, var(--cream) 14px 100%);
  border: 3px solid var(--ink);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  box-shadow: 0 26px 50px rgba(0,0,0,.5);
  padding: 14px clamp(12px, 2vw, 22px) 16px;
  display: grid;
  gap: 12px;
}

.shelf__id { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.shelf__name { font-weight: 900; font-size: clamp(15px, 1.7vw, 21px); letter-spacing: -.02em; }
.shelf__tick {
  font-family: var(--mono); font-weight: 700; font-size: clamp(13px, 1.5vw, 18px);
  background: var(--ink); color: var(--lime); padding: .18em .5em .24em; border-radius: 6px;
}

.ca {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--paper);
  border: 2px dashed var(--cream-dark);
  border-radius: 10px;
  padding: 9px 11px;
}
.ca__label {
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; color: #6b6750;
}
.ca__value {
  font-family: var(--mono); font-weight: 500; font-size: clamp(11px, 1.25vw, 14px);
  word-break: break-all; flex: 1 1 12ch; min-width: 0; color: var(--ink);
}
.ca--empty .ca__value { color: #7a7660; font-style: italic; }
.ca__copy {
  font-family: var(--display); font-weight: 900; font-size: 13px;
  padding: 8px 14px; min-height: 40px;
  border: 3px solid var(--ink); border-radius: 8px;
  background: var(--lime); color: var(--ink); cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}
.ca__copy:active { box-shadow: 1px 1px 0 var(--ink); translate: 2px 2px; }
.ca__copy[disabled] { background: #ddd9c4; color: #7a7660; cursor: not-allowed; box-shadow: none; border-color: #a9a48c; }
.ca__msg { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.ca__msg[data-tone="ok"] { color: #2b6d0b; }
.ca__msg[data-tone="bad"] { color: #a2050d; }

.acts { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 10px 20px;
  font-weight: 900; font-size: clamp(14px, 1.5vw, 17px); letter-spacing: -.01em;
  text-decoration: none; cursor: pointer;
  border: 3px solid var(--ink); border-radius: 10px;
  box-shadow: 5px 5px 0 var(--ink);
  transition: translate .08s ease, box-shadow .08s ease;
}
.btn:active { translate: 3px 3px; box-shadow: 2px 2px 0 var(--ink); }
.btn--buy { background: var(--lime); color: var(--ink); }
.btn--x { background: var(--ink); color: #fff; }
.btn--x svg { width: 17px; height: 17px; display: block; }
.btn[aria-disabled="true"] {
  background: #ddd9c4; color: #7a7660; border-color: #a9a48c;
  box-shadow: none; cursor: not-allowed;
}

/* the till roll: the mechanic's output */

.receipt {
  grid-area: receipt;
  align-self: stretch;
  position: relative;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 26px 50px rgba(0,0,0,.5);
  font-family: var(--mono);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.receipt__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  border-bottom: 2px solid var(--ink);
  font-weight: 700; font-size: 11px; letter-spacing: .1em;
}
.receipt__chain { background: var(--ink); color: var(--lime); padding: .12em .42em; border-radius: 4px; }

.receipt__body { overflow-y: auto; padding: 10px 12px; display: grid; gap: 9px; align-content: start; }
.receipt__hint { margin: 0; font-size: 12px; font-weight: 500; color: #6b6750; line-height: 1.45; }

.row { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px dashed var(--cream-dark); }
.row:last-child { border-bottom: none; }
.row__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row__sym { font-weight: 700; font-size: 14px; }
.row__ate { font-weight: 700; font-size: 13px; color: var(--ink); background: var(--lime); padding: .05em .38em; border-radius: 4px; }
.row__name { font-size: 11px; font-weight: 500; color: #6b6750; }
.row__supply { font-size: 12px; font-weight: 500; }
.row__supply b { font-weight: 700; }
.row__supply[data-state="wait"] { color: #7a7660; }
.row__supply[data-state="fail"] { color: #a2050d; }

.receipt__total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 12px;
  border-top: 2px solid var(--ink);
  background: var(--lime);
}
.receipt__totalLabel { font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.receipt__totalNum { font-weight: 700; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.receipt__totalNum.is-pop { animation: pop .32s cubic-bezier(.3,1.7,.5,1); }
@keyframes pop { 0% { scale: 1 } 40% { scale: 1.32 } 100% { scale: 1 } }

.receipt__tear {
  height: 14px;
  background:
    linear-gradient(-45deg, transparent 50%, var(--paper) 50%) 0 0 / 14px 14px repeat-x,
    linear-gradient(45deg, transparent 50%, var(--paper) 50%) 0 0 / 14px 14px repeat-x;
  filter: drop-shadow(0 3px 0 var(--ink));
}

/* ---------- screen 2: the gallery ---------- */

.gallery { scroll-margin-top: 0; padding: clamp(30px, 6vw, 80px) clamp(12px, 3vw, 40px) clamp(110px, 12vw, 140px); }

.gallery__title {
  margin: 0 auto clamp(16px, 2.5vw, 30px);
  width: min(1440px, 100%);
  font-weight: 900; font-size: clamp(30px, 6vw, 76px);
  letter-spacing: -.04em; line-height: .95;
  color: var(--lime);
  text-shadow: 5px 5px 0 var(--ink);
}

.tiles {
  list-style: none; margin: 0 auto; padding: 0;
  width: min(1440px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}

.tile {
  position: relative; display: block; width: 100%; padding: 0;
  aspect-ratio: 3 / 2;
  border: 3px solid var(--ink); border-radius: 10px;
  overflow: hidden; cursor: pointer;
  background: #1b1b12;
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
  transition: translate .12s ease, box-shadow .12s ease;
}
.tile:hover { translate: 0 -4px; box-shadow: 0 18px 34px rgba(0,0,0,.55); }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video { position: absolute; inset: 0; opacity: 0; transition: opacity .2s ease; }
.tile.is-playing video { opacity: 1; }

.tile__badge {
  position: absolute; left: 8px; bottom: 8px;
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  background: var(--lime); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 6px;
  padding: .2em .45em;
}

/* ---------- music dock ---------- */

.dock {
  position: fixed; z-index: 40;
  left: 50%; translate: -50% 0; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  background: var(--ink);
  border: 3px solid var(--lime);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0,0,0,.6);
  max-width: calc(100vw - 20px);
}

.dock__play, .dock__track {
  font-family: var(--display); font-weight: 900; font-size: 13px;
  min-height: 40px; padding: 8px 14px;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--lime); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.dock__track { background: #2a2a1a; color: var(--lime); }
.dock__icon {
  width: 0; height: 0; display: inline-block;
  border-left: 11px solid currentColor;
  border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.dock[data-on="1"] .dock__icon {
  width: 11px; height: 13px; border: none;
  background: linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px, currentColor 7px 11px);
}
.dock__volwrap { display: flex; align-items: center; }
.dock__vol { width: 84px; accent-color: var(--lime); }
.dock__now {
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: #cfcfb8;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-right: 6px;
}

/* ---------- intro ---------- */

.intro {
  width: 100vw; max-width: 100vw; height: 100svh; max-height: 100svh;
  margin: 0; padding: 0; border: none; background: var(--dark); overflow: hidden;
}
.intro::backdrop { background: #000; }
.intro__vid {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: saturate(1.25) brightness(.72);
}
.intro__inner {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px;
  text-align: center;
  background: radial-gradient(90% 70% at 50% 50%, rgba(0,0,0,.25), rgba(0,0,0,.72));
}
.intro__title {
  margin: 0; font-weight: 900; letter-spacing: -.04em; line-height: .9;
  font-size: clamp(38px, 11vw, 150px);
  color: var(--lime);
  text-shadow: 6px 6px 0 var(--ink);
  text-wrap: balance;
}
.intro__sub { margin: 0 0 8px; color: #fff; font-weight: 500; font-size: clamp(14px, 2.2vw, 22px); }
.intro__go {
  font-family: var(--display); font-weight: 900; font-size: clamp(16px, 2.4vw, 24px);
  padding: 16px 34px; min-height: 56px; cursor: pointer;
  background: var(--lime); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 14px;
  box-shadow: 7px 7px 0 var(--ink);
}
.intro__go:active { translate: 4px 4px; box-shadow: 3px 3px 0 var(--ink); }
.intro__quiet {
  background: none; border: none; cursor: pointer;
  color: #e9e9d8; font-family: var(--mono); font-size: 13px; font-weight: 500;
  text-decoration: underline; padding: 12px 16px; min-height: 44px;
}

/* ---------- lightbox ---------- */

.lb {
  width: min(1100px, 94vw); max-width: 94vw;
  padding: 0; border: 4px solid var(--ink); border-radius: 14px;
  background: var(--lime); overflow: visible;
}
.lb::backdrop { background: rgba(4,6,0,.86); }
.lb__fig { margin: 0; }
.lb__media { line-height: 0; }
.lb__media img, .lb__media video { width: 100%; height: auto; display: block; border-radius: 10px 10px 0 0; }
.lb__cap {
  font-family: var(--mono); font-weight: 700; font-size: clamp(12px, 1.5vw, 15px);
  padding: 12px 16px; color: var(--ink);
}
.lb__close {
  position: absolute; top: -18px; right: -18px;
  width: 46px; height: 46px; font-size: 26px; line-height: 1; cursor: pointer;
  background: var(--ink); color: var(--lime);
  border: 3px solid var(--lime); border-radius: 999px;
}

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
  .rig {
    grid-template-columns: 1fr;
    grid-template-areas: "mast" "wall" "shelf" "receipt";
    gap: 0;
  }
  .receipt { margin-top: 18px; max-height: none; }
  .receipt__body { max-height: 340px; }
}

@media (max-width: 760px) {
  .stage { padding-bottom: 96px; }
  .wall { aspect-ratio: 4 / 3; }
  .chips {
    position: static;
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 7px; padding: 10px 0 0;
  }
  .chip {
    position: static; transform: none; width: 100%;
    box-shadow: 3px 3px 0 var(--ink);
    font-size: 13px; padding: .6em .3em;
    text-align: center;
  }
  .chip:hover, .chip:active { transform: none; }
  .chip.is-gone { opacity: .35; transform: none; }
  .dock__now { display: none; }
  .dock__vol { width: 64px; }
}

@media (max-width: 420px) {
  .dock { gap: 6px; padding: 6px 8px; }
  .dock__play, .dock__track { padding: 8px 12px; font-size: 12px; }
  .dock__volwrap { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .world__vid { display: none; }
  .world { background: #14140a; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
