@font-face {
  font-family: "Playfair Display";
  src: url("../assets/fonts/PlayfairDisplay-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Anton";
  src: url("../assets/fonts/Anton.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../assets/fonts/Archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --ink: #111111;
  --paper: #ffffff;
  --night: #1d1d1d;
  --dot: #a8a262;
  --hot: #eaff3a;      /* brand yellow (logo case, footprint) */
  --sun-soft: #f6ffa8; /* lighter yellow for big fills */
  --display: "Playfair Display", "Bodoni 72", Didot, Georgia, serif; /* black italic, outlined: the big words */
  --badge: "Anton", "Impact", "Arial Narrow", sans-serif;            /* tall condensed: badge words and big numbers */
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;            /* black label boxes and buttons */
  --sans: "Archivo", system-ui, sans-serif;                           /* reading text */
  --map-bg: #f4f1e8;
  --hand: "Architects Daughter", "Comic Sans MS", cursive; /* the logo's lettering, used for UI labels */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .27 0 0 0 0 .22 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--map-bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
}
body.on-results { background: var(--paper); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--hot); }
code { font-size: 0.9em; background: #0001; padding: 1px 5px; border-radius: 4px; }

/* =========================================================
   LANDING
   ========================================================= */
.landing {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
}
.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.landing::after { content: ""; position: absolute; inset: 0; background: var(--grain); mix-blend-mode: multiply; pointer-events: none; z-index: 1; }

.landing-center {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 28px;
  padding: 24px 16px;
  pointer-events: none;
}
.landing-center > * { pointer-events: auto; }
/* The logo is decoration: clicks go through it to the map underneath.
   The zip form only catches clicks on its own controls, so the map can be dragged around it. */
.landing-center > .logo-wrap, .landing-center > .zip-form { pointer-events: none; }
.zip-form > * { pointer-events: auto; }

/* --- Logo: chunky outlined type sitting on the map --- */
.logo-wrap {
  --L: clamp(40px, 8.6vw, 124px); /* logo type size; the sticker is sized from it */
  position: relative;
  transition: transform 0.5s cubic-bezier(.3, 1.3, .5, 1);
}
.zip-form { transition: transform 0.5s cubic-bezier(.3, 1.3, .5, 1); }
/* While typing, the logo shrinks to the top and the zip box drops to the bottom so the map shows through.
   js/app.js measures the real sizes and sets these, so it fits any screen height. */
.landing.typing .logo-wrap, .landing.settled .logo-wrap { transform: var(--logo-t, translateY(-25vh) scale(0.42)); }
.landing.typing .zip-form, .landing.settled .zip-form { transform: var(--form-t, translateY(21vh)); }
.landing.leaving { animation: leave 0.45s ease-in forwards; }
@keyframes leave { to { opacity: 0; transform: scale(1.08); } }
@font-face {
  font-family: "Architects Daughter";
  src: url("../assets/fonts/ArchitectsDaughter.woff2") format("woff2");
  font-display: block;
}
.logo { margin: 0; line-height: 0; }
.logo svg { display: block; width: min(calc(var(--L) * 5.2), 94vw); height: auto; overflow: visible; }
/* each word stomps down like a giant's footstep, then the stars and coins pop on, then the whole logo shudders */
.logo .word, .logo .extras {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: stomp 0.55s cubic-bezier(.3, 1.4, .5, 1) both;
  animation-delay: calc(0.45s + var(--i) * 0.38s);
}
.logo .extras { transform-origin: 50% 50%; animation-name: popIn; }
@keyframes popIn { from { transform: scale(0); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } to { transform: none; opacity: 1; } }
.logo-wrap .logo { animation: shudder 0.32s linear calc(0.45s + 4 * 0.38s + 0.2s) both; }
@keyframes stomp {
  0%   { transform: translateY(-120%) scale(1.25, 0.9); opacity: 0; }
  55%  { transform: translateY(0) scale(1.18, 0.78); opacity: 1; }
  75%  { transform: translateY(-6%) scale(0.95, 1.06); }
  100% { transform: none; opacity: 1; }
}
@keyframes shudder {
  20% { transform: translate(-4px, 3px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-3px, -3px); }
  80% { transform: translate(2px, 2px); }
}

/* Stuck on the upper left corner, just touching the "F" without covering it */
/* catchphrase under the logo: just handwriting, with a yellow marker swipe and a little footprint */
.tagline {
  display: table;
  position: relative;
  margin: calc(var(--L) * 0.1) auto 0;
  padding: 0 0.2em 0 1.25em;
  font: 400 max(17px, calc(var(--L) * 0.26)) var(--hand);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink);
  /* paper-colored halo so it reads over the map dots */
  text-shadow: 0 0 3px var(--map-bg), 0 0 6px var(--map-bg), 0 0 10px var(--map-bg);
  rotate: -2deg;
  animation: popIn .5s cubic-bezier(.3,1.4,.5,1) calc(0.45s + 4.6 * 0.38s) both;
  transition: opacity .3s;
}
.tagline::before { /* the footprint */
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 1em; height: 1em;
  translate: 0 -50%;
  background: url("../assets/icons/icon-192.png") center / contain no-repeat;
}
.tagline::after { /* yellow marker swipe under the words */
  content: "";
  position: absolute;
  left: 1.1em; right: 0; bottom: 0.08em;
  height: 0.38em;
  background: var(--hot);
  border-radius: 0.2em 0.5em 0.3em 0.6em;
  z-index: -1;
  rotate: -0.6deg;
}
.landing.typing .tagline, .landing.settled .tagline { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes stick {
  from { transform: scale(0) rotate(-90deg); }
  to   { transform: none; }
}

/* --- Zip entry, styled like stacked black label boxes --- */
.zip-form {
  display: grid;
  justify-items: center;
  gap: 10px;
  animation: fade 0.6s ease 1.6s both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.zip-label {
  background: var(--ink);
  color: var(--paper);
  font: 400 clamp(16px, 4.6vw, 21px) var(--hand);
  letter-spacing: 0.01em;
  padding: 5px 16px 4px;
  rotate: -1deg;
  filter: url(#hand);
  white-space: nowrap;
}
.zip-form input {
  width: 5.4em;
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(44px, 8vw, 72px);
  letter-spacing: 0.1em;
  filter: url(#hand);
  text-align: center;
  padding: 2px 10px;
  color: var(--ink);
  background: var(--sun-soft);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  border-radius: 0;
}
.zip-form input::placeholder { color: #0003; }
.zip-readout {
  margin: 4px 0 0;
  background: rgba(255, 253, 246, 0.9);
  padding: 2px 10px;
  min-height: 1.5em;
  font: 400 17px var(--hand);
  color: var(--ink);
  text-align: center;
}
.go {
  font: 400 24px var(--hand);
  padding: 8px 28px;
  filter: url(#hand);
  background: var(--ink);
  color: var(--hot);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--hot), 4px 4px 0 3px var(--ink);
  cursor: pointer;
}
.go:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
.go:not(:disabled):hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--hot), 6px 6px 0 3px var(--ink); }

/* =========================================================
   RESULTS
   ========================================================= */
.results {
  /* a desk the folders sit on */
  background: #c9d9df;
  min-height: 100vh;
  padding: 20px 16px 40px;
  overflow-x: clip; /* a wobbling sticker should never cause a sideways scroll */
}
.results-head {
  max-width: 1280px;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 20px;
}
.back {
  align-self: start;
  font: 400 18px var(--hand);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  filter: url(#hand);
  padding: 5px 14px;
  cursor: pointer;
}
.back:hover { background: var(--hot); }
.place-zip {
  margin: 0;
  /* the zip, lettered like the logo: black ink in a yellow case with a black edge */
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(56px, 10vw, 120px);
  line-height: 1.05;
  color: var(--ink);
  -webkit-text-stroke: 0.16em var(--hot);
  paint-order: stroke fill;
  filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink)) url(#hand);
  padding: 0 0.1em;
}
.place-name {
  display: inline-block;
  margin: 10px 0 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 20px var(--hand);
  padding: 4px 14px;
  rotate: -1deg;
}

/* ---- File folders: one per level of government ---- */
.file {
  --tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .24 0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
          url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='700'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.01' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .33 0 0 0 0 .25 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --federal: #d8d4cc;
  --state: #eec3c8;
  --city: #efe7d6;
  --sources: #dcb68e;
  --folder: var(--federal);
  position: relative;
  z-index: 0;
  max-width: 1400px;
  margin: 0 auto;
}
.file[data-level="state"] { --folder: var(--state); }
.file[data-level="city"] { --folder: var(--city); }
.file[data-level="sources"] { --folder: var(--sources); }

/* tabs sit along the top edge at left, middle, and right, like a box of third-cut folders */
.levels.file-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 18px;
  position: relative;
}
.level-btn:nth-child(1) { justify-self: start; }
.level-btn:nth-child(2) { justify-self: center; }
.level-btn:nth-child(3) { justify-self: end; }
.level-btn {
  position: relative;
  z-index: 1; /* folders in back sit behind the front folder */
  isolation: isolate;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 52px;
  padding: 13px 36px 12px;
  border: 0;
  background: none;
  color: #262422;
  font: 400 23px var(--hand);
  letter-spacing: 0.01em;
  white-space: nowrap;
  filter: brightness(0.9);
  transform: translateY(12px);
  transition: transform .2s cubic-bezier(.3,1.4,.5,1), filter .2s;
  cursor: pointer;
}
/* the tab itself: a card-stock trapezoid with rounded shoulders */
.level-btn::before {
  content: "";
  position: absolute;
  inset: 0 0 -4px;
  z-index: -1;
  background: var(--tex), var(--tab, var(--federal));
  border-radius: 12px 12px 0 0;
  transform: perspective(80px) rotateX(10deg);
  transform-origin: 50% 100%;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 -2px 6px rgba(60,40,20,.14);
}
.level-btn[data-level="state"] { --tab: var(--state); }
.level-btn[data-level="city"] { --tab: var(--city); }
.level-btn[data-level="sources"] { --tab: var(--sources); }
.level-btn[aria-current="page"] { transform: none; filter: none; z-index: 3; cursor: default; }
.level-btn[aria-current="page"]::before { inset: 0 0 -10px; box-shadow: inset 0 2px 0 rgba(255,255,255,.45); }
.level-btn:hover { transform: translateY(5px); filter: brightness(0.96); }
.level-btn[aria-pressed="true"] { transform: none; filter: none; z-index: 3; }
.level-btn[aria-pressed="true"]::before { inset: 0 0 -10px; box-shadow: inset 0 2px 0 rgba(255,255,255,.45); }
.level-btn .tab-name { font: 400 16px var(--hand); color: #555; }
.level-btn.is-missing { opacity: .75; }
.level-btn.is-missing .tab-name { text-decoration: line-through; }

/* the front folder: card stock, with the papers inside it */
.folder {
  position: relative;
  z-index: 2;
  background: var(--tex), var(--folder);
  border-radius: 3px 3px 8px 8px;
  padding: 34px clamp(12px, 2.4vw, 30px) 26px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.4), inset 0 -3px 0 rgba(90,60,30,.12), 0 18px 30px rgba(30,20,10,.16);
  transition: background-color .3s;
}
/* the two pressed fold lines along the top of real file folders */
.folder::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 12px;
  height: 7px;
  border-top: 1px solid rgba(90,60,30,.18);
  border-bottom: 1px solid rgba(90,60,30,.13);
  pointer-events: none;
}
/* the papers: a top sheet with two more peeking out underneath, held by a paper clip */
.folder > .frame {
  position: relative;
  max-width: none;
  padding: 30px clamp(14px, 3vw, 36px) 26px;
  background:
    linear-gradient(#ece7db 1px, transparent 1px) 0 0 / 100% 28px,
    #fffdf6;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(40,25,10,.18), 4px 4px 0 -1px #f4efe3, 4px 4px 0 0 rgba(40,25,10,.12), 8px 8px 0 -1px #ebe4d4, 8px 8px 0 0 rgba(40,25,10,.1);
}
.folder > .frame::before {
  content: "";
  position: absolute;
  top: -20px; right: 46px;
  width: 22px; height: 64px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 84'%3E%3Cpath d='M9 76V14a6 6 0 0 1 12 0v54a9 9 0 0 1-18 0V22' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}
/* the other folders, stacked underneath the front one */
.file::after {
  content: "";
  position: absolute;
  left: 12px; right: -10px; top: 60px; bottom: -12px;
  z-index: 1;
  background: var(--tex), #c4bdb0;
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(30,20,10,.12);
}
.folder.pull-a { animation: pullA .55s cubic-bezier(.3,1.3,.5,1); }
.folder.pull-b { animation: pullB .55s cubic-bezier(.3,1.3,.5,1); }
@keyframes pullA { 0% { transform: translateY(-46px) rotate(-.8deg); } 55% { transform: translateY(6px) rotate(.2deg); } 100% { transform: none; } }
@keyframes pullB { 0% { transform: translateY(-46px) rotate(.8deg); } 55% { transform: translateY(6px) rotate(-.2deg); } 100% { transform: none; } }

/* The collage spreads out across the whole page, no box around it */
.frame {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 0 0;
}
.level-line { margin: 0 0 10px; font: 400 28px/1.25 var(--hand); max-width: 60ch; }
.level-line b { font-weight: 400; background: var(--hot); padding: 0 6px; border-radius: 0.2em 0.5em 0.3em 0.6em; }
.level-line span { display: block; font: 400 15px/1.45 var(--sans); color: #555; margin-top: 4px; }
.empty { font-size: 18px; padding: 40px 0; max-width: 55ch; }

/* ---- Floating objects: each category is a loose cutout, not a tile ---- */
.collage.scatter { position: relative; min-height: 320px; }

.obj {
  position: absolute;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  animation:
    pop 0.6s cubic-bezier(.2, 1.6, .4, 1) var(--delay) both,
    bob var(--bob) ease-in-out var(--bob-delay) infinite;
  transition: left 0.6s cubic-bezier(.3, 1.2, .5, 1), top 0.6s cubic-bezier(.3, 1.2, .5, 1), width 0.6s ease;
}
.obj:hover, .obj:focus-visible { z-index: 5; }
@keyframes pop {
  from { scale: 0.2; opacity: 0; rotate: calc(var(--rot) * -3); }
  to   { scale: 1; opacity: 1; rotate: 0deg; }
}
@keyframes bob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 calc(var(--s) * -0.035); }
}

.pic {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: rotate(var(--rot));
  transition: transform 0.3s cubic-bezier(.3, 1.6, .5, 1);
}
.obj:hover .pic, .obj:focus-visible .pic { transform: rotate(0deg) scale(1.1); }

.pic img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(4px 6px 0 #0003);
}

/* big money number, slapped on like a sticker */
.num {
  position: absolute;
  z-index: 3;
  top: 2%;
  left: -4%;
  display: flex;
  align-items: flex-start;
  /* numbers lettered like the logo: black ink, yellow case, black edge */
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(26px, calc(var(--s) * 0.28), 150px);
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
  -webkit-text-stroke: 0.025em var(--ink); /* thickens the pen line */
  /* a ring of yellow, then a ring of black, drawn as shadows so the corners stay round */
  text-shadow:
    0.070em 0.000em 0 var(--hot),
    0.061em 0.035em 0 var(--hot),
    0.035em 0.061em 0 var(--hot),
    0.000em 0.070em 0 var(--hot),
    -0.035em 0.061em 0 var(--hot),
    -0.061em 0.035em 0 var(--hot),
    -0.070em 0.000em 0 var(--hot),
    -0.061em -0.035em 0 var(--hot),
    -0.035em -0.061em 0 var(--hot),
    -0.000em -0.070em 0 var(--hot),
    0.035em -0.061em 0 var(--hot),
    0.061em -0.035em 0 var(--hot),
    0.105em 0.000em 0 var(--ink),
    0.091em 0.052em 0 var(--ink),
    0.053em 0.091em 0 var(--ink),
    0.000em 0.105em 0 var(--ink),
    -0.052em 0.091em 0 var(--ink),
    -0.091em 0.052em 0 var(--ink),
    -0.105em 0.000em 0 var(--ink),
    -0.091em -0.052em 0 var(--ink),
    -0.053em -0.091em 0 var(--ink),
    -0.000em -0.105em 0 var(--ink),
    0.053em -0.091em 0 var(--ink),
    0.091em -0.053em 0 var(--ink);
  transform: rotate(var(--num-rot));
  pointer-events: none;
}
.obj.num-right .num { left: auto; right: -4%; }
.num-sign, .num-c { font-size: 0.45em; margin-top: 0.12em; letter-spacing: 0; }

/* label + dollar amount hang off the bottom like a price tag */
.label {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 88%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: max-content;
  max-width: max(150px, 110%);
  transform: translateX(-50%) rotate(var(--tag-rot));
  pointer-events: none;
}
.tag {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 2px 10px 1px;
  background: #fffdf6;
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(14px, calc(var(--s) * 0.065), 20px);
  line-height: 1.2;
  text-align: center;
}
.amt {
  background: var(--ink);
  color: var(--paper);
  padding: 1px 8px;
  font-family: var(--hand);
  font-size: 15px;
  font-weight: 400;
}
.obj:hover .tag { background: var(--hot); }

/* googly eyes on the biggest item */
.eyes { position: absolute; z-index: 3; top: 34%; left: 50%; transform: translateX(-50%); display: flex; gap: 6%; width: 30%; }
.eye {
  flex: 1;
  aspect-ratio: 1;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.pupil { width: 48%; aspect-ratio: 1; background: var(--ink); border-radius: 50%; transition: transform 0.08s linear; }

.barely { margin-top: 30px; border-top: 3px dashed var(--ink); padding-top: 16px; }
.barely-title { margin: 0 0 10px; font: 400 22px var(--hand); }
.barely ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.barely li {
  display: flex; align-items: center; gap: 6px;
  border: 2px solid #999; padding: 4px 10px 4px 4px;
  font: 400 16px var(--hand); color: #555; background: #fffdf6;
}
.barely img { width: 28px; height: 28px; filter: grayscale(1); opacity: 0.6; }

.level-foot { max-width: 1280px; margin: 22px 0 0; border-top: 1px solid rgba(90,60,30,.25); padding-top: 14px; font-size: 15px; color: #333; }
.level-foot p { margin: 0 0 8px; max-width: 80ch; }
.level-foot a { color: var(--ink); font-weight: 700; }

/* detail popup */
.detail {
  width: min(460px, calc(100% - 32px));
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 24px;
  background: var(--paper);
}
.detail::backdrop { background: #111a; }
.detail-close { float: right; font: 400 17px var(--hand); border: 2px solid var(--ink); background: var(--paper); padding: 4px 10px; cursor: pointer; }
.detail img { width: 140px; height: 140px; object-fit: contain; display: block; }
.detail h2 { font-family: var(--hand); font-weight: 400; font-size: 36px; margin: 8px 0 4px; line-height: 1.1; }
.detail-levels { list-style: none; margin: 16px 0 0; padding: 0; }
.detail-levels li { display: flex; justify-content: space-between; gap: 16px; border-top: 2px solid var(--ink); padding: 10px 0; }
.detail-levels li span:first-child { font-weight: 800; }
.detail-levels li span:last-child { text-align: right; }

.site-foot { padding: 18px 16px 28px; font-size: 13px; color: #8a8a8a; text-align: center; }
body.on-results .site-foot { background: var(--paper); color: #666; }
body:not(.on-results) .site-foot { display: none; }

/* =========================================================
   SMALL SCREENS
   ========================================================= */
@media (max-width: 820px) {
  .results-head { grid-template-columns: auto 1fr; align-items: start; }
  .results-head .place { grid-column: 1 / -1; grid-row: 2; }
  .levels { justify-content: flex-start; }
  .levels.file-tabs { padding: 0 4px; }
  .level-btn { padding: 11px 18px 10px; font-size: 19px; min-height: 44px; }
  .level-btn .tab-name { font-size: 14px; }
  .level-line { font-size: 23px; }
}

/* Short screens (phones sideways, small laptop windows): tighter logo and zip box so the intro fits */
@media (max-height: 560px) {
  .logo-wrap { --L: clamp(34px, 11vh, 80px); }
  .landing-center { gap: 14px; }
  .zip-form { gap: 6px; }
  .zip-form input { font-size: clamp(34px, 10vh, 56px); }
  .zip-label { font-size: 14px; padding: 4px 10px; }
  .zip-readout { font-size: 12px; }
  .go { font-size: 15px; padding: 8px 20px; }
}

@media (max-width: 480px) {
  .level-btn { padding: 11px 16px 10px; }
  .level-btn .tab-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   SOURCES PAGE
   ========================================================= */
.sources-head { grid-template-columns: auto 1fr; }
.sources .frame { display: grid; gap: 14px; }
.src-h {
  margin: 22px 0 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.15;
}
.src-h::before { content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .35em; vertical-align: -.05em; background: url("../assets/icons/icon-192.png") center / contain no-repeat; }
.sources .level-line { font-size: 23px; }
.src-p { margin: 0; max-width: 68ch; }
.src-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; max-width: 72ch; }
.sources a { color: var(--ink); font-weight: 700; }
.table-wrap { overflow-x: auto; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.src-table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 15px; background: #fffdf6; }
.src-table th {
  text-align: left;
  background: var(--ink);
  color: var(--hot);
  font: 400 18px var(--hand);
  padding: 8px 12px;
}
.src-table td { padding: 10px 12px; border-top: 1px solid #e3dccb; vertical-align: top; }
.src-table td:first-child { font: 400 17px var(--hand); white-space: nowrap; }
.src-table tbody tr:nth-child(odd) td { background: #f8f3e6; }

/* Sources link on the map */
.map-sources {
  position: absolute;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  color: var(--ink);
  font: 400 16px var(--hand);
  background: var(--paper);
  padding: 4px 12px;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  filter: url(#hand);
}
.map-sources:hover { background: var(--hot); }
.site-foot a { color: inherit; font-weight: 700; }

.map { touch-action: none; cursor: grab; }
.map-controls {
  position: absolute;
  z-index: 2;
  left: max(16px, env(safe-area-inset-left, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 6px;
}
.map-btn {
  min-width: 36px;
  height: 36px;
  font: 400 20px var(--hand);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  filter: url(#hand);
  padding: 0 10px;
  cursor: pointer;
}
.map-btn:hover { background: var(--hot); }
.map-reset { font-size: 13px; text-transform: uppercase; }
