/* ======================
   Custom Properties
   ====================== */
:root {
  /* Primary */
  --color-primary: #007bff;
  --color-primary-hover: #006ee4;
  --color-primary-dark: #005bc4;
  --color-accent: #5ba8ff;
  --color-accent-light: #89c4ff;

  /* Semantic */
  --color-success: #0f9d58;
  --color-error: #ff6b6b;
  --color-gold: #f0c040;

  /* Backgrounds */
  --bg-body: #0a0921;
  --bg-card: #1a1a2e;
  --bg-card-alt: #1c1c3a;
  --bg-code: #12121f;
  --bg-footer: #060515;

  /* Text */
  --text-primary: #e0e0e0;
  --text-heading: #fff;
  --text-secondary: #ccc;
  --text-muted: #b0b0b0;
  --text-dim: #999;
  --text-dimmer: #888;
  --text-subtle: #666;
  --text-faint: #555;

  /* Borders */
  --border-color: #333;
  --border-light: #444;

  /* Theme-aware (hardcoded overrides) */
  --bg-nav-mobile: rgba(10, 9, 33, 0.95);
  --shadow-nav: 0 2px 12px rgba(0, 0, 0, 0.5);
  --bg-tag: rgba(0, 123, 255, 0.15);
  --bg-tag-hover: rgba(0, 123, 255, 0.25);
  --border-subtle: rgba(51, 51, 51, 0.5);
  --bg-detail-gradient: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(28, 28, 58, 0.6) 100%);
  --border-detail-accent: rgba(0, 123, 255, 0.2);
  --skeleton-from: #1a1a2e;
  --skeleton-mid: #252542;
  --table-separator: #2a2a40;
  --landing-gradient-1: rgba(0, 123, 255, 0.20);
  --landing-gradient-2: rgba(91, 168, 255, 0.14);
  --landing-gradient-3: rgba(22, 36, 71, 0.8);

  /* Shadows */
  --shadow-primary-sm: 0 2px 8px rgba(0, 123, 255, 0.3);
  --shadow-primary-md: 0 4px 16px rgba(0, 123, 255, 0.15);
  --shadow-primary-lg: 0 8px 24px rgba(0, 123, 255, 0.15);
  --shadow-cta: 0 4px 16px rgba(0, 123, 255, 0.3);
  --shadow-toggle-mobile: 0 2px 8px rgba(0, 0, 0, 0.2);

  /* Primary backgrounds (opacity variants) */
  --bg-primary-faint: rgba(0, 123, 255, 0.08);
  --bg-primary-light: rgba(0, 123, 255, 0.1);
  --bg-primary-subtle: rgba(0, 123, 255, 0.15);
  --bg-primary-medium: rgba(0, 123, 255, 0.2);
  --bg-primary-strong: rgba(0, 123, 255, 0.3);

  /* Accent backgrounds */
  --bg-accent-faint: rgba(91, 168, 255, 0.08);
  --bg-accent-light: rgba(91, 168, 255, 0.1);

  /* Success/Error feedback */
  --bg-success-subtle: rgba(15, 157, 88, 0.15);
  --border-success-subtle: rgba(15, 157, 88, 0.3);
  --glow-success: 0 0 6px rgba(15, 157, 88, 0.5);
  --glow-success-strong: 0 0 12px rgba(15, 157, 88, 0.8), 0 0 4px rgba(15, 157, 88, 0.4);
  --bg-error-faint: rgba(255, 107, 107, 0.08);
  --bg-error-subtle: rgba(255, 107, 107, 0.15);
  --border-error-subtle: rgba(255, 107, 107, 0.3);

  /* Table / Nav */
  --bg-table-even: rgba(255, 255, 255, 0.02);
  --bg-hover-overlay: rgba(255, 255, 255, 0.1);
  --border-nav-mobile-top: rgba(255, 255, 255, 0.08);
}

/* Light Theme */
[data-theme="light"] {
  --color-primary: #0066d6;
  --color-primary-hover: #005bc4;
  --color-primary-dark: #004da8;
  --color-accent: #0066d6;
  --color-accent-light: #3d8bdb;
  --color-success: #0a7c46;
  --color-error: #d93025;
  --color-gold: #c09000;
  --bg-body: #f5f5f7;
  --bg-card: #fff;
  --bg-card-alt: #f0f0f5;
  --bg-code: #f5f5f5;
  --bg-footer: #e8e8ec;
  --text-primary: #1d1d1f;
  --text-heading: #000;
  --text-secondary: #333;
  --text-muted: #555;
  --text-dim: #666;
  --text-dimmer: #777;
  --text-subtle: #999;
  --text-faint: #aaa;
  --border-color: #d1d1d6;
  --border-light: #c0c0c5;
  --bg-nav-mobile: rgba(245, 245, 247, 0.95);
  --shadow-nav: 0 2px 12px rgba(0, 0, 0, 0.1);
  --bg-tag: rgba(0, 102, 214, 0.1);
  --bg-tag-hover: rgba(0, 102, 214, 0.18);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --bg-detail-gradient: linear-gradient(135deg, rgba(240, 240, 245, 0.9) 0%, rgba(255, 255, 255, 0.8) 100%);
  --border-detail-accent: rgba(0, 102, 214, 0.25);
  --skeleton-from: #e0e0e5;
  --skeleton-mid: #f0f0f5;
  --table-separator: #d1d1d6;
  --landing-gradient-1: rgba(0, 102, 214, 0.08);
  --landing-gradient-2: rgba(61, 139, 219, 0.06);
  --landing-gradient-3: rgba(245, 245, 247, 0.5);

  /* Shadows */
  --shadow-primary-sm: 0 2px 8px rgba(0, 102, 214, 0.2);
  --shadow-primary-md: 0 4px 16px rgba(0, 102, 214, 0.1);
  --shadow-primary-lg: 0 8px 24px rgba(0, 102, 214, 0.1);
  --shadow-cta: 0 4px 16px rgba(0, 102, 214, 0.2);
  --shadow-toggle-mobile: 0 2px 8px rgba(0, 0, 0, 0.1);

  /* Primary backgrounds */
  --bg-primary-faint: rgba(0, 102, 214, 0.05);
  --bg-primary-light: rgba(0, 102, 214, 0.08);
  --bg-primary-subtle: rgba(0, 102, 214, 0.1);
  --bg-primary-medium: rgba(0, 102, 214, 0.15);
  --bg-primary-strong: rgba(0, 102, 214, 0.2);

  /* Accent backgrounds */
  --bg-accent-faint: rgba(61, 139, 219, 0.06);
  --bg-accent-light: rgba(61, 139, 219, 0.08);

  /* Success/Error feedback */
  --bg-success-subtle: rgba(10, 124, 70, 0.12);
  --border-success-subtle: rgba(10, 124, 70, 0.25);
  --glow-success: 0 0 6px rgba(10, 124, 70, 0.3);
  --glow-success-strong: 0 0 12px rgba(10, 124, 70, 0.5), 0 0 4px rgba(10, 124, 70, 0.2);
  --bg-error-faint: rgba(217, 48, 37, 0.06);
  --bg-error-subtle: rgba(217, 48, 37, 0.1);
  --border-error-subtle: rgba(217, 48, 37, 0.2);

  /* Table / Nav */
  --bg-table-even: rgba(0, 0, 0, 0.02);
  --bg-hover-overlay: rgba(0, 0, 0, 0.05);
  --border-nav-mobile-top: rgba(0, 0, 0, 0.08);
}

/* Transición suave de tema (solo se activa vía JS al hacer toggle) */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* Base / Reset */
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

* {
  margin: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Footer siempre al fondo — portfolio SPA */
#main-content {
  flex: 1;
}

.supercontainer {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Accesibilidad */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 100;
  background: var(--color-primary);
  color: var(--text-heading);
  padding: 0.5rem 1rem;
  border-radius: 0 0 4px 0;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}
