:root {
  --ink: #101814;
  --cream: #f3ead8;
  --paper: #fff9eb;
  --coral: #df6f55;
  --blue: #3866a6;
  --green: #315d42;
  --line: #17221d;
  --shadow: 6px 6px 0 var(--line);
  font-family: "DM Mono", monospace;
  color: var(--ink);
  background: #0c1511;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: #0c1511;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

button, a { font: inherit; }

button { color: inherit; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .12;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.13) 3px 4px),
    radial-gradient(rgba(0,0,0,.45) 1px, transparent 1px);
  background-size: 100% 4px, 5px 5px;
  mix-blend-mode: overlay;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  text-align: center;
  color: white;
  background:
    linear-gradient(rgba(11,24,18,.22), rgba(11,24,18,.76)),
    url("/assets/city-map-clean.png") center / cover;
  transition: opacity .7s cubic-bezier(.7,0,.2,1), visibility .7s;
}

.intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, transparent 0 16%, rgba(7,15,12,.72) 76%);
}

.intro > * { position: relative; }

.intro__eyebrow {
  margin-bottom: 22px;
  font: 10px/1.6 "Press Start 2P", monospace;
  letter-spacing: .16em;
  color: #e7ca72;
}

.intro h1 {
  margin: 0;
  font: clamp(40px, 8vw, 102px)/.88 "Press Start 2P", monospace;
  letter-spacing: -.08em;
  text-shadow: 7px 7px 0 #17221d;
}

.intro h1 span { color: #ef825f; }

.intro p {
  margin: 26px 0 30px;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.skip-intro {
  margin-top: 22px;
  padding: 6px;
  border: 0;
  color: rgba(255,255,255,.72);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.intro.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.world {
  position: fixed;
  inset: 0;
  display: block;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(77,104,83,.68), rgba(8,15,12,.98) 74%),
    #0c1511;
}

.world::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

.map-frame {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  border: 0;
  box-shadow: none;
  background: #15231b;
  isolation: isolate;
}

.world-surface {
  position: absolute;
  left: 0;
  top: 0;
  width: 1672px;
  height: 941px;
  transform-origin: 0 0;
  will-change: transform;
}

.map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.map-glow {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  box-shadow: inset 0 0 110px rgba(6,18,12,.42);
}

.topbar {
  position: fixed;
  z-index: 10;
  top: 24px;
  left: 28px;
  right: 28px;
  display: grid;
  grid-template-columns: 190px 1fr 190px;
  align-items: start;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand {
  width: max-content;
  color: var(--cream);
  text-decoration: none;
  text-shadow: 3px 3px 0 #111;
}

.brand span, .brand strong {
  display: block;
  font: 19px/.92 "Press Start 2P", monospace;
}

.brand strong { color: #ed7b5d; }
.brand small { font-size: 8px; letter-spacing: .22em; }

.topbar nav {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.pixel-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 12px 18px 10px;
  border: 3px solid var(--line);
  color: var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--line);
  text-decoration: none;
  font: 10px/1.2 "Press Start 2P", monospace;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .2s;
}

.pixel-button:hover {
  background: #fffaf0;
  transform: translate(-2px,-2px);
  box-shadow: 6px 6px 0 var(--line);
}

.pixel-button:active {
  transform: translate(3px,3px);
  box-shadow: 1px 1px 0 var(--line);
}

.pixel-button--coral {
  color: white;
  background: var(--coral);
  min-width: 190px;
}

.pixel-button--coral:hover { background: #f18164; }

.sound-toggle {
  justify-self: end;
  padding: 9px 10px;
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(9,18,14,.58);
  font-size: 9px;
  letter-spacing: .12em;
  cursor: pointer;
}

.sound-toggle span { color: #ef825f; }

.map-pin {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px 6px;
  border: 2px solid #fff5dc;
  color: white;
  background: rgba(14,24,19,.88);
  box-shadow: 3px 3px 0 #142018;
  cursor: pointer;
  transform: translate(-50%,-50%);
  transition: transform .18s, background .18s;
}

.map-pin:hover {
  background: var(--coral);
  transform: translate(-50%,-50%) translateY(-5px);
}

.map-pin--about { left: 458px; top: 348px; }
.map-pin--gallery { left: 1200px; top: 348px; }
.map-pin--contact { left: 850px; top: 616px; }

.pin-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 3px solid white;
  background: #e9cc6a;
  animation: pulse 1.8s infinite;
}

.map-pin em {
  font-style: normal;
  font-size: 8px;
  letter-spacing: .12em;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 7px rgba(255,240,174,.2); }
}

.game-help {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: 22px;
  color: white;
  text-align: center;
  transform: translateX(-50%);
}

.game-help span {
  display: block;
  font: 9px "Press Start 2P", monospace;
}

.game-help small { opacity: .72; font-size: 9px; }

.site-footer {
  position: fixed;
  z-index: 8;
  right: 22px;
  bottom: 20px;
  color: rgba(255,255,255,.82);
  font-size: 10px;
  text-shadow: 1px 1px 0 #000;
}

.game-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.actor {
  position: absolute;
  width: auto;
  height: 58px;
  object-fit: contain;
  transform: translate(-50%, -88%);
  transform-origin: 50% 88%;
  filter: drop-shadow(2px 3px 0 rgba(0,0,0,.42));
  image-rendering: pixelated;
  will-change: left, top, transform;
  user-select: none;
}

.actor--player {
  z-index: 7;
  height: 64px;
}

.actor--npc { z-index: 5; }

.actor.is-walking {
  animation: sprite-walk .28s steps(2,end) infinite;
}

.actor.is-left {
  transform: translate(-50%, -88%) scaleX(-1);
}

.actor.is-sitting {
  height: 48px;
  transform: translate(-50%, -72%) scaleY(.8);
}

@keyframes sprite-walk {
  50% { margin-top: -3px; }
}

.vehicle {
  position: absolute;
  z-index: 3;
  width: 58px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.36));
  transform: translate(-50%, -50%);
  transform-origin: center;
  will-change: top;
  user-select: none;
}

.vehicle.is-down { transform: translate(-50%, -50%) rotate(180deg); }

.panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 6vw;
  background: rgba(8,15,12,.82);
  backdrop-filter: blur(9px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s, visibility .35s;
}

.panel.is-open {
  opacity: 1;
  visibility: visible;
}

.panel__content {
  width: min(100%, 1120px);
  max-height: 82dvh;
  overflow: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 11px 11px 0 var(--coral);
}

.panel__close {
  position: fixed;
  z-index: 2;
  top: 30px;
  right: 34px;
  width: 46px;
  height: 46px;
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--ink);
  font: 27px/1 "DM Mono", monospace;
  cursor: pointer;
}

.panel__index {
  position: fixed;
  left: 34px;
  bottom: 30px;
  color: white;
  font: 9px "Press Start 2P", monospace;
}

.page { padding: clamp(30px, 6vw, 78px); }

.kicker {
  margin: 0 0 24px;
  font: 9px "Press Start 2P", monospace;
  letter-spacing: .12em;
  color: var(--coral);
}

.page h2 {
  margin: 0 0 44px;
  font: clamp(34px, 6vw, 76px)/.94 "Press Start 2P", monospace;
  letter-spacing: -.06em;
}

.page h2 span { color: var(--blue); }

.page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 8vw, 110px);
}

.page p { line-height: 1.75; }
.page .lead { font-size: clamp(18px, 2.2vw, 28px); line-height: 1.35; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 54px;
  border: 2px solid var(--ink);
  background: var(--ink);
}

.stats div { padding: 22px; background: var(--cream); }
.stats strong { display: block; font: 9px "Press Start 2P"; margin-bottom: 8px; }
.stats span { font-size: 11px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.project-card {
  position: relative;
  border: 3px solid var(--ink);
  padding: 14px;
  box-shadow: 5px 5px 0 var(--ink);
}

.project-card__number {
  position: absolute;
  top: 21px;
  right: 21px;
  font: 8px "Press Start 2P";
  color: white;
}

.project-card__art {
  min-height: 165px;
  display: grid;
  place-items: center;
  color: white;
  border: 2px solid var(--ink);
  font: clamp(13px, 1.4vw, 18px) "Press Start 2P";
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.1) 25%, transparent 25% 75%, rgba(255,255,255,.1) 75%),
    linear-gradient(45deg, rgba(255,255,255,.1) 25%, transparent 25% 75%, rgba(255,255,255,.1) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}

.project-card--blue .project-card__art { background-color: var(--blue); }
.project-card--coral .project-card__art { background-color: var(--coral); }
.project-card--green .project-card__art { background-color: var(--green); }
.project-card h3 { margin: 22px 0 8px; font: 10px "Press Start 2P"; }
.project-card p { margin: 0; font-size: 11px; line-height: 1.5; }

.contact-card {
  display: grid;
  gap: 28px;
  width: min(100%, 720px);
  padding: clamp(24px, 4vw, 48px);
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 8px 8px 0 var(--blue);
}

.contact-card p {
  margin: 0;
  max-width: 56ch;
  font-size: clamp(16px, 2vw, 22px);
}

.contact-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-bottom: 12px;
  color: var(--ink);
  border-bottom: 3px solid var(--ink);
  text-decoration: none;
  font-size: clamp(17px, 3vw, 32px);
}

.contact-link span { color: var(--coral); }

.availability {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 8px "Press Start 2P";
}

.availability i {
  width: 10px;
  height: 10px;
  background: #56a867;
  box-shadow: 0 0 0 5px rgba(86,168,103,.18);
}

@media (max-width: 900px) {
  .topbar {
    top: 16px;
    left: 16px;
    right: 16px;
    grid-template-columns: auto 1fr;
  }

  .brand span, .brand strong { font-size: 13px; }
  .brand small { font-size: 6px; }
  .topbar nav { justify-content: flex-end; gap: 8px; }
  .topbar .pixel-button { padding: 10px 9px 8px; font-size: 7px; min-height: 36px; }
  .sound-toggle { display: none; }
  .map-frame { width: 88vw; }
  .game-help { bottom: 42px; }
  .site-footer { right: 12px; bottom: 12px; font-size: 8px; }
  .gallery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar { display: flex; flex-direction: column; gap: 14px; }
  .topbar nav { width: 100%; justify-content: stretch; }
  .topbar nav a { flex: 1; }
  .map-pin { padding: 6px; }
  .map-pin em { display: none; }
  .game-help { display: none; }
  .site-footer { left: 12px; right: 12px; text-align: center; }
  .page-grid, .stats { grid-template-columns: 1fr; }
  .panel { padding: 66px 18px 40px; }
  .panel__content { max-height: 80dvh; }
  .panel__close { top: 14px; right: 18px; }
  .panel__index { display: none; }
  .page h2 { margin-bottom: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
