/* Self-hosted fonts (SIL Open Font License, see fonts/OFL-*.txt) */
@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/press-start-2p-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #1d2b53;
  --plum: #7e2553;
  --paper: #fff1e8;
  --peach: #ffccaa;
  --pink: #ff77a8;
  --sun: #ffec27;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --body: "Space Grotesk", system-ui, sans-serif;
  --shadow: 2px 2px 0 var(--ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #06122e;
  color: var(--paper);
  font-family: var(--body);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  top: 0;
  left: 0;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
  cursor: pointer;
}

/* soft vignette over the game */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(4, 8, 28, 0.45) 100%);
}

.hidden { display: none !important; }

/* ── HUD ─────────────────────────────────────────── */
.hud-top {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  pointer-events: none;
  z-index: 5;
}
.hud-top > * { pointer-events: auto; }

.brand-name {
  font-family: var(--pixel);
  font-size: 14px;
  text-shadow: var(--shadow);
}
.brand-role {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--peach);
  margin-top: 8px;
  text-shadow: var(--shadow);
}

.hud-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.log { display: flex; gap: 6px; }
.log button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  cursor: pointer;
  font-family: var(--pixel);
  font-size: 8px;
  color: rgba(255, 241, 232, 0.55);
  background: rgba(29, 43, 83, 0.6);
  box-shadow: inset 0 0 0 2px rgba(255, 241, 232, 0.3);
  transition: transform 0.15s;
}
.log button:hover { transform: translateY(-2px); }
.log button.caught {
  color: var(--ink);
  background: var(--c);
  box-shadow: inset 0 0 0 2px var(--paper), 0 0 10px var(--c);
}

.btn {
  font-family: var(--pixel);
  font-size: 10px;
  line-height: 1;
  color: var(--ink);
  background: var(--sun);
  border: 0;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), 0 4px 0 2px var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { background: #fff27a; }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--ink), 0 1px 0 2px var(--ink); }
.btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 4px; }

.menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  min-width: 230px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--ink), 6px 6px 0 3px rgba(0, 0, 0, 0.35);
}
.menu ul { list-style: none; margin: 0; padding: 6px; }
.menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--ink);
}
.menu button:hover, .menu button:focus-visible { background: var(--peach); outline: none; }
.menu .depth-tag { margin-left: auto; font-size: 8px; color: var(--plum); }
.swatch { width: 10px; height: 10px; flex: none; background: var(--c); box-shadow: 0 0 0 2px var(--ink); }

/* ── Intro / hint / depth / toast ────────────────── */
.intro {
  position: fixed;
  left: 50%;
  top: 11vh;
  width: min(92vw, 600px);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.6s, transform 0.6s;
}
.intro.gone { opacity: 0; transform: translate(-50%, -24px); }
.intro h1 {
  margin: 0 0 16px;
  font-family: var(--pixel);
  font-size: clamp(22px, 5vw, 44px);
  font-weight: 400;
  color: var(--sun);
  text-shadow: 3px 3px 0 var(--plum), 6px 6px 0 var(--ink);
}
.intro p {
  margin: 8px 0;
  font-family: var(--pixel);
  font-size: clamp(8px, 1.3vw, 11px);
  line-height: 2;
  text-shadow: var(--shadow);
}

kbd {
  font-family: var(--pixel);
  font-size: 0.9em;
  color: var(--ink);
  background: var(--paper);
  padding: 3px 6px;
  box-shadow: 0 3px 0 var(--peach);
  text-shadow: none;
}

.depth {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--pixel);
  font-size: 12px;
  text-align: right;
  text-shadow: var(--shadow);
  pointer-events: none;
}
.depth small { display: block; font-size: 7px; color: var(--peach); margin-bottom: 8px; }

.hint {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  font-family: var(--pixel);
  font-size: 10px;
  line-height: 1.8;
  text-align: center;
  background: rgba(29, 43, 83, 0.88);
  box-shadow: 0 0 0 2px var(--paper);
  pointer-events: none;
}
.hint:empty { display: none; }
.hint b { font-weight: 400; }

.toast {
  position: fixed;
  left: 50%;
  top: 84px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  font-family: var(--pixel);
  font-size: 9px;
  line-height: 1.8;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--ink), 4px 4px 0 3px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, -10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 6;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Catch card ──────────────────────────────────── */
.card-wrap {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 18, 46, 0.55);
  -webkit-user-select: text;
  user-select: text;
}
.card {
  width: min(660px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 9px var(--c), 0 0 0 13px var(--ink), 14px 18px 0 13px rgba(0, 0, 0, 0.35);
  animation: pop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes pop {
  from { transform: translateY(40px) scale(0.85); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px 18px;
  border-bottom: 4px dashed rgba(29, 43, 83, 0.18);
}
.card-fish {
  width: 144px;
  height: 96px;
  flex: none;
  image-rendering: pixelated;
  box-shadow: 0 0 0 3px var(--ink);
}
.kicker { font-family: var(--pixel); font-size: 8px; line-height: 1.6; color: var(--plum); }
.card h2 {
  margin: 10px 0;
  font-family: var(--pixel);
  font-size: clamp(15px, 3.4vw, 22px);
  font-weight: 400;
  line-height: 1.3;
}
.meta { font-family: var(--pixel); font-size: 8px; line-height: 1.8; color: #5f574f; }

.card-body {
  padding: 20px 24px;
  overflow: auto;
  font-size: 16px;
  line-height: 1.6;
}
.card-foot {
  display: flex;
  justify-content: flex-end;
  padding: 14px 22px 22px;
}
.esc { opacity: 0.55; }

/* card content */
.card-body h3 {
  margin: 22px 0 10px;
  font-family: var(--pixel);
  font-size: 10px;
  font-weight: 400;
  color: var(--plum);
}
.card-body h3:first-child { margin-top: 0; }
.card-body h4 { margin: 0 0 6px; font-size: 18px; }
.card-body p { margin: 0 0 12px; }
.card-body a { color: var(--ink); }
.lead { font-size: 19px; font-weight: 500; }

.facts { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.facts li { display: flex; gap: 12px; padding: 10px 12px; background: rgba(29, 43, 83, 0.06); }
.facts span { flex: none; width: 116px; padding-top: 5px; font-family: var(--pixel); font-size: 8px; color: var(--plum); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips span {
  padding: 6px 10px;
  font-size: 14px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 3px 3px 0 var(--c);
}

.projects { display: grid; gap: 14px; }
.project { padding: 14px 16px; background: #fff; box-shadow: inset 0 0 0 3px var(--ink); }
.project p { margin-bottom: 0; }
.tags { margin: 10px 0; font-family: var(--pixel); font-size: 8px; line-height: 1.8; color: var(--plum); }
.links-row { display: flex; gap: 14px; font-weight: 700; }

.timeline { list-style: none; margin: 0 0 0 6px; padding: 0; border-left: 4px solid var(--c); }
.timeline li { position: relative; padding: 0 0 18px 20px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 3px;
  width: 12px;
  height: 12px;
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--ink);
}
.when { margin-bottom: 6px; font-family: var(--pixel); font-size: 8px; color: var(--plum); }

.contact-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.card-body .contact-links a,
.card-body .contact-links button {
  display: block;
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
  line-height: inherit;
  padding: 14px;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--c);
  transition: transform 0.1s, box-shadow 0.1s;
}
.card-body .contact-links a:hover,
.card-body .contact-links button:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--c); }
.card-body .contact-links button.copied { background: #008751; }
.card-body .privacy { margin: 20px 0 0; font-size: 13px; color: #5f574f; }

/* ── Lighthouse wardrobe ─────────────────────────── */
.wardrobe-body {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 20px 24px;
  overflow: auto;
}
.wardrobe-preview {
  width: 160px;
  height: 184px;
  flex: none;
  image-rendering: pixelated;
  box-shadow: 0 0 0 3px var(--ink);
}
.wardrobe-rows { flex: 1; display: grid; gap: 12px; min-width: 0; }
.wardrobe-row {
  display: grid;
  grid-template-columns: 76px 34px 1fr 34px;
  align-items: center;
  gap: 8px;
}
.w-label { font-family: var(--pixel); font-size: 8px; color: var(--plum); text-transform: uppercase; }
.w-name { font-family: var(--pixel); font-size: 9px; line-height: 1.5; text-align: center; }
.w-arrow {
  height: 30px;
  border: 0;
  cursor: pointer;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 3px 3px 0 var(--c);
}
.w-arrow:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--c); }
.w-arrow:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--c); }
.w-arrow:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.card-foot { gap: 14px; }
.btn-ghost { background: var(--paper); }
.btn-ghost:hover { background: #fff; }

.noscript { position: fixed; inset: 40% 16px auto; text-align: center; font-family: var(--pixel); font-size: 10px; line-height: 2; }

/* ── Small screens ───────────────────────────────── */
@media (max-width: 640px) {
  .menu-label, .esc { display: none; }
  .brand-name { font-size: 11px; }
  .log button { width: 18px; height: 18px; }
  .depth { top: auto; bottom: 90px; transform: none; }
  .hint { font-size: 8px; }
  .card-wrap { padding: 14px; }
  .card-head { gap: 12px; padding: 16px; }
  .card-fish { width: 84px; height: 56px; }
  .card-body { padding: 16px; font-size: 15px; }
  .facts span { width: 84px; }
  .wardrobe-body { flex-direction: column; padding: 16px; gap: 16px; }
  .wardrobe-preview { width: 120px; height: 138px; }
  .wardrobe-rows { width: 100%; }
  .wardrobe-row { grid-template-columns: 64px 30px 1fr 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .intro, .toast { transition: none; }
}
