* {
  box-sizing: border-box
}

html {
  height: 100%;
}

body {
  min-height: 100%;
}

body {
  margin: 0
}

:root {
  --paper: #f2efe6;
  --ink: #2a2a2a;
  --muted: #6b6b6b;

  --corniceH: 96px;
  --stepH: 160px;

  --colW: 86px;
  --colGap: 26px;

  --capH: 28px;
  --shaftMin: 520px;

  --upperPlinthW: 120px;
  --upperPlinthH: 22px;

  --lowerPlinthW: 260px;
  --lowerPlinthH: 34px;

  --pairEdgeInset: 72px;
  --roundBig: 22px;
  --roundMed: 16px;
}

body {
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: #0b4f6c;
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

body.publications-directory {
  position: relative;
  overflow-x: hidden;
  background: var(--paper);
}

.stairs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--stepH, 140px);
  background: repeating-linear-gradient(to bottom,
      rgba(0, 0, 0, .12) 0px,
      rgba(0, 0, 0, .12) 2px,
      transparent 2px,
      transparent 12px);
  z-index: 0;
  pointer-events: none;
}

.cornice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--corniceH);
  background:
    linear-gradient(180deg, rgba(255,255,255,.85), rgba(0,0,0,.12)),
    repeating-linear-gradient(0deg, rgba(0,0,0,.06) 0 3px, rgba(255,255,255,.18) 3px 6px);
  z-index: 5;
  pointer-events: none;
}

.columns {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.column {
  position: fixed;
  top: var(--corniceH);
  bottom: var(--stepH);
  width: var(--colW);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.column.left.outer {
  left: var(--pairEdgeInset)
}

.column.left.inner {
  left: calc(var(--pairEdgeInset) + var(--colW) + var(--colGap))
}

.column.right.outer {
  right: var(--pairEdgeInset)
}

.column.right.inner {
  right: calc(var(--pairEdgeInset) + var(--colW) + var(--colGap))
}

.column .cap {
  height: var(--capH);
  width: calc(var(--upperPlinthW));
  margin-left: calc((var(--colW) - var(--upperPlinthW)) / 2);
  background:
    radial-gradient(circle at left 50%, rgba(255, 255, 255, .65), rgba(0, 0, 0, .12)),
    radial-gradient(circle at right 50%, rgba(255, 255, 255, .65), rgba(0, 0, 0, .12)),
    linear-gradient(180deg, rgba(255, 255, 255, .65), rgba(0, 0, 0, .12));
  background-size: var(--roundMed) 100%, var(--roundMed) 100%, calc(100% - (var(--roundMed) * 2)) 100%;
  background-position: 0 0, 100% 0, var(--roundMed) 0;
  background-repeat: no-repeat;
}

.column .shaft {
  flex: 1;
  min-height: calc(var(--shaftMin) - var(--capH) - var(--upperPlinthH) - var(--lowerPlinthH));
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .70), rgba(0, 0, 0, .10)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .06) 0 7px, rgba(255, 255, 255, .18) 7px 14px);
  background-blend-mode: normal;
}

.column .plinth.upper {
  height: var(--upperPlinthH);
  width: var(--upperPlinthW);
  margin-left: calc((var(--colW) - var(--upperPlinthW)) / 2);
  background:
    radial-gradient(circle at left 50%, rgba(255, 255, 255, .55), rgba(0, 0, 0, .18)),
    radial-gradient(circle at right 50%, rgba(255, 255, 255, .55), rgba(0, 0, 0, .18)),
    linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(0, 0, 0, .18));
  background-size: var(--roundMed) 100%, var(--roundMed) 100%, calc(100% - (var(--roundMed) * 2)) 100%;
  background-position: 0 0, 100% 0, var(--roundMed) 0;
  background-repeat: no-repeat;
}

.column .plinth.lower {
  height: var(--lowerPlinthH);
  width: var(--lowerPlinthW);
  margin-left: calc((var(--colW) - var(--lowerPlinthW)) / 2);
  background:
    radial-gradient(circle at left 50%, rgba(255, 255, 255, .55), rgba(0, 0, 0, .18)),
    radial-gradient(circle at right 50%, rgba(255, 255, 255, .55), rgba(0, 0, 0, .18)),
    linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(0, 0, 0, .18));
  background-size: var(--roundBig) 100%, var(--roundBig) 100%, calc(100% - (var(--roundBig) * 2)) 100%;
  background-position: 0 0, 100% 0, var(--roundBig) 0;
  background-repeat: no-repeat;
}

/* Height fallbacks (explicit px mirrors --capH / --upperPlinthH / --lowerPlinthH) */
.column .cap { height: 28px; }
.column .plinth.upper { height: 22px; }
.column .plinth.lower { height: 34px; }

body.publications-directory main {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: calc(var(--corniceH) + 24px);
  padding-bottom: calc(var(--stepH) + 24px);
  width: 100%;
}

body.publications-directory {
  --centerSpan: calc(100vw - (2 * var(--pairEdgeInset)) - (4 * var(--colW)) - (2 * var(--colGap)));
  --centerGutter: 56px;
  --textLane: min(72ch, calc(var(--centerSpan) - var(--centerGutter)));
}

body.publications-directory .portal {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.publications-directory .portal-inner {
  width: min(100%, var(--textLane));
  text-align: center;
}

body.publications-directory .portal-inner p {
  margin-left: auto;
  margin-right: auto;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

body.publications-directory .portal-inner h1,
body.publications-directory .portal-inner h2 {
  text-wrap: balance;
}

header {
  text-align: center
}

h1 {
  margin: 0 0 12px;
  font-size: 30px;
  letter-spacing: .4px
}

p {
  margin: 10px 0;
  color: var(--muted)
}

.doc {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 120px;
  padding-bottom: 80px;
  padding-left: 24px;
  padding-right: 24px;
}

.catalog-body {
  display: none;
}

.catalog-body.open {
  display: block;
}

.catalog-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.catalog-list {
  width: 35%;
  overflow-y: auto;
  padding: 1rem;
}

.catalog-detail {
  width: 65%;
  padding: 2rem;
  overflow-y: auto;
}

.catalog-card {
  border: 1px solid #ccc;
  padding: 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

.catalog-card:hover {
  background: #f5f5f5;
}

.portal-card {
  max-width: 720px;
  margin: 140px auto;
  padding: 2.5rem 3rem;
  text-align: center;
  position: relative;
  z-index: 10;
}

.portal-enter {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid #ccc;
  text-decoration: none;
}

.portal-enter:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.portal {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

body.card-catalog {
  position: relative;
}

body.card-catalog .artifact-cabinet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 720px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 420px;
  z-index: 2;
}

.card-catalog-stage {
  position: relative;
  z-index: 5;
  max-width: 1100px;
  margin: 60px auto 0;
  padding: 0 2rem 3rem;
}

.directory-content {
  position: relative;
  z-index: 30;
  pointer-events: auto;
  margin: 180px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.directory-content p {
  max-width: 520px;
  margin: 12px 0;
}

.site-frame {
  max-width: 1200px;
  width: 92%;
  margin: 0 auto;
  position: relative;
}

.artifact-cabinet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 720px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 420px;
  z-index: 2;
}

.artifact-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  text-decoration: none;
  font-weight: 500;
  background: #f3f3f3;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  color: #444;
}

.artifact-tile h3 {
  text-align: center;
  margin-bottom: 8px;
}

.artifact-tile p {
  text-align: left;
  margin: 0;
  line-height: 1.45;
  font-size: 13px;
}

.catalog-intro {
  max-width: 620px;
  margin: 20px auto 30px auto;
  font-size: 16px;
  line-height: 1.6;
  color: #555;
  text-align: center;
}

.catalog-entry {
  text-align: center;
  margin-top: 20px;
}

.catalog-enter {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid #999;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  background: #f5f5f5;
  font-weight: 500;
  transition: all 0.2s ease;
}

.catalog-enter:hover {
  background: #eaeaea;
  border-color: #777;
}

.columns,
.column,
.cap,
.shaft,
.plinth,
.stairs {
  pointer-events: none;
}

.portal-inner a {
  white-space: nowrap;
}

main {
  position: relative;
  z-index: 20;
}

.portal,
.portal-inner {
  position: relative;
  z-index: 25;
}

.cornice-bar,
.columns,
.column,
.cap,
.shaft,
.plinth,
.stairs {
  pointer-events: none;
}

.portal ul {
  list-style: none;
  padding-left: 0;
}

.cabinet {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: clamp(420px, 55vw, 720px);
  margin: 40px auto;
}

.row {
  display: contents;
}

.drawer {
  border: 1px solid #bfbfbf;
  padding: 14px;
  background: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.drawer a {
  text-decoration: none;
  color: #1a2a44;
  display: block;
}

.drawer:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

.drawer span {
  display: block;
}

.symbolic {
  font-family: "Cinzel", "Times New Roman", serif;
  font-style: italic;
}

.symbolic::before { content: "("; }
.symbolic::after  { content: ")"; }

.catalog-chamber {
  text-align: center;
}

.catalog-chamber .intro {
  max-width: 600px;
  margin: 0 auto 30px auto;
}

.drawer {
  padding: 14px;
  min-height: 72px;
}

body.card-catalog .columns {
  position: relative;
}

.catalog-chamber {
  text-align: center;
  margin-top: 140px !important;
}

.back-link {
  position: relative !important;
  z-index: 9999 !important;
  pointer-events: auto !important;
  display: inline-block !important;
}

.catalog-chamber,
.catalog-chamber * {
  pointer-events: auto !important;
}

.catalog-chamber { position: relative; z-index: 10; }

.catalog-key {
  max-width: 720px;
  margin: 30px auto 40px auto;
  line-height: 1.6;
  font-size: 0.9rem;
  opacity: 0.85;
  font-style: italic;
}

.catalog-inscription {
  text-align: center;
  margin: 25px 0 35px 0;
  font-style: italic;
  opacity: 0.8;
}

.return-home {
  text-align: center;
  margin-top: 140px;
  margin-bottom: 40px;
}

.return-directory {
  display: block;
  margin-top: 60px;
  text-align: center;
}

.drawer-chamber {
  text-align: center;
  max-width: 720px;
  margin: 120px auto;
}

.drawer-return {
  margin-top: 80px;
  font-size: 14px;
}

.drawer-esoteric {
  font-style: italic;
  font-weight: 600;
  font-size: 1.05em;
}

.drawer-esoteric-label {
  font-style: italic;
  font-weight: 600;
  opacity: 0.75;
}

.drawer-chamber a {
  position: relative;
  z-index: 30;
  pointer-events: auto;
}

#artifact-list {
  list-style: none;
  padding: 0;
  position: relative;
  z-index: 30;
  pointer-events: auto;
}

#artifact-list li {
  margin-bottom: 8px;
  pointer-events: auto;
}

/* --- Row inscriptions --- */

/* --- Row labels (bilateral system) --- */

.cabinet-row-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.cabinet-row-wrap .row {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  flex: 0 0 auto;
  width: clamp(420px, 55vw, 720px);
}

/* LEFT SIDE — identity */

.row-label-left {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 140px;
  pointer-events: none;
  user-select: none;
  text-align: right;
}

.row-name {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--ink);
}

.row-arrow-right {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* RIGHT SIDE — interpretation */

.row-label-right {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 200px;
  pointer-events: none;
  user-select: none;
  text-align: left;
}

.row-arrow-left {
  font-size: 0.9rem;
  opacity: 0.7;
}

.row-descriptor {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
}.cabinet-row-wrap .row {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  flex: 0 0 auto;
  width: clamp(420px, 55vw, 720px);
  contents: unset;
}

.row-inscription {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 160px;
  padding-left: 8px;
  border-left: 1px solid rgba(42, 42, 42, 0.18);
  pointer-events: none;
  user-select: none;
}

.row-name {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: var(--ink);
  font-weight: 600;
}

.row-descriptor {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
}