/* Design tokens live in index.html so the loading overlay can use them before
   this file has loaded. Everything below builds on those custom properties. */

html,
body {
  background-color: var(--bg, #0b0f10);
  margin: 0;
  height: 100%;
  overflow: hidden;
  /* The scene owns every gesture: no pull-to-refresh, no double-tap zoom, no
     accidental text selection while dragging the camera. */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--sans);
  color: var(--text);
}

h1,
h2,
h3,
h4,
h5,
p {
  font-family: var(--sans);
  font-weight: 500;
  color: var(--text);
}

a {
  text-decoration: none;
  color: var(--accent);
}

#webgl {
  pointer-events: none;
}

#css {
  cursor: pointer;
}

#ui-interactive {
  position: absolute;
  inset: 0;
  z-index: 2;
  /* The overlay is a HUD: it must never swallow clicks meant for the scene.
     Individual controls opt back in. */
  pointer-events: none;
}

.interface-wrapper {
  position: absolute;
  inset: 0;
}

/* ---------------------------------------------------------------- controls */

.control-cluster {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.control-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.control-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(232, 236, 237, 0.28);
}

.control-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.control-button img {
  display: block;
  width: 12px;
  height: 12px;
}

/* -------------------------------------------------------------------- hint */

.hint {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: hint-pulse 2.4s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ------------------------------------------------------------- crt screen */

.screen-container {
  position: relative;
  overflow: hidden;
}

/* Scanlines plus a corner falloff, sitting above the embedded site. The iframe
   is cross-origin so it can't be shaded in GL — this sells the CRT instead. */
.screen-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
  background-image: repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.09) 0px,
      rgba(0, 0, 0, 0.09) 1px,
      rgba(0, 0, 0, 0) 1px,
      rgba(0, 0, 0, 0) 4px
    ),
    radial-gradient(
      ellipse at center,
      rgba(0, 0, 0, 0) 58%,
      rgba(0, 0, 0, 0.3) 100%
    );
}

/* Atmosphere when the monitor is scenery; out of the way when someone is
   actually reading the site through it. */
.screen-overlay.is-reading {
  opacity: 0.18;
}

.jitter {
  animation-duration: 0.3s;
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
  animation-iteration-count: infinite;
  animation-name: jittery;
}

@keyframes jittery {
  10% {
    transform: translate(-0.1px, -0.15px);
  }
  20% {
    transform: translate(0.15px, 0.1px);
  }
  30% {
    transform: translate(-0.2px, -0.25px);
  }
  40% {
    transform: translate(0.05px, 0.1px);
  }
  50% {
    transform: translate(-0.025px, -0.05px);
  }
  60% {
    transform: translate(0px, 0.075px);
  }
  70% {
    transform: translate(-0.075px, -0.1px);
  }
  80% {
    transform: translate(0.075px, 0.125px);
  }
  90% {
    transform: translate(-0.125px, -0.075px);
  }
  100% {
    transform: translate(0.075px, 0.025px);
  }
}

/* ---------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .jitter {
    animation: none;
  }
  .hint-dot {
    animation: none;
    opacity: 0.8;
  }
  .control-button {
    transition: none;
  }
}
