/* MIKO.QUEST — Subterranean Cartographers' Guild Archival Registry
   Cold goblincore institutional catalogue. Cool-grays palette, sharp-angled
   clip-path masonry, display-bold condensed mastheads. */

:root {
  --basalt:      #1c2024;
  --wet-schist:  #2e353c;
  --flagstone:   #4a525a;
  --mist-grey:   #7d8690;
  --lichen:      #a6b0b8;
  --drift:       #cdd4d9;
  --frost:       #e6eaed;
  --deep-moss:   #3d4f4a;
  --gap: 14px;
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--drift);
  background-image:
    repeating-linear-gradient(115deg, rgba(28,32,36,0.025) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(35deg, rgba(28,32,36,0.018) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 30% 20%, rgba(122,134,144,0.06), transparent 60%);
  color: var(--basalt);
  font-family: "Spectral", Georgia, serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ============ HEADER STRIP ============ */
.catalogue-header {
  min-height: 18vh;
  background: var(--wet-schist);
  display: grid;
  grid-template-columns: 96px 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 22px 36px;
  border-bottom: 1px solid var(--basalt);
  position: relative;
  overflow: hidden;
}
.catalogue-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 60px, rgba(28,32,36,0.18) 60px 61px);
  pointer-events: none;
}
.crest { width: 96px; height: 96px; position: relative; z-index: 1; }
.crest-svg { width: 100%; height: 100%; }

.masthead { position: relative; z-index: 1; }
.title {
  font-family: "Antonio", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-size: clamp(3.5rem, 9vw, 7rem);
  letter-spacing: 0.02em;
  line-height: 0.92;
  color: var(--frost);
  text-transform: uppercase;
}
.subtitle {
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lichen);
  margin-top: 6px;
}

.colophon {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lichen);
  border-left: 1px solid var(--flagstone);
  padding-left: 22px;
}
.colophon span:first-child {
  font-family: "Big Shoulders Display", "Arial Narrow", sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--drift);
}

/* ============ BODY: RAIL + WALL ============ */
.catalogue-body {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: start;
}

/* ---- Margin index rail ---- */
.index-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #525b63, var(--flagstone) 40%, #424a52);
  border-right: 1px solid var(--basalt);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rail-pendulum {
  flex: 0 0 auto;
  width: 30px;
  height: 80px;
  margin: 10px 0 16px;
  transform-origin: 50% 4%;
}
.pendulum-svg { width: 100%; height: 100%; overflow: visible; }
#pendulumBob, #pendulumString { transform-box: fill-box; }

.rail-list {
  list-style: none;
  flex: 1 1 auto;
  width: 100%;
  text-align: center;
  will-change: transform;
}
.rail-list li {
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--lichen);
  padding: 7px 0;
  border-bottom: 1px solid rgba(28,32,36,0.18);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  cursor: default;
  transition: color 0.2s;
}
.rail-list li:hover { color: var(--frost); }
.rail-list li.active { color: var(--frost); border-color: var(--deep-moss); }

/* ---- Specimen wall masonry ---- */
.specimen-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: 38px;
  grid-auto-flow: dense;
  gap: var(--gap);
  padding: var(--gap);
  background:
    radial-gradient(circle at 80% 0%, rgba(122,134,144,0.05), transparent 50%);
}

.specimen {
  position: relative;
  background: var(--wet-schist);
  color: var(--lichen);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--mist-grey);
  cursor: default;
  transition: filter 0.3s ease, transform 0.3s ease;
}
.specimen:hover { filter: brightness(1.08); }

/* highlight stroke on upper-left edges — drawn as a pseudo border via box-shadow */
.specimen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-top: 2px solid var(--lichen);
  border-left: 2px solid var(--lichen);
  opacity: 0.55;
}

/* the rendered specimen plate area */
.plate {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 88%, rgba(28,32,36,0.55), transparent 70%),
    linear-gradient(165deg, #353c44 0%, var(--wet-schist) 45%, #262c33 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.plate svg { width: 64%; height: 64%; overflow: visible; }
/* sharp short shadow at ~60deg under each rendered object */
.plate .shadow {
  fill: rgba(20,24,28,0.5);
}

/* sigil corner stamp */
.sigil {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  opacity: 0.7;
}
.sigil svg { width: 100%; height: 100%; }
.sigil line, .sigil polyline { stroke: var(--lichen); stroke-width: 1.6; fill: none; }

/* crack-pulse overlay (the "lottie" accent) */
.crack {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.crack polyline {
  fill: none;
  stroke: var(--deep-moss);
  stroke-width: 1.6;
  stroke-dasharray: 1 600;
  stroke-dashoffset: 0;
  opacity: 0;
}
.specimen.cracking .crack polyline {
  opacity: 1;
  animation: crackProp 0.7s ease-out forwards;
}
@keyframes crackProp {
  0%   { stroke-dasharray: 1 600; opacity: 0.9; }
  100% { stroke-dasharray: 600 1; opacity: 0; }
}

/* figcaption block */
.caption {
  flex: 0 0 auto;
  padding: 9px 11px 11px;
  background: rgba(20,24,28,0.35);
  border-top: 1px solid var(--flagstone);
}
.spec-id {
  font-family: "Big Shoulders Display", "Arial Narrow", sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--lichen);
  text-transform: uppercase;
  line-height: 1;
}
.spec-class {
  font-family: "Antonio", "Arial Narrow", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mist-grey);
  margin-top: 3px;
  display: inline-block;
}
.spec-latin {
  font-style: italic;
  font-size: 0.86rem;
  color: var(--drift);
  margin-top: 5px;
}
.spec-prov {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--mist-grey);
  margin-top: 5px;
}
.spec-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--flagstone);
  margin-top: 7px;
}
.specimen:hover .spec-latin {
  text-decoration: underline;
  text-decoration-color: var(--deep-moss);
  text-underline-offset: 3px;
}

/* ============ FOOTER ============ */
.provenance-footer {
  min-height: 24vh;
  background: var(--flagstone);
  border-top: 1px solid var(--basalt);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 36px;
  align-items: center;
  padding: 36px 44px;
}
.footer-seal { display: flex; justify-content: center; }
.seal-svg { width: 150px; height: 150px; overflow: visible; }
.seal-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.18em;
  fill: var(--lichen);
}
.seal-bloom polygon, .seal-bloom line { transition: none; }

.footer-prose p {
  font-size: 0.92rem;
  line-height: 1.6;
  text-align: justify;
  color: var(--drift);
  hyphens: auto;
}
.footer-runes { display: flex; justify-content: flex-end; }
.rune-stanza {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--lichen);
  border-left: 1px solid var(--mist-grey);
  padding-left: 18px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 760px) {
  .catalogue-header {
    grid-template-columns: 64px 1fr;
    grid-template-rows: auto auto;
  }
  .crest { width: 64px; height: 64px; }
  .colophon {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    border-left: none;
    border-top: 1px solid var(--flagstone);
    padding-left: 0;
    padding-top: 10px;
    gap: 14px;
  }
  .catalogue-body { grid-template-columns: 34px 1fr; }
  .specimen-wall { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .rail-list li { font-size: 0.5rem; }
  .provenance-footer {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  .footer-runes { justify-content: center; }
  .rune-stanza { border-left: none; padding-left: 0; text-align: left; }
}
