/*
 * Braden Riggins Personal Website
 * Design System - Modern, Clean, Professional
 * Accent: #0070BB (Blue)
 */

/* ===== CSS RESET & MODERN BASELINE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
}

ul {
  padding-left: 3rem;
}

/* ===== CSS CUSTOM PROPERTIES (DESIGN TOKENS) ===== */
:root {
  /* Colors - Light Mode */
  --accent-blue: #0070BB;
  --accent-blue-dark: #005A99;
  --accent-blue-light: #3399DD;

  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FA;
  --bg-tertiary: #E9ECEF;

  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-tertiary: #6C757D;

  --border-color: #DEE2E6;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Inter', -apple-system, sans-serif;

  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1060;

  /* Semantic Colors */
  --color-success: #10B981;
  --color-success-light: #D1FAE5;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-error: #EF4444;
  --color-error-light: #FEE2E2;
  --color-focus: var(--accent-blue);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #0F1419;
  --bg-secondary: #16181D;
  --bg-tertiary: #1C1F26;

  --text-primary: #E7E9EA;
  --text-secondary: #B8BBBF;
  --text-tertiary: #7A8389;

  --border-color: #2F3336;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Accent colors - slightly lighter for better visibility on dark backgrounds */
  --accent-blue-light: #66B2FF;
}

/* Reduced Motion Preference */
@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;
  }
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* Heading Size Utilities */
.h5-size { font-size: 1.125rem; }
.h6-size { font-size: 1rem; }

/* Stat Numbers - Large display numbers for metrics */
.stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-number-lg {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-blue-dark);
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== GRADIENT TEXT UTILITIES ===== */
.gradient-text {
  color: var(--text-primary); /* Fallback if CSS fails */
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block; /* Fix for Safari/iOS gradient text bug */
  text-shadow: 0px 0px transparent; /* Additional Safari/iOS fix */
}

.gradient-text-red {
  color: #7f1d1d; /* Fallback if CSS fails */
  background: linear-gradient(135deg, #7f1d1d 0%, #f87171 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block; /* Fix for Safari/iOS gradient text bug */
  text-shadow: 0px 0px transparent; /* Additional Safari/iOS fix */
}

/* ===== LAYOUT UTILITIES ===== */
.container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 1500px;
}

.container-narrow {
  max-width: 950px;
}

.section {
  padding: var(--space-3xl) 0;
}

.section-sm {
  padding: var(--space-2xl) 0;
}

.section-lg {
  padding: 5rem 0;
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-lg);
  width: 100%;
  margin: 0 auto;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

@media (min-width: 768px) {
  .grid-md-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 1200px;
    margin: 0 auto;
  }
  .grid-md-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ===== NAVIGATION ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-base);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);

  /* Glassy bento box container */
  background: linear-gradient(135deg, rgba(0, 112, 187, 0.08) 0%, rgba(51, 153, 221, 0.12) 100%);
  border: 1px solid rgba(0, 112, 187, 0.2);
  border-radius: 16px;
  padding: var(--space-sm);
  box-shadow: 0 2px 8px rgba(0, 112, 187, 0.08);
  transition: all 0.3s ease;

  /* Align with hero content card left border */
  margin-left: 0.5rem;
}

[data-theme="dark"] .logo {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.logo img {
  height: 40px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-blue);
  transition: width var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-blue);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Mobile Menu */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 4px 0;
  transition: all var(--transition-base);
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 61px;
    right: -100%;
    width: 100%;
    max-width: 300px;
    height: calc(100vh - 61px);
    background: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    transition: right var(--transition-base);
  }

  .nav-links.active {
    right: 0;
  }

  .mobile-menu-toggle {
    display: block;
  }
}

/* Dark Mode Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
  color: var(--accent-blue);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  background: var(--accent-blue);
  color: white;
  transform: scale(1.1);
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

[data-theme="dark"] .theme-toggle {
  color: var(--accent-blue-light);
}

[data-theme="dark"] .theme-toggle:hover {
  color: white;
}

/* Gamification Toggle */
#gamification-toggle {
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  padding: 0;
  flex-shrink: 0;
  color: var(--accent-blue);
}

#gamification-toggle svg.gamification-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  transition: transform 0.3s ease;
}

#gamification-toggle:hover {
  background: rgba(255, 215, 0, 0.1);
  transform: scale(1.1);
}

#gamification-toggle.active {
  background: rgba(255, 215, 0, 0.2);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  }
}

#gamification-toggle:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

#gamification-toggle:hover .gamification-icon {
  transform: rotate(15deg);
}

#gamification-toggle.active .gamification-icon {
  animation: wiggle 1s infinite;
}

[data-theme="dark"] #gamification-toggle {
  color: var(--accent-blue-light);
}

[data-theme="dark"] #gamification-toggle:hover {
  color: var(--accent-blue-light);
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* Glassy Tooltip Bubbles */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1),
              0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
}

[data-tooltip]::after {
  content: '';
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Dark mode tooltip styles */
[data-theme="dark"] [data-tooltip]::before {
  background: rgba(30, 35, 40, 0.95);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] [data-tooltip]::after {
  border-bottom-color: rgba(30, 35, 40, 0.95);
}

/* Dark Mode Navigation Enhancements */
[data-theme="dark"] .navbar {
  background: rgba(15, 20, 25, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .nav-link::after {
  background: var(--accent-blue-light);
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
  color: var(--accent-blue-light);
}

[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

[data-theme="dark"] .theme-toggle:hover {
  background: var(--accent-blue);
  color: white;
}

[data-theme="dark"] #gamification-toggle {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] #gamification-toggle:hover {
  background: rgba(255, 215, 0, 0.15);
}

[data-theme="dark"] #gamification-toggle.active {
  background: rgba(255, 215, 0, 0.25);
}

@media (max-width: 768px) {
  [data-theme="dark"] .nav-links {
    background: rgba(15, 20, 25, 0.98);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
  }
}

/* ===== HERO SECTION ===== */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Dark Mode Hero Enhancements */
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, rgba(15, 20, 25, 1) 0%, rgba(22, 24, 29, 1) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.hero-logo {
  width: 200px;
  height: auto;
  margin: 0 auto var(--space-xl);
  animation: fadeInUp 0.8s ease;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease 0.2s backwards;
}

.hero-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.8s ease 0.4s backwards;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  border: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Push buttons to bottom of card */
.card .btn {
  margin-top: auto;
}

/* Project Card - Specific layout for project cards */
.project-card {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 0;
}

.project-card .card-image {
  border: 2px solid var(--border-color);
}

.card-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .card-glass {
  background: rgba(22, 24, 29, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark Mode Card Enhancements */
[data-theme="dark"] .card {
  background: var(--bg-secondary);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .card-image {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Link wrapper for card images - remove default link styles */
.card a {
  display: block;
  text-decoration: none;
  margin-bottom: var(--space-md);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 0;
  cursor: pointer;
  display: block;
  vertical-align: top;
}

.card-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.card-description {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.card-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  margin-bottom: var(--space-md);
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--space-sm);
}

.card-tags::-webkit-scrollbar {
  display: none;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue-light) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 112, 187, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent-blue);
  color: var(--accent-blue);
}

.btn-outline:hover {
  background: var(--accent-blue);
  color: white;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* Dark Mode Button Enhancements */
[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 112, 187, 0.4);
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-blue-light) 0%, var(--accent-blue) 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(51, 153, 221, 0.4);
}

[data-theme="dark"] .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .btn-outline {
  border-color: var(--accent-blue-light);
  color: var(--accent-blue-light);
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

/* ===== FORMS ===== */
.form-input,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color var(--transition-fast);
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.form-error {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.form-error::before {
  content: "⚠";
  flex-shrink: 0;
}

.form-input:invalid:not(:placeholder-shown),
.form-textarea:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
}

/* Dark Mode Form Enhancements */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-textarea {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-textarea:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-blue-light);
  box-shadow: 0 0 0 3px rgba(51, 153, 221, 0.15);
}

[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder {
  color: var(--text-tertiary);
}

/* ===== TAGS/BADGES ===== */
.tag {
  display: inline-block;
  padding: 0.25rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.2;
}

.tag-accent {
  background: rgba(0, 112, 187, 0.1);
  color: var(--accent-blue);
}

/* Dark Mode Tags */
[data-theme="dark"] .tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

[data-theme="dark"] .tag-accent {
  background: rgba(0, 112, 187, 0.2);
  color: var(--accent-blue-light);
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
  padding: 0;
  overflow: hidden;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: var(--z-modal-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-content {
  position: relative;
  z-index: var(--z-modal);
  width: 90%;
  height: 90%;
  max-width: 1400px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

/* Panzoom Container - CRITICAL for proper zoom/pan */
.panzoom-parent {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

.modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  cursor: grab;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  /* Hardware acceleration */
  transform: translateZ(0);
  will-change: transform;
  -webkit-user-drag: none;
}

.modal-image:active {
  cursor: grabbing;
}

.modal-close {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all var(--transition-fast);
  z-index: calc(var(--z-modal) + 1);
  pointer-events: auto;
}

.modal-close:hover {
  background: var(--accent-blue);
  transform: rotate(90deg);
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: calc(var(--z-modal) + 1);
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  border-radius: 30px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.zoom-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  user-select: none;
}

.zoom-btn:hover,
.zoom-btn:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: white;
  transform: scale(1.1);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-btn[data-action="reset"] {
  width: auto;
  padding: 0 20px;
  border-radius: 20px;
  font-size: 0.875rem;
}

/* Zoom Hint */
.zoom-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  margin: 0;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  pointer-events: none;
  z-index: calc(var(--z-modal) + 1);
  animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Handle very tall images */
@media (max-aspect-ratio: 1/2) {
  .modal-image {
    max-height: 90vh;
    width: auto;
  }
}

/* Handle very wide images */
@media (min-aspect-ratio: 3/1) {
  .modal-image {
    max-width: 90vw;
    height: auto;
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .zoom-controls {
    bottom: 10px;
  }

  .zoom-hint {
    font-size: 0.75rem;
  }
}

/* Accessibility: Focus visible for zoom controls */
.zoom-btn:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

/* ===== PROJECT DETAIL LAYOUTS ===== */
.project-hero {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-dark) 100%);
  color: white;
  padding: var(--space-3xl) 0;
  text-align: center;
}

.project-hero h1 {
  color: white;
  margin-bottom: var(--space-md);
}

.project-hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.25rem;
  max-width: 800px;
  margin: 0 auto;
}

/* Dark Mode Project Hero - Enhanced gradient */
[data-theme="dark"] .project-hero {
  background: linear-gradient(135deg, #005A99 0%, #003d6b 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.project-content {
  padding: var(--space-3xl) 0;
}

.project-section {
  margin-bottom: var(--space-3xl);
}

.project-section h2 {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--accent-blue);
}

.project-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.project-image-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.project-image-container:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.project-image {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.footer-section {
  text-align: left;
}

.footer-section h3 {
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
  padding-left: 0;
  text-align: left;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-blue);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-md);
  margin-top: var(--space-md);
  border-top: 1px solid var(--border-color);
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Dark Mode Footer Enhancements */
[data-theme="dark"] .footer {
  background: var(--bg-secondary);
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .footer-links a:hover {
  color: var(--accent-blue-light);
}

/* Dark Mode SVG Icon Enhancements */
[data-theme="dark"] svg {
  color: var(--text-primary);
}

[data-theme="dark"] .card svg,
[data-theme="dark"] section svg {
  color: var(--accent-blue-light);
}

/* Dark Mode Section Background Enhancements */
[data-theme="dark"] section[style*="background: var(--bg-secondary)"] {
  background: var(--bg-tertiary) !important;
}

/* Dark Mode Modal Enhancements */
[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .modal-close {
  background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] .modal-close:hover {
  background: var(--accent-blue);
}

[data-theme="dark"] .zoom-controls {
  background: rgba(0, 0, 0, 0.85);
}

/* Dark Mode Project Image Container */
[data-theme="dark"] .project-image-container {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .project-image-container:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Dark Mode Contact Page Specific Enhancements */
[data-theme="dark"] .contact-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .contact-card:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .contact-icon {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-dark) 100%);
  box-shadow: 0 4px 12px rgba(0, 112, 187, 0.3);
}

/* Dark Mode Link Enhancements */
[data-theme="dark"] a {
  color: var(--accent-blue-light);
}

[data-theme="dark"] a:hover {
  color: #88C6FF;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.6s ease;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease;
}

/* Scroll-triggered animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.hidden { display: none !important; }
.visible { display: block !important; }

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

/* Skip to Content Link */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent-blue);
  color: white;
  padding: var(--space-sm) var(--space-md);
  z-index: calc(var(--z-modal) + 100);
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) 0;
  transition: top var(--transition-fast);
  opacity: 0;
}

.skip-to-content:focus {
  top: 0;
  opacity: 1;
}

/* Enhanced Focus Indicators */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ===== TWO-COLUMN LAYOUTS ===== */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

@media (min-width: 768px) {
  .two-col-layout {
    grid-template-columns: repeat(2, 1fr);
  }
}

.two-col-layout.align-center {
  align-items: center;
}

/* Split Section - Alternating image/text layouts */
.split-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  align-items: center;
  margin-bottom: var(--space-3xl);
}

@media (min-width: 768px) {
  .split-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .split-section.reverse {
    direction: rtl;
  }

  .split-section.reverse > * {
    direction: ltr;
  }
}

/* Image-Text Split - Specific for project pages */
.image-text-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  align-items: center;
  margin: var(--space-2xl) 0;
}

@media (min-width: 768px) {
  .image-text-split {
    grid-template-columns: 45% 55%;
  }

  .image-text-split.text-first {
    grid-template-columns: 55% 45%;
  }
}

.image-text-split img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Sidebar Layout - For contact forms */
.sidebar-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

@media (min-width: 968px) {
  .sidebar-layout {
    grid-template-columns: 1fr 400px;
  }

  .sidebar-layout.sidebar-left {
    grid-template-columns: 400px 1fr;
  }
}

/* ===== TIMELINE MOBILE RESPONSIVENESS ===== */
/* Target the Professional Experience timeline and make it mobile-friendly */
@media (max-width: 767px) {
  /* Hide the center timeline line on mobile */
  .container > div[style*="max-width: 1000px"] > div[style*="position: absolute"][style*="left: 50%"] {
    display: none !important;
  }

  /* Stack timeline cards vertically with full width */
  .container > div[style*="max-width: 1000px"] > div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] {
    display: block !important;
    margin-top: 0 !important;
  }

  /* Make all timeline card containers full width */
  .container > div[style*="max-width: 1000px"] > div[style*="display: grid"] > div {
    display: block !important;
    width: 100% !important;
    margin-bottom: var(--space-xl);
  }

  /* Ensure cards themselves take full width */
  .container > div[style*="max-width: 1000px"] .card {
    width: 100%;
    max-width: 100%;
  }

  /* Center company logos on mobile */
  .container > div[style*="max-width: 1000px"] .card > div[style*="margin-bottom"][style*="display: flex"] {
    justify-content: center !important;
  }

  /* Hide the "Fun Fact" badge and bubble on mobile for cleaner layout */
  .container > div[style*="max-width: 1000px"] .card > div[style*="position: absolute"][style*="top: -25px"],
  .container > div[style*="max-width: 1000px"] .card > div[style*="position: absolute"][style*="top: 20px"] {
    display: none !important;
  }

  /* Center the cheeky footnote card on mobile */
  .container > div[style*="max-width: 1000px"] > div[style*="margin-top"][style*="justify-content: center"] {
    margin-top: var(--space-xl) !important;
  }

  /* ===== ABOUT PAGE HERO CENTERING ===== */
  /* Center headshot image on mobile */
  .grid.grid-md-2 > div[style*="margin-left: var(--space-2xl)"] {
    margin-left: 0 !important;
    text-align: center;
  }

  /* Reduce headshot size on mobile and center it */
  .grid.grid-md-2 > div[style*="margin-left: var(--space-2xl)"] img[src*="headshot"] {
    max-width: 250px !important;
    display: block !important;
    margin: 0 auto !important;
  }

  /* Center typing animation and subtext on mobile */
  .grid.grid-md-2 > div[style*="margin-left: calc"] {
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: center;
  }
}

/* ========================================
   SWEETALERT DARK MODE SUPPORT
   ======================================== */

/* Dark mode styling for SweetAlert popups */
.swal-dark-mode {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
}

.swal-dark-mode .swal2-title {
  color: #e0e0e0 !important;
}

.swal-dark-mode .swal2-html-container {
  color: #e0e0e0 !important;
}
