/* Minimal desert: paper sand, ink text. */
:root {
  --paper: #14100b;
  --sand: #2e2318;
  --ink: #ece0c9;
  --faded: #a08d6f;
  --spice: #e07b39;
}

* { box-sizing: border-box; }

/* per-volume themes (duplicating the JS palette so theming never depends
   on one mechanism alone) */
body[data-vol="dune"] { --paper: #14100b; --sand: #2e2318; --ink: #ece0c9; --faded: #a08d6f; --spice: #e07b39; }
body[data-vol="messiah"] { --paper: #171009; --sand: #33241a; --ink: #ead9bd; --faded: #a68a5c; --spice: #c9962e; }
body[data-vol="children"] { --paper: #161006; --sand: #352813; --ink: #f0e3c2; --faded: #ab8f57; --spice: #d9a529; }
body[data-vol="godemperor"] { --paper: #130d08; --sand: #2c2013; --ink: #e6d5b8; --faded: #9c8461; --spice: #b06a2e; }
body[data-vol="heretics"] { --paper: #160b07; --sand: #352015; --ink: #f0dcc4; --faded: #a87f60; --spice: #e05a2a; }
body[data-vol="chapterhouse"] { --paper: #0e100b; --sand: #232a1c; --ink: #dfe4cf; --faded: #8f957e; --spice: #7fae56; }

/* click acknowledgement wash */
#flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  background: var(--spice);
}
#flash.go { animation: flashfade 0.45s ease-out; }
@keyframes flashfade {
  0% { opacity: 0.14; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #flash.go { animation: none; }
}

/* per-volume ambient art: only the selected volume's group shows */
#bgart {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#bgart svg { width: 100%; height: 100%; opacity: 0.4; }
#bgart g { display: none; }
/* standalone compass widget: fixed size, anchored corner, immune to page reflow */
.compass-foot {
  text-align: center;
  padding: 16px 24px 56px;
}
.compass-phrase {
  margin: 14px auto 0;
  font-size: 14px;
  font-style: italic;
  color: var(--faded);
}
#compass {
  width: min(140px, 44vw);
  height: auto;
  opacity: 0.9;
}
#compass .ticks {
  fill: none;
  stroke: var(--faded);
  stroke-width: 8;
  stroke-dasharray: 2 5;
  opacity: 0.6;
}
#compass .outer {
  fill: none;
  stroke: var(--faded);
  stroke-width: 1.5;
  opacity: 0.7;
}
#compass .cross {
  stroke: var(--faded);
  stroke-width: 1;
  opacity: 0.45;
}
#compass .sweep-arc {
  fill: none;
  stroke: var(--spice);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.9;
}
#compass .sweep-ring {
  fill: none;
  stroke: var(--spice);
  stroke-width: 1.5;
  stroke-dasharray: 4 10;
  opacity: 0.55;
}
#compass .wedge { fill: var(--spice); opacity: 0.95; }
#compass .inter {
  fill: var(--faded);
  font-family: "Courier New", monospace;
  font-size: 15px;
  text-anchor: middle;
  opacity: 0.7;
}
#compass .cardinal {
  fill: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 26px;
  font-weight: bold;
  text-anchor: middle;
  opacity: 0.9;
}
#compass .pin { fill: var(--faded); }
body[data-vol="dune"] #art-dune,
body[data-vol="messiah"] #art-messiah,
body[data-vol="children"] #art-children,
body[data-vol="godemperor"] #art-godemperor,
body[data-vol="heretics"] #art-heretics,
body[data-vol="chapterhouse"] #art-chapterhouse { display: block; }
#art-dune circle { fill: #8a5c22; }
#art-messiah circle { fill: #a03c14; }
#art-children circle { fill: #b08a28; }
#art-godemperor circle { fill: #7d5226; }
#art-heretics circle { fill: #a03c14; }
#art-chapterhouse circle { fill: #3f6030; }

header, main, footer { position: relative; z-index: 1; text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55); }

html {
  scroll-behavior: smooth;
  background: #14100b;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
}

.shelf {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 36px 24px 0;
  max-width: 940px;
  margin: 0 auto;
}
.spine {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 56px;
  padding: 14px 0 10px;
  text-align: center;
  overflow: hidden;
  box-shadow: 2px 3px 0 rgba(43, 33, 24, 0.3);
  transition: transform 0.18s ease;
}
.spine:hover { transform: translateY(-8px); }
.spine {
  cursor: pointer;
}
.spine.active {
  transform: translateY(-8px);
}
.spine span {
  writing-mode: vertical-rl;
  font-size: 11px;
  letter-spacing: 0.12em;
  margin: 0 auto;
  line-height: 1.5;
}
.spine em {
  font-style: normal;
  font-size: 10px;
  opacity: 0.75;
  margin-top: 8px;
}
.s1 { height: 168px; background: #b3541e; color: #f4ecdd; }
.s2 { height: 152px; background: #2b2118; color: #e4d3b3; }
.s3 { height: 160px; background: #8a7a5f; color: #2b2118; }
.s4 { height: 176px; background: #6e2f12; color: #f4ecdd; }
.s5 { height: 148px; background: #e4d3b3; color: #2b2118; border: 1px solid #8a7a5f; }
.s6 { height: 164px; background: #3d2c17; color: #e4d3b3; }
.shelf-note {
  text-align: center;
  font-size: 14px;
  font-style: italic;
  color: var(--faded);
  margin: 12px auto 0;
  max-width: 880px;
  padding: 0 24px;
  min-height: 42px;
}
.shelf-note.tick { animation: acknowledge 0.35s ease; }
@keyframes acknowledge {
  0% { opacity: 0.15; }
  100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf-note.tick { animation: none; }
}

header, main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

header { padding-top: 12px; }
.kicker {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--faded);
}
h1 {
  margin: 8px 0 4px;
  font-size: clamp(34px, 7vw, 54px);
  font-weight: normal;
  letter-spacing: 0.02em;
}
.tagline {
  margin: 0 0 20px;
  font-style: italic;
  color: var(--faded);
}
.theme-note {
  margin: -8px 0 20px;
  font-size: 15px;
  font-style: italic;
  color: var(--faded);
  opacity: 0.85;
}
.theme-note em { color: var(--spice); }
nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sand);
}
nav a, p a { color: var(--spice); }
nav a {
  text-decoration: none;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
nav a:hover { text-decoration: underline; }
nav a svg {
  width: 18px;
  height: 18px;
  color: var(--faded);
  flex: none;
}
nav a:hover svg { color: var(--spice); }

main section { padding: 30px 0; border-top: 1px solid var(--sand); }
main section:first-child { border-top: none; }
h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: normal;
  color: var(--faded);
}
h2 .num {
  color: var(--spice);
  margin-right: 12px;
}

p { margin: 0 0 12px; }
ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
li { padding: 9px 0; border-bottom: 1px dotted var(--sand); transition: padding-left 0.15s ease; }
li:hover { padding-left: 8px; }
li strong { font-weight: normal; }
li span { color: var(--faded); }
li span::before { content: " — "; }
li i {
  display: inline-block;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--spice);
  border: 1px solid var(--sand);
  border-radius: 10px;
  padding: 0 8px;
  margin: 2px 0 2px 8px;
  white-space: nowrap;
}
.more { margin-top: 14px; }

/* project list: compact rows */
.proj-index { list-style: none; margin: 0 0 12px; padding: 0; }
.proj-index li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dotted var(--sand);
}
.proj-index li:hover { padding-left: 8px; }
.proj-index .num { color: var(--spice); font-size: 14px; letter-spacing: 0.2em; }
.proj-index a.title {
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  white-space: nowrap;
}
.proj-index a.title:hover { color: var(--spice); }
.proj-index .blurb { color: var(--faded); font-size: 17px; }
.proj-index .go { margin-left: auto; color: var(--spice); white-space: nowrap; }

/* detail pages: hero media + gallery */
.hero video {
  display: block;
  width: 100%;
  border: 1px solid var(--sand);
}
.hero video { background: #000; }
/* blog photos: fill the column when landscape, cap by height when portrait */
.hero img, main figure img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72vh;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--sand);
}
main figure { margin: 0 0 14px; }
figure.portrait img { max-width: 300px; }
main figcaption {
  font-size: 15px;
  font-style: italic;
  color: var(--faded);
  margin-top: 6px;
  text-align: center;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 14px 0;
}
.gallery figure { margin: 0; }
.gallery img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--sand);
}
.gallery figcaption {
  font-size: 15px;
  font-style: italic;
  color: var(--faded);
  margin-top: 6px;
}
/* inline architecture diagrams */
.arch svg { display: block; width: 100%; height: auto; }
.arch .box { fill: var(--sand); fill-opacity: 0.5; stroke: var(--faded); stroke-width: 2; }
.arch .box.hot { stroke: var(--spice); }
.arch text { font-family: "Courier New", monospace; text-anchor: middle; }
.arch .t { font-size: 17px; fill: var(--ink); }
.arch .ts { font-size: 14px; fill: var(--ink); }
.arch .s { font-size: 12px; fill: var(--faded); }
.arch .l { text-anchor: start; }
.arch .tag { font-size: 13px; fill: var(--spice); letter-spacing: 0.15em; }
.arch .edge { stroke: var(--spice); stroke-width: 1.5; fill: none; }
.arch .ahead { fill: var(--spice); }
.arch .elbl { font-size: 12px; fill: var(--faded); }
.arch .nc { fill: var(--spice); }
.arch .nt { fill: #14100b; font-size: 12px; font-weight: bold; }
/* click-to-zoom lightbox */
main figure img { cursor: zoom-in; }
.hero img { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 5, 0.93);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 24px;
}
.lightbox.on { opacity: 1; pointer-events: auto; cursor: zoom-out; }
.lightbox figure { margin: 0; max-width: 94vw; text-align: center; }
.lightbox figure img { max-width: 94vw; max-height: 88vh; cursor: zoom-out; }
.lightbox figcaption { margin-top: 10px; font-size: 15px; font-style: italic; color: var(--faded); }
@media (prefers-reduced-motion: reduce) { .lightbox { transition: none; } }
.media-missing {
  border: 1px dashed var(--sand);
  color: var(--faded);
  font-style: italic;
  padding: 26px 18px;
  text-align: center;
}
.feat { padding-left: 22px; }
.feat li { border-bottom: none; padding: 5px 0; list-style: square; }
.feat li::marker { color: var(--spice); }

/* stack inventory tables */
table.spec {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 18px;
}
table.spec th, table.spec td {
  text-align: left;
  vertical-align: top;
  padding: 7px 10px 7px 0;
  border-bottom: 1px dotted var(--sand);
}
table.spec th {
  font-weight: normal;
  color: var(--spice);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 14px;
  white-space: nowrap;
  width: 130px;
}
table.spec code, p code, li code {
  font-family: "Courier New", monospace;
  font-size: 0.92em;
  color: var(--ink);
}

/* project log: blog entries */
article { padding: 28px 0; border-top: 1px solid var(--sand); }
article:first-of-type { border-top: none; }
article h2 {
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink);
}
article h2 .num { font-size: 15px; }
.stack { margin: 2px 0 10px; }
.stack i {
  display: inline-block;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--spice);
  border: 1px solid var(--sand);
  border-radius: 10px;
  padding: 0 8px;
  margin: 0 8px 4px 0;
  white-space: nowrap;
}
.divider {
  margin: 34px 0 4px;
  padding-top: 26px;
  border-top: 2px solid var(--spice);
}

/* editorial project features */
.ed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: center;
  padding: 26px 0;
  border-top: 1px solid var(--sand);
}
.ed:first-of-type { border-top: none; }
.ed.flip .ed-media { order: 2; }
.ed-media img, .ed-media video {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  border: 1px solid var(--sand);
  background: #000;
}
.ed .num { color: var(--spice); font-size: 14px; letter-spacing: 0.2em; }
.ed h3 { margin: 6px 0 8px; font-size: clamp(24px, 4vw, 34px); font-weight: normal; }
.ed h3 a { color: var(--ink); text-decoration: none; }
.ed h3 a:hover { color: var(--spice); }
.ed p.desc { color: var(--faded); font-style: italic; }
@media (max-width: 700px) {
  .ed { grid-template-columns: 1fr; }
  .ed.flip .ed-media { order: 0; }
}
/* stack filter chips */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.filters .chip {
  font-family: "Courier New", monospace;
  font-size: 13px;
  background: transparent;
  color: var(--faded);
  border: 1px solid var(--sand);
  border-radius: 12px;
  padding: 2px 12px;
  cursor: pointer;
}
.filters .chip:hover { color: var(--spice); border-color: var(--spice); }
.filters .chip.on { background: var(--spice); border-color: var(--spice); color: #14100b; }
.filter-status {
  margin-left: auto;
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: var(--faded);
}
main { padding-bottom: 64px; }
