:root {
  --kh-sky-top: #010208;
  --kh-sky-upper: #040817;
  --kh-sky-lower: #0b1024;
  --kh-sky-horizon: #171028;
  --kh-lower-base: #020204;
  --kh-sun-x: 36%;
  --kh-sun-y: 54%;
  --kh-star-opacity: 0;
  --kh-sun-opacity: 1;
  --kh-gold: #e6c66f;
  --kh-highlight: #f0d887;
  --kh-cream: #f5efe3;
}

* {
  box-sizing: border-box;
}

html,
body.kh-solar-body {
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #05080d;
}

body.kh-solar-body {
  color: var(--kh-cream);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.kh-solar-gate {
  position: fixed;
  inset: 0;
  isolation: isolate;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  outline: 0;
  background: var(--kh-sky-top);
  touch-action: manipulation;
}

.kh-solar-world {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0) scale(1);
  transform-origin: 50% 72%;
}

.kh-sky {
  position: absolute;
  z-index: -10;
  inset: -2%;
  background-color: var(--kh-sky-top);
  background-image:
    radial-gradient(ellipse 112% 38% at var(--kh-sun-x) 94%, rgba(255, 143, 91, 0.08) 0%, transparent 67%),
    linear-gradient(
      180deg,
      var(--kh-sky-top) 0%,
      var(--kh-sky-upper) 43%,
      var(--kh-sky-lower) 73%,
      var(--kh-sky-horizon) 92%,
      var(--kh-lower-base) 100%
    );
}

.kh-sky::before,
.kh-sky::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.kh-sky::before {
  opacity: 0.36;
  background:
    radial-gradient(circle at 50% -18%, rgba(151, 189, 255, 0.16), transparent 48%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.035), transparent 34%, rgba(255, 162, 111, 0.05) 72%, transparent);
  mix-blend-mode: screen;
}

.kh-sky::after {
  background: linear-gradient(180deg, rgba(0, 0, 8, 0.26), transparent 15%, transparent 78%, rgba(4, 1, 8, 0.18));
}

.kh-stars {
  position: absolute;
  z-index: -8;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: var(--kh-star-opacity);
  pointer-events: none;
}

.kh-sun-system {
  position: absolute;
  z-index: -4;
  top: var(--kh-sun-y);
  left: var(--kh-sun-x);
  width: clamp(244px, 66vw, 370px);
  aspect-ratio: 1;
  opacity: var(--kh-sun-opacity);
  transform: translate(-50%, -50%);
  transform-origin: center;
}

.kh-solar-gate.is-sky-ready .kh-sky {
  transition: background-color 6s ease, background-image 6s ease;
}

.kh-solar-gate.is-sky-ready .kh-stars {
  transition: opacity 5s ease;
}

.kh-solar-gate.is-sky-ready .kh-sun-system {
  transition: top 6s ease, left 6s ease, opacity 5s ease;
}

.kh-sun-disc,
.kh-sun-corona,
.kh-sun-bloom {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.kh-sun-disc {
  z-index: 3;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 42% 35%, rgba(255, 255, 255, 0.82) 0 7%, transparent 27%),
    radial-gradient(circle at 49% 47%, #fffef3 0 43%, #ffe6a7 71%, #ffac68 90%, #e6633d 100%);
  box-shadow:
    inset -11px -16px 30px rgba(185, 73, 47, 0.14),
    inset 8px 6px 24px rgba(255, 255, 255, 0.2),
    0 0 5px 1px rgba(255, 245, 207, 0.72);
}

.kh-sun-disc::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 31% 38%, rgba(255, 255, 255, 0.12) 0 1.4%, transparent 3%),
    radial-gradient(circle at 67% 62%, rgba(196, 90, 47, 0.08) 0 1.2%, transparent 3.2%),
    radial-gradient(circle, transparent 72%, rgba(186, 65, 44, 0.12) 96%, rgba(124, 42, 36, 0.18) 100%);
  content: "";
  mix-blend-mode: multiply;
}

.kh-sun-corona {
  z-index: 2;
  inset: -8%;
  opacity: 0.92;
  background: radial-gradient(circle, rgba(255, 237, 179, 0.7) 45%, rgba(255, 167, 84, 0.29) 68%, transparent 78%);
  filter: blur(10px);
}

.kh-sun-bloom {
  z-index: 1;
  inset: -70%;
  opacity: 0.8;
  background: radial-gradient(circle, rgba(255, 195, 117, 0.35) 0%, rgba(242, 75, 58, 0.15) 34%, rgba(105, 47, 92, 0.05) 55%, transparent 72%);
  filter: blur(38px);
  mix-blend-mode: screen;
}

.kh-horizon-aura {
  position: absolute;
  z-index: -6;
  top: 79%;
  right: -34vw;
  left: -34vw;
  height: 31vh;
  border-radius: 50%;
  opacity: 0.68;
  background: radial-gradient(ellipse at 50% 54%, rgba(255, 149, 99, 0.15) 0%, rgba(154, 84, 100, 0.08) 38%, transparent 70%);
  filter: blur(24px);
}

.kh-refraction {
  position: absolute;
  z-index: 1;
  right: -8%;
  bottom: -1px;
  left: -8%;
  height: 11%;
  opacity: 0.22;
  background:
    linear-gradient(180deg, transparent 0 18%, rgba(255, 221, 178, 0.09) 19% 20%, transparent 22% 45%, rgba(255, 154, 105, 0.07) 46% 47%, transparent 49%),
    linear-gradient(180deg, transparent, rgba(6, 4, 10, 0.25));
  transform: translateZ(0);
}

.kh-optical-finish {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at var(--kh-sun-x) var(--kh-sun-y), transparent 0 21%, rgba(7, 8, 20, 0.035) 48%, rgba(0, 0, 5, 0.38) 120%),
    linear-gradient(90deg, rgba(9, 13, 34, 0.08), transparent 17% 83%, rgba(31, 5, 24, 0.1));
}

.kh-film-grain {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.15;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.kh-wordmark {
  position: fixed;
  z-index: 20;
  top: max(22px, calc(env(safe-area-inset-top) + 15px));
  left: 50%;
  width: clamp(112px, 31vw, 158px);
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.kh-wordmark img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.9;
  filter: drop-shadow(0 2px 16px rgba(0, 0, 0, 0.22));
}

.kh-gate-control:focus-visible,
.kh-noscript:focus-visible {
  outline: 2px solid var(--kh-highlight);
  outline-offset: 5px;
}

.kh-gate-cluster {
  position: fixed;
  z-index: 30;
  right: max(20px, calc(env(safe-area-inset-right) + 17px));
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 17px));
  width: 70px;
  height: 70px;
  opacity: 0;
  transform: translate3d(0, 10px, 0) scale(0.9);
}

.kh-solar-gate.is-ready .kh-gate-cluster {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.kh-gate-control {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  place-items: center;
  overflow: visible;
  border: 1px solid rgba(255, 247, 235, 0.5);
  border-radius: 50%;
  outline: 0;
  color: rgba(255, 250, 242, 0.94);
  background:
    radial-gradient(circle at 42% 35%, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(10, 13, 24, 0.09);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    0 10px 42px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  backdrop-filter: blur(4px);
}

.kh-gate-control:hover {
  border-color: rgba(255, 247, 235, 0.82);
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 12px 46px rgba(0, 0, 0, 0.22), 0 0 24px rgba(230, 198, 111, 0.1);
}

.kh-gate-orbit {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from 210deg, transparent 0deg 235deg, rgba(230, 198, 111, 0.2) 252deg, var(--kh-highlight) 290deg, transparent 318deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  animation: kh-orbit 18s linear infinite;
}

.kh-gate-arrow {
  position: relative;
  z-index: 2;
  display: block;
  font-size: 1.55rem;
  font-weight: 300;
  line-height: 1;
  transform: translate3d(0, 0, 0);
  text-shadow: 0 0 18px rgba(230, 198, 111, 0.3);
}

.kh-solar-gate.is-ready:not(.is-interacting) .kh-gate-arrow {
  animation: kh-arrow-hint 620ms 850ms ease-in-out 1;
}

.kh-portal {
  position: fixed;
  z-index: 24;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.kh-portal-disc {
  position: absolute;
  right: max(11px, calc(env(safe-area-inset-right) + 8px));
  bottom: max(13px, calc(env(safe-area-inset-bottom) + 8px));
  width: 88px;
  height: 88px;
  border-radius: 50%;
  opacity: 0;
  background:
    radial-gradient(circle at 51% 53%, rgba(25, 20, 36, 0.98) 0 10%, rgba(8, 10, 23, 0.995) 49%, #04060e 76%),
    #04060e;
  box-shadow: 0 0 0 1px rgba(230, 198, 111, 0.08), 0 0 70px rgba(230, 198, 111, 0.11);
  transform: translateZ(0) scale(0.01);
  transform-origin: 50% 50%;
}

.kh-portal-lockup {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: clamp(76px, 22vw, 112px);
  aspect-ratio: 1;
  place-items: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}

.kh-portal-lockup img {
  display: block;
  width: 62%;
  height: 62%;
  object-fit: contain;
  opacity: 0.9;
}

.kh-portal-orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(230, 198, 111, 0.38);
  border-top-color: rgba(240, 216, 135, 0.92);
  border-radius: 50%;
  transform: rotate(-35deg);
}

.kh-solar-gate.is-entering {
  cursor: progress;
}

.kh-solar-gate.is-interacting .kh-gate-control {
  cursor: grabbing;
}

.kh-solar-gate.is-entering .kh-portal-orbit {
  animation: kh-handoff-orbit 720ms cubic-bezier(0.65, 0, 0.35, 1) 1 both;
}

.kh-assistive {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.kh-noscript {
  position: fixed;
  z-index: 80;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  min-height: 48px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(230, 198, 111, 0.58);
  border-radius: 999px;
  color: var(--kh-cream);
  background: #080b12;
  text-decoration: none;
}

@keyframes kh-orbit {
  to { transform: rotate(360deg); }
}

@keyframes kh-arrow-hint {
  0%, 100% { transform: translate3d(0, 0, 0); }
  45% { transform: translate3d(-5px, 0, 0); }
}

@keyframes kh-handoff-orbit {
  from { transform: rotate(-35deg); }
  to { transform: rotate(315deg); }
}

@media (min-width: 760px) {
  .kh-sun-system {
    width: clamp(330px, 30vw, 520px);
  }

  .kh-horizon-aura {
    top: 76%;
    right: -8vw;
    left: -8vw;
    height: 34vh;
  }

  .kh-gate-cluster {
    right: max(36px, calc(env(safe-area-inset-right) + 29px));
    bottom: max(34px, calc(env(safe-area-inset-bottom) + 27px));
    width: 76px;
    height: 76px;
  }

  .kh-portal-disc {
    right: max(30px, calc(env(safe-area-inset-right) + 23px));
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 21px));
  }
}

@media (pointer: coarse), (max-width: 759px) {
  .kh-sky::before,
  .kh-film-grain {
    mix-blend-mode: normal;
  }

  .kh-film-grain {
    opacity: 0.055;
  }

  .kh-sun-corona {
    filter: blur(7px);
  }

  .kh-sun-bloom {
    inset: -48%;
    opacity: 0.62;
    filter: blur(24px);
    mix-blend-mode: normal;
  }

  .kh-horizon-aura {
    filter: blur(18px);
  }

  .kh-gate-control {
    backdrop-filter: none;
    background-color: rgba(7, 9, 18, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kh-sky,
  .kh-stars,
  .kh-sun-system,
  .kh-gate-cluster {
    transition-duration: 1ms !important;
  }

  .kh-gate-orbit,
  .kh-gate-arrow,
  .kh-portal-orbit {
    animation: none !important;
  }
}
