:root {
  color-scheme: dark;
  --gold: #f2d58d;
  --gold-bright: #fff0b6;
  --deep: #06141c;
  --ink: #3f2b16;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 50% 38%, rgba(250, 225, 150, 0.18), transparent 28%),
    linear-gradient(180deg, #102838 0%, #07131c 100%);
  color: #fff6d6;
  font-family:
    "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", serif;
}

a,
button {
  font: inherit;
}

.incense-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.incense-stage {
  position: relative;
  width: min(100vw, 150vh);
  min-height: min(100vh, 66.666vw);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  isolation: isolate;
  background: var(--deep);
  box-shadow:
    0 0 0 1px rgba(255, 234, 178, 0.12),
    0 28px 96px rgba(0, 0, 0, 0.5);
}

.incense-bg {
  position: absolute;
  inset: 0;
  z-index: -5;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.page-vignette,
.mist-layer,
.floating-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.page-vignette {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(4, 18, 28, 0.4) 0%, transparent 22%, transparent 70%, rgba(4, 18, 28, 0.28) 100%),
    radial-gradient(circle at 50% 54%, rgba(255, 227, 154, 0.2), transparent 32%);
}

.mist-layer {
  left: -28%;
  width: 160%;
  height: 24%;
  z-index: 1;
  opacity: 0.12;
  filter: blur(24px);
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 12% 55%, rgba(255, 255, 255, 0.46), transparent 40%),
    radial-gradient(ellipse at 38% 48%, rgba(216, 242, 255, 0.3), transparent 42%),
    radial-gradient(ellipse at 68% 52%, rgba(255, 243, 202, 0.34), transparent 44%),
    radial-gradient(ellipse at 92% 56%, rgba(255, 255, 255, 0.34), transparent 42%);
}

.mist-a {
  top: 21%;
  animation: mist-drift 86s linear infinite;
}

.mist-b {
  top: 70%;
  opacity: 0.045;
  animation: mist-drift 118s linear infinite reverse;
}

.floating-clouds {
  z-index: 13;
  overflow: hidden;
}

.floating-cloud {
  position: absolute;
  left: -34%;
  top: var(--top);
  width: var(--width);
  opacity: var(--opacity);
  filter: blur(var(--blur)) brightness(1.08);
  animation: cloud-pass var(--duration) linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}

.cloud-a {
  --top: 17%;
  --width: 38%;
  --opacity: 0.18;
  --blur: 1.3px;
  --duration: 78s;
  --delay: -20s;
}

.cloud-b {
  --top: 42%;
  --width: 46%;
  --opacity: 0.14;
  --blur: 1.8px;
  --duration: 96s;
  --delay: -58s;
}

.cloud-c {
  --top: 68%;
  --width: 34%;
  --opacity: 0.15;
  --blur: 1.5px;
  --duration: 88s;
  --delay: -10s;
}

.site-header {
  position: relative;
  z-index: 20;
  height: 8%;
  min-height: 66px;
}

.brand {
  position: absolute;
  left: 2.2%;
  top: 18%;
  width: 12.5%;
  min-width: 150px;
  line-height: 0;
}

.brand img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}

.primary-nav {
  position: absolute;
  left: 22.2%;
  top: 17%;
  width: 52%;
  display: flex;
  justify-content: space-between;
  gap: 1.2vw;
}

.utility-nav {
  position: absolute;
  right: 2.4%;
  top: 17%;
  display: flex;
  gap: 1.2vw;
}

.nav-link,
.utility-link {
  position: relative;
  color: rgba(255, 232, 174, 0.88);
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.36);
  transition:
    color 220ms ease,
    text-shadow 220ms ease;
}

.nav-link {
  padding: 0.3rem 0.18rem 0.68rem;
  font-size: clamp(0.95rem, 1.28vw, 1.28rem);
  white-space: nowrap;
}

.utility-link {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.3rem 0.1rem;
  font-size: clamp(0.82rem, 1vw, 1rem);
}

.utility-icon {
  width: 1.32em;
  height: 1.32em;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 226, 151, 0.58);
  border-radius: 999px;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.28rem;
  width: 0;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  box-shadow: 0 0 12px rgba(255, 235, 170, 0.9);
  opacity: 0;
  transition:
    width 220ms ease,
    opacity 220ms ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active,
.utility-link:hover,
.utility-link:focus-visible {
  color: #fff3c2;
  text-shadow:
    0 0 10px rgba(255, 229, 158, 0.76),
    0 2px 12px rgba(0, 0, 0, 0.42);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  width: 86%;
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.memorial-photo-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: max(100%, 150vh);
  aspect-ratio: 3 / 2;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.memorial-photo-slot {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 25.6%;
  width: 16%;
  height: 39.7%;
  margin: 0;
  overflow: hidden;
  border-radius: 2px;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 260ms ease;
}

.memorial-frame-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
}

.memorial-photo-slot.has-photo {
  opacity: 1;
  background: linear-gradient(180deg, #f5ebd4, #eadbbd);
  box-shadow:
    inset 0 0 26px rgba(255, 240, 194, 0.26),
    inset 0 0 0 1px rgba(255, 225, 149, 0.18);
}

.memorial-photo {
  position: relative;
  z-index: 1;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  filter: sepia(0.08) saturate(0.92) brightness(1.03);
  user-select: none;
}

.memorial-photo-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  opacity: 1;
  filter: sepia(0.08) saturate(0.92) brightness(1.03);
  user-select: none;
}

.memorial-photo-slot.has-photo .memorial-photo,
.memorial-photo-slot.has-photo .memorial-photo-fill {
  display: block;
}

.memorial-photo-slot.has-extended-photo .memorial-photo {
  opacity: 0;
}

.memorial-photo-slot::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 56%, rgba(255, 223, 151, 0.1) 100%),
    linear-gradient(180deg, rgba(255, 247, 221, 0.04), rgba(78, 42, 14, 0.04));
  pointer-events: none;
}

.memorial-photo-slot.has-photo::after {
  opacity: 1;
}

.incense-visual {
  position: absolute;
  left: 49.65%;
  top: 56.1%;
  z-index: 8;
  width: 7.7%;
  height: 17.4%;
  transform: translateX(-50%);
  pointer-events: none;
}

.incense-stick-window {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 1;
  width: 78%;
  height: 94%;
  overflow: hidden;
  transform: translateX(-50%);
}

.incense-sticks {
  position: absolute;
  left: 50%;
  bottom: -16%;
  width: auto;
  height: 118%;
  max-width: none;
  opacity: 0;
  transform: translateX(-50%) translateY(10px) scale(0.96);
  filter:
    drop-shadow(0 6px 7px rgba(27, 8, 2, 0.42))
    drop-shadow(0 0 7px rgba(255, 173, 86, 0.18));
  transition:
    opacity 380ms ease,
    transform 520ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.incense-burner-cover {
  position: absolute;
  inset: 0;
  z-index: 9;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: inset(70.2% 38.6% 19.1% 38.6%);
  pointer-events: none;
  user-select: none;
}

.altar-candles {
  position: absolute;
  left: 49.65%;
  top: 63.6%;
  z-index: 10;
  width: 28%;
  height: 13.2%;
  transform: translateX(-50%);
  pointer-events: none;
}

.altar-candle {
  position: absolute;
  bottom: 0;
  width: 16%;
  height: 100%;
}

.candle-left {
  left: 13%;
}

.candle-right {
  right: 13%;
}

.candle-image,
.candle-flame {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.candle-image {
  bottom: 0;
  width: auto;
  height: 100%;
  max-width: none;
  opacity: 0.94;
  filter: drop-shadow(0 7px 9px rgba(20, 8, 3, 0.42));
  user-select: none;
}

.candle-flame {
  bottom: 95%;
  z-index: 2;
  width: 15px;
  height: 23px;
  border-radius: 68% 68% 72% 72% / 86% 86% 46% 46%;
  opacity: 0;
  transform: translateX(-50%) scale(0.58);
  transform-origin: 50% 84%;
  background:
    radial-gradient(circle at 50% 66%, #fff8d4 0 16%, transparent 18%),
    radial-gradient(ellipse at 50% 44%, #fff1a5 0 22%, #ff9d42 54%, #b84819 80%, transparent 82%);
  filter: drop-shadow(0 0 10px rgba(255, 169, 67, 0.72));
  transition:
    opacity 260ms ease,
    transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.candle-flame::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 187, 82, 0.34), transparent 68%);
}

.incense-stage.is-lit .candle-flame {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  animation: candle-flicker 1.55s ease-in-out infinite alternate;
}

.incense-stage.is-lit .candle-right .candle-flame {
  animation-delay: -0.35s;
}

.incense-smoke {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: 96%;
  z-index: 2;
  width: 36px;
  height: 104px;
  opacity: 0;
  transform: translateX(-50%) translateY(6px) scale(0.48);
  transform-origin: 50% 100%;
  filter: blur(0.6px);
}

.incense-smoke::before,
.incense-smoke::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border-left: 2px solid rgba(255, 246, 214, 0.58);
  border-top: 1px solid rgba(255, 246, 214, 0.12);
  transform: rotate(18deg);
}

.incense-smoke::after {
  inset: 12px 6px 0 8px;
  border-left-color: rgba(255, 255, 255, 0.34);
  transform: rotate(-22deg);
}

.smoke-a {
  margin-left: -24px;
}

.smoke-b {
  margin-left: -7px;
  width: 42px;
  height: 108px;
}

.smoke-c {
  margin-left: 13px;
  width: 34px;
  height: 92px;
}

.smoke-d {
  margin-left: -32px;
  width: 30px;
  height: 84px;
}

.smoke-e {
  margin-left: 26px;
  width: 38px;
  height: 104px;
}

.smoke-f {
  margin-left: 2px;
  width: 28px;
  height: 82px;
}

.incense-stage.is-lit .incense-sticks {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.incense-stage.is-lit .smoke-a {
  animation: incense-smoke 6.2s ease-in-out infinite;
}

.incense-stage.is-lit .smoke-b {
  animation: incense-smoke 7.4s ease-in-out 0.55s infinite;
}

.incense-stage.is-lit .smoke-c {
  animation: incense-smoke 6.8s ease-in-out 1s infinite;
}

.incense-stage.is-lit .smoke-d {
  animation: incense-smoke 8.2s ease-in-out 1.35s infinite;
}

.incense-stage.is-lit .smoke-e {
  animation: incense-smoke 7.8s ease-in-out 1.8s infinite;
}

.incense-stage.is-lit .smoke-f {
  animation: incense-smoke 5.8s ease-in-out 0.25s infinite;
}

.ritual-panel {
  position: absolute;
  z-index: 14;
  left: 50%;
  bottom: 7.4%;
  transform: translateX(-50%);
  text-align: center;
}

.light-button {
  border: 1px solid rgba(196, 135, 42, 0.5);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.light-button {
  min-width: 164px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px;
  color: #533511;
  background: linear-gradient(180deg, #fff5c8, #e4b552);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 0 18px rgba(255, 218, 120, 0.45);
}

.light-button:hover,
.light-button:focus-visible,
.light-button.is-lit {
  transform: translateY(-2px);
  border-color: rgba(255, 232, 158, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 0 26px rgba(255, 225, 137, 0.78);
}

.flame {
  width: 0.82em;
  height: 1.18em;
  border-radius: 70% 70% 70% 70% / 88% 88% 45% 45%;
  background:
    radial-gradient(circle at 48% 62%, #fff8c9 0 20%, transparent 22%),
    linear-gradient(180deg, #fff0a8, #e36e28 70%, #a84418);
  box-shadow: 0 0 13px rgba(255, 156, 70, 0.72);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 2.2%;
  z-index: 40;
  min-width: 240px;
  margin: 0;
  padding: 0.64rem 1rem;
  border: 1px solid rgba(255, 226, 151, 0.45);
  border-radius: 999px;
  color: #fff4c4;
  text-align: center;
  background: rgba(18, 37, 44, 0.72);
  box-shadow: 0 0 20px rgba(255, 222, 126, 0.25);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ritual-glow {
  position: absolute;
  left: 50%;
  top: 69.6%;
  z-index: 5;
  width: 18%;
  aspect-ratio: 1;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle, rgba(255, 246, 198, 0.56), rgba(255, 185, 78, 0.18) 36%, transparent 68%);
  mix-blend-mode: screen;
  animation: ritual-glow 1200ms ease-out forwards;
  pointer-events: none;
}

@keyframes mist-drift {
  from {
    transform: translate3d(-6%, 0, 0);
  }

  to {
    transform: translate3d(6%, 0, 0);
  }
}

@keyframes cloud-pass {
  from {
    transform: translate3d(-5vw, 0, 0);
  }

  to {
    transform: translate3d(150vw, 0, 0);
  }
}

@keyframes ritual-glow {
  from {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.58);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.25);
  }
}

@keyframes candle-flicker {
  0% {
    transform: translateX(-50%) scale(0.94) rotate(-1.6deg);
    filter: drop-shadow(0 0 8px rgba(255, 166, 58, 0.64));
  }

  50% {
    transform: translateX(-50%) scale(1.05) rotate(1.4deg);
    filter: drop-shadow(0 0 14px rgba(255, 196, 91, 0.82));
  }

  100% {
    transform: translateX(-50%) scale(0.98) rotate(-0.6deg);
    filter: drop-shadow(0 0 11px rgba(255, 176, 67, 0.72));
  }
}

@keyframes incense-smoke {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(6px) translateX(0) scale(0.48);
  }

  16% {
    opacity: 0.7;
  }

  62% {
    opacity: 0.42;
    transform: translateX(-50%) translateY(-36px) translateX(10px) scale(0.88);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-86px) translateX(-8px) scale(1.12);
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .incense-page {
    display: block;
  }

  .incense-stage {
    width: 100%;
    min-height: 100vh;
    aspect-ratio: auto;
    overflow: visible;
  }

  .site-header {
    height: auto;
    min-height: 0;
    padding: 0.85rem 1rem 0;
  }

  .brand,
  .primary-nav,
  .utility-nav {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
  }

  .brand {
    display: block;
    width: 170px;
    min-width: 0;
    margin-bottom: 0.7rem;
  }

  .primary-nav,
  .utility-nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .utility-nav {
    margin-top: 0.35rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .incense-stage.is-lit .incense-smoke {
    animation: none !important;
    opacity: 0.34;
    transform: translateX(-50%) translateY(-22px) scale(0.9);
  }

  .incense-stage.is-lit .candle-flame {
    animation: none !important;
  }
}
