:root {
  --bg: #05060a;
  --panel: rgba(12, 14, 20, 0.72);
  --panel-stroke: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #ffffff;
  --accent: #7af0c2;
  --accent-2: #6b7bff;
  --glow: 0 20px 60px rgba(122, 240, 194, 0.18);
  --radius-lg: 24px;
  --radius-sm: 12px;
  --grid-gap: 20px;
  --blur: 14px;
  --nebula-hue: 0deg;
  --nebula-sat: 0.75;
  --nebula-bright: 0.6;
  --nebula-opacity: 0.55;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

button,
input,
select,
textarea {
  font: inherit;
}

textarea {
  resize: vertical;
}

#app {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

#scene-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  pointer-events: none;
  perspective: 1200px;
  background: var(--bg);
}

body[data-page="home"] {
  --bg: #05060a;
  --nebula-hue: 0deg;
  --nebula-sat: 0.75;
  --nebula-bright: 0.6;
  --nebula-opacity: 0.55;
}

body[data-page="ritual"] {
  --bg: #0b0706;
  --nebula-hue: 22deg;
  --nebula-sat: 0.9;
  --nebula-bright: 0.56;
  --nebula-opacity: 0.6;
}

body[data-page="light"] {
  --bg: #03080b;
  --nebula-hue: 72deg;
  --nebula-sat: 0.95;
  --nebula-bright: 0.78;
  --nebula-opacity: 0.5;
}

body[data-page="sound"] {
  --bg: #04070b;
  --nebula-hue: 190deg;
  --nebula-sat: 0.85;
  --nebula-bright: 0.62;
  --nebula-opacity: 0.58;
}

body[data-page="contact"] {
  --bg: #0a0804;
  --nebula-hue: 38deg;
  --nebula-sat: 0.88;
  --nebula-bright: 0.68;
  --nebula-opacity: 0.52;
}

#nav-marquee {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  visibility: hidden;
  pointer-events: none;
  perspective: 1200px;
  z-index: 12;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 64%, rgba(0, 0, 0, 1) 88%);
  mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 64%, rgba(0, 0, 0, 1) 88%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 260% 260%;
  mask-size: 260% 260%;
  -webkit-mask-position: center;
  mask-position: center;
}

.nav-track {
  display: flex;
  gap: 48px;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  transform-style: preserve-3d;
  pointer-events: auto;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: clamp(70px, 7.5vw, 90px);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 120ms ease, transform 120ms ease;
  transform-style: preserve-3d;
  line-height: 0.9;
  will-change: transform;
}

.nav-item:hover {
  color: #ffffff;
  opacity: 1;
}

.nav-track:hover .nav-item:not(:hover):not(.is-active) {
  color: var(--text);
}

.nav-track:hover .nav-item.is-active:not(:hover) {
  color: var(--accent);
}

.nav-item.is-active {
  color: var(--accent);
  text-shadow: 0 0 30px rgba(122, 240, 194, 0.35);
}

.nav-item.is-active:hover {
  color: #ffffff;
  opacity: 1;
  text-shadow: 0 0 28px var(--accent);
}
.audio-toggle {
  position: fixed;
  right: calc(60px + env(safe-area-inset-right));
  top: calc(60px + env(safe-area-inset-top));
  left: auto;
  bottom: auto;
  width: 88px;
  height: 88px;
  border: none;
  background: transparent;
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 15;
  pointer-events: auto;
}

.audio-toggle svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.audio-toggle.is-muted {
  color: rgba(255, 255, 255, 0.55);
}

.audio-toggle.is-muted::after {
  content: "";
  position: absolute;
  width: 52px;
  height: 3px;
  background: currentColor;
  border-radius: 999px;
  transform: rotate(-35deg);
}

body.impressum-open {
  overflow: hidden;
}

.impressum-link {
  display: inline-block;
  position: fixed;
  left: calc(60px + env(safe-area-inset-left));
  bottom: calc(60px + env(safe-area-inset-bottom));
  transform: none;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 16;
  transition: color 160ms ease;
}

.impressum-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.impressum-dialog {
  display: none;
  width: min(50vw, 560px);
  height: min(50vh, 520px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(5, 6, 10, 0.92);
  color: #ffffff;
  padding: 24px;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.impressum-dialog[open] {
  display: flex;
}

.impressum-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.impressum-dialog h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.impressum-close {
  align-self: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #ffffff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.impressum-content {
  flex: 1;
  overflow: auto;
  color: var(--muted);
  line-height: 1.6;
  padding-right: 6px;
}

.portrait-overlay {
  position: fixed;
  width: 100px;
  height: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: none;
  z-index: 4;
}

#ui-grid {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
  padding: 96px clamp(20px, 3vw, 60px);
  padding-top: calc(192px + env(safe-area-inset-top));
  padding-bottom: calc(clamp(96px, 12vw, 160px) + env(safe-area-inset-bottom));
  max-width: calc(640px + 2 * clamp(20px, 3vw, 60px));
  margin: 0 auto;
  width: 100%;
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform;
}

.panel {
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  isolation: isolate;
}

.title h1 {
  margin: 4px 0 8px;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lede {
  color: var(--muted);
  margin: 8px 0 16px;
  line-height: 1.6;
}

#page-intro {
  font-size: clamp(16px, 4.2vw, 20px);
}

.list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.list li + li {
  margin-top: 6px;
}

/* Scene elements */
.nebula {
  position: absolute;
  inset: 0;
  background-image: url("./media/backgrounds/Universe 1.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-color: #000000;
  transform: translate3d(0, 0, -260px) scale(1.04);
  transition: opacity 6000ms ease;
  pointer-events: none;
  will-change: transform, opacity;
}

.nebula-alt {
  opacity: 0;
}

.nebula-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.nebula-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.1) 55%,
    rgba(0, 0, 0, 0.35) 100%);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.lensflare {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 120deg, rgba(122, 240, 194, 0.6), rgba(255, 123, 187, 0.35), rgba(107, 123, 255, 0.55), rgba(122, 240, 194, 0.6));
  filter: blur(20px) saturate(1.08);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
  opacity: 0;
  will-change: transform, opacity;
}

.floating-point {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, rgba(122, 240, 194, 0.8));
  box-shadow: 0 0 40px rgba(122, 240, 194, 0.45);
  will-change: transform, opacity;
}

.scene-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.env-warning {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  letter-spacing: 0.01em;
  backdrop-filter: blur(10px);
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.noscript {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  letter-spacing: 0.01em;
  backdrop-filter: blur(10px);
  z-index: 30;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.koalendar-widget,
.koalendar-widget-button,
.koalendar-widget-trigger,
.koalendar-button,
[data-koalendar-widget],
[data-koalendar-trigger] {
  right: calc(60px + env(safe-area-inset-right)) !important;
  bottom: calc(60px + env(safe-area-inset-bottom)) !important;
  left: auto !important;
  top: auto !important;
}

@media (max-width: 720px) {
  #ui-grid {
    padding: 28px 18px;
    padding-top: calc(56px + env(safe-area-inset-top));
    padding-bottom: calc(clamp(96px, 16vw, 140px) + env(safe-area-inset-bottom));
    gap: 16px;
  }

  .nav-track {
    gap: 24px;
  }

  .nav-item {
    font-size: clamp(28px, 6.5vw, 48px);
    letter-spacing: 0.04em;
    line-height: 1;
  }

  .audio-toggle {
    right: calc(60px + env(safe-area-inset-right));
    top: calc(60px + env(safe-area-inset-top));
    left: auto;
    bottom: auto;
    width: 64px;
    height: 64px;
  }

  .audio-toggle svg {
    width: 28px;
    height: 28px;
  }

  .impressum-dialog {
    width: min(80vw, 520px);
    height: min(60vh, 520px);
    padding: 20px;
  }
}

@media (max-width: 420px) {
  #ui-grid {
    padding: 24px 16px;
    padding-top: calc(48px + env(safe-area-inset-top));
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .panel {
    padding: 16px 18px;
  }

  .nav-track {
    gap: 18px;
  }

  .nav-item {
    font-size: clamp(22px, 6vw, 40px);
    letter-spacing: 0.03em;
  }

  .impressum-link {
    font-size: 11px;
  }

  .impressum-dialog {
    width: min(86vw, 520px);
    height: min(62vh, 520px);
  }
}
