/* Console access portal: no visible text or messages. login.js marks <html> with .js and drives the state in
   data-state; without JavaScript the static ring remains and the simulation controls disappear. */

/* ── Tokens ─────────────────────────────────────────────────── */

:root {
  --bg: #04050a;
  --warn: #ff6f5a;

  /* Ring radius. login.js sets it in px so CSS and the shader match. */
  --r: clamp(min(96px, 28vmin), 20vmin, 230px);

  --ease: cubic-bezier(.2, .7, .1, 1);

  color-scheme: dark;
}

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

html { height: 100%; background: var(--bg); }

body {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Scene ──────────────────────────────────────────────────── */

.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.webgl .scene { opacity: 1; }

/* Fallback without WebGL / without JS */
.ring {
  position: fixed;
  top: 50%; left: 50%;
  width: calc(var(--r) * 2);
  height: calc(var(--r) * 2);
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid rgba(214, 232, 255, .9);
  box-shadow:
    0 0 48px rgba(110, 170, 255, .38),
    0 0 140px rgba(140, 110, 255, .22),
    inset 0 0 36px rgba(120, 170, 255, .16);
  pointer-events: none;
  transition: scale 1.1s var(--ease), opacity .9s ease, border-color .4s, box-shadow .4s;
}
.webgl .ring { display: none; }
.js[data-state="off"]  .ring { opacity: 0; scale: .84; }
[data-state="waiting"] .ring { scale: .93; animation: breathe 1.4s ease-in-out infinite; }
[data-state="denied"]  .ring { border-color: var(--warn); box-shadow: 0 0 56px rgba(255, 90, 70, .42); }
[data-state="granted"] .ring {
  scale: 0;
  opacity: 0;
  transition: scale 1.3s cubic-bezier(.7, 0, .9, .3), opacity .3s ease 1.1s;
}

/* ── Gate: invisible click area over the ring ───────────────── */

.gate {
  position: fixed;
  top: 50%; left: 50%;
  width: calc(var(--r) * 2.24);
  height: calc(var(--r) * 2.24);
  translate: -50% -50%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.gate:disabled { cursor: default; }


/* Keyboard focus: no outline is drawn. login.js lights the ring up
   the same as on hover; without WebGL the fallback ring does it. */
html:not(.webgl):has(.gate:focus-visible) .ring {
  box-shadow:
    0 0 64px rgba(140, 195, 255, .6),
    0 0 160px rgba(140, 110, 255, .32),
    inset 0 0 44px rgba(120, 170, 255, .26);
}

/* ── Animations ─────────────────────────────────────────────── */

@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
