/* Scroll Transitions CSS - Reusable styles for page transitions */

/* CSS Variables for Light/Dark Mode */
:root {
  /* Light mode colors (default) */
  --bg-color: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --nav-bg-light: rgba(255, 255, 255, 0.95);
  --nav-bg-dark: rgba(0, 0, 0, 0.8);
  --dropdown-bg: rgba(0, 0, 0, 0.9);
  --highlight-color: #c41e3a;
}

/* Dark mode colors */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --text-muted: #b0b0b0;
  --border-color: #333333;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --nav-bg-light: rgba(26, 26, 26, 0.95);
  --nav-bg-dark: rgba(0, 0, 0, 0.9);
  --dropdown-bg: rgba(26, 26, 26, 0.95);
  --highlight-color: #ff6b6b;
}

/* Apply dark mode to body and main elements */
[data-theme="dark"] body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

[data-theme="dark"] .content-box {
  background: var(--bg-color);
}

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

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

/* Header and Navigation */
header {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0);
  z-index: 1000;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0);
  transition: background 0.1s ease, box-shadow 0.1s ease, transform 0.5s ease;
  will-change: transform, background, box-shadow;
  min-width: 100vw; /* Force full viewport width calculation */
  box-sizing: border-box;
}

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

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo img {
  height: 75px;
  width: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  transition: filter 0.1s ease;
  will-change: filter;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  text-decoration: none;
  color: rgb(255, 255, 255);
  font-weight: 500;
  transition: opacity 0.3s ease, color 0.1s ease, text-shadow 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  will-change: color, text-shadow;
}

.nav-menu a:hover {
  opacity: 0.7;
}

/* Dropdown submenu styles */
.has-submenu > a {
  position: relative;
}

.has-submenu > a::after {
  content: '▼';
  font-size: 0.7rem;
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: rgba(0, 0, 0, 0.9);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  padding: 0.5rem 0;
  list-style: none;
  padding-left: 0;
}

.nav-menu li:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown li {
  margin: 0;
  padding: 0;
}

.dropdown a {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease;
  color: white;
}

.dropdown a:last-child {
  border-bottom: none;
}

.dropdown a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 20px;
  height: 2px;
  background: white;
  margin: 3px 0;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

header.scrolled .hamburger span {
  background: #333;
  box-shadow: none;
}

.close-menu {
  display: none;
  position: fixed;
  top: 1rem;
  right: 2rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10000;
}

/* Dark Mode Toggle - Base styles */
.dark-mode-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.dark-mode-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}

.dark-mode-icon {
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  font-size: 1.2rem;
  filter: grayscale(1);
  transition: filter 0.3s ease;
}

.dark-mode-toggle:hover .dark-mode-icon {
  filter: grayscale(0);
}

/* Desktop-specific dark mode toggle */
.desktop-only {
  margin-left: 10px;
  margin-right: 0;
  display: block;
}

/* Desktop toggle container */
.desktop-toggle-container {
  display: flex;
  align-items: center;
  margin-left: 5px;
  line-height: 1;
}

.desktop-toggle-container .dark-mode-toggle {
  margin: 0;
  position: relative;
  top: -0.35em;
}

/* Mobile menu top section */
.mobile-menu-top {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  margin-bottom: 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px; /* Fixed height for consistent positioning */
  z-index: 10000;
}

/* Position mobile toggle and close button */
.mobile-menu-top {
  display: none;
}

.nav-menu.active .mobile-menu-top {
  display: flex;
}

.mobile-menu-top .dark-mode-toggle {
  position: fixed;
  left: 2rem;
  top: 1rem;
  margin: 0;
  background: transparent;
  z-index: 10000;
}

/* Mobile-specific styles */
@media (max-width: 920px) {
  
  /* Hide desktop toggle on mobile */
  .desktop-toggle-container {
    display: none !important;
  }
  
  /* Position close button - use fixed positioning for consistency */
  .close-menu {
    position: fixed;
    right: 2rem;
    top: 1rem;
  }
}

/* When header is scrolled */
header.scrolled .dark-mode-toggle {
  background: transparent;
}

/* Dark mode version */
[data-theme="dark"] .dark-mode-toggle {
  background: transparent;
}

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

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

/* Desktop dark mode toggle positioning */
.desktop-dark-toggle {
  margin-left: 10px;
}

/* Header background using CSS variables */
header.scrolled {
  background: var(--nav-bg-light) !important;
}

/* Dark mode header scrolled state */
[data-theme="dark"] header.scrolled {
  background: rgba(26, 26, 26, 0.95) !important;
  border-bottom: 1px solid var(--border-color);
}

/* Navigation text color updates - DESKTOP ONLY */
@media (min-width: 921px) {
  header.scrolled .nav-menu a {
    color: var(--text-color) !important;
    text-shadow: none !important;
  }

  [data-theme="dark"] header.scrolled .nav-menu a {
    color: var(--text-color) !important;
    text-shadow: none !important;
  }
}

/* Dark mode logo adjustments - ensure proper visibility */
[data-theme="dark"] .logo img {
  filter: brightness(0) invert(1) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8)) !important;
}

[data-theme="dark"] header.scrolled .logo img {
  filter: brightness(1.2) saturate(1.1) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3)) !important;
}

/* Dark mode hamburger adjustments */
[data-theme="dark"] .hamburger span {
  background: white !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

[data-theme="dark"] header.scrolled .hamburger span {
  background: var(--text-color) !important;
  box-shadow: none !important;
}


/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
  background-color: #000000;
}

/* LAYER 1: Hero Image - scrolls with page */
.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50vh; /* 50vh on desktop */
  overflow: hidden;
  z-index: 1;
}

/* Increase hero image height for desktop screens */
@media (min-width: 1200px) {
  .hero-image {
    height: 50vh; /* Taller hero image on desktop */
  }
  
  /* Adjust title position for taller hero image */
  .title-box {
    top: calc(50vh - 8rem);
  }
  
  /* Adjust content box position for taller hero image */
  .content-box {
    top: calc(50vh - 8rem + 3rem + 4rem);
  }
}

.hero-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.4));
  z-index: 2;
  pointer-events: none;
}

.hero-image img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  z-index: 1;
  /* Improve image rendering quality */
  image-rendering: -webkit-optimize-contrast; /* Chrome, Safari */
  image-rendering: crisp-edges; /* Firefox */
  transform: translateZ(0); /* Force GPU acceleration */
  backface-visibility: hidden; /* Reduce rendering jitter */
  -webkit-transform-style: preserve-3d; /* Improve rendering consistency */
  will-change: transform; /* Hint to browser for optimization */
  filter: brightness(1.03) contrast(1.05); /* Slightly enhance image appearance */
  transform: translateZ(0); /* Force GPU acceleration */
  backface-visibility: hidden; /* Reduce rendering jitter */
  -webkit-transform-style: preserve-3d; /* Improve rendering consistency */
  will-change: transform; /* Hint to browser for optimization */
}

/* LAYER 2: Title Box - initially fixed, then flows */
.title-box {
  position: fixed;
  top: calc(50vh - 8rem);
  left: 0;
  right: 0;
  z-index: 10;
  text-align: center;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  will-change: position, top, transform;
  transform: translateZ(0); /* Force GPU acceleration */
  backface-visibility: hidden; /* Reduce rendering jitter */
  -webkit-transform-style: preserve-3d; /* Improve rendering consistency */
  -webkit-backface-visibility: hidden; /* Additional rendering improvement for Safari */
}

.title-box.flowing {
  position: absolute;
  margin-bottom: 0;
  transition: none; /* Disable transitions during flowing state to prevent jitter */
}

.page-title {
  font-size: 3rem;
  font-weight: 300;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.5);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
  will-change: color, text-shadow;
  backface-visibility: hidden; /* Reduce text rendering jitter */
  -webkit-font-smoothing: antialiased;
}

.page-title.on-white {
  color: #333;
  text-shadow: none;
}

/* LAYER 3: Content Box - initially fixed, then flows */
.content-box {
  position: fixed;
  top: calc(50vh - 8rem + 3rem + 4rem); /* title position + title height + larger margin */
  left: 0;
  right: 0;
  z-index: 5;
  background: var(--bg-color, white);
  min-height: 100vh;
  will-change: position, top, transform;
  transform: translateZ(0); /* Force GPU acceleration */
  backface-visibility: hidden; /* Reduce rendering jitter */
  -webkit-transform-style: preserve-3d; /* Improve rendering consistency */
  -webkit-backface-visibility: hidden; /* Additional rendering improvement for Safari */
}

.content-box.flowing {
  position: absolute;
  transition: none; /* Disable transitions during flowing state to prevent jitter */
}

/* Responsive adjustments */
@media (max-width: 920px) {
  .logo img {
    height: 60px;
  }

  header {
    padding: 0.75rem 1.5rem;
  }

  nav {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
  }

  .hamburger {
    display: flex;
  }

  .logo {
    flex: none;
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: 0;
    width: 100vw;
    height: 100vh;
    flex-direction: column;
    background: #000000;
    text-align: center;
    transition: left 0.3s ease;
    padding: 5rem 0 3rem 0;
    justify-content: flex-start;
    display: flex;
    z-index: 9999;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    max-height: 100vh;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-menu.active .close-menu {
    display: block;
    opacity: 1;
  }

  .nav-menu.active ~ .hamburger {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
  }

  .nav-menu li {
    margin: 1rem 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .nav-menu.active li {
    opacity: 1;
    transform: translateY(0);
  }

  .nav-menu.active li:nth-child(2) { transition-delay: 0.1s; }
  .nav-menu.active li:nth-child(3) { transition-delay: 0.15s; }
  .nav-menu.active li:nth-child(4) { transition-delay: 0.2s; }
  .nav-menu.active li:nth-child(5) { transition-delay: 0.25s; }
  .nav-menu.active li:nth-child(6) { transition-delay: 0.3s; }
  .nav-menu.active li:nth-child(7) { transition-delay: 0.35s; }
  .nav-menu.active li:nth-child(8) { transition-delay: 0.4s; }

  /* ==========================================
     MOBILE MENU - SINGLE SOURCE OF TRUTH
     ========================================== */
  
  /* Mobile menu links - always white, no exceptions */
  .nav-menu a {
    font-size: 1.1rem;
    color: white !important;
    text-shadow: none !important;
  }

  /* Mobile dropdown styling - consistent regardless of theme or scroll state */
  .dropdown {
    position: static !important;
    opacity: 0 !important;
    visibility: hidden !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    background: rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 4px !important;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease, visibility 0s ease 0.3s !important;
    list-style: none !important;
    padding-left: 0 !important;
  }

  .has-submenu.expanded .dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    max-height: 250px !important;
    margin: 0.5rem 0 !important;
    padding: 0.5rem 0 !important;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease, visibility 0s ease 0s !important;
    overflow-y: auto !important;
  }

  .dropdown a {
    color: white !important;
    font-size: 0.9rem !important;
    padding: 0.4rem 1rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: transparent !important;
  }

  .dropdown a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
  }

  .dropdown a:last-child {
    border-bottom: none !important;
  }

  /* Mobile dark toggle adjustments */
  .nav-menu.active .dark-toggle-container {
    opacity: 1;
    pointer-events: auto;
    margin: 1rem auto;
    position: relative;
    top: auto;
    right: auto;
  }

  .dark-toggle-container .dark-mode-toggle {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
  }

  .dark-toggle-container .dark-mode-icon {
    font-size: 1.5rem;
  }


  /* Mobile dropdown adjustments */
  .has-submenu {
    position: relative;
  }

  .has-submenu > a {
    cursor: pointer;
    padding-right: 2rem;
    position: relative;
  }

  .has-submenu > a::after {
    content: '▶';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    color: #333;
  }

  .has-submenu.expanded > a::after {
    transform: translateY(-50%) rotate(90deg);
  }




  /* Mobile hero image should be smaller */
  .hero-image {
    height: 33vh; /* Keep original 33vh on mobile */
  }

  .title-box {
    top: calc(33vh - 6rem); /* Update for mobile 33vh */
  }

  .page-title {
    font-size: 2rem;
  }

  .content-box {
    top: calc(33vh - 6rem + 2rem + 3rem); /* Adjust for mobile 33vh + smaller title height + larger margin */
  }
}

/* Extra small screens (iPhone SE, etc) */
@media (max-width: 375px) {
  header {
    padding: 0.5rem 1rem;
  }

  .logo img {
    height: 50px;
  }

  .title-box {
    top: calc(33vh - 5rem); /* Keep 33vh for extra small screens */
  }

  .page-title {
    font-size: 1.8rem;
  }

  .content-box {
    top: calc(33vh - 5rem + 1.8rem + 2.5rem); /* Adjust for 33vh + even smaller title height + larger margin */
  }
} 

/* Ensure dropdown list items have no bullets */
.dropdown li {
  list-style: none;
} 