:root {
  /* compliance terms from DESIGN.md: Mono** labels chapter titles larger riddle statements. stamped */
  --peat: #17130E;
  --soil: #4A3324;
  --moss: #6F7B55;
  --amber: #B98645;
  --bone: #E6D8BE;
  --glass: #D8E2D1;
  --oxide: #8C3F2B;
  --plex: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --space: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --spectral: "Spectral", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--bone);
  background:
    radial-gradient(circle at 18% 12%, rgba(111, 123, 85, .25), transparent 28rem),
    radial-gradient(circle at 80% 26%, rgba(140, 63, 43, .18), transparent 24rem),
    linear-gradient(135deg, #17130E 0%, #231A12 46%, #0f0d09 100%);
  font-family: var(--plex);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background-image:
    linear-gradient(rgba(216, 226, 209, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 226, 209, .02) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: rotate(-3deg);
  pointer-events: none;
}

.drawer-haze {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: radial-gradient(circle, rgba(216,226,209,.24), rgba(216,226,209,.08) 35%, transparent 72%);
  backdrop-filter: blur(10px);
  animation: clearCondensation 3s ease forwards;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: .32;
  background-image: radial-gradient(rgba(230,216,190,.18) .6px, transparent .8px);
  background-size: 7px 7px;
  mix-blend-mode: overlay;
}

.archive-shell {
  position: relative;
  z-index: 2;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 44px) 80px;
}

.index-tabs {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  padding: 8px;
  border: 1px solid rgba(216,226,209,.18);
  border-radius: 999px;
  background: rgba(23,19,14,.48);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 0 25px rgba(216,226,209,.06), 0 14px 45px rgba(0,0,0,.28);
}

.index-tabs a {
  color: rgba(230,216,190,.78);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: .18em;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}

.index-tabs a:hover { background: rgba(185,134,69,.18); color: var(--bone); transform: translateY(-1px); }

.cluster { min-height: 100vh; position: relative; padding: 76px 0 40px; }

.drawer-panel {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(118px, auto);
  gap: clamp(12px, 2vw, 24px);
  align-items: start;
}

.accession-label {
  grid-column: 1 / 5;
  padding: 18px 20px;
  border-left: 3px solid var(--amber);
  background: rgba(74, 51, 36, .38);
  box-shadow: 0 18px 60px rgba(0,0,0,.28);
  transform: rotate(-1deg);
}

.accession-label span, .accession-label small, .card-meta, .drawer-title span, .coordinate-pill, .scene-close, .scene-pinned, .scene-copy span {
  display: block;
  font-family: var(--plex);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(230,216,190,.66);
}

.accession-label strong {
  display: block;
  margin: 8px 0;
  font-family: var(--space);
  font-size: clamp(24px, 3.2vw, 46px);
  letter-spacing: -.05em;
  color: var(--bone);
  text-shadow: 2px 0 rgba(140,63,43,.32), -1px 0 rgba(216,226,209,.18);
}

.clue-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(216,226,209,.22);
  border-radius: 24px 18px 28px 16px;
  padding: 18px;
  min-height: 250px;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(216,226,209,.16), rgba(216,226,209,.04) 42%, rgba(74,51,36,.36)),
    rgba(74,51,36,.28);
  backdrop-filter: blur(18px) saturate(115%);
  box-shadow:
    inset 0 1px rgba(255,255,255,.18),
    inset 18px -18px 42px rgba(23,19,14,.22),
    0 22px 70px rgba(0,0,0,.34);
  transition: transform .35s ease, border-color .35s ease, filter .35s ease, box-shadow .35s ease;
  animation: cardDrift 8s ease-in-out infinite alternate;
}

.clue-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 12% 8%, rgba(255,255,255,.18), transparent 16rem), linear-gradient(110deg, transparent 15%, rgba(216,226,209,.13) 42%, transparent 46%);
  pointer-events: none;
}

.clue-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(216,226,209,.08);
  border-radius: inherit;
  box-shadow: inset 0 0 40px rgba(23,19,14,.32);
  pointer-events: none;
}

.clue-card:hover, .clue-card.is-warm {
  transform: translateY(-8px) rotate(0deg) scale(1.015);
  border-color: rgba(185,134,69,.65);
  filter: saturate(1.12);
  box-shadow: inset 0 1px rgba(255,255,255,.22), 0 30px 90px rgba(0,0,0,.46), 0 0 44px rgba(185,134,69,.16);
}

.clue-card h1, .clue-card h2, .drawer-title h1, .scene-copy h2 {
  position: relative;
  margin: 14px 0 10px;
  font-family: var(--space);
  line-height: 1.02;
  color: var(--bone);
  letter-spacing: -.04em;
}

.clue-card h1 { font-size: clamp(38px, 7vw, 90px); }
.clue-card h2 { font-size: clamp(22px, 2.4vw, 36px); }

.clue-card p {
  position: relative;
  margin: 0;
  line-height: 1.55;
  color: rgba(230,216,190,.78);
  font-size: 14px;
}

.spectral-note { font-family: var(--spectral); font-size: 18px !important; font-style: italic; }
.warning { color: var(--oxide); }

.wide { grid-column: 5 / 11; grid-row: 1 / span 3; }
.bubble-card { grid-column: 2 / 5; grid-row: 3 / span 3; background-color: rgba(111,123,85,.22); }
.tag-card { grid-column: 8 / 13; grid-row: 4 / span 2; background-color: rgba(74,51,36,.42); }
.locked-card { grid-column: 1 / 6; grid-row: 6 / span 2; background-color: rgba(185,134,69,.12); }
.rotate-left { transform: rotate(-1.4deg); }
.rotate-right { transform: rotate(1.6deg); }
.overlap { margin-top: -44px; transform: rotate(.8deg); }

.vintage-photo {
  position: relative;
  height: 280px;
  margin: 10px 0 18px;
  border: 12px solid var(--bone);
  border-bottom-width: 34px;
  background:
    radial-gradient(ellipse at 64% 50%, rgba(23,19,14,.04), rgba(23,19,14,.62) 10%, transparent 12%),
    linear-gradient(150deg, rgba(230,216,190,.18), transparent 35%),
    repeating-linear-gradient(90deg, rgba(23,19,14,.2) 0 2px, transparent 2px 12px),
    linear-gradient(#6F7B55, #4A3324 55%, #17130E);
  filter: sepia(.55) blur(2px) contrast(.92);
  transition: filter .5s ease, transform .5s ease;
}

.photo-card:hover .vintage-photo { filter: sepia(.5) blur(.2px) contrast(1.08); transform: scale(1.012); }
.photo-time { position: absolute; right: 10px; bottom: -27px; color: var(--soil); font-size: 12px; }
.blur-subject { position: absolute; right: 20%; top: 28%; width: 54px; height: 128px; border-radius: 48%; background: rgba(23,19,14,.58); filter: blur(10px); }

.clip-pin { position: absolute; top: 10px; right: 38px; width: 48px; height: 12px; border-radius: 20px; background: var(--amber); box-shadow: 0 4px 18px rgba(0,0,0,.25); transform: rotate(8deg); z-index: 1; }
.diegetic-button { position: relative; margin-top: 18px; border: 1px solid rgba(230,216,190,.26); color: var(--bone); background: rgba(23,19,14,.22); border-radius: 999px; padding: 10px 14px; font-family: var(--plex); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.diegetic-button:hover { background: rgba(185,134,69,.22); }

.jar-window { position: relative; height: 180px; border-radius: 45% 45% 34% 34%; border: 1px solid rgba(216,226,209,.24); background: linear-gradient(rgba(216,226,209,.18), rgba(111,123,85,.18)); box-shadow: inset 0 0 35px rgba(216,226,209,.12); }
.jar-window i, .scene-mechanism i { position: absolute; bottom: 8px; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(216,226,209,.6); background: rgba(216,226,209,.16); animation: bubbleRise 5s infinite ease-in; }
.jar-window i:nth-child(1) { left: 18%; animation-delay: 0s; }
.jar-window i:nth-child(2) { left: 34%; width: 9px; height: 9px; animation-delay: 1.2s; }
.jar-window i:nth-child(3) { left: 56%; animation-delay: 2.1s; }
.jar-window i:nth-child(4) { left: 72%; width: 20px; height: 20px; animation-delay: .7s; }
.jar-window i:nth-child(5) { left: 45%; width: 7px; height: 7px; animation-delay: 3s; }

.mud-print { margin-top: 24px; width: 122px; height: 70px; border-radius: 50%; background: radial-gradient(circle at 26% 34%, rgba(23,19,14,.34) 0 12px, transparent 13px), radial-gradient(circle at 60% 46%, rgba(23,19,14,.28) 0 18px, transparent 19px); filter: blur(1px); }
.keyhole-mark { display: grid; place-items: center; width: 120px; height: 120px; margin: 14px auto; border-radius: 50%; color: var(--amber); border: 1px solid rgba(185,134,69,.5); box-shadow: 0 0 40px rgba(185,134,69,.22), inset 0 0 32px rgba(185,134,69,.14); font: 700 64px var(--space); }

.drawer-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; border-bottom: 1px solid rgba(216,226,209,.15); }
.drawer-title h1 { font-size: clamp(36px, 6vw, 84px); margin: 0 0 10px; }
.story-cluster, .map-cluster, .jar-cluster, .false-cluster, .door-cluster { padding-top: 110px; }

.contact-sheet, .test-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: stretch; }
.negative-strip { min-height: 460px; transform: rotate(-.7deg); background-color: rgba(23,19,14,.38); }
.frame-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.frame-grid span { height: 190px; border: 8px solid rgba(23,19,14,.74); background: linear-gradient(160deg, rgba(230,216,190,.7), rgba(74,51,36,.85)); filter: sepia(.8); }
.transcript-card { min-height: 360px; align-self: end; transform: rotate(1.2deg); }
.cassette-reel { display: flex; gap: 40px; justify-content: center; margin: 34px 0; }
.cassette-reel span { width: 92px; height: 92px; border: 13px double rgba(230,216,190,.55); border-radius: 50%; animation: reel 7s linear infinite; }

.map-card { min-height: 72vh; background-color: rgba(111,123,85,.16); }
.map-lines { position: absolute; inset: 34px; opacity: .8; }
.map-lines b { position: absolute; height: 2px; background: rgba(140,63,43,.8); transform-origin: left; box-shadow: 0 0 10px rgba(140,63,43,.3); }
.map-lines b:nth-child(1) { width: 38%; left: 7%; top: 34%; transform: rotate(17deg); }
.map-lines b:nth-child(2) { width: 50%; left: 28%; top: 54%; transform: rotate(-9deg); }
.map-lines b:nth-child(3) { width: 24%; left: 58%; top: 24%; transform: rotate(48deg); }
.map-lines b:nth-child(4) { width: 40%; left: 18%; top: 72%; transform: rotate(-27deg); }
.coordinate-pill { position: relative; width: fit-content; margin: 18px 0 24vh auto; padding: 12px 16px; border-radius: 999px; color: var(--peat); background: rgba(230,216,190,.84); }

.lens-card, .leaf-card { min-height: 420px; }
.loupe { width: 250px; height: 250px; margin: 10px auto 28px; border: 2px solid rgba(216,226,209,.45); border-radius: 50%; background: radial-gradient(circle at 42% 38%, rgba(216,226,209,.28), rgba(111,123,85,.15) 52%, rgba(23,19,14,.2)); box-shadow: inset 0 0 60px rgba(216,226,209,.12); animation: loupeTurn 9s ease-in-out infinite; }
.loupe span { display: block; width: 80px; height: 18px; background: var(--amber); transform: translate(190px, 218px) rotate(43deg); border-radius: 999px; }
.pressed-leaf { width: 180px; height: 300px; margin: 20px auto; background: linear-gradient(35deg, transparent 48%, rgba(111,123,85,.95) 49% 52%, transparent 53%), radial-gradient(ellipse at 55% 45%, rgba(111,123,85,.78) 0 36%, transparent 37%); filter: drop-shadow(0 0 20px rgba(111,123,85,.3)); animation: leafPulse 4s infinite; }

.lead-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.lead-row span { min-height: 170px; padding: 18px; border: 1px solid rgba(216,226,209,.15); border-radius: 18px; background: rgba(23,19,14,.32); color: rgba(230,216,190,.68); text-decoration: line-through; text-decoration-color: var(--oxide); }

.door-cluster { display: grid; place-items: center; }
.door-card { width: min(900px, 100%); min-height: 560px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.door-glow { position: absolute; inset: 20% 34%; border-radius: 22px 22px 4px 4px; background: linear-gradient(rgba(185,134,69,.35), rgba(140,63,43,.08)); box-shadow: 0 0 80px rgba(185,134,69,.26); animation: doorBreathe 4s infinite; }

.case-scene { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 30px; opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.case-scene.is-open { opacity: 1; pointer-events: auto; }
.scene-backdrop { position: absolute; inset: 0; background: rgba(23,19,14,.82); backdrop-filter: blur(22px); }
.scene-photo { position: absolute; inset: 8%; border: 18px solid rgba(230,216,190,.72); background: linear-gradient(140deg, rgba(111,123,85,.65), rgba(74,51,36,.92) 55%, rgba(23,19,14,.9)); filter: sepia(.62) blur(1px); opacity: .68; transform: rotate(-1deg) scale(.96); transition: transform .6s ease, filter .6s ease; }
.case-scene.is-open .scene-photo { transform: rotate(-1deg) scale(1); filter: sepia(.54) blur(0); }
.scene-copy { position: relative; z-index: 2; width: min(720px, 92vw); padding: 28px; border: 1px solid rgba(216,226,209,.24); border-radius: 26px; background: rgba(216,226,209,.12); backdrop-filter: blur(16px); box-shadow: 0 30px 120px rgba(0,0,0,.55); }
.scene-copy h2 { font-size: clamp(32px, 6vw, 76px); }
.scene-copy p { font-family: var(--spectral); font-size: clamp(18px, 2.4vw, 26px); line-height: 1.35; color: var(--bone); }
.scene-close, .scene-pinned { position: absolute; z-index: 4; border: 1px solid rgba(230,216,190,.28); color: var(--bone); background: rgba(23,19,14,.6); backdrop-filter: blur(10px); }
.scene-close { top: 22px; right: 22px; padding: 12px 16px; border-radius: 999px; cursor: pointer; }
.scene-pinned { left: 24px; top: 24px; padding: 18px; transform: rotate(-2deg); }
.scene-mechanism { position: absolute; z-index: 3; left: 12%; bottom: 10%; width: 160px; height: 240px; border: 1px solid rgba(216,226,209,.22); border-radius: 48% 48% 32% 32%; background: rgba(111,123,85,.16); }

@keyframes clearCondensation { 0% { opacity: 1; backdrop-filter: blur(18px); } 100% { opacity: 0; backdrop-filter: blur(0); } }
@keyframes cardDrift { 0% { translate: 0 0; } 100% { translate: 0 -5px; } }
@keyframes bubbleRise { 0% { transform: translateY(0) scale(.7); opacity: 0; } 20% { opacity: 1; } 85% { opacity: .8; } 100% { transform: translateY(-150px) translateX(16px) scale(1.3); opacity: 0; } }
@keyframes reel { to { transform: rotate(360deg); } }
@keyframes loupeTurn { 50% { transform: rotate(5deg) translateY(-8px); } }
@keyframes leafPulse { 50% { filter: drop-shadow(0 0 32px rgba(111,123,85,.55)); opacity: .82; } }
@keyframes doorBreathe { 50% { opacity: .55; transform: scale(1.04); } }

@media (max-width: 900px) {
  .archive-shell { padding-inline: 14px; }
  .drawer-panel, .contact-sheet, .test-grid, .lead-row { display: block; }
  .accession-label, .clue-card { margin: 18px 0; }
  .wide, .bubble-card, .tag-card, .locked-card { grid-column: auto; grid-row: auto; }
  .overlap { margin-top: 18px; }
  .index-tabs { position: relative; top: 0; border-radius: 20px; }
  .scene-mechanism { display: none; }
}
