/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sand:       #e8d5a3;
  --parchment:  #f5e6c8;
  --paper-dark: #ede0c0;
  --espresso:   #2c1a0e;
  --leather:    #8b5e3c;
  --gold:       #c4933f;
  --gold-dark:  #9a6e22;
  --ink:        #3a2010;
}

html, body {
  height: 100%;
  font-family: 'EB Garamond', Georgia, serif;
  color: var(--espresso);
  background-color: var(--sand);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Parchment texture overlay ────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent, transparent 3px,
      rgba(139, 94, 60, 0.025) 3px, rgba(139, 94, 60, 0.025) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent, transparent 7px,
      rgba(196, 147, 63, 0.015) 7px, rgba(196, 147, 63, 0.015) 8px
    );
}

/* ── Header ───────────────────────────────────────────────── */
#site-header {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  background: linear-gradient(180deg, #d4b06a 0%, #c9a455 20%, var(--sand) 100%);
  border-bottom: 1px solid var(--leather);
  text-align: center;
  padding: 10px 20px 8px;
  box-shadow: 0 2px 12px rgba(44, 26, 14, 0.18);
}

#site-header h1 {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: clamp(1.1rem, 2.8vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-shadow: 1px 1px 2px rgba(196, 147, 63, 0.4);
  line-height: 1.2;
}

.header-subtitle {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: clamp(0.75rem, 1.6vw, 0.9rem);
  color: var(--leather);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.header-ornament {
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 0.15em;
  line-height: 1;
  margin: 3px 0;
  user-select: none;
}

/* ── Filter / Nav Bar ─────────────────────────────────────── */
#filter-bar {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px;
  background: linear-gradient(180deg, var(--sand) 0%, var(--paper-dark) 100%);
  border-bottom: 2px solid var(--leather);
  box-shadow: 0 1px 6px rgba(44, 26, 14, 0.12);
}

.filter-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  padding: 4px 11px;
  cursor: pointer;
  border: 1px solid var(--leather);
  background: var(--parchment);
  color: var(--espresso);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
  outline: none;
}

.filter-btn:hover:not(.active) {
  background: var(--paper-dark);
  border-color: var(--gold);
}

.filter-btn.active {
  background: var(--espresso);
  color: var(--parchment);
  border-color: var(--gold);
}

/* ── Tabernacle Container ─────────────────────────────────── */
#tabernacle-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px 45vh;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--leather) var(--sand);
}

#tabernacle-container::-webkit-scrollbar { width: 5px; }
#tabernacle-container::-webkit-scrollbar-track { background: var(--sand); }
#tabernacle-container::-webkit-scrollbar-thumb { background: var(--leather); }

#tabernacle-floor {
  max-width: 900px;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 18px rgba(44, 26, 14, 0.22));
}

/* ── SVG Interactivity ────────────────────────────────────── */
.statue-section {
  cursor: pointer;
  transition: filter 0.15s ease;
  outline: none;
}

.statue-section:hover {
  filter: brightness(1.2) drop-shadow(0 0 5px rgba(196, 147, 63, 0.4));
}

.statue-section.active {
  filter: brightness(1.28) drop-shadow(0 0 10px rgba(196, 147, 63, 0.7));
}

/* Labels are not interactive */
.statue-label { pointer-events: none; }

/* Dimension annotations — non-interactive, hidden on mobile */
.dim-label { pointer-events: none; }

/* ── Info Panel ───────────────────────────────────────────── */
#info-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: linear-gradient(180deg, #f8ecd5 0%, var(--parchment) 30%, var(--paper-dark) 100%);
  border-top: 3px double var(--leather);
  box-shadow: 0 -5px 25px rgba(44, 26, 14, 0.28);
  padding: 14px 22px 16px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
  max-height: 55vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--leather) var(--sand);
}

#info-panel.open { transform: translateY(0); }

#info-panel::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(196, 147, 63, 0.3);
  pointer-events: none;
  z-index: 0;
}

#panel-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: 1px solid var(--leather);
  color: var(--leather);
  font-size: 0.9rem;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 10;
  font-family: 'Cinzel', serif;
}

#panel-close:hover {
  background: var(--espresso);
  color: var(--parchment);
  border-color: var(--gold);
}

#panel-material {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--leather);
  margin-bottom: 5px;
  position: relative;
  z-index: 1;
}

#panel-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding-right: 36px;
  position: relative;
  z-index: 1;
}

.phase-badge {
  flex-shrink: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  text-transform: uppercase;
  margin-top: 5px;
  white-space: nowrap;
  border: 1px solid transparent;
}

#panel-name {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: 0.04em;
}

#panel-date {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: clamp(0.8rem, 1.6vw, 0.92rem);
  color: var(--gold-dark);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

#panel-date::before {
  content: '✦ ';
  font-style: normal;
  font-size: 0.75em;
  opacity: 0.8;
}

#panel-summary {
  font-size: clamp(0.85rem, 1.8vw, 0.98rem);
  line-height: 1.6;
  color: var(--espresso);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

#panel-summary::after {
  content: '✦ · · · ✦';
  display: block;
  text-align: center;
  color: var(--gold);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  margin-top: 10px;
}

.panel-section {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}

.panel-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--leather);
  margin-bottom: 5px;
}

#panel-scriptures {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.scripture-link {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  background: var(--espresso);
  color: var(--parchment);
  text-decoration: none;
  border: 1px solid var(--gold);
  transition: background 0.15s, color 0.15s;
}

.scripture-link:hover {
  background: var(--leather);
  color: #fff;
}

.article-btn {
  display: inline-block;
  position: relative;
  z-index: 1;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 7px 18px;
  background: linear-gradient(135deg, var(--leather) 0%, #6b3a1f 100%);
  color: var(--parchment);
  text-decoration: none;
  border: 1px solid var(--gold);
  margin-top: 8px;
  transition: box-shadow 0.2s, filter 0.2s;
}

.article-btn:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 10px rgba(44, 26, 14, 0.35);
}

#panel-wt-btn { margin-left: 6px; }

.panel-attribution {
  position: relative;
  z-index: 1;
  font-size: 0.65rem;
  font-style: italic;
  color: var(--leather);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(139, 94, 60, 0.3);
}

.panel-attribution a { color: var(--gold-dark); text-decoration: none; }
.panel-attribution a:hover { text-decoration: underline; }

/* ── Info Panel Scrollbar ─────────────────────────────────── */
#info-panel::-webkit-scrollbar { width: 5px; }
#info-panel::-webkit-scrollbar-track { background: var(--sand); }
#info-panel::-webkit-scrollbar-thumb { background: var(--leather); }

/* ── Footer ───────────────────────────────────────────────── */
#site-footer {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--paper-dark) 0%, #d4b882 100%);
  border-top: 1px solid var(--leather);
  padding: 5px 16px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--leather);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#site-footer a { color: var(--gold-dark); text-decoration: none; }
#site-footer a:hover { text-decoration: underline; }
.footer-sep { color: var(--gold); margin: 0 2px; }

/* ── Security Gate ────────────────────────────────────────── */
#security-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(180deg, #f0ddb0 0%, #e8d5a3 60%, #dfc898 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.5s ease;
}

#security-gate.gate-fade { opacity: 0; }

#gate-card {
  background: linear-gradient(180deg, #f8ecd5 0%, var(--parchment) 40%, var(--paper-dark) 100%);
  border: 2px solid var(--leather);
  box-shadow:
    0 0 0 1px rgba(196, 147, 63, 0.35),
    0 8px 40px rgba(44, 26, 14, 0.35);
  padding: 36px 44px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
}

#gate-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(196, 147, 63, 0.3);
  pointer-events: none;
}

.gate-ornament { font-size: 0.55rem; margin: 0 0 14px; }

#gate-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-shadow: 1px 1px 2px rgba(196, 147, 63, 0.4);
  line-height: 1.3;
  margin-bottom: 6px;
}

#gate-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--leather);
  margin-bottom: 10px;
}

.gate-divider {
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 0.2em;
  margin: 12px 0;
  user-select: none;
}

#gate-prompt {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--espresso);
  margin-bottom: 14px;
}

#gate-input {
  display: block;
  width: 100%;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 0.25em;
  text-align: center;
  padding: 9px 14px;
  background: var(--parchment);
  border: 1px solid var(--leather);
  color: var(--ink);
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#gate-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(196, 147, 63, 0.2);
}

#gate-submit {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 32px;
  background: var(--espresso);
  color: var(--parchment);
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  margin-bottom: 12px;
}

#gate-submit:hover {
  background: var(--leather);
  box-shadow: 0 2px 10px rgba(44, 26, 14, 0.3);
}

#gate-error {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 0.9rem;
  color: #8b1a1a;
  min-height: 1.2em;
  margin-top: 4px;
}

/* ── Mobile Legend ────────────────────────────────────────── */
#statue-legend {
  display: none;
  width: 100%;
  max-width: 480px;
  margin-top: 14px;
  border: 1px solid var(--leather);
  background: linear-gradient(180deg, #f8ecd5 0%, var(--parchment) 100%);
  box-shadow: 0 2px 10px rgba(44, 26, 14, 0.14);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(139, 94, 60, 0.2);
  cursor: pointer;
  transition: background 0.15s;
}

.legend-row:last-child { border-bottom: none; }

.legend-row:active,
.legend-row:hover { background: rgba(196, 147, 63, 0.1); }

.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

.legend-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.legend-material {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legend-zone {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--espresso);
  line-height: 1.2;
}

.legend-date {
  font-family: 'EB Garamond', serif;
  font-size: 0.75rem;
  color: var(--gold-dark);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  #site-header { padding: 7px 12px 6px; }
  #filter-bar { gap: 3px; padding: 4px 8px; }
  .filter-btn { font-size: 0.55rem; padding: 3px 7px; }
  #info-panel { padding: 12px 14px 14px; max-height: 65vh; }
  #panel-header { flex-direction: column; gap: 4px; }
  .phase-badge { margin-top: 0; }
  #tabernacle-container {
    padding: 16px 8px 60vh;
    flex-direction: column;
    align-items: center;
  }
  .statue-label { display: none; }
  .dim-label    { display: none; }
  #statue-legend { display: block; }
}

@media (max-width: 480px) {
  #gate-card { padding: 24px 20px 22px; }
}
