/* CSS Custom Properties */
:root {
  --color-primary: #05D75F;
  --color-primary-rgb: 5, 215, 95;
  --color-bg: rgba(0, 0, 48, 1);
  --color-bg-dark: rgba(0, 0, 30, 0.95);
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-text-subtle: rgba(255, 255, 255, 0.05);
  --z-layer-back: 1;
  --z-layer-front: 2;
  --z-ui: 100;
  --z-modal: 1000;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-text-subtle);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--color-primary-rgb), 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--color-primary-rgb), 0.6);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--color-primary-rgb), 0.4) var(--color-text-subtle);
}

body {
  min-height: 100vh;
  background: var(--color-bg);
  display: grid;
  place-content: center;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Project Logo */
.project-logo {
  position: fixed;
  top: 16px;
  left: 16px;
  /* max-height: 40px;
  max-width: 120px; */
  width: auto;
  height: auto;
  z-index: var(--z-ui);
  pointer-events: none;
}

/* Main container for atom + filters */
.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100vh;
  padding: 60px 16px 16px;
  box-sizing: border-box;
}

/* Wrapper for both layers */
.atom-wrapper {
  position: relative;
  width: min(calc(100vh - 160px), calc(100vw - 32px), 1000px);
  aspect-ratio: 1;
  flex-shrink: 0;
}

/* Layer base - stacked on top of each other */
.layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Back layer - Empty electrons */
.layer--back {
  z-index: var(--z-layer-back);
  filter: blur(6px);
}

/* Front layer - Active electrons */
.layer--front {
  z-index: var(--z-layer-front);
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Orbit Rings */
.orbit {
  stroke: rgba(var(--color-primary-rgb), 0.08);
  stroke-width: 6;
  fill: none;
}

/* Electron background circle - creates local solid bg for metaball effect */
.electron-bg {
  fill: #0d1b2a;
}

/* Electrons - all same green */
.electron {
  fill: var(--color-primary);
  cursor: pointer;
  transition: fill 0.3s ease;
}

.electron--active {
  fill: var(--color-primary);
}

.electron--muted {
  fill: var(--color-primary);
  cursor: default;
}

.electron--empty {
  fill: var(--color-primary);
  cursor: default;
}

/* Focus styles for keyboard accessibility */
.electron:focus {
  outline: none;
  stroke: #ffffff;
  stroke-width: 4;
}

.electron:focus-visible {
  stroke: #ffffff;
  stroke-width: 4;
}

/* Hover text in center */
.hover-text {
  fill: #ffffff;
  font-size: 48px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.hover-text--visible {
  opacity: 1;
}

/* Filter Pills */
.filter-pills {
  display: none;
  gap: 8px;
  padding: 12px 16px;
  justify-content: center;
  flex-wrap: wrap;
  background: transparent;
  width: 100%;
}

@media (min-width: 768px) {
  .filter-pills {
    display: flex;
  }
}

.filter-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.1);
}

.filter-pill--active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.filter-pill--reset {
  border-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.8);
}

.filter-pill--reset:hover {
  border-color: #ffffff;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}


/* Mobile Filter Toggle */
.filter-toggle {
  display: block;
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--color-primary);
  background: rgba(1, 2, 4, 0.9);
  color: var(--color-primary);
  font-size: 14px;
  cursor: pointer;
  z-index: var(--z-ui);
  transition: all 0.2s ease;
}

.filter-toggle:hover {
  background: rgba(var(--color-primary-rgb), 0.1);
}

.filter-toggle--active {
  background: rgba(var(--color-primary-rgb), 0.2);
}

@media (min-width: 768px) {
  .filter-toggle {
    display: none;
  }
}

/* Mobile Filter Dropdown */
.filter-mobile {
  display: none;
  position: fixed;
  top: 60px;
  right: 16px;
  background: rgba(1, 2, 4, 0.95);
  border: 1px solid rgba(var(--color-primary-rgb), 0.3);
  border-radius: 12px;
  padding: 12px;
  z-index: var(--z-ui);
  max-width: 280px;
}

.filter-mobile--visible {
  display: block;
}

.filter-mobile-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-mobile-pills .filter-pill {
  width: 100%;
  text-align: center;
}

@media (min-width: 768px) {
  .filter-mobile {
    display: none !important;
  }
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 6px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.6);
  background: transparent;
  color: var(--color-primary);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(var(--color-primary-rgb), 0.15);
  border-color: var(--color-primary);
}

.btn:active {
  background: rgba(var(--color-primary-rgb), 0.25);
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #010204;
}

.btn--primary:hover {
  background: #27ae60;
  border-color: #27ae60;
}

.btn--primary:active {
  background: #229954;
}

.btn--small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn--large {
  padding: 16px 32px;
  font-size: 18px;
}

/* Modal Overlay */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: var(--z-modal);
}

.modal--visible {
  opacity: 1;
  visibility: visible;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-close-icon {
  width: 20px;
  height: 20px;
}

.modal-content {
  max-width: 1000px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 40px;
  color: #fff;
}

.modal-topic {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-primary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.2;
}

.modal-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 24px;
  display: none;
}

.modal-image--visible {
  display: block;
}

.modal-description {
  font-size: 18px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

.modal-link {
  display: none;
  margin-top: 24px;
  text-decoration: none;
}

.modal-link--visible {
  display: inline-block;
}

/* Accessibility Toggle & Panel */
.a11y-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  z-index: var(--z-ui);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.a11y-toggle:hover {
  transform: scale(1.1);
}

.a11y-icon {
  width: 100%;
  height: 100%;
  filter: brightness(0) saturate(100%) invert(72%) sepia(52%) saturate(501%) hue-rotate(88deg) brightness(97%) contrast(96%);
}

.a11y-panel {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: rgba(1, 2, 4, 0.95);
  border: 1px solid var(--color-primary);
  border-radius: 12px;
  padding: 16px 20px;
  z-index: var(--z-ui);
  min-width: 200px;
}

.a11y-panel--visible {
  display: block;
}

.a11y-panel h3 {
  color: var(--color-primary);
  font-size: 14px;
  margin: 0 0 12px 0;
  font-weight: 600;
}

.a11y-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.a11y-panel li {
  color: #ffffff;
  font-size: 13px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.a11y-panel li:last-child {
  margin-bottom: 0;
}

.a11y-panel kbd {
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-primary);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  min-width: 60px;
  text-align: center;
}
