/* ============================================
   THE DOORS OF THE RELIQUARY
   Shut when the page opens; scrolling down swings them wide on the Reliquary itself,
   and scrolling up at the very top shuts them again (see doors.js).
   The doors are cropped on purpose: the picture is wider and taller than the screen,
   so neither the top nor the bottom of the doors is ever seen.
   ============================================ */

.gate {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  /* above the page, the knight and the sparkles; the cursor stays on top of it all */
  z-index: 99990;
}

.gate.is-open {
  display: none;
}

.doors {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}

.door {
  width: 50.2%; /* slight overlap so no seam shows when closed */
  height: 100%;
  object-fit: cover;
  will-change: transform;
  backface-visibility: hidden;
}

.door-left {
  object-position: right center;
}

.door-right {
  object-position: left center;
}

.invitation {
  position: absolute;
  left: 50%;
  bottom: clamp(2rem, 8vh, 5rem);
  transform: translateX(-50%);
  width: min(90vw, 480px);
  padding: 1.35rem 1.75rem 1.1rem;
  text-align: center;
  /* a bronze plaque on the door, so the words stay readable over the gold */
  background: linear-gradient(180deg, rgba(26, 15, 5, 0.93) 0%, rgba(13, 7, 5, 0.95) 100%);
  border: 2px solid var(--gold-dark, #8b6914);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.invitation::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(201, 162, 39, 0.5);
  pointer-events: none;
}

.invitation-title {
  font-family: var(--font-display, 'Cinzel Decorative', serif);
  font-size: clamp(0.85rem, 2.2vw, 1.25rem);
  color: var(--gold, #c9a227);
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.9);
  margin-bottom: 0.5rem;
}

.invitation-text {
  font-family: var(--font-heading, 'Cinzel', serif);
  font-size: clamp(0.7rem, 1.6vw, 0.9rem);
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--parchment, #f4e4bc);
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.9);
}

.invitation-arrow {
  width: 14px;
  height: 14px;
  margin: 0.9rem auto 0.6rem;
  border-right: 2px solid var(--gold, #c9a227);
  border-bottom: 2px solid var(--gold, #c9a227);
  transform: rotate(45deg);
  animation: nudgeDown 2s ease-in-out infinite;
}

@keyframes nudgeDown {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.6; }
  50%      { transform: rotate(45deg) translate(5px, 5px); opacity: 1; }
}

.invitation-hint {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--parchment-dark, #d4c4a0);
  opacity: 0.75;
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.9);
}

/* While the doors are shut the page behind must not rubber-band or pull to refresh */
html.gate-closed,
html.gate-closed body {
  overscroll-behavior: none;
}

/* A visitor already at the very top can still pull the doors shut: no pull-to-refresh in the way */
html {
  overscroll-behavior-y: contain;
}

@media (max-width: 760px) {
  .invitation { bottom: 1.5rem; }
  .invitation-hint { display: none; }
}

@media (max-height: 560px) {
  .invitation { bottom: 0.5rem; padding: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .invitation-arrow { animation: none; }
}
