/* header.css — Marc Zamora web-3.0 */

/* ── Variables locales del header ── */
:root {
  --header-px:    clamp(12px, 2vw, 32px);
  --nav-fs:       clamp(13px, 1.1vw, 15px);
  --nav-gap:      clamp(8px, 1.3vw, 20px);
  --speed:        200ms;
  --ease-out:     cubic-bezier(0.25, 0, 0.1, 1);
  --ease-in:      cubic-bezier(0.9, 0, 1, 1);
}

/* ── Reset base ── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 8px 16px;
  background: var(--color-primary);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  z-index: 200;
  transition: top 150ms var(--ease-out);
}
.skip-link:focus {
  top: 0;
}

/* ── Header: sticky, fondo blanco ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-white);
  border-bottom: 1px solid oklch(90% 0.005 280);
  box-shadow: 0 1px 0 oklch(14% 0.04 280 / 0.05);
  transition: box-shadow var(--speed) var(--ease-out);
}
.site-header.is-scrolled {
  box-shadow:
    0 1px 0 oklch(90% 0.005 280),
    0 4px 24px oklch(14% 0.04 280 / 0.08);
}

/* ── Header inner: flex 3 columnas ── */
.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(4px, 0.6vw, 8px) var(--header-px);
  gap: clamp(8px, 1.5vw, 20px);
}

/* ── Columnas ── */
.header-col--logo {
  flex: 0 0 auto;
  min-width: 0;
}
.header-col--nav {
  flex: 1 1 auto;
  min-width: 0;
}
.header-col--actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

/* ── Logo imagen ── */
.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.logo-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: 2px;
}
.logo-img {
  display: block;
  height: clamp(36px, 3.8vw, 48px);
  width: auto;
  max-width: clamp(140px, 14vw, 180px);
  object-fit: contain;
  object-position: left center;
}

/* ── Nav list desktop ── */
.nav-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--nav-gap);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

/* ── Nav link ── */
.nav-link {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--nav-fs);
  letter-spacing: 0.06em;
  color: var(--color-primary);
  text-decoration: none;
  padding: 6px 0;
  white-space: nowrap;
  text-transform: uppercase;
  transition: color var(--speed) var(--ease-out);
}
.nav-link:hover { color: oklch(38% 0.04 280); }
.nav-link:active { color: oklch(22% 0.03 280); }
.nav-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ── Dropdown toggle button ── */
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--color-primary);
  transition: color var(--speed) var(--ease-out);
}
.nav-dropdown-toggle:hover { color: oklch(38% 0.04 280); }
.nav-dropdown-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.nav-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform var(--speed) var(--ease-out);
}
.nav-dropdown-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

/* ── Dropdown ── */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 230px;
  background: var(--color-white);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  box-shadow:
    0 2px 8px oklch(14% 0.04 280 / 0.07),
    0 8px 24px oklch(14% 0.04 280 / 0.09);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out),
    visibility 180ms;
}
.nav-dropdown[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 12px;
  background: transparent;
}
.nav-dropdown-link {
  display: block;
  padding: clamp(10px, 1vw, 14px) clamp(16px, 1.8vw, 24px);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(14px, 1.2vw, 17px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out);
}
.nav-dropdown-link:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}
.nav-dropdown-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  background-color: oklch(95% 0.005 280);
}
.nav-dropdown-link:active {
  background-color: oklch(20% 0.04 280);
  color: var(--color-white);
}

/* ── Botón CTA ── */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 0.8vw, 12px) clamp(12px, 1.4vw, 22px);
  background: var(--color-cta);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(14px, 1.2vw, 16px);
  letter-spacing: 0.05em;
  text-decoration: none;
  border-radius: 10px;
  white-space: nowrap;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}
.btn-cta:hover {
  opacity: 0.88;
  transform: translateY(-2px);
  color: var(--color-white) !important;
}
.btn-cta:focus-visible {
  outline: 3px solid var(--color-cta);
  outline-offset: 4px;
}
.btn-cta:active {
  opacity: 0.80;
  transform: translateY(0);
}

/* ── Hamburger ── */
.hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
  flex-shrink: 0;
}
.hamburger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.hamburger-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  transform-origin: center;
  transition:
    transform var(--speed) var(--ease-out),
    opacity var(--speed) var(--ease-out);
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile nav ── */
.mobile-nav {
  display: none;
  grid-template-rows: 0fr;
  overflow: hidden;
  border-top: 1px solid oklch(92% 0.005 280);
  transition: grid-template-rows 250ms var(--ease-out);
}
.mobile-nav[data-open="true"] {
  grid-template-rows: 1fr;
}
.mobile-nav-inner {
  min-height: 0;
  overflow: hidden;
}
.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 16px;
}
.mobile-nav-link {
  display: block;
  padding: 12px var(--header-px);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms var(--ease-out);
}
.mobile-nav-link:hover {
  background-color: oklch(96% 0.004 280);
}
.mobile-nav-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}
.mobile-nav-link--sub {
  padding-left: calc(var(--header-px) + 20px);
  font-size: 16px;
  color: oklch(40% 0.03 280);
}
.mobile-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
}
.mobile-details > summary::-webkit-details-marker { display: none; }
.mobile-details > summary::after {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  margin-right: var(--header-px);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%231B1832' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform var(--speed) var(--ease-out);
  flex-shrink: 0;
}
.mobile-details[open] > summary::after {
  transform: rotate(180deg);
}
.mobile-nav-sub {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Preview body (solo en preview, no va al child-theme) ── */
.preview-body {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px var(--header-px);
  text-align: center;
  background: oklch(97% 0.004 280);
  gap: 16px;
}
.preview-label {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: oklch(55% 0.02 280);
  text-transform: uppercase;
  margin: 0;
}
.preview-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(24px, 3vw, 40px);
  color: var(--color-primary);
  text-transform: uppercase;
  margin: 0;
  line-height: 1.3;
}
.preview-hint {
  font-family: var(--font-body);
  font-size: 14px;
  color: oklch(50% 0.02 280);
  margin: 0;
}

/* ── Responsive: Tablet (≤ 1024px) ── */
@media (max-width: 1024px) {
  .header-col--logo { flex: 0 0 auto; }
  .header-col--nav  { display: none; }
  .header-col--actions {
    flex: 1;
    justify-content: flex-end;
  }
  .hamburger  { display: flex; }
  .mobile-nav { display: grid; }
  .btn-cta    { font-size: clamp(14px, 1.7vw, 16px); }
  .logo-img {
    height: clamp(44px, 6vw, 58px);
    max-width: clamp(160px, 22vw, 210px);
  }
}

/* ── Responsive: Mobile (≤ 767px) ── */
@media (max-width: 767px) {
  .header-col--logo { flex: 1; }
  .header-col--actions { flex: 0 0 auto; }
  .btn-cta { display: none; }
  .hamburger-bar { width: 20px; }
  .logo-img {
    height: clamp(44px, 12vw, 54px);
    max-width: clamp(150px, 42vw, 190px);
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .nav-link,
  .nav-dropdown-toggle,
  .nav-chevron,
  .nav-dropdown,
  .nav-dropdown-link,
  .btn-cta,
  .hamburger-bar,
  .mobile-nav,
  .mobile-nav-link,
  .logo-name,
  .mobile-details > summary::after {
    transition: none;
  }
}

/* ── Selector flotante de idiomas (TranslatePress/Weglot/WPML) ── */
.trp-language-switcher,
#trp-floater-ls,
.weglot-container,
.wpml-ls-statics-shortcode_html {
  top: auto !important;
  bottom: 20px !important;
  right: 20px !important;
}

/* Ocultar el widget flotante duplicado de GTranslate fuera del header */
body > .gtranslate_wrapper,
body > #gtranslate_wrapper,
.gtranslate_wrapper[style*="position: fixed"],
.gtranslate_wrapper[style*="position: absolute"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* -- GTranslate Integrado -- */
.gtranslate-mobile {
  display: none;
}
.gtranslate-desktop {
  display: flex;
  align-items: center;
  /* Evita que el desplegable expanda la cabecera */
  max-height: 44px;
  overflow: visible;
}
.gtranslate-desktop > * {
  /* Si el plugin usa height 100% o similar, forzamos que no crezca */
  max-height: 44px;
  overflow: visible !important;
}
/* Forzamos posición absoluta al menú desplegable interno de GTranslate para que flote */
.gtranslate-desktop [class*="wrapper"] {
  position: relative;
}
.gtranslate-desktop [class*="options"],
.gtranslate-desktop [class*="dropdown"],
.gtranslate-desktop ul {
  position: absolute !important;
  top: 100% !important;
  left: 0;
  z-index: 9999 !important;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@media (max-width: 1280px) {
  .gtranslate-desktop {
    display: none;
  }
  .gtranslate-mobile {
    display: block;
    padding: 16px var(--header-px);
    border-top: 1px solid oklch(92% 0.005 280);
    margin-top: 8px;
  }
}
