:root {
  --bg: #050505;
  --ink: #f3f1ec;
  --muted: #8a8a8a;
  --dim: #5c5c5c;
  --line: #242424;
  --gold: #c6b48a;
  --focus: #f3f1ec;
  --mono: "IBM Plex Mono", "Courier New", Courier, monospace;
  --serif: "Newsreader", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --measure: 68ch;
  --nav: 52px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  font-weight: 400;
}

img { max-width: 100%; }

button, input { font: inherit; color: inherit; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: #fff;
  color: #000;
  padding: 8px 12px;
  z-index: 50;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.skip:focus { top: 12px; }

.gate {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 20px 64px;
  text-align: center;
}

.kicker, .gate-foot, .eyebrow, .site-nav, .deity-index, .deity-role,
.stage figcaption, .films figcaption, .filters, .wall-note, .stats,
.ledger, .search, .colophon, .noscript, .viewer-bar, .search-count {
  font-family: var(--mono);
}

.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mark {
  display: grid;
  grid-template-columns: auto auto auto auto auto;
  align-items: start;
  justify-content: center;
  column-gap: 0.31em;
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  font-size: clamp(64px, 12vw, 132px);
  line-height: 0.86;
  color: #fff;
  text-decoration: none;
}

.col { display: flex; flex-direction: column; align-items: center; }

.initial {
  display: block;
  font-size: 0.6em;
  line-height: 1;
}

.drop {
  display: block;
  font-size: 0.6em;
  font-weight: 500;
  line-height: 1.12;
  color: #6e6e6e;
  margin-top: 0.18em;
}

.dot-cell {
  /* Same height as the I / H / O line, so the dot centers on the letter. */
  height: 0.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.06em;
}

.dot {
  width: 0.2em;
  height: 0.2em;
  border-radius: 50%;
  background: #fff;
  display: block;
}

.mark:hover .drop, .mark:focus-visible .drop { color: #bdbdbd; }

.gate-foot {
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--nav);
  padding: 0 22px;
  background: rgba(5, 5, 5, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.nav-mark {
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.nav-links a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav-links a:hover { color: var(--ink); }

main { padding: 0 22px 40px; }

section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 0 24px;
  scroll-margin-top: calc(var(--nav) + 12px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3 { font-weight: 500; letter-spacing: -0.02em; }

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 0.95;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

h3 {
  margin: 0;
  font-size: 1.8rem;
  font-family: var(--serif);
}

.place, .lead {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
}

.place { margin: 0 0 28px; }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1em; }

.lead { max-width: 70ch; margin: 0 0 28px; }

.deities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 8px;
}

.deities article {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.deities article.horus { border-top-color: var(--gold); }

.deity-index, .deity-role {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.deity-role { margin: 4px 0 14px; color: var(--muted); }

.deities p:last-child { margin: 0; font-size: 1.02rem; }

.films {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 42px;
}

.films figure {
  margin: 0;
  min-width: 0;
}

.frame {
  background: #000;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 9;
}

.frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.films figcaption, .stage figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.stage {
  margin: 0;
  background: #000;
}

.stage-hit {
  display: block;
  width: 100%;
  height: min(68vh, 640px);
  padding: 0;
  border: 1px solid var(--line);
  background: #000;
  cursor: zoom-in;
}

.stage-hit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stage-controls { display: flex; gap: 8px; }

.stage-controls button, .filters button, .viewer-bar button, .viewer-stage button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.stage-controls button:hover, .filters button:hover, .viewer-bar button:hover {
  border-color: var(--muted);
}

.strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 0 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #2c2c2c #050505;
}

.strip::-webkit-scrollbar {
  height: 10px;
}

.strip::-webkit-scrollbar-track {
  background: #050505;
}

.strip::-webkit-scrollbar-thumb {
  background: #2c2c2c;
  border: 2px solid #050505;
}

.strip::-webkit-scrollbar-thumb:hover {
  background: #454545;
}

.strip button {
  flex: 0 0 92px;
  height: 64px;
  padding: 0;
  border: 1px solid transparent;
  background: #000;
  cursor: pointer;
}

.strip button[aria-current="true"] { border-color: var(--ink); }

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

.closing {
  margin: 36px 0 28px;
  text-align: center;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-style: italic;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.filters button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #050505;
}

.filters span { color: inherit; opacity: 0.7; }

.wall-note {
  margin: 0 0 16px;
  color: var(--dim);
  font-size: 0.72rem;
}

.wall {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 6px;
}

.eye {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: #fff;
  cursor: zoom-in;
  aspect-ratio: 3839 / 2550;
}

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

.eye:hover img, .eye:focus-visible img { opacity: 0.82; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 0;
}

.stats div { background: var(--bg); padding: 16px 14px 14px; }

.stats dt {
  color: var(--dim);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.stats dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1;
}

.search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.search input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-family: var(--serif);
}

.search-count {
  min-height: 1.2em;
  color: var(--dim);
  font-size: 0.72rem;
}

.ledger {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 28px;
  font-size: 0.78rem;
}

.ledger li {
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.ledger .num { color: var(--dim); }
.ledger .who {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1rem;
  color: inherit;
}
.ledger .side { color: var(--muted); text-align: right; }
.ledger .fib { color: var(--gold); }

.colophon {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 22px 72px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.colophon .closing { margin-top: 0; color: var(--ink); }

.contacts { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.contacts a { color: var(--ink); }

.noscript {
  max-width: 1180px;
  margin: 0 auto 40px;
  padding: 0 22px;
  color: var(--muted);
  font-size: 0.8rem;
}

#viewer {
  width: min(1100px, calc(100vw - 24px));
  height: min(920px, calc(100vh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  margin: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: #050505;
  color: var(--ink);
  overflow: hidden;
}

/* display:flex on the dialog itself beats the UA rule dialog:not([open]) { display: none },
   so a closed viewer stays in the document and sits at the bottom of the page. */
#viewer[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
}

#viewer::backdrop { background: rgba(0, 0, 0, 0.88); }

.viewer-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: 10px;
  font-size: 0.75rem;
}

.viewer-bar p { margin: 0; }

.viewer-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.viewer-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex: 0 0 auto;
}

.viewer-stage img {
  width: 100%;
  flex: 1 1 0;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: #000;
}

.viewer-stage button {
  font-size: 1.6rem;
  line-height: 1;
  padding: 8px 12px;
}

@media (max-width: 980px) {
  .deities, .films { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .wall { grid-template-columns: repeat(6, 1fr); }
  .ledger { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .site-nav {
    width: 100%;
    padding: 8px 14px;
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }
  .nav-links { width: 100%; }
  main { padding: 0 14px 24px; }
  .wall { grid-template-columns: repeat(3, 1fr); }
  .ledger { grid-template-columns: 1fr; }
  .stage-hit { height: 52vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .strip { scroll-behavior: auto; }
}
