/* ==========================================================================
   COMPONENT: Navigation
   Thin info bar (hours, socials, phone), then a sticky navy bar with the logo,
   menu and a yellow estimate button. Pressure Washing opens a wide panel.
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-background-color);
  box-shadow: 0 10px 30px -18px rgb(0 0 0 / 0.6);

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* ----- Info bar ----- */
  .nav-top {
    background: #04101f;
    color: var(--text-on-dark-muted);
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-on-dark);

    .container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      min-height: 40px;
    }

    ul {
      display: flex;
      align-items: center;
      gap: 22px;
    }

    li {
      display: flex;
      align-items: center;
      gap: 7px;
      white-space: nowrap;
    }

    i {
      color: var(--primary-on-dark);
    }

    a {
      text-decoration: none;
      transition: color 0.2s ease;

      &:hover {
        color: white;
      }
    }
  }

  .nav-top-call {
    font-family: var(--font-heading);
    font-weight: 800;
    font-style: italic;
    font-stretch: 112%;
    letter-spacing: 0.02em;
    color: var(--accent-color);

    i {
      color: var(--accent-color) !important;
    }
  }

  /* ----- Main bar ----- */
  .nav-main {
    position: relative;
    background: var(--contours), var(--nav-background-color);

    &::after {
      content: "";
      position: absolute;
      inset: auto 0 0;
      height: 3px;
      background: linear-gradient(90deg, var(--primary-color), var(--primary-on-dark) 60%, var(--accent-color));
    }

    .container {
      display: flex;
      align-items: center;
      gap: 28px;
      min-height: 92px;
    }
  }

  .nav-logo {
    flex: 0 0 auto;
    margin-block: 6px;
  }

  .nav-logo img {
    width: 210px;
    height: auto;
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;

    > li {
      position: relative;
    }

    > li > a,
    > li > button {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 10px 14px;
      font-family: var(--font-heading);
      font-size: 0.95rem;
      font-weight: 700;
      font-stretch: 110%;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      color: var(--text-on-dark);
      text-decoration: none;
      white-space: nowrap;
      background: none;
      border: 0;
      cursor: pointer;
      transition: color 0.2s ease;

      i {
        font-size: 0.7rem;
      }
    }

    > li > a::after,
    > li > button::after {
      content: "";
      position: absolute;
      left: 14px;
      right: 14px;
      bottom: 2px;
      height: 3px;
      background: var(--accent-color);
      transform: scaleX(0) skewX(-30deg);
      transform-origin: left;
      transition: transform 0.2s ease;
    }

    > li:hover > a,
    > li:hover > button,
    > li:focus-within > a,
    > li:focus-within > button {
      color: white;

      &::after {
        transform: scaleX(1) skewX(-30deg);
      }
    }
  }

  /* Simple dropdown (About) */
  .nav-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    padding: 10px;
    background: white;
    border-top: 4px solid var(--primary-color);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;

    a {
      display: block;
      padding: 9px 12px;
      font-weight: 600;
      color: var(--secondary-color);
      text-decoration: none;
      border-radius: 4px;

      &:hover {
        color: var(--primary-strong);
        background: var(--primary-soft);
      }
    }
  }

  .nav-item-drop:hover .nav-dropdown,
  .nav-item-drop:focus-within .nav-dropdown,
  .nav-item-mega:hover .nav-mega,
  .nav-item-mega:focus-within .nav-mega {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Wide Pressure Washing panel */
  .nav-item-mega {
    position: static !important;
  }

  .nav-mega {
    position: absolute;
    top: 100%;
    left: 50%;
    width: min(940px, calc(100vw - 48px));
    margin-left: calc(min(940px, calc(100vw - 48px)) / -2);
    display: grid;
    grid-template-columns: repeat(2, 1fr) 290px;
    grid-auto-flow: column;
    grid-template-rows: repeat(4, auto);
    gap: 4px 16px;
    padding: 24px;
    background: white;
    border-top: 4px solid var(--primary-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }

  .nav-mega-item a,
  .nav-mega-all a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: 4px;

    i {
      display: grid;
      place-items: center;
      flex: 0 0 34px;
      height: 34px;
      font-size: 1rem;
      color: white;
      background: var(--primary-color);
      clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    }

    &:hover {
      color: var(--primary-strong);
      background: var(--surface-alt);
    }
  }

  .nav-mega-feature {
    grid-column: 3;
    grid-row: 1 / span 4;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    color: white;
    background: var(--contours), linear-gradient(160deg, var(--primary-strong), var(--secondary-color));
    border-radius: var(--radius);

    p {
      margin-bottom: 14px;
      color: var(--text-on-dark-muted);
    }

    .nav-mega-feature-title {
      margin-bottom: 8px;
      font: italic 900 1.3rem / 1.1 var(--font-heading);
      font-stretch: 120%;
      text-transform: uppercase;
      color: white;
    }

    .btn {
      align-self: flex-start;
    }
  }

  /* ----- Actions ----- */
  .nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .nav-toggle,
  .nav-mobile-call {
    display: none;
  }

  .nav-toggle {
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
    color: var(--secondary-color);
    background: var(--accent-color);
    border: 0;
    border-radius: 4px;
    cursor: pointer;
  }
}

/* ----- Off-canvas panel (mobile) ----- */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgb(4 12 26 / 0.7);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;

  &.is-open {
    opacity: 1;
    visibility: visible;
  }
}

.nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 210;
  width: min(370px, 90vw);
  padding: 20px 24px 32px;
  overflow-y: auto;
  background: var(--contours), var(--secondary-color);
  color: var(--text-on-dark);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s;

  &.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;

    img {
      width: 170px;
    }
  }

  .nav-close {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    color: white;
    background: rgb(255 255 255 / 0.08);
    border: 0;
    border-radius: 4px;
    cursor: pointer;
  }

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  > ul > li {
    border-bottom: 1px solid var(--border-on-dark);
  }

  ul a,
  .nav-panel-sub-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 13px 0;
    font: italic 800 1.02rem var(--font-heading);
    font-stretch: 110%;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-on-dark);
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
  }

  .nav-panel-sub {
    display: none;
    padding: 0 0 10px 14px;
    border-left: 3px solid var(--accent-color);

    a {
      padding: 7px 0;
      font: 500 0.98rem var(--font-body);
      text-transform: none;
      color: var(--text-on-dark-muted);
    }
  }

  li.is-expanded > .nav-panel-sub {
    display: block;
  }

  .nav-panel-sub-toggle i {
    transition: transform 0.2s ease;
  }

  li.is-expanded > .nav-panel-sub-toggle i,
  li.is-expanded > .nav-panel-row .nav-panel-sub-toggle i {
    transform: rotate(180deg);
  }

  .nav-panel-row {
    display: flex;
    align-items: center;

    a {
      flex: 1;
    }

    .nav-panel-sub-toggle {
      justify-content: center;
      width: 44px;
      flex: 0 0 44px;
    }
  }

  .btn-row {
    margin-top: 24px;
    flex-direction: column;
  }
}

body.nav-locked {
  overflow: hidden;
}

@media (max-width: 1480px) {
  .site-nav .nav-main .container {
    gap: 14px;
  }

  .site-nav .nav-logo img {
    width: 180px;
  }

  .site-nav .nav-links > li > a,
  .site-nav .nav-links > li > button {
    padding-inline: 10px;
    font-size: 0.88rem;
  }
}

@media (max-width: 1100px) {
  .site-nav {
    .nav-links,
    .nav-actions {
      display: none;
    }

    .nav-main .container {
      min-height: 76px;
      gap: 12px;
    }

    .nav-logo img {
      width: 160px;
    }

    .nav-toggle {
      display: grid;
      place-items: center;
    }

    .nav-mobile-call {
      display: grid;
      place-items: center;
      margin-left: auto;
      width: 48px;
      height: 48px;
      font-size: 1.2rem;
      color: white;
      background: var(--primary-color);
      border-radius: 4px;
    }
  }
}

@media (max-width: 720px) {
  .site-nav .nav-top-hide {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .site-nav .nav-top {
    font-size: 0.8rem;

    ul {
      gap: 12px;
    }
  }

  .site-nav .nav-logo img {
    width: 140px;
  }
}
