/* Vault Of Memes: one stone wall, two materials (stone to read, brass to press). Pixel type, 22 px floor. */
@font-face { font-family: "Departure Mono"; src: url("/fonts/DepartureMono-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Pixeloid Sans"; src: url("/fonts/PixeloidSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --ink: #060907; --deep: #0c2e19; --mid: #1f7a3a; --acid: #39ff5a; --bone: #d8e6c8; --dim: #8fa88e; --warn: #ff6a5a;
  --mono: "Departure Mono", "Courier New", monospace;
  --display: "Pixeloid Sans", "Departure Mono", monospace;
  --label: 22px; --value: 33px; --hero: 44px; --title: 36px;
  --gap: 24px; --section: 72px; --col: 1760px;
  /* nine-slice insets, measured on the exported plates (tools/art-check.mjs bbox + a corner look at 4x) */
  --plaque-slice: 150; --plaque-w: 44px;
  --plate-slice: 120; --plate-w: 28px;
  --slot-slice: 110; --slot-w: 22px;
  --frame-slice: 150; --frame-w: 40px;
  --tablet-slice: 130; --tablet-w: 44px;
}
* { box-sizing: border-box; }
html { background: var(--ink); color: var(--bone); font: var(--label)/1.5 var(--mono); -webkit-font-smoothing: none; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--ink); }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
a { color: var(--acid); }
button { font: inherit; color: inherit; }
::selection { background: var(--acid); color: var(--ink); }
:focus-visible { outline: 3px solid var(--acid); outline-offset: 4px; }

/* ---------- the world behind the wall ---------- */
.world { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.world::before { content: ""; position: absolute; inset: -4%; background: url("/img/corridor-far.webp") center / cover no-repeat; filter: blur(6px) brightness(.55); }
#dust { position: absolute; inset: 0; width: 100%; height: 100%; }
#app { position: relative; z-index: 1; max-width: var(--col); margin: 0 auto; padding: 24px 16px 96px; }

/* ---------- type ---------- */
.carved { font: 700 var(--title)/1.3 var(--display); color: var(--acid); text-align: center; margin: 0 0 var(--gap); text-shadow: 0 0 2px rgba(57,255,90,.6), 0 0 18px rgba(57,255,90,.25); letter-spacing: .02em; }
.lede, .wall-note { text-align: center; max-width: 880px; margin: 0 auto var(--gap); color: var(--bone); }
.wall-note { color: var(--dim); }

/* ---------- surfaces ---------- */
.plaque {
  border-style: solid; border-width: var(--plaque-w); border-image: url("/img/plaque.webp") var(--plaque-slice) fill / var(--plaque-w) / 0 stretch;
  padding: 8px 12px; filter: drop-shadow(0 8px 0 rgba(0,0,0,.45));
}
.plate {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 6px 22px;
  border-style: solid; border-width: var(--plate-w); border-image: url("/img/button.webp") var(--plate-slice) fill / var(--plate-w) / 0 stretch;
  color: var(--ink); text-decoration: none; cursor: pointer; background: none; line-height: 1.2; white-space: nowrap; user-select: none;
  transition: transform .08s ease, filter .12s ease;
}
.plate:hover { filter: brightness(1.12) drop-shadow(0 0 10px rgba(57,255,90,.55)); }
.plate:active { transform: translateY(3px); }
.plate[disabled], .plate[aria-disabled="true"] { border-image-source: url("/img/button-dim.webp"); color: var(--dim); cursor: not-allowed; pointer-events: none; filter: none; }
.plate[aria-disabled="true"] { pointer-events: auto; }
.plate-big { min-height: 72px; font-size: var(--value); padding: 8px 30px; }
.plate-mark { min-width: 88px; padding: 6px 18px; }
.plate-mark img { width: 34px; height: 34px; object-fit: contain; }
.plate-mark[aria-disabled="true"] img { opacity: .45; filter: grayscale(1); }
.slot {
  width: 100%; min-height: 56px; padding: 8px 18px; color: var(--acid); background: none; font: inherit;
  border-style: solid; border-width: var(--slot-w); border-image: url("/img/slot.webp") var(--slot-slice) fill / var(--slot-w) / 0 stretch; outline: none;
}
.slot::placeholder { color: var(--dim); }
.slot:focus { filter: drop-shadow(0 0 8px rgba(57,255,90,.5)); }
textarea.slot { resize: vertical; line-height: 1.4; }
.file { position: relative; display: flex; align-items: center; gap: 14px; }
.file input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file .plate { pointer-events: none; min-height: 48px; padding: 4px 18px; font-size: 20px; }
.file-name { flex: 1; min-width: 0; color: var(--bone); overflow-wrap: anywhere; font-size: 20px; }
.file:focus-within .plate { outline: 3px solid var(--acid); outline-offset: 3px; }

/* ---------- entrance ---------- */
.entrance { padding-top: 8px; }
.lintel { margin: 0 auto 4px; max-width: 960px; }
.lintel img { width: 100%; }
.lede { margin-bottom: 18px; }
.entrance-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--gap); align-items: stretch; margin-top: 8px; }
.gate { position: relative; display: flex; flex-direction: column; min-width: 0; }
.gate-door { position: relative; margin: 0 auto; width: min(100%, 600px); }
.gate .contract { position: relative; z-index: 2; width: min(100%, 640px); margin: -19% auto 0; }
.gate-glow { position: absolute; inset: 18% 12% 16% 60%; background: radial-gradient(ellipse at 40% 50%, rgba(57,255,90,.45), rgba(57,255,90,0) 70%); filter: blur(24px); animation: breathe 5.2s steps(8) infinite; pointer-events: none; mix-blend-mode: screen; }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.contract { display: flex; flex-direction: column; gap: 10px; }
.contract-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; border-bottom: 3px solid rgba(57,255,90,.35); padding-bottom: 10px; }
.contract-name { font: 700 var(--title)/1.3 var(--display); color: var(--bone); }
.contract-ticker { font-size: var(--value); color: var(--acid); }
.contract-label { color: var(--dim); }
.contract-address { font-size: 26px; line-height: 1.35; color: var(--acid); min-width: 0; overflow-wrap: anywhere; user-select: all; min-height: 2.7em; }
.contract-address.empty { color: var(--dim); user-select: none; }
.contract-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.contract-note { color: var(--dim); min-height: 1.5em; }
.contract-note.ok { color: var(--acid); }
.contract-note.bad { color: var(--warn); }

.desk { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.counter { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 0 14px; border-bottom: 3px solid rgba(57,255,90,.35); }
.counter-number { font: 700 clamp(64px, 6vw, 96px)/1.2 var(--display); color: var(--acid); text-shadow: 0 0 2px rgba(57,255,90,.7), 0 0 26px rgba(57,255,90,.35); font-variant-numeric: tabular-nums; }
.counter-label { font-size: var(--value); color: var(--bone); margin-top: 6px; }
.counter-sub { color: var(--dim); margin-top: 4px; }
.desk-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.desk-nav .plate-big { grid-column: 1 / -1; }
.rules { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.rule { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: baseline; padding: 6px 0; border-top: 2px solid rgba(216,230,200,.14); }
.rule b { font: 700 var(--value)/1.3 var(--display); color: var(--acid); }
.rule span { color: var(--bone); line-height: 1.4; }

/* ---------- the wall of doors ---------- */
.wall, .wing, .exhibits-wrap { margin-top: var(--section); }
/* the stone wall the doors hang on, and the flagstone floor under the last row */
.wall { position: relative; padding: 24px 24px 0; }
.wall::before { content: ""; position: absolute; inset: 120px 0 0; background: url("/img/wall-tile.webp") center top / 512px 512px repeat; opacity: .38; z-index: -1; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 140px, #000 calc(100% - 60px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 140px, #000 calc(100% - 60px), transparent); }
.wall .doors { padding-bottom: 12px; }
.wall::after { content: ""; display: block; height: 72px; margin: 0 -24px; background: url("/img/floor.webp") center top / auto 100% repeat-x; opacity: .9; }
.doors { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px 20px; align-items: end; }
.door { position: relative; display: block; text-decoration: none; color: var(--bone); transition: transform .12s ease, filter .12s ease; }
.door:hover, .door:focus-visible { transform: scale(1.03); filter: drop-shadow(0 0 14px rgba(57,255,90,.55)); z-index: 1; }
.door-lamp { position: absolute; right: 0; top: -5%; width: 40%; z-index: 2; pointer-events: none; }
.door-lamp img { width: 100%; }
.door-lamp.on { animation: flicker 6.5s steps(1) infinite; }
@keyframes flicker { 0%, 91%, 100% { filter: drop-shadow(0 0 10px rgba(57,255,90,.8)); } 92% { filter: drop-shadow(0 0 3px rgba(57,255,90,.4)); } 94% { filter: drop-shadow(0 0 12px rgba(57,255,90,.9)); } 95.5% { filter: drop-shadow(0 0 4px rgba(57,255,90,.4)); } }
.door-body { position: relative; }
.door-body > img { width: 100%; }
.door-port { position: absolute; left: 39%; top: 27%; width: 22%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--ink); }
.door-port canvas, .door-port img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.door-port img { opacity: 0; transition: opacity .25s ease; }
.door:hover .door-port img { opacity: 1; }
.door-count { position: absolute; left: 33%; top: 44.5%; width: 34%; height: 9.5%; display: flex; align-items: center; justify-content: center; font: 700 clamp(18px, 1.5vw, 33px)/1.15 var(--display); color: var(--acid); text-shadow: 0 0 6px rgba(57,255,90,.5); }
.door-ribbon { position: absolute; left: 5%; bottom: 7%; width: 30%; z-index: 2; filter: drop-shadow(0 4px 0 rgba(0,0,0,.5)); }
.door-caption { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 8px; padding: 8px 6px 10px; min-height: 96px; border-top: 3px solid rgba(57,255,90,.35); }
.door-caption b { color: var(--acid); font-size: var(--label); }
.door-caption i { font-style: normal; color: var(--bone); overflow-wrap: break-word; line-height: 1.3; }
.door-caption em { font-style: normal; color: var(--dim); font-size: 18px; margin-top: 2px; }
.door.memorial .door-body > img { filter: brightness(.6); }
.arch { opacity: .8; }
.arch img { width: 100%; }
.arch .door-caption { visibility: hidden; }

/* ---------- memorial wing ---------- */
.wing { padding: 32px 0 0; }
.tablets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 24px; align-items: stretch; padding-top: 52px; }
.tablet { position: relative; display: flex; flex-direction: column; gap: 8px; border-style: solid; border-width: var(--tablet-w); border-image: url("/img/tombstone.webp") var(--tablet-slice) fill / var(--tablet-w) / 0 stretch; padding: 26px 10px 8px; color: var(--bone); text-decoration: none; transition: transform .12s, filter .12s; }
.tablet:hover, .tablet:focus-visible { transform: scale(1.02); filter: drop-shadow(0 0 14px rgba(57,255,90,.45)); }
/* the wreath bump, laid on at the plate's own scale so the nine-slice never stretches it (tools/tablet.mjs) */
.tablet::before { content: ""; position: absolute; left: 50%; top: calc(-135 * var(--tablet-w) / 130 - var(--tablet-w)); width: calc(576 * var(--tablet-w) / 130); aspect-ratio: 576 / 273; transform: translateX(-50%); background: url("/img/wreath.webp") center / 100% 100% no-repeat; pointer-events: none; }
.tablet-name { font: 700 28px/1.3 var(--display); color: var(--bone); text-align: center; }
.tablet-ticker { text-align: center; color: var(--acid); }
.tablet-row { display: flex; justify-content: space-between; gap: 12px; border-top: 2px solid rgba(216,230,200,.14); padding-top: 6px; }
.tablet-row span:first-child { color: var(--dim); }
.tablet-row span:last-child { color: var(--acid); font-variant-numeric: tabular-nums; }
.candles { display: flex; justify-content: center; gap: 48px; margin-top: 28px; }
.candle { width: 72px; aspect-ratio: 2 / 3; background: url("/img/candle-1.webp") center / contain no-repeat; animation: candle 1.8s steps(1) infinite; }
.candle-b { animation-delay: -.6s; } .candle-c { animation-delay: -1.2s; }
@keyframes candle { 0% { background-image: url("/img/candle-1.webp"); } 33% { background-image: url("/img/candle-2.webp"); } 66% { background-image: url("/img/candle-3.webp"); } }

/* ---------- hall ---------- */
.back { margin-bottom: 20px; }
.hall-head { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.hall-head .hall-logo { position: relative; aspect-ratio: 1; overflow: hidden; border-style: solid; border-width: var(--frame-w); border-image: url("/img/frame.webp") var(--frame-slice) / var(--frame-w) / 0 stretch; }
.hall-logo canvas, .hall-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.hall-logo img { opacity: 0; transition: opacity .25s; }
.hall-logo:hover img { opacity: 1; }
.hall-meta { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hall-name { font: 700 clamp(36px, 3.4vw, 54px)/1.25 var(--display); color: var(--bone); overflow-wrap: anywhere; }
.hall-ticker { font-size: var(--value); color: var(--acid); }
.hall-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; color: var(--dim); }
.hall-status b { color: var(--acid); }
.hall-status.memorial b { color: var(--bone); }
.hall-desc { color: var(--bone); }
.hall-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; border-top: 3px solid rgba(57,255,90,.35); padding-top: 12px; }
.fact span { display: block; color: var(--dim); font-size: 18px; }
.fact b { font: 700 28px/1.3 var(--display); color: var(--acid); overflow-wrap: anywhere; }
.hall-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.hall-address { font-size: 20px; color: var(--acid); overflow-wrap: anywhere; user-select: all; }

.exhibits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 24px; }
.exhibit { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--bone); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.exhibit-frame { position: relative; aspect-ratio: 1; border-style: solid; border-width: var(--frame-w); border-image: url("/img/frame.webp") var(--frame-slice) / var(--frame-w) / 0 stretch; background: var(--ink); overflow: hidden; transition: transform .12s, filter .12s; }
.exhibit:hover .exhibit-frame, .exhibit:focus-visible .exhibit-frame { transform: scale(1.03); filter: drop-shadow(0 0 14px rgba(57,255,90,.5)); }
.exhibit-frame canvas, .exhibit-frame img.colour { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.exhibit-frame img.colour { opacity: 0; transition: opacity .3s; }
.exhibit:hover .exhibit-frame img.colour { opacity: 1; }
.exhibit-seal { position: absolute; right: -6px; bottom: -6px; width: 30%; z-index: 2; display: flex; align-items: center; justify-content: center; }
.exhibit-seal img { width: 100%; }
.exhibit-seal b { position: absolute; font: 700 22px/1.3 var(--display); color: var(--ink); }
.exhibit-caption { display: flex; flex-direction: column; gap: 2px; padding: 0 6px; }
.exhibit-caption b { color: var(--bone); overflow-wrap: anywhere; }
.exhibit-caption span { color: var(--dim); font-size: 18px; }
.exhibit-caption a { color: var(--acid); font-size: 18px; overflow-wrap: anywhere; }
.exhibit.waiting .exhibit-frame { filter: brightness(.6); }
.exhibit.waiting .exhibit-frame::after { content: "waiting for the archive"; position: absolute; left: 0; right: 0; bottom: 0; padding: 8px; text-align: center; background: rgba(6,9,7,.8); color: var(--dim); font-size: 18px; }

.shelf { margin-top: var(--section); display: flex; flex-direction: column; gap: 12px; }
.shelf h3 { font: 700 28px/1.3 var(--display); color: var(--bone); margin: 0; }
.shelf p { margin: 0; color: var(--dim); }
.shelf .hall-actions { margin-top: 4px; }

/* ---------- sheets (dialogs) ---------- */
.sheet { border: 0; padding: 0; background: transparent; max-width: min(96vw, 980px); width: 100%; color: var(--bone); margin: auto; }
.sheet::backdrop { background: rgba(2,4,3,.82); }
.form { display: flex; flex-direction: column; gap: 18px; }
.form-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 3px solid rgba(57,255,90,.35); padding-bottom: 10px; }
.form-head h2 { font: 700 28px/1.3 var(--display); margin: 0; color: var(--bone); }
.form-lede { margin: 0; color: var(--bone); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { color: var(--dim); font-size: 18px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; align-items: center; }
.form-status { min-height: 1.5em; color: var(--dim); }
.form-status.ok { color: var(--acid); } .form-status.bad { color: var(--warn); }
.viewer-body { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.viewer-close { align-self: flex-end; }
.viewer-frame { position: relative; width: 100%; max-width: 860px; max-height: 70vh; border-style: solid; border-width: var(--frame-w); border-image: url("/img/frame.webp") var(--frame-slice) / var(--frame-w) / 0 stretch; background: var(--ink); }
.viewer-frame img { max-height: calc(70vh - 2 * var(--frame-w)); width: auto; max-width: 100%; margin: 0 auto; object-fit: contain; }
.viewer-caption { width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 6px; }
.viewer-caption b { color: var(--bone); }
.viewer-caption p { margin: 0; color: var(--bone); white-space: pre-wrap; }
.viewer-caption a { color: var(--acid); overflow-wrap: anywhere; }

/* ---------- widths ---------- */
@media (max-width: 1500px) { .doors { grid-template-columns: repeat(5, minmax(0, 1fr)); } .exhibits { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .doors { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tablets { grid-template-columns: 1fr 1fr; } .entrance-row { grid-template-columns: minmax(0, 1fr); } .gate-door { width: min(100%, 560px); } }
@media (max-width: 820px) {
  :root { --plaque-w: 34px; --plate-w: 22px; --slot-w: 18px; --frame-w: 28px; --tablet-w: 34px; --section: 56px; }
  .doors { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 12px; }
  .exhibits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
  .tablets { grid-template-columns: 1fr; }
  .hall-head { grid-template-columns: 1fr; }
  .hall-head .hall-logo { width: min(100%, 240px); margin: 0 auto; }
  .form-grid { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 110px 1fr; }
  .plate-big { font-size: 26px; }
}
@media (max-width: 560px) {
  .file { flex-wrap: wrap; }
  .file .plate { font-size: 18px; padding: 4px 14px; }
  .file-name { flex-basis: 100%; }
  .form-head { flex-wrap: wrap; }
  .form-head .plate { margin-left: auto; }
  .sheet { max-width: calc(100vw - 12px); }
  .hall-actions .plate-text, .form-actions .plate, .shelf .plate, .back { white-space: normal; text-align: center; max-width: 100%; }
  .shelf .plate-big, .form-actions .plate-big { width: 100%; padding-left: 18px; padding-right: 18px; }
  .doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .door-caption { min-height: 110px; }
  .contract-address { font-size: 22px; }
  .contract-actions .plate-mark { min-width: 72px; flex: 1; }
  .desk-nav { grid-template-columns: 1fr; }
  .counter-number { font-size: 64px; }
  .candles { gap: 20px; } .candle { width: 56px; }
  .exhibit-seal b { font-size: 18px; }
}
@media (max-width: 360px) {
  .desk-nav .plate, .contract-actions .plate-text, .form-actions .plate, .hall-actions .plate-text, .back { white-space: normal; text-align: center; padding-left: 14px; padding-right: 14px; }
  .plate-big { font-size: 24px; }
  .rule { grid-template-columns: 1fr; gap: 4px; }
  .door-count { font-size: 16px; }
  .file .plate { white-space: normal; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .gate-glow, .door-lamp.on, .candle { animation: none; }
  .plate, .door, .exhibit-frame { transition: none; }
}
