:root {
  /* Cohesive, professional color system - sophisticated, artistic, optimistic */
  
  /* Backgrounds - Fresh, clean white instead of beige */
  --color-bg: #FFFFFF;
  --color-bg-alt: #FCFCFC;
  
  /* Surfaces */
  --color-surface: #FFFFFF;
  --color-surface-elevated: #FFFFFF;
  --color-surface-nav: rgba(255, 255, 255, 0.85);
  
  /* Text */
  --color-text: #1A1A1A;
  --color-text-muted: #5A5A5A;
  --color-text-inverted: #FFFFFF;
  
  /* Accent (used sparingly for highlights, tags, subtle UI) */
  --color-accent: #B87D5F;
  --color-accent-soft: #F5E8DC;
  
  /* Action (buttons, links, interactive elements) - blue for both modes */
  --color-action: #5B9FD8;
  --color-action-hover: #4A8FC8;
  --color-action-active: #3A7FB8;
  --color-action-disabled: #9CA3AF;
  
  /* Buttons & FAB (blue for AAA accessibility with white text) */
  --color-button: #1565C0;
  --color-button-hover: #0D47A1;
  --color-button-active: #0A3D6B;
  
  /* Borders & Dividers */
  --color-border: rgba(26, 26, 26, 0.12);
  --color-border-soft: rgba(26, 26, 26, 0.08);
  --color-divider: rgba(26, 26, 26, 0.06);
  
  /* Focus States */
  --color-focus: #5B9FD8;
  --color-focus-ring: rgba(91, 159, 216, 0.4);
  
  /* Visualization Colors - Harmonious oranges and purples */
  --viz-orange: #D97757;
  --viz-orange-light: #E8A082;
  --viz-orange-dark: #B85A3A;
  --viz-purple: #8B6FA8;
  --viz-purple-light: #A88BC4;
  --viz-purple-dark: #6B4F88;
  --viz-coral: #E67E7E;
  --viz-coral-light: #F5A5A5;
}

/* Dark Mode */
[data-theme="dark"] {
  /* Backgrounds - Deep, warm dark tones */
  --color-bg: #1A1A1A;
  --color-bg-alt: #222222;
  
  /* Surfaces */
  --color-surface: #2A2A2A;
  --color-surface-elevated: #333333;
  --color-surface-nav: rgba(26, 26, 26, 0.95);
  
  /* Text */
  --color-text: #F5F5F5;
  --color-text-muted: #B0B0B0;
  --color-text-inverted: #1A1A1A;
  
  /* Accent - Blue tones to match action colors in dark mode */
  --color-accent: #5B9FD8;
  --color-accent-soft: rgba(91, 159, 216, 0.15);
  
  /* Action - Slightly brighter blue for dark backgrounds */
  --color-action: #5B9FD8;
  --color-action-hover: #6BAFE8;
  --color-action-active: #4A8FC8;
  --color-action-disabled: #6A6A6A;
  
  /* Buttons & FAB (darker blue for AAA accessibility with white text) */
  --color-button: #1976D2;
  --color-button-hover: #1565C0;
  --color-button-active: #0D47A1;
  
  /* Borders & Dividers */
  --color-border: rgba(255, 255, 255, 0.15);
  --color-border-soft: rgba(255, 255, 255, 0.1);
  --color-divider: rgba(255, 255, 255, 0.08);
  
  /* Focus States */
  --color-focus: #5B9FD8;
  --color-focus-ring: rgba(91, 159, 216, 0.4);
  
  /* Visualization Colors - Harmonious oranges and purples for dark mode */
  --viz-orange: #E8A082;
  --viz-orange-light: #F5B8A0;
  --viz-orange-dark: #D97757;
  --viz-purple: #A88BC4;
  --viz-purple-light: #C4A8E0;
  --viz-purple-dark: #8B6FA8;
  --viz-coral: #F5A5A5;
  --viz-coral-light: #FFB8B8;
  
  /* Error & Warning Colors (same for dark mode) */
  --color-error: #ff6b6b;
  --color-error-text: #ff6b6b;
  --color-error-rgb: 255, 107, 107;
  --color-warning: #f0a500;
  --color-warning-text: #d4940f;
  --color-warning-rgb: 240, 165, 0;
  
  /* Legacy variable mappings for compatibility */
  --bg: var(--color-bg);
  --bg-soft: var(--color-bg-alt);
  --accent: var(--color-accent);
  --accent-light: var(--color-accent-soft);
  --link: var(--color-action);
  --link-hover: var(--color-action-hover);
  --text: var(--color-text);
  --muted: var(--color-text-muted);
  --card: var(--color-surface);
  --border: var(--color-border);
  --border-soft: var(--color-border-soft);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.background {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, rgba(184,125,95,0.04), transparent 45%),
              radial-gradient(circle at 80% 0%, rgba(184,125,95,0.03), transparent 55%),
              radial-gradient(circle at 50% 80%, rgba(184,125,95,0.02), transparent 50%),
              var(--color-bg);
  transition: background 0.3s ease;
}

[data-theme="dark"] .background {
  background: radial-gradient(circle at 20% 20%, rgba(201,154,122,0.08), transparent 45%),
              radial-gradient(circle at 80% 0%, rgba(201,154,122,0.06), transparent 55%),
              radial-gradient(circle at 50% 80%, rgba(201,154,122,0.04), transparent 50%),
              var(--color-bg);
}

.background::before {
  content: '';
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 45deg, rgba(184,125,95,0.04), transparent, rgba(184,125,95,0.02));
  filter: blur(140px);
  animation: slow-rotate 40s linear infinite;
}

.background::after {
  content: '';
  position: absolute;
  inset: -30%;
  background: conic-gradient(from 225deg, rgba(184,125,95,0.05), transparent, rgba(184,125,95,0.06));
  filter: blur(120px);
  animation: slow-rotate-reverse 50s linear infinite;
  opacity: 0.4;
}

@keyframes slow-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes slow-rotate-reverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* CSS Lava Lamp Background - inside of a lava lamp effect */
.lava-lamp-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  /* No blur - completely opaque */
  opacity: 1;
  transition: opacity 0.6s ease;
}

/* Hide on non-homepage */
body:not(.homepage) .lava-lamp-container {
  display: none;
}

/* Temporarily hide lava lamp animation */
.lava-lamp-container {
  display: none !important;
}

/* Wavy liquid layer at top - 6px, liquidy and wavy */
.lava-lamp-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--color-text);
  opacity: 1; /* Completely opaque */
  /* Wavy liquid effect using clip-path */
  clip-path: polygon(
    0% 0%,
    5% 100%,
    15% 0%,
    25% 100%,
    35% 0%,
    45% 100%,
    55% 0%,
    65% 100%,
    75% 0%,
    85% 100%,
    95% 0%,
    100% 100%,
    100% 0%
  );
  animation: waveTop 8s ease-in-out infinite;
}

/* Thin liquid layer at bottom - 12px, blobs ooze from here */
.lava-lamp-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 12px;
  background: var(--color-text);
  opacity: 1; /* Completely opaque */
  /* Smooth flowing liquid effect */
  clip-path: polygon(
    0% 100%,
    8% 20%,
    16% 100%,
    24% 10%,
    32% 100%,
    40% 15%,
    48% 100%,
    56% 8%,
    64% 100%,
    72% 12%,
    80% 100%,
    88% 18%,
    96% 100%,
    100% 100%
  );
  animation: waveBottom 4s ease-in-out infinite;
}

/* Wavy animation for top layer */
@keyframes waveTop {
  0%, 100% {
    clip-path: polygon(
      0% 0%,
      5% 100%,
      15% 0%,
      25% 100%,
      35% 0%,
      45% 100%,
      55% 0%,
      65% 100%,
      75% 0%,
      85% 100%,
      95% 0%,
      100% 100%,
      100% 0%
    );
  }
  50% {
    clip-path: polygon(
      0% 0%,
      8% 100%,
      18% 0%,
      28% 100%,
      38% 0%,
      48% 100%,
      58% 0%,
      68% 100%,
      78% 0%,
      88% 100%,
      98% 0%,
      100% 100%,
      100% 0%
    );
  }
}

/* Smooth flowing animation for bottom layer */
@keyframes waveBottom {
  0%, 100% {
    clip-path: polygon(
      0% 100%,
      8% 20%,
      16% 100%,
      24% 10%,
      32% 100%,
      40% 15%,
      48% 100%,
      56% 8%,
      64% 100%,
      72% 12%,
      80% 100%,
      88% 18%,
      96% 100%,
      100% 100%
    );
  }
  33% {
    clip-path: polygon(
      0% 100%,
      10% 15%,
      18% 100%,
      26% 12%,
      34% 100%,
      42% 18%,
      50% 100%,
      58% 10%,
      66% 100%,
      74% 14%,
      82% 100%,
      90% 20%,
      98% 100%,
      100% 100%
    );
  }
  66% {
    clip-path: polygon(
      0% 100%,
      6% 25%,
      14% 100%,
      22% 8%,
      30% 100%,
      38% 12%,
      46% 100%,
      54% 15%,
      62% 100%,
      70% 10%,
      78% 100%,
      86% 16%,
      94% 100%,
      100% 100%
    );
  }
}

/* Organic blob shapes - stretch from bottom liquid, flowing smoothly */
.lava-lamp-blob {
  position: absolute;
  width: 280px;
  height: 80px; /* Start tall and thin - stretched from bottom */
  /* Organic blob shape - wider at bottom, narrower at top initially */
  border-radius: 50% 50% 45% 55% / 60% 60% 40% 40%;
  background: var(--color-text); /* Exact same color as hero text */
  /* No blur - completely opaque */
  opacity: 1;
  /* Start connected to bottom layer - stretching upward */
  bottom: 12px; /* Right at top of bottom liquid layer */
  left: 50%;
  transform: translateX(-50%) scaleY(1);
  transform-origin: bottom center; /* Scale from bottom */
  /* Smooth, flowing animation */
  animation: lavaFlow 8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Fewer blobs - 3 blobs with organic flowing shapes */
.blob-1 {
  left: 25%;
  animation-duration: 8s;
  animation-delay: 0s;
  width: 300px;
  height: 90px;
}

.blob-2 {
  left: 55%;
  animation-duration: 9s;
  animation-delay: 10s; /* Wait 10s before starting */
  width: 260px;
  height: 75px;
}

.blob-3 {
  left: 38%;
  animation-duration: 8.5s;
  animation-delay: 22s; /* Wait 22s before starting */
  width: 280px;
  height: 85px;
}

/* Smooth liquid flow animation - stretching from bottom to top */
@keyframes lavaFlow {
  0% {
    bottom: 12px; /* Connected to bottom layer */
    height: 80px;
    width: 280px;
    transform: translateX(-50%) scaleY(1) scaleX(1);
    border-radius: 50% 50% 45% 55% / 60% 60% 40% 40%;
    opacity: 1;
  }
  5% {
    /* Start stretching upward - pulling from bottom layer */
    bottom: 12px;
    height: 120px;
    width: 260px;
    transform: translateX(-50%) scaleY(1.2) scaleX(0.95);
    border-radius: 48% 52% 42% 58% / 55% 55% 45% 45%;
    opacity: 1;
  }
  20% {
    /* Continue stretching - blob forming */
    bottom: 8%;
    height: 180px;
    width: 240px;
    transform: translateX(-50%) scaleY(1.5) scaleX(0.9);
    border-radius: 45% 55% 40% 60% / 50% 50% 50% 50%;
    opacity: 1;
  }
  40% {
    /* Mid-rise - blob fully formed, flowing upward */
    bottom: 30%;
    height: 220px;
    width: 220px;
    transform: translateX(-50%) scaleY(1.3) scaleX(1);
    border-radius: 40% 60% 50% 50% / 45% 45% 55% 55%;
    opacity: 1;
  }
  60% {
    /* Continuing flow - maintaining shape */
    bottom: 50%;
    height: 240px;
    width: 200px;
    transform: translateX(-50%) scaleY(1.2) scaleX(1.05);
    border-radius: 50% 50% 45% 55% / 50% 50% 50% 50%;
    opacity: 1;
  }
  80% {
    /* Approaching top - stretching to connect */
    bottom: 75%;
    height: 200px;
    width: 180px;
    transform: translateX(-50%) scaleY(1.1) scaleX(1.1);
    border-radius: 45% 55% 50% 50% / 55% 55% 45% 45%;
    opacity: 1;
  }
  95% {
    /* Connecting to top layer - stretching thin */
    bottom: calc(100vh - 6px);
    height: 60px;
    width: 160px;
    transform: translateX(-50%) scaleY(0.8) scaleX(1.2);
    border-radius: 50% 50% 48% 52% / 60% 60% 40% 40%;
    opacity: 1;
  }
  100% {
    /* Merged into top layer - fade out */
    bottom: 100vh;
    height: 40px;
    width: 140px;
    transform: translateX(-50%) scaleY(0.5) scaleX(1.3);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0; /* Fade out as it merges */
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .lava-lamp-container::before {
    height: 5px; /* Slightly thinner on mobile */
  }
  
  .lava-lamp-container::after {
    height: 10px; /* Slightly thinner on mobile */
  }
  
  .lava-lamp-blob {
    width: 220px;
    height: 70px; /* Proportionally smaller */
    bottom: 10px; /* Adjust for thinner bottom layer */
  }
  
  .blob-1 {
    width: 240px;
    height: 75px;
  }
  
  .blob-2 {
    width: 200px;
    height: 60px;
  }
  
  .blob-3 {
    width: 220px;
    height: 70px;
  }
  
  /* Adjust animation for mobile - start position */
  @keyframes lavaFlow {
    0% {
      bottom: 10px;
      height: 70px;
      width: 220px;
      transform: translateX(-50%) scaleY(1) scaleX(1);
      border-radius: 50% 50% 45% 55% / 60% 60% 40% 40%;
      opacity: 1;
    }
    5% {
      bottom: 10px;
      height: 100px;
      width: 200px;
      transform: translateX(-50%) scaleY(1.2) scaleX(0.95);
      border-radius: 48% 52% 42% 58% / 55% 55% 45% 45%;
      opacity: 1;
    }
    20% {
      bottom: 8%;
      height: 150px;
      width: 180px;
      transform: translateX(-50%) scaleY(1.5) scaleX(0.9);
      border-radius: 45% 55% 40% 60% / 50% 50% 50% 50%;
      opacity: 1;
    }
    40% {
      bottom: 30%;
      height: 180px;
      width: 160px;
      transform: translateX(-50%) scaleY(1.3) scaleX(1);
      border-radius: 40% 60% 50% 50% / 45% 45% 55% 55%;
      opacity: 1;
    }
    60% {
      bottom: 50%;
      height: 200px;
      width: 140px;
      transform: translateX(-50%) scaleY(1.2) scaleX(1.05);
      border-radius: 50% 50% 45% 55% / 50% 50% 50% 50%;
      opacity: 1;
    }
    80% {
      bottom: 75%;
      height: 160px;
      width: 120px;
      transform: translateX(-50%) scaleY(1.1) scaleX(1.1);
      border-radius: 45% 55% 50% 50% / 55% 55% 45% 45%;
      opacity: 1;
    }
    95% {
      bottom: calc(100vh - 5px);
      height: 50px;
      width: 100px;
      transform: translateX(-50%) scaleY(0.8) scaleX(1.2);
      border-radius: 50% 50% 48% 52% / 60% 60% 40% 40%;
      opacity: 1;
    }
    100% {
      bottom: 100vh;
      height: 30px;
      width: 90px;
      transform: translateX(-50%) scaleY(0.5) scaleX(1.3);
      border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
      opacity: 0;
    }
  }
}



@keyframes float {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  33% { transform: translateY(-20px) translateX(10px); }
  66% { transform: translateY(10px) translateX(-15px); }
}

/* Navigation Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1), 
              background 300ms ease,
              backdrop-filter 300ms ease,
              box-shadow 300ms ease,
              border-color 300ms ease;
  transform: translateY(0);
}

/* Make header more opaque on mobile by default for better readability */
@media (max-width: 768px) {
  header {
    background: rgba(252, 252, 252, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  }
  
  [data-theme="dark"] header {
    background: rgba(34, 34, 34, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  }
}

header.hidden {
  transform: translateY(-100%);
}

[data-theme="dark"] header {
  background: rgba(26, 26, 26, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] header.scrolled {
  background: rgba(34, 34, 34, 0.95) !important;
  backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5) !important;
}

header.scrolled {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  background: rgba(252, 252, 252, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

header .breadcrumb {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem) 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  justify-content: flex-start;
  width: 100%;
  position: relative;
  z-index: 10;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 0.75rem; /* Increased from 0.5rem to 0.75rem (12px) for more spacing */
  margin-top: 0.5rem; /* Additional margin-top (8px) for total ~12px spacing */
  text-align: left;
}

[data-theme="dark"] header .breadcrumb {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.breadcrumb a {
  color: var(--color-action);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  margin: 0 0.25rem;
  color: var(--color-text-muted);
  opacity: 0.5;
}

/* Section Navigation - Bottom of pages */
.section-navigation {
  display: flex;
  justify-content: flex-start; /* Left align the chips */
  align-items: center;
  gap: 12px !important; /* Gap between buttons - 12px */
  margin-top: 2rem; /* Reduced from 5rem - closer to content above */
  margin-left: 0; /* Flush left with text */
  margin-bottom: 2rem; /* Space before contact section */
  padding-left: 0; /* No left padding - flush left */
  padding-top: 0;
  padding-bottom: var(--rhythm-unit);
}

@media (max-width: 768px) {
  .section-navigation {
    gap: 4px !important; /* Gap on tablet/mobile - 4px */
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .section-navigation {
    gap: 12px !important; /* Gap on small mobile - 12px */
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
  }
}

.section-nav-button {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.36rem 0.72rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  /* Ensure border is visible */
  border-width: 1px;
  border-style: solid;
  margin-right: 4px !important; /* Add spacing between buttons - 4px */
}

.section-nav-button:last-child {
  margin-right: 0 !important; /* Remove margin from last button */
}

@media (max-width: 768px) {
  .section-nav-button {
    margin-right: 4px !important;
  }
  
  .section-nav-button:last-child {
    margin-right: 0 !important;
  }
}

@media (max-width: 480px) {
  .section-nav-button {
    margin-right: 4px !important;
  }
  
  .section-nav-button:last-child {
    margin-right: 0 !important;
  }
}

.section-nav-button:hover {
  color: var(--color-text);
  border-color: var(--color-border);
  background: rgba(26, 26, 26, 0.04);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.section-nav-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.section-nav-button.current {
  color: #1565C0; /* Dark blue text for readability on light blue background */
  background: rgba(91, 159, 216, 0.15); /* Light blue background */
  border-color: rgba(91, 159, 216, 0.3); /* Subtle blue border */
  cursor: default;
  pointer-events: none;
  opacity: 1;
}

.section-nav-button.current:hover {
  transform: none;
  box-shadow: none;
  background: rgba(91, 159, 216, 0.15); /* Keep light blue on hover */
}

[data-theme="dark"] .section-nav-button {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

[data-theme="dark"] .section-nav-button:hover {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .section-nav-button:active {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .section-nav-button.current {
  background: rgba(91, 159, 216, 0.25); /* Slightly more opaque light blue for dark mode */
  border-color: rgba(91, 159, 216, 0.4); /* Subtle blue border */
  color: #E3F2FD; /* Light blue text for readability on darker background */
}

/* Home button - icon-based, matches non-current button styling exactly */
.section-nav-home {
  /* Inherits all base styles from .section-nav-button */
  /* Explicitly ensure it has non-current styling (transparent background, muted text) */
  color: var(--color-text-muted) !important;
  background: transparent !important;
  border-color: var(--color-border) !important;
  min-height: auto; /* Let it size naturally to match others */
  line-height: 1.5; /* Match text line-height */
}

/* Home icon styling - sized larger to match text button height exactly */
.home-icon {
  width: 1.4rem; /* Larger to match text visual height */
  height: 1.4rem; /* Larger to match text visual height */
  display: block;
  color: var(--color-action); /* Blue like links */
  flex-shrink: 0; /* Prevent icon from shrinking */
}

.section-nav-home:hover {
  color: var(--color-text) !important;
  background: rgba(26, 26, 26, 0.04) !important;
}

.section-nav-home:hover .home-icon {
  color: var(--color-action-hover); /* Darker blue on hover */
}

[data-theme="dark"] .section-nav-home .home-icon {
  color: var(--color-action); /* Blue like links in dark mode */
}

[data-theme="dark"] .section-nav-home:hover .home-icon {
  color: var(--color-action-hover); /* Darker blue on hover in dark mode */
}

@media (max-width: 768px) {
  .section-navigation {
    gap: 12px !important; /* Gap on mobile - 12px */
    flex-wrap: wrap;
    justify-content: flex-start; /* Left align on mobile too */
    margin-left: 0; /* Flush left on mobile too */
    padding-left: 0; /* No left padding on mobile */
  }
  
  .section-nav-button {
    font-size: 0.875rem;
    padding: 0.3rem 0.6rem;
  }
}

@media (max-width: 768px) {
  header .breadcrumb {
    font-size: 0.85rem;
    gap: 0.375rem;
    padding-top: 0.75rem; /* Increased padding-top (12px) */
    margin-top: 0.5rem; /* Additional margin-top (8px) */
    padding-bottom: 0.5rem;
  }
  
  .breadcrumb-link {
    padding: 0.2rem 0.4rem;
  }
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  transition: all 300ms ease;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(184,125,95,0.25), rgba(184,125,95,0.12));
  border: 2px solid rgba(184,125,95,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  transition: all 300ms ease;
  overflow: hidden;
  position: relative;
  z-index: 1002;
}

/* Sparkle effect container */
.avatar-sparkles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* Individual sparkle particle */
.sparkle-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Removed blur and preserve-3d for better performance */
}

/* Sparkle particle color variants - harmonious palette with more presence */
.sparkle-particle.color-tan {
  background: radial-gradient(circle, rgba(184, 125, 95, 1) 0%, rgba(184, 125, 95, 0.75) 40%, rgba(184, 125, 95, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(184, 125, 95, 0.8),
              0 0 20px rgba(184, 125, 95, 0.6),
              0 0 30px rgba(184, 125, 95, 0.4),
              0 0 40px rgba(184, 125, 95, 0.2);
}

.sparkle-particle.color-blue {
  background: radial-gradient(circle, rgba(42, 111, 175, 1) 0%, rgba(42, 111, 175, 0.75) 40%, rgba(42, 111, 175, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(42, 111, 175, 0.8),
              0 0 20px rgba(42, 111, 175, 0.6),
              0 0 30px rgba(42, 111, 175, 0.4),
              0 0 40px rgba(42, 111, 175, 0.2);
}

.sparkle-particle.color-orange {
  background: radial-gradient(circle, rgba(217, 119, 87, 1) 0%, rgba(217, 119, 87, 0.75) 40%, rgba(217, 119, 87, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(217, 119, 87, 0.8),
              0 0 20px rgba(217, 119, 87, 0.6),
              0 0 30px rgba(217, 119, 87, 0.4),
              0 0 40px rgba(217, 119, 87, 0.2);
}

.sparkle-particle.color-purple {
  background: radial-gradient(circle, rgba(139, 111, 168, 1) 0%, rgba(139, 111, 168, 0.75) 40%, rgba(139, 111, 168, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(139, 111, 168, 0.8),
              0 0 20px rgba(139, 111, 168, 0.6),
              0 0 30px rgba(139, 111, 168, 0.4),
              0 0 40px rgba(139, 111, 168, 0.2);
}

.sparkle-particle.color-coral {
  background: radial-gradient(circle, rgba(230, 126, 126, 1) 0%, rgba(230, 126, 126, 0.75) 40%, rgba(230, 126, 126, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(230, 126, 126, 0.8),
              0 0 20px rgba(230, 126, 126, 0.6),
              0 0 30px rgba(230, 126, 126, 0.4),
              0 0 40px rgba(230, 126, 126, 0.2);
}

.sparkle-particle.color-gold {
  background: radial-gradient(circle, rgba(255, 193, 7, 1) 0%, rgba(255, 193, 7, 0.75) 40%, rgba(255, 193, 7, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.8),
              0 0 20px rgba(255, 193, 7, 0.6),
              0 0 30px rgba(255, 193, 7, 0.4),
              0 0 40px rgba(255, 193, 7, 0.2);
}

.sparkle-particle.color-teal {
  background: radial-gradient(circle, rgba(77, 182, 172, 1) 0%, rgba(77, 182, 172, 0.75) 40%, rgba(77, 182, 172, 0.4) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(77, 182, 172, 0.8),
              0 0 20px rgba(77, 182, 172, 0.6),
              0 0 30px rgba(77, 182, 172, 0.4),
              0 0 40px rgba(77, 182, 172, 0.2);
}

/* Sparkle animation - optimized for smooth rendering */
@keyframes sparkle-burst {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(0.5) rotate(0deg);
  }
  33% {
    opacity: 0.9;
    transform: translate3d(calc(var(--sparkle-x) * 0.65), calc(var(--sparkle-y) * 0.65), 0) scale(1.1) rotate(360deg);
  }
  66% {
    opacity: 0.7;
    transform: translate3d(calc(var(--sparkle-x) * 0.9), calc(var(--sparkle-y) * 0.9 + 70px), 0) scale(1.3) rotate(720deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(var(--sparkle-x) * 1.05), calc(var(--sparkle-y) * 1.05 + 150px), 0) scale(1.5) rotate(1080deg);
  }
}

/* Additional sparkle trail effect for some particles */
.sparkle-particle.trail {
  opacity: 0.6;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar::after {
  content: 'SB';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(184,125,95,0.25), rgba(184,125,95,0.12));
  transition: opacity 300ms ease;
}

.avatar.has-image::after {
  opacity: 0;
  pointer-events: none;
}

.logo-link:hover .avatar {
  transform: scale(1.05);
  border-color: rgba(91, 159, 216, 0.35);
  box-shadow: 0 4px 12px rgba(91, 159, 216, 0.12);
}

.logo-text {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.2;
  display: inline-block;
  color: var(--text);
  position: relative;
}

.logo-text::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  transform: scaleX(0);
  width: 100%;
  height: 2px;
  background: var(--color-action);
  transition: transform 300ms ease;
  transform-origin: left;
}

/* Make underline more visible in light mode using action color */
:not([data-theme="dark"]) .logo-text::after {
  background: var(--color-action);
  height: 2.5px;
}

.logo-link:hover .logo-text::after,
.logo-link:focus .logo-text::after {
  transform: scaleX(1);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  margin-left: auto;
}

.nav-links .theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  margin-left: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
  color: var(--color-text-muted);
  z-index: 1001;
  gap: 0.5rem;
  white-space: nowrap;
}

/* Hide mobile theme toggle on desktop */
.theme-toggle-mobile {
  display: none;
}

.nav-links .theme-toggle:hover,
.nav-links .theme-toggle:focus {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
  transform: none;
  outline: none;
}

.nav-item {
  position: relative;
  z-index: 1001;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.5rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 300ms ease;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--color-action);
  transition: transform 300ms ease;
}

/* Make underline more visible in light mode using action color */
:not([data-theme="dark"]) .nav-link::after {
  background: var(--color-action);
  height: 2.5px;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* Contact link should not have underline */
.nav-link.open-contact-modal::after {
  display: none;
}

.dropdown-toggle {
  padding-right: 1.5rem;
}

.dropdown-toggle::before {
  content: '▼';
  position: absolute;
  right: 0.75rem;
  font-size: 0.6rem;
  transition: transform 300ms ease;
}

.nav-item:hover .dropdown-toggle::before {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background: var(--color-surface);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 0.5rem 0.4rem;
  min-width: 190px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(26, 26, 26, 0.10), 0 1.5px 6px rgba(26, 26, 26, 0.08);
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 1002;
  pointer-events: none;
}

/* Invisible bridge area extending upward to fill the gap and maintain hover */
.dropdown-menu::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 0.5rem;
  background: transparent;
  pointer-events: auto;
}

.nav-item:hover .dropdown-menu,
.dropdown-menu:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  padding: 0;
  margin: 0;
  list-style: none;
}

.dropdown-link {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.95rem;
  border-radius: 7px;
  transition: background 200ms ease, color 200ms ease;
  margin-bottom: 0;
  letter-spacing: 0.01em;
}

.dropdown-item:last-child .dropdown-link {
  margin-bottom: 0;
}

.dropdown-link:hover,
.dropdown-link:focus {
  background-color: rgba(91, 159, 216, 0.1);
  color: var(--color-action-hover);
  text-decoration: none;
}


/* Theme Toggle - General styles (for mobile menu) */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-text);
  z-index: 1001;
  gap: 0.5rem;
}

.theme-toggle:hover,
.theme-toggle:focus {
  outline: none;
}

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

.theme-toggle-icon {
  display: block;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle-label {
  display: block; /* Show label on desktop */
  font-size: 0.95rem;
  font-weight: 500;
  color: inherit;
}

[data-theme="dark"] .theme-toggle-icon {
  transform: rotate(180deg);
}

/* Hamburger Menu */
.hamburger {
  display: none !important;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  position: relative;
  background: transparent;
  border: none;
  align-items: center;
  justify-content: center;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Ensure hamburger is hidden on desktop */
@media (min-width: 769px) {
  .hamburger {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 300ms ease;
  display: block;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .hamburger {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }
  
  .hamburger span {
    background: var(--color-text) !important;
  }
  
  /* Hide desktop theme toggle on mobile */
  .nav-links > .nav-item:not(.theme-toggle-mobile) > .theme-toggle {
    display: none !important;
  }
  
  /* Show mobile theme toggle in mobile menu */
  .theme-toggle-mobile {
    display: block;
  }
  
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: rgba(255, 251, 246, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--color-border-soft);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 1.5rem 2rem;
    gap: 0;
    transition: right 300ms ease-out;
    overflow-y: auto;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
  }
  
  [data-theme="dark"] .nav-links {
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  
  .theme-toggle-mobile {
    width: 100%;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-soft);
  }
  
  .theme-toggle-mobile .theme-toggle {
    display: flex;
    width: 100%;
    max-width: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    justify-content: flex-start;
    height: auto;
    margin: 0;
  }
  
  .theme-toggle-mobile .theme-toggle:hover {
    background: var(--color-surface-elevated);
    transform: none;
  }
  
  .theme-toggle-mobile .theme-toggle-label {
    display: block;
    margin-left: 0.5rem;
  }

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

  .nav-item {
    width: 100%;
  }

  .nav-link {
    width: 100%;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 0.25rem;
  }
  
  .nav-link::after {
    left: 1rem;
    transform: scaleX(0);
    width: calc(100% - 2rem);
  }
  
  .nav-link:hover::after,
  .nav-link.active::after {
    transform: scaleX(1);
  }
  
  /* Contact link should not have underline on mobile */
  .nav-link.open-contact-modal::after {
    display: none;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
    flex-direction: column;
    margin-top: 0.5rem;
    margin-left: 1rem;
    width: calc(100% - 2rem);
    box-shadow: none;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 0.5rem 0;
  }

  .nav-item.active .dropdown-menu {
    display: flex;
    flex-direction: column;
  }

  .dropdown-toggle::before {
    transform: rotate(0deg);
  }

  .nav-item.active .dropdown-toggle::before {
    transform: rotate(180deg);
  }

  .logo-text {
    font-size: 1.2rem;
  }
}

@media (max-width: 360px) {
  .logo-text {
    display: none;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 1rem 1.25rem;
  }
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 4vw, 3rem) 6rem;
  padding-top: calc(2rem + 80px);
}

/* Adjust padding when breadcrumb is present in header */
header:has(.breadcrumb) ~ main {
  padding-top: calc(2rem + 80px + 2.5rem);
}

@media (max-width: 768px) {
  main {
    padding-top: calc(1rem + 70px);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-bottom: 4rem;
  }

  header:has(.breadcrumb) ~ main {
    padding-top: calc(1rem + 70px + 2rem);
  }

  /* Harmonious typography scale on mobile - H2 is reference point */
  h1 {
    font-size: clamp(1.35rem, 4.5vw, 1.8rem); /* Smaller than hero, larger than H2 */
  }

  h2 {
    font-size: clamp(1rem, 3.5vw, 1.35rem); /* Reference size - smaller than hero */
  }

  h3 {
    font-size: clamp(0.9rem, 3vw, 1.15rem); /* ~0.85x H2 */
  }

  h4 {
    font-size: clamp(0.8rem, 2.6vw, 1rem); /* ~0.75x H2 */
  }

  h5 {
    font-size: clamp(0.7rem, 2.3vw, 0.9rem); /* ~0.65x H2 */
  }

  h6 {
    font-size: clamp(0.6rem, 1.9vw, 0.75rem); /* ~0.55x H2 */
  }
}

@media (max-width: 480px) {
  main {
    padding-top: calc(0.75rem + 65px);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-bottom: 3rem;
  }

  header:has(.breadcrumb) ~ main {
    padding-top: calc(0.75rem + 65px + 1.75rem);
  }

  /* Harmonious typography scale on mobile - H2 is reference point */
  h1 {
    font-size: clamp(1.35rem, 4.5vw, 1.8rem); /* Smaller than hero, larger than H2 */
  }

  h2 {
    font-size: clamp(1rem, 3.5vw, 1.35rem); /* Reference size - smaller than hero */
  }

  h3 {
    font-size: clamp(0.9rem, 3vw, 1.15rem); /* ~0.85x H2 */
  }

  h4 {
    font-size: clamp(0.8rem, 2.6vw, 1rem); /* ~0.75x H2 */
  }

  h5 {
    font-size: clamp(0.7rem, 2.3vw, 0.9rem); /* ~0.65x H2 */
  }

  h6 {
    font-size: clamp(0.6rem, 1.9vw, 0.75rem); /* ~0.55x H2 */
  }
}

@media (max-width: 375px) {
  /* Harmonious typography scale on small mobile - H2 is reference point */
  h1 {
    font-size: clamp(1.2rem, 4.5vw, 1.65rem); /* Smaller than hero, larger than H2 */
  }

  h2 {
    font-size: clamp(0.9rem, 3.5vw, 1.2rem); /* Reference size - smaller than hero */
  }

  h3 {
    font-size: clamp(0.8rem, 3vw, 1rem); /* ~0.85x H2 */
  }

  h4 {
    font-size: clamp(0.7rem, 2.6vw, 0.9rem); /* ~0.75x H2 */
  }

  h5 {
    font-size: clamp(0.6rem, 2.3vw, 0.8rem); /* ~0.65x H2 */
  }

  h6 {
    font-size: clamp(0.55rem, 1.9vw, 0.7rem); /* ~0.55x H2 */
  }
}

section {
  margin-bottom: 6rem;
  margin-top: 0;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  position: relative;
  z-index: 1;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Vertical Rhythm - Base unit: 1.5rem */
:root {
  --rhythm-unit: 1.5rem;
  --rhythm-2x: 3rem;
  --rhythm-3x: 4.5rem;
  --rhythm-4x: 6rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  margin-top: 0;
}

h1 {
  line-height: 1.5;
  margin-bottom: var(--rhythm-unit);
  margin-top: 0;
}

h2 {
  font-size: 2.25rem;
  line-height: 1.5;
  margin-top: var(--rhythm-3x);
  margin-bottom: var(--rhythm-unit);
}

h2:first-child {
  margin-top: 0;
}

h3 {
  font-size: 1.5rem;
  line-height: 1.5;
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-unit);
}

h4 {
  font-size: 1.25rem;
  line-height: 1.5;
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-unit);
}

h5 {
  font-size: 1.1rem;
  line-height: 1.5;
  margin-top: var(--rhythm-unit);
  margin-bottom: calc(var(--rhythm-unit) * 0.75);
}

h6 {
  font-size: 1rem;
  line-height: 1.5;
  margin-top: var(--rhythm-unit);
  margin-bottom: calc(var(--rhythm-unit) * 0.75);
}

p {
  color: var(--color-text-muted);
  font-weight: 400;
  line-height: 1.5;
  margin-top: 0;
  margin-bottom: var(--rhythm-unit);
}

p:last-child {
  margin-bottom: 0;
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--rhythm-unit);
  padding-left: 1.5rem;
}

li {
  margin-bottom: calc(var(--rhythm-unit) * 0.5);
  line-height: 1.5;
}

li:last-child {
  margin-bottom: 0;
}

/* Sections - ensure proper spacing (consolidated with above) */
section:last-child {
  margin-bottom: 0;
}

/* Mobile-specific section spacing - using screen media query for better mobile device targeting */
@media screen and (max-width: 768px) {
section {
    margin-bottom: 4rem !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
}

section:last-child {
    margin-bottom: 0 !important;
  }
  
  main section {
    margin-bottom: 4rem !important;
  }
}

@media screen and (max-width: 480px) {
  section {
    margin-bottom: 3rem !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }
  
  section:last-child {
    margin-bottom: 0 !important;
  }
  
  main section {
    margin-bottom: 3rem !important;
  }
}

.about,
.contact {
  margin-top: var(--rhythm-4x);
  margin-bottom: var(--rhythm-4x);
}

.about h2,
.contact h2 {
  margin-top: 0;
}

@media (max-width: 768px) {
  .about,
  .contact {
    margin-top: 4rem;
    margin-bottom: 4rem;
  }
  
  .contact {
    padding-top: 4rem !important; /* Match section bottom spacing on mobile */
  }
}

@media (max-width: 480px) {
  .about,
  .contact {
    margin-top: 3rem;
    margin-bottom: 3rem;
  }
  
  .contact {
    padding-top: 3rem !important; /* Match section bottom spacing on small mobile */
  }
}

/* Content spacing adjustments */
.principle-examples {
  margin-top: var(--rhythm-unit);
  margin-bottom: var(--rhythm-unit);
}

.contact-links {
  margin-top: var(--rhythm-unit);
}

blockquote {
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
  padding-left: var(--rhythm-unit);
  border-left: 3px solid var(--color-border-soft);
}

.approach p,
section.approach p {
  max-width: 100% !important;
  width: 100% !important;
}

/* Limit body copy to 50% width on large viewports for optimal readability */
@media (min-width: 1024px) {
  /* Removed 50% width constraint - paragraphs should use full width for better readability */
  
  /* Keep full width for specific elements that need it */
  .principle-examples,
  .principle-images-gallery,
  .design-principles-grid,
  .projects-grid,
  .clients-grid,
  .skills,
  .contact-links,
  .contact p,
  .skill-group p,
  .skill-group strong,
  .approach p {
    max-width: 100% !important;
  }
}

/* Links - bold font weight for accessibility (non-color affordance) */
a:not(.cta):not(.nav-link):not(.logo-link):not(.logo-text):not(.dropdown-toggle):not(.dropdown-link) {
  color: var(--color-action);
  text-decoration: none;
  font-weight: 600;
  transition: background-color 200ms ease, color 200ms ease;
  padding: 0.25em 0.5em; /* Consistent padding to prevent shift on hover */
  margin: -0.25em -0.5em; /* Negative margin to offset padding and prevent layout shift */
  border-radius: 3px;
}

a:not(.cta):not(.nav-link):not(.logo-link):not(.logo-text):not(.dropdown-toggle):not(.dropdown-link):hover {
  background-color: rgba(91, 159, 216, 0.1);
  color: var(--color-action-hover);
}

.hero {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  opacity: 1;
  transform: none;
  position: relative;
  margin: 0;
  margin-bottom: 1.5rem; /* Reduced from var(--rhythm-4x) to minimize gap after hero */
  max-width: 1100px;
  padding: 0;
  padding-left: clamp(1.25rem, 4vw, 3rem);
  padding-right: clamp(1.25rem, 4vw, 3rem);
  padding-top: 0; /* No top padding on large screens - let justify-content: center handle it */
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .hero {
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 480px) {
  .hero {
    margin-bottom: 1rem;
  }
}

/* Add minimal padding at medium widths for slight spacing from header */
@media (min-width: 769px) and (max-width: 1024px) {
  .hero {
    padding-top: 1rem; /* Minimal padding for medium screens */
  }
}

/* Large viewports - truly centered */
@media (min-width: 1025px) {
  .hero {
    padding-top: 0; /* No padding - perfectly centered */
  }
}


/* Viewport Hero Animation */
.hero-animation {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.8s ease-out;
  will-change: opacity;
  overflow: hidden;
}
@keyframes float-shape {
  0% {
    transform: translate(0%, 0%) scale(1);
  }
  25% {
    transform: translate(15%, 20%) scale(1.05);
  }
  50% {
    transform: translate(25%, 10%) scale(0.95);
  }
  75% {
    transform: translate(10%, 25%) scale(1.02);
  }
  100% {
    transform: translate(0%, 0%) scale(1);
  }
}

@keyframes pulse-shape {
  0%, 100% {
    opacity: 0.15;
    transform: scale(1);
  }
  50% {
    opacity: 0.25;
    transform: scale(1.1);
  }
}

@keyframes rotate-geometric {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes float-geometric {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(15px, -20px) rotate(120deg);
  }
  66% {
    transform: translate(-10px, -15px) rotate(240deg);
  }
}

@media (max-width: 768px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    margin: 0 calc(-1 * clamp(1.5rem, 4vw, 3rem)) 0;
    max-width: 1100px;
    padding: 0;
    padding-left: clamp(1.5rem, 4vw, 3rem);
    padding-right: clamp(1.5rem, 4vw, 3rem);
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
  }
  
  /* Center content in full viewport by shifting up to account for header overlap */
  .hero > * {
    margin-top: calc(-35px); /* Shift up by half header height to center in viewport */
  }
  
  .hero .tagline {
    font-size: clamp(1.8rem, 6vw, 2.5rem); /* Larger than h1 - hero prominence */
  }
}

/* Ensure proper spacing at tablet sizes around 723px */
@media (min-width: 600px) and (max-width: 768px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    padding-top: 70px; /* Header height only */
    padding-bottom: 0;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .hero .tagline {
    font-size: clamp(1.8rem, 6vw, 2.5rem); /* Larger than h1 - hero prominence */
  }
  
  .hero-image-wrapper {
    padding: 1.5rem 1.25rem; /* Reasonable padding */
    max-height: 35vh; /* Further reduced for medium screens */
  }
  
  .hero-image {
    max-width: 50%; /* Comfortable size with padding */
    max-height: 100%;
  }
}

@media (max-width: 480px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    max-height: none;
    margin: 0 calc(-1 * clamp(1.5rem, 4vw, 3rem)) 0;
    max-width: 1100px;
    padding: 0;
    padding-left: clamp(1.5rem, 4vw, 3rem);
    padding-right: clamp(1.5rem, 4vw, 3rem);
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
  }
  
  /* Center content in full viewport by shifting up to account for header overlap */
  .hero > * {
    margin-top: calc(-32.5px); /* Shift up by half header height to center in viewport */
  }
  
  .hero .tagline {
    font-size: clamp(1.8rem, 6.5vw, 2.4rem); /* Larger than h1 - hero prominence */
    margin-bottom: 1rem; /* Proper spacing between tagline and paragraph */
    margin-top: 0;
    line-height: 1.5;
  }
  
  .hero p {
    margin-top: 0;
  }
  
  .hero .subtitle {
    margin-top: 0;
    margin-bottom: 1rem; /* Proper spacing between subtitle and tagline */
  }
  
  .hero p {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
  }
  
  /* Homepage hero spacing at 480px */
  main > .hero:first-of-type .tagline {
    margin-bottom: 1rem; /* Proper spacing between tagline and paragraph */
  }
  
  main > .hero:first-of-type .subtitle {
    margin-bottom: 1rem; /* Proper spacing between subtitle and tagline */
  }
}

/* Extra small screens (iPhone SE and similar) */
@media (max-width: 375px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    max-height: none;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    display: flex;
    flex-direction: column;
    position: relative;
  }
  
  /* Center content in full viewport by shifting up to account for header overlap */
  .hero > * {
    margin-top: calc(-32.5px); /* Shift up by half header height to center in viewport */
  }
  
  .hero .tagline {
    font-size: clamp(1.6rem, 6vw, 2.1rem); /* Larger than h1 - hero prominence */
    line-height: 1.5;
    margin-bottom: 0.75rem; /* Proper spacing between tagline and paragraph */
    margin-top: 0;
  }
  
  .hero p {
    margin-top: 0;
  }
  
  .hero .subtitle {
    margin-top: 0;
    margin-bottom: 0.75rem; /* Proper spacing between subtitle and tagline */
  }
  
  .hero p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
  }
  
  /* Homepage hero spacing at 375px */
  main > .hero:first-of-type .tagline {
    margin-bottom: 0.75rem; /* Proper spacing between tagline and paragraph */
  }
  
  main > .hero:first-of-type .subtitle {
    margin-bottom: 0.75rem; /* Proper spacing between subtitle and tagline */
  }
}

.hero .subtitle,
.hero .tagline,
.hero p,
.hero .cta,
.hero-text,
.hero-image-wrapper {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  position: relative;
  z-index: 1;
}

.hero .tagline {
  margin-bottom: 2rem; /* 32px - proper spacing between tagline and paragraph */
  margin-top: 0;
  text-align: center;
  position: relative;
  color: var(--color-text);
}

/* Homepage hero specific styles */
main > .hero:first-of-type .tagline {
  margin-bottom: 2rem; /* 32px - proper spacing between tagline and paragraph */
  margin-top: 0;
  text-align: center;
  position: relative;
  color: var(--color-text);
}

.hero p {
  margin-bottom: var(--rhythm-unit);
  margin-top: 0;
  text-align: center;
}

main > .hero:first-of-type p {
  margin-bottom: var(--rhythm-unit);
  margin-top: 0;
  text-align: center;
}

.hero-text {
  margin-bottom: var(--rhythm-2x);
}

/* Only apply animation if hero doesn't have visible class yet (for graceful degradation) */
.hero:not(.visible) .subtitle,
.hero:not(.visible) .tagline,
.hero:not(.visible) p,
.hero:not(.visible) .cta {
  opacity: 0;
  transform: translateY(20px);
}

/* Hero text and image wrapper should be visible by default for better UX */
.hero:not(.visible) .hero-text,
.hero:not(.visible) .hero-image-wrapper {
  opacity: 1;
  transform: translateY(0);
}

.hero.visible .subtitle {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.05s;
}

.hero.visible .tagline {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

.hero.visible p {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.15s;
}

.hero.visible .cta {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.2s;
}

.hero.visible .hero-text {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

.hero.visible .hero-image-wrapper {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.2s;
}

/* Scroll Indicator */
.scroll-indicator {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  opacity: 1;
  transition: opacity 500ms ease;
  pointer-events: none;
  z-index: 999;
}

.scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) {
  .scroll-indicator {
    bottom: 0.75rem;
  }
}

@media (max-width: 480px) {
  .scroll-indicator {
    bottom: 0.75rem;
  }
}

.scroll-indicator-icon {
  width: 18px;
  height: 30px;
  border: 2px solid var(--color-action);
  border-radius: 10px;
  position: relative;
  opacity: 1;
}

.scroll-indicator-icon::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 6px;
  background: var(--color-action);
  border-radius: 1.5px;
  animation: scroll-bounce 2s ease-in-out infinite;
  opacity: 1;
}

.scroll-indicator-text {
  font-size: 0.65rem;
  color: var(--color-text);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Dark mode adjustments */
[data-theme="dark"] .scroll-indicator-icon {
  opacity: 0.7;
  border-color: var(--color-action);
}

[data-theme="dark"] .scroll-indicator-icon::before {
  opacity: 0.8;
  background: var(--color-action);
}

[data-theme="dark"] .scroll-indicator-text {
  opacity: 0.6;
  color: var(--color-text);
}

@keyframes scroll-bounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) translateY(12px);
    opacity: 0.3;
  }
}

.hero {
  position: relative;
  padding-bottom: 2rem;
  overflow: visible;
}

/* Hero Content Wrapper - Split Layout */
.hero-content-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  justify-content: flex-start;
  vertical-align: bottom;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: var(--rhythm-unit);
}

.hero-image-wrapper {
  position: relative;
  width: 100%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
  padding: 0 1.5rem; /* Reasonable padding around image */
  height: fit-content;
  z-index: 1;
}

/* Ensure hero images are not cut off */
.hero-content-wrapper {
  overflow: visible !important;
}

.hero-image {
  width: 100%;
  height: auto;
  max-width: 90%; /* Constrain width with padding on sides */
  max-height: 500px; /* Reasonable max height */
  object-fit: contain;
  border-radius: 16px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.08));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              filter 0.4s ease;
  animation: float-image 8s ease-in-out infinite;
  will-change: transform;
}

.hero-image:hover {
  transform: translateY(-8px) scale(1.02);
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.12));
  animation-play-state: paused;
}

@keyframes float-image {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-10px) rotate(1deg);
  }
  50% {
    transform: translateY(-15px) rotate(0deg);
  }
  75% {
    transform: translateY(-10px) rotate(-1deg);
  }
}

[data-theme="dark"] .hero-image {
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.3));
}

[data-theme="dark"] .hero-image:hover {
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.4));
}

/* Responsive Hero Layout */
@media (max-width: 968px) {
  .hero-content-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem; /* Reduced gap for better spacing */
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    min-height: auto; /* Remove fixed min-height to allow natural flow */
    align-items: center; /* Center align content */
  }
  
  .hero-text {
    text-align: center; /* Center align text */
    align-items: center; /* Center align flex items */
  }
  
  .hero .subtitle,
  .hero .tagline,
  .hero p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  /* Homepage hero center alignment */
  main > .hero:first-of-type .subtitle,
  main > .hero:first-of-type .tagline,
  main > .hero:first-of-type p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  .hero-image-wrapper {
    min-height: 0; /* Remove fixed min-height to allow text to be visible */
    flex: 0 0 auto; /* Don't grow to fill space */
    max-height: 35vh; /* Reduced height for better fit on tablets */
    order: -1;
    overflow: visible !important;
    padding: 1.5rem 2rem; /* Reasonable padding around image */
    margin-bottom: 1.5rem; /* Space between image and headline */
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .hero-image {
    max-width: 45%; /* Reduced from 70% - fits comfortably with padding */
    width: auto;
    height: auto;
    max-height: 100%; /* Constrain height */
    margin: 0 auto;
    object-fit: contain;
  }
}

@media (max-width: 768px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    margin-bottom: 1.25rem !important; /* Reduced to minimize gap after hero */
    padding-top: 70px; /* Header height only */
    padding-bottom: 0;
    overflow: visible !important;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .hero-content-wrapper {
    gap: 2rem;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    min-height: auto; /* Remove fixed min-height to allow natural flow */
    align-items: center; /* Center align content */
  }
  
  .hero-text {
    text-align: center; /* Center align text */
    align-items: center; /* Center align flex items */
  }
  
  .hero .subtitle,
  .hero .tagline,
  .hero p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  .hero-image-wrapper {
    min-height: 0; /* Remove fixed min-height to allow text to be visible */
    max-height: 40vh; /* Reduced height for better fit */
    overflow: visible !important;
    padding: 1.5rem 1rem; /* More padding around image */
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto; /* Don't grow to fill space */
  }
  
  .hero-image {
    max-width: 55%; /* Reduced from 70% - fits more comfortably */
    width: auto;
    height: auto;
    max-height: 100%; /* Constrain height */
    object-fit: contain;
    margin: 0 auto;
  }
}

/* Ensure proper spacing at mid breakpoint (600-768px) */
@media (min-width: 600px) and (max-width: 768px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    padding-top: 70px; /* Header height only */
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    box-sizing: border-box;
  }
  
  .hero-content-wrapper {
    align-items: center; /* Center align content */
  }
  
  .hero-text {
    text-align: center; /* Center align text */
    align-items: center; /* Center align flex items */
  }
  
  .hero .subtitle,
  .hero .tagline,
  .hero p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  /* Homepage hero center alignment */
  main > .hero:first-of-type .subtitle,
  main > .hero:first-of-type .tagline,
  main > .hero:first-of-type p {
    text-align: center; /* Center align subtitle, headline and text */
  }
}

@media (max-width: 480px) {
  .hero {
    height: 100vh;
    min-height: 100vh;
    margin-bottom: 1rem !important; /* Reduced to minimize gap after hero */
    padding-top: 65px; /* Header height only */
    padding-bottom: 0;
    overflow: visible !important;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    box-sizing: border-box;
  }
  
  .hero-content-wrapper {
    gap: 1.5rem;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    min-height: auto; /* Remove fixed min-height to allow natural flow */
    align-items: flex-start; /* Left align content */
  }
  
  .hero-text {
    text-align: left; /* Left align text */
    align-items: flex-start; /* Left align flex items */
  }
  
  .hero .subtitle,
  .hero .tagline,
  .hero p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  .hero-image-wrapper {
    min-height: 0; /* Remove fixed min-height to allow text to be visible */
    flex: 0 0 auto; /* Don't grow to fill space */
    max-height: 35vh; /* Reduced height for better fit */
    overflow: visible !important;
    padding: 1.25rem 1rem; /* Reasonable padding around image */
    margin-bottom: 1.25rem; /* Space between image and headline */
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .hero-image {
    max-width: 50%; /* Reduced from 65% - fits more comfortably */
    width: auto;
    height: auto;
    max-height: 100%; /* Constrain height */
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
  }
}

@media (max-width: 375px) {
  .hero-image-wrapper {
    min-height: 0; /* Remove fixed min-height to allow text to be visible */
    flex: 0 0 auto; /* Don't grow to fill space */
    max-height: 40vh; /* Limit image height so text can fit */
    padding: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .hero-content-wrapper {
    min-height: auto; /* Remove fixed min-height to allow natural flow */
    align-items: center; /* Center align content */
  }
  
  .hero-text {
    text-align: center; /* Center align text */
    align-items: center; /* Center align flex items */
  }
  
  .hero .subtitle,
  .hero .tagline,
  .hero p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  /* Homepage hero center alignment */
  main > .hero:first-of-type .subtitle,
  main > .hero:first-of-type .tagline,
  main > .hero:first-of-type p {
    text-align: center; /* Center align subtitle, headline and text */
  }
  
  .hero-text {
    text-align: left; /* Left align text */
    align-items: flex-start; /* Left align flex items */
  }
  
  .hero-image {
    max-width: 60%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
  }
}

.tagline {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0.5rem 0 1rem;
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 600;
  line-height: 1.5;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 2.5rem; /* Increased spacing between subtitle and headline */
}

/* Add margin-top to hero subtitle for spacing from header */
.hero .subtitle {
  margin-top: 0;
  margin-bottom: 1.5rem; /* 24px - proper spacing between subtitle and tagline */
  text-align: center; /* Center align by default, overridden at larger screens */
}

/* Homepage hero subtitle specific styles */
main > .hero:first-of-type .subtitle {
  margin-top: 0;
  margin-bottom: 1.5rem; /* 24px - proper spacing between subtitle and tagline */
  text-align: center; /* Center align by default, overridden at larger screens */
}

/* Responsive margin-top for subtitle at different screen sizes */
@media (min-width: 769px) and (max-width: 1024px) {
  .hero .subtitle {
    margin-top: 0;
  }
  
  /* Ensure homepage hero subtitle is centered at medium sizes */
  main > .hero:first-of-type .subtitle {
    text-align: center;
  }
}

@media (max-width: 768px) {
  .hero .subtitle {
    margin-top: 0;
    text-align: center; /* Center align subtitle on smaller screens */
  }
  
  main > .hero:first-of-type .subtitle {
    text-align: center; /* Center align homepage subtitle on smaller screens */
  }
}

@media (max-width: 480px) {
  .hero .subtitle {
    margin-top: 0;
    text-align: center; /* Center align subtitle on smaller screens */
  }
  
  main > .hero:first-of-type .subtitle {
    text-align: center; /* Center align homepage subtitle on smaller screens */
  }
}

@media (max-width: 375px) {
  .hero .subtitle {
    margin-top: 0;
    text-align: center; /* Center align subtitle on smaller screens */
  }
  
  main > .hero:first-of-type .subtitle {
    text-align: center; /* Center align homepage subtitle on smaller screens */
  }
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  margin-top: 1.8rem;
  border-radius: 8px;
  background: var(--color-button);
  color: #ffffff;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color 200ms ease,
              box-shadow 200ms ease,
              transform 200ms ease;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
              0 1px 2px rgba(0, 0, 0, 0.08);
}

.cta:hover {
  background: var(--color-button-hover);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12),
              0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.cta:focus-visible {
  background: var(--color-button-hover);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12),
              0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* AAA-compliant focus visibility in dark mode - white outline for maximum contrast */
[data-theme="dark"] .cta:focus-visible {
  outline: 4px solid #FFFFFF;
  outline-offset: 4px;
  /* Double shadow for extra visibility: inner white glow + outer dark shadow */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
              0 2px 4px rgba(0, 0, 0, 0.3),
              0 0 0 2px rgba(255, 255, 255, 0.8),
              inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.cta:active {
  background: var(--color-button-active);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
}

/* Section Divider */
.section-divider {
  width: 100%;
  height: 1px;
  background: var(--color-divider);
  margin: 4rem 0;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

[data-theme="dark"] .section-divider {
  background: var(--color-divider);
}

@media (max-width: 768px) {
  .section-divider {
    margin: 3rem 0;
  }
}

@media (max-width: 480px) {
  .section-divider {
    margin: 2.5rem 0;
  }
}

/* Reduce spacing when divider is before contact section */

/* Reduce spacing when divider immediately follows hero */
.hero + .section-divider {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .hero + .section-divider {
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 480px) {
  .hero + .section-divider {
    margin-bottom: 1rem;
  }
}

.about {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
  position: relative;
  overflow: visible;
}

/* Reduce top margin when about section follows hero divider */
.hero + .section-divider + .about {
  margin-top: 0;
}

@media (max-width: 768px) {
  .hero + .section-divider + .about {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .hero + .section-divider + .about {
    margin-top: 0;
  }
}

.about p {
  max-width: none;
}

.clients {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

[data-theme="dark"] .clients {
  background: var(--color-surface);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--color-border-soft);
}

.clients-header {
  width: 100%;
}

.clients-header h2,
.clients-header p {
  max-width: 100%;
  width: 100%;
}

.clients-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2rem;
  align-items: center;
  justify-items: start;
  width: 100%;
}

.client-logo {
  width: auto;
  max-width: 150px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  opacity: 1;
  transition: opacity 300ms ease, transform 300ms ease;
  position: relative;
  cursor: help;
}

.client-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}

.client-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: transparent;
}

/* Inflection logo: swap to dark mode version */
[data-theme="dark"] .client-logo:has(img[alt="Inflection"]) {
  position: relative;
}

[data-theme="dark"] .client-logo img[alt="Inflection"] {
  opacity: 0;
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Show dark mode version as background */
[data-theme="dark"] .client-logo:has(img[alt="Inflection"])::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/logos/logo-inflection-dark.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  pointer-events: none;
}

/* Shopify logo: swap to dark mode version */
[data-theme="dark"] .client-logo:has(img[alt="Shopify"]) {
  position: relative;
}

[data-theme="dark"] .client-logo img[alt="Shopify"] {
  opacity: 0;
}

/* Show dark mode version as background */
[data-theme="dark"] .client-logo:has(img[alt="Shopify"])::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/logos/logo-shopify-dark.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  pointer-events: none;
}

/* Make Oration logo muted white/light blue in dark mode */
[data-theme="dark"] .client-logo img[alt="Oration"] {
  filter: invert(1) brightness(0.9) sepia(0.1) saturate(0.8);
  opacity: 0.85;
}

/* Make Ancestry, SurveyMonkey, and Inflection logos larger for visual balance */
.client-logo-large {
  max-width: 173px !important;
  height: 69px !important;
}

.client-logo-large img {
  max-width: 115%;
  max-height: 115%;
}

/* Make SurveyMonkey, Inflection, and Ancestry logos larger for better visual balance */
.client-logo img[alt="SurveyMonkey"] {
  transform: scale(1.25);
  transform-origin: left center;
}

.client-logo img[alt="Inflection"],
.client-logo img[alt="Ancestry"] {
  transform: scale(1.2);
  transform-origin: left center;
}

/* Make Oration logo slightly smaller */
.client-logo img[alt="Oration"] {
  transform: scale(0.95);
}

/* Adjust dark mode Inflection logo size */
[data-theme="dark"] .client-logo:has(img[alt="Inflection"])::after {
  transform: scale(1.2);
  transform-origin: left center;
}

.client-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--color-text);
  color: var(--color-text-inverted);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms ease;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.client-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-text);
}

.client-logo:hover .client-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .clients-container {
    min-height: auto;
    padding: 1.5rem;
  }

  .clients {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .clients-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 1rem;
    justify-items: start;
  }

  .client-logo {
    max-width: 120px;
    height: 50px;
  }

  .client-logo-large {
    max-width: 138px !important;
    height: 58px !important;
  }
}

@media (max-width: 480px) {
  .clients {
    gap: 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .clients-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 1rem;
    justify-items: start;
  }

  .client-logo {
    max-width: 100px;
    height: 45px;
  }

  .client-logo-large {
    max-width: 115px !important;
    height: 52px !important;
  }
}

.portrait {
  width: 100%;
  height: 340px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(184,125,95,0.12), rgba(184,125,95,0.04));
  border: 1px solid var(--color-border-soft);
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 400ms ease, border-color 400ms ease, box-shadow 400ms ease;
  position: relative;
  overflow: hidden;
}

.portrait::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(184,125,95,0.06), transparent);
  opacity: 0;
  transition: opacity 400ms ease;
}

.portrait:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: rgba(184,125,95,0.2);
  box-shadow: 0 20px 40px rgba(184,125,95,0.08);
}

.portrait:hover::before {
  opacity: 1;
}

.projects-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 0.5rem;
  align-items: stretch; /* Ensure all cards have equal height */
}

/* Ensure balanced padding at mid breakpoints */
@media (min-width: 600px) and (max-width: 968px) {
.project-card {
    padding: 1.5rem !important;
  }
  
  .approach {
    padding: 2rem !important;
  }
  
  .skill-group {
    padding: 0.875rem !important;
  }
  
  .approach h2:first-child {
    margin-top: 0;
  }
}

.project-card {
  background: #FFFFFF;
  border: 1px solid var(--color-border-soft);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 400ms cubic-bezier(0.34, 1.56, 0.64, 1), 
              transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 400ms ease,
              background 400ms ease;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  height: 100%; /* Ensure cards fill grid cell height */
  justify-content: flex-start; /* Content starts at top */
}

[data-theme="dark"] .project-card {
  background: var(--color-surface);
}

.project-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(184,125,95,0.04), transparent);
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 50px rgba(184,125,95,0.15);
  background: #FFFFFF;
}

[data-theme="dark"] .project-card:hover {
  background: var(--color-surface);
  box-shadow: 0 20px 30px rgba(91, 159, 216, 0.2);
}

.project-card:hover::before {
  opacity: 1;
}

[data-theme="dark"] .project-card::before {
  background: linear-gradient(135deg, rgba(91, 159, 216, 0.1), transparent);
}

.project-card:nth-child(1) { transition-delay: 0.1s; }
.project-card:nth-child(2) { transition-delay: 0.2s; }
.project-card:nth-child(3) { transition-delay: 0.3s; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.85rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--color-text-muted);
  transition: all 300ms ease;
  display: inline-block;
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .tag {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
}

.project-card:hover .tag {
  color: var(--color-text);
  transform: translateY(-2px);
}

.project-card:hover .tag:nth-child(1) { transition-delay: 0.05s; }
.project-card:hover .tag:nth-child(2) { transition-delay: 0.1s; }
.project-card:hover .tag:nth-child(3) { transition-delay: 0.15s; }

.case-link {
  margin-top: auto; /* Push to bottom of card */
  color: var(--color-action);
  text-decoration: none;
  font-weight: 600;
  transition: all 300ms ease;
  display: inline-flex;
  align-items: baseline; /* Baseline align text */
  gap: 0.3rem;
  width: fit-content;
  padding: 0.25rem 0.5rem; /* Consistent padding to prevent shift on hover */
  margin: 0;
  margin-top: auto; /* Push to bottom */
  border-radius: 3px;
}

.case-link::after {
  content: '→';
  transition: transform 300ms ease;
  display: inline-block;
}

.case-link:hover {
  background-color: rgba(91, 159, 216, 0.1);
  color: var(--color-action-hover);
  transform: translateX(4px);
}

.case-link:hover::after {
  transform: translateX(4px);
}

.skills-radar {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-soft);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
  margin-bottom: var(--rhythm-unit);
}

.skills-radar h2 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
}

.radar-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 1rem 0;
}

.radar-chart {
  max-width: 100%;
  height: auto;
  width: 100%;
  max-width: 400px;
}

.radar-grid circle {
  transition: opacity 0.3s ease;
}

.radar-axes line {
  stroke: var(--color-border);
  stroke-width: 1;
  opacity: 0.4;
}

.radar-area {
  transition: all 0.6s ease;
  filter: drop-shadow(0 2px 4px rgba(91, 159, 216, 0.2));
}

.radar-points circle {
  fill: var(--color-action);
  stroke: #FFFFFF;
  stroke-width: 2;
  r: 5;
  transition: all 0.3s ease;
  cursor: pointer;
}

.radar-points circle:hover {
  r: 7;
  fill: var(--color-action-hover);
}

.radar-labels text {
  font-size: 0.85rem;
  fill: var(--color-text);
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

[data-theme="dark"] .skills-radar {
  background: var(--color-bg-alt);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .radar-grid circle {
  stroke: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .radar-axes line {
  stroke: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .radar-labels text {
  fill: var(--color-text);
}

@media (max-width: 768px) {
  .skills-radar {
    padding: 1.5rem;
  }
  
  .radar-chart {
    max-width: 350px;
  }
  
  .radar-labels text {
    font-size: 0.75rem;
  }
}

/* Ensure balanced padding at mid breakpoints */
@media (min-width: 600px) and (max-width: 968px) {
  .skills-radar {
    padding: 2rem !important;
  }
}

@media (max-width: 480px) {
  .radar-chart {
    max-width: 300px;
  }
  
  .radar-labels text {
    font-size: 0.7rem;
  }
}

.approach {
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
}

.approach h2:first-child {
  margin-top: 0;
}

/* Ensure all headers in container sections have balanced padding */
.approach h2,
.skills-radar h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

/* Ensure headers have balanced spacing at medium breakpoints */
@media (min-width: 600px) and (max-width: 968px) {
  .approach h2,
  .skills-radar h2,
  .contact h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
  }
  
  /* Ensure section headers have proper spacing from container top */
  .approach h2:first-child,
  .skills-radar h2:first-child {
    margin-top: 0;
  }
}

.approach p {
  max-width: 100% !important;
  width: 100% !important;
}

section.approach p {
  max-width: 100% !important;
  width: 100% !important;
}

.skills {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 1rem;
  width: 100%;
}

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

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

.skill-group {
  padding: 0.875rem;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid var(--color-border-soft);
  transition: all 400ms ease;
  opacity: 0;
  transform: translateY(20px);
  min-width: 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .skill-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border-soft);
}

.skill-group strong,
.skill-group p {
  word-wrap: break-word;
  overflow-wrap: break-word;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  margin: 0;
}

.skill-group strong {
  display: block;
  margin-bottom: 0.5rem;
  width: 100% !important;
  max-width: 100% !important;
}

.skill-group p {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
}

.skill-group.visible {
  opacity: 1;
  transform: translateY(0);
}

.skill-group:hover {
  background: rgba(184,125,95,0.08);
  border-color: rgba(184,125,95,0.2);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(184,125,95,0.1);
}

[data-theme="dark"] .skill-group:hover {
  background: rgba(255, 255, 255, 0.08);
}

.skill-group:nth-child(1) { transition-delay: 0.1s; }
.skill-group:nth-child(2) { transition-delay: 0.2s; }
.skill-group:nth-child(3) { transition-delay: 0.3s; }
.skill-group:nth-child(4) { transition-delay: 0.4s; }

.contact {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: var(--rhythm-4x); /* Match section bottom spacing (6rem) */
  margin-top: 0;
}

.contact h2 {
  margin-top: 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  align-items: center; /* Align items to center */
  width: 100%; /* Ensure full width available */
}

/* External link icon for links that open in new tab (general) */
a[target="_blank"]:not(.external-link) {
  white-space: nowrap !important; /* Prevent arrow from wrapping to new line - force with !important */
  word-break: keep-all !important; /* Prevent word breaking */
  overflow-wrap: normal !important; /* Prevent wrapping */
}

a[target="_blank"]:not(.external-link)::after {
  content: "\00a0↗"; /* Non-breaking space + arrow */
  font-size: 0.85em;
  opacity: 0.7;
  display: inline !important;
  transition: opacity 200ms ease;
  vertical-align: baseline;
  white-space: nowrap !important;
  word-break: keep-all !important; /* Prevent word breaking */
  overflow-wrap: normal !important; /* Prevent wrapping */
  unicode-bidi: embed; /* Ensure proper text direction */
  margin-left: 0; /* Remove any margin that could cause wrapping */
  padding-left: 0; /* Remove any padding that could cause wrapping */
}

a[target="_blank"]:not(.external-link):hover::after {
  opacity: 1;
}

/* Use background-image for animated underline on external contact links */
.contact-links a[target="_blank"] {
  background-image: linear-gradient(var(--color-action), var(--color-action));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: bottom left;
  transition: background-size 300ms ease, opacity 200ms ease;
  white-space: nowrap !important; /* Prevent arrow from wrapping to new line - force with !important */
  word-break: keep-all !important; /* Prevent word breaking */
  overflow-wrap: normal !important; /* Prevent wrapping */
  max-width: fit-content; /* Allow link to size to its content */
}

.contact-links a[target="_blank"]:hover {
  background-size: 100% 2px;
}

.contact-links a {
  color: var(--color-action);
  text-decoration: none;
  font-weight: 600;
  transition: all 300ms ease;
  position: relative;
  padding: 0.5rem 0.75rem; /* Add horizontal padding for balanced hover state */
  margin: 0 -0.75rem; /* Negative margin to offset padding and prevent layout shift */
  white-space: nowrap !important; /* Prevent text and icons from wrapping - force with !important */
  flex-shrink: 0 !important; /* Prevent flex items from shrinking - force with !important */
  display: inline-flex !important; /* Use flex to keep arrow inline - force with !important */
  align-items: baseline; /* Align arrow with text baseline */
  word-break: keep-all !important; /* Prevent word breaking */
  overflow-wrap: normal !important; /* Prevent wrapping */
  min-width: fit-content; /* Allow link to size to its content */
}

/* Ensure external link icon span doesn't wrap */
.contact-links a .external-link-icon {
  white-space: nowrap !important;
  display: inline !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  flex-shrink: 0 !important;
}

.contact-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-action);
  transition: width 300ms ease;
}

.contact-links a:hover {
  background-color: rgba(91, 159, 216, 0.1);
  color: var(--color-action-hover);
  transform: translateX(4px);
}

.contact-links a:hover::after {
  width: 100%;
}

/* External link indicator */
.external-link-icon {
  display: inline !important;
  margin-left: 0.25em;
  font-size: 0.85em;
  opacity: 0.7;
  transition: opacity 200ms ease, transform 200ms ease;
  vertical-align: baseline;
  white-space: nowrap !important; /* Prevent icon from wrapping */
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}

/* Prevent external link text and icon from wrapping */
.external-link {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  display: inline-flex !important;
  align-items: baseline;
}

.external-link:hover .external-link-icon {
  opacity: 1;
  transform: translate(2px, -2px);
}

/* Override underline for external links - use background-image instead */
.contact-links a.external-link::after {
  display: none; /* Hide the default underline animation */
}

.contact-links a.external-link {
  background-image: linear-gradient(var(--color-action), var(--color-action));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: bottom left;
  transition: background-size 300ms ease;
  white-space: nowrap !important; /* Prevent text and icon from wrapping */
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  display: inline-flex !important;
  align-items: baseline;
}

.contact-links a.external-link:hover {
  background-size: 100% 2px;
}

/* Use background-image for animated underline on external contact links */
.contact-links a[target="_blank"] {
  background-image: linear-gradient(var(--color-action), var(--color-action));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: bottom left;
  transition: background-size 300ms ease, opacity 200ms ease, transform 300ms ease;
}

.contact-links a[target="_blank"]:hover {
  background-size: 100% 2px;
}

@media (max-width: 600px) {
  .cta {
    width: 100%;
    justify-content: center;
  }
}

/* Footer */
.site-footer {
  max-width: 1100px;
  margin: 4rem auto 0;
  padding: 3rem clamp(1.25rem, 4vw, 3rem) 2rem;
  padding-left: clamp(1.25rem, 4vw, 3rem);
  text-align: left;
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
}

.site-footer p {
  margin: 0;
}

/* Contact Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Hide reCAPTCHA badge by default - show when form modal is open */
.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Show badge when modal is open */
body.modal-open .grecaptcha-badge {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  display: block !important;
}

/* Position badge next to form-note, small size - when inside form-note */
.form-note .grecaptcha-badge {
  position: absolute !important;
  top: 50% !important;
  right: 0 !important;
  transform: translateY(-50%) scale(0.6) !important;
  transform-origin: center right !important;
  z-index: 10 !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  display: block !important;
}

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

.modal-container {
  background: #FAFAFA;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  position: relative;
  padding: 2rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12),
              0 4px 8px rgba(0, 0, 0, 0.08);
  border: none;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .modal-container {
  background: var(--color-surface);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3),
              0 4px 8px rgba(0, 0, 0, 0.2);
  border: none;
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 1;
  transition: background-color 0.2s ease, 
              box-shadow 0.2s ease,
              transform 0.2s ease;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

[data-theme="dark"] .modal-close {
  background: rgba(42, 42, 42, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-close:hover,
.modal-close:focus {
  background: rgba(255, 255, 255, 1);
  transform: rotate(90deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  outline: none;
}

[data-theme="dark"] .modal-close:hover,
[data-theme="dark"] .modal-close:focus {
  background: rgba(58, 58, 58, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-close span {
  display: block;
}

.modal-content {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-content h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.modal-description {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Contact Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: -0.75rem 0 0.25rem;
  font-style: italic;
  position: relative;
  padding-right: 120px; /* Make room for reCAPTCHA badge */
  min-height: 30px; /* Ensure enough height for badge */
  padding-top: 2px; /* Small adjustment to align with smaller CAPTCHA badge */
  display: flex;
  align-items: center; /* Vertically center content */
  z-index: 1; /* Ensure it's above other content */
}

.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.form-group input,
.form-group textarea,
.textarea-wrapper textarea {
  width: 100%;
  padding: 0.875rem 1rem; /* Increased padding for better text spacing */
  border: 1px solid rgba(26, 26, 26, 0.2);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: 'Open Sans', sans-serif;
  background: #FFFFFF;
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
  box-shadow: none;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .textarea-wrapper textarea {
  background: var(--color-bg-alt);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .textarea-wrapper textarea:focus {
  border-color: var(--color-action);
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(74, 159, 232, 0.15);
  background: var(--color-bg-alt);
}

.form-group input:focus,
.form-group textarea:focus,
.textarea-wrapper textarea:focus {
  outline: none;
  border-color: var(--color-action);
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(91, 159, 216, 0.08);
  background: #FFFFFF;
}

.form-group input.error,
.form-group textarea.error,
.textarea-wrapper textarea.error {
  border-color: #d84315;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(216, 67, 21, 0.08);
}

[data-theme="dark"] .form-group input.error,
[data-theme="dark"] .form-group textarea.error,
[data-theme="dark"] .textarea-wrapper textarea.error {
  border-color: #ef5350;
  box-shadow: 0 0 0 2px rgba(239, 83, 80, 0.25);
}

.form-group input.error:focus,
.form-group textarea.error:focus,
.textarea-wrapper textarea.error:focus {
  border-color: #d84315;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(216, 67, 21, 0.12);
}

[data-theme="dark"] .form-group input.error:focus,
[data-theme="dark"] .form-group textarea.error:focus,
[data-theme="dark"] .textarea-wrapper textarea.error:focus {
  border-color: #ef5350;
  box-shadow: 0 0 0 2px rgba(239, 83, 80, 0.35);
}

.form-group input.warning,
.form-group textarea.warning,
.textarea-wrapper textarea.warning {
  border-color: #b8860b;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.08);
}

[data-theme="dark"] .form-group input.warning,
[data-theme="dark"] .form-group textarea.warning,
[data-theme="dark"] .textarea-wrapper textarea.warning {
  border-color: #ffcc80;
  box-shadow: 0 0 0 2px rgba(255, 204, 128, 0.25);
}

.form-group input.warning:focus,
.form-group textarea.warning:focus,
.textarea-wrapper textarea.warning:focus {
  border-color: #b8860b;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.12);
}

[data-theme="dark"] .form-group input.warning:focus,
[data-theme="dark"] .form-group textarea.warning:focus,
[data-theme="dark"] .textarea-wrapper textarea.warning:focus {
  border-color: #ffcc80;
  box-shadow: 0 0 0 2px rgba(255, 204, 128, 0.35);
}

.form-group textarea,
.textarea-wrapper textarea {
  resize: vertical;
  min-height: 70px;
  transition: height 0.2s ease;
}

.textarea-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

.textarea-wrapper textarea {
  padding-bottom: 2rem;
}

.character-counter {
  position: absolute;
  bottom: 0.75rem;
  right: 0.9rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  pointer-events: none;
  user-select: none;
}

[data-theme="dark"] .character-counter {
  color: rgba(255, 255, 255, 0.6);
}

.form-error-message,
.form-warning-message {
  font-size: 0.85rem;
  margin-top: -0.25rem;
  display: none;
}

.form-error-message {
  color: #d84315;
}

[data-theme="dark"] .form-error-message {
  color: #e57373;
}

.form-warning-message {
  color: #8b6914;
}

[data-theme="dark"] .form-warning-message {
  color: #ffe0b2;
}

.form-group.has-error .form-error-message {
  display: block;
}

.form-group.has-warning .form-warning-message {
  display: block;
}

.form-actions {
  margin-top: 0.25rem;
}

.form-actions .cta {
  width: 100%;
  justify-content: center;
  position: relative;
  margin-top: 0;
}

.button-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.cta.loading .button-text {
  opacity: 0;
}

.cta.loading .button-loader {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.form-message {
  padding: 0.875rem;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0;
  margin-bottom: 1rem;
  display: none;
  scroll-margin-top: 1rem; /* Space for scroll positioning */
}

.form-message.success {
  display: block;
  background: rgba(76, 175, 80, 0.1);
  color: #2e7d32;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.form-message.error {
  display: block;
  background: rgba(211, 47, 47, 0.1);
  color: #c62828;
  border: 1px solid rgba(211, 47, 47, 0.3);
}

/* Reset form link styling - match success message color */
.form-message.success .reset-form-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: #2e7d32; /* Same green as success message text */
  text-decoration: underline;
  font-weight: 500;
  transition: color 200ms ease, opacity 200ms ease;
}

.form-message.success .reset-form-link:hover,
.form-message.success .reset-form-link:focus {
  color: #1b5e20; /* Darker green on hover */
  text-decoration: underline;
  opacity: 0.8;
}

[data-theme="dark"] .form-message.success .reset-form-link {
  color: #81c784; /* Lighter green for dark mode */
}

[data-theme="dark"] .form-message.success .reset-form-link:hover,
[data-theme="dark"] .form-message.success .reset-form-link:focus {
  color: #a5d6a7; /* Even lighter green on hover in dark mode */
  text-decoration: underline;
}

/* Ensure form message is visible and scrollable on mobile */
@media (max-width: 768px) {
  .form-message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    font-size: 0.95rem;
  }
  
  /* When message is visible, ensure it's in viewport */
  .form-message:not([style*="display: none"]) {
    scroll-margin-top: 1rem;
  }
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 1rem; /* 16px padding around modal */
    align-items: flex-start;
    padding-top: 1rem;
  }

  .modal-container {
    max-width: 100%;
    max-height: calc(100vh - 2rem);
    height: auto;
    border-radius: 12px;
    margin: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem; /* Padding on container so content scrolls with space */
  }

  .modal-content {
    padding: 0; /* No padding - container provides the spacing */
    padding-top: 2rem; /* Space for close button */
    overflow-y: auto; /* Allow entire content to scroll */
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
  
  /* Add extra spacing at top when scrolled to top */
  .modal-content::before {
    content: '';
    display: block;
    height: 1.5rem; /* Increased spacer at top */
    flex-shrink: 0;
    pointer-events: none;
  }
  
  /* Add extra spacing at bottom when scrolled to bottom */
  .modal-content::after {
    content: '';
    display: block;
    height: 3rem; /* Increased spacer at bottom */
    flex-shrink: 0;
    pointer-events: none;
  }
  
  /* Ensure h2 has top margin */
  .modal-content > h2:first-child {
    margin-top: 0.5rem; /* Extra space from top spacer */
  }
  
  /* Ensure form has bottom spacing */
  .modal-content > .contact-form:last-child,
  .modal-content > form:last-child {
    margin-bottom: 1.5rem; /* Extra space at bottom before spacer */
  }
  
  /* Ensure form actions button has spacing */
  .modal-content .form-actions {
    margin-bottom: 0.75rem; /* Space before bottom spacer */
  }
  
  /* Add extra bottom padding when keyboard might be visible */
  .modal-content.keyboard-visible {
    padding-bottom: 4rem; /* Increased bottom padding for keyboard */
  }
  
  .modal-content.keyboard-visible::after {
    height: 4rem; /* More space at bottom when keyboard visible */
  }

  .modal-content h2 {
    font-size: 1.5rem;
    margin-top: 0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .modal-description {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    margin-top: 0;
  }

  .contact-form {
    margin-bottom: 0;
    padding-top: 0.5rem; /* Extra spacing at top of form when scrolled */
  }
  
  /* Ensure form actions button has spacing at bottom */
  .modal-content .form-actions {
    margin-bottom: 0.5rem; /* Extra space so button doesn't touch edge when scrolled */
  }
  
  .modal-close {
    top: 0.75rem;
    right: 0.75rem;
    position: absolute;
    z-index: 20;
  }
  
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 1rem; /* 16px padding around modal */
    align-items: flex-start;
    padding-top: 1rem;
    background: rgba(0, 0, 0, 0.5);
  }

  .modal-container {
    max-height: calc(100vh - 2rem);
    height: auto;
    border-radius: 16px;
    margin: 0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem; /* Padding on container so content scrolls with space */
  }

  .modal-content {
    padding: 0; /* No padding - container provides the spacing */
    padding-top: 1.75rem; /* Space for close button */
    max-height: calc(100vh - 4rem);
    overflow-y: auto; /* Allow entire content to scroll */
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
  
  /* Add extra spacing at top when scrolled to top */
  .modal-content::before {
    content: '';
    display: block;
    height: 2rem; /* Even more spacer at top */
    flex-shrink: 0;
    pointer-events: none;
  }
  
  /* Add extra spacing at bottom when scrolled to bottom */
  .modal-content::after {
    content: '';
    display: block;
    height: 4rem; /* Even more spacer at bottom */
    flex-shrink: 0;
    pointer-events: none;
  }
  
  /* Ensure h2 has top margin */
  .modal-content > h2:first-child {
    margin-top: 0.5rem; /* Extra space from top spacer */
  }
  
  /* Ensure form has bottom spacing */
  .modal-content > .contact-form:last-child,
  .modal-content > form:last-child {
    margin-bottom: 1.5rem; /* Extra space at bottom before spacer */
  }
  
  /* Ensure form actions button has spacing */
  .modal-content .form-actions {
    margin-bottom: 0.75rem; /* Space before bottom spacer */
  }
  
  /* Add extra bottom padding when keyboard is visible */
  .modal-content.keyboard-visible {
    padding-bottom: 4rem; /* Increased bottom padding for keyboard */
  }
  
  .modal-content.keyboard-visible::after {
    height: 5rem; /* Even more space at bottom when keyboard visible */
  }

  .modal-content h2 {
    font-size: 1.35rem;
    margin-top: 0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .modal-description {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
    margin-top: 0;
  }

  .contact-form {
    margin-bottom: 0;
    padding-bottom: 1rem;
    padding-top: 0.5rem; /* Extra spacing at top of form when scrolled */
  }
  
  /* Ensure form actions button has spacing at bottom */
  .modal-content .form-actions {
    margin-bottom: 0.5rem; /* Extra space so button doesn't touch edge when scrolled */
  }

  .modal-close {
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
    position: absolute;
    z-index: 20;
  }
  
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-action);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
              0 1px 2px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 200ms ease,
              background-color 200ms ease;
  z-index: 999;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.scroll-to-top:hover,
.scroll-to-top:focus-visible {
  background: var(--color-action-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12),
              0 2px 4px rgba(0, 0, 0, 0.1);
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Use blue action color in dark theme too */
[data-theme="dark"] .scroll-to-top {
  background: var(--color-action);
}

[data-theme="dark"] .scroll-to-top:hover,
[data-theme="dark"] .scroll-to-top:focus-visible {
  background: var(--color-action-hover);
}

/* AAA-compliant focus visibility in dark mode for scroll-to-top button */
[data-theme="dark"] .scroll-to-top:focus-visible {
  outline: 4px solid #FFFFFF;
  outline-offset: 4px;
  /* Double shadow for extra visibility: inner white glow + outer dark shadow */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
              0 2px 4px rgba(0, 0, 0, 0.3),
              0 0 0 2px rgba(255, 255, 255, 0.8),
              inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.scroll-to-top:active {
  background: var(--color-action-active);
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .scroll-to-top:active {
  background: var(--color-action-active);
}

.scroll-to-top::before {
  content: '↑';
  display: block;
}

@media (max-width: 768px) {
  .scroll-to-top {
    width: 44px;
    height: 44px;
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .scroll-to-top {
    width: 40px;
    height: 40px;
    bottom: 1.25rem;
    right: 1.25rem;
    font-size: 1rem;
  }
}

/* Illustration */
.illustration-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.6s ease-out;
  pointer-events: none;
}

.illustration {
  width: auto;
  height: auto;
  max-width: none;
  mix-blend-mode: multiply;
  filter: contrast(1.1);
  display: block;
}

@media (max-width: 768px) {
  .illustration-container {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

@media (max-width: 480px) {
  .illustration-container {
    bottom: 1.25rem;
    right: 1.25rem;
  }
}

/* Craft Page Styles */
/* Breadcrumb styles - now in header */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  justify-content: flex-start;
  width: 100%;
  position: relative;
  z-index: 10;
}

/* Homepage hero - centered vertically in viewport below header */
main > .hero:first-of-type {
  min-height: calc(100vh - 80px);
  margin-top: calc(-2rem);
  margin-bottom: var(--rhythm-4x);
  padding-top: 0;
  padding-bottom: 2rem;
  justify-content: center;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

/* Medium viewports - centered */
@media (min-width: 769px) and (max-width: 1024px) {
  main > .hero:first-of-type {
    height: 100vh;
    min-height: 100vh;
    margin-top: calc(-2rem);
    padding-top: 0;
    justify-content: center;
    align-items: center; /* Center subtitle, tagline, and paragraph as a column */
    box-sizing: border-box;
  }
  
  /* Ensure homepage hero text is centered at medium sizes */
  main > .hero:first-of-type .subtitle,
  main > .hero:first-of-type .tagline,
  main > .hero:first-of-type p {
    text-align: center;
  }
}

/* Large viewports - perfectly centered */
@media (min-width: 1025px) {
  main > .hero:first-of-type {
    height: 100vh;
    min-height: 100vh;
    margin-top: calc(-2rem - 80px + 40px); /* Offset main padding-top + slight adjustment to center perfectly */
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center subtitle, tagline, and paragraph as a column */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
  }
}

main > .hero:first-of-type {
  margin-top: calc(-2rem - 80px); /* Offset main padding-top to center hero vertically */
  position: relative;
}


main > .hero:first-of-type .hero-content-wrapper {
  width: 100%;
  max-width: 100%;
}

/* Make headlines smaller on hero pages with images (craft, leadership, process, impact) */
.hero-content-wrapper .tagline {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem); /* Smaller than homepage hero */
}

@media (max-width: 768px) {
  main > .hero:first-of-type {
    height: 100vh;
    height: 100dvh; /* Visible viewport on mobile so hero is middle-aligned */
    min-height: 100vh;
    min-height: 100dvh;
    margin-top: calc(-1rem - 70px); /* Offset main padding-top */
    margin-bottom: 3rem !important;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
  }
  
  /* Shift content up by half header to center in viewport */
  main > .hero:first-of-type > * {
    transform: translateY(calc(-35px));
  }
}

@media (max-width: 480px) {
  main > .hero:first-of-type {
    height: 100vh;
    height: 100dvh; /* Visible viewport on iOS so hero is truly centered */
    min-height: 100vh;
    min-height: 100dvh;
    margin-top: calc(-0.75rem - 65px); /* Offset main padding-top */
    margin-bottom: 3rem !important;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
  }
  
  main > .hero:first-of-type .tagline,
  main > .hero:first-of-type p,
  main > .hero:first-of-type .subtitle {
    margin-top: 0;
  }
}

@media (max-width: 375px) {
  main > .hero:first-of-type {
    height: 100vh;
    height: 100dvh; /* Visible viewport on iPhone SE / small phones */
    min-height: 100vh;
    min-height: 100dvh;
    margin-top: calc(-0.75rem - 65px); /* Offset main padding-top */
    margin-bottom: 3rem !important;
    padding-top: 0;
    padding-bottom: 0;
    justify-content: center;
    align-items: center; /* Center align horizontally */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
  }
  
  /* Shift content up by half header to center in viewport */
  main > .hero:first-of-type > * {
    transform: translateY(calc(-32.5px));
  }
  
  main > .hero:first-of-type .tagline,
  main > .hero:first-of-type p,
  main > .hero:first-of-type .subtitle {
    margin-top: 0;
  }
}

.breadcrumb a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  transition: color 200ms ease;
  position: relative;
  z-index: 11;
  pointer-events: auto;
}

.breadcrumb a:hover {
  color: var(--color-action);
}

.breadcrumb-separator {
  color: #b0b0b0;
}

.breadcrumb > span:last-child {
  color: #6a6a6a;
}

.craft-section {
  margin-bottom: var(--rhythm-4x);
  margin-top: 0;
  position: relative;
  padding-top: 0;
  padding-bottom: 0;
}

.craft-section:last-child {
  margin-bottom: 0;
}

@media screen and (max-width: 768px) {
  .craft-section {
    margin-bottom: 4rem !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  
  .craft-section:last-child {
    margin-bottom: 0 !important;
  }
}

@media screen and (max-width: 480px) {
  .craft-section {
    margin-bottom: 3rem !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  
  .craft-section:last-child {
    margin-bottom: 0 !important;
  }
}

/* Alternating section backgrounds for visual interest */

#coaching-mindset {
  padding: 4rem 0;
  position: relative;
}

@media screen and (max-width: 768px) {
  #coaching-mindset {
    padding: 3rem 0 !important;
  }
}

@media screen and (max-width: 480px) {
  #coaching-mindset {
    padding: 2.5rem 0 !important;
  }
}

#coaching-mindset::after {
  display: none; /* Remove gradient border - using common page border instead */
}

#portfolio {
  padding: 4rem 0;
  margin: 0 calc(-1 * clamp(1.25rem, 4vw, 3rem));
  padding-left: clamp(1.25rem, 4vw, 3rem);
  padding-right: clamp(1.25rem, 4vw, 3rem);
  background: var(--color-bg-alt);
  border-radius: 24px;
  margin-bottom: 6rem;
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(0, 0, 0, 0.08); /* Common page border for consistency */
}

[data-theme="dark"] #portfolio {
  background: var(--color-bg-alt);
  border-top-color: rgba(255, 255, 255, 0.15); /* Dark mode border */
}

#testimonials {
  padding: 4rem 0;
  position: relative;
}

#testimonials::before {
  content: '';
  position: absolute;
  top: -3rem;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--color-border-soft) 20%, 
    var(--color-border-soft) 80%, 
    transparent 100%);
}

@media (max-width: 768px) {
  #portfolio {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    border-radius: 16px;
  }
}

.design-principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rhythm-2x);
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
}

/* Challenge and Solution Grid */
.challenge-solution-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rhythm-2x);
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
  padding-bottom: var(--rhythm-2x);
  border-bottom: 1px solid var(--color-border-soft);
}

.challenge-solution-item {
  display: flex;
  flex-direction: column;
  gap: calc(var(--rhythm-unit) * 0.75);
}

.challenge-solution-item p {
  margin: 0;
  line-height: 1.5;
  color: var(--color-text);
}

.challenge-solution-item p strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--color-text);
}

.challenge-solution-item p:not(:first-child) {
  color: var(--color-text-muted);
}

@media (max-width: 768px) {
  .challenge-solution-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Process Steps Grid */
.process-steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--rhythm-2x);
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
  align-items: start;
}

.process-step {
  display: flex;
  flex-direction: column;
  gap: var(--rhythm-unit);
  height: 100%;
}

.process-step h5 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
  min-height: 3.2rem;
}

.process-step p {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.5;
  font-size: 0.95rem;
  min-height: 5.5rem;
  flex: 0 0 auto;
}

.process-step-image {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  flex: 0 0 auto;
}

.process-step-image img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: block;
}

.process-step-image img:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .process-step-image img {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .process-step-image img:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.process-step-image .thumbnail-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  font-weight: 500;
}

@media (max-width: 1200px) {
  .process-steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 968px) {
  .process-steps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .process-steps-grid {
    grid-template-columns: 1fr;
  gap: 2rem;
  }

  .process-step-image img {
    max-height: 180px;
  }
}

@media (max-width: 480px) {
  .process-step-image img {
    max-height: 160px;
  }
}

/* Impact Page Styles */
.impact-logo {
  max-width: 300px;
  height: auto;
  margin-bottom: 2rem;
  display: block;
}

.impact-logo.small {
  max-width: 200px;
  margin-right: 2rem;
  margin-bottom: 1rem;
}

.impact-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 2rem;
}

.logo-arrow {
  color: var(--color-text-muted);
  opacity: 0.6;
  flex-shrink: 0;
  margin: 0 24px;
  transition: opacity 0.3s ease;
  align-self: center;
}

.impact-logos:hover .logo-arrow {
  opacity: 0.8;
}

.impact-logo-wrapper {
  display: flex;
  align-items: center;
  position: relative;
}

.impact-logo-wrapper img,
.impact-logos > img {
  display: block;
  object-fit: contain;
  vertical-align: middle;
}

/* Align Ancestry logo with Inflection logo */
.impact-logos > img[alt*="Ancestry"] {
  align-self: center;
}

/* Adjust Ancestry logo to align baseline with Inflection */
.impact-logos > img[alt*="Ancestry"] {
  transform: translateY(2px);
}

/* Inflection logo: swap to dark mode version on impact page */
[data-theme="dark"] .impact-logo-wrapper:has(img[alt*="Inflection"]) {
  position: relative;
}

[data-theme="dark"] .impact-logo-wrapper img[alt*="Inflection"] {
  opacity: 0;
}

/* Show dark mode version as background */
[data-theme="dark"] .impact-logo-wrapper:has(img[alt*="Inflection"])::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/logos/logo-inflection-dark.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  pointer-events: none;
}

.impact-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--rhythm-2x);
  margin-top: var(--rhythm-2x);
  padding-top: var(--rhythm-2x);
  border-top: 1px solid var(--color-border-soft);
}

.impact-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(var(--rhythm-unit) * 0.5);
}

.impact-metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'Merriweather', Georgia, serif;
  color: var(--color-text);
  line-height: 1.2;
}

.impact-metric-label {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.metric-arrow {
  color: var(--color-accent);
  margin: 0 0.25rem;
}

/* Data Visualizations */
.metric-visualization {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--rhythm-unit);
  position: relative;
}

/* Circular Progress Indicator - Enhanced Donut Style */
.circular-progress {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

.circular-progress-bg {
  fill: none;
  stroke: var(--viz-orange-light);
  stroke-width: 12;
  opacity: 0.2;
}

.circular-progress-fill {
  fill: none;
  stroke: var(--viz-orange);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(217, 119, 87, 0.3));
}

[data-theme="dark"] .circular-progress-fill {
  stroke: var(--viz-orange);
  filter: drop-shadow(0 2px 4px rgba(232, 160, 130, 0.4));
}

.metric-visualization svg {
  position: relative;
}

.metric-visualization svg defs {
  position: absolute;
}

.metric-value-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.85rem;
  font-weight: 700;
  font-family: 'Merriweather', Georgia, serif;
  color: var(--color-text);
  text-align: center;
  line-height: 1.2;
  z-index: 2;
}

/* Bar Chart - Enhanced Horizontal Style */
.bar-chart {
  width: 100%;
  height: 100px;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.bar-chart::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
  pointer-events: none;
}

.bar-chart-bar {
  width: 100%;
  height: var(--bar-value);
  background: linear-gradient(180deg, 
    var(--viz-orange) 0%, 
    var(--viz-purple) 50%,
    var(--viz-purple-dark) 100%);
  border-radius: 8px 8px 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  min-height: 50px;
  box-shadow: 0 4px 12px rgba(217, 119, 87, 0.25),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.bar-chart-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
  pointer-events: none;
}

[data-theme="dark"] .bar-chart-bar {
  background: linear-gradient(180deg, 
    var(--viz-orange) 0%, 
    var(--viz-purple) 50%,
    var(--viz-purple-dark) 100%);
  box-shadow: 0 4px 12px rgba(232, 160, 130, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.bar-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: 'Merriweather', Georgia, serif;
  color: var(--color-text-inverted);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 1;
  position: relative;
}

/* Comparison Chart - Enhanced Before/After */
.comparison-chart {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  height: 120px;
  padding: 12px;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
  border-radius: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
  position: relative;
}

.comparison-bar {
  flex: 1;
  height: var(--comparison-value);
  border-radius: 8px 8px 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 35px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.comparison-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, transparent 100%);
  pointer-events: none;
}

.comparison-bar.before {
  background: linear-gradient(180deg, 
    var(--viz-orange-light) 0%, 
    var(--viz-orange) 100%);
  opacity: 0.85;
}

.comparison-bar.after {
  background: linear-gradient(180deg, 
    var(--viz-purple) 0%, 
    var(--viz-purple-dark) 50%,
    var(--viz-coral) 100%);
  box-shadow: 0 4px 16px rgba(139, 111, 168, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .comparison-bar.before {
  background: linear-gradient(180deg, 
    var(--viz-orange-light) 0%, 
    var(--viz-orange) 100%);
}

[data-theme="dark"] .comparison-bar.after {
  background: linear-gradient(180deg, 
    var(--viz-purple) 0%, 
    var(--viz-purple-dark) 50%,
    var(--viz-coral) 100%);
  box-shadow: 0 4px 16px rgba(168, 139, 196, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.comparison-label {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: 'Merriweather', Georgia, serif;
  color: var(--color-text);
  text-align: center;
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.comparison-bar.after .comparison-label {
  color: var(--color-text-inverted);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.comparison-arrow {
  font-size: 1.75rem;
  color: var(--viz-purple);
  font-weight: 600;
  align-self: center;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(139, 111, 168, 0.3));
  transition: transform 0.3s ease;
}

[data-theme="dark"] .comparison-arrow {
  color: var(--viz-purple-light);
  filter: drop-shadow(0 2px 4px rgba(168, 139, 196, 0.4));
}

.comparison-chart:hover .comparison-arrow {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .impact-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .impact-metric-value {
    font-size: 2rem;
  }

  .impact-logo {
    max-width: 250px;
  }

  .impact-logo.small {
    max-width: 150px;
    margin-right: 1rem;
  }

  .circular-progress {
    width: 120px;
    height: 120px;
  }

  .metric-value-overlay {
    font-size: 1.6rem;
  }

  .bar-chart {
    height: 90px;
  }

  .bar-value {
    font-size: 1.35rem;
  }

  .comparison-chart {
    height: 110px;
  }

  .comparison-label {
    font-size: 1.15rem;
    top: -30px;
  }
}

@media (max-width: 480px) {
  .impact-metrics {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .impact-metric-value {
    font-size: 1.75rem;
  }

  .impact-logos {
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  .logo-arrow {
    margin: 0 16px;
    transform: rotate(90deg);
  }

  .impact-logos:hover .logo-arrow {
    transform: rotate(90deg) translateX(2px);
  }

  .circular-progress {
    width: 110px;
    height: 110px;
  }

  .metric-value-overlay {
    font-size: 1.4rem;
  }

  .bar-chart {
    height: 80px;
  }

  .bar-value {
    font-size: 1.2rem;
  }

  .comparison-chart {
    height: 100px;
  }

  .comparison-label {
    font-size: 1.05rem;
    top: -28px;
  }
}

.design-principle {
  padding: 1.5rem;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid var(--color-border-soft);
  transition: all 300ms ease;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .design-principle {
  background: var(--color-surface);
}

.design-principle:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.design-principle-image {
  width: calc(100% + 3rem);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  margin-top: -1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  max-height: 220px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: transparent;
}

.principle-illustration {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 300ms ease, opacity 0.2s ease;
  border-radius: 12px 12px 0 0;
  display: block;
  cursor: pointer; /* Make it clear these images are clickable */
}

.design-principle:hover .principle-illustration {
  transform: scale(1.05);
}

.design-principle h3 {
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.design-principle p {
  margin: 0;
  color: var(--color-text-muted);
}

.principle-item {
  margin-top: 0;
  margin-bottom: var(--rhythm-3x);
  padding-bottom: var(--rhythm-3x);
  border-bottom: 1px solid var(--color-border-soft);
}

.principle-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.principle-item h3 {
  margin-top: 0;
}

.principle-item h4 {
  margin-top: var(--rhythm-2x);
}

.principle-item h3 {
  margin-bottom: 1rem;
  color: var(--color-text);
}

.principle-item > p {
  margin-bottom: 1.5rem;
}

.principle-examples {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.principle-examples li {
  padding: 0.5rem 0;
  color: var(--color-text-muted);
  position: relative;
  padding-left: 1.5rem;
  line-height: 1.5;
}

.principle-examples li strong {
  color: var(--color-text);
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

/* Portfolio Companies Section */
.portfolio-companies {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rhythm-3x) var(--rhythm-2x);
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
}

.portfolio-company {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: 16px;
  transition: all 300ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .portfolio-company {
  background: var(--color-surface-elevated);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.portfolio-company:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .portfolio-company:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.portfolio-logo {
  width: 120px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.25rem;
}

.portfolio-logo-large {
  width: 140px;
  height: 70px;
}

.portfolio-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 300ms ease, filter 300ms ease;
}

/* Make SurveyMonkey and Ancestry portfolio logos larger for visual balance */
.portfolio-logo img[alt="SurveyMonkey"] {
  transform: scale(1.25);
}

.portfolio-logo img[alt="Ancestry"] {
  transform: scale(1.2);
}

/* Make Oration portfolio logo slightly smaller */
.portfolio-logo img[alt="Oration"] {
  transform: scale(0.95);
}

/* Make Shopify, Oration, and Ancestry logos white in dark mode */
/* For Oration - muted white/light blue in dark mode */
[data-theme="dark"] .portfolio-logo img[alt="Oration"] {
  filter: invert(1) brightness(0.9) sepia(0.1) saturate(0.8);
  opacity: 0.85;
}

/* Shopify portfolio logo: swap to dark mode version */
[data-theme="dark"] .portfolio-logo:has(img[alt="Shopify"]) {
  position: relative;
}

[data-theme="dark"] .portfolio-logo img[alt="Shopify"] {
  opacity: 0;
}

[data-theme="dark"] .portfolio-logo:has(img[alt="Shopify"])::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/logos/logo-shopify-dark.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  pointer-events: none;
}

/* Ancestry logo: leave as-is in dark mode (no filter manipulation) */

.portfolio-company:hover .portfolio-logo img {
  transform: scale(1.05);
}

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

.portfolio-description {
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 968px) {
  .portfolio-companies {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 1.5rem;
  }
}

@media (max-width: 768px) {
  .portfolio-companies {
    gap: 2rem 1.5rem;
  }

  .portfolio-logo {
    width: 100px;
    height: 50px;
  }

  .portfolio-logo-large {
    width: 115px;
    height: 58px;
  }
}

@media (max-width: 480px) {
  .portfolio-companies {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .portfolio-logo {
    width: 90px;
    height: 45px;
  }

  .portfolio-logo-large {
    width: 103px;
    height: 52px;
  }
}

.principle-examples li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: bold;
}

/* Testimonials Carousel */
.testimonials-carousel-wrapper {
  position: relative;
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
  margin-left: calc(-1 * clamp(1.25rem, 4vw, 3rem));
  margin-right: calc(-1 * clamp(1.25rem, 4vw, 3rem));
  padding-left: clamp(1.25rem, 4vw, 3rem);
  padding-right: clamp(1.25rem, 4vw, 3rem);
}

.testimonials-carousel {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  scroll-snap-type: x mandatory;
  padding-bottom: 1rem;
  padding-right: clamp(1.25rem, 4vw, 3rem);
}

.testimonials-carousel::-webkit-scrollbar {
  height: 8px;
}

.testimonials-carousel::-webkit-scrollbar-track {
  background: transparent;
}

.testimonials-carousel::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.testimonials-carousel::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.testimonial-card {
  flex: 0 0 auto;
  width: 85%;
  max-width: 600px;
  min-width: 280px;
  padding: 2rem 2.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: 16px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform 300ms ease, box-shadow 300ms ease;
  margin-right: 1.5rem;
}

.testimonial-card:last-child {
  margin-right: 0;
}

[data-theme="dark"] .testimonial-card {
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.testimonial-card blockquote {
  margin: 0;
  padding: 0;
  border: none;
  font-style: normal;
}

.testimonial-card blockquote p {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: var(--rhythm-unit);
  font-style: italic;
  font-weight: 400;
}

.testimonial-card blockquote footer {
  margin-top: var(--rhythm-unit);
  font-style: normal;
  padding-top: var(--rhythm-unit);
  border-top: 1px solid var(--color-border-soft);
}

.testimonial-card blockquote footer strong {
  display: block;
  color: var(--color-text);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.testimonial-card blockquote footer span {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.testimonial-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 300ms ease;
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.testimonial-arrow:hover {
  background: var(--color-surface-elevated);
  border-color: var(--color-accent);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.testimonial-arrow:active {
  transform: translateY(-50%) scale(1);
}

.testimonial-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.testimonial-arrow-left {
  left: clamp(1.25rem, 4vw, 3rem);
}

.testimonial-arrow-right {
  right: clamp(1.25rem, 4vw, 3rem);
}

[data-theme="dark"] .testimonial-arrow {
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .testimonial-arrow:hover {
  background: var(--color-surface-elevated);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .testimonials-carousel-wrapper {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .testimonial-card {
    width: 90%;
    padding: 1.75rem 2rem;
  }

  .testimonial-card blockquote p {
    font-size: 1.15rem;
  }

  .testimonial-arrow {
    width: 40px;
    height: 40px;
  }

  .testimonial-arrow-left {
    left: 1.25rem;
  }

  .testimonial-arrow-right {
    right: 1.25rem;
  }
}

@media (max-width: 480px) {
  .testimonials-carousel {
    gap: 1rem;
  }

  .testimonial-card {
    width: 95%;
    min-width: 260px;
    padding: 1.5rem 1.75rem;
  }

  .testimonial-card blockquote p {
    font-size: 1.1rem;
    line-height: 1.5;
  }

  .testimonial-arrow {
    width: 36px;
    height: 36px;
  }

  .testimonial-arrow svg {
    width: 20px;
    height: 20px;
  }

  .testimonial-arrow-left {
    left: 1rem;
  }

  .testimonial-arrow-right {
    right: 1rem;
  }
}

.principle-image-container {
  margin-top: 2rem;
  width: 100%;
}

.principle-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: block;
}

.principle-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Clickable images - make it clear they're interactive */
.clickable-image {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.clickable-image:hover {
  opacity: 0.9;
}

.hero-image.clickable-image:hover {
  opacity: 1;
}

.principle-illustration.clickable-image:hover,
.principle-illustration:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

/* Principle Images Gallery - Horizontal Scroll */
.principle-images-gallery {
  display: flex;
  gap: var(--rhythm-unit);
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: var(--rhythm-2x);
  margin-bottom: var(--rhythm-2x);
  margin-left: calc(-1 * clamp(1.25rem, 4vw, 3rem));
  margin-right: calc(-1 * clamp(1.25rem, 4vw, 3rem));
  padding-left: clamp(1.25rem, 4vw, 3rem);
  padding-right: clamp(1.25rem, 4vw, 3rem);
  padding-bottom: calc(var(--rhythm-unit) * 0.5);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  width: calc(100% + 2 * clamp(1.25rem, 4vw, 3rem));
}

/* Single thumbnail in craft-section floats left of paragraph */
/* Only apply float behavior when there's exactly one thumbnail */
.craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) {
  display: block;
  margin: 0;
  padding: 0;
  width: auto;
  overflow: visible;
  float: left;
  margin-right: 2rem;
  margin-bottom: var(--rhythm-unit);
  margin-top: var(--rhythm-unit);
  clear: left;
}

/* Multi-thumbnail galleries in craft-section should maintain flex/horizontal scroll */
.craft-section .principle-images-gallery:not(:has(.principle-thumbnail:only-child)) {
  display: flex;
  float: none;
}

/* Metrics section should clear the float and appear below */
.impact-metrics {
  clear: both;
}

.principle-images-gallery::-webkit-scrollbar {
  height: 8px;
}

.principle-images-gallery::-webkit-scrollbar-track {
  background: transparent;
}

.principle-images-gallery::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.principle-images-gallery::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.principle-thumbnail {
  flex: 0 0 auto;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Single thumbnail in craft-section - only when it's the only child */
.craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) .principle-thumbnail {
  width: 420px;
  max-width: 45%;
  float: none;
  display: block;
}

.craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) .principle-thumbnail a {
  display: block;
  text-decoration: none;
}

.principle-thumbnail img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: block;
}

/* Show more of the image for single thumbnails in craft-section */
.craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) .principle-thumbnail img {
  max-height: none;
  object-fit: contain;
}

.principle-thumbnail img:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .principle-thumbnail img {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .principle-thumbnail img:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.thumbnail-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  font-weight: 500;
}

/* Single thumbnail label in craft-section */
.craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) .thumbnail-label {
  text-align: left;
  margin-top: 0.5rem;
}

.thumbnail-link {
  display: block;
  font-size: 0.8rem;
  color: var(--color-action);
  text-decoration: none;
  text-align: center;
  font-weight: 500;
  margin-top: 0.5rem;
  transition: color 200ms ease;
}

.thumbnail-link:hover {
  color: var(--color-action-hover);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .principle-thumbnail {
    width: 240px;
  }

  .principle-thumbnail img {
    max-height: 180px;
  }

  .principle-images-gallery {
    gap: 0.75rem;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    width: calc(100% + 2.5rem);
  }

  /* Single thumbnail in craft-section on mobile */
  .craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) {
    float: none;
    margin: var(--rhythm-unit) 0;
    max-width: 100%;
  }

  /* Multi-thumbnail galleries should maintain flex display on mobile */
  .craft-section .principle-images-gallery:not(:has(.principle-thumbnail:only-child)) {
    display: flex;
    float: none;
  }

  .craft-section .principle-images-gallery:has(.principle-thumbnail:only-child) .principle-thumbnail {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .principle-thumbnail {
    width: 200px;
  }

  .principle-thumbnail img {
    max-height: 160px;
  }

  .principle-images-gallery {
    gap: 0.5rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    width: calc(100% + 2rem);
  }
}

/* Image Lightbox */
.image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

[data-theme="dark"] .image-lightbox {
  background: rgba(0, 0, 0, 0.98);
}

.image-lightbox.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 2rem;
  line-height: 1;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 10002;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.image-lightbox.active .lightbox-close {
  display: flex;
}

.lightbox-close:hover,
.lightbox-close:focus {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lightbox-close span {
  display: block;
}

.lightbox-content {
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lightbox-image-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 95vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: block;
}

.lightbox-image-wrapper:hover .lightbox-caption,
.lightbox-image-wrapper:focus-within .lightbox-caption,
.lightbox-image-wrapper .lightbox-caption:focus {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.lightbox-caption {
  display: block;
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 0.75rem 1.25rem;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.lightbox-caption.light-background {
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
}

.lightbox-caption.dark-background {
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a;
}

.lightbox-caption::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: inherit;
}

.lightbox-caption.light-background::after {
  border-top-color: rgba(0, 0, 0, 0.85);
}

.lightbox-caption.dark-background::after {
  border-top-color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 768px) {
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .lightbox-content {
    padding: 3rem 1rem 1rem;
  }

  .lightbox-caption {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    bottom: 1rem;
    max-width: 85%;
    white-space: normal;
  }

  .principle-image-container {
    margin-top: 1.5rem;
  }
}

.page-navigation {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 5rem;
  margin-bottom: 0;
  margin-left: calc(-1 * clamp(1.25rem, 4vw, 3rem));
  margin-right: calc(-1 * clamp(1.25rem, 4vw, 3rem));
  padding-top: 0;
  padding-bottom: var(--rhythm-unit);
  padding-left: clamp(1.25rem, 4vw, 3rem);
  padding-right: clamp(1.25rem, 4vw, 3rem);
  border-top: none;
}

/* When there's only one nav link, right-align it */
.page-navigation:has(.nav-page-link:only-child) {
  justify-content: flex-end;
}

.nav-page-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: .36rem .72rem !important;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.nav-page-link:hover {
  color: var(--color-text);
  border-color: var(--color-border);
  background: rgba(26, 26, 26, 0.04);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.nav-page-link:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border-color: var(--color-border);
  background: rgba(26, 26, 26, 0.06);
}

[data-theme="dark"] .nav-page-link {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

[data-theme="dark"] .nav-page-link:hover {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .nav-page-link:active {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  .design-principles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .design-principle-image {
    min-height: 150px;
    max-height: 180px;
  }

  .principle-examples {
    grid-template-columns: 1fr;
  }

  .page-navigation {
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  
  .nav-page-link {
    padding: 0.875rem 3rem;
    font-size: 0.9rem;
    flex: 0 1 auto;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .page-navigation {
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .nav-page-link {
    padding: 0.75rem 2.5rem;
    font-size: 0.85rem;
    flex: 0 1 auto;
    min-width: 0;
  }
}

/* Error Pages */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: clamp(1.25rem, 4vw, 3rem);
  margin-bottom: 6rem;
  margin-top: 0;
  opacity: 1;
  transform: none;
  position: relative;
  z-index: 1;
}

.error-container {
  text-align: center;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.error-code {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 var(--rhythm-unit) 0;
  color: var(--color-text);
  font-family: 'Merriweather', Georgia, serif;
}

.error-description {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 400;
  line-height: 1.5;
  margin-top: 0;
  margin-bottom: var(--rhythm-2x);
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--rhythm-2x);
}

.error-actions .cta {
  min-width: 160px;
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
  box-shadow: none;
}

.error-actions .cta:hover,
.error-actions .cta:focus-visible {
  background: var(--color-text);
  color: var(--color-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.error-actions .cta:active {
  background: var(--color-text);
  color: var(--color-bg);
  transform: translateY(0);
}

[data-theme="dark"] .error-actions .cta {
  border-color: var(--color-text);
  color: var(--color-text);
}

[data-theme="dark"] .error-actions .cta:hover,
[data-theme="dark"] .error-actions .cta:focus-visible {
  background: var(--color-text);
  color: var(--color-bg);
}

@media (max-width: 768px) {
  .error-page {
    min-height: calc(100vh - 150px);
    padding: 3rem 1.5rem;
  }

  .error-code {
    font-size: 2rem;
  }

  .error-description {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .error-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .error-actions .cta {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .error-code {
    font-size: 1.75rem;
  }
}
