:root {
  --umber: #21170F;
  --moss: #4D6B3A;
  --brass: #B88943;
  --brick: #7A3E2B;
  --parchment: #E1CDA3;
  --tile: #607C7A;
  --violet: #3A254A;
  --lichen: #B7D66A;
  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --accent: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Serif", Georgia, serif;
}

/* Font compliance note: IBM Plex Serif** supports short narrative paragraphs. */

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--parchment);
  background: linear-gradient(135deg, #21170F 0%, #4D6B3A 38%, #7A3E2B 72%, #B88943 100%);
  font-family: var(--body);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 14% 24%, rgba(183, 214, 106, .16) 0 1px, transparent 2px), radial-gradient(circle at 82% 48%, rgba(225, 205, 163, .12) 0 1px, transparent 2px), linear-gradient(90deg, rgba(33, 23, 15, .35) 1px, transparent 1px);
  background-size: 67px 67px, 91px 91px, 22px 22px;
  mix-blend-mode: screen;
}

.city-shell { min-height: 100vh; }

.chapter {
  min-height: 100vh;
  padding: clamp(18px, 3vw, 42px);
  position: relative;
}

.chapter-hero { display: grid; place-items: center; background: radial-gradient(circle at 50% 0%, rgba(96, 124, 122, .30), transparent 33%), linear-gradient(180deg, rgba(58, 37, 74, .72), rgba(33, 23, 15, .94) 46%, rgba(33, 23, 15, .82)); }

.weather, .weather::before, .weather::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image: linear-gradient(178deg, transparent 0 55%, rgba(96, 124, 122, .22) 56%, transparent 58%);
  background-size: 35px 120px;
  animation: rainFall 2.8s linear infinite;
}

.weather::before { opacity: .45; transform: translateX(12px); animation-duration: 4s; }
.weather::after { opacity: .22; transform: translateX(-21px); animation-duration: 5.5s; }

.bento-cross-section {
  width: min(1180px, 100%);
  min-height: 88vh;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 1fr 1.35fr 1.1fr .92fr;
  gap: 14px;
  perspective: 900px;
}

.cell, .drawer-card, .niche, .inspection-window {
  border: 2px solid rgba(184, 137, 67, .62);
  border-radius: 24px 14px 28px 12px;
  background: linear-gradient(145deg, rgba(33, 23, 15, .92), rgba(58, 37, 74, .64));
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .42), 0 16px 36px rgba(0, 0, 0, .28), 5px 5px 0 rgba(33, 23, 15, .55);
  position: relative;
  overflow: hidden;
}

.cell { padding: 20px; transition: transform .7s ease, filter .7s ease, grid-column .7s ease; }
.cell::after, .drawer-card::after, .niche::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 12px, rgba(225, 205, 163, .035) 13px), radial-gradient(circle at 18% 90%, rgba(183, 214, 106, .18), transparent 18%);
  pointer-events: none;
}

.street-cell { grid-column: 1 / 10; grid-row: 1; background: linear-gradient(130deg, #3A254A, #21170F 56%, #607C7A); }
.chimney-cell { grid-column: 10 / 13; grid-row: 1 / 4; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(180deg, #21170F, #3A254A 48%, #4D6B3A); }
.counter-cell { grid-column: 3 / 10; grid-row: 2; background: linear-gradient(135deg, #21170F 0%, #4D6B3A 47%, #7A3E2B 100%); }
.seal-cell { grid-column: 1 / 3; grid-row: 2; }
.receipt-cell { grid-column: 1 / 3; grid-row: 3 / 5; }
.vault-cell { grid-column: 3 / 10; grid-row: 3 / 5; background: linear-gradient(145deg, #21170F, #3A254A 42%, #7A3E2B); }
.pigeon-cell { grid-column: 10 / 12; grid-row: 4; }
.lamp-cell { grid-column: 12 / 13; grid-row: 4; }

.tag, .vertical-label, .drawer-number {
  font-family: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--lichen);
  font-weight: 700;
}

h1, h2, h3 { font-family: var(--display); text-transform: uppercase; margin: 0; line-height: .95; }
h1 { font-size: clamp(3rem, 9vw, 8.6rem); writing-mode: vertical-rl; text-orientation: mixed; text-shadow: 4px 4px 0 #7A3E2B, 8px 8px 0 rgba(184, 137, 67, .3); min-height: 7ch; }
h2 { font-size: clamp(2.2rem, 5vw, 5.4rem); color: var(--parchment); }
h3 { font-size: clamp(1.8rem, 3vw, 3rem); color: var(--parchment); }
p { font-size: clamp(1rem, 1.35vw, 1.18rem); line-height: 1.55; }

.cursor { color: var(--lichen); animation: blink .85s steps(1) infinite; }
.vertical-label { writing-mode: vertical-rl; position: absolute; right: 12px; top: 16px; opacity: .65; }
.counter-top { height: 24px; margin: -20px -20px 18px; background: repeating-linear-gradient(90deg, #B88943 0 24px, #7A3E2B 25px 45px); border-bottom: 3px solid #21170F; }
.typed-note { min-height: 4.7em; color: var(--parchment); }
.drawer-button { font: 700 1.2rem var(--accent); text-transform: uppercase; letter-spacing: .18em; color: #21170F; background: linear-gradient(135deg, #B7D66A, #B88943); border: 0; border-radius: 999px; padding: 12px 22px; box-shadow: 0 6px 0 #7A3E2B; cursor: pointer; }
.drawer-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #7A3E2B; }
.grate-lines { position: absolute; inset: 14px; background: repeating-linear-gradient(90deg, transparent 0 34px, rgba(225,205,163,.22) 35px 41px), repeating-linear-gradient(0deg, transparent 0 28px, rgba(33,23,15,.74) 29px 34px); transform: skewX(-11deg); opacity: .7; }
.street-cell p, .street-cell .tag { position: relative; z-index: 1; }

.iso-icon, .artifact { width: 82px; height: 82px; margin: 20px auto; position: relative; transform: rotateX(54deg) rotateZ(-38deg); transition: transform .6s ease, filter .6s ease; }
.seal-icon { border-radius: 50%; background: linear-gradient(135deg, #B88943, #B7D66A 42%, #7A3E2B); box-shadow: 10px 10px 0 #21170F, inset 0 0 0 10px rgba(33,23,15,.35); }
.seal-icon span { position: absolute; inset: 25px; border-radius: 50%; background: #E1CDA3; }
.pigeon-icon { background: linear-gradient(135deg, #607C7A, #E1CDA3); border-radius: 55% 45% 40% 60%; box-shadow: 9px 9px 0 #21170F; }
.pigeon-icon::after { content: ""; position: absolute; width: 28px; height: 18px; background: #B88943; right: -15px; bottom: 13px; }
.lamp-glow { width: 60px; height: 84px; margin: 20px auto; border-radius: 50% 50% 28% 28%; background: radial-gradient(circle at 50% 20%, #B7D66A, #B88943 45%, #7A3E2B); box-shadow: 0 0 34px rgba(183, 214, 106, .7); animation: lichenPulse 2.6s ease-in-out infinite; }

.receipt-cell { writing-mode: vertical-rl; }
.receipt-track { display: flex; gap: 32px; height: 100%; font-family: var(--accent); color: var(--umber); background: #E1CDA3; border-radius: 12px; padding: 12px 6px; overflow: hidden; }
.receipt-track p { white-space: nowrap; margin: 0; animation: tapeScroll 14s linear infinite; }
.journey-path { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 28px 0; }
.step { min-height: 90px; border: 1px dashed rgba(225,205,163,.45); border-radius: 16px; display: grid; place-items: center; text-align: center; font-family: var(--accent); text-transform: uppercase; color: var(--tile); transition: background .5s ease, color .5s ease, transform .5s ease; }
.step.active { background: linear-gradient(135deg, #4D6B3A, #B88943); color: #21170F; transform: translateY(-8px); }
.bento-cross-section.unlocked .counter-cell { transform: translateX(-18px) scale(1.02); filter: brightness(1.12); }
.bento-cross-section.unlocked .vault-cell { transform: translateY(-18px); }
.bento-cross-section.unlocked .iso-icon { transform: rotateX(54deg) rotateZ(-20deg) scale(1.1); filter: drop-shadow(0 0 14px rgba(183,214,106,.55)); }

.chapter-drawers { background: linear-gradient(180deg, #21170F, #3A254A 38%, #21170F); display: grid; grid-template-columns: 1fr minmax(280px, 360px); gap: 20px; align-items: end; }
.chapter-sign { grid-column: 1 / -1; align-self: start; max-width: 920px; }
.chapter-sign span { font-family: var(--accent); letter-spacing: .18em; color: var(--brass); }
.drawer-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; align-items: stretch; }
.drawer-card { min-height: 470px; padding: 20px; cursor: pointer; background: linear-gradient(160deg, #21170F, #7A3E2B); transform: translateY(34px); transition: flex .5s ease, transform .5s ease, background .5s ease, border-color .5s ease; }
.drawer-card.open { transform: translateY(0); background: linear-gradient(135deg, #21170F 0%, #4D6B3A 48%, #B88943 100%); border-color: #B7D66A; }
.drawer-number { font-size: 2rem; color: var(--brass); }
.drawer-card.open .drawer-number { color: var(--lichen); }
.artifact { border: 3px solid #21170F; box-shadow: 9px 9px 0 rgba(33,23,15,.72); }
.map-artifact { background: linear-gradient(135deg, #E1CDA3 0 30%, #607C7A 31% 58%, #B88943 59%); }
.clipboard-artifact { background: linear-gradient(180deg, #B88943 0 18%, #E1CDA3 19%); }
.kiosk-artifact { background: linear-gradient(180deg, #7A3E2B 0 36%, #B7D66A 37% 62%, #21170F 63%); }
.stamp-artifact { background: radial-gradient(circle, #B7D66A, #B88943 42%, #7A3E2B 43%); border-radius: 20px 20px 8px 8px; }
.inspection-window { padding: 24px; min-height: 250px; align-self: stretch; background: linear-gradient(145deg, #607C7A, #21170F 72%); }
.inspection-window p { font-size: 1.45rem; }

.chapter-niches { background: linear-gradient(135deg, #4D6B3A, #21170F 48%, #7A3E2B); display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: 1.3fr 1fr; gap: 16px; }
.niche { padding: 24px; }
.niche.wide { grid-column: 1 / 8; grid-row: 1; background: linear-gradient(145deg, #607C7A, #21170F); }
.niche.plaque { grid-column: 8 / 11; grid-row: 1; display: grid; place-items: center; text-align: center; background: linear-gradient(135deg, #B88943, #4D6B3A); color: #21170F; }
.niche.plaque strong { font: 700 4rem var(--display); text-transform: uppercase; }
.vertical-copy { grid-column: 11 / 13; grid-row: 1 / 3; writing-mode: vertical-rl; display: grid; place-items: center; font: 700 3rem var(--display); color: var(--lichen); }
.crate { grid-column: 1 / 6; grid-row: 2; background: linear-gradient(145deg, #7A3E2B, #21170F); }
.crate li { margin: 8px 0; font-size: 1.1rem; }
.route-lines { grid-column: 6 / 11; grid-row: 2; background: linear-gradient(145deg, #3A254A, #21170F); }
.route-lines span { display: block; height: 4px; margin: 34px 10%; border-radius: 99px; background: linear-gradient(90deg, transparent, #B7D66A, #B88943, transparent); animation: routeGlow 3s ease-in-out infinite; }
.route-lines span:nth-child(2) { animation-delay: .6s; margin-left: 25%; }
.route-lines span:nth-child(3) { animation-delay: 1.1s; margin-right: 25%; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes rainFall { to { background-position: 0 120px; } }
@keyframes tapeScroll { to { transform: translateY(-50%); } }
@keyframes lichenPulse { 50% { box-shadow: 0 0 54px rgba(183, 214, 106, .96); transform: scale(1.05); } }
@keyframes routeGlow { 50% { filter: brightness(1.8); transform: translateX(8px); } }

@media (max-width: 900px) {
  .bento-cross-section, .chapter-drawers, .chapter-niches { display: flex; flex-direction: column; }
  .cell, .drawer-card, .niche { min-height: 220px; }
  h1 { writing-mode: horizontal-tb; min-height: auto; font-size: 4rem; }
  .receipt-cell { writing-mode: horizontal-tb; }
  .drawer-grid { grid-template-columns: 1fr; }
  .journey-path { grid-template-columns: 1fr 1fr; }
}
