/* ============================================
   NAV SHELL — Dock responsivo + rail de categorías
   ============================================ */

:root {
  --nav-dock-height: 46px;
  --nav-top-height: 48px;
  --nav-shell-height: calc(var(--nav-top-height) + var(--nav-dock-height) + 10px);
  --category-shell-height: 50px;
  --mobile-main-nav-height: var(--nav-shell-height);
  --mobile-nav-stack-height: calc(var(--nav-shell-height) + var(--category-shell-height));
  --nav-chrome: rgba(6, 8, 10, 0.88);
  --nav-glow: rgba(251, 191, 36, 0.55);
  --nav-cyan: rgba(103, 232, 249, 0.45);
}

/* —— Navbar shell —— */
.navbar.nav-shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  padding: 0.4rem 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-wrap: nowrap;
  min-height: var(--nav-shell-height);
  background:
    linear-gradient(180deg, rgba(8, 10, 12, 0.97) 0%, rgba(12, 8, 14, 0.92) 100%);
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(
    90deg,
    transparent,
    var(--nav-glow),
    var(--nav-cyan),
    var(--nav-glow),
    transparent
  ) 1;
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: navShellBorder 8s linear infinite;
}

@keyframes navShellBorder {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(18deg); }
}

.nav-shell-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--nav-top-height);
}

.nav-shell .brand-lockup {
  margin-right: 0;
  min-width: 0;
  max-width: 100%;
}

.nav-shell .brand-title {
  font-size: clamp(0.72rem, 3.2vw, 0.95rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-shell-cart,
.nav-shell .nav-cart-btn {
  position: relative;
  flex-shrink: 0;
  height: 40px;
  min-height: 40px;
  padding: 0 0.75rem;
  border-radius: 12px;
  z-index: 2;
  box-shadow:
    0 4px 18px rgba(251, 191, 36, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}


/* Desktop-only: reforzar marca + animación + reducir carrito */
@media (min-width: 769px) {
  /* Logo más protagonista */
  .nav-shell .brand-lockup--mobile-logo-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.15rem 0.35rem;
  }

.nav-shell .brand-lockup--mobile-logo-title .brand-logo {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 18px;

    animation: seedsLogoFloat 2.6s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.55))
            drop-shadow(0 0 18px rgba(103, 232, 249, 0.18));
  }

  .nav-shell .brand-lockup--mobile-logo-title .brand-title {
    font-size: 0.98rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fbbf24;
    text-shadow: 0 0 18px rgba(251, 191, 36, 0.28);
  }

  /* Carrito más compacto */
  .nav-shell .nav-cart-btn,
  .nav-shell-cart {
    height: 38px;
    min-height: 38px;
    padding: 0 0.6rem;
    border-radius: 999px;
    gap: 0.35rem;
    max-width: 116px;
  }

  .nav-shell .nav-cart-btn .cart-icon-wrap {
    font-size: 1rem;
  }

  .nav-shell .nav-cart-btn .cart-total {
    font-size: 0.9rem;
    white-space: nowrap;
  }

  /* Respetar accesibilidad */
  @media (prefers-reduced-motion: reduce) {
    .nav-shell .brand-lockup--mobile-logo-title .brand-logo {
      animation: none !important;
    }
  }

  @keyframes seedsLogoFloat {
    0%, 100% { transform: translateY(0) rotate(-1deg) scale(1); }
    50% { transform: translateY(-4px) rotate(1.5deg) scale(1.04); }
  }
}


.nav-shell-cart:hover,
.nav-shell .nav-cart-btn:hover {
  transform: scale(1.04);
}

.nav-shell-cart.has-items {
  animation: cartPulse 2s ease-in-out infinite;
}

@keyframes cartPulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(251, 191, 36, 0.35); }
  50% { box-shadow: 0 4px 28px rgba(251, 191, 36, 0.65), 0 0 20px rgba(103, 232, 249, 0.25); }
}

/* Dock: 4 columnas iguales — nada queda detrás del carrito */
.nav-shell-dock {
  position: relative;
  width: 100%;
  min-height: var(--nav-dock-height);
}

.nav-dock-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.nav-shell .nav-dock-item,
.nav-shell .nav-icon-btn.nav-dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  width: 100%;
  min-width: 0;
  height: var(--nav-dock-height);
  padding: 0.35rem 0.2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.22);
  color: rgba(254, 243, 199, 0.82);
  overflow: hidden;
  transition:
    transform 0.28s cubic-bezier(0.23, 1, 0.32, 1),
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.nav-shell .nav-dock-item .nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-shell .nav-dock-item span {
  font-size: 0.58rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.1rem;
}

.nav-shell .nav-dock-item:hover {
  transform: translateY(-2px);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fef3c7;
}

.nav-shell .nav-dock-item.active {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.95), rgba(217, 119, 6, 0.9));
  border-color: rgba(254, 243, 199, 0.6);
  color: #0a0a0a;
  box-shadow:
    0 6px 22px rgba(251, 191, 36, 0.45),
    0 0 24px rgba(103, 232, 249, 0.2);
  animation: dockActiveGlow 2.4s ease-in-out infinite;
}

@keyframes dockActiveGlow {
  0%, 100% { box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 8px 28px rgba(251, 191, 36, 0.65), 0 0 30px rgba(52, 211, 153, 0.25); }
}

.nav-dock-aurora {
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(103, 232, 249, 0.15) 40%,
    rgba(251, 191, 36, 0.2) 50%,
    rgba(232, 121, 249, 0.12) 60%,
    transparent 80%
  );
  background-size: 200% 100%;
  animation: dockAuroraSweep 6s ease-in-out infinite;
}

@keyframes dockAuroraSweep {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.nav-dock-grid {
  position: relative;
  z-index: 1;
}

/* Ocultar layout viejo cuando usa shell */
.nav-shell .nav-actions {
  display: contents;
}

/* —— Escritorio: una sola fila —— */
.navbar.nav-shell.nav-shell--pages .nav-shell-top {
  grid-template-columns: 1fr;
  justify-items: center;
}

.navbar.nav-shell.nav-shell--pages .brand-lockup {
  justify-content: center;
}

@media (min-width: 769px) {
  :root {
    --nav-dock-height: 44px;
    --nav-top-height: 52px;
    --nav-shell-height: 78px;
    --category-shell-height: 54px;
  }

  .navbar.nav-shell {
    flex-direction: row;
    align-items: center;
    padding: 0.65rem 1.25rem;
    gap: 1rem;
  }

  .nav-shell-top {
    display: contents;
  }

  /* Forzar logo al centro en desktop */
  .nav-shell-top {
    grid-template-columns: 1fr auto 1fr;
  }

  .nav-shell .brand-lockup {
    order: 2;
    justify-self: center;
    margin: 0;
  }

  .nav-shell-dock {
    order: 1;
    justify-self: center;
    flex: 0 0 auto;
    max-width: none;
  }

  .nav-shell-cart,
  .nav-shell .nav-cart-btn {
    order: 3;
    justify-self: end;
    margin-left: 0;
  }


  .nav-shell-dock {
    order: 2;
    flex: 1;
    min-width: 0;
    max-width: 520px;
    margin: 0 auto;
  }

  .nav-dock-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .nav-shell .nav-dock-item {
    flex-direction: row;
    gap: 0.4rem;
    height: 44px;
    padding: 0.5rem 0.65rem;
  }

  .nav-shell .nav-dock-item span {
    font-size: 0.72rem;
  }

  .nav-shell-cart,
  .nav-shell .nav-cart-btn {
    order: 3;
    height: 44px;
    min-height: 44px;
  }

  .nav-shell .cart-total {
    display: inline;
  }
}

@media (min-width: 1024px) {
  .nav-shell .nav-dock-item span {
    font-size: 0.78rem;
  }
}

/* —— Category rail —— */
.category-rail {
  position: sticky;
  top: var(--nav-shell-height);
  z-index: 90;
  min-height: var(--category-shell-height);
  max-height: var(--category-shell-height);
  padding: 0;
  background:
    linear-gradient(180deg, rgba(10, 8, 14, 0.94), rgba(4, 6, 8, 0.9));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(251, 191, 36, 0.28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.category-rail-inner {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 22px;
  align-items: stretch;
  min-height: var(--category-shell-height);
}

.category-rail-track.category-index {
  position: relative;
  top: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  min-height: var(--category-shell-height);
  max-height: var(--category-shell-height);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: transparent;
  border: none;
  box-shadow: none;
  animation: none;
}

.category-rail-track::-webkit-scrollbar {
  display: none;
}

.category-rail-fade {
  width: 28px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  flex-shrink: 0;
}

.category-rail-fade--left {
  background: linear-gradient(90deg, rgba(10, 8, 14, 0.98), transparent);
}

.category-rail-fade--right {
  background: linear-gradient(270deg, rgba(10, 8, 14, 0.98), transparent);
}

.category-rail-indicator {
  position: absolute;
  bottom: 4px;
  left: 0;
  height: 3px;
  width: 48px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--holo-gold, #fbbf24), #86efac, #67e8f9);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.7);
  transform: translateX(0);
  transition:
    transform 0.38s cubic-bezier(0.23, 1, 0.32, 1),
    width 0.38s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
  z-index: 3;
}

.category-rail .category-btn {
  flex: 0 0 auto;
  scroll-snap-align: center;
  min-height: 34px;
  padding: 0.4rem 0.9rem;
  font-size: 0.74rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.28);
  color: rgba(254, 243, 199, 0.85);
  position: relative;
  z-index: 1;
}

.category-rail .category-btn.active {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.85));
  color: #0a0a0a;
  border-color: rgba(254, 243, 199, 0.5);
  transform: none;
}

.category-rail-hint {
  display: none;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.2);
  color: var(--holo-gold, #fbbf24);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
  animation: hintNudge 2s ease-in-out infinite;
}

.category-rail.is-overflow .category-rail-hint {
  display: block;
}

@keyframes hintNudge {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.7; }
  50% { transform: translateY(-50%) translateX(3px); opacity: 1; }
}

.page-content {
  padding-top: var(--nav-shell-height);
}

@media (max-width: 768px) {
  .page-content.has-category-rail {
    /* categorías pegadas bajo nav, no duplican espacio extra */
  }
}

/* Anular reglas conflictivas del layout anterior */
@media (max-width: 768px) {
  .navbar.nav-shell {
    height: auto;
    min-height: var(--nav-shell-height);
    display: flex !important;
    grid-template-columns: unset;
    grid-template-rows: unset;
  }

  .navbar.nav-shell .brand-title {
    text-align: left;
  }

  .nav-shell .nav-main-links {
    overflow: visible;
    padding-right: 0;
    width: 100%;
  }
}

@media (max-width: 390px) {
  .navbar.nav-shell .nav-dock-item span {
    display: block;
    font-size: 0.5rem;
  }

  .navbar.nav-shell .nav-dock-item[data-nav-key="experiencia"] span {
    font-size: 0.46rem;
  }

  .navbar:not(.nav-shell) .nav-icon-btn span {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-top-height: 54px;
    --nav-dock-height: 42px;
    --mobile-main-nav-height: 122px;
    --nav-shell-height: var(--mobile-main-nav-height);
    --category-shell-height: 52px;
    --mobile-nav-stack-height: calc(var(--mobile-main-nav-height) + var(--category-shell-height));
  }

  .navbar.nav-shell {
    --nav-top-height: 54px;
    --nav-dock-height: 42px;
    height: var(--mobile-main-nav-height);
    min-height: var(--mobile-main-nav-height);
    max-height: var(--mobile-main-nav-height);
    box-sizing: border-box;
    padding: 0.45rem 0.65rem 0.6rem;
    display: flex !important;
    gap: 0.45rem;
    grid-template-columns: unset;
    grid-template-rows: unset;
    overflow: visible;
    background:
      linear-gradient(180deg, rgba(5, 7, 9, 0.98) 0%, rgba(8, 10, 12, 0.95) 58%, rgba(11, 8, 7, 0.93) 100%);
    border-bottom: 1px solid rgba(251, 191, 36, 0.18);
    border-image: none;
    box-shadow:
      0 10px 26px rgba(0, 0, 0, 0.48),
      inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    animation: none;
  }

  .navbar.nav-shell .nav-shell-top {
    height: var(--nav-top-height);
    min-height: var(--nav-top-height);
  }

  .navbar.nav-shell .brand-lockup--mobile-logo-title {
    min-height: var(--nav-top-height);
    width: 96px;
    max-width: 96px;
  }

  .navbar.nav-shell .brand-lockup--mobile-logo-title .brand-logo {
    width: 88px;
    height: 48px;
    filter:
      drop-shadow(0 0 10px rgba(251, 191, 36, 0.42))
      drop-shadow(0 0 18px rgba(52, 211, 153, 0.12));
    animation: none;
  }

  .navbar.nav-shell .nav-shell-cart,
  .navbar.nav-shell .nav-cart-btn {
    height: 38px;
    min-height: 38px;
    padding: 0 0.72rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.32);
    color: #fef3c7;
    box-shadow: none;
  }

  .navbar.nav-shell .nav-cart-btn:hover {
    transform: none;
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.18);
  }

  .navbar.nav-shell .nav-shell-dock {
    min-height: var(--nav-dock-height);
    padding: 0.18rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .navbar.nav-shell .nav-dock-aurora {
    display: none;
  }

  .navbar.nav-shell .nav-dock-grid {
    gap: 0.18rem;
    height: 100%;
  }

  .nav-shell .nav-main-links {
    overflow: visible;
    padding-right: 0;
    width: 100%;
  }

.navbar.nav-shell .nav-dock-item,
  .navbar.nav-shell .nav-icon-btn.nav-dock-item {
    height: calc(var(--nav-dock-height) - 0.36rem);
    min-height: calc(var(--nav-dock-height) - 0.36rem);
    padding: 0.28rem 0.15rem;

    border-radius: 12px;
    background: transparent;
    border-color: transparent;
    color: rgba(254, 243, 199, 0.72);
    box-shadow: none;
  }

  .navbar.nav-shell .nav-dock-item .nav-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .navbar.nav-shell .nav-dock-item span {
    font-size: 0.56rem;
    line-height: 1;
    letter-spacing: 0;
  }

  .navbar.nav-shell .nav-dock-item:hover {
    transform: none;
    background: rgba(251, 191, 36, 0.08);
    border-color: transparent;
  }

  .navbar.nav-shell .nav-dock-item.active {
    background: rgba(251, 191, 36, 0.94);
    border-color: rgba(254, 243, 199, 0.36);
    color: #0b0d0f;
    box-shadow: 0 8px 18px rgba(251, 191, 36, 0.22);
    animation: none;
  }

  .page-content.has-category-rail {
    padding-top: var(--mobile-main-nav-height);
  }

  .category-rail {
    top: var(--mobile-main-nav-height);
    z-index: 110;
    min-height: var(--category-shell-height);
    max-height: var(--category-shell-height);
    background: rgba(6, 7, 8, 0.96);
    border-top: 1px solid rgba(255, 255, 255, 0.045);
    border-bottom: 1px solid rgba(251, 191, 36, 0.20);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36);
  }

  .category-rail-inner {
    grid-template-columns: 12px minmax(0, 1fr) 12px;
    min-height: var(--category-shell-height);
  }

  .category-rail-track.category-index {
    gap: 0.42rem;
    padding: 0.46rem 0.36rem;
    min-height: var(--category-shell-height);
    max-height: var(--category-shell-height);
    scroll-padding-inline: 0.75rem;
  }

  .category-rail-fade {
    width: 18px;
  }

  .category-rail-fade--left {
    background: linear-gradient(90deg, rgba(6, 7, 8, 1), transparent);
  }

  .category-rail-fade--right {
    background: linear-gradient(270deg, rgba(6, 7, 8, 1), transparent);
  }

  .category-rail .category-btn {
    min-height: 34px;
    padding: 0.42rem 0.82rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(254, 243, 199, 0.76);
    box-shadow: none;
  }

  .category-rail .category-btn.active {
    background: #f4c14e;
    border-color: rgba(255, 255, 255, 0.40);
    color: #10100d;
    box-shadow: 0 8px 18px rgba(244, 193, 78, 0.20);
  }

  .category-rail-indicator {
    bottom: 3px;
    height: 2px;
    background: #f4c14e;
    box-shadow: 0 0 10px rgba(244, 193, 78, 0.55);
  }

  .category-rail-hint {
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(244, 193, 78, 0.16);
    color: #f4c14e;
  }
}

@media (max-width: 390px) {
  :root {
    --mobile-main-nav-height: 122px;
    --nav-shell-height: var(--mobile-main-nav-height);
    --mobile-nav-stack-height: calc(var(--mobile-main-nav-height) + var(--category-shell-height));
  }
}

@media (prefers-reduced-motion: reduce) {
  .navbar.nav-shell,
  .nav-dock-aurora,
  .nav-shell .nav-dock-item.active,
  .nav-shell-cart.has-items,
  .category-rail-hint,
  .category-rail-indicator {
    animation: none !important;
  }

  .category-rail-indicator {
    transition: none;
  }
}
