/* The Desk — opening experience (docs/the-desk.md, docs/world-bible.md §5–6)
   Loaded on index.html only, after style.css. The room's two real light
   states are the two themes: overcast monsoon day (light) and the tungsten
   lamp at night (dark). Same objects, same wear — only the hour changes. */

/* ---------- the hour ---------------------------------------------------- */
body.desk {
  /* overcast monsoon day — window as primary light */
  --wood-far:  #5a462f;
  --wood-near: #6e573c;
  --lamp-core: rgba(255, 214, 150, 0.10);
  --lamp-mid:  rgba(255, 200, 130, 0.05);
  --ambient:   rgba(141, 151, 163, 0.10);   /* --monsoon, thinned */
  --cast:      rgba(24, 17, 9, 0.35);       /* object shadow strength */
  --dusk:      rgba(20, 14, 8, 0.30);       /* room-edge vignette */
  --glow:      0.12;                        /* the lamp is off by day */
  background: var(--wood-far);
}
@media (prefers-color-scheme: dark) {
  body.desk {
    /* past ten at night — the lamp is the sun */
    --wood-far:  #2b2014;
    --wood-near: #4b3922;
    --lamp-core: rgba(255, 187, 100, 0.32);
    --lamp-mid:  rgba(255, 172, 84, 0.14);
    --ambient:   rgba(141, 151, 163, 0.05);
    --cast:      rgba(10, 6, 2, 0.6);
    --dusk:      rgba(8, 5, 2, 0.55);
    --glow:      1;                         /* the lamp is the sun */
    background: var(--wood-far);
  }
}
/* QA / future lamp-switch override */
html[data-light="night"] body.desk {
  --wood-far:  #2b2014;
  --wood-near: #4b3922;
  --lamp-core: rgba(255, 187, 100, 0.32);
  --lamp-mid:  rgba(255, 172, 84, 0.14);
  --ambient:   rgba(141, 151, 163, 0.05);
  --cast:      rgba(10, 6, 2, 0.6);
  --dusk:      rgba(8, 5, 2, 0.55);
  --glow:      1;
  background: var(--wood-far);
}
html[data-light="day"] body.desk {
  --wood-far:  #5a462f;
  --wood-near: #6e573c;
  --lamp-core: rgba(255, 214, 150, 0.10);
  --lamp-mid:  rgba(255, 200, 130, 0.05);
  --ambient:   rgba(141, 151, 163, 0.10);
  --cast:      rgba(24, 17, 9, 0.35);
  --dusk:      rgba(20, 14, 8, 0.30);
  --glow:      0.12;
  background: var(--wood-far);
}

/* ---------- matter: procedural textures (world, not evidence) -----------
   SVG turbulence as data URIs — organic grain no gradient can fake.
   ~1 KB total, zero requests. */
body.desk {
  --tex-wood: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="640" height="260"><filter id="w"><feTurbulence type="fractalNoise" baseFrequency="0.011 0.13" numOctaves="4" seed="7"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0.32 0.15 0 -0.06"/></filter><rect width="640" height="260" filter="url(%23w)" opacity="0.5"/></svg>');
  --tex-fiber: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="220" height="220"><filter id="f"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" seed="3"/><feColorMatrix type="matrix" values="0 0 0 0 0.34 0 0 0 0 0.29 0 0 0 0 0.20 0.45 0.45 0.45 0 -0.55"/></filter><rect width="220" height="220" filter="url(%23f)" opacity="0.45"/></svg>');
  --tex-fox: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="340" height="340"><filter id="x"><feTurbulence type="fractalNoise" baseFrequency="0.045" numOctaves="3" seed="11"/><feColorMatrix type="matrix" values="0 0 0 0 0.40 0 0 0 0 0.27 0 0 0 0 0.11 2.8 2.0 1.1 0 -2.65"/></filter><rect width="340" height="340" filter="url(%23x)" opacity="0.2"/></svg>');
  /* deckle: hand-made paper is not die-cut */
  --deckle-a: polygon(0.7% 1.4%, 26% 0.3%, 52% 1.1%, 79% 0.2%, 99.4% 1.3%, 99% 28%, 99.8% 54%, 99.1% 80%, 99.5% 98.8%, 71% 99.4%, 44% 98.7%, 17% 99.6%, 0.9% 98.9%, 0.3% 68%, 1% 36%);
  --deckle-b: polygon(0.4% 0.9%, 21% 1.2%, 49% 0.2%, 76% 1.3%, 99.6% 0.6%, 99.1% 33%, 99.7% 62%, 99% 99.1%, 74% 98.6%, 47% 99.5%, 20% 98.8%, 0.6% 99.3%, 1.1% 71%, 0.2% 41%);
  /* the camera: a person standing at the desk, head inclined */
  perspective: 1400px;
  perspective-origin: 50% 28%;
  overflow-x: hidden;
}

/* ---------- the wood ----------------------------------------------------
   Sheesham: dense, matte, one long sheen band toward the lamp (§4).
   Furniture, not background: grain, wear, a cup-ring, micro-scratches. */
.room {
  position: relative;
  min-height: max(100svh, 780px);
  overflow: hidden;
  transform: rotateX(3.4deg) scale(1.018);
  transform-origin: 50% 94%;
  background:
    /* lamp pool — upper left, the room's sun */
    radial-gradient(1100px 800px at 13% 4%, var(--lamp-core), var(--lamp-mid) 40%, transparent 68%),
    /* forearm wear: the pale patch where a wrist rests (§2) */
    radial-gradient(240px 150px at 21% 34%, rgba(255, 236, 205, 0.05), transparent 75%),
    /* the cup-ring, old, to the right (§1) */
    radial-gradient(ellipse 92px 70px at 76% 63%, transparent 60%, rgba(16, 9, 3, 0.13) 65%, rgba(16, 9, 3, 0.04) 70%, transparent 75%),
    /* two micro-scratches catching the lamp */
    linear-gradient(84deg, transparent 49.85%, rgba(255, 238, 205, 0.06) 50%, transparent 50.15%),
    linear-gradient(96deg, transparent 49.9%, rgba(255, 238, 205, 0.04) 50%, transparent 50.1%),
    /* the one sheen band toward the lamp */
    linear-gradient(115deg, transparent 18%, rgba(255, 226, 180, 0.05) 30%, transparent 44%),
    /* organic grain */
    var(--tex-wood),
    /* long grain streaks beneath */
    repeating-linear-gradient(93deg,
      transparent 0 34px, rgba(0, 0, 0, 0.055) 34px 36px,
      transparent 36px 89px, rgba(255, 235, 200, 0.02) 89px 91px),
    /* board color, warmer near the lamp */
    linear-gradient(125deg, var(--wood-near) 0%, var(--wood-far) 62%);
  background-size:
    auto, auto, auto,
    340px 220px, 520px 300px,
    auto, 640px 260px, auto, auto;
  background-position:
    0 0, 0 0, 0 0,
    12% 78%, 64% 22%,
    0 0, 0 0, 0 0, 0 0;
}
/* monsoon ambient + depth fog: the far edge of the desk recedes */
.room::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 44;
  background:
    linear-gradient(to bottom, var(--dusk) 0%, transparent 16%),
    linear-gradient(160deg, var(--ambient), transparent 45%),
    radial-gradient(140% 110% at 30% 20%, transparent 55%, var(--dusk) 100%);
}

/* ---------- the air (haze, dust in the cone, the lamp breathing) --------- */
.air {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 43;
  background:
    /* warm haze hanging inside the lamp's cone */
    radial-gradient(900px 620px at 13% 4%, rgba(255, 205, 135, 0.055), transparent 62%),
    /* motes, visible only where there is light to catch */
    radial-gradient(1.5px 1.5px at 12% 9%, rgba(255, 232, 190, 0.5), transparent 100%),
    radial-gradient(1px 1px at 22% 16%, rgba(255, 232, 190, 0.4), transparent 100%),
    radial-gradient(1px 1px at 8% 22%, rgba(255, 232, 190, 0.30), transparent 100%),
    radial-gradient(1.5px 1.5px at 28% 7%, rgba(255, 232, 190, 0.28), transparent 100%),
    radial-gradient(1px 1px at 17% 30%, rgba(255, 232, 190, 0.22), transparent 100%);
}
@media (prefers-reduced-motion: no-preference) {
  .air { animation: lamp-breath 9s ease-in-out infinite alternate; }
  @keyframes lamp-breath {           /* tungsten is never perfectly steady */
    from { opacity: 0.92; }
    to   { opacity: 1; }
  }
}

/* ---------- objects: the common physics --------------------------------
   Position via --x/--y (%), width --w, resting skew --r. Shadows all agree
   with the lamp: cast down-right, away from upper-left. */
.obj {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: var(--w);
  /* every object has a body: --bow is the sheet's slight cup off the desk */
  transform: perspective(900px) rotateX(var(--bow, 0deg)) rotate(var(--r, 0deg));
  z-index: var(--z, 2);
  color: var(--ink);
  text-decoration: none;
  touch-action: manipulation;
  transition: transform 640ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 640ms ease, filter 400ms ease;
}
.obj:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 5px;
}
/* a graspable thing behaves like one: no text-selection ghosts, no native
   image-drag, no touch-scroll fighting the hand */
.obj:not(.fixed) {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.obj:not(.fixed):active { cursor: grabbing; }
/* stir: a hand hovers near — barely (this is not the lift) */
@media (hover: hover) {
  .obj:not(.fixed):hover {
    transform: perspective(900px) rotateX(calc(var(--bow, 0deg) * 0.55)) rotate(var(--r, 0deg)) translateY(-6px) scale(1.012);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sheet:not(.fixed):hover::before, .card:hover::before, .slipnote:hover::before {
    filter: drop-shadow(2px 3px 2px rgba(12, 7, 2, 0.3))
            drop-shadow(15px 24px 26px var(--cast));
  }
}
/* lift: paper bends before it moves — peel, then rise (§11) */
.obj.lifted, .obj:not(.fixed):focus-visible {
  transform: perspective(900px) rotateX(calc(var(--bow, 0deg) * 0.4)) rotate(calc(var(--r, 0deg) * 0.3)) translateY(-10px) scale(1.03);
  box-shadow: 14px 22px 30px -10px var(--cast);
  z-index: 30;
}
.obj.sliding {
  transition: box-shadow 200ms ease;
  box-shadow: 10px 16px 24px -8px var(--cast);
  z-index: 40;
  cursor: grabbing;
}

/* ---------- paper: archival matter, not a CSS colour ---------------------
   The paper body lives on ::before — deckled edge (clip-path), cotton-rag
   fibre (turbulence), pressed-edge emboss (inset light), and a two-part
   shadow: contact (tight, dark — the millimetres of still air under it)
   plus ambient throw agreeing with the lamp. Content stays unclipped
   above it; catalogue tags escape the deckle. */
.sheet, .card, .slipnote {
  --bow: 1.3deg;
  background: none;
  box-shadow: none;
}
.sheet::before, .card::before, .slipnote::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.55), transparent 55%),
    var(--tex-fiber),
    var(--paper);
  background-size: auto, 220px 220px, auto;
  clip-path: var(--deckle-a);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.4),
    inset -1px -1px 0 rgba(96, 80, 56, 0.10);
  filter:
    drop-shadow(1px 2px 1px rgba(12, 7, 2, 0.28))
    drop-shadow(9px 14px 16px var(--cast));
  transition: filter 640ms ease;
}
.card::before { clip-path: var(--deckle-b); }
.sheet.lifted, .card.lifted, .slipnote.lifted,
.sheet.sliding, .card.sliding, .slipnote.sliding { box-shadow: none; }
.sheet.lifted::before, .card.lifted::before, .slipnote.lifted::before {
  filter:
    drop-shadow(2px 4px 3px rgba(12, 7, 2, 0.26))
    drop-shadow(20px 32px 36px var(--cast));
}
.sheet.sliding::before, .card.sliding::before, .slipnote.sliding::before {
  filter:
    drop-shadow(2px 3px 2px rgba(12, 7, 2, 0.28))
    drop-shadow(14px 22px 26px var(--cast));
}
/* foxing on the papers that have lived longest (audit slip, draft, card) */
#obj-audit::before, #obj-draft::before, #obj-lib::before {
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.55), transparent 55%),
    var(--tex-fox),
    var(--tex-fiber),
    var(--paper-deep);
  background-size: auto, 340px 340px, 220px 220px, auto;
}
.finding-aid > * {
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.5), transparent 55%),
    var(--tex-fiber),
    var(--paper);
  background-size: auto, 220px 220px, auto;
  box-shadow: 5px 8px 16px -7px var(--cast);
}
.sheet { padding: 1.1rem 1.25rem 1.25rem; }
.sheet, .card, .slipnote { border-radius: 1px; }

/* the note to visitors — under the lamp, the brightest thing on the desk */
.note h1 {
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  line-height: 1.25;
  margin: 0 0 0.6rem;
}
.note p { font-size: var(--text-sm); margin: 0.4rem 0; }
.note .pencil-layer { padding: 0 0.2rem; }

/* index cards: exam-feint rules (§7, the bluebook lineage) */
.card {
  padding: 0.85rem 1rem 1rem;
  font-size: var(--text-sm);
  line-height: 1.32;
}
.card::before {
  background:
    repeating-linear-gradient(transparent 0 1.32em, var(--rule) 1.32em calc(1.32em + 1px)),
    linear-gradient(112deg, rgba(255, 253, 246, 0.5), transparent 55%),
    var(--tex-fiber),
    var(--paper);
  background-size: auto, auto, 220px 220px, auto;
}
.card .head {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--vermilion-ink);
  display: block;
  margin-bottom: 0.35rem;
}

/* small slips */
.slipnote { padding: 0.6rem 0.8rem; font-size: var(--text-sm); }

/* taped slip: the pinned sentence. The tape is painted into the paper
   layer (::before is the paper's body; ::after belongs to dust). */
#obj-audit::before {
  background:
    linear-gradient(rgba(242, 236, 216, 0.6), rgba(238, 230, 208, 0.5)),
    linear-gradient(112deg, rgba(255, 253, 246, 0.55), transparent 55%),
    var(--tex-fox),
    var(--tex-fiber),
    var(--paper-deep);
  background-size: 48px 13px, auto, 340px 340px, 220px 220px, auto;
  background-position: 50% 0, 0 0, 0 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, repeat, repeat, no-repeat;
}

/* conservator's slip: the honest substitute (evidence-ledger law).
   Machine-cut, not deckled — a different hand made this paper. */
.conservator {
  --bow: 0.8deg;
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px dashed var(--rule);
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.5), transparent 55%),
    var(--tex-fiber),
    var(--paper);
  background-size: auto, 220px 220px, auto;
  box-shadow:
    0 1px 2px rgba(12, 7, 2, 0.3),
    6px 9px 14px -7px var(--cast);
}
.conservator .stamp-line {
  display: block;
  margin-top: 0.4rem;
  color: var(--vermilion-ink);
  letter-spacing: 0.14em;
  transform: rotate(-1.2deg);
  transform-origin: left;
}

/* ---------- the notebook: indigo cloth, letterpress title (§4, §7) ------- */
.notebook {
  aspect-ratio: 3 / 4.1;
  border-radius: 2px 5px 5px 2px;
  background:
    linear-gradient(100deg, rgba(255, 246, 228, 0.07), transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255, 255, 255, 0.016) 2px 3px),
    repeating-linear-gradient(90deg, transparent 0 2px, rgba(0, 0, 0, 0.05) 2px 3px),
    var(--cloth, #2e3644);
  box-shadow:
    inset 8px 0 10px -8px rgba(0, 0, 0, 0.7),   /* spine hollow */
    6px 10px 18px -8px var(--cast);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8%;
}
.notebook .title {
  color: #c8cbd4;
  font-style: italic;
  font-size: var(--text-sm);
  text-align: center;
  line-height: 1.5;
  /* letterpress: impressed, lit from the lamp's angle */
  text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.55), 1px 1px 0 rgba(255, 255, 255, 0.08);
}
.notebook .ribbon-tail {
  position: absolute;
  bottom: -14px; left: 22%;
  width: 9px; height: 26px;
  background: var(--vermilion);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 2px 3px 4px -2px var(--cast);
}
/* the fore-edge: the page block, slightly proud of the cover — thickness.
   Lives on ::before because ::after is reserved for dust, sitewide. */
.notebook::before {
  content: "";
  position: absolute;
  right: -4px; top: 2.5%; bottom: 4%;
  width: 5px;
  border-radius: 0 2px 2px 0;
  background: repeating-linear-gradient(to bottom,
    #efe7d2 0 1.4px, #cfc5ab 1.4px 2.3px);
  box-shadow: 3px 4px 6px -2px var(--cast);
}

/* ---------- the packet: thread-tied, stamped (§3 obj 14) ----------------- */
.packet {
  aspect-ratio: 1 / 1.05;
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.4), transparent 60%),
    var(--paper-deep);
  box-shadow: 5px 8px 14px -7px var(--cast);
  display: flex; align-items: center; justify-content: center;
}
.packet::before {  /* the thread, crossed — one layer, ::after is dust's */
  content: "";
  position: absolute;
  inset: -2%;
  background:
    linear-gradient(to right, transparent calc(50% - 1px), var(--vermilion) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), var(--vermilion) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  filter: drop-shadow(1px 1px 1px rgba(20, 12, 4, 0.3));
}
.packet .stamp {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--vermilion-ink);
  transform: rotate(-3deg);
  text-align: center;
  opacity: 0.85;   /* uneven inking, until the real impression is scanned */
}

/* ---------- the envelope (§3 obj 9/28) ------------------------------------ */
.env {
  --bow: 0.9deg;
  min-height: 6.2rem;
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.55), transparent 55%),
    var(--tex-fiber),
    var(--paper);
  background-size: auto, 220px 220px, auto;
  border-bottom: 2px solid rgba(120, 100, 70, 0.22);   /* folded thickness */
  box-shadow:
    0 1px 2px rgba(12, 7, 2, 0.3),
    6px 9px 15px -7px var(--cast);
  padding: 0.85rem 0.95rem;
}
.env::before {  /* the flap's crease */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom right, transparent 49.6%, rgba(35, 32, 27, 0.10) 49.6%, transparent 51%);
  clip-path: polygon(0 0, 50% 46%, 100% 0);
  pointer-events: none;
}
.env .addr {
  font-style: italic;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  line-height: 1.5;
  margin-top: 2rem;
  display: block;
}

/* ---------- the ID card, half under the note (§3 obj 16) ------------------ */
.idcard {
  aspect-ratio: 1.62 / 1;
  border-radius: 4px;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0.6), transparent 50%), #e9e2cf;
  box-shadow: 4px 6px 12px -6px var(--cast);
  padding: 5% 7%;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.idcard b { color: var(--ink); font-weight: normal; letter-spacing: 0.12em; }
.idcard .photo {
  position: absolute; right: 7%; top: 18%;
  width: 22%; aspect-ratio: 3.5/4.5;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
}

/* ---------- the desk's front edge + the drawer (furniture, not symbol) ----
   The apron gives the desktop thickness: end grain, a bevel where the
   surface lips over, ambient occlusion beneath the lip. The drawer sits
   in it — cavity behind, front panel that slides with the reluctance of
   a wooden runner (heavy start, wooden stop). */
.apron {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 88px;
  z-index: 2;
  background:
    /* bevel highlight: the lamp catching the desk's edge */
    linear-gradient(to bottom, rgba(255, 226, 180, 0.14) 0 1px, transparent 1px),
    /* end grain: tighter, darker, vertical */
    repeating-linear-gradient(90deg,
      transparent 0 3px, rgba(0, 0, 0, 0.06) 3px 4px,
      transparent 4px 11px, rgba(255, 230, 195, 0.015) 11px 12px),
    var(--tex-wood),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--wood-near) 78%, black) 0%,
      color-mix(in srgb, var(--wood-far) 70%, black) 100%);
  background-size: auto, auto, 640px 260px, auto;
  /* occlusion where the surface lips over the edge */
  box-shadow: inset 0 12px 16px -10px rgba(0, 0, 0, 0.75);
}
.drawer {
  position: absolute;
  left: 50%; bottom: 8px;
  transform: translateX(-50%);
  width: min(400px, 84vw);
  height: 66px;
  z-index: 3;
  text-decoration: none;
}
/* recessed joinery frame around the drawer opening */
.drawer::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 230, 195, 0.05);
  pointer-events: none;
}
/* the cavity: interior darkness, contents barely visible */
.drawer .cavity {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 2px 2px 0 0;
  background:
    radial-gradient(120% 90% at 50% 120%, rgba(58, 42, 22, 0.35), transparent 60%),
    #0b0602;
  box-shadow: inset 0 8px 12px rgba(0, 0, 0, 0.95);
}
.drawer .paperedge {
  position: absolute;
  bottom: 46px; left: 11%;
  width: 34%; height: 3px;
  background: #cfc3a5;
  opacity: 0.35;
  transform: rotate(-0.7deg);
  border-radius: 1px;
}
.drawer .glimpse {
  position: absolute;
  top: 5px; left: 8%;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: rgba(200, 188, 165, 0.45);
  white-space: nowrap;
  transition: color 460ms ease;
}
/* the drawer front: a board, not a stripe */
.drawer .front {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 44px;
  border-radius: 2px;
  background:
    linear-gradient(to bottom, rgba(255, 230, 195, 0.07) 0 1px, transparent 1px),
    repeating-linear-gradient(88deg,
      transparent 0 26px, rgba(0, 0, 0, 0.05) 26px 28px, transparent 28px 61px),
    var(--tex-wood),
    linear-gradient(to bottom, var(--wood-near), color-mix(in srgb, var(--wood-near) 72%, black));
  background-size: auto, auto, 640px 260px, auto;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    inset 2px 2px 4px -2px rgba(255, 230, 195, 0.10),
    0 3px 5px -2px rgba(0, 0, 0, 0.6);
  /* the runner: reluctant first centimetre, then free, then the stop */
  transition: transform 520ms cubic-bezier(0.55, 0.02, 0.28, 1);
}
.drawer .pull {
  position: absolute;
  left: 50%; top: 17px;
  transform: translateX(-50%);
  width: 56px; height: 10px;
  border-radius: 5px;
  background:
    radial-gradient(20px 5px at 50% 30%, rgba(255, 240, 205, 0.5), transparent 70%),
    linear-gradient(to bottom, #b59a63, #6d5527);
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.6),
    inset 0 -1px 1px rgba(0, 0, 0, 0.4);
}
.drawer:hover .front, .drawer:focus-visible .front { transform: translateY(9px); }
.drawer:hover .glimpse, .drawer:focus-visible .glimpse { color: rgba(216, 204, 178, 0.75); }
.drawer:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 6px; }

/* ---------- the map (primary navigation; substitute until drawn in ink) --- */
.map { cursor: default; margin: 0; }
.map figcaption {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: rgba(238, 228, 205, 0.72);
  margin-bottom: 0.3rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.map svg {
  display: block;
  width: 100%;
  height: auto;
  background:
    linear-gradient(112deg, rgba(255, 253, 246, 0.5), transparent 55%),
    var(--tex-fiber),
    var(--paper);
  background-size: auto, 220px 220px, auto;
  /* the largest sheet bows the most; drafting paper holds a slight wave */
  transform: perspective(1300px) rotateX(1deg) rotateY(-1.1deg);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.35);
  filter:
    drop-shadow(1px 2px 1px rgba(12, 7, 2, 0.25))
    drop-shadow(11px 16px 20px var(--cast));
}
.map svg a { outline: none; }
.map svg a .rm { transition: fill 200ms ease; }
.map svg a:hover .rm, .map svg a:focus .rm { fill: var(--paper-deep); }
.map svg a:focus-visible .rm { stroke: var(--vermilion); stroke-width: 2; }

/* ---------- the lamp: the room's sun, finally visible ---------------------
   Seen from above at this camera: enamel shade, articulated arm reaching
   in from the corner, cord trailing off the desk. Its glow is the same
   pool that has lit this desk from the first build — now it has a body.
   Night: lit. Day: an object, switched off. */
.lamp {
  position: absolute;
  left: -26px; top: -50px;
  z-index: 6;
  pointer-events: none;
}
.lamp .cord {
  position: absolute;
  left: -34px; top: 0;
  width: 130px; height: 64px;
  border-bottom: 2px solid rgba(8, 5, 3, 0.55);
  border-radius: 0 0 65% 35%;
  transform: rotate(-16deg);
}
.lamp .arm {
  position: absolute;
  left: 18px; top: 16px;
  width: 156px; height: 11px;
  transform: rotate(26deg);
  transform-origin: left center;
  border-radius: 6px;
  background: linear-gradient(to bottom, #464036, #191410 70%, #0b0805);
  box-shadow: 3px 4px 5px rgba(0, 0, 0, 0.45);
}
.lamp .shade {
  position: absolute;
  left: 92px; top: 30px;
  width: 196px; height: 128px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side at 40% 36%,
      #4c463c 55%, #2a251d 76%, #120d08 100%);
  box-shadow:
    inset 5px 7px 12px rgba(255, 255, 255, 0.07),
    inset -8px -12px 20px rgba(0, 0, 0, 0.6),
    26px 34px 44px -16px rgba(0, 0, 0, 0.7);
}
/* light escaping under the rim — the shade's underside, burning */
.lamp .shade::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%; top: 58%; bottom: -10%;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(255, 224, 165, calc(0.85 * var(--glow, 1))),
    rgba(255, 195, 115, calc(0.35 * var(--glow, 1))) 55%,
    transparent 78%);
  filter: blur(7px);
}
/* the hot rim itself */
.lamp .shade::before {
  content: "";
  position: absolute;
  left: 6%; right: 6%; top: 62%; bottom: 2%;
  border-radius: 50%;
  border-bottom: 4px solid rgba(255, 236, 190, calc(0.9 * var(--glow, 1)));
  box-shadow: 0 4px 14px rgba(255, 210, 140, calc(0.7 * var(--glow, 1)));
  filter: blur(1.2px);
}
/* and the burn on the wood directly beneath the rim */
.lamp::after {
  content: "";
  position: absolute;
  left: 70px; top: 120px;
  width: 300px; height: 190px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(255, 216, 150, calc(0.30 * var(--glow, 1))),
    rgba(255, 196, 120, calc(0.12 * var(--glow, 1))) 55%,
    transparent 80%);
  filter: blur(10px);
}

/* ---------- dust: settles on the un-visited (§4) -------------------------- */
.obj.dusty::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(47deg, transparent 0 3px, rgba(206, 196, 172, 0.05) 3px 4px),
    rgba(200, 190, 168, 0.13);
  border-radius: inherit;
  transition: opacity 2s ease;   /* dust leaves at ink-dry speed */
}
.obj.dusty.lifted::after, .obj.dusty:hover::after { opacity: 0.4; }

/* ---------- catalogue tags (Pitt Rivers voice; shown on lift/focus) ------- */
.obj .tag {
  position: absolute;
  left: 0; top: calc(100% + 8px);
  width: max-content;
  max-width: 34ch;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  line-height: 1.45;
  padding: 0.4rem 0.6rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 0s 200ms;
  z-index: 50;
  pointer-events: none;
}
.obj.lifted .tag, .obj:focus-visible .tag {
  opacity: 1; visibility: visible; transition: opacity 200ms ease;
}

/* ---------- the leakage card's plot (real data, real axes) ---------------- */
.plotcard svg { display: block; width: 100%; height: auto; margin-top: 0.3rem; }
.plotcard .pencil-note {
  font-style: italic;
  color: var(--ink-faint);
  font-size: var(--text-xs);
  display: block;
  transform: rotate(-0.6deg);
  margin-top: 0.25rem;
}

/* ---------- the ninth draft: struck lines ---------------------------------- */
.draft .struck {
  text-decoration: line-through;
  text-decoration-color: var(--vermilion);
  color: var(--ink-faint);
}
.draft .verdict {
  font-style: italic;
  color: var(--vermilion-ink);
  font-size: var(--text-xs);
  display: block;
  transform: rotate(-1deg);
  margin-top: 0.3rem;
}

/* ---------- finding aid: the archive's own tool (a11y, diegetic) ---------- */
.finding-aid {
  position: absolute;
  left: 1.2rem; bottom: calc(88px + 0.9rem);
  z-index: 60;
  width: min(340px, 86vw);
}
.finding-aid summary {
  display: inline-block;
  cursor: pointer;
  background: var(--paper);
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  padding: 0.45rem 0.7rem;
  box-shadow: 4px 6px 12px -6px var(--cast);
}
.finding-aid summary::marker { content: ""; }
.finding-aid[open] summary { color: var(--vermilion-ink); }
.finding-aid .aid-body {
  background: var(--paper);
  padding: 0.9rem 1rem;
  margin-top: 0.4rem;
  box-shadow: 6px 9px 16px -7px var(--cast);
  max-height: min(52vh, 30rem);
  overflow: auto;
}
.finding-aid .aid-body > p {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: 0 0 0.5rem;
}
.finding-aid .door-map { margin: 0; }

/* the seal — stamped at the desk's edge */
.desk-seal {
  position: absolute;
  left: 1.2rem; bottom: 18px;   /* branded into the desk's front edge */
  max-width: min(44%, 440px);
  line-height: 1.7;
  z-index: 4;
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: rgba(232, 220, 196, 0.55);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.desk-seal b { color: rgba(198, 96, 70, 0.9); font-weight: normal; }

/* No object moves unless a hand moves it. (The fan-tremble was cut here
   by the owner's order, 2026-07-06: even one autonomous twitch reads as
   the room acting on its own.) */

/* ---------- the pile (below 900px): papers pulled toward you --------------- */
@media (max-width: 899px) {
  .room {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    padding: 1.4rem 1.2rem 6rem;
    overflow: visible;
  }
  .obj, .drawer {
    /* relative, not static: tags, tape, threads, ribbon, and the drawer's
       glimpse are absolutely positioned children and must stay anchored */
    position: relative;
    left: auto; top: auto; bottom: auto;
    width: min(100%, 30rem);
    max-width: 100%;
    transform: rotate(var(--r, 0deg));
  }
  .map, .map svg { width: 100%; max-width: 100%; }
  .drawer { transform: none; height: 66px; margin-top: 0.5rem; }
  .apron { display: none; }
  .lamp { transform: scale(0.62); transform-origin: top left; left: -20px; top: -36px; }
  /* the pile is not draggable: give touch back to the scroll */
  .obj:not(.fixed) {
    touch-action: auto;
    cursor: pointer;
    user-select: text;
    -webkit-user-select: text;
  }
  .room {
    transform: none;
    background-size: auto;
  }
  body.desk { perspective: none; }
  .notebook { width: 180px; }
  .packet { width: 130px; }
  .idcard { width: 210px; min-height: 5.6rem; }
  .obj .tag { top: calc(100% + 4px); max-width: 100%; }
  .finding-aid { position: static; width: min(100%, 30rem); margin-top: 0.5rem; }
  .desk-seal { position: static; text-align: center; margin-top: 1rem; }
}

/* reduced motion: the room is honestly still */
@media (prefers-reduced-motion: reduce) {
  .obj, .obj.lifted { transition: none; }
}

/* print: the desk prints as its catalogue */
@media print {
  body.desk { background: white; }
  .room { background: none; min-height: 0; display: block; transform: none; }
  .room::after, .air, .apron, .lamp { display: none; }
  .obj, .drawer { position: static; width: auto; transform: none; box-shadow: none; margin: 0.6rem 0; }
  .finding-aid .aid-body { max-height: none; }
  .desk-seal { position: static; color: black; }
}

/* ---------- arrival: the lamp lights because you entered. Once, ever. ----
   JS sets html[data-arrive] before first paint, then releases it; the dark
   lifts over ~1.1s like a filament warming. No JS, no reduced-motion, and
   every later visit: the room is simply already lit. */
#arrive {
  position: absolute; inset: 0;
  z-index: 70;
  background: #0d0905;
  opacity: 0;
  pointer-events: none;
}
html[data-arrive] #arrive { opacity: 1; }
/* the filament catches on the third try — tungsten, honestly */
html.relit #arrive { animation: lights-on 1700ms ease-out forwards; }
@keyframes lights-on {
  0%   { opacity: 1; }
  14%  { opacity: 1; }
  20%  { opacity: 0.22; }
  27%  { opacity: 0.88; }
  40%  { opacity: 0.10; }
  50%  { opacity: 0.6; }
  64%  { opacity: 0.04; }
  100% { opacity: 0; }
}
/* …and the owner's freshest line writes itself once the light holds */
.ink-line .line { display: inline-block; }
html.relit .ink-line.wet .line {
  animation: write-line 1400ms steps(32) 1500ms both, bleed 2s ease-out 2900ms both;
}
@keyframes write-line {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 -2% 0 0); }
}

/* ---------- the plan, inked: turbulence-displaced strokes -------------- */
.map svg :is(path, rect, ellipse, circle):not(#plan-bg) { filter: url(#ink); }
