/* =================================================================
   m.b. parks  ·  the shadowbox
   a Joseph Cornell box that compiles to JavaScript
   ================================================================= */

:root {
  /* paper */
  --paper:        #ece2c8;
  --paper-mid:    #d8c8a4;
  --paper-edge:   #b89770;
  --paper-glow:   #f5ecd6;

  /* wood (the box frame) */
  --wood:         #4a2e1a;
  --wood-light:   #6b4528;
  --wood-deep:    #1f1108;
  --wood-grain:   #3a2316;

  /* fittings (brass tacks, dividers) */
  --brass:        #b8985a;
  --brass-hi:     #d6b878;
  --brass-lo:     #6e5028;

  /* ink */
  --ink:          #2a1f15;
  --ink-soft:     #5a432c;
  --ink-faint:    #8a7355;

  /* Cornell hues */
  --sky:          #7a96b8;   /* his soft celestial blue */
  --sky-deep:     #2f4a6b;
  --rose:         #7a3838;   /* faded red ink, vintage poster */
  --gold:         #c4a14a;   /* faded gold leaf */
  --thread:       #856841;   /* stitched thread / pencil line */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  /* the room around the box: a dim study */
  color: var(--ink);
  font-family: "Cormorant Garamond", "IM Fell English", Georgia, serif;
  font-size: 18px;
  line-height: 1.5;
  background-color: #14100b;
  background-image:
    radial-gradient(ellipse at 50% 0%,  rgba(196, 161, 74, 0.10), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.6), transparent 50%),
    radial-gradient(ellipse at 50% 50%, #271a10, #14100b 70%);
  background-attachment: fixed;
  padding: 36px 20px 56px;
  position: relative;
  overflow-x: hidden;
}

/* fine room-noise grain so the background doesn't read flat */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.16 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* ----------------- THE BOX ITSELF ----------------- */

.shadowbox {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  /* the wood frame is built from layered borders + an inset paper interior */
  padding: 26px;
  background-color: var(--wood);
  /* wood grain via stacked gradients */
  background-image:
    repeating-linear-gradient(
      96deg,
      var(--wood) 0px,
      var(--wood-grain) 1px,
      var(--wood) 2px,
      var(--wood) 6px,
      var(--wood-light) 7px,
      var(--wood) 9px,
      var(--wood) 18px
    ),
    radial-gradient(ellipse at 30% 20%, rgba(196,161,74,0.04), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(0,0,0,0.4), transparent 50%);
  border-radius: 4px;
  /* deep shadow as if hanging on a wall */
  box-shadow:
    0 1px 0 rgba(255, 235, 200, 0.06) inset,
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 10px 30px rgba(0, 0, 0, 0.55),
    0 40px 80px rgba(0, 0, 0, 0.5);
}

/* ----------------- BRASS CORNER TACKS ----------------- */

.tack {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 -1px 1px rgba(0, 0, 0, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 3;
}
.tack--tl { top: 8px;  left: 8px;  }
.tack--tr { top: 8px;  right: 8px; }
.tack--bl { bottom: 8px; left: 8px;  }
.tack--br { bottom: 8px; right: 8px; }

/* ----------------- GLASS FRONT ----------------- */

.glass {
  position: absolute;
  inset: 26px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
  /* a faint diagonal sheen as if light catches the glass */
  background:
    linear-gradient(
      118deg,
      rgba(255, 255, 240, 0) 0%,
      rgba(255, 255, 240, 0.04) 22%,
      rgba(255, 255, 240, 0.08) 30%,
      rgba(255, 255, 240, 0) 42%,
      rgba(255, 255, 240, 0) 100%
    );
}

/* ----------------- THE CABINET INTERIOR ----------------- */

.cabinet {
  position: relative;
  z-index: 1;
  background-color: var(--paper);
  background-image:
    /* paper grain */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.12  0 0 0 0 0.06  0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>"),
    /* faint vignette */
    radial-gradient(ellipse at 50% 30%, var(--paper-glow) 0%, var(--paper) 50%, var(--paper-mid) 100%);
  padding: 36px 32px 32px;
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.18),
    inset 0 0 0 2px rgba(255, 255, 245, 0.25),
    inset 0 2px 14px rgba(0, 0, 0, 0.18);
}

/* ----------------- LID / MASTHEAD ----------------- */

.lid {
  text-align: center;
  padding: 6px 12px 30px;
  position: relative;
}

/* small constellation arc behind the lid, drawn as SVG-in-CSS */
.lid::before {
  content: "";
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: min(560px, 90%);
  height: 70px;
  pointer-events: none;
  opacity: 0.7;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 560 70'><g fill='none' stroke='%231f3a5e' stroke-width='1.1' stroke-dasharray='3 5'><path d='M 30 50 Q 280 0 530 50' /></g><g fill='%231f3a5e'><circle cx='30' cy='50' r='2.2'/><circle cx='110' cy='28' r='1.8'/><circle cx='200' cy='14' r='2.4'/><circle cx='280' cy='8' r='2'/><circle cx='360' cy='14' r='2.6'/><circle cx='450' cy='28' r='1.8'/><circle cx='530' cy='50' r='2.2'/></g></svg>");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: contain;
}

.backlink {
  position: absolute;
  top: 4px;
  left: 0;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  padding-bottom: 2px;
  transition: border-color .2s ease, color .2s ease;
}
.backlink:hover { color: var(--ink); border-bottom-color: var(--ink-soft); }

.theme-toggle {
  position: absolute;
  top: 4px;
  right: 0;
  background: none;
  border: none;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 2px 4px 3px;
  border-bottom: 1px dashed transparent;
  transition: color .2s ease, border-color .2s ease;
}
.theme-toggle:hover {
  color: var(--ink);
  border-bottom-color: var(--ink-soft);
}
.theme-toggle:focus-visible {
  outline: 1px dashed var(--brass);
  outline-offset: 4px;
}

.exhibit-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 18px 10px;
  border: 2px solid var(--rose);
  border-radius: 1px;
  font-family: "Special Elite", monospace;
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--rose);
  transform: rotate(-2.5deg);
  background: var(--paper);
  margin-bottom: 22px;
  box-shadow:
    inset 0 0 8px rgba(122, 56, 56, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.25);
}
.exhibit-label__line { display: block; }
.exhibit-label__line--accent {
  font-size: 13px;
  letter-spacing: 0.34em;
}

.lid__logo {
  display: block;
  margin: 0 auto 18px;
  width: 220px;
  height: auto;
  max-width: 80%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.masthead {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  margin: 0 0 6px;
  line-height: 1;
}
.masthead__name {
  display: block;
  font-size: clamp(38px, 6.5vw, 64px);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.masthead__sub {
  display: block;
  font-family: "Special Elite", monospace;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--rose);
  margin-top: 10px;
}

.manifesto {
  margin: 22px auto 0;
  max-width: 660px;
}
.manifesto__line {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.4;
}
.manifesto__line em {
  font-style: italic;
  margin: 0 6px;
}
.manifesto__pinned {
  margin: 8px 0 0;
  font-family: "Caveat", cursive;
  font-size: 22px;
  color: var(--rose);
}
.manifesto__pinned a {
  color: var(--rose);
  text-decoration: none;
  margin: 0 8px;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color .2s ease, border-color .2s ease;
}
.manifesto__pinned a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ----------------- THE DIVIDER (between lid and tray) ----------------- */

.divider {
  height: 8px;
  margin: 26px 0 28px;
  background:
    linear-gradient(180deg, var(--wood-deep), var(--wood) 40%, var(--wood-light) 50%, var(--wood) 60%, var(--wood-deep));
  border-radius: 1px;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 170, 0.18),
    0 2px 4px rgba(0, 0, 0, 0.35);
  position: relative;
}
.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4), inset 0 -1px 1px rgba(0,0,0,0.4), 0 1px 1px rgba(0,0,0,0.4);
  transform: translateY(-50%);
}
.divider::before { left: 14px; }
.divider::after  { right: 14px; }

/* ----------------- THE PRINTER'S TRAY ----------------- */

.tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.cell {
  position: relative;
  padding: 28px 22px 22px;
  background-color: var(--paper-glow);
  background-image:
    /* extra paper grain per cell, lighter */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.12  0 0 0 0 0.06  0 0 0 0.045 0'/></filter><rect width='100%' height='100%' filter='url(%23c)'/></svg>");
  border-radius: 1px;
  /* wood-divider walls between cells, via stacked shadows */
  box-shadow:
    inset 0 0 0 1px rgba(74, 46, 26, 0.35),
    inset 0 0 0 2px rgba(245, 236, 214, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.1);
}

.cell__label {
  position: absolute;
  top: -10px;
  left: 18px;
  padding: 3px 10px 4px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: "Special Elite", monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid var(--ink-faint);
  border-radius: 1px;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ----------------- statement cell ----------------- */

.statement {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  font-size: 24px;
  line-height: 1.3;
  margin: 0;
  color: var(--ink);
}
.statement em {
  color: var(--rose);
  font-style: italic;
}

/* ----------------- photos (specimen case) ----------------- */

.cell--photos {
  /* a tiny celestial chart watermark behind the photos */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='%237a96b8' opacity='0.18'><circle cx='40' cy='30' r='1.5'/><circle cx='80' cy='55' r='1'/><circle cx='150' cy='40' r='1.8'/><circle cx='110' cy='90' r='1.2'/><circle cx='170' cy='130' r='1.5'/><circle cx='60' cy='150' r='1'/><circle cx='30' cy='100' r='1.5'/><circle cx='100' cy='170' r='1.2'/></g></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.12  0 0 0 0 0.06  0 0 0 0.045 0'/></filter><rect width='100%' height='100%' filter='url(%23c)'/></svg>");
  background-size: 240px, 160px;
  background-repeat: no-repeat, repeat;
  background-position: center, 0 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.photo-grid a {
  display: block;
  padding: 6px;
  background: var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(74, 46, 26, 0.25),
    0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform .2s ease, box-shadow .2s ease;
}
.photo-grid a:hover {
  transform: translateY(-1px) rotate(-0.5deg);
  box-shadow:
    inset 0 0 0 1px rgba(74, 46, 26, 0.35),
    0 4px 8px rgba(0, 0, 0, 0.3);
}
.photo-grid img {
  width: 100%;
  height: auto;
  display: block;
}
.photo-grid > small {
  grid-column: 1 / -1;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  color: var(--ink-soft);
  padding: 14px 4px;
}

/* ----------------- link lists (correspondence / studios / diversions) ----------------- */

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.link-list li {
  margin: 0;
  padding: 4px 0 5px;
  border-bottom: 1px dashed var(--ink-faint);
  line-height: 1.3;
}
.link-list li:last-child { border-bottom: none; }
.link-list a {
  color: var(--ink);
  text-decoration: none;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.005em;
  display: inline-block;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.link-list a:hover {
  color: var(--rose);
  border-bottom-color: var(--rose);
}

/* tiny brass key-ring before each Correspondence link */
.cell--correspondence .link-list li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.25);
  vertical-align: middle;
  transform: translateY(-1px);
}

/* Cabinets: subdivided into Games & Sims and Tools, three items each plus a
   small typewritten pointer back to the portal page. */
.cell--diversions .sub-head {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--rose);
  margin: 16px 0 6px;
  letter-spacing: 0.01em;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--ink-faint);
}
.cell--diversions .sub-head:first-of-type {
  margin-top: 0;
}

/* tiny gold star before each game/tool */
.cell--diversions .link-list li::before {
  content: "✦";
  color: var(--gold);
  font-size: 11px;
  margin-right: 7px;
  vertical-align: middle;
  transform: translateY(-1px);
  display: inline-block;
}

/* the typewritten "more in the..." pointer at the bottom of each sub-list */
.cell--diversions .sub-more {
  margin-top: 8px;
  padding: 4px 0 0;
  text-align: right;
  border-bottom: none;
}
.cell--diversions .sub-more::before {
  content: none;
}
.cell--diversions .sub-more a {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--ink-faint);
  padding-bottom: 1px;
}
.cell--diversions .sub-more a:hover {
  color: var(--rose);
  border-bottom-color: var(--rose);
}

/* a faint number-stamp gutter before each Studios link */
.cell--studios { counter-reset: studio-num; }
.cell--studios .link-list li {
  counter-increment: studio-num;
  position: relative;
  padding-left: 26px;
}
.cell--studios .link-list li::before {
  content: counter(studio-num, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 6px;
  font-family: "Special Elite", monospace;
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.15em;
}

/* ----------------- dispatches (substack) ----------------- */

.dispatch-list { font-family: "Cormorant Garamond", Georgia, serif; }
.dispatch-list a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-style: italic;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 1px dashed var(--ink-faint);
  transition: color .2s ease;
}
.dispatch-list a:last-of-type { border-bottom: none; }
.dispatch-list a:hover { color: var(--rose); }
.dispatch-list small {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  color: var(--ink-soft);
  font-style: normal;
}

/* ----------------- telegram (bluesky latest) ----------------- */

.telegram {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
}
.telegram > div:first-child {
  white-space: pre-wrap;
  margin-bottom: 8px;
}
.telegram a {
  color: var(--sky-deep);
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px dashed var(--sky-deep);
  padding-bottom: 1px;
}
.telegram a:hover { color: var(--rose); border-bottom-color: var(--rose); }
.telegram > div:last-child {
  font-family: "Special Elite", monospace;
  font-size: 10px !important;
  color: var(--ink-faint) !important;
  letter-spacing: 0.1em;
}
.telegram small {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

/* ----------------- contact + finis ----------------- */

.cell--contact p {
  margin: 0 0 8px;
}
.cell--contact a {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  font-size: 19px;
  color: var(--rose);
  text-decoration: none;
  border-bottom: 1px solid var(--rose);
  padding-bottom: 1px;
}
.cell--contact a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.cell--contact .hand {
  font-family: "Caveat", cursive;
  font-size: 18px;
  color: var(--ink-soft);
  margin-top: 14px;
  transform: rotate(-1.5deg);
}

.cell--fini {
  text-align: center;
  position: relative;
  padding: 30px 22px;
}
.cell--fini .star-chart {
  width: 100%;
  max-width: 200px;
  height: 110px;
  margin: 0 auto 8px;
  opacity: 0.55;
}
.cell--fini .hand {
  font-family: "Caveat", cursive;
  font-size: 22px;
  color: var(--ink-soft);
  margin: 8px 0 0;
  transform: rotate(-2deg);
}

/* one small star in the Finis constellation hides a link. The only signal
   it offers is a pointer cursor when you happen to hover that exact spot. */
.hidden-star { cursor: pointer; }

/* ----------------- signature plate ----------------- */

.signature {
  margin-top: 30px;
  text-align: center;
  color: var(--ink-soft);
}
.signature .rule {
  height: 1px;
  margin: 0 auto 22px;
  max-width: 320px;
  background: repeating-linear-gradient(
    to right,
    var(--brass) 0 6px,
    transparent 6px 12px
  );
  opacity: 0.7;
}
.signature__line {
  font-family: "IM Fell English", Georgia, serif;
  font-style: italic;
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--ink);
}
.signature__date {
  font-family: "Special Elite", monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 6px;
  color: var(--ink-soft);
}
.signature__copy {
  font-family: "Special Elite", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink-faint);
}

/* ----------------- RESPONSIVE ----------------- */

@media (max-width: 940px) {
  .tray { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  body { padding: 14px 8px 36px; }
  .shadowbox { padding: 14px; }
  .tack { width: 11px; height: 11px; }
  .glass { inset: 14px; }
  .cabinet { padding: 28px 18px 22px; }
  .tray { grid-template-columns: 1fr; gap: 22px; }
  .masthead__name { font-size: 36px; }
  .statement { font-size: 20px; }
  .cell__label { left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .photo-grid a:hover { transform: none; }
}

/* =================================================================
   DARK MODE  ·  "the Cornell night-sky box"
   Not a dimmed cabinet, but a different cabinet: the cream-paper
   interior becomes a deep midnight indigo, the cream ink inverts to
   pale silver-gelatin, the paper-grain noise flips to a faint starfield,
   and the celestial elements (constellation arc, Finis star chart) get
   to be the luminous objects they were always meant to be.
   ================================================================= */

:root[data-theme="dark"] {
  /* the cabinet interior is now a deep indigo void */
  --paper:        #131828;
  --paper-mid:    #0e1320;
  --paper-edge:   #06091a;
  --paper-glow:   #1a2038;

  /* wood frame deepens to charcoal mahogany */
  --wood:         #0b0608;
  --wood-light:   #1a0e0c;
  --wood-deep:    #020102;
  --wood-grain:   #08050a;

  /* brass remains lustrous, the high points catching lamplight */
  --brass:        #d4b070;
  --brass-hi:     #f2d088;
  --brass-lo:     #826238;

  /* ink inverts: cream text on the indigo, like silver gelatin */
  --ink:          #d8c8a4;
  --ink-soft:     #a89678;
  --ink-faint:    #6e5e48;

  /* sky elements luminous; sky-deep flips to "still blue, still visible" */
  --sky:          #b6d0ec;
  --sky-deep:     #7aa0c8;

  /* rose dims to faded wine-red ink, still warm */
  --rose:         #c87878;

  /* gold catches firelight beautifully */
  --gold:         #f0c860;

  --thread:       #4a3520;
}

/* the room around the cabinet goes very dark */
:root[data-theme="dark"] body {
  background-color: #050208;
  background-image:
    radial-gradient(ellipse at 50% 0%,   rgba(214, 176, 112, 0.06), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.85), transparent 50%),
    radial-gradient(ellipse at 50% 50%,  #0a0510, #050208 70%);
}

/* a soft warm halo wraps the cabinet from outside, like a lamp behind it */
:root[data-theme="dark"] .shadowbox {
  box-shadow:
    0 1px 0 rgba(255, 235, 200, 0.08) inset,
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 70px rgba(230, 175, 100, 0.07),
    0 14px 38px rgba(0, 0, 0, 0.75),
    0 50px 100px rgba(0, 0, 0, 0.65);
}

/* the glass front catches a candle's reflection */
:root[data-theme="dark"] .glass {
  background:
    linear-gradient(
      118deg,
      rgba(255, 230, 180, 0)    0%,
      rgba(255, 230, 180, 0.04) 22%,
      rgba(255, 230, 180, 0.14) 30%,
      rgba(255, 230, 180, 0.02) 42%,
      rgba(255, 230, 180, 0)    100%
    );
}

/* cabinet interior: swap the dark-on-light noise filter for light specks,
   so the paper-grain reads as a faint starfield against the indigo */
:root[data-theme="dark"] .cabinet {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.82  0 0 0 0 0.86  0 0 0 0 0.96  0 0 0 0.045 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>"),
    radial-gradient(ellipse at 50% 30%, var(--paper-glow) 0%, var(--paper) 50%, var(--paper-mid) 100%);
}

/* each cell: same noise swap (light specks against dark) */
:root[data-theme="dark"] .cell {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.82  0 0 0 0 0.86  0 0 0 0 0.96  0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23c)'/></svg>");
}

/* photos cell: brighter celestial chart sitting over a light-speck base */
:root[data-theme="dark"] .cell--photos {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='%23c4d6e6' opacity='0.5'><circle cx='40' cy='30' r='1.5'/><circle cx='80' cy='55' r='1'/><circle cx='150' cy='40' r='1.8'/><circle cx='110' cy='90' r='1.2'/><circle cx='170' cy='130' r='1.5'/><circle cx='60' cy='150' r='1'/><circle cx='30' cy='100' r='1.5'/><circle cx='100' cy='170' r='1.2'/></g></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='c'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.82  0 0 0 0 0.86  0 0 0 0 0.96  0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23c)'/></svg>");
}

/* constellation arc above the masthead glows with brighter stars */
:root[data-theme="dark"] .lid::before {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 560 70'><g fill='none' stroke='%23b6cce0' stroke-width='0.8' stroke-dasharray='2 4'><path d='M 30 50 Q 280 0 530 50' /></g><g fill='%23e2ecf6'><circle cx='30' cy='50' r='1.8'/><circle cx='110' cy='28' r='1.4'/><circle cx='200' cy='14' r='2'/><circle cx='280' cy='8' r='1.6'/><circle cx='360' cy='14' r='2.2'/><circle cx='450' cy='28' r='1.4'/><circle cx='530' cy='50' r='1.8'/></g></svg>");
  opacity: 0.7;
  filter: drop-shadow(0 0 3px rgba(182, 204, 224, 0.5));
}

/* Finis star chart: lift hardcoded dark-blue circles to luminous sky-blue */
:root[data-theme="dark"] .cell--fini .star-chart {
  opacity: 0.95;
  filter: brightness(2.4) saturate(0.85) drop-shadow(0 0 2px rgba(244, 232, 199, 0.5));
}

/* Telegram (Bluesky) link uses sky-deep, which is set above to stay luminous,
   but also force the dashed underline to match so it remains visible. */
:root[data-theme="dark"] .telegram a {
  color: var(--sky);
  border-bottom-color: var(--sky);
}

/* small affordance: the brass fittings get a touch more shine in the dark. */
:root[data-theme="dark"] .cell--correspondence .link-list li::before,
:root[data-theme="dark"] .grommet,
:root[data-theme="dark"] .divider::before,
:root[data-theme="dark"] .divider::after,
:root[data-theme="dark"] .tack {
  filter: brightness(1.08) saturate(1.05);
}

