:root {
  --bg: #091511;
  --duration-zoom: 1600ms;
  --duration-gate: 2200ms;
  --ease-gate: cubic-bezier(0.2, 0.75, 0.08, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
}

body {
  font-family: Georgia, serif;
  overflow: hidden;
}

.page,
.gate-hero,
.burial-details {
  height: 100vh;
}

.page {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.gate-hero {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  isolation: isolate;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 500ms ease,
    visibility 500ms ease;
  background:
    radial-gradient(circle at center, rgba(247, 230, 169, 0.08), transparent 22%),
    linear-gradient(180deg, #13251f 0%, #08120f 100%);
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(4, 10, 8, 0.34), rgba(4, 10, 8, 0.54)),
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.scene-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-ripple-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 12, 10, 0.14) 0%, rgba(6, 12, 10, 0.26) 34%, rgba(6, 12, 10, 0.44) 68%, rgba(6, 12, 10, 0.62) 100%);
  filter: blur(6px);
}

.bg-ripple-overlay::before {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  top: 54%;
  bottom: -18%;
  background:
    radial-gradient(18% 26% at 12% 22%, rgba(6, 12, 10, 0.9) 0 56%, transparent 62%),
    radial-gradient(16% 24% at 30% 18%, rgba(6, 12, 10, 0.88) 0 54%, transparent 60%),
    radial-gradient(19% 28% at 50% 24%, rgba(6, 12, 10, 0.92) 0 57%, transparent 63%),
    radial-gradient(17% 23% at 70% 17%, rgba(6, 12, 10, 0.88) 0 54%, transparent 60%),
    radial-gradient(18% 26% at 88% 22%, rgba(6, 12, 10, 0.9) 0 56%, transparent 62%),
    linear-gradient(180deg, rgba(6, 12, 10, 0.95) 0%, rgba(6, 12, 10, 0.78) 18%, rgba(6, 12, 10, 0.38) 42%, rgba(6, 12, 10, 0.08) 70%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: 0;
  transform: translateY(100%);
  filter: blur(14px);
  will-change: transform, opacity;
}

.gate-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  perspective: 2200px;
  perspective-origin: center center;
  transform: scale(0.56);
  transform-origin: center center;
  opacity: 0;
  transition:
    transform var(--duration-zoom) ease,
    opacity 700ms ease;
}

.memorial-writeup {
  position: absolute;
  left: 11%;
  top: 45%;
  z-index: 2;
  width: min(34%, 460px);
  color: #f5ebcb;
  text-align: center;
  opacity: 0;
  transform: translateY(-50%) translateX(-42px);
  transition:
    opacity 900ms ease,
    transform 1200ms cubic-bezier(0.2, 0.75, 0.08, 1);
}

.hero-bio-modal {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 360ms ease,
    visibility 360ms ease;
}

.hero-bio-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
}

.hero-bio-card {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  max-height: min(100%, calc(100vh - 4rem));
  padding: 1.5rem 1.4rem;
  border: 1px solid rgba(245, 235, 203, 0.18);
  border-radius: 24px;
  background: rgba(7, 12, 10, 0.76);
  backdrop-filter: blur(14px);
  color: #f5ebcb;
  overflow-y: auto;
  opacity: 0;
  transform: scale(0.86);
  transform-origin: center center;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.34);
  transition:
    opacity 420ms ease,
    transform 520ms cubic-bezier(0.2, 0.75, 0.08, 1);
}

.hero-bio-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-bottom: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(245, 235, 203, 0.24);
  border-radius: 999px;
  background: transparent;
  color: #f5ebcb;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.hero-bio-copy {
  margin: 0.95rem 0 0;
  font-size: 1rem;
  line-height: 1.75;
  text-align: center;
  color: rgba(245, 235, 203, 0.9);
}

.hero-bio-copy:first-of-type {
  margin-top: 0;
}

.writeup-eyebrow {
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(245, 235, 203, 0.7);
}

.writeup-name {
  margin: 0;
  font-size: clamp(2.2rem, 3.5vw, 4.2rem);
  line-height: 0.92;
  font-weight: 600;
}

.abbv {
  margin: 0.35rem 0 0;
  font-style: italic;
  font-weight: 700;
  color: #f5ebcb;
}

.bdate{
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: rgba(245, 235, 203, 0.78);
}

.writeup-copy {
  margin: 1rem auto 0;
  max-width: 28rem;
  font-size: clamp(1rem, 1.3vw, 1.22rem);
  line-height: 1.6;
  color: rgba(245, 235, 203, 0.86);
  text-align: center;
}

.writeup-role {
  display: inline-block;
  min-width: 12ch;
  color: #f8b201;
  font-weight: 700;
  transition:
    opacity 280ms ease,
    transform 280ms ease;
}

.writeup-role.is-changing {
  opacity: 0;
  transform: translateY(0.2em);
}

.writeup-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  padding: 0.9rem 1.5rem;
  border: 1px solid rgba(245, 235, 203, 0.34);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(245, 235, 203, 0.18), rgba(245, 235, 203, 0.08));
  color: #f5ebcb;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transition:
    transform 220ms ease,
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.writeup-cta:hover,
.writeup-cta:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(245, 235, 203, 0.5);
  background: linear-gradient(180deg, rgba(245, 235, 203, 0.24), rgba(245, 235, 203, 0.12));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

.writeup-cta:focus-visible {
  outline: 2px solid rgba(245, 235, 203, 0.4);
  outline-offset: 4px;
}

.burial-details {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(24px);
  transition:
    opacity 500ms ease,
    transform 600ms cubic-bezier(0.2, 0.75, 0.08, 1),
    visibility 500ms ease;
  background: #050807;
}

.details-video,
.details-overlay {
  position: absolute;
  inset: 0;
}

.details-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-overlay {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.6)),
    rgba(0, 0, 0, 0.28);
}

.details-content {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  max-height: calc(100vh - 4rem);
  padding: 2rem;
  border: 1px solid rgba(245, 235, 203, 0.16);
  border-radius: 28px;
  background: rgba(7, 12, 10, 0.34);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  text-align: center;
  color: #f5ebcb;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.3);
}

.details-eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(245, 235, 203, 0.74);
}

.details-title {
  margin: 0;
  font-size: clamp(2.2rem, 4.5vw, 4.4rem);
  line-height: 0.95;
  font-weight: 600;
}

.details-copy {
  margin: 1.2rem auto 0;
  max-width: 38rem;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.7;
  color: rgba(245, 235, 203, 0.86);
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  justify-items: center;
}

.details-card {
  width: min(100%, 620px);
  padding: 1.1rem 1rem;
  border: 1px solid rgba(245, 235, 203, 0.14);
  border-radius: 18px;
  background: rgba(245, 235, 203, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  text-align: center;
}

.details-label,
.details-meta,
.details-note {
  margin: 0;
}

.details-label {
  margin-bottom: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: rgba(245, 235, 203, 0.68);
}

.details-meta {
  font-size: 1rem;
  line-height: 1.5;
  color: #f5ebcb;
}

.details-note {
  margin-top: 0.8rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(245, 235, 203, 0.78);
}

.details-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  padding: 0.9rem 1.4rem;
  border: 1px solid rgba(245, 235, 203, 0.24);
  border-radius: 999px;
  background: rgba(245, 235, 203, 0.08);
  color: #f5ebcb;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.8;
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease;
}

.details-back:hover,
.details-back:focus-visible {
  opacity: 1;
  transform: translateY(-2px);
  border-color: rgba(245, 235, 203, 0.42);
  background: rgba(245, 235, 203, 0.12);
}

.details-actions,
.map-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.details-actions .details-back,
.map-modal-actions .details-back {
  margin-top: 0;
}

.details-back-secondary {
  background: transparent;
}

.map-modal {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 300ms ease,
    visibility 300ms ease;
}

.map-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 6, 0.46);
  backdrop-filter: blur(10px);
}

.map-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 820px);
  max-height: min(100%, calc(100vh - 4rem));
  padding: 1.5rem;
  border: 1px solid rgba(245, 235, 203, 0.18);
  border-radius: 28px;
  background: rgba(7, 12, 10, 0.62);
  backdrop-filter: blur(16px);
  color: #f5ebcb;
  overflow-y: auto;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.35);
}

.map-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(245, 235, 203, 0.24);
  border-radius: 999px;
  background: transparent;
  color: #f5ebcb;
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.map-modal-title {
  margin: 0.2rem 0 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.1;
  text-align: center;
}

.map-modal-copy {
  margin: 1rem auto 0;
  max-width: 34rem;
  text-align: center;
  line-height: 1.6;
  color: rgba(245, 235, 203, 0.84);
}

.details-map {
  display: block;
  width: 100%;
  height: min(52vh, 420px);
  margin-top: 1.4rem;
  border: 0;
  border-radius: 20px;
  object-fit: contain;
  background: rgba(245, 235, 203, 0.05);
}

body.show-map .map-modal {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.show-hero-bio .hero-bio-modal {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.show-hero-bio .hero-bio-card {
  opacity: 1;
  transform: scale(1);
}

body.show-map .details-content {
  pointer-events: none;
}

body.view-details .gate-hero {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.view-details .burial-details {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.memorial-portrait {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: min(30%, 420px);
  transform: translateX(-50%) scale(0.84);
  transform-origin: center bottom;
  opacity: 0;
  z-index: 1;
  object-fit: contain;
  filter: drop-shadow(0 22px 32px rgba(0, 0, 0, 0.28));
  transition:
    opacity 900ms ease,
    transform 1200ms ease;
}

.memorial-portrait.is-fading {
  opacity: 0;
}

.portrait-clouds {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: min(42%, 560px);
  height: 34%;
  transform: translateX(-50%) scale(0.88);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  filter: blur(14px);
  background:
    radial-gradient(circle at 18% 62%, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 26%),
    radial-gradient(circle at 38% 50%, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 54% 64%, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0) 28%),
    radial-gradient(circle at 72% 48%, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 86% 62%, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 26%);
  transition:
    opacity 900ms ease,
    transform 1800ms ease;
}

.top-arch {
  position: absolute;
  top: 0;
  left: 50%;
  width: 58%;
  max-width: 920px;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  transition: transform 1900ms var(--ease-gate), opacity 1400ms ease;
}

.gate {
  position: absolute;
  top: 0;
  height: 100%;
  width: auto;
  max-width: none;
  z-index: 2;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: transform var(--duration-gate) var(--ease-gate);
  will-change: transform;
}

.gate-left {
  left: 0;
  transform-origin: 6% 52%;
}

.gate-right {
  right: 0;
  transform-origin: 94% 52%;
}

body.is-ready .gate-stage {
  transform: scale(1);
  opacity: 1;
}

body.gates-open .gate-left {
  transform: rotateY(-108deg) translateX(-28%) translateY(1.5%);
}

body.gates-open .gate-right {
  transform: rotateY(108deg) translateX(28%) translateY(1.5%);
}

body.gates-open .top-arch {
  transform: translateX(-50%) translateY(-32%) scale(0.88);
  opacity: 0;
}

body.show-portrait .memorial-portrait {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

body.show-portrait .portrait-clouds {
  opacity: 0.9;
  transform: translateX(-50%) scale(1) translateY(-2%);
  animation: portrait-cloud-drift 5s ease-in-out infinite alternate;
}

body.show-overlay .bg-ripple-overlay {
  animation: flood-settle 1600ms cubic-bezier(0.18, 0.8, 0.2, 1) forwards;
}

body.show-overlay .bg-ripple-overlay::before {
  animation: flood-crest-travel 1600ms cubic-bezier(0.18, 0.8, 0.2, 1) forwards;
}

body.show-writeup .memorial-portrait {
  transform: translateX(62%) translateY(-16%) scale(0.96);
}

body.show-writeup .portrait-clouds {
  transform: translateX(42%) translateY(-16%) scale(0.98);
}

body.show-writeup .memorial-writeup {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 900px) {
  .scene {
    inset: 0;
  }

  .top-arch {
    width: 92%;
  }

  .memorial-writeup {
    left: 50%;
    top: 7%;
    width: min(84%, 420px);
    padding: 1rem 1.1rem 1.2rem;
    border: 1px solid rgba(245, 235, 203, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(8, 18, 15, 0.78), rgba(8, 18, 15, 0.52));
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
    text-align: center;
    transform: translateX(-50%) translateY(-12px);
  }

  .writeup-eyebrow,
  .writeup-name,
  .writeup-copy,
  .writeup-cta {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  }

  .writeup-cta {
    width: 100%;
  }

  .writeup-cta {
    margin-top: 1.1rem;
  }

  .burial-details {
    padding: 1.25rem;
  }

  .details-content {
    padding: 1.5rem 1.2rem;
    border-radius: 20px;
  }

  .hero-bio-modal {
    padding: 1rem;
  }

  .hero-bio-card {
    padding: 1.2rem 1rem;
    border-radius: 20px;
  }

  .map-modal {
    padding: 1rem;
  }

  .map-modal-panel {
    padding: 1.2rem;
    border-radius: 22px;
  }

  .details-map {
    height: 300px;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .memorial-portrait {
    left: 50%;
    width: min(64%, 340px);
    bottom: 18%;
    transform: translateX(-50%) scale(0.84);
  }

  .portrait-clouds {
    left: 50%;
    width: min(82%, 420px);
    height: 26%;
    bottom: 12%;
    transform: translateX(-50%) scale(0.88);
  }

  .gate-left {
    left: -14%;
  }

  .gate-right {
    right: -14%;
  }

  body.show-portrait .memorial-portrait {
    transform: translateX(-50%) scale(1);
  }

  body.show-portrait .portrait-clouds {
    transform: translateX(-50%) scale(1) translateY(-2%);
  }

  body.show-writeup .memorial-portrait {
    transform: translateX(-50%) translateY(16%) scale(0.94);
  }

  body.show-writeup .portrait-clouds {
    transform: translateX(-50%) translateY(12%) scale(0.96);
  }

  body.show-writeup .memorial-writeup {
    transform: translateX(-50%) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene,
  .gate,
  .gate-stage,
  .top-arch {
    transition: none;
  }

  body.is-ready .gate-stage {
    opacity: 1;
    transform: none;
  }

  body.show-portrait .portrait-clouds {
    animation: none;
  }
}

@keyframes flood-settle {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 0.58;
  }
  100% {
    opacity: 1;
  }
}

@keyframes flood-crest-travel {
  0% {
    opacity: 0;
    transform: translateY(100%);
  }
  18% {
    opacity: 0.95;
  }
  68% {
    opacity: 1;
    transform: translateY(12%);
  }
  88% {
    opacity: 0.36;
    transform: translateY(-34%);
  }
  100% {
    opacity: 0;
    transform: translateY(-72%);
  }
}

@keyframes portrait-cloud-drift {
  from {
    transform: translateX(-50%) scale(1) translateY(-2%);
  }
  to {
    transform: translateX(-50%) scale(1.05) translateY(3%);
  }
}
