/* ===== Header ===== */
header {
  background-color: var(--secondary-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1.5rem;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 20;
}

header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -18px;
  height: 18px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
}

/* ===== Mobile Navigation Drawer: Link/Button Layout ===== */
@media (max-width: 900px) {

  /* Vertical layout for navigation links */
  .nav-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.6rem;
    margin-top: 1.8rem !important;
    margin-bottom: 0.4rem;
    text-align: center;
    padding-top: 0.3rem !important;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
    position: relative;
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.01),
      rgba(30, 111, 114, 0.02)
    );
    border-radius: 8px;
    flex-grow: 1;
    overflow: visible;
    width: 100%;
  }

  .nav-footer {
    margin-top: auto;
    padding-bottom: 0.6rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  /* Mobile navigation link/button styling */
  .nav-menu a {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
      to bottom right,
      rgba(255, 255, 255, 0.25),
      rgba(30, 111, 114, 0.04)
    );
    backdrop-filter: blur(6px);
    border-radius: 50px;
    border: 1px solid rgba(30, 111, 114, 0.12);
    padding: 0.85rem 1.8rem;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--heading-color);
    letter-spacing: 0.01875rem;
    text-align: center;
    width: 80%;
    margin: 0 auto;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3),
                inset 0 -1px 2px rgba(0, 0, 0, 0.04),
                0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease both;
  }

  /* Hover / Focus / Active button feedback */
  .nav-menu a:hover,
  .nav-menu a:focus-visible,
  .nav-menu a:active {
    background: linear-gradient(
      to bottom right,
      rgba(255, 255, 255, 0.35),
      rgba(30, 111, 114, 0.08)
    );
    transform: translateY(-1px) scale(1.02);
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.4),
                0 3px 6px rgba(30, 111, 114, 0.15);
    font-weight: 600;
    color: var(--accent);
    border: 2px solid var(--accent);
  }



  /* Height-based refinements: short screens */
  @media (max-height: 700px) {
    .nav-menu ul {
      margin-top: 0.5rem;
      margin-bottom: 1rem;
      gap: 1.4rem;
    }
  }

  @media (max-height: 650px) {
    .nav-menu ul {
      margin-top: 0.6rem;
      margin-bottom: 1rem;
      gap: 1.5rem;
    }
  }

  /* Tall screens */
  @media (min-height: 820px) {
    .nav-menu ul {
      margin-top: 0.9rem;
      margin-bottom: 2.3rem;
    }
  }
}



header .container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

/* Let the header use the viewport on large monitors instead of leaving
   the logo and quick actions inset by the 1400px content constraint. */
@media (min-width: 1600px) {
  header .container {
    width: 100%;
    max-width: none;
    padding-inline: clamp(0.5rem, 1.5vw, 2rem);
  }
}

.nav-menu {
  justify-self: center;
}

/* ===== Header Logo Styling ===== */
.logo {
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 600;
}

.logo img {
    height: clamp(42px, 4.4vw, 64px);
    width: auto;
    vertical-align: middle;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
    transition: transform 0.2s ease;
    margin-top: 4px;
}

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


/* ===== Desktop Navigation Drawer Link & Layout Styles (Chunk 3) ===== */
@media (min-width: 901px) {

  /* Desktop navigation list layout */
  .nav-menu ul {
    list-style: none;
    display: flex;
    flex-direction: row;
    gap: 2.5rem;
    justify-content: center;
    text-align: right;
  }

  /* Desktop navigation link styling */
  .nav-menu a {
    font-size: 1.15rem;
    color: var(--heading-color);
    letter-spacing: 0.025rem;
    font-weight: 500;
    padding: 10px 0;
    opacity: 1;
    transform: none;
    animation: none;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
  }

  /* Desktop hover effects */
 .nav-menu a:hover {
  opacity: 1;
  transform: translateX(4px);
  color: var(--accent);
  letter-spacing: 0.03125rem;
  text-decoration: none;
}


  .nav-menu a {
    position: relative;
    text-decoration: none;
  }

  .nav-menu a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 3px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    border-radius: 2px;
  }

}

/* ===== Accessibility Wrapper (Header only) ===== */
.accessibility-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Header Controls (Shared Size Contract) ===== */
.menu-toggle,
.accessibility-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 36px;
  height: 36px;
  z-index: 1500;
}

.accessibility-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
  transform: translateY(-6px);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.accessibility-button:hover img {
  opacity: 1;
  transform: scale(1.08);
}

.accessibility-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
  background-color: rgba(30, 111, 114, 0.12);
}

body.dark-mode .accessibility-button img {
  filter: brightness(0) invert(1);
}

body.dark-mode header {
  background-color: var(--secondary-bg);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

body.dark-mode header::after {
  background: linear-gradient(180deg, rgba(99, 210, 207, 0.08) 0%, rgba(99, 210, 207, 0) 100%);
}

@media (max-width: 900px) {
  .menu-toggle {
      appearance: none;
      background: none;
      border: none;
      display: flex !important;
      flex-direction: column;
      justify-content: center;
      gap: 4px;
      width: 36px;
      height: 36px;
      cursor: pointer;
      z-index: 2000;
      pointer-events: auto;
      position: absolute;
      top: 1.15rem;
      right: 1.2rem;
  }

  /* Hide hamburger when navigation drawer is open */
  body.menu-open .menu-toggle {
    display: none !important;
  }

  .menu-toggle:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
    background: rgba(30, 111, 114, 0.08);
  }

 .menu-toggle .bar {
  display: block;
  height: 0.21875rem;
  width: 100%;
  background-color: #000;
  border-radius: 4px;
  transition: all 0.3s ease;
  forced-color-adjust: none;
}


  body.dark-mode .menu-toggle .bar {
    background-color: var(--body-text);
  }

  .menu-toggle.active .bar:nth-child(2) { opacity: 0; }
  .menu-toggle.active .bar:nth-child(1) {
      transform: translateY(8px) rotate(45deg);
  }
  .menu-toggle.active .bar:nth-child(3) {
      transform: translateY(-8px) rotate(-45deg);
  }
}

@media (max-width: 900px) {
  .accessibility-button {
    position: absolute;
    top: 1.15rem;   /* shared vertical anchor */
    right: 4.2rem;  /* sits left of hamburger */
  }

  body.menu-open .accessibility-button {
    display: none !important;
  }
}

@media (min-width: 901px) {
  .menu-toggle {
      display: none !important;
  }
}

.menu-toggle {
  width: 32px !important;
  height: 32px !important;
}

/* ===== Drawer Close (X Button) ===== */
.drawer-close {
  position: fixed;
  top: 1.45rem;
  right: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1100;
  width: 32px !important;
  height: 32px !important;
}

.drawer-close .close-icon {
  width: 80%;
  height: 80%;
  object-fit: contain;
  transform: translate(-0.03125rem, 0.0375rem);
  filter: brightness(0) saturate(100%) invert(15%) sepia(8%)
          saturate(1548%) hue-rotate(160deg) brightness(95%) contrast(89%);
  transition: transform 0.25s ease, filter 0.25s ease;
}

.drawer-close:active .close-icon {
  opacity: 0.75;
  transform: scale(0.9);
  transition: transform 0.1s ease, opacity 0.1s ease;
}

/* ===== Mobile Navigation Drawer: Container & Header ===== */
@media (max-width: 900px) {
  /* Refined mobile drawer layout */
  .nav-menu {
    overscroll-behavior: none;
    background: linear-gradient(180deg, #f4f6f7 0%, #e7f1f2 100%);
    box-shadow: -6px 0 20px rgba(0,0,0,0.08);
    border-left: 1px solid rgba(30,111,114,0.15);
    position: fixed;
    top: 0;
    right: -260px;
    width: 250px;
    height: 100vh;
    max-height: 100vh;
    flex-grow: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: right 0.45s ease, opacity 0.35s ease;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
  }

  body.dark-mode .nav-menu {
    background: linear-gradient(180deg, #172126 0%, #111b20 100%);
    border-left-color: var(--border);
    box-shadow: -10px 0 26px rgba(0, 0, 0, 0.42);
  }

  body.dark-mode .nav-menu ul {
    background: linear-gradient(
      to bottom,
      rgba(99, 210, 207, 0.04),
      rgba(255, 255, 255, 0.02)
    );
  }

  body.dark-mode .nav-menu a {
    background: linear-gradient(
      to bottom right,
      rgba(255, 255, 255, 0.08),
      rgba(99, 210, 207, 0.05)
    );
    border-color: rgba(99, 210, 207, 0.18);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.06),
                0 6px 16px rgba(0, 0, 0, 0.18);
    color: var(--heading-color);
  }

  body.dark-mode .nav-menu a:hover,
  body.dark-mode .nav-menu a:focus-visible,
  body.dark-mode .nav-menu a:active {
    background: rgba(99, 210, 207, 0.12);
    border-color: var(--hover-accent);
    color: var(--hover-accent);
  }

  body.dark-mode .nav-header::after {
    background: rgba(99, 210, 207, 0.28);
  }

  body.dark-mode .drawer-close .close-icon {
    filter: brightness(0) invert(1);
  }

  /* Position logo and X button at the very top before the divider */
  .nav-header {
    flex: 0 0 auto !important;
    width: 100%;
    padding: 1rem 1.2rem 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative !important;
  }

  .nav-header::after {
    content: "";
    position: absolute;
    bottom: -0.6rem;
    left: 20px;
    right: 20px;
    height: 1px;
    background: rgba(30,111,114,0.5);
    pointer-events: none;
  }

  /* Keep the drawer logo separate from the pill styling used by nav links. */
  body .nav-menu .nav-header a.logo {
    width: 64px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    animation: none;
    transform: none;
  }

  body .nav-menu .nav-header a.logo:hover,
  body .nav-menu .nav-header a.logo:focus-visible,
  body .nav-menu .nav-header a.logo:active {
    background: none;
    border: 0;
    box-shadow: none;
    transform: none;
  }

  /* Hide the duplicate close button that appears near the logo */
  .nav-header .drawer-close {
    display: none;
  }

  .nav-logo {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
    margin: 0;
  }

  .nav-logo:hover {
    transform: scale(1.05);
  }

  /* Accent side border for mobile nav */
  .nav-menu::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: var(--accent);
    border-radius: 0 8px 8px 0;
  }

  /* Mobile nav open state */
  .nav-menu.open {
    right: 0;
    visibility: visible;
    opacity: 1;
  }
}

/* Prevent background scrolling when drawer is open */
/* ===== iOS FULL FREEZE: Prevent ANY page scrolling ===== */
html.menu-open,
body.menu-open {
  position: fixed !important;
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
  inset: 0 !important;
  touch-action: none !important;
  overscroll-behavior: none !important;
}
