:root {
  /* MANDATORY: Automatically adapt native UI to user system preferences */
  color-scheme: light dark;

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }

  /* Color Palette - Premium & Modern */
  --color-bg-body: #f0f2f5;
  --color-surface: #ffffff;
  --color-surface-alt: #f8f9fa;
  --color-primary: #2c3e50; /* Deep Slate Blue */
  --color-primary-dark: #1a252f;
  --color-secondary: #e6b800; /* Gold Accent */
  --color-text-main: #1a1a1a;
  --color-text-muted: #495057; /* Darker gray for better contrast */
  --color-white: #ffffff;
  --color-border: #e9ecef;
  --color-nav-bg: rgba(255, 255, 255, 0.85);
  --color-tag-bg: rgba(44, 62, 80, 0.06);

  /* Hero Gradient */
  --color-hero-start: #e0eafc;
  --color-hero-end: #cfdef3;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

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

  /* Typography */
  --font-family-serif: "Gilda Display", serif;
  --font-family-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark theme overrides via explicit toggle attribute or system preference when set to dark */
:root[data-theme="dark"],
:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  --color-bg-body: #0f172a;
  --color-surface: #1e293b;
  --color-surface-alt: #0f172a;
  --color-primary: #93c5fd;
  --color-primary-dark: #60a5fa;
  --color-secondary: #fbbf24;
  --color-text-main: #f8fafc;
  --color-text-muted: #cbd5e1;
  --color-border: #334155;
  --color-nav-bg: rgba(15, 23, 42, 0.88);
  --color-tag-bg: rgba(147, 197, 253, 0.12);
  --color-hero-start: #0f172a;
  --color-hero-end: #1e293b;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

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

body {
  font-family: var(--font-family-sans);
  background-color: var(--color-bg-body);
  color: var(--color-text-main);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6,
.display-font {
  font-family: var(--font-family-serif);
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--color-primary);
}

/* Accessible Focus Indicators */
:where(a:any-link, button):focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 3px;
}

/* Visually Hidden & Skip Link Utility */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:where(:focus, :active) {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 2000;
  padding: 0.6rem 1.2rem;
  background-color: var(--color-primary);
  color: var(--color-white);
  border-radius: 50rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

/* Glassmorphism Classes */
.glass-nav {
  background: var(--color-nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

header:has(> .glass-nav) {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Utility Classes replacing inline styles */
.logo-text {
  color: var(--color-primary);
}

.btn-custom-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

:root[data-theme="dark"] .btn-custom-primary,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-custom-primary {
  color: #0f172a;
  font-weight: 600;
}

.btn-custom-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-white);
}

:root[data-theme="dark"] .btn-outline-dark,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-outline-dark {
  color: var(--color-text-main);
  border-color: var(--color-border);
}

:root[data-theme="dark"] .btn-outline-dark:hover,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-outline-dark:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #0f172a;
}

:root[data-theme="dark"] .bg-white,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .bg-white {
  background-color: #0f172a !important;
}

:root[data-theme="dark"] .bg-light,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .bg-light {
  background-color: #162032 !important;
}

:root[data-theme="dark"] .text-dark,
:root[data-theme="dark"] .link-dark,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .text-dark,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .link-dark {
  color: var(--color-text-main) !important;
}

:root[data-theme="dark"] .text-muted,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .text-muted {
  color: var(--color-text-muted) !important;
}

.theme-toggle-btn {
  min-width: 2.5rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
}

.hero-subtitle {
  color: var(--color-secondary);
  letter-spacing: 2px;
}

.text-highlight {
  color: var(--color-primary);
}

.badge-highlight {
  background-color: var(--color-secondary) !important;
  color: black !important;
}

.border-top-secondary {
  border-top-color: var(--color-secondary) !important;
}

.border-top-primary {
  border-top-color: var(--color-primary) !important;
}

/* Specific Section Styles */

/* Hero Section */
.hero-section {
  padding: var(--space-xl) 0;
  background: linear-gradient(135deg, var(--color-hero-start) 0%, var(--color-hero-end) 100%);
}

.headshot-container img {
  border-radius: 50%;
  border: 4px solid var(--color-white);
  box-shadow: var(--shadow-xl);
  transition: transform 0.3s ease;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top;
}

@media (prefers-reduced-motion: no-preference) {
  .headshot-container img:hover {
    transform: scale(1.02);
  }
}

/* Cards */
.modern-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  height: 100%;
  border: 1px solid var(--color-border);
}

@media (prefers-reduced-motion: no-preference) {
  .modern-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
  }
}

/* Skills Tags */
.skill-tag {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  margin: 0.2rem;
  background-color: var(--color-tag-bg);
  color: var(--color-primary);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.skill-tag:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

:root[data-theme="dark"] .skill-tag:hover,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .skill-tag:hover {
  color: #0f172a;
}

.section-title {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-lg);
  font-size: 2.5rem;
  color: var(--color-primary);
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 60px;
  height: 3px;
  background-color: var(--color-secondary);
  border-radius: 2px;
}

/* Timeline/Experience */
.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--color-border);
  border-radius: 0;
  padding-bottom: 3rem;
}

.timeline-item:last-child {
  padding-bottom: 2rem;
  border-left-color: transparent;
}

@media (max-width: 768px) {
  .timeline-item {
    padding-bottom: 1.5rem;
  }
  .timeline-item:last-child {
    padding-bottom: 1.5rem;
  }
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-white);
}

.logo-img {
  object-fit: contain;
}

.timeline-item ul {
  font-size: 0.95rem;
}

/* Footer */
footer {
  background-color: #2c3e50 !important;
  color: var(--color-white);
}

@media print {
  nav,
  .btn,
  .skip-link,
  footer {
    display: none !important;
  }
  body {
    background-color: white;
    color: black;
  }
  a,
  .text-dark {
    text-decoration: none;
    color: black !important;
  }

  .text-muted {
    color: black !important;
  }
}

/* Performance Optimization */
#experience {
  content-visibility: auto;
  contain-intrinsic-size: 1px 1000px;
}

.nav-link.active {
  color: var(--color-primary) !important;
  font-weight: 700;
}
