:root {
  --nav-h: 64px;
  --nav-teal: #0D565E;
  --nav-teal-dark: #084345;
  --nav-gray-600: #4B5563;
  --nav-gray-200: #E5E7EB;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  width: 100%;
  height: var(--nav-h);
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-gray-200, #E5E7EB);
}

.nav {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0 clamp(16px, 4vw, 48px);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
}

.nav-start {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  gap: 8px;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.nav-hamburger:hover,
.nav-hamburger:focus-visible {
  background: rgba(13, 86, 94, 0.08);
  outline: none;
}

.nav-hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--nav-teal, #0D565E);
  border-radius: 1px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.site-nav.is-mobile-open .nav-hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-nav.is-mobile-open .nav-hamburger-line:nth-child(2) {
  opacity: 0;
}

.site-nav.is-mobile-open .nav-hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

body.nav-mobile-open {
  overflow: hidden;
}

.nav-logo {
  height: 26px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.nav-center > a {
  font-size: 14px;
  font-weight: 500;
  color: var(--nav-gray-600, #4B5563);
  transition: all 0.2s ease;
  padding: 8px 10px;
  border-radius: 8px;
}

.nav-center > a:hover {
  color: var(--nav-teal, #0D565E);
  background: rgba(13, 86, 94, 0.12);
}

.nav-actions {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.nav-cta {
  background: var(--nav-teal, #0D565E);
  color: #fff !important;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.nav-cta:hover {
  background: var(--nav-teal-dark, #084345);
  color: #fff !important;
}

.nav-login {
  border: 1px solid rgba(13, 86, 94, 0.35);
  color: var(--nav-teal, #0D565E) !important;
  background: transparent;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.nav-login:hover {
  background: rgba(13, 86, 94, 0.08);
  border-color: rgba(13, 86, 94, 0.55);
  color: #0A4A51 !important;
}

.nav-mobile-backdrop {
  display: none;
}

/* Desktop: center links in the header bar */
@media (min-width: 901px) {
  .nav-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    white-space: nowrap;
    pointer-events: auto;
  }

  .nav-dropdown-panel {
    z-index: 4;
  }
}

@media (max-width: 900px) {
  :root { --nav-h: 56px; }

  .site-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #fff;
  }

  .nav {
    position: relative;
    z-index: 1103;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    padding: 0 16px;
  }

  .nav-hamburger {
    display: flex;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: 0;
  }

  .nav-start {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    flex: none;
  }

  .nav-start > a {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
  }

  .nav-logo {
    height: auto;
    max-height: 28px;
    max-width: min(112px, 30vw);
    width: auto;
    object-fit: contain;
    object-position: left center;
    flex-shrink: 1;
  }

  .nav-mobile-backdrop {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--nav-h);
    background: rgba(13, 38, 41, 0.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1101;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }

  .nav-center {
    position: fixed;
    top: calc(var(--nav-h) + 10px);
    left: 12px;
    bottom: auto;
    width: min(288px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - var(--nav-h) - 20px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    padding: 18px 10px 12px;
    background: linear-gradient(168deg, #ffffff 0%, #f6fbfb 52%, #eef8f7 100%);
    border: 1px solid rgba(13, 86, 94, 0.1);
    border-radius: 18px;
    box-shadow:
      0 24px 48px rgba(13, 86, 94, 0.16),
      0 8px 16px rgba(13, 86, 94, 0.06),
      inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateX(calc(-100% - 28px));
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.32s ease;
    z-index: 1102;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    pointer-events: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav-center::before {
    content: 'Menú';
    display: block;
    padding: 0 12px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(13, 86, 94, 0.42);
  }

  .nav-center::after {
    content: '';
    position: absolute;
    top: 0;
    left: 14px;
    right: 14px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, #0D565E 0%, #01C8BD 55%, #B0F300 100%);
    pointer-events: none;
  }

  .site-nav.is-mobile-open .nav-center,
  body.nav-mobile-open .nav-center,
  .nav-center.is-drawer-open {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .nav-center > a {
    display: block;
    padding: 13px 14px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--nav-gray-600, #4B5563);
    border-radius: 12px;
    transition: background 0.16s ease, color 0.16s ease;
  }

  .nav-center > a:hover,
  .nav-center > a:focus-visible {
    background: rgba(13, 86, 94, 0.07);
    color: var(--nav-teal, #0D565E);
    outline: none;
  }

  .nav-center > a:active {
    background: rgba(13, 86, 94, 0.11);
  }

  .site-nav.is-mobile-open .nav-mobile-backdrop,
  body.nav-mobile-open .nav-mobile-backdrop {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: none;
    flex-shrink: 0;
    min-width: 0;
  }

  .nav-cta,
  .nav-login {
    padding: 8px 11px;
    font-size: 12px;
    line-height: 1.2;
  }
}

@media (max-width: 640px) {
  .nav {
    column-gap: 10px;
    padding: 0 14px;
  }

  .nav-start {
    gap: 8px;
  }

  .nav-logo {
    max-height: 26px;
    max-width: min(96px, 28vw);
  }

  .nav-actions {
    gap: 6px;
  }

  .nav-cta,
  .nav-login {
    padding: 7px 10px;
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .nav {
    column-gap: 10px;
    padding: 0 14px;
  }

  .nav-hamburger {
    width: 32px;
    height: 32px;
  }

  .nav-hamburger-line {
    width: 18px;
  }

  .nav-start {
    gap: 8px;
  }

  .nav-logo {
    max-height: 24px;
    max-width: min(88px, 26vw);
  }

  .nav-actions {
    gap: 7px;
  }

  .nav-cta,
  .nav-login {
    padding: 7px 9px;
    font-size: 10px;
  }
}
