/* ============================================ */
/* FIXED NAVIGATION BAR                         */
/* Usa design tokens para consistencia          */
/* ============================================ */

/* Base Navbar Styles */
#fixed-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: var(--z-index-navbar-fixed);

  /* Liquid Glass Effect - transparent background, layers handle the effect */
  background: transparent;

  /* Glass shine - inner glow and subtle border */
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.7),
    inset 0 -1px 1px rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-top: none;

  /* Visible by default on all pages */
  transform: translateY(0);
  opacity: 1;

  /* Smooth transition for show/hide - slower and smoother */
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================ */
/* LIQUID GLASS EFFECT LAYERS                   */
/* ============================================ */

/* Glass effect layer - blur with subtle distortion */
#fixed-navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  filter: url(#liquid-glass-filter);
  border-radius: inherit;
}

/* Glass tint layer - color overlay */
#fixed-navbar::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.4);
  border-radius: inherit;
}

/* ============================================ */
/* DARK MODE LIQUID GLASS                       */
/* ============================================ */

[data-theme="dark"] #fixed-navbar,
.dark-mode #fixed-navbar {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 1px rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
}

[data-theme="dark"] #fixed-navbar::after,
.dark-mode #fixed-navbar::after {
  background: rgba(15, 20, 30, 0.5);
}

/* Hidden state - only on home/landing page initially (applied by body class) */
body.home #fixed-navbar:not(.navbar-visible) {
  transform: translateY(-100%);
  opacity: 0;
}

/* Visible state (applied by JavaScript) */
#fixed-navbar.navbar-visible {
  transform: translateY(0);
  opacity: 1;
}

/* Navbar Container - Max width and centering */
.navbar-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo Styles */
.navbar-logo {
  flex-shrink: 0;
}

.navbar-logo-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.navbar-logo img {
  height: var(--space-10);
  width: var(--space-10);
  display: block;
  border-radius: 0;
  object-fit: contain;
  padding: 4px;
}

.navbar-logo-text {
  font-family: var(--font-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: #2c4d69;
  letter-spacing: var(--letter-spacing-tight);
}

/* Desktop Navigation Links */
.navbar-links-desktop {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.navbar-link {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-dark);
  text-decoration: none;
  transition: color var(--transition-fast) ease;
  position: relative;
}

.navbar-link:hover {
  color: var(--color-primary);
}

/* Subtle underline on hover */
.navbar-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: var(--border-width-medium);
  background-color: var(--color-primary);
  transition: width var(--transition-base) ease;
}

.navbar-link:hover::after {
  width: 100%;
}

/* Desktop CTA Button in Navbar */
.desktop-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background-color: var(--color-accent-green) !important;
  border: var(--border-width-medium) solid var(--color-overlay-dark);
  border-radius: var(--border-radius-pill);
  box-shadow: var(--shadow-glow-green);
  text-decoration: none;
  transition: all var(--transition-base) ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.desktop-cta-button:hover {
  background-color: rgb(0, 230, 160);
  box-shadow: 0px 0px 40px 0px var(--color-accent-green-glow-strong),
              0px 0px 0px 6px rgba(var(--color-accent-green-rgb), 0.15);
  transform: translateY(-1px);
}

.desktop-cta-button:active {
  transform: translateY(0px);
  box-shadow: var(--shadow-glow-green);
}

.desktop-cta-text {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-black);
  line-height: 1;
}

.desktop-cta-icon {
  width: var(--font-size-base);
  height: var(--font-size-base);
  color: var(--color-black);
  flex-shrink: 0;
}

/* Add shine effect to desktop CTA button */
.desktop-cta-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
  animation: shine 9s infinite;
  pointer-events: none;
  z-index: 1;
}

.desktop-cta-text,
.desktop-cta-icon {
  position: relative;
  z-index: 2;
}

/* Hide mobile menu on desktop */
.mobile-menu-toggle {
  display: none;
}

/* ============================================ */
/* MOBILE HAMBURGER MENU                        */
/* ============================================ */

/* Mobile breakpoint: < 1150px */
@media (max-width: 1149.98px) {
  /* Hide desktop links on mobile */
  .navbar-links-desktop {
    display: none;
  }

  /* Show hamburger button */
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
  }

  .mobile-menu-toggle .hamburger-line {
    width: 100%;
    height: 2px;
    background-color: #1a1a1a;
    transition: all var(--transition-base) ease;
    transform-origin: center;
  }

  /* Hamburger animation to X when open */
  .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ============================================ */
/* MOBILE FULL-SCREEN MENU OVERLAY              */
/* ============================================ */

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;

  /* Liquid Glass Effect - transparent, layers handle effect */
  background: transparent;

  /* Initially hidden */
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base) ease, visibility var(--transition-base) ease;
}

/* Mobile menu liquid glass layers */
.mobile-menu-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  filter: url(#liquid-glass-filter);
}

.mobile-menu-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.5);
}

/* Dark mode mobile menu */
[data-theme="dark"] .mobile-menu-overlay::after,
.dark-mode .mobile-menu-overlay::after {
  background: rgba(15, 20, 30, 0.6);
}

/* Visible state (applied by JavaScript) */
.mobile-menu-overlay.menu-open {
  opacity: 1;
  visibility: visible;
}

/* Mobile Menu Container */
.mobile-menu-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 80px 24px;
  position: relative;
}

/* Close Button */
.mobile-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  cursor: pointer;
  padding: 8px;
  color: #1a1a1a !important;
  transition: opacity var(--transition-fast) ease;
}

.mobile-close-btn svg {
  stroke-width: 3;
  stroke: currentColor !important;
}

.mobile-close-btn:hover {
  opacity: 0.8;
  background: transparent !important;
  background-color: transparent !important;
}

/* Mobile Navigation Links */
.mobile-menu-links {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

/* Mobile menu links - solo aplica estilos dentro del overlay móvil */
.mobile-menu-overlay .mobile-menu-link {
  font-family: var(--font-primary);
  font-size: 24px;
  font-weight: 600;
  color: var(--color-primary-dark);
  text-decoration: none;
  transition: color var(--transition-fast) ease, transform var(--transition-fast) ease;
}

.mobile-menu-overlay .mobile-menu-link:hover {
  color: var(--color-primary);
  transform: scale(1.05);
}

/* En desktop, los enlaces con ambas clases usan estilos de navbar-link */
@media (min-width: 1150px) {
  .navbar-link.mobile-menu-link {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
  }
}

/* ============================================ */
/* ACCESSIBILITY ENHANCEMENTS                   */
/* ============================================ */

/* Focus styles for keyboard navigation */
.navbar-link:focus-visible,
.mobile-menu-link:focus-visible,
.mobile-menu-toggle:focus-visible,
.mobile-close-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Reduce motion for users with preference */
@media (prefers-reduced-motion: reduce) {
  #fixed-navbar,
  .navbar-link::after,
  .hamburger-line,
  .mobile-menu-overlay,
  .mobile-menu-link {
    transition: none;
  }
}

/* ============================================ */
/* BODY SCROLL LOCK (when mobile menu open)     */
/* ============================================ */

body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Hide navbar when mobile menu is open */
body.menu-open #fixed-navbar {
  opacity: 0;
  pointer-events: none;
}

/* ============================================ */
/* MOBILE MENU - Language & Theme controls      */
/* ============================================ */

/* Compact layout for language selector and theme toggle */
.mobile-menu-overlay .lang-seg-control {
  margin: 16px auto 6px !important;
}

.mobile-menu-overlay .theme-seg-control {
  margin: 6px auto 0 !important;
}

/* ============================================ */
/* MOBILE MENU CTA BUTTON                       */
/* ============================================ */

.mobile-menu-cta {
  margin-top: 24px;
  padding: 0 32px;
  width: 100%;
  box-sizing: border-box;
}

.mobile-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 32px;
  background-color: var(--color-accent-green);
  border: 2px solid var(--color-overlay-dark);
  border-radius: var(--border-radius-pill);
  box-shadow: var(--shadow-glow-green);
  text-decoration: none;
  transition: all var(--transition-base) ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.mobile-cta-button:hover {
  background-color: rgb(0, 230, 160);
  box-shadow: 0px 0px 40px 0px rgba(42, 240, 124, 0.5),
              0px 0px 0px 6px rgba(var(--color-accent-green-rgb), 0.15);
  transform: translateY(-2px);
}

.mobile-cta-button:active {
  transform: translateY(0px);
  box-shadow: 0px 0px 20px 0px rgba(42, 240, 124, var(--opacity-strong)),
              0px 0px 0px 3px rgba(var(--color-accent-green-rgb), var(--opacity-medium));
}

.mobile-cta-text {
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-black);
  line-height: 1;
}

.mobile-cta-icon {
  width: 18px;
  height: 18px;
  color: var(--color-black);
  flex-shrink: 0;
}

/* Add shine effect to mobile CTA button (same as hero button) */
.mobile-cta-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
  animation: shine 9s infinite;
  pointer-events: none;
  z-index: 1;
}

.mobile-cta-text,
.mobile-cta-icon {
  position: relative;
  z-index: 2;
}

/* ============================================ */
/* THEME TOGGLE (Apple Segmented Control)      */
/* Styles are in language-selector.css         */
/* ============================================ */

/* ============================================ */
/* SCROLL ANCHOR OFFSET                        */
/* ============================================ */

/* Offset for anchor links to account for fixed navbar */
body.home section[id] {
  scroll-margin-top: 100px;
}

html {
  scroll-behavior: smooth;
}
