/* ==========================================================================
   darkweb.cloud - Original splash theme (living quiet)
   ========================================================================== */

/* --- Design tokens --- */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --accent: #00d4ff;
  --accent-dim: #0088aa;
  --accent-glow: rgba(0, 212, 255, 0.15);
  --text-primary: #e0e6ed;
  --text-secondary: #6b7a8d;
  --grid-color: rgba(0, 212, 255, 0.03);
  --border-color: rgba(0, 212, 255, 0.1);
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  font-family: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* --- Ambient background layers --- */

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.scanline {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 100;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(0, 0, 0, 0.45) 100%
  );
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: float-up linear infinite;
  will-change: transform, opacity;
}

/* --- Main content --- */

.container {
  text-align: center;
  z-index: 10;
  position: relative;
  will-change: transform;
  padding: 1.5rem;
}

/* --- Logo: concentric spinning rings + hex icon --- */

.logo-ring {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 3rem;
  will-change: transform;
  cursor: default;
  touch-action: manipulation;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.ring-outer {
  inset: 0;
  animation: spin 20s linear infinite;
  border-style: dashed;
}

.ring-middle {
  inset: 20px;
  animation: spin 15s linear infinite reverse;
  border-color: var(--accent-dim);
}

.ring-inner {
  inset: 40px;
  animation: spin 10s linear infinite;
  border-color: var(--accent);
  box-shadow:
    0 0 20px var(--accent-glow),
    inset 0 0 20px var(--accent-glow);
}

.logo-core {
  position: absolute;
  inset: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hex-icon {
  width: 70px;
  height: 70px;
  color: var(--accent);
  filter: drop-shadow(0 0 10px var(--accent));
  animation: pulse-glow 3s ease-in-out infinite;
}

/* --- Title with glitch effect --- */

h1.glitch {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  color: var(--text-primary);
  position: relative;
  margin-bottom: 0.5rem;
}

h1.glitch::before,
h1.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Cyan glitch layer (top half) */
h1.glitch::before {
  color: var(--accent);
  animation: glitch-1 4s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  transform: translate(-2px);
  opacity: 0.8;
}

/* Magenta glitch layer (bottom half) */
h1.glitch::after {
  color: #ff0066;
  animation: glitch-2 3s infinite linear alternate-reverse;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  transform: translate(2px);
  opacity: 0.8;
}

/* Occasional stronger burst (JS adds .glitch-hot briefly) */
h1.glitch.glitch-hot::before {
  animation: glitch-hot-1 0.35s steps(2, end) infinite;
  opacity: 1;
}

h1.glitch.glitch-hot::after {
  animation: glitch-hot-2 0.28s steps(2, end) infinite;
  opacity: 1;
}

/* --- Tagline --- */

.tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  margin-bottom: 0;
  opacity: 0;
  animation: fade-in 1s 0.5s forwards;
  min-height: 1.4em;
  transition: opacity 0.35s ease;
}

/* --- Status bar with beacon --- */

.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background: rgba(0, 212, 255, 0.02);
  margin-top: 3rem;
  opacity: 0;
  animation: fade-in 1s 1s forwards;
}

.beacon {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  transition:
    background 0.4s ease,
    box-shadow 0.4s ease,
    opacity 0.4s ease;
}

.beacon.is-live {
  animation: beacon-breathe 2.8s ease-in-out infinite;
}

.beacon.is-dim {
  background: #6b7a8d;
  box-shadow: 0 0 6px rgba(107, 122, 141, 0.5);
  animation: none;
}

.status-text {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  transition: opacity 0.28s ease;
  min-width: 12ch;
  text-align: left;
}

.status-text.is-fading {
  opacity: 0.25;
}

/* --- Decorative signal --- */

.signal {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.35rem;
  opacity: 0;
  animation: fade-in 1s 1.35s forwards;
}

.signal-label {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  color: var(--text-secondary);
  text-transform: lowercase;
}

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}

.signal-bars i {
  display: block;
  width: 3px;
  background: rgba(0, 212, 255, 0.18);
  border-radius: 1px;
  transition:
    background 0.45s ease,
    box-shadow 0.45s ease;
}

.signal-bars i:nth-child(1) {
  height: 4px;
}
.signal-bars i:nth-child(2) {
  height: 7px;
}
.signal-bars i:nth-child(3) {
  height: 10px;
}
.signal-bars i:nth-child(4) {
  height: 12px;
}
.signal-bars i:nth-child(5) {
  height: 14px;
}

.signal-bars i.on {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

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

.whisper {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(92vw, 36rem);
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: rgba(107, 122, 141, 0.85);
  opacity: 0;
  animation: fade-in 1.4s 1.8s forwards;
  pointer-events: none;
  line-height: 1.6;
}

.status-link {
  position: fixed;
  right: max(0.9rem, env(safe-area-inset-right));
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  z-index: 20;
  color: rgba(0, 212, 255, 0.28);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.4rem;
  transition: color 0.3s ease;
}

.status-link:hover,
.status-link:focus-visible {
  color: var(--accent);
  outline: none;
}

/* --- Status page --- */

body.status-page {
  overflow: auto;
  align-items: stretch;
  justify-content: center;
}

.status-shell {
  position: relative;
  z-index: 10;
  width: min(92vw, 34rem);
  margin: 3rem auto;
  padding: 2rem 1.5rem 3rem;
  text-align: left;
}

.status-shell .brand {
  display: inline-block;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.16em;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.status-shell .brand:hover {
  color: var(--accent);
}

.status-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  margin-bottom: 0.75rem;
}

.status-shell h1 {
  font-weight: 300;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.status-lede {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.85;
  margin-bottom: 2rem;
  max-width: 34em;
}

.status-grid {
  display: grid;
  gap: 0.85rem;
  border: 1px solid var(--border-color);
  background: rgba(0, 212, 255, 0.02);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.75rem;
}

.status-grid > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.status-grid dt {
  color: var(--text-secondary);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
}

.status-grid dd {
  color: var(--text-primary);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  word-break: break-word;
}

.status-foot {
  color: rgba(107, 122, 141, 0.95);
  font-size: 0.75rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  max-width: 34em;
}

.home-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  border-bottom: 1px solid transparent;
}

.home-link:hover {
  border-bottom-color: var(--accent-dim);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 10px var(--accent));
  }
  50% {
    opacity: 0.7;
    filter: drop-shadow(0 0 20px var(--accent));
  }
}

@keyframes glitch-1 {
  0%,
  95% {
    transform: translate(0);
  }
  96% {
    transform: translate(-3px, 1px);
  }
  97% {
    transform: translate(2px, -1px);
  }
  98% {
    transform: translate(-1px, 2px);
  }
  99% {
    transform: translate(1px, -1px);
  }
  100% {
    transform: translate(0);
  }
}

@keyframes glitch-2 {
  0%,
  93% {
    transform: translate(0);
  }
  94% {
    transform: translate(2px, 1px);
  }
  95% {
    transform: translate(-3px, -1px);
  }
  96% {
    transform: translate(1px, 2px);
  }
  97% {
    transform: translate(-2px, -1px);
  }
  100% {
    transform: translate(0);
  }
}

@keyframes glitch-hot-1 {
  0% {
    transform: translate(-4px, 1px);
  }
  50% {
    transform: translate(3px, -2px);
  }
  100% {
    transform: translate(-2px, 2px);
  }
}

@keyframes glitch-hot-2 {
  0% {
    transform: translate(3px, -1px);
  }
  50% {
    transform: translate(-4px, 2px);
  }
  100% {
    transform: translate(2px, -2px);
  }
}

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

@keyframes float-up {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-10vh) translateX(20px);
    opacity: 0;
  }
}

@keyframes beacon-breathe {
  0%,
  100% {
    box-shadow: 0 0 8px var(--accent);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 16px var(--accent);
    opacity: 0.7;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ring-outer,
  .ring-middle,
  .ring-inner,
  .hex-icon,
  h1.glitch::before,
  h1.glitch::after,
  .beacon.is-live,
  .particle {
    animation: none !important;
  }

  .tagline,
  .status-bar,
  .signal,
  .whisper {
    opacity: 1;
    animation: none;
  }

  h1.glitch::before,
  h1.glitch::after {
    opacity: 0.35;
    transform: none;
    animation: none !important;
  }
}

/* Mobile */
@media (max-width: 520px) {
  .logo-ring {
    width: 140px;
    height: 140px;
    margin-bottom: 2.2rem;
  }

  .logo-core {
    inset: 42px;
  }

  .hex-icon {
    width: 56px;
    height: 56px;
  }

  h1.glitch {
    letter-spacing: 0.18em;
  }

  .status-bar {
    margin-top: 2.2rem;
  }

  .status-grid > div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

/* Legacy redesign error helpers (kept harmless if referenced) */
.error-page {
  overflow: hidden;
}
.error-shell {
  max-width: 520px;
  padding: 2rem;
  text-align: center;
  z-index: 10;
}
