/* THEMES.CSS - Dark/Light mode, high contrast e design tokens centralizzati */

/* Design Tokens - Sistema Completo */
:root {
  /* ===== COLORS - Neon & Accent ===== */
  --neon-cyan: #00ffe7;
  --neon-magenta: #ff00ea;
  --neon-yellow: #e8e85a;
  --accent: #5ee6d4;
  --neon-cyan-dim: rgba(0, 255, 231, 0.45);
  --neon-magenta-dim: rgba(255, 0, 234, 0.35);
  --neon-cyan-glow: rgba(0, 255, 231, 0.22);
  --neon-magenta-glow: rgba(255, 0, 234, 0.15);
  
  /* ===== COLORS - Background ===== */
  --dark-bg: #06061a;
  --bg-main: rgba(12, 14, 36, 0.72);
  --bg-card: rgba(14, 16, 42, 0.78);
  --box-bg: rgba(14, 16, 42, 0.78);
  --surface-elevated: rgba(18, 22, 52, 0.88);
  --bg-mesh-cyan: rgba(0, 200, 200, 0.12);
  --bg-mesh-magenta: rgba(180, 40, 200, 0.1);
  
  /* ===== COLORS - Text ===== */
  --text-main: #f2f7ff;
  --text-secondary: #9ee8e0;
  --text-muted: rgba(242, 247, 255, 0.68);
  
  /* ===== NAVIGATION ===== */
  --nav-bg: rgba(10, 10, 30, 0.95);
  --nav-border: rgba(0, 255, 231, 0.2);
  --nav-text: #ffffff;
  --nav-accent: #00ffe7;
  --nav-accent-alt: #ff00ea;
  --nav-hover-bg: rgba(0, 255, 231, 0.1);
  --nav-shadow: 0 8px 32px rgba(0, 255, 231, 0.15);
  --nav-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-blur: blur(20px);
  
  /* ===== SPACING ===== */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;
  --spacing-xl: 4rem;
  
  /* ===== TYPOGRAPHY ===== */
  --font-main: 'IBM Plex Sans', system-ui, sans-serif;
  --font-title: 'Orbitron', sans-serif;
  --font-ui: 'Rajdhani', system-ui, sans-serif;
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  
  /* ===== EFFECTS ===== */
  --box-blur: 8px;
  --border-radius: 18px;
  --border-radius-sm: 14px;
  --border-radius-lg: 22px;
  --card-border: 1px solid rgba(0, 255, 231, 0.28);
  
  /* ===== SHADOWS ===== */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-neon-cyan: 0 0 18px var(--neon-cyan), 0 0 40px rgba(0, 255, 231, 0.3);
  --shadow-neon-magenta: 0 0 18px var(--neon-magenta), 0 0 40px rgba(255, 0, 234, 0.3);
  
  /* ===== TRANSITIONS ===== */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* ===== Theme defaults ===== */
  --theme-bg: var(--dark-bg);
  --theme-text: var(--text-main);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --neon-cyan: #00ffff;
    --neon-magenta: #ff00ff;
    --neon-yellow: #ffff00;
    --text-main: #ffffff;
    --text-secondary: #ffffff;
    --bg-main: #000000;
    --bg-card: #000000;
    --dark-bg: #000000;
    --accent: #00ffff;
  }
  
  /* Migliora contrasto per tutti gli elementi */
  .glitch-text,
  .cyber-section h2.section-title,
  .cyber-hero h1 {
    text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan) !important;
  }
  
  .project-card.neon,
  .social-card.neon,
  .ambiente-block.neon-border {
    border-width: 3px;
    box-shadow: 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan) !important;
  }
}

/* Light Theme */
[data-theme="light"] {
  --theme-bg: #f4f6fb;
  --theme-text: #12141c;
  --text-main: #12141c;
  --text-secondary: #2d3340;
  --text-muted: rgba(18, 20, 28, 0.65);
  --bg-main: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.95);
  --surface-elevated: #ffffff;
  --bg-mesh-cyan: rgba(0, 160, 150, 0.08);
  --bg-mesh-magenta: rgba(140, 60, 160, 0.06);
  --neon-cyan-dim: rgba(0, 140, 130, 0.35);
  --neon-magenta-dim: rgba(160, 0, 140, 0.25);
  --card-border: 1px solid rgba(0, 120, 110, 0.25);
  --nav-bg: rgba(255, 255, 255, 0.94);
  --nav-border: rgba(0, 120, 110, 0.15);
}

[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 120% 90% at 10% 0%, var(--bg-mesh-cyan), transparent 50%),
    radial-gradient(ellipse 90% 70% at 90% 20%, var(--bg-mesh-magenta), transparent 45%);
}

/* Light: sezione Software, footer e card scure ereditate dal tema dark */
[data-theme="light"] .software-card {
  background: linear-gradient(145deg, #ffffff, rgba(248, 250, 252, 0.98));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 100, 95, 0.06);
}

[data-theme="light"] .software-card:hover {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 120, 110, 0.12);
}

[data-theme="light"] .software-logo-circle {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 20px rgba(0, 140, 130, 0.25);
}

[data-theme="light"] .software-badge {
  color: var(--text-main);
  background: rgba(0, 140, 130, 0.1);
  text-shadow: none;
  box-shadow: none;
}

[data-theme="light"] .software-card[data-legacy="true"] .software-badge {
  color: var(--text-secondary);
  background: rgba(100, 116, 139, 0.12);
  border-color: #94a3b8;
  text-shadow: none;
}

[data-theme="light"] .software-card[data-private="true"] .software-badge {
  color: #92400e;
  background: rgba(251, 191, 36, 0.15);
  border-color: #d97706;
  text-shadow: none;
}

[data-theme="light"] .software-title,
[data-theme="light"] .software-tagline,
[data-theme="light"] .software-desc {
  color: var(--text-main);
  text-shadow: none;
}

[data-theme="light"] .software-tagline,
[data-theme="light"] .software-desc {
  color: var(--text-muted);
}

[data-theme="light"] .tech-tag {
  color: var(--text-main);
  background: rgba(140, 60, 160, 0.08);
  border-color: rgba(140, 60, 160, 0.35);
  text-shadow: none;
}

[data-theme="light"] .software-link.primary {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 14px rgba(0, 120, 110, 0.25);
}

[data-theme="light"] .software-link.secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  border-color: rgba(0, 120, 110, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .software-link.secondary:hover {
  background: rgba(0, 140, 130, 0.08);
  color: var(--text-main);
  border-color: rgba(0, 120, 110, 0.55);
}

[data-theme="light"] .cyber-footer {
  border-top-color: rgba(0, 120, 110, 0.18);
}

[data-theme="light"] .cyber-footer,
[data-theme="light"] .footer-social a {
  color: var(--text-secondary);
}

[data-theme="light"] .footer-social a:hover {
  color: #0d9488;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .software-logo-circle,
  .software-card,
  .project-card.neon,
  .project-card--detail,
  .glitch-preloader-text,
  .preloader-bar {
    animation: none !important;
  }

  .software-logo-circle {
    transform: none !important;
  }
}

body {
  background-color: var(--theme-bg);
  background-image:
    radial-gradient(ellipse 125% 95% at 6% -8%, var(--bg-mesh-cyan), transparent 52%),
    radial-gradient(ellipse 100% 85% at 94% 6%, var(--bg-mesh-magenta), transparent 48%),
    radial-gradient(ellipse 65% 50% at 50% 100%, rgba(0, 70, 85, 0.22), transparent 55%);
  background-attachment: fixed;
  color: var(--theme-text);
  font-family: var(--font-main);
  transition: background-color 0.4s, color 0.4s;
}

/* ===== SOBER MODE FLOATING TOGGLE BUTTON ===== */
.sober-toggle-floating {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 30, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 231, 0.3);
  border-radius: 50%;
  color: var(--neon-cyan);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 231, 0.2);
  padding: 0;
}

.sober-toggle-floating:hover {
  background: rgba(0, 255, 231, 0.1);
  border-color: var(--neon-cyan);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 255, 231, 0.4);
  transform: scale(1.1);
}

.sober-toggle-floating:active {
  transform: scale(0.95);
}

.sober-toggle-floating svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}

.sober-toggle-floating:hover svg {
  transform: rotate(5deg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sober-toggle-floating {
    bottom: 1.5rem;
    left: 1.5rem;
    width: 44px;
    height: 44px;
  }
  
  .sober-toggle-floating svg {
    width: 20px;
    height: 20px;
  }
}

/* ===== SOBER MODE - Wikipedia-like minimal style ===== */
.sober-mode {
  /* Override theme variables */
  --theme-bg: #ffffff;
  --theme-text: #202122;
  --text-main: #202122;
  --text-secondary: #54595d;
  --text-muted: #72777d;
  --bg-main: #ffffff;
  --bg-card: #f8f9fa;
  --box-bg: #ffffff;
  --nav-bg: #ffffff;
  --nav-text: #202122;
  --nav-border: #a7d7f9;
  --nav-accent: #0645ad;
  --nav-hover-bg: #f8f9fa;
  
  /* Typography - Wikipedia style */
  --font-main: 'Georgia', 'Times New Roman', serif;
  --font-title: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
  
  /* Remove effects */
  --shadow-neon-cyan: none;
  --shadow-neon-magenta: none;
  --box-blur: 0;
}

.sober-mode body {
  background: var(--theme-bg);
  color: var(--theme-text);
  font-family: var(--font-main);
}

/* Hide all visual effects */
.sober-mode .scanlines-overlay,
.sober-mode .noise-overlay,
.sober-mode .flash-overlay,
.sober-mode #bg-canvas,
.sober-mode #custom-cursor,
.sober-mode #cyber-cursor,
.sober-mode #cyber-cursor-follower {
  display: none !important;
}

/* Disable all animations */
.sober-mode *,
.sober-mode *::before,
.sober-mode *::after {
  animation: none !important;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease !important;
}

/* Remove glitch effects */
.sober-mode .glitch-text {
  animation: none !important;
  text-shadow: none !important;
  color: var(--text-main) !important;
  font-family: var(--font-title) !important;
  position: static !important;
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
  white-space: normal !important;
}

.sober-mode .glitch-text::before,
.sober-mode .glitch-text::after,
.sober-mode .glitch-text > span {
  display: none !important;
}

/* Remove neon effects */
.sober-mode .neon,
.sober-mode .neon-card,
.sober-mode .neon-border {
  border: 1px solid #a7d7f9 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
}

.sober-mode .neon:hover,
.sober-mode .neon-card:hover,
.sober-mode .neon-border:hover {
  background: #f8f9fa !important;
  border-color: #0645ad !important;
  transform: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Clean card styles */
.sober-mode .project-card,
.sober-mode .software-card,
.sober-mode .social-card,
.sober-mode .network-card,
.sober-mode .news-card,
.sober-mode .backed-card,
.sober-mode .investor-block,
.sober-mode .ambiente-block,
.sober-mode .signal-panel,
.sober-mode .product-card {
  background: var(--bg-card) !important;
  border: 1px solid #a7d7f9 !important;
  border-radius: 4px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  padding: 1.5rem !important;
  margin-bottom: 1rem !important;
}

/* Clean navigation */
.sober-mode .cyber-header {
  background: var(--nav-bg) !important;
  border-bottom: 1px solid var(--nav-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  backdrop-filter: none !important;
}

.sober-mode .nav-link,
.sober-mode .mobile-nav-link {
  color: var(--nav-text) !important;
  text-shadow: none !important;
}

.sober-mode .nav-link:hover,
.sober-mode .mobile-nav-link:hover {
  color: var(--nav-accent) !important;
  background: var(--nav-hover-bg) !important;
}

.sober-mode .nav-glow,
.sober-mode .burger-glow,
.sober-mode .logo-pulse {
  display: none !important;
}

/* Clean hero section */
.sober-mode .cyber-hero {
  background: var(--bg-main) !important;
  padding: 2rem 0 !important;
}

.sober-mode .hero-title {
  color: var(--text-main) !important;
  font-family: var(--font-title) !important;
  text-shadow: none !important;
  font-size: 2.5rem !important;
}

.sober-mode .hero-bio {
  color: var(--text-secondary) !important;
  font-size: 1.125rem !important;
  line-height: 1.6 !important;
}

/* Clean sections */
.sober-mode .cyber-section {
  background: var(--bg-main) !important;
  padding: 2rem 0 !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
}

.sober-mode .cyber-section h2 {
  color: var(--text-main) !important;
  font-family: var(--font-title) !important;
  text-shadow: none !important;
  font-size: 2rem !important;
  border-bottom: 1px solid #a7d7f9 !important;
  padding-bottom: 0.5rem !important;
  margin-bottom: 1.5rem !important;
}

/* Clean links - Wikipedia blue */
.sober-mode a {
  color: #0645ad !important;
  text-decoration: none !important;
}

.sober-mode a:hover {
  text-decoration: underline !important;
}

.sober-mode a:visited {
  color: #0b0080 !important;
}

/* Clean buttons */
.sober-mode .cyber-btn,
.sober-mode .cta-minimal,
.sober-mode .software-link,
.sober-mode .project-link,
.sober-mode .backed-link {
  background: #0645ad !important;
  color: #ffffff !important;
  border: 1px solid #0645ad !important;
  border-radius: 4px !important;
  padding: 0.5rem 1rem !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.sober-mode .cyber-btn:hover,
.sober-mode .cta-minimal:hover,
.sober-mode .software-link:hover,
.sober-mode .project-link:hover,
.sober-mode .backed-link:hover {
  background: #0b0080 !important;
  border-color: #0b0080 !important;
  transform: none !important;
}

/* Clean footer */
.sober-mode .cyber-footer {
  background: #f8f9fa !important;
  border-top: 1px solid #a7d7f9 !important;
  color: var(--text-secondary) !important;
  padding: 2rem 0 !important;
}

.sober-mode .footer-social a {
  color: var(--text-secondary) !important;
}

.sober-mode .footer-social a:hover {
  color: var(--nav-accent) !important;
}

/* OIN Member Badge in Sober Mode */
.sober-mode .oin-member-badge {
  border-top-color: #a7d7f9 !important;
}

.sober-mode .oin-member-link {
  background: #f8f9fa !important;
  border-color: #a7d7f9 !important;
  color: var(--text-main) !important;
}

.sober-mode .oin-member-link:hover {
  background: #e9ecef !important;
  border-color: #0645ad !important;
  transform: none !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.sober-mode .oin-member-logo {
  filter: none !important;
  opacity: 0.8 !important;
}

.sober-mode .oin-member-link:hover .oin-member-logo {
  opacity: 1 !important;
  filter: none !important;
}

/* Clean toggle button in sober mode */
.sober-mode .sober-toggle-floating {
  background: #ffffff !important;
  color: #0645ad !important;
  border-color: #a7d7f9 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.sober-mode .sober-toggle-floating:hover {
  background: #f8f9fa !important;
  border-color: #0645ad !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  transform: scale(1.05) !important;
}

/* Remove all special effects */
.sober-mode .animated-tilt,
.sober-mode .hero-avatar,
.sober-mode .avatar-gradient {
  transform: none !important;
  animation: none !important;
}

.sober-mode .network-connections,
.sober-mode .connections-svg {
  display: none !important;
}

.sober-mode .ecosystem-orbit__ambient {
  display: none !important;
}

/* Ecosystem Orbit — sober mode */
.sober-mode .ecosystem-orbit__ambient,
.sober-mode .ecosystem-orbit__bonds,
.sober-mode .ecosystem-orbit__controls {
  display: none !important;
}

.sober-mode .ecosystem-orbit__stage {
  background: #fff !important;
  border: 1px solid #a7d7f9 !important;
  box-shadow: none !important;
  min-height: auto !important;
}

.sober-mode .ecosystem-orbit__core,
.sober-mode .ecosystem-orbit__pill,
.sober-mode .ecosystem-orbit__satellite,
.sober-mode .ecosystem-orbit__mobile-core,
.sober-mode .ecosystem-orbit__mobile-card-btn,
.sober-mode .ecosystem-orbit__mobile-project {
  animation: none !important;
  filter: none !important;
  opacity: 1 !important;
}

.sober-mode .ecosystem-orbit__core {
  position: static !important;
  transform: none !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.5rem !important;
  margin: 0.35rem !important;
}

.sober-mode .ecosystem-orbit__core-orb {
  width: auto !important;
  height: auto !important;
  min-width: 2.5rem !important;
  min-height: 2.5rem !important;
  border-radius: 6px !important;
  border: 1px solid #a7d7f9 !important;
  background: #f8f9fa !important;
  box-shadow: none !important;
  color: #202122 !important;
  text-shadow: none !important;
  font-family: sans-serif !important;
}

.sober-mode .ecosystem-orbit__core-caption,
.sober-mode .ecosystem-orbit__pill-label,
.sober-mode .ecosystem-orbit__satellite-label {
  color: #54595d !important;
  text-shadow: none !important;
}

.sober-mode .ecosystem-orbit__ring,
.sober-mode .ecosystem-orbit__satellites {
  position: static !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.5rem 1rem 1rem !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  height: auto !important;
  max-width: none !important;
}

.sober-mode .ecosystem-orbit.is-expanded .ecosystem-orbit__satellites {
  display: flex !important;
}

.sober-mode .ecosystem-orbit__pill,
.sober-mode .ecosystem-orbit__satellite {
  position: static !important;
  transform: none !important;
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  min-height: auto !important;
  border-radius: 6px !important;
  border: 1px solid #a7d7f9 !important;
  background: #f8f9fa !important;
  box-shadow: none !important;
  color: #202122 !important;
  font-size: 0.95rem !important;
}

.sober-mode .ecosystem-orbit__stage {
  display: flex !important;
  flex-direction: column !important;
}

.sober-mode .ecosystem-orbit.is-mobile .ecosystem-orbit__mobile {
  padding: 1rem !important;
}

.sober-mode .ecosystem-orbit__mobile-core,
.sober-mode .ecosystem-orbit__mobile-card-btn,
.sober-mode .ecosystem-orbit__mobile-project,
.sober-mode .ecosystem-orbit__tree-btn {
  background: #fff !important;
  border: 1px solid #a7d7f9 !important;
  color: #202122 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.sober-mode .ecosystem-orbit__tree-children {
  border-left-color: #a7d7f9 !important;
}

.sober-mode .ecosystem-orbit__detail {
  background: #fff !important;
  border: 1px solid #a7d7f9 !important;
  box-shadow: none !important;
  border-radius: 6px !important;
}

.sober-mode .ecosystem-orbit__detail-title,
.sober-mode .ecosystem-orbit__detail-text {
  color: #202122 !important;
}

.sober-mode .ecosystem-orbit__detail-meta {
  color: #54595d !important;
}

.sober-mode .ecosystem-orbit__detail-cta {
  background: #f8f9fa !important;
  border-color: #a7d7f9 !important;
  color: #202122 !important;
  box-shadow: none !important;
}

.sober-mode .ecosystem-orbit__detail-close {
  background: #f8f9fa !important;
  color: #54595d !important;
}

.sober-mode .ecosystem-section::before {
  display: none !important;
}

.sober-mode .ecosystem-section .section-subtitle {
  color: #54595d !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* Clean typography */
.sober-mode p,
.sober-mode .software-desc,
.sober-mode .project-desc,
.sober-mode .social-desc {
  color: var(--text-main) !important;
  line-height: 1.6 !important;
  font-size: 1rem !important;
}

.sober-mode .about-quote {
  color: var(--text-secondary) !important;
  font-style: italic !important;
  text-shadow: none !important;
  border-left: 3px solid #a7d7f9 !important;
  padding-left: 1rem !important;
  margin: 1.5rem 0 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sober-mode .cyber-section {
    padding: 1.5rem 1rem !important;
  }
  
  .sober-mode .hero-title {
    font-size: 2rem !important;
  }
}
