:root {
  color-scheme: light;
  --ink: #080705;
  --ink-soft: #211b14;
  --paper: #eadfc8;
  --paper-light: #f5ecd8;
  --paper-dim: #d1bea0;
  --gold: #c89a45;
  --gold-deep: #8d6328;
  --oxide: #8f351e;
  --rule: rgba(8, 7, 5, 0.84);
  --shadow: rgba(0, 0, 0, 0.34);
  --spread-max: 1180px;
  --viewer-width: min(88vw, 1720px);
  --viewer-height: min(86vh, 980px);
  --spread-border: 3px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: #000;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: rgba(245, 236, 216, 0.012);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
a.button {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.55rem 0.75rem;
  transform: translateY(-180%);
  background: var(--paper-light);
  border: 2px solid var(--ink);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  color: var(--paper-light);
  background: rgba(5, 4, 3, 0.96);
  border-bottom: 2px solid var(--gold);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark small {
  color: var(--paper-dim);
  font-size: 0.72rem;
}

.brand-sigil {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  color: var(--paper-light);
  background: #050403;
  border: 2px solid var(--gold);
  font-size: 1.55rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.site-nav a {
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(200, 154, 69, 0.46);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.78rem;
  background: rgba(234, 223, 200, 0.07);
}

.site-nav a:focus-visible,
.site-nav a:hover,
.button:focus-visible,
.button:hover,
.icon-button:focus-visible,
.icon-button:hover {
  outline: 2px solid var(--paper-light);
  outline-offset: 2px;
}

main {
  width: min(var(--spread-max), calc(100% - 2rem));
  margin: 0 auto;
}

.page-section {
  margin: clamp(1.2rem, 3vw, 2.2rem) 0;
}

.hero {
  display: grid;
  width: min(var(--spread-max), 100%);
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 26rem);
  gap: 0;
  align-items: stretch;
  margin-right: auto;
  margin-left: auto;
  overflow: hidden;
  border: var(--spread-border) solid var(--gold);
  background: var(--paper);
  box-shadow: 0 1.2rem 3.8rem var(--shadow);
}

.hero-image {
  position: relative;
  min-height: clamp(20rem, 54vh, 34rem);
  background: #000;
  overflow: hidden;
}

.hero-image::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent 58%, rgba(8, 7, 5, 0.68));
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1.5rem, 3.2vw, 2.8rem);
  background:
    linear-gradient(rgba(245, 236, 216, 0.92), rgba(234, 223, 200, 0.94)),
    repeating-linear-gradient(0deg, rgba(8, 7, 5, 0.04), rgba(8, 7, 5, 0.04) 1px, transparent 1px, transparent 8px);
  border-left: var(--spread-border) solid var(--ink);
}

.kicker,
.viewer-index {
  margin: 0;
  color: var(--gold-deep);
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.04;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: none;
  margin-bottom: 0;
  overflow-wrap: normal;
  font-size: clamp(2.15rem, 3.25vw, 3.12rem);
}

.hero-panel p {
  font-size: 1.05rem;
}

.hero-actions,
.viewer-controls,
.zoom-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  color: var(--ink);
  background: var(--paper-light);
  border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 1px rgba(200, 154, 69, 0.62);
  cursor: pointer;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 700;
}

.button.primary {
  color: var(--paper-light);
  background: var(--ink);
  border-color: var(--gold);
}

.button.compact {
  min-height: 2.45rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
}

.section-rule {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
  margin-bottom: 1rem;
  background: var(--paper-light);
  border: 3px solid var(--ink);
  box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.18);
}

.section-rule span {
  display: grid;
  min-width: 4.6rem;
  place-items: center;
  color: var(--paper-light);
  background: var(--ink);
  border-right: 2px solid var(--gold);
  font-size: 2.2rem;
  font-weight: 700;
}

.section-rule h2 {
  margin: 0;
  padding: 0.7rem 1rem;
  font-size: clamp(1.45rem, 3.8vw, 2.65rem);
}

.text-section {
  padding: clamp(1rem, 3vw, 1.4rem);
  background:
    linear-gradient(rgba(245, 236, 216, 0.94), rgba(234, 223, 200, 0.96)),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(8, 7, 5, 0.035) 12px, rgba(8, 7, 5, 0.035) 13px);
  border: var(--spread-border) double var(--rule);
}

.text-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 1.08rem;
}

.gallery-status {
  padding: 0.75rem 1rem;
  color: var(--paper-light);
  background: rgba(8, 7, 5, 0.88);
  border: 1px solid var(--gold);
}

.gallery-status:empty {
  display: none;
}

.plate-grid {
  display: grid;
  width: min(var(--spread-max), 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-right: auto;
  margin-left: auto;
}

.plate-card {
  display: grid;
  grid-template-rows: auto 1fr;
  color: var(--ink);
  background: var(--paper);
  border: var(--spread-border) solid var(--ink);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.22);
}

.plate-card button {
  display: grid;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.plate-thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--ink);
  border-bottom: 2px solid var(--gold);
}

.plate-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.plate-thumb.has-plate-document {
  aspect-ratio: 3 / 2;
}

.plate-thumb.has-plate-document > .plate-number {
  display: none;
}

.plate-card:hover .plate-thumb img,
.plate-card:focus-within .plate-thumb img {
  transform: scale(1.025);
}

.plate-number {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  place-items: center;
  color: var(--paper-light);
  background: rgba(8, 7, 5, 0.95);
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  font-size: 1.55rem;
  font-weight: 700;
}

.plate-card-text {
  padding: 0.85rem;
  border-top: 1px solid rgba(8, 7, 5, 0.28);
}

.plate-card h3 {
  margin-bottom: 0.2rem;
  font-size: clamp(1.08rem, 2vw, 1.45rem);
}

.plate-card p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.glossary-note {
  max-width: 64rem;
}

.glossary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.glossary-entry {
  padding: 0.85rem;
  background: rgba(245, 236, 216, 0.72);
  border: 2px solid rgba(8, 7, 5, 0.78);
}

.glossary-entry h3 {
  margin-bottom: 0.35rem;
}

.glossary-entry p {
  margin-bottom: 0;
}

.plate-reader {
  display: none;
  margin: clamp(1.25rem, 3vw, 2rem) 0;
}

.plate-reader.is-open {
  display: block;
}

.reader-nav,
.reader-shell,
.reader-header,
.reader-art,
.reader-body {
  width: min(100%, 72rem);
  margin-right: auto;
  margin-left: auto;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.reader-nav-bottom {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.reader-shell {
  display: block;
  padding: clamp(1rem, 2.5vw, 2rem) 0;
}

.reader-header {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  color: var(--ink);
  background-color: var(--paper-light);
  background-image: linear-gradient(rgba(245, 236, 216, 0.98), rgba(234, 223, 200, 0.98));
  border: 2px solid rgba(8, 7, 5, 0.24);
  box-shadow: 0 0.7rem 1.6rem rgba(0, 0, 0, 0.1);
}

.reader-index {
  margin: 0 0 0.35rem;
  color: var(--gold-deep);
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
}

.reader-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.viewer-subtitle {
  margin: 0.3rem 0 0;
  color: #30261d;
  text-transform: uppercase;
  font-weight: 700;
}

.reader-art {
  width: min(90%, 960px);
  margin-bottom: 1.5rem;
}

.reader-art img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: transparent;
  cursor: zoom-in;
}

.reader-body {
  font-size: clamp(1.08rem, 1.45vw, 1.3rem);
  line-height: 1.78;
}

.reader-body p {
  margin-bottom: 1.2rem;
}

.reader-body p:last-child {
  margin-bottom: 0;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  isolation: isolate;
  background: #000;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: #000;
  border: 0;
  cursor: zoom-out;
}

.lightbox-figure {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(96vw, 1400px);
  height: min(92vh, 1000px);
  margin: 4vh auto 0;
  padding: 1rem;
  overflow: hidden;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.5);
  cursor: grab;
  transform-origin: center center;
  will-change: transform;
  touch-action: none;
  user-select: none;
}

.image-lightbox.is-panning .lightbox-figure img {
  cursor: grabbing;
}

.lightbox-close {
  position: absolute;
  right: 1.25rem;
  top: 1.25rem;
  z-index: 2;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  color: var(--paper-light);
  background: var(--ink);
  border: 2px solid var(--gold);
  cursor: pointer;
  font-weight: 700;
}

.noscript-warning {
  margin: 1rem;
  padding: 1rem;
  background: var(--paper-light);
  border: 2px solid var(--oxide);
}

@media (max-width: 860px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .hero,
  .viewer-shell {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-panel,
  .viewer-panel {
    border-left: 0;
    border-top: var(--spread-border) solid var(--ink);
  }

  .hero-image {
    min-height: clamp(18rem, 48vh, 30rem);
  }

  .hero-image::after {
    background: linear-gradient(0deg, rgba(8, 7, 5, 0.58), transparent 45%);
  }

  h1 {
    max-width: none;
    font-size: clamp(1.95rem, 9.2vw, 3.2rem);
  }

  .text-columns,
  .plate-grid,
  .glossary-list {
    grid-template-columns: 1fr;
  }

  .viewer-shell {
    width: min(100%, calc(100vw - 1rem));
    height: min(94vh, 980px);
    overflow-y: auto;
  }

  .plate-viewer.is-inspection .viewer-shell {
    grid-template-columns: 1fr;
  }

  .plate-viewer.has-body-copy .viewer-shell,
  .plate-viewer.has-body-copy.is-inspection .viewer-shell,
  .plate-viewer.has-no-metadata .viewer-shell,
  .plate-viewer.has-no-metadata.is-inspection .viewer-shell {
    grid-template-columns: 1fr;
  }

  .plate-viewer.is-inspection .viewer-panel dl {
    display: block;
  }

  .viewer-image-wrap {
    min-height: 52vh;
  }

  .viewer-image-wrap img {
    max-height: none;
  }

  .plate-viewer.has-plate-document .viewer-image-wrap {
    min-height: 62vh;
  }

  .plate-document {
    grid-template-columns: minmax(9rem, 42%) minmax(0, 1fr);
  }

  .plate-document-heading {
    grid-template-columns: 3rem minmax(0, 1fr);
  }

  .plate-document-number {
    font-size: 2rem;
  }

  .plate-document-title {
    padding: 0.45rem 0.6rem;
  }

  .plate-document-title h3 {
    font-size: clamp(0.9rem, 3.8vw, 1.35rem);
  }

  .plate-document-title p {
    font-size: clamp(0.72rem, 3vw, 1rem);
  }

  .plate-document-copy {
    padding: 0.65rem;
    font-size: clamp(0.72rem, 2.7vw, 1rem);
  }
}

@media (max-width: 520px) {
  main {
    width: min(100% - 1rem, 1180px);
  }

  .site-nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .section-rule span {
    min-width: 3.4rem;
    font-size: 1.65rem;
  }

  .hero-actions,
  .viewer-controls,
  .zoom-controls {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .plate-document {
    grid-template-columns: minmax(8rem, 45%) minmax(0, 1fr);
  }

  .plate-document-copy {
    line-height: 1.32;
  }

  .plate-document-footer {
    font-size: 0.62rem;
  }
}
