:root {
  --fs-300: 0.9375rem;
  --fs-400: 1.0625rem;
  --fs-500: 1.375rem;
  --fs-600: 1.875rem;
  --fs-700: 2rem;

  --ff-body: "Roboto", sans-serif;
  --ff-heading: "Playfair Display", serif;

  --fw-400: 400;
  --fw-700: 700;
  --fw-900: 900;

  --clr-primary-200: hsla(169, 70%, 95%, 1);
  --clr-primary-300: hsla(169, 100%, 39%, 1);
  --clr-primary-400: hsla(169, 100%, 26%, 1);
  --clr-primary-500: hsla(169, 100%, 16%, 1);

  --clr-neutral-100: hsla(0, 0%, 100%, 1);
  --clr-neutral-300: hsla(0, 0%, 50%, 1);
  --clr-neutral-400: hsla(0, 0%, 40%, 1);
  --clr-neutral-500: hsla(0, 0%, 60%, 1);
  --clr-neutral-900: hsla(0, 0%, 10%, 1);
  
  /* Glassmorphic Light Theme */
  --glass-white: rgba(255, 255, 255, 0.85);
  --glass-white-soft: rgba(255, 255, 255, 0.6);
  --glass-white-subtle: rgba(255, 255, 255, 0.25);
  --glass-backdrop: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: rgba(0, 0, 0, 0.1);
  --glass-shadow-soft: rgba(0, 0, 0, 0.05);
  --glass-text: rgba(30, 32, 42, 0.9);
  --glass-text-muted: rgba(30, 32, 42, 0.6);
  --glass-accent: rgba(59, 130, 246, 0.8);
  --glass-accent-soft: rgba(59, 130, 246, 0.6);
  
  /* Enhanced Theme colors - WCAG AAA compliant */
--theme-bg: linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.8) 100%);
--theme-bg-secondary: var(--glass-white-soft);
--theme-text: rgba(15, 23, 42, 0.95); /* Enhanced contrast */
--theme-text-muted: rgba(51, 65, 85, 0.8); /* Better contrast than original */
--theme-border: var(--glass-border);
--theme-shadow: var(--glass-shadow);
--theme-accent: rgba(37, 99, 235, 1); /* Enhanced blue for better contrast */
--theme-card-bg: var(--glass-white);
--theme-header-bg: var(--glass-backdrop);
--theme-footer-bg: var(--glass-white-soft);
  
  /* RGB values for rgba() usage */
  --accent-rgb: 59, 130, 246;
}

/* Glassmorphic Dark Theme */
:root[data-theme="dark"] {
  /* Dark glass variables */
  --glass-dark: rgba(15, 23, 42, 0.85);
  --glass-dark-soft: rgba(15, 23, 42, 0.6);
  --glass-dark-subtle: rgba(30, 41, 59, 0.4);
  --glass-dark-backdrop: rgba(30, 41, 59, 0.2);
  --glass-dark-border: rgba(148, 163, 184, 0.2);
  --glass-dark-shadow: rgba(0, 0, 0, 0.4);
  --glass-dark-text: rgba(248, 250, 252, 0.95);
  --glass-dark-text-muted: rgba(203, 213, 225, 0.7);
  --glass-dark-accent: rgba(99, 179, 237, 0.9);
  
  /* Enhanced Dark theme colors - WCAG AAA compliant */
  --theme-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%);
  --theme-bg-secondary: var(--glass-dark-soft);
  --theme-text: rgba(248, 250, 252, 0.98); /* Enhanced contrast */
  --theme-text-muted: rgba(203, 213, 225, 0.85); /* Better contrast */
  --theme-border: var(--glass-dark-border);
  --theme-shadow: var(--glass-dark-shadow);
  --theme-accent: rgba(147, 197, 253, 1); /* Enhanced light blue for dark theme */
  --theme-card-bg: var(--glass-dark);
  --theme-header-bg: var(--glass-dark-backdrop);
  --theme-footer-bg: var(--glass-dark-soft);
  
  /* RGB values for dark theme */
  --accent-rgb: 99, 179, 237;
}

/* Auto-detect system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark glass variables */
    --glass-dark: rgba(15, 23, 42, 0.85);
    --glass-dark-soft: rgba(15, 23, 42, 0.6);
    --glass-dark-subtle: rgba(30, 41, 59, 0.4);
    --glass-dark-backdrop: rgba(30, 41, 59, 0.2);
    --glass-dark-border: rgba(148, 163, 184, 0.2);
    --glass-dark-shadow: rgba(0, 0, 0, 0.4);
    --glass-dark-text: rgba(248, 250, 252, 0.95);
    --glass-dark-text-muted: rgba(203, 213, 225, 0.7);
    --glass-dark-accent: rgba(99, 179, 237, 0.9);
    
    /* Enhanced Dark theme colors - WCAG AAA compliant */
--theme-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%);
--theme-bg-secondary: var(--glass-dark-soft);
--theme-text: rgba(248, 250, 252, 0.98); /* Enhanced contrast */
--theme-text-muted: rgba(203, 213, 225, 0.85); /* Better contrast */
--theme-border: var(--glass-dark-border);
--theme-shadow: var(--glass-dark-shadow);
--theme-accent: rgba(147, 197, 253, 1); /* Enhanced light blue for dark theme */
--theme-card-bg: var(--glass-dark);
--theme-header-bg: var(--glass-dark-backdrop);
--theme-footer-bg: var(--glass-dark-soft);
    
    /* RGB values for dark theme */
    --accent-rgb: 99, 179, 237;
  }
}

:root {
  /* Enhanced Animation System */
  --timing-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --timing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --timing-ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --timing-ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --timing-ease-in-out-back: cubic-bezier(0.68, -0.6, 0.32, 1.6);
  
  /* Dynamic spacing system */
  --space-xs: clamp(0.5rem, 2vw, 1rem);
  --space-sm: clamp(1rem, 3vw, 1.5rem);
  --space-md: clamp(1.5rem, 4vw, 2.5rem);
  --space-lg: clamp(2rem, 6vw, 4rem);
  --space-xl: clamp(3rem, 8vw, 6rem);
  
  /* Responsive navigation sizing */
  --nav-container-size: clamp(280px, 90vw, 450px);
  --nav-circle-size: clamp(50px, 12vw, 90px);
  --nav-radius: calc(var(--nav-container-size) * 0.4);
  
  /* Performance optimization variables */
  --blur-intensity: clamp(10px, 2vw, 20px);
  --shadow-elevation-1: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-elevation-2: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-elevation-3: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-elevation-4: 0 16px 64px rgba(0, 0, 0, 0.25);
}

/* Enhanced Responsive Breakpoint System */
@media (min-width: 20em) { /* 320px - Small phones */
  :root {
    --nav-container-size: 300px;
    --nav-circle-size: 55px;
  }
}

@media (min-width: 24em) { /* 384px - Larger phones */
  :root {
    --nav-container-size: 340px;
    --nav-circle-size: 65px;
  }
}

@media (min-width: 35em) { /* 560px - Small tablets */
  :root {
    --fs-300: 1rem;
    --fs-400: 1.125rem;
    --fs-500: 1.5rem;
    --fs-600: 2.25rem;
    --fs-700: 3rem;
    --nav-container-size: 380px;
    --nav-circle-size: 75px;
  }
}

@media (min-width: 48em) { /* 768px - Tablets */
  :root {
    --nav-container-size: 420px;
    --nav-circle-size: 85px;
  }
}

@media (min-width: 64em) { /* 1024px - Desktop */
  :root {
    --nav-container-size: 450px;
    --nav-circle-size: 90px;
  }
}

@media (min-width: 80em) { /* 1280px - Large desktop */
  :root {
    --nav-container-size: 480px;
    --nav-circle-size: 95px;
  }
}

/* //////////////////////
  RESET - source: https://piccalil.li/blog/a-modern-css-reset
  /////////////////////// */

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul:where([role="list"]),
ol:where([role="list"]) {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Enhanced root defaults with performance optimizations */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

html:focus-within {
  scroll-behavior: smooth;
}

/* Enhanced body defaults with glassmorphic background */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.5;
  font-family: var(--ff-body);
  font-size: var(--fs-400);
  color: var(--theme-text);
  
  /* Enhanced glassmorphic background for all pages */
  background: var(--theme-bg);
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(120, 219, 226, 0.15) 0%, transparent 50%);
  background-attachment: fixed;
  background-size: 100% 100%;
  
  backdrop-filter: blur(20px);
  transition: color 0.3s ease, background 0.3s ease;
  
  /* Performance optimizations */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
  
  /* Enhanced scrolling on iOS */
  -webkit-overflow-scrolling: touch;
  
  /* Optimize for animations */
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* //////////////////////
  General styling
  /////////////////////// */

h1,
h2,
h3 {
  font-family: var(--ff-heading);
  font-weight: var(--fw-900);
  line-height: 1.1;
}

strong {
  font-weight: var(--fw-700);
}

section,
.section {
  padding: min(10vh, 10em) 0;
}

/* //////////////////////
  Utility Classes
  /////////////////////// */

/* select all direct childen of .flow
   and add margin to the top for proper
   spacing */

.flow > *:where(:not(:first-child)) {
  margin-top: var(--flow-spacer, 1em);
}

.container {
  margin-inline: auto;
  padding-inline: 1.5em;
  max-width: 72rem;
}

.container--narrow {
  max-width: 65rem;
}

.flex-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, 1em);
}

.text-center {
  text-align: center;
}

/* typgraphy */

.article-title,
.section-title {
  color: var(--theme-accent);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-title {
  font-size: var(--fs-700);
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: var(--fs-600);
  margin-bottom: 2rem;
}

/* //////////////////////
  Header
  /////////////////////// */

/* Hide footer on homepage */
body:has(.circular-nav-container) .site-footer {
  display: none;
}

/* CSS-Only Sticky Header - Works on all pages except homepage */
.page-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  padding: 0.8em 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Dark theme header */
:root[data-theme="dark"] .page-header {
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

/* Homepage: disable sticky header */
body:has(.circular-nav-container) .page-header {
  position: relative;
  display: none;
}

.page-header__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Enhanced Logo styling with clickable link */
.logo {
  width: 12rem !important;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

/* Logo link wrapper styling */
.page-header a[aria-label="Go to homepage"] {
  display: inline-block;
  text-decoration: none;
  border-radius: 12px;
  padding: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  cursor: pointer;
}

.page-header a[aria-label="Go to homepage"]:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.page-header a[aria-label="Go to homepage"]:hover .logo {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.page-header a[aria-label="Go to homepage"]:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 37,99,235), 0.2);
  background: rgba(var(--accent-rgb, 37,99,235), 0.05);
}

.page-header a[aria-label="Go to homepage"]:active {
  transform: translateY(0px) scale(0.98);
  transition: all 0.1s ease-out;
}

.page-header a[aria-label="Go to homepage"]:active .logo {
  transform: scale(1.02);
}

/* Legacy hover support maintained */
.logo:hover {
  transform: scale(1.05);
}

.nav-list {
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  
  /* Enhanced spacing for modern pill buttons */
  flex-wrap: wrap;
  justify-content: flex-end;
  
  /* Smooth container animations */
  transition: gap 0.3s ease;
}

/* Responsive gap adjustment */
@media (max-width: 768px) {
  .nav-list {
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .nav-list::-webkit-scrollbar {
    display: none;
  }
}

.nav-list a {
  color: var(--theme-text);
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.9rem 1.4rem;
  
  /* Modern ultra-rounded corners */
  border-radius: 50px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  z-index: 10;
  min-height: 44px;
  min-width: 44px;
  
  /* Enhanced typography */
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
  
  /* Ensure touch targets are properly sized for mobile */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  
  /* Enhanced glassmorphic pill-shaped background */
  background: linear-gradient(135deg, 
    var(--theme-card-bg) 0%, 
    rgba(255, 255, 255, 0.8) 100%);
  border: 1.5px solid var(--theme-border);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  
  /* Enhanced modern shadow system */
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  
  /* Performance optimizations */
  will-change: transform, box-shadow;
  transform: translateZ(0);
}

.nav-list a:focus,
.nav-list a:hover {
  color: white;
  text-decoration: none;
  
  /* Modern gradient hover effect */
  background: linear-gradient(135deg, 
    var(--theme-accent) 0%, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.9) 100%);
  border-color: var(--theme-accent);
  
  /* Enhanced hover shadow */
  box-shadow: 
    0 8px 32px rgba(var(--accent-rgb, 37, 99, 235), 0.25),
    0 4px 16px rgba(var(--accent-rgb, 37, 99, 235), 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  
  /* Smooth lift effect */
  transform: translateY(-2px) translateZ(0);
}

.nav-list a:active {
  /* Pressed state with inset effect */
  background: linear-gradient(135deg, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.8) 0%, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.6) 100%);
  box-shadow: 
    0 2px 8px rgba(var(--accent-rgb, 37, 99, 235), 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(0px) scale(0.98) translateZ(0);
  transition: all 0.15s ease-out;
}

/* Mobile-specific touch optimizations for navigation links */
@media (max-width: 768px) {
  .nav-list a {
    padding: 1rem 1.5rem;
    min-height: 48px;
    min-width: 48px;
    font-size: 0.9rem;
    font-weight: 600;
    
    /* Maintain pill shape on mobile */
    border-radius: 50px;
    
    /* Enhanced mobile glassmorphic background */
    background: linear-gradient(135deg, 
      var(--theme-card-bg) 0%, 
      rgba(255, 255, 255, 0.9) 100%);
    border: 1.5px solid var(--theme-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    /* Enhanced mobile shadows */
    box-shadow: 
      0 6px 20px rgba(0, 0, 0, 0.1),
      0 2px 8px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
    
    /* Ensure buttons are easily tappable */
    margin: 0 0.25rem;
    color: var(--theme-text);
  }
  
  .nav-list a:hover {
    /* Mobile hover with modern pill styling */
    background: linear-gradient(135deg, 
      var(--theme-accent) 0%, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.9) 100%);
    border-color: var(--theme-accent);
    color: white;
    
    box-shadow: 
      0 8px 24px rgba(var(--accent-rgb, 37, 99, 235), 0.3),
      0 4px 12px rgba(var(--accent-rgb, 37, 99, 235), 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    
    transform: translateY(-1px);
  }
  
  .nav-list a:active {
    background: linear-gradient(135deg, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.8) 0%, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.7) 100%);
    box-shadow: 
      0 3px 12px rgba(var(--accent-rgb, 37, 99, 235), 0.4),
      inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: scale(0.96) translateY(0px);
    transition: all 0.1s ease;
    color: white;
  }
}

/* Touch-friendly styles for devices that don't support hover */
@media (hover: none) and (pointer: coarse) {
  .nav-list a {
    padding: 1rem 1.5rem;
    min-height: 48px;
    min-width: 48px;
    
    /* Maintain modern pill shape for touch devices */
    border-radius: 50px;
    
    /* Enhanced touch-friendly glassmorphic background */
    background: linear-gradient(135deg, 
      var(--theme-card-bg) 0%, 
      rgba(255, 255, 255, 0.95) 100%);
    border: 1.5px solid var(--theme-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    /* Enhanced touch shadows */
    box-shadow: 
      0 6px 20px rgba(0, 0, 0, 0.12),
      0 3px 10px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.6);
    
    color: var(--theme-text);
    font-weight: 600;
    font-size: 0.9rem;
  }
  
  .nav-list a:active {
    /* Modern pill active state for touch */
    background: linear-gradient(135deg, 
      var(--theme-accent) 0%, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.8) 100%);
    border-color: var(--theme-accent);
    
    box-shadow: 
      0 4px 16px rgba(var(--accent-rgb, 37, 99, 235), 0.4),
      inset 0 2px 6px rgba(0, 0, 0, 0.2);
    
    transform: scale(0.96);
    transition: all 0.15s ease;
    color: white;
  }
}

/* Dark theme specific navigation enhancements */
:root[data-theme="dark"] .nav-list a {
  /* Modern dark theme pill styling */
  background: linear-gradient(135deg, 
    rgba(30, 41, 59, 0.9) 0%, 
    rgba(15, 23, 42, 0.8) 100%);
  border-color: rgba(148, 163, 184, 0.4);
  color: rgba(248, 250, 252, 0.98);
  
  /* Enhanced dark theme shadows */
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 3px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .nav-list a:hover {
  /* Modern dark theme hover with accent gradient */
  background: linear-gradient(135deg, 
    rgba(147, 197, 253, 1) 0%, 
    rgba(99, 179, 237, 0.95) 100%);
  border-color: rgba(147, 197, 253, 0.8);
  color: rgba(15, 23, 42, 0.95);
  
  /* Enhanced dark theme hover shadows */
  box-shadow: 
    0 8px 32px rgba(147, 197, 253, 0.3),
    0 4px 16px rgba(99, 179, 237, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  
  transform: translateY(-2px) translateZ(0);
}

:root[data-theme="dark"] .nav-list a:active {
  /* Modern dark theme active state */
  background: linear-gradient(135deg, 
    rgba(99, 179, 237, 0.9) 0%, 
    rgba(59, 130, 246, 0.8) 100%);
  border-color: rgba(99, 179, 237, 1);
  color: white;
  
  box-shadow: 
    0 3px 12px rgba(99, 179, 237, 0.5),
    inset 0 2px 4px rgba(0, 0, 0, 0.3);
  
  transform: translateY(0px) scale(0.98) translateZ(0);
}

/* Ensure navigation has proper stacking context for touch events */
.page-header nav {
  position: relative;
  z-index: 100;
}

/* Mobile tap enhancement - ensure immediate response */
@media (pointer: coarse) {
  .nav-list a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }
}

/* //////////////////////
  Theme Toggle
  /////////////////////// */

/* Enhanced Glassmorphic Theme Toggle with Auto Mode Support */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--theme-border);
  border-radius: 16px;
  background: var(--theme-card-bg);
  color: var(--theme-text);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  
  /* Enhanced glassmorphic effects */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 8px 32px var(--theme-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  
  /* Smooth transitions */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Performance optimizations */
  will-change: transform;
  transform: translateZ(0);
}

/* Loading state */
.theme-toggle.loading {
  opacity: var(--loading-opacity, 0.7);
  cursor: wait;
  animation: themeToggleLoading 1s ease-in-out infinite alternate;
}

@keyframes themeToggleLoading {
  0% { transform: translateZ(0) scale(1); }
  100% { transform: translateZ(0) scale(1.02); }
}

/* Mode indicators */
.theme-toggle::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.9;
  transition: all 0.3s ease;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-toggle.mode-light::after {
  background: #fbbf24; /* Amber for light mode */
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.theme-toggle.mode-dark::after {
  background: #6366f1; /* Indigo for dark mode */
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.theme-toggle.mode-auto::after {
  background: #10b981; /* Emerald green for auto mode */
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.theme-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  background: var(--theme-accent);
  color: white;
  border-color: var(--theme-accent);
  box-shadow: 
    0 12px 48px var(--theme-shadow),
    0 4px 16px rgba(var(--accent-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.theme-toggle:active {
  transform: translateY(0px) scale(0.98);
  transition: all 0.1s ease-out;
}

/* Enhanced focus indicator for accessibility */
.theme-toggle:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 3px;
  box-shadow: 
    0 12px 48px var(--theme-shadow),
    0 0 0 3px rgba(var(--accent-rgb, 37,99,235), 0.2);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle svg,
  .theme-toggle::after {
    transition: none;
    animation: none;
  }
  
  .theme-toggle.loading {
    animation: none;
  }
}

/* Icon display logic for three-way toggle */
.theme-toggle svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.4rem;
  height: 1.4rem;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Light mode - show sun */
.theme-toggle.mode-light .sun-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.theme-toggle.mode-light .moon-icon,
.theme-toggle.mode-light .auto-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.8);
}

/* Dark mode - show moon */
.theme-toggle.mode-dark .moon-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.theme-toggle.mode-dark .sun-icon,
.theme-toggle.mode-dark .auto-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.8);
}

/* Auto mode - show auto icon */
.theme-toggle.mode-auto .auto-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.theme-toggle.mode-auto .sun-icon,
.theme-toggle.mode-auto .moon-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(180deg) scale(0.8);
}

/* Legacy support for data-theme attribute (fallback) */
[data-theme="dark"] .theme-toggle:not(.mode-light):not(.mode-dark):not(.mode-auto) .sun-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.8);
}

[data-theme="dark"] .theme-toggle:not(.mode-light):not(.mode-dark):not(.mode-auto) .moon-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

/* Enhanced hover states for dark theme */
[data-theme="dark"] .theme-toggle:hover {
  background: var(--theme-accent);
  color: var(--theme-bg);
}

/* //////////////////////
  Footer
  /////////////////////// */

.site-footer {
  --logo-color: currentColor;
  padding: 0.5em 0;
  color: var(--theme-text);
  background: var(--theme-footer-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--theme-border);
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 -8px 32px var(--theme-shadow);
}

/* Footer logo link styling */
.site-footer a[aria-label="Go to homepage"] {
  display: inline-block;
  text-decoration: none;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  cursor: pointer;
}

.site-footer a[aria-label="Go to homepage"]:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.site-footer a[aria-label="Go to homepage"]:hover .logo {
  transform: scale(1.08);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.site-footer a[aria-label="Go to homepage"]:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 37,99,235), 0.2);
  background: rgba(var(--accent-rgb, 37,99,235), 0.05);
}

.site-footer a[aria-label="Go to homepage"]:active {
  transform: translateY(-1px) scale(0.97);
  transition: all 0.1s ease-out;
}

.site-footer a[aria-label="Go to homepage"]:active .logo {
  transform: scale(1.03);
}

/* Enhanced footer logo sizing */
.site-footer .logo {
  width: 6rem;
  height: auto;
  margin-bottom: 0;
  transition: all 0.3s ease;
}

/* //////////////////////
  Homepage
  /////////////////////// */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-neutral-100);
  overflow: hidden;
}

.hero__background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=1920&h=1080&fit=crop');
  background-size: cover;
  background-position: center;
  filter: brightness(0.4);
  z-index: -1;
}

.hero__content {
  text-align: center;
  padding: 2em;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2em;
}

.hero .section-title {
  color: white;
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 0.5em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero p {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  max-width: 600px;
  margin-inline: auto;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* //////////////////////
  Enhanced Hero Section with Circular Navigation
  /////////////////////// */

.circular-nav-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('https://images.unsplash.com/photo-1509062522246-3755977927d7?w=1920&h=1080&fit=crop&crop=center&q=80');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
  
  /* Performance optimizations */
  contain: layout style paint;
  will-change: transform;
  transform: translateZ(0);
  
  /* Enhanced backdrop with subtle animation */
  animation: backgroundShift 20s ease-in-out infinite;
  
  /* Mobile touch optimizations */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Prevent text selection on touch */
  user-select: none;
  -webkit-user-select: none;
}

@keyframes backgroundShift {
  0%, 100% { background-position: center center; }
  25% { background-position: 60% 40%; }
  50% { background-position: 40% 60%; }
  75% { background-position: 80% 20%; }
}

.circular-nav-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0.4) 70%,
    rgba(0, 0, 0, 0.6) 100%
  );
  z-index: 1;
  pointer-events: none;
  animation: overlayPulse 8s ease-in-out infinite;
}

@keyframes overlayPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.circular-nav {
  position: relative;
  width: var(--nav-container-size);
  height: var(--nav-container-size);
  margin: 0;
  padding: 0;
  list-style: none;
  z-index: 2;
  
  /* Performance optimizations */
  contain: layout style;
  will-change: transform;
  transform: translateZ(0);
  
  /* Enhanced entrance animation */
  animation: navEntrance 1.5s var(--timing-ease-out-expo) forwards,
             navBreath 4s ease-in-out 1.5s infinite;
  opacity: 0;
  transform: scale(0.5) translateZ(0);
  
  /* Touch optimizations */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@keyframes navEntrance {
  0% {
    opacity: 0;
    transform: scale(0.5) rotateZ(-180deg) translateZ(0);
  }
  70% {
    opacity: 1;
    transform: scale(1.05) rotateZ(0deg) translateZ(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateZ(0deg) translateZ(0);
  }
}

@keyframes navBreath {
  0%, 100% { transform: scale(1) translateZ(0); }
  50% { transform: scale(1.02) translateZ(0); }
}

/* Enhanced Glassmorphism Navigation Buttons - OPTIMIZED */
.nav-circle {
  position: absolute;
  width: var(--nav-circle-size);
  height: var(--nav-circle-size);
  border-radius: 50%;
  
  /* Optimized Glassmorphism */
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  
  /* Optimized shadow system */
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  
  /* Optimized transitions */
  transition: 
    scale 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;
  
  /* Dynamic center positioning with separate transform properties */
  top: 50%;
  left: 50%;
  margin: calc(var(--nav-circle-size) / -2) 0 0 calc(var(--nav-circle-size) / -2);
  
  /* Performance optimizations */
  contain: layout style paint;
  
  /* Simplified entrance animation */
  animation: 
    circleEntrance 1s var(--timing-ease-out-expo) forwards,
    gentleFloat 12s ease-in-out 1.5s infinite;
  opacity: 0;
  scale: 0;
}

/* Staggered entrance animations - optimized */
.nav-circle:nth-child(1) { 
  animation-delay: 0.1s, 1.6s;
  transform: translateY(calc(var(--nav-radius) * -1));
  background: linear-gradient(135deg, 
    rgba(255, 107, 107, 0.2) 0%, 
    rgba(255, 142, 83, 0.2) 100%);
}
.nav-circle:nth-child(2) { 
  animation-delay: 0.2s, 1.8s; 
  transform: translateX(calc(var(--nav-radius) * 0.951)) translateY(calc(var(--nav-radius) * -0.309));
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.2) 0%, 
    rgba(80, 227, 194, 0.2) 100%);
}
.nav-circle:nth-child(3) { 
  animation-delay: 0.3s, 2.0s; 
  transform: translateX(calc(var(--nav-radius) * 0.588)) translateY(calc(var(--nav-radius) * 0.809));
  background: linear-gradient(135deg, 
    rgba(168, 85, 247, 0.2) 0%, 
    rgba(236, 72, 153, 0.2) 100%);
}
.nav-circle:nth-child(4) { 
  animation-delay: 0.4s, 2.2s; 
  transform: translateX(calc(var(--nav-radius) * -0.588)) translateY(calc(var(--nav-radius) * 0.809));
  background: linear-gradient(135deg, 
    rgba(34, 197, 94, 0.2) 0%, 
    rgba(59, 130, 246, 0.2) 100%);
}
.nav-circle:nth-child(5) { 
  animation-delay: 0.5s, 2.4s; 
  transform: translateX(calc(var(--nav-radius) * -0.951)) translateY(calc(var(--nav-radius) * -0.309));
  background: linear-gradient(135deg, 
    rgba(245, 101, 101, 0.2) 0%, 
    rgba(247, 147, 26, 0.2) 100%);
}

@keyframes circleEntrance {
  0% {
    opacity: 0;
    scale: 0;
    rotate: -90deg;
  }
  70% {
    opacity: 1;
    scale: 1.05;
    rotate: 5deg;
  }
  100% {
    opacity: 1;
    scale: 1;
    rotate: 0deg;
  }
}

/* Gentler floating animation that doesn't interfere with interactions */
@keyframes gentleFloat {
  0%, 100% { 
    translate: 0 0;
  }
  33% { 
    translate: 0 -3px;
  }
  66% { 
    translate: 0 -6px;
  }
}

/* Optimized hover effects using modern CSS properties */
.nav-circle:hover {
  scale: 1.12;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 
    0 12px 40px rgba(255, 255, 255, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation-play-state: paused;
}

/* Optimized active state */
.nav-circle:active {
  scale: 0.95;
  background: rgba(255, 255, 255, 0.35);
  transition: scale 0.1s ease-out, background 0.1s ease-out;
}

/* Focus states for accessibility */
.nav-circle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

/* Optimized icon styling */
.nav-icon {
  font-size: clamp(1.4em, 4vw, 2em);
  margin-bottom: 0.1em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: 
    scale 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    translate 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-circle:hover .nav-icon {
  scale: 1.08;
  translate: 0 -2px;
}

.nav-circle:active .nav-icon {
  scale: 0.95;
  translate: 0 0;
}

/* Optimized text styling */
.nav-text {
  font-weight: 600;
  font-size: clamp(0.5em, 1.6vw, 0.7em);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  text-align: center;
  opacity: 0.85;
  transition: 
    opacity 0.2s ease,
    translate 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-circle:hover .nav-text {
  opacity: 1;
  translate: 0 -1px;
}

.nav-circle:active .nav-text {
  translate: 0 0;
  opacity: 0.9;
}

/* Mobile optimizations - disable complex animations */
@media (max-width: 768px) and (hover: none) {
  .nav-circle {
    /* Completely disable problematic animations on touch devices */
    animation: none !important;
    /* Ensure elements are immediately visible and clickable */
    opacity: 1 !important;
    scale: 1 !important;
    /* Simplify backdrop effects that can interfere with touch */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Ensure immediate clickability */
    pointer-events: auto;
    /* Force hardware acceleration */
    will-change: transform;
    transform: translateZ(0);
  }
  
  .nav-circle:hover {
    scale: 1;
    animation-play-state: paused;
  }
  
  /* Touch-friendly active states */
  .nav-circle:active {
    scale: 0.92 !important;
    background: rgba(255, 255, 255, 0.4) !important;
    transform: translateZ(0) !important;
  }
}

/* Enhanced touch support for all coarse pointer devices */
@media (pointer: coarse) {
  .nav-circle {
    /* Ensure immediate touch response without 300ms delay */
    touch-action: manipulation;
    /* Remove webkit tap highlight */
    -webkit-tap-highlight-color: transparent;
    /* Ensure minimum touch target size */
    min-width: 44px;
    min-height: 44px;
    /* Improve touch responsiveness */
    cursor: pointer;
    /* Prevent selection on touch */
    user-select: none;
    -webkit-user-select: none;
    /* Ensure proper stacking context */
    z-index: 10;
  }
  
  /* Enhanced touch feedback */
  .nav-circle:active {
    scale: 0.88;
    background: rgba(255, 255, 255, 0.45);
    transition: scale 0.08s ease-out, background 0.08s ease-out;
    /* Add subtle shadow for depth perception */
    box-shadow: 
      0 4px 16px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }
}

/* Specific optimizations for Android devices */
@media (pointer: coarse) and (hover: none) {
  .nav-circle {
    /* Ensure consistent touch target across different screen densities */
    min-width: 48px;
    min-height: 48px;
    /* Optimize for high-DPI displays */
    backface-visibility: hidden;
    /* Improve rendering performance */
    transform: translateZ(0);
    /* Ensure proper touch handling */
    touch-action: manipulation;
    /* Disable all animations that might interfere */
    animation: none !important;
    transition: none !important;
    /* Ensure immediate visibility and interaction */
    opacity: 1 !important;
    scale: 1 !important;
    /* Simplify positioning to avoid transform issues */
    position: absolute !important;
    /* Force higher z-index */
    z-index: 999 !important;
  }
  
  /* More pronounced feedback for touch devices */
  .nav-circle:active {
    scale: 0.85 !important;
    background: rgba(255, 255, 255, 0.5) !important;
    /* Faster transition for immediate feedback */
    transition: all 0.05s ease-out !important;
    /* Ensure touch feedback is visible */
    opacity: 1 !important;
    transform: translateZ(0) scale(0.85) !important;
  }
  
  /* Ensure touch events are properly captured */
  .nav-circle * {
    pointer-events: auto;
    /* Ensure child elements don't interfere with touch */
    touch-action: manipulation;
  }
  
  /* Disable potentially interfering container effects on touch devices */
  .circular-nav-container {
    animation: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  .circular-nav-container::before {
    animation: none !important;
  }
  
  .circular-nav {
    animation: none !important;
    opacity: 1 !important;
    transform: scale(1) translateZ(0) !important;
  }
  
  /* Add visible touch debug borders on touch devices */
  .nav-circle {
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    /* Ensure solid background for touch detection */
    background: rgba(255, 255, 255, 0.3) !important;
    /* Remove complex effects that might interfere */
    box-shadow: none !important;
    /* Ensure minimum size for touch */
    min-width: 60px !important;
    min-height: 60px !important;
    /* Center content within touch area */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Ensure proper cursor */
    cursor: pointer !important;
    /* CRITICAL: Lock position during touch to prevent ghost movement */
    position: absolute !important;
    /* Preserve original transform positioning but lock it */
    transform-origin: center center !important;
  }
  
  .nav-circle:active {
    background: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(255, 255, 255, 1) !important;
    /* CRITICAL: Don't scale during touch to prevent positioning glitch */
    scale: 1 !important;
    /* Lock the transform to prevent ghost movement */
    transform: var(--original-transform, none) !important;
  }
  
  /* Fix for each positioned circle - maintain their original positions */
  .nav-circle:nth-child(1) {
    /* Lock the specific transform to prevent movement */
    --original-transform: translateY(calc(var(--nav-radius) * -1));
  }
  
  .nav-circle:nth-child(2) {
    --original-transform: translateX(calc(var(--nav-radius) * 0.951)) translateY(calc(var(--nav-radius) * -0.309));
  }
  
  .nav-circle:nth-child(3) {
    --original-transform: translateX(calc(var(--nav-radius) * 0.588)) translateY(calc(var(--nav-radius) * 0.809));
  }
  
  .nav-circle:nth-child(4) {
    --original-transform: translateX(calc(var(--nav-radius) * -0.588)) translateY(calc(var(--nav-radius) * 0.809));
  }
  
  .nav-circle:nth-child(5) {
    --original-transform: translateX(calc(var(--nav-radius) * -0.951)) translateY(calc(var(--nav-radius) * -0.309));
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .nav-circle {
    animation: fadeIn 0.5s ease forwards;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  .nav-circle:hover {
    scale: 1.05;
  }
}

/* High-DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .nav-circle {
    box-shadow: 
      0 8px 32px rgba(0, 0, 0, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
}

/* Featured Articles Section & Blog Page */
.featured-articles {
  background: var(--theme-bg);
  padding: 6em 0;
  min-height: 100vh;
}

.featured-articles .section-title {
  color: var(--theme-accent);
  margin-bottom: 2rem;
}

/* Blog page styling */
.section {
  background: var(--theme-bg);
  min-height: 100vh;
  padding: 4rem 0;
}

.articles__list {
  display: grid;
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin-top: 2rem;
}

@media (min-width: 48em) {
  .articles__list {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2.5rem;
  }
}

/* //////////////////////
  Individual article page
  /////////////////////// */

.main-article {
  margin-bottom: 3rem;
  background: var(--clr-paper);
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.02) 1px, transparent 0);
  background-size: 20px 20px;
  min-height: 100vh;
  padding: 2rem 0;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.02);
}

.main-article .container {
  background: var(--theme-card-bg);
  color: var(--theme-text);
  padding: 3rem 2rem;
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 16px 64px var(--theme-shadow);
  border: 1px solid var(--theme-border);
  position: relative;
  transition: all 0.3s ease;
}

.main-article .container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--theme-accent), var(--theme-accent));
  border-radius: 8px 8px 0 0;
}

.main-article__figure {
  margin: 2rem 0;
  text-align: center;
  background: var(--theme-bg);
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid var(--theme-border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.main-article__figure img {
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.main-article__figure figcaption {
  margin: 1rem 0 0 0;
  font-size: var(--fs-300);
  color: var(--theme-text-muted);
  font-style: italic;
  text-align: center;
}

/* Scholastic typography for article content */
.main-article h1,
.main-article h2,
.main-article h3,
.main-article h4,
.main-article h5,
.main-article h6 {
  color: var(--theme-text);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: var(--fw-700);
  line-height: 1.3;
}

.main-article h1 {
  font-size: var(--fs-700);
  border-bottom: 2px solid var(--theme-accent);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.main-article h2 {
  font-size: var(--fs-600);
  color: var(--theme-accent);
  border-left: 4px solid var(--theme-accent);
  padding-left: 1rem;
}

.main-article h3 {
  font-size: var(--fs-500);
  color: var(--theme-accent);
}

.main-article p {
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--theme-text);
  text-align: justify;
  text-justify: inter-word;
}

.main-article ul,
.main-article ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.main-article li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.main-article blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: var(--theme-bg-secondary);
  border-left: 4px solid var(--theme-accent);
  font-style: italic;
  border-radius: 0 6px 6px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.main-article blockquote p {
  margin: 0;
  font-size: var(--fs-400);
  color: var(--theme-text);
}

.main-article code {
  background: var(--theme-bg-secondary);
  color: var(--theme-text);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  border: 1px solid var(--theme-border);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.main-article pre {
  background: var(--theme-card-bg);
  color: var(--theme-text);
  padding: 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--theme-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.main-article pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

/* Academic-style links */
.main-article a {
  color: var(--theme-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

.main-article a:hover {
  border-bottom-color: var(--theme-accent);
}

/* Responsive adjustments */
@media (min-width: 45em) {
  .main-article .container {
    padding: 4rem 3rem;
    margin: 0 2rem;
  }
  
  .main-article p {
    font-size: var(--fs-400);
  }
}

@media (min-width: 65em) {
  .main-article .container {
    padding: 5rem 4rem;
    margin: 0 4rem;
  }
}

/* //////////////////////
  Article snippets
  /////////////////////// */

.snippet {
  display: grid;
  gap: 1em;
  grid-template-areas:
    "image"
    "title"
    "meta"
    "body"
    "button";
  background: var(--theme-card-bg);
  padding: 2rem;
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--theme-border);
  box-shadow: 0 16px 64px var(--theme-shadow);
  transition: all 0.3s ease;
}

.snippet:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 80px var(--theme-shadow);
}

.snippet__image {
  grid-area: image;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.snippet:hover .snippet__image {
  transform: scale(1.02);
}
.snippet__title {
  grid-area: title;
}
.snippet__meta {
  grid-area: meta;
  color: var(--theme-text-muted);
}

.snippet__meta span {
  color: var(--theme-text);
}

.snippet .btn {
  grid-area: button;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.snippet:hover .btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.snippet__title {
  color: var(--theme-text);
  font-size: var(--fs-500);
}

.snippet__title a {
  color: inherit;
  text-decoration: none;
}

.snippet__title a:hover,
.snippet__title a:focus {
  color: var(--theme-accent);
} 

@media (min-width: 45em) {
  .snippet {
    grid-template-areas:
      "title image"
      "meta image"
      "body image"
      "button image";
    grid-column-gap: 4em;
    grid-template-columns: 1fr 40%;
    grid-template-rows: min-content min-content min-content 1fr;
  }
}

.btn {
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1;
  padding: 0.9rem 1.4rem;
  
  /* Modern ultra-rounded pill shape */
  border-radius: 50px;
  
  align-self: start;
  justify-self: start;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Enhanced typography */
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
  
  /* Ensure touch targets are properly sized */
  min-height: 44px;
  min-width: 44px;
  
  /* Touch optimizations */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  
  /* Performance optimizations */
  will-change: transform, box-shadow;
  transform: translateZ(0);
  position: relative;
  z-index: 1;
}

.btn:focus {
  outline: 2px solid var(--theme-accent);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 37,99,235), 0.2);
}

.btn--primary {
  color: white;
  font-weight: 500;
  
  /* Modern gradient background */
  background: linear-gradient(135deg, 
    var(--theme-accent) 0%, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.9) 100%);
  border: 1.5px solid var(--theme-accent);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  
  /* Enhanced modern shadow system */
  box-shadow: 
    0 4px 16px rgba(var(--accent-rgb, 37, 99, 235), 0.25),
    0 2px 8px rgba(var(--accent-rgb, 37, 99, 235), 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.btn--primary:hover,
.btn--primary:focus {
  color: white;
  
  /* Enhanced hover gradient */
  background: linear-gradient(135deg, 
    rgba(var(--accent-rgb, 37, 99, 235), 1) 0%, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.8) 100%);
  border-color: var(--theme-accent);
  
  /* Enhanced hover shadow */
  box-shadow: 
    0 8px 32px rgba(var(--accent-rgb, 37, 99, 235), 0.35),
    0 4px 16px rgba(var(--accent-rgb, 37, 99, 235), 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  
  /* Smooth lift effect */
  transform: translateY(-2px) translateZ(0);
}

.btn--primary:active {
  /* Pressed state with inset effect */
  background: linear-gradient(135deg, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.8) 0%, 
    rgba(var(--accent-rgb, 37, 99, 235), 0.6) 100%);
  box-shadow: 
    0 2px 8px rgba(var(--accent-rgb, 37, 99, 235), 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(0px) scale(0.98) translateZ(0);
  transition: all 0.15s ease-out;
}

.btn--neutral {
  color: var(--theme-text);
  font-weight: 500;
  
  /* Enhanced glassmorphic background */
  background: linear-gradient(135deg, 
    var(--theme-card-bg) 0%, 
    rgba(255, 255, 255, 0.8) 100%);
  border: 1.5px solid var(--theme-border);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  
  /* Enhanced shadow system */
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.btn--neutral:hover,
.btn--neutral:focus {
  color: var(--theme-text);
  
  /* Enhanced hover background */
  background: linear-gradient(135deg, 
    var(--theme-bg-secondary) 0%, 
    rgba(255, 255, 255, 0.9) 100%);
  border-color: var(--theme-border);
  
  /* Enhanced hover shadow */
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  
  /* Smooth lift effect */
  transform: translateY(-2px) translateZ(0);
}

.btn--neutral:active {
  /* Pressed state */
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.6) 0%, 
    rgba(255, 255, 255, 0.4) 100%);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(0px) scale(0.98) translateZ(0);
  transition: all 0.15s ease-out;
}

/* Mobile-specific button optimizations */
@media (max-width: 768px) {
  .btn {
    padding: 1rem 1.5rem;
    min-height: 48px;
    min-width: 48px;
    font-size: 0.9rem;
    font-weight: 600;
    
    /* Maintain pill shape on mobile */
    border-radius: 50px;
  }
  
  .btn--primary {
    /* Enhanced mobile touch styling */
    background: linear-gradient(135deg, 
      var(--theme-accent) 0%, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.9) 100%);
    border: 1.5px solid var(--theme-accent);
    
    box-shadow: 
      0 6px 20px rgba(var(--accent-rgb, 37, 99, 235), 0.3),
      0 3px 10px rgba(var(--accent-rgb, 37, 99, 235), 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  
  .btn--primary:hover {
    box-shadow: 
      0 8px 24px rgba(var(--accent-rgb, 37, 99, 235), 0.35),
      0 4px 12px rgba(var(--accent-rgb, 37, 99, 235), 0.25);
    transform: translateY(-1px);
  }
  
  .btn--primary:active {
    box-shadow: 
      0 3px 12px rgba(var(--accent-rgb, 37, 99, 235), 0.4),
      inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: scale(0.96) translateY(0px);
  }
}

/* Touch-friendly styles for devices that don't support hover */
@media (hover: none) and (pointer: coarse) {
  .btn {
    padding: 1rem 1.5rem;
    min-height: 48px;
    min-width: 48px;
    font-weight: 600;
    font-size: 0.9rem;
    
    /* Maintain pill shape for touch devices */
    border-radius: 50px;
  }
  
  .btn--primary {
    /* Enhanced touch-friendly styling */
    background: linear-gradient(135deg, 
      var(--theme-accent) 0%, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.9) 100%);
    border: 1.5px solid var(--theme-accent);
    
    box-shadow: 
      0 6px 20px rgba(var(--accent-rgb, 37, 99, 235), 0.3),
      0 3px 10px rgba(var(--accent-rgb, 37, 99, 235), 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  
  .btn--primary:active {
    /* Touch active state */
    background: linear-gradient(135deg, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.8) 0%, 
      rgba(var(--accent-rgb, 37, 99, 235), 0.6) 100%);
    box-shadow: 
      0 4px 16px rgba(var(--accent-rgb, 37, 99, 235), 0.4),
      inset 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: scale(0.96);
    transition: all 0.15s ease;
  }
  
  .btn--neutral:active {
    background: linear-gradient(135deg, 
      rgba(255, 255, 255, 0.6) 0%, 
      rgba(255, 255, 255, 0.4) 100%);
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.1),
      inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: scale(0.96);
    transition: all 0.15s ease;
  }
}

/* Dark theme specific button enhancements */
[data-theme="dark"] .btn--primary {
  background: linear-gradient(135deg, 
    rgba(147, 197, 253, 1) 0%, 
    rgba(147, 197, 253, 0.9) 100%);
  border-color: rgba(147, 197, 253, 1);
  color: var(--theme-bg);
  
  box-shadow: 
    0 4px 16px rgba(147, 197, 253, 0.25),
    0 2px 8px rgba(147, 197, 253, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .btn--primary:hover {
  background: linear-gradient(135deg, 
    rgba(147, 197, 253, 0.9) 0%, 
    rgba(147, 197, 253, 0.8) 100%);
  
  box-shadow: 
    0 8px 32px rgba(147, 197, 253, 0.35),
    0 4px 16px rgba(147, 197, 253, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .btn--neutral {
  background: linear-gradient(135deg, 
    var(--theme-card-bg) 0%, 
    rgba(30, 41, 59, 0.8) 100%);
  border-color: var(--theme-border);
  color: var(--theme-text);
}

/* //////////////////////
  Contact Page
  /////////////////////// */

.contact {
  padding: min(10vh, 10em) 0;
  background: var(--theme-bg);
  min-height: 100vh;
}

.contact__grid {
  display: grid;
  gap: 3em;
  margin-top: 2em;
}

.contact__info {
  background: var(--theme-card-bg);
  padding: 2em;
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--theme-border);
  box-shadow: 0 16px 64px var(--theme-shadow);
  transition: all 0.3s ease;
}

.contact__details {
  display: grid;
  gap: 1.5em;
}

.contact__item h3 {
  color: var(--theme-accent);
  font-size: var(--fs-500);
  margin-bottom: 0.5em;
}

.contact__item a {
  color: var(--theme-text);
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact__item a:hover {
  color: var(--theme-accent);
  text-decoration: underline;
}

.contact__form {
  background: var(--theme-card-bg);
  padding: 2em;
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--theme-border);
  box-shadow: 0 16px 64px var(--theme-shadow);
  transition: all 0.3s ease;
}

.form-group {
  display: grid;
  gap: 0.5em;
}

.form-group label {
  font-weight: var(--fw-700);
  color: var(--theme-text);
  margin-bottom: 0.5em;
}

.form-group input,
.form-group textarea {
  padding: 0.75em;
  border: 2px solid var(--theme-border);
  border-radius: 8px;
  font-size: var(--fs-400);
  background: var(--theme-bg);
  color: var(--theme-text);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

@media (min-width: 45em) {
  .contact__grid {
    grid-template-columns: 1fr 2fr;
  }
}