/* ==========================================================================
   Design Token System
   Single source of truth for all visual properties across light and dark themes.
   Requirements: 1.1, 1.2, 1.3
   ========================================================================== */

:root {
  /* Brand Gradient Palette */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-hero: linear-gradient(135deg, #0c0d1a 0%, #1a1b3a 50%, #2d1b69 100%);

  /* Surface Colors - Light Theme */
  --surface-primary: #ffffff;
  --surface-secondary: #f8f9fc;
  --surface-elevated: rgba(255, 255, 255, 0.7);
  --surface-glass: rgba(255, 255, 255, 0.25);

  /* Text Colors */
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #6a6a8a;
  --text-inverse: #ffffff;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-blur: 12px;
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);

  /* Soft Shadows */
  --shadow-sm: 0 2px 8px rgba(99, 99, 140, 0.08);
  --shadow-md: 0 4px 16px rgba(99, 99, 140, 0.12);
  --shadow-lg: 0 8px 32px rgba(99, 99, 140, 0.16);
  --shadow-xl: 0 16px 48px rgba(99, 99, 140, 0.2);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);

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

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing Scale (8px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

/* Dark Theme Overrides - Requirement 1.2 */
[data-theme="dark"] {
  --surface-primary: #0f0f1a;
  --surface-secondary: #1a1a2e;
  --surface-elevated: rgba(26, 26, 46, 0.8);
  --surface-glass: rgba(255, 255, 255, 0.05);

  --text-primary: #e8e8f0;
  --text-secondary: #a8a8c8;
  --text-muted: #8585ad;

  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Theme Toggle Button
   Requirements: 2.1, 2.6
   ========================================================================== */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background-color var(--duration-fast) var(--ease-out-expo);
  margin-left: var(--space-2);
}

.theme-toggle:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.theme-toggle__icon {
  line-height: 1;
}

.theme-toggle__icon--dark {
  display: none;
}

/* ==========================================================================
   Glassmorphism Card Component
   Requirements: 3.1, 3.2, 3.3, 9.4
   ========================================================================== */

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: var(--space-6);
}

.glass-card--hoverable {
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

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

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(1px)) {
  .glass-card {
    background: rgba(255, 255, 255, 0.85);
  }

  [data-theme="dark"] .glass-card {
    background: rgba(26, 26, 46, 0.9);
  }
}

/* ==========================================================================
   Scroll-Driven Entrance Animations
   Requirements: 4.1, 4.4, 7.1, 7.4, 8.4
   ========================================================================== */

/* Only hide elements when JS is confirmed working.
   The ScrollAnimator adds 'js-scroll-ready' to <html> on init.
   Without JS, everything stays visible. */
.js-scroll-ready .animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  will-change: transform, opacity;
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

/* Hero content should always be visible immediately — it's above the fold */
.hero .animate-on-scroll {
  opacity: 1;
  transform: none;
}

.js-scroll-ready .hero .animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
}

.hero .animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Respect reduced motion preferences - Requirement 4.4, 8.4 */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .js-scroll-ready .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }
}


/* ==========================================================================
   Dark Mode Overrides for Legacy Styles
   Catches old hardcoded color variables that don't use design tokens
   ========================================================================== */

[data-theme="dark"] body {
  background-color: var(--surface-primary);
  color: var(--text-primary);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--text-primary);
}

[data-theme="dark"] p {
  color: var(--text-secondary);
}

/* Section titles */
[data-theme="dark"] .section__title {
  color: var(--text-primary);
}

[data-theme="dark"] .section__subtitle,
[data-theme="dark"] .section__description {
  color: var(--text-secondary);
}

/* Contact items */
[data-theme="dark"] .contact__item {
  background-color: var(--surface-secondary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .contact__item:hover {
  background-color: var(--surface-elevated);
}

[data-theme="dark"] .contact__section-title {
  color: var(--text-primary);
}

[data-theme="dark"] .contact__item-title {
  color: var(--text-primary);
}

[data-theme="dark"] .contact__item-description,
[data-theme="dark"] .contact__text {
  color: var(--text-secondary);
}

/* Form elements */
[data-theme="dark"] .form__input,
[data-theme="dark"] .form__textarea {
  background-color: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .form__label {
  color: var(--text-primary);
}

[data-theme="dark"] .form__help {
  color: var(--text-muted);
}

/* Project cards */
[data-theme="dark"] .project-card {
  background-color: var(--surface-secondary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .project__title {
  color: var(--text-primary);
}

[data-theme="dark"] .project__description {
  color: var(--text-secondary);
}

[data-theme="dark"] .project__tech-tag {
  background-color: var(--surface-elevated);
  color: var(--text-secondary);
}

/* Filter and search */
[data-theme="dark"] .filter__btn {
  background-color: var(--surface-secondary);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .filter__btn:hover,
[data-theme="dark"] .filter__btn--active {
  color: var(--text-inverse);
}

[data-theme="dark"] .search__input {
  background-color: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .search__help {
  color: var(--text-muted);
}

[data-theme="dark"] .search__label {
  color: var(--text-primary);
}

/* About section */
[data-theme="dark"] .about__text,
[data-theme="dark"] .about__intro p {
  color: var(--text-secondary);
}

/* Skills section */
[data-theme="dark"] .skill-category {
  background-color: var(--surface-secondary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .skill-category__title {
  color: var(--text-primary);
}

[data-theme="dark"] .skill__name {
  color: var(--text-secondary);
}

/* Footer */
[data-theme="dark"] .footer {
  background-color: var(--surface-secondary);
  color: var(--text-secondary);
}

[data-theme="dark"] .footer__brand-title,
[data-theme="dark"] .footer__section-title {
  color: var(--text-primary);
}

[data-theme="dark"] .footer__brand-description,
[data-theme="dark"] .footer__brand-tagline,
[data-theme="dark"] .footer__nav-link,
[data-theme="dark"] .footer__social-link,
[data-theme="dark"] .footer__link,
[data-theme="dark"] .footer__copyright,
[data-theme="dark"] .footer__newsletter-description {
  color: var(--text-secondary);
}

[data-theme="dark"] .footer__nav-link:hover,
[data-theme="dark"] .footer__social-link:hover,
[data-theme="dark"] .footer__link:hover {
  color: var(--text-primary);
}

[data-theme="dark"] .footer__newsletter-input {
  background-color: var(--surface-primary);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .footer__bottom {
  border-color: var(--glass-border);
}

/* Social links */
[data-theme="dark"] .social-links__item {
  background-color: var(--surface-secondary);
  color: var(--text-secondary);
}

[data-theme="dark"] .social-links__item:hover {
  background-color: var(--surface-elevated);
}

[data-theme="dark"] .social-links__description {
  color: var(--text-muted);
}

/* Availability */
[data-theme="dark"] .response-time {
  color: var(--text-secondary);
}

[data-theme="dark"] .collaboration-item {
  color: var(--text-secondary);
}

/* AWS Community Builder section */
[data-theme="dark"] .aws-community-builder {
  background-color: var(--surface-secondary);
}

/* CV download section */
[data-theme="dark"] .cv-download {
  background-color: var(--surface-secondary);
}

[data-theme="dark"] .cv-download__title {
  color: var(--text-primary);
}

[data-theme="dark"] .cv-download__description {
  color: var(--text-secondary);
}

/* Error page */
[data-theme="dark"] .error-page__title,
[data-theme="dark"] .error-page__subtitle {
  color: var(--text-primary);
}

[data-theme="dark"] .error-page__description {
  color: var(--text-secondary);
}

[data-theme="dark"] .error-page__link {
  background-color: var(--surface-secondary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .error-page__link:hover {
  background-color: var(--surface-elevated);
}

/* Buttons - secondary/outline variants */
[data-theme="dark"] .btn--secondary {
  color: var(--text-primary);
  border-color: var(--glass-border);
}

[data-theme="dark"] .btn--secondary:hover {
  background-color: var(--surface-secondary);
}

/* Nav links */
[data-theme="dark"] .nav__link {
  color: var(--text-secondary);
}

[data-theme="dark"] .nav__link:hover,
[data-theme="dark"] .nav__link--active {
  color: var(--text-primary);
}

[data-theme="dark"] .nav__logo {
  color: var(--text-primary);
}

[data-theme="dark"] .nav__hamburger,
[data-theme="dark"] .nav__hamburger::before,
[data-theme="dark"] .nav__hamburger::after {
  background-color: var(--text-primary);
}

/* Page header non-gradient */
[data-theme="dark"] .page-header {
  background-color: var(--surface-secondary);
}


/* ==========================================================================
   Skills Cloud Tags
   Cloud-themed skill display with tag bubbles
   ========================================================================== */

.skills {
  padding: var(--space-16) 0;
}

.skills__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

@media (max-width: 767px) {
  .skills__grid {
    grid-template-columns: 1fr;
  }
}

.skills__category {
  padding: var(--space-6);
  text-align: center;
}

.skills__category-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.skills__category-icon {
  font-size: 1.5rem;
}

.skills__category-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.skills__cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.skill-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-weight: 500;
  cursor: default;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-out-expo);
  background: linear-gradient(135deg, var(--tag-color), color-mix(in srgb, var(--tag-color) 70%, #764ba2));
  color: #fff;
  border: none;
}

.skill-tag:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.skill-tag--sm {
  font-size: 0.75rem;
  padding: var(--space-1) var(--space-2);
}

.skill-tag--md {
  font-size: 0.85rem;
  padding: var(--space-1) var(--space-3);
}

.skill-tag--lg {
  font-size: 0.95rem;
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
  .skill-tag {
    background: var(--tag-color);
  }
}


/* ==========================================================================
   Hero Social Links
   ========================================================================== */

.hero__socials {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.hero__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all var(--duration-normal) var(--ease-out-expo);
  text-decoration: none;
}

.hero__social-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.hero__social-link svg {
  flex-shrink: 0;
}


/* ==========================================================================
   Certifications Section — Scrolling Carousel
   ========================================================================== */

.certifications {
  padding: var(--space-16) 0;
  overflow: hidden;
}

.certifications__grid {
  margin-top: var(--space-8);
}

.cert-scroll {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.cert-scroll__track {
  display: flex;
  gap: var(--space-4);
  width: max-content;
  animation: cert-scroll 30s linear infinite;
}

@keyframes cert-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.cert-card {
  flex-shrink: 0;
  width: 240px;
  padding: var(--space-6);
  text-align: center;
  cursor: default;
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

.cert-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

.cert-card__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
}

.cert-card__name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.cert-card__issuer {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.cert-card__date {
  display: inline-block;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 500;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

[data-theme="dark"] .cert-card__date {
  background: rgba(102, 126, 234, 0.2);
}

.certifications__empty {
  text-align: center;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .cert-scroll__track {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
  }
  
  .cert-scroll {
    mask-image: none;
    -webkit-mask-image: none;
  }
}


/* AWS Community Builder badge link */
a.aws-community-builder__badge {
  text-decoration: none;
  color: inherit;
  display: flex;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: transform var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

a.aws-community-builder__badge:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

a.aws-community-builder__badge * {
  pointer-events: none;
}


/* Nav CV Download Button */
.nav__cv-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--text-inverse);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) var(--ease-out-expo);
}

.nav__cv-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  color: var(--text-inverse);
}

@media (max-width: 639px) {
  .nav__cv-btn {
    display: none;
  }
}
