/* ============================================
   DisplayPixels — Visual Upgrade Stylesheet
   Cyberpunk-inspired, gaming-style aesthetic
   ============================================ */

/* === ANIMATED BACKGROUND CANVAS === */
#dp-particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Ensure ALL content sits above the particle canvas */
body {
  isolation: isolate;
}

body > * {
  position: relative;
  z-index: 1;
}

/* === ROOT OVERRIDES === */
:root {
  --bg: #080c14;
  --card: rgba(16, 22, 36, 0.75);
  --card-solid: #101624;
  --text: #e8edf5;
  --accent: #00d4ff;
  --accent2: #a855f7;
  --accent3: #22d3ee;
  --muted: #6b7a8d;
  --glow: rgba(0, 212, 255, 0.15);
  --glow-strong: rgba(0, 212, 255, 0.35);
  --gradient: linear-gradient(135deg, #00d4ff, #a855f7);
  --gradient-subtle: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(168, 85, 247, 0.08));
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f0f4f8;
    --card: rgba(255, 255, 255, 0.85);
    --card-solid: #ffffff;
    --text: #0f172a;
    --accent: #0284c7;
    --accent2: #7c3aed;
    --accent3: #06b6d4;
    --muted: #64748b;
    --glow: rgba(2, 132, 199, 0.1);
    --glow-strong: rgba(2, 132, 199, 0.25);
    --gradient: linear-gradient(135deg, #0284c7, #7c3aed);
    --gradient-subtle: linear-gradient(135deg, rgba(2, 132, 199, 0.06), rgba(124, 58, 237, 0.06));
  }
}

/* === BODY === */
body {
  background: var(--bg) !important;
  position: relative;
  overflow-x: hidden;
  font-size: 1rem !important;
  line-height: 1.7 !important;
}

/* Override the old .85rem body text */
section p, section li, section td, .intro, .info {
  font-size: 0.95rem !important;
  line-height: 1.7 !important;
}

/* Grid overlay removed — particles handle the background */

/* === HEADER / LOGO === */
header h1 {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  letter-spacing: -0.02em;
}

header h1::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--gradient);
  border-radius: 1px;
  opacity: 0.5;
}

/* === NAV === */
nav {
  gap: 0.5rem !important;
}

nav a {
  color: var(--muted) !important;
  font-size: 0.82rem !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: 999px !important;
  border: 1px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

nav a:hover {
  color: var(--accent) !important;
  background: var(--glow) !important;
  border-color: rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 16px var(--glow);
}

nav a.active {
  background: var(--gradient) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow:
    0 0 20px rgba(0, 212, 255, 0.3),
    0 0 40px rgba(168, 85, 247, 0.15);
  font-weight: 600 !important;
}

/* === LAYOUT WIDTH — override the old 480px max-width === */
main, section, table, .intro, .info[style*="max-width"] {
  max-width: 720px !important;
  width: 100% !important;
}

/* === MAIN CARD === */
main {
  background: var(--card-solid) !important;
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 1rem !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 1px rgba(0, 212, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  position: relative;
  overflow: hidden;
  padding: 2.5rem 2rem !important;
}

main::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0.7;
}

/* No hover glow on main card — it's not interactive */

/* === METRICS — Neon Glow === */
.metric {
  color: var(--accent) !important;
  text-shadow:
    0 0 10px rgba(0, 212, 255, 0.5),
    0 0 30px rgba(0, 212, 255, 0.2);
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* Pulse animation on load */
.metric.dp-pulse {
  animation: metricPulse 0.8s ease-out;
}

@keyframes metricPulse {
  0% {
    text-shadow:
      0 0 20px rgba(0, 212, 255, 0.8),
      0 0 60px rgba(0, 212, 255, 0.4),
      0 0 100px rgba(168, 85, 247, 0.2);
    transform: scale(1.05);
  }
  100% {
    text-shadow:
      0 0 10px rgba(0, 212, 255, 0.5),
      0 0 30px rgba(0, 212, 255, 0.2);
    transform: scale(1);
  }
}

/* === LABELS === */
.label {
  color: var(--muted) !important;
  font-size: 0.9rem !important;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

/* === BUTTONS === */
button {
  background: var(--gradient) !important;
  color: #fff !important;
  font-weight: 600;
  border-radius: 999px !important;
  padding: 0.65rem 1.6rem !important;
  border: none !important;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(0, 212, 255, 0.25),
    0 0 0 0 rgba(0, 212, 255, 0);
  letter-spacing: 0.02em;
}

button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 212, 255, 0.35),
    0 0 30px rgba(0, 212, 255, 0.15) !important;
}

button:active {
  transform: translateY(0);
}

/* Shimmer effect on buttons */
button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -100%;
  width: 60%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s;
}

button:hover::after {
  left: 130%;
}

/* === BADGES === */
.badge {
  border-radius: 999px !important;
  padding: 0.3rem 1rem !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge--ok {
  background: linear-gradient(135deg, #10b981, #22d3ee) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.badge--fail {
  background: linear-gradient(135deg, #ef4444, #f97316) !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.badge--na {
  background: linear-gradient(135deg, #6b7280, #9ca3af) !important;
}

/* === SECTIONS — Content Areas === */
section {
  max-width: 720px !important;
  background: var(--card-solid) !important;
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 0.75rem;
  padding: 1.5rem !important;
  margin: 1rem 0 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Scroll reveal */
section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  z-index: 2 !important;
  position: relative;
}

section.dp-visible {
  opacity: 1;
  transform: translateY(0);
}

/* === SECTION HEADINGS === */
section h2 {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.3rem !important;
  margin-bottom: 0.75rem;
}

section h3 {
  color: var(--accent) !important;
}

/* === TABLES === */
table {
  border-collapse: separate !important;
  border-spacing: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(0, 212, 255, 0.15) !important;
  width: 100%;
}

th {
  background: rgba(0, 212, 255, 0.08) !important;
  color: var(--accent) !important;
  border: none !important;
  border-bottom: 1px solid rgba(0, 212, 255, 0.15) !important;
  padding: 0.65rem 0.5rem !important;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

td {
  border: none !important;
  border-bottom: 1px solid rgba(0, 212, 255, 0.06) !important;
  padding: 0.55rem 0.5rem !important;
  transition: background 0.2s;
}

tr:last-child td {
  border-bottom: none !important;
}

tr:hover td {
  background: rgba(0, 212, 255, 0.04);
}

/* === LINKS IN CONTENT === */
section a,
p a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 212, 255, 0.3);
  transition: border-color 0.2s, color 0.2s;
}

section a:hover,
p a:hover {
  color: var(--accent3);
  border-bottom-color: var(--accent3);
}

/* === CODE BLOCKS === */
pre {
  background: rgba(0, 212, 255, 0.04) !important;
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 0.5rem !important;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

code {
  color: var(--accent);
  background: rgba(0, 212, 255, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  font-size: 0.85em;
}

/* === HORIZONTAL RULES === */
hr {
  border: none !important;
  border-top: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.3), rgba(168, 85, 247, 0.3), transparent) !important;
  margin: 2rem 0 1.5rem !important;
}

/* === FOOTER === */
footer {
  border-top: 1px solid rgba(0, 212, 255, 0.08);
  padding-top: 2rem !important;
}

footer a {
  color: var(--muted) !important;
  transition: color 0.2s;
  border-bottom: none !important;
}

footer a:hover {
  color: var(--accent) !important;
}

/* === PPI RULER — Card outline === */
#card {
  border-color: var(--accent) !important;
  box-shadow: 0 0 20px var(--glow);
  transition: box-shadow 0.3s;
}

#card:hover {
  box-shadow: 0 0 30px var(--glow-strong);
}

#handle {
  background: var(--accent) !important;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* === DIALOGS === */
dialog {
  background: var(--card-solid) !important;
  border: 1px solid rgba(0, 212, 255, 0.15) !important;
  border-radius: 1rem !important;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.4),
    0 0 40px var(--glow) !important;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* === EXIT BUTTON (pixel test) === */
#exitBtn {
  background: var(--gradient) !important;
  border: none !important;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* === SCROLL-TRIGGERED COUNTER ANIMATION === */
.dp-count-up {
  display: inline-block;
}

/* === INTRO TEXT === */
.intro {
  max-width: 720px !important;
  line-height: 1.6;
}

/* === "WHY I BUILT" BOX === */
.info[style*="max-width:480px"] {
  background: var(--gradient-subtle) !important;
  border: 1px solid rgba(0, 212, 255, 0.06);
  border-radius: 0.75rem;
  padding: 1.5rem !important;
  max-width: 720px !important;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
  nav a {
    font-size: 0.75rem !important;
    padding: 0.3rem 0.6rem !important;
  }

  main {
    padding: 1.5rem 1rem !important;
  }

  section {
    padding: 1rem !important;
  }
}

/* === ACCESSIBILITY: reduced motion === */
@media (prefers-reduced-motion: reduce) {
  section {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .metric.dp-pulse {
    animation: none !important;
  }

  button::after {
    display: none;
  }

  #dp-particles {
    display: none;
  }
}
