/* ===== NAVBAR CSS (mobile-friendly, right-aligned menu) ===== */

/* Container helper */
.container {
    width: min(1200px, 92%);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
}

.header-container {
  width: 100%;
  height: var(--header-height);

  position: fixed;
  top: 0;
  left: 0;

  z-index: 1000;

  background: var(--navbar-color);

  border-bottom: 1px solid var(--border-color);

  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

/* Inner header: keep relative so absolute children can anchor to it */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-height);
  position: relative;
  padding: 0 12px;
}

/* Brand */
.brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}

.brand a {
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-decoration: none;
}

/* Navbar base */
.navbar {
  margin-left: auto;
  display: flex;
  align-items: center;
}  

/* Nav links row (desktop) */
.nav-links {
  display: flex;
  gap: 18px;
  list-style: none;
  align-items: center;
  margin: 0;
  padding: 0;
}

/* Link appearance */
.nav-selection {
  display: inline-block;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  position: relative;
  color: var(--text-color);
  transition: var(--transition);
  border-radius: 8px;
}

.nav-selection:hover{

    color:var(--primary-color);
}

.nav-selection:hover::after{

    transform:scaleX(1);
}

.nav-selection::after{

    content:"";

    position:absolute;

    left:14px;
    right:14px;
    bottom:4px;

    height:2px;

    background:var(--primary-color);

    transform:scaleX(0);

    transform-origin:center;

    transition:.3s;
}

/* Mobile toggle button - absolute so it never moves */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 5px;
  cursor: pointer;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  transition: .3s ease;
  z-index: 1200;
}

.nav-toggle,
.nav-toggle:visited,
.nav-toggle:focus,
.nav-toggle:active {
    color: #ffffff;
    outline: none;
}

.nav-toggle:hover {
  cursor: pointer;
}

.nav-toggle:focus {
  outline: 3px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}

/* Hamburger lines */
.hamburger {
  display: inline-block;
  width: 28px;
  height: 2px;
  background-color: currentColor;
  position: relative;
  transition: transform 220ms ease;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 28px;
  height: 2px;
  background-color: currentColor;
  transition: transform 220ms ease, top 220ms ease, opacity 220ms ease;
}

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  top: 8px;
}

/* When nav is open, animate hamburger to X */
.header-container.open .hamburger {
  background-color: transparent;
}

.header-container.open .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}

.header-container.open .hamburger::after {
  transform: rotate(-45deg);
  top: 0;
}

/* ===== Responsive behavior ===== */
@media (max-width: 880px) {

  /* Show toggle */
  .nav-toggle {
    display: inline-flex;
  }

  /* Ensure brand doesn't overlap toggle */
  .brand {
    padding-right: 48px;
  }

  
  /* Mobile menu: fixed, right-aligned, anchored below header */
  .nav-links {
    position: fixed;
    right: 12px;
    top: calc(var(--header-height, 75px) + 8px);
    left: auto;
    background: var(--navbar-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
    padding: 12px;
    flex-direction: column;
    gap: 8px;
    transform-origin: top right;
    transform: translateY(0) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
    width: fit-content;
    min-width: 170px;
    max-width: calc(100% - 40px);
    z-index: 1100;
    /* below the toggle */
  }

  /* When open */
  .header-container.open .nav-links {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
  }

  /* Make nav items stack and be full width of the menu */
  .nav-selection {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Small screens: slightly narrower */
  @media (max-width: 420px) {
    .nav-links {
      right: 8px;
      min-width: 160px;
    }

    .nav-selection {
      padding: 10px;
      text-align: center;
    }
  }

/* Ensure clicks/touches outside can be detected visually (no pointer blocking) */
.nav-links,
.nav-toggle {
  touch-action: manipulation;
}