/* ════════════════════════════════════════════════════════════════════════
   TRIXEL — Layout
   Topbar, header, mobile-nav, footer, slot wrapper.
   ════════════════════════════════════════════════════════════════════════ */

/* El wrapper data-slot debe ser "transparente" al layout */
[data-slot] { display: contents; }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--c-graphite);
  color: var(--c-warm-white);
  font-size: var(--fs-xs);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-3) 0;
  flex-wrap: wrap;
}
.topbar__msg { letter-spacing: 0.04em; color: rgba(250, 250, 247, 0.78); }
.topbar__links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.topbar__links a {
  color: rgba(250, 250, 247, 0.85);
  transition: color var(--t-fast);
}
.topbar__links a:hover { color: var(--c-cyan-soft); }

@media (max-width: 980px) {
  .topbar { display: none; }
}

/* ── Header ────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: var(--topbar-h, 0px);
  z-index: 70;
  background: var(--c-graphite);
  border-bottom: 1px solid transparent;
  transition:
    border-color var(--t-base),
    box-shadow var(--t-base),
    background var(--t-base),
    transform var(--t-base);
  will-change: transform;
}
.header.is-scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.28);
  background: var(--c-graphite);
  box-shadow: var(--sh-sm);
}
.header.is-hidden {
  transform: translateY(-100%);
}
body.nav-open .header {
  transform: translateY(0);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) 0;
  min-height: var(--header-h);
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
  color: var(--c-text);
}
.brand__logo {
  height: 52px;
  width: auto;
  display: block;
}
.footer .brand__logo { height: 56px; }

/* Nav (desktop) */
.nav { flex: 1 1 auto; display: flex; justify-content: center; }
.nav__list {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.nav__item { position: relative; }
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.88);
  /* Pastilla con borde sutil que se ilumina en cian al pasar el ratón. */
  padding: 10px 14px;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
/* Hover/activo: pastilla de fondo SÓLIDO (sin borde ni translúcido), estilo Horeka. */
.nav__link:hover,
.nav__link.is-active {
  color: var(--c-graphite);
  background: var(--c-white);
}

/* Caret junto al link con megamenú */
.nav__caret {
  width: 10px; height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  opacity: 0.55;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.nav__item.is-open .nav__caret {
  transform: rotate(225deg) translate(-2px, -2px);
  opacity: 1;
}

/* ── Megamenu ──────────────────────────────────────────────────────────── */
.megamenu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translate(-50%, 8px);
  min-width: 620px;
  padding: var(--sp-6);
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
  z-index: 75;
}
/* Puente invisible que rellena el gap entre el item y el menu para que
   el mouse pueda cruzar sin disparar mouseleave del item. */
.nav__item.is-open .megamenu::before {
  content: "";
  position: absolute;
  top: -14px; left: 0; right: 0;
  height: 14px;
}
.nav__item.is-open .megamenu,
.nav__item:focus-within .megamenu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.megamenu__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3) var(--sp-7);
}
.megamenu__link {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--t-fast), transform var(--t-fast);
}
.megamenu__link:hover {
  background: var(--c-violet-tint);
  transform: translateX(2px);
}
.megamenu__link-ico {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--c-mist);
  color: var(--c-violet-dark);
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.megamenu__link:hover .megamenu__link-ico {
  background: var(--grad-brand);
  color: var(--c-white);
}
.megamenu__link-ico .nav-ico {
  width: 20px;
  height: 20px;
}
.megamenu__link-body { display: block; min-width: 0; }
.megamenu__link small {
  display: block;
  color: var(--c-text-soft);
  font-weight: 400;
  margin-top: 2px;
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.megamenu__cta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-4);
  padding-top: var(--sp-5);
  border-top: 1px dashed var(--c-border);
  font-size: var(--fs-sm);
  color: var(--c-text-soft);
  gap: var(--sp-4);
}

@media (max-width: 980px) {
  .megamenu { display: none; }
}

/* Header actions */
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
/* Lang switcher + redes dentro del header azul. */
.header__actions .lang-switcher__btn {
  color: var(--c-white);
}
.header__actions .lang-switcher__btn:hover {
  color: rgba(255, 255, 255, 0.78);
}
.header__actions .social-icons--header .social-icons__link {
  background: var(--c-graphite) !important;
  border-color: var(--c-white) !important;
  color: var(--c-white) !important;
}
.header__actions .social-icons--header .social-icons__link:hover {
  background: var(--c-graphite) !important;
  border-color: var(--c-white) !important;
  color: var(--c-white) !important;
  transform: translateY(-2px);
}

/* Burger (mobile) */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--sp-2);
  border-radius: var(--r-sm);
}
.burger span {
  width: 22px; height: 2px;
  background: var(--c-white);
  transition: transform var(--t-base), opacity var(--t-base);
}
body.nav-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .burger span:nth-child(2) { opacity: 0; }
body.nav-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 980px) {
  .nav { display: none; }
  .header__actions .btn,
  .header__actions .lang-switcher,
  .header__actions .social-icons--header { display: none; }
  .burger { display: inline-flex; }
}

/* ── Mobile nav (off-canvas) ───────────────────────────────────────────── */
.mobile-nav {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(86vw, 360px);
  background: var(--c-white);
  border-left: 1px solid var(--c-border);
  box-shadow: var(--sh-lg);
  padding: calc(var(--header-h) + var(--sp-6)) var(--sp-6) var(--sp-8);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--t-base);
  z-index: 65;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
body.nav-open .mobile-nav { transform: translateX(0); }

.mobile-nav__group h4 {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--c-text-dim);
  margin-bottom: var(--sp-3);
}
.mobile-nav__group a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px 0;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
}
.mobile-nav__group a:last-child { border-bottom: 0; }
.mobile-nav__ico {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--c-mist);
  color: var(--c-violet-dark);
  flex-shrink: 0;
}
.mobile-nav__ico .nav-ico { width: 22px; height: 22px; }
.mobile-nav__lang h4 {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--c-text-dim);
  margin-bottom: var(--sp-3);
}
.mobile-nav__lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}
.mobile-nav__lang-grid button {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-soft);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.mobile-nav__lang-grid button:hover { border-color: var(--c-violet); color: var(--c-text); }

.mobile-nav__cta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: auto;
}

/* Overlay para cerrar */
body.nav-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 28, 0.45);
  backdrop-filter: blur(4px);
  z-index: 62;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
  background: var(--c-graphite);
  color: var(--c-white);
  padding: var(--sp-10) 0 var(--sp-6);
  margin-top: var(--sp-12);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
  gap: var(--sp-7);
  padding-bottom: var(--sp-8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}
.footer,
.footer * { color: var(--c-white); }
.footer .brand { margin-bottom: var(--sp-4); }
.footer__brand p {
  font-size: var(--fs-sm);
  max-width: 320px;
  margin-bottom: var(--sp-5);
}
.footer h4 {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  text-transform: none;
  margin-bottom: var(--sp-4);
}
.footer ul li { margin-bottom: var(--sp-3); }
.footer ul a,
.footer__brand a {
  font-size: var(--fs-sm);
  transition: opacity var(--t-fast);
}
.footer ul a:hover { opacity: 0.75; }

.footer__newsletter p {
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.footer__newsletter form {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.footer__newsletter input[type="email"] {
  flex: 1 1 180px;
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-warm-white);
  font-size: var(--fs-sm);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.footer__newsletter input[type="email"]::placeholder { color: rgba(255, 255, 255, 0.65); font-weight: 600; }
.footer__newsletter input[type="email"]:focus {
  border-color: var(--c-white);
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}
/* Botón "Suscribir" en el footer grafito: blanco con texto grafito.
   !important para vencer la regla .footer * que fuerza color blanco. */
.footer__newsletter .btn--primary {
  background: var(--c-white);
  color: var(--c-graphite) !important;
  box-shadow: none;
}
.footer__newsletter .btn--primary:hover {
  background: var(--c-white);
  color: var(--c-graphite) !important;
  transform: translateY(-2px);
}

.footer__bottom {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding-top: var(--sp-5);
  font-size: var(--fs-xs);
}
.footer__bottom a { transition: opacity var(--t-fast); }
.footer__bottom a:hover { opacity: 0.75; }
.footer__bottom a:hover { color: var(--c-cyan-soft); }
.footer__powered {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
  .footer__newsletter { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .footer__grid { grid-template-columns: 1fr; }
  .footer__bottom { justify-content: center; text-align: center; }
  .footer__powered { position: static; transform: none; }
}

/* ── Bloqueo de scroll cuando modal o nav abierta ──────────────────────── */
body.cookie-modal-open,
body.nav-open { overflow: hidden; }


/* ── Header overlay (sobre hero full-screen) ───────────────────────────────
   Header fijo y solido sobre hero; el JS lo oculta al bajar y lo muestra
   al subir, sin cambiarlo a transparente.
   ──────────────────────────────────────────────────────────────────────── */
body[data-hero-overlay] .header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--c-graphite);
  border-bottom-color: rgba(255, 255, 255, 0.28);
  box-shadow: var(--sh-sm);
}

/* Mantiene el header fijo también cuando vuelve a sólido al subir. */
body[data-hero-overlay] .header.is-scrolled {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--c-graphite);
}
/* Padding superior para que el contenido no quede debajo del header fijo
   cuando NO hay overlay de hero. Cuando hay overlay, el hero ya compensa. */
body[data-hero-overlay] main { padding-top: 0; }
