/* Orbe Immersive — temporary landing page */

@font-face {
  font-family: 'Comfortaa';
  src: url('../fonts/comfortaa-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Everything on the page is measured off the ring. In the reference the ring
     is 70.9% of the viewport height; the vw cap keeps it inside a portrait
     phone, where 70.9vh would be wider than the screen. */
  --ring: min(70.9vh, 84vw);

  /* The glow reaches a little past the ring before it dies, so the canvas has
     to be wider than the ring. Paired with CONFIG.eyeDist in js/orb.js: change
     one and the orb's apparent size changes, so change both. */
  --orb: calc(var(--ring) * 1.2);

  --footer-h: max(5.3vh, 46px);
  --ink: #1e3a42;
}

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

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

body {
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------------------------------------------------------- stage --- */

/* isolation:isolate keeps the canvas's screen blend inside this element, and
   .bg being a sibling (rather than the body background) is what gives the blend
   something to blend against. */
.stage {
  position: fixed;
  inset: 0;
  isolation: isolate;
  /* The stage is the drag surface. touch-action:none stops a touch drag being
     stolen as a browser gesture, and everything inside is pointer-events:none
     so the stage always receives the pointer. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage > * {
  pointer-events: none;
}

/* Only advertise the grab once the orb is actually live — there is nothing to
   drag in the CSS fallback. */
.is-ready .stage {
  cursor: grab;
}

.is-ready.is-dragging .stage {
  cursor: grabbing;
}

.bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    #030304 0%,
    #040407 30%,
    #050708 35%,
    #070c0f 40%,
    #0a141a 45%,
    #10212b 50%,
    #193343 55%,
    #25495d 60%,
    #38647b 65%,
    #4d7d9a 70%,
    #6698b5 75%,
    #7fb1cd 80%,
    #9ac5df 85%,
    #afd6eb 90%,
    #bfe1f3 95%,
    #c9e6f8 100%
  );
}

/* ------------------------------------------------------------------ orb --- */

.orb,
.orb-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--orb);
  height: var(--orb);
  transform: translate(-50%, -50%);
  /* Black is the identity for screen, so the square edges of the canvas simply
     vanish into the gradient and the lower half washes out on its own. */
  mix-blend-mode: screen;
  pointer-events: none;
}

.orb {
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.is-ready .orb {
  opacity: 1;
}

/* Only ever seen if WebGL is unavailable or the context is lost. Two radial
   gradients standing in for the warm inner rim and the blue outer fringe. */
.orb-fallback {
  display: none;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0 56%,
    rgba(198, 126, 68, 0.5) 65%,
    rgba(160, 196, 214, 0.55) 74%,
    rgba(92, 150, 198, 0.32) 86%,
    transparent 96%
  );
}

.orb-fallback::after {
  content: '';
  position: absolute;
  inset: 0;
  /* Biases the glow toward 3 o'clock, matching where the shader puts the sun. */
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0 60%,
    rgba(232, 240, 248, 0.38) 70%,
    transparent 90%
  );
  -webkit-mask-image: linear-gradient(to right, transparent 32%, #000 88%);
  mask-image: linear-gradient(to right, transparent 32%, #000 88%);
}

.no-webgl .orb {
  display: none;
}

.no-webgl .orb-fallback {
  display: block;
}

/* ------------------------------------------------------- ring and logo --- */

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--ring);
  height: var(--ring);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: fade-in 1s ease both 0.15s;
}

.logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--ring) * 0.53);
  height: auto;
  transform: translate(-50%, -50%);
  animation: fade-in 1s ease both 0.3s;
}

/* ---------------------------------------------------------------- grain --- */

/* Sits above the gradient at a couple of percent to break up banding across the
   dark blues, and doubles as cover for the shader's reduced sample count. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* --------------------------------------------------------------- footer --- */

.contact {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  height: var(--footer-h);
  background: linear-gradient(to bottom, #e1effa, #e5f3fc);
  animation: fade-in 1s ease both 0.45s;
}

.contact__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--ink);
  font-family: 'Comfortaa', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  /* 2.92vh reproduces the reference's ~173px string width, 18px x-height and
     23px ascender at 1920x1080; the clamp only guards the extremes. */
  font-size: clamp(14px, 2.92vh, 44px);
  font-weight: 400;
  letter-spacing: 0;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.contact__link:hover {
  background-color: rgba(255, 255, 255, 0.55);
  color: #0d262e;
}

.contact__link:focus-visible {
  outline: 2px solid #0d262e;
  outline-offset: -6px;
  border-radius: 4px;
}

/* ------------------------------------------------------------ animation --- */

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ring,
  .logo,
  .contact {
    animation-duration: 0.01ms;
  }

  .orb {
    transition-duration: 0.01ms;
  }
}
