:root {
  --theme-fade-duration: 0.6s;
}

html,
body {
  position: static;
  z-index: auto;
}

.theme-background-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--theme-fade-duration) ease;
}

.theme-background-root.is-active {
  opacity: 1;
}

.theme-scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--theme-fade-duration) ease;
}

.theme-scene.theme-scene--active {
  opacity: 1;
}

body.theme-blending .theme-scene,
body.theme-blending .theme-background-root {
  transition: none !important;
}

.theme-layer {
  position: absolute;
  inset: 0;
}

.theme-layer--hero {
  z-index: 0;
}

.theme-layer--foliage {
  z-index: 1;
}

.theme-layer--hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.theme-layer--foliage img.theme-foliage {
  display: block;
  width: 100%;
  height: 106%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.theme-layer--sprites {
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.cover,
.chapter-header,
.story-section,
.section-divider,
.chapter-transition {
  position: relative;
  z-index: 1;
}

.story-section {
  z-index: 2;
  isolation: isolate;
}

body[class*="theme-"] .story-section,
body[class*="theme-"] .chapter-header,
body[class*="theme-"] .section-divider,
body[class*="theme-"] .chapter-transition,
body[class*="theme-"] .cover {
  position: relative;
  z-index: 100;
  transform: translateZ(0);
  backface-visibility: hidden;
}

body.theme-blending .story-section,
body.theme-blending .chapter-header,
body.theme-blending .section-divider,
body.theme-blending .chapter-transition,
body.theme-blending .cover {
  opacity: 1 !important;
  visibility: visible !important;
}

body.theme-blending .story-section {
  will-change: transform;
}

body.theme-malaysia-active .mango-grove {
  display: none;
}

body.theme-saudi-active .mango-grove,
body.theme-blending .mango-grove {
  display: none;
}

body.theme-norway-active .mango-grove {
  display: none;
}

#transition-malaysia-saudi {
  height: 1000px;
}

#transition-saudi-norway {
  height: 1000px;
}

@media (prefers-reduced-motion: reduce) {
  .theme-background-root,
  .theme-scene {
    transition: none !important;
  }
}
