/* CHZ Development — chzdevelopment.com
   Two static pages: the title screen, and a world map that works as the menu. */

@font-face {
  font-family: 'Press Start 2P';
  src: url('fonts/press-start-2p.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jersey 15';
  src: url('fonts/jersey-15.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #16162F;
  --ground: #F6F6F1;
  --accent: #FFC93C;
  --green: #0F6B3C;
  --muted: #5B5F73;
  --soft: #3D4058;
  --locked: #4A4E63;
  --locked-bg: #E6E8EC;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --body: 'Jersey 15', ui-monospace, 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--ground);
  /* scanlines */
  background-image: repeating-linear-gradient(0deg, rgba(22, 22, 47, 0.05) 0 1px, transparent 1px 4px);
  color: var(--ink);
  font-family: var(--body);
  font-size: 24px;
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--green); }
a:hover { color: var(--ink); }

:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

[hidden] { display: none !important; }

/* pixel art stays sharp at any size */
.px { shape-rendering: crispEdges; }

.skip {
  position: absolute;
  left: -9999px;
  top: 16px;
  z-index: 10;
  padding: 14px 14px 12px;
  background: var(--ink);
  color: #fff;
  font-family: var(--pixel);
  font-size: 11px;
}
.skip:focus { left: 16px; color: #fff; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 0;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: var(--pixel);
  font-size: 11px;
  line-height: 1.3;
}
.btn--start {
  padding: 22px 28px 19px;
  border: 4px solid var(--ink);
  background: var(--accent);
  color: var(--ink);
  font-size: 16px;
  box-shadow: 6px 6px 0 var(--ink);
}
.btn--start svg { flex: none; width: 10px; height: 18px; margin-top: -3px; }
.btn--start:hover { color: var(--ink); transform: translate(2px, 2px); box-shadow: 4px 4px 0 var(--ink); }
.btn--start:active { transform: translate(6px, 6px); box-shadow: none; }

.btn--dark {
  display: flex;
  width: 100%;
  margin-top: auto;
  padding: 17px 14px 15px;
  background: var(--ink);
  color: #fff;
  box-shadow: 4px 4px 0 var(--accent);
}
.btn--dark:hover { color: #fff; transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--accent); }
.btn--dark:active { transform: translate(4px, 4px); box-shadow: none; }

.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Screen wipe (wipe.js) ---------- */

/* Press Start: pushed in, flashing, like a console confirming the choice. */
.btn--start.is-pressed,
.btn--start.is-pressed:hover {
  transform: translate(6px, 6px);
  box-shadow: none;
  animation: press-flash 0.42s steps(1) both;
}
.btn--start.is-pressed .blink { animation: none; }
@keyframes press-flash {
  0%, 34%, 68% { background: #fff; }
  17%, 51%, 85%, 100% { background: var(--accent); }
}

/* The sweeping blocks: one canvas pixel per block, scaled up sharp. */
.wipe {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* A page arriving through the wipe starts covered, before wipe.js runs.
   If the script never runs, the cover gives up after a moment. */
.wipe-in body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--ink);
  animation: wipe-giveup 0s 2s forwards;
}
@keyframes wipe-giveup { to { visibility: hidden; } }

/* ---------- Title screen ---------- */

.title {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.title__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 26px 32px 0;
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: 1px;
}
.title__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 32px 24px 56px;
  text-align: center;
}
.wordmark {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(56px, min(12vw, 21vh), 176px);
  line-height: 1;
}
.wordmark span { display: block; }
.wordmark__chz { text-shadow: 0.045em 0.045em 0 var(--accent); }
/* sized so DEVELOPMENT is exactly as wide as CHZ */
.wordmark__dev { margin-top: 0.55em; font-size: 0.2625em; letter-spacing: 0.039em; }

.title__tag { margin: 0; max-width: 560px; font-size: 30px; line-height: 1.25; color: var(--soft); }

.title__scene {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(10px, 2.6vw, 40px);
  padding: 0 16px;
  overflow: hidden;
}
.title__scene svg { flex: none; }
.s-tree { width: clamp(30px, 3.4vw, 48px); aspect-ratio: 6 / 7; }
.s-tree--lg { width: clamp(36px, 4.2vw, 60px); }
.s-sprout { width: clamp(40px, 4.4vw, 64px); aspect-ratio: 16 / 13; }
.s-hq { width: clamp(64px, 7.8vw, 112px); aspect-ratio: 16 / 15; }

.title__ground {
  height: 32px;
  background: linear-gradient(to bottom, #1E6F4A 12px, #74C68F 12px);
}

/* The map page fills at least the window, so the footer sits at the bottom. */
.world { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ---------- World: header ---------- */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 18px 32px;
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
  background: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--pixel);
  font-size: 14px;
  letter-spacing: 1px;
}
.brand svg { flex: none; width: 36px; height: 36px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 2px 14px 0;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--pixel);
  font-size: 11px;
}
.nav a:hover { background: var(--accent); }

/* ---------- World: intro ---------- */

.wrap {
  /* take the spare height and center the content in it */
  flex: 1 0 auto;
  justify-content: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.intro { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { margin: 0; font-family: var(--pixel); font-size: 11px; line-height: 1.7; letter-spacing: 1px; color: var(--green); }
.intro h2 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(20px, 2.4vw, 34px);
  line-height: 1.5;
}
.intro p:last-child { margin: 0; max-width: 660px; font-size: 27px; line-height: 1.25; color: var(--soft); }

/* ---------- World: map + info windows ---------- */

.board { display: flex; flex-wrap: wrap; align-items: stretch; gap: 28px; }

.window {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 4px solid var(--ink);
  background: #fff;
  box-shadow: 8px 8px 0 var(--ink);
}
.window--map { flex: 999 1 620px; }
.window--info { flex: 1 1 360px; }

.window__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 4px solid var(--ink);
  font-family: var(--pixel);
  font-size: 11px;
}
.window__bar--accent { background: var(--accent); }
.window__bar--locked { background: var(--locked-bg); }
.muted { color: var(--muted); }

.map-scroll { overflow-x: auto; }
.map {
  position: relative;
  min-width: 640px;
  background-color: #BDE0FE;
  /* waves */
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.6) 0 2px, transparent 2px 8px);
}
.map img { display: block; width: 100%; height: auto; }
.map__name {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 1px;
  color: #1F4E79;
}

.node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--pixel);
}
.node__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 4px solid var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
}
.node__box svg { width: 32px; height: 32px; }
.node__label { padding: 6px 7px 4px; background: var(--ink); color: #fff; font-size: 10px; white-space: nowrap; }
.node__cursor {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 22px;
  height: 14px;
  margin-left: -11px;
  display: none;
  animation: bob 0.8s steps(1) infinite;
}
@keyframes bob { 50% { transform: translateY(-4px); } }

.node:hover .node__box { background: #FFF3CC; }
.node[aria-pressed="true"] .node__cursor { display: block; }
.node[aria-pressed="true"] .node__box { background: var(--accent); }

.node--locked .node__box { padding: 4px 0 0 3px; background: var(--locked-bg); color: var(--locked); font-size: 20px; }
.node--locked .node__label { background: var(--locked); }

/* Info window: with JavaScript one panel shows at a time; without it they all stack. */
.panel { flex: 1; display: flex; flex-direction: column; }
.panel + .panel { border-top: 4px solid var(--ink); }
.js .panel + .panel { border-top: 0; }
.js .panel:not(.is-active) { display: none; }
html:not(.js) .window--map { align-self: flex-start; }

.panel__body { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 22px 20px 24px; }
.panel__head { display: flex; align-items: center; gap: 16px; }
.panel__title { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.panel__title h3 { margin: 0; font-family: var(--pixel); font-weight: 400; font-size: 16px; line-height: 1.4; }
.panel__title .h3--long { font-size: 14px; line-height: 1.5; }
.panel p { margin: 0; font-size: 27px; line-height: 1.2; }

.tile {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 4px solid var(--ink);
  background: #EEF0F4;
}
.tile svg { width: 48px; height: 48px; }
.tile--green { background: #E9F7E1; }
.tile--locked { padding: 6px 0 0 4px; background: var(--locked-bg); color: var(--locked); font-family: var(--pixel); font-size: 30px; }

.tag { padding: 6px 8px 4px; background: var(--ink); color: #fff; font-family: var(--pixel); font-size: 9px; }
.tag--locked { background: var(--locked); }

.facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; font-size: 23px; line-height: 1.2; }
.facts dt { padding-top: 7px; font-family: var(--pixel); font-size: 10px; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
/* label above value, for long values like an email address */
.facts--stack { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.facts--stack dt { padding-top: 0; }
.facts--stack dd + dt { margin-top: 12px; }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 18px 32px;
  border-top: 4px solid var(--ink);
  background: #fff;
  font-size: 22px;
  color: var(--soft);
}

/* ---------- Big screens ---------- */

/* Scale the whole map page up when the window has room for it, in both directions.
   Zoom goes on the three parts, not .world, so its full-window height stays exact. */
.bar, .wrap, .footer { zoom: var(--scale, 1); }
@media (min-width: 1500px) and (min-height: 1010px) { .world { --scale: 1.1; } }
@media (min-width: 1650px) and (min-height: 1100px) { .world { --scale: 1.2; } }
@media (min-width: 1800px) and (min-height: 1190px) { .world { --scale: 1.3; } }
@media (min-width: 2000px) and (min-height: 1330px) { .world { --scale: 1.45; } }
@media (min-width: 2200px) and (min-height: 1470px) { .world { --scale: 1.6; } }
@media (min-width: 2550px) and (min-height: 1700px) { .world { --scale: 1.85; } }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .title__bar, .bar, .footer { padding-left: 20px; padding-right: 20px; }
  .title__bar { font-size: 9px; }
  .title__tag { font-size: 26px; }
  .btn--start { padding: 20px 22px 17px; font-size: 13px; }
  .brand { font-size: 12px; gap: 12px; }
  .nav { margin-left: -14px; }
  .wrap { padding: 28px 20px 40px; }
  .window { box-shadow: 6px 6px 0 var(--ink); }
}

/* Short screens (a phone on its side): tighten the title screen so it still fits. */
@media (max-height: 560px) {
  .title__bar { padding-top: 12px; }
  .title__main { gap: 14px; padding-top: 12px; padding-bottom: 16px; }
  .title__tag { font-size: 22px; }
  .btn--start { padding-top: 14px; padding-bottom: 11px; }
  .title__scene { display: none; }
  .title__ground { height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blink, .node__cursor { animation: none; }
  .btn--start:hover, .btn--dark:hover, .btn--start:active, .btn--dark:active { transform: none; }
}
