/* =========================================
   THEME SYSTEM (GLOBAL)
========================================= */

:root {
  --bg: #0a0810;
  --fg: #e9e6ff;
  --accent: #b19cff;
  --accent-glow: rgba(177, 156, 255, 0.35);
  --grad-1: #120d1d;
  --grad-2: #07060c;
}

[data-theme="light"] {
  --bg: #ffffff;
  --fg: #161616;
  --accent: #4b2fff;
  --accent-glow: rgba(75, 47, 255, 0.75);
  --grad-1: #ffffff;
  --grad-2: #dcdcff;
}

/* Base theme application */
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--fg);
}

/* actual animated background */
body {
  background: radial-gradient(
    1200px 800px at 80% 20%,
    var(--grad-1),
    var(--bg),
    var(--grad-2)
  );
}

/* =========================================
   THEME TOGGLE
========================================= */

#theme-toggle {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 999;
  perspective: 600px;
  transition: transform 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

#theme-toggle:not(.flipping):hover {
  transform: rotate(15deg);
}

#theme-icon {
  width: 28px;
  height: 28px;
  display: block;
  backface-visibility: hidden;
  filter: drop-shadow(0 0 6px var(--accent-glow));
  transition:
    opacity 0.25s ease,
    filter 0.25s ease;
}

#theme-toggle.flipping #theme-icon {
  transform: rotateY(180deg);
}

body,
.report-box,
.card,
table,
input,
select,
button {
  background-color: transparent;
}

/* enable view transitions */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* circular reveal animation */
::view-transition-new(root) {
  clip-path: circle(0 at var(--reveal-x) var(--reveal-y));
  animation: themeReveal 700ms cubic-bezier(.65,0,.35,1) forwards;
}

@keyframes themeReveal {
  to {
    clip-path: circle(150vmax at var(--reveal-x) var(--reveal-y));
  }
}

/* =========================================
   THEMED LINK SYSTEM (Glow Version)
========================================= */

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition:
    color 0.25s ease,
    text-shadow 0.25s ease,
    transform 0.15s ease,
    opacity 0.2s ease;
}

/* Animated underline */
a.underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.3s ease;
}

/* Hover */
a:hover {
  text-shadow: 0 0 8px var(--accent-glow);
}

a:hover::after {
  width: 100%;
}

/* Active (click press) */
a:active {
  transform: scale(0.96);
  opacity: 0.8;
}

/* Focus (keyboard accessibility) */
a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Visited */
a:visited {
  color: var(--accent);
}