:root {
  --bg: #070707;
  --ink: #f3eee6;
  --muted: #b7b0a4;
  --gap: 6px;
  --pad: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  height: -webkit-fill-available;
}
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  scrollbar-width: thin;
  scrollbar-color: rgba(207,198,184,0.35) transparent;
}

a { color: inherit; text-decoration: none; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--pad);
  letter-spacing: 0.28em;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  color: #e8e2d8;
  background: var(--bg);
}

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}
.mast .topbar {
  position: relative;
  background: transparent;
}
.subbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad) 16px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8f8a82;
}
.subbar a.active,
.subbar a:hover { color: #f3eee6; }

@media (min-width: 801px) {
  .topbar,
  .mast .topbar,
  .filters,
  .subbar,
  .chapter-tabs,
  .atlas-tabs,
  .nav-menu a {
    font-size: 14.3px;
  }
}

/* Journal/Atlas/Codex main nav: solid chrome in normal flow inside .mast
   (no translucent overlay, no fade-to-transparent). */
.journal-page .topbar {
  position: relative;
  z-index: 40;
  background: var(--bg);
  background-color: var(--bg);
  text-shadow: none;
  padding-top: max(22px, env(safe-area-inset-top));
}

.filters {
  display: flex;
  align-items: center;
  gap: 22px;
  color: #8f8a82;
}

.filters a.active,
.filters a:hover { color: #f3eee6; }

.dot { color: #5c5852; letter-spacing: 0; }

.cover { overflow: hidden; }
.cover-hero img { object-position: center 45%; }

.cover-mark {
  position: fixed;
  top: max(36px, calc(env(safe-area-inset-top) + 10px));
  left: 0;
  right: 0;
  z-index: 6;
  text-align: center;
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 44px);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #f4efe6;
  text-shadow: 0 2px 18px rgba(0,0,0,0.45);
}

.cover-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(32px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 6;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 4px 18px rgba(0,0,0,0.7);
}

.cover-nav a { color: #fff; opacity: 0.95; }
.cover-nav a:hover { opacity: 1; }
.cover-nav .dot { color: rgba(255,255,255,0.55); }

.wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  padding: 0 var(--pad) var(--pad);
}

.tile {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #111;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile .label {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
}

.tile:hover .label { opacity: 1; }











.arrow {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 36px;
  color: #efe8dc;
  opacity: 0.4;
}
.arrow:hover { opacity: 1; }











.more {
  display: inline;
  margin: 0;
  border: 0;
  background: none;
  color: #cfc6b8;
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  flex: 0 0 auto;
}

.lore {
  max-width: 42ch;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: none;
  box-shadow: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: max-height 280ms ease, opacity 220ms ease, margin-top 280ms ease, padding 280ms ease;
}
.lore::-webkit-scrollbar { width: 3px; }
.lore::-webkit-scrollbar-track { background: transparent; }
.lore::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; }
.lore::-webkit-scrollbar-thumb { transition: background 700ms ease; }
.lore.show-bar::-webkit-scrollbar-thumb,
.lore.open.show-bar::-webkit-scrollbar-thumb { background: rgba(207,198,184,0.45); }
.lore.show-bar,
.lore.open.show-bar { scrollbar-width: thin; scrollbar-color: rgba(207,198,184,0.45) transparent; }
.lore.open {
  max-height: none;
  opacity: 1;
  margin-top: 14px;
  overflow: auto;
  scrollbar-width: none;
  background: none;
  box-shadow: none;
  padding: 4px 0 8px;
  -webkit-mask-image: none;
  mask-image: none;
}
.lore p {
  line-height: 1.55;
  font-size: 16px;
  color: #e7dfd3;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.85),
    0 0 14px rgba(0,0,0,0.8),
    0 0 28px rgba(0,0,0,0.55);
}
.lore p + p { margin-top: 12px; }
.lore .say {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #b7b0a4;
}













.journal-read {
  scrollbar-width: thin;
  scrollbar-color: rgba(207,198,184,0.38) transparent;
}
.journal-read::-webkit-scrollbar {
  width: 3px;
}
.journal-read::-webkit-scrollbar-track {
  background: transparent;
}
.journal-read::-webkit-scrollbar-thumb {
  background: rgba(207,198,184,0.4);
  border-radius: 99px;
}

.room-body { padding: 48px var(--pad); }
.index-list { padding: 8px var(--pad) 64px; max-width: 820px; }
.index-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.42fr) 1fr;
  gap: 24px;
  padding: 11px 0;
  border-bottom: 1px solid #1c1c1c;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.index-name { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.index-cap { font-size: 13px; color: #8f8a82; }

.atlas-page {
  position: relative;
  background: #070707;
  min-height: 100dvh;
}
.atlas-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.atlas-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.46) saturate(0.9);
}
.atlas-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.38), rgba(0,0,0,0.52) 40%, rgba(0,0,0,0.62));
}
.atlas-page .topbar {
  position: sticky;
  background: var(--bg);
  color: #e8e2d8;
  text-shadow: none;
}
.atlas-stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 64px);
  padding: 0 16px 28px;
}
.atlas-plate {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  box-shadow: none;
}
.atlas-stage img {
  width: auto;
  height: auto;
  max-width: min(94vw, 1260px);
  max-height: calc(100dvh - 96px);
  object-fit: contain;
  display: block;
  border: 1px solid #000;
  background: transparent;
}

.journal-page {
  position: relative;
  min-height: 100dvh;
}

.journal-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.journal-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: brightness(0.46) saturate(0.9);
}
.journal-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.38), rgba(0,0,0,0.52) 40%, rgba(0,0,0,0.62));
}

.journal-page .chapter-tabs,
.journal-page .journal-read {
  position: relative;
  z-index: 2;
}

.journal-page .chapter-tabs {
  padding-top: 76px;
}

.chapter-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 4px var(--pad) 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b7b0a4;
}
.chapter-tabs a {
  padding: 6px 8px;
  border-bottom: 1px solid transparent;
}
.chapter-tabs a.active,
.chapter-tabs a:hover {
  color: #f3eee6;
  border-bottom-color: #f3eee6;
}

.journal-read {
  position: relative;
  max-width: 880px;
  margin: 0 auto 72px;
  padding: 48px 64px 80px;
  background: transparent;
  box-shadow: none;
}
.journal-read::before {
  content: "";
  position: absolute;
  inset: -90px -110px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(6,6,6,0.88) 0%,
    rgba(6,6,6,0.72) 38%,
    rgba(6,6,6,0.28) 62%,
    rgba(6,6,6,0) 78%
  );
}
.journal-read h2 {
  text-align: center;
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.03em;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(243,238,230,0.12);
}
.journal-read p {
  font-size: 18px;
  line-height: 1.75;
  color: #f0e9de;
  margin: 0 0 18px;
  text-shadow: 0 1px 12px rgba(0,0,0,0.45);
}
.journal-fig { margin: 28px 0 32px; }
.journal-fig img {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: cover;
}
.journal-fig figcaption {
  margin-top: 8px;
  text-align: center;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #b7b0a4;
}

.empty {
  padding: 12px 4px;
  color: #8f8a82;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

@media (max-width: 800px) {
  .wall { grid-template-columns: 1fr 1fr; padding: 0 12px 12px; }
  .topbar { padding: 16px 12px; letter-spacing: 0.16em; }


  .filters { gap: 12px; }
  .subbar { gap: 10px; letter-spacing: 0.12em; padding-bottom: 12px; }
  .cover-mark { top: max(22px, calc(env(safe-area-inset-top) + 8px)); letter-spacing: 0.22em; }
  .cover-nav { gap: 10px; font-size: 11px; letter-spacing: 0.16em; bottom: max(22px, calc(env(safe-area-inset-bottom) + 8px)); }




  .more{
    font-size: 11px;
    line-height: 1.35;
    letter-spacing: 0.04em;
    min-height: 32px;
    padding: 6px 4px;
  }







  .lore.open {
    flex: 0 1 auto;
    max-height: none;
    height: auto;
    overflow: hidden;
    margin: 10px 0 0;
    padding: 8px 0 12px;
    -webkit-mask-image: none;
    mask-image: none;
  }




  .arrow {
    position: absolute;
    top: 34%;
    width: 72px;
    height: 140px;
    font-size: 36px;
    pointer-events: auto;
  }
  .arrow.prev { left: 0; }
  .arrow.next { right: 0; }

  .index-row { grid-template-columns: 1fr; gap: 4px; }
  .journal-read { margin: 0 12px 48px; padding: 24px 18px 40px; }
  .journal-read::before { inset: -40px -24px; }
  .journal-page .chapter-tabs { padding-top: calc(64px + env(safe-area-inset-top)); }
}
