/*
 * TEC · Header global (TEC-02) y navegación móvil (TEC-03). B04.
 * Estados oficiales 04_Home/03_Header_States: inicial (Home, sin logo) y revelado (LOG-03 D / LOG-04 M).
 * La marca se renderiza visible desde el servidor (fallback sin JS e interiores). El estado
 * «concealed» reserva su hueco y la retira del foco; solo Brand Reveal (B07) lo activa.
 * B07: Brand Reveal (HOME-30) 400 ms opacidad 0→1 e Y 8→0, inverso cancelable desde el estado
 * visual actual. RC3 conserva la geometría continua del encabezado y el área de toque.
 */

.tec-header-section {
  position: sticky;
  top: 0;
  z-index: var(--tec-z-header);
}

.tec-header {
  --tec-header-height: 72px;
  --tec-header-icon: 28px;
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  block-size: var(--tec-header-height);
  border-block-end: var(--tec-border-width) solid transparent;
  color: var(--tec-text-primary);
  font-family: var(--tec-font-sans);
  font-synthesis: none;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}

.tec-header__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  box-sizing: border-box;
  block-size: 100%;
  padding-inline: var(--tec-s3);
}

/* The surface fills the same geometry as the controls and sticky rail. */
.tec-header::before {
  content: '';
  position: absolute;
  inset: 0 0 calc(-1 * var(--tec-border-width)); /* caja de borde completa: filete en su fila original */
  z-index: -1;
  border-block-end: var(--tec-border-width) solid var(--tec-border-decorative);
  background: var(--tec-surface-card);
}

/* ---------- Marca: hueco reservado, sin CLS al revelar ---------- */
.tec-header__brand {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: center;
  min-inline-size: 0;
}

.tec-header__brand .tec-brand--header {
  --tec-brand-width: 140px;
  --tec-brand-clearance: 4px;
}

.tec-header__brand-d {
  display: none;
}

.tec-header__brand {
  transition:
    opacity 400ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0s;
}

.tec-header__brand[data-tec-brand-state='concealed'] {
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 400ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 400ms;
}

/* Estado inicial o recalculado (carga, BFCache) y perfil Static: cambio directo. */
.tec-header__brand[data-tec-brand-instant],
html[data-tec-motion-profile='static'] .tec-header__brand,
html[data-tec-motion-profile='static'] .tec-header::before {
  transition: none;
}

/* Arranque de Brand Reveal en Home: oculta desde el primer frame mientras el módulo calcula.
   El atributo lo pone un script en línea y caduca solo; sin JS la marca sigue visible. */
html[data-tec-brand-boot] .tec-header[data-tec-home='true'] .tec-header__brand {
  visibility: hidden;
  opacity: 0;
  transition: none;
}

/* ---------- Navegación de escritorio ---------- */
.tec-header__nav {
  display: none;
}

.tec-header__list {
  display: flex;
  gap: var(--tec-s3) clamp(var(--tec-s6), 3.4vw, 52px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tec-header__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-block-size: var(--tec-target);
  min-inline-size: var(--tec-target);
  justify-content: center;
  color: var(--tec-text-primary);
  font-size: calc(16 * var(--tec-u));
  line-height: var(--tec-leading-ui);
  text-decoration: none;
  white-space: nowrap;
}

.tec-header__link[aria-current='page']::after {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  border-block-end: var(--tec-selection-width) solid var(--tec-accent-decorative);
  content: '';
}

@media (hover: hover) and (pointer: fine) {
  .tec-header__link:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.45em;
  }

  .tec-header__link[aria-current='page']:hover {
    text-decoration: none;
  }
}

/* ---------- Iconos: menú, búsqueda y bolsa con objetivo táctil 44 px ---------- */
.tec-header__start,
.tec-header__actions {
  display: flex;
  grid-row: 1;
  align-items: center;
  min-inline-size: 0;
}

.tec-header__start {
  grid-column: 1;
  justify-content: flex-start;
}

.tec-header__actions {
  grid-column: 3;
  justify-content: flex-end;
  gap: var(--tec-s1);
}

.tec-header__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-inline-size: var(--tec-target);
  min-block-size: var(--tec-target);
  padding: 0;
  border: 0;
  border-radius: var(--tec-radius-control);
  background: transparent;
  color: var(--tec-text-primary);
  text-decoration: none;
  cursor: pointer;
}

.tec-header__icon svg {
  display: block;
  inline-size: var(--tec-header-icon);
  block-size: var(--tec-header-icon);
}

/* Cantidad confirmada por Shopify; ancho reservado para 3+ dígitos, oculta en cero. */
.tec-header__count {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: 0;
  box-sizing: border-box;
  min-inline-size: 20px;
  padding: 0 var(--tec-s1);
  border-radius: var(--tec-radius-chip);
  background: var(--tec-action-primary-bg);
  color: var(--tec-action-primary-fg);
  font-size: calc(11 * var(--tec-u));
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tec-header__count:empty,
.tec-header__count[data-tec-count-zero='true'] {
  display: none;
}

.tec-header__icon:focus-visible,
.tec-header__link:focus-visible,
.tec-header__brand a:focus-visible {
  outline: var(--tec-focus-width) solid var(--tec-focus-light);
  outline-offset: calc(var(--tec-focus-offset) * -1 + 1px);
}

.tec-header__link:focus-visible {
  outline-offset: var(--tec-focus-offset);
}

@media screen and (min-width: 1024px) {
  .tec-header {
    --tec-header-height: 84px;
  }

  .tec-header__bar {
    padding-inline: clamp(var(--tec-s7), calc(32px + 16 * (100vw - 1024px) / 416), var(--tec-s9));
  }

  .tec-header__brand {
    grid-column: 1;
    justify-content: flex-start;
  }

  .tec-header__brand .tec-brand--header {
    --tec-brand-width: clamp(190px, calc(190px + 43 * (100vw - 1024px) / 416), 233px);
    --tec-brand-clearance: 6px;
  }

  .tec-header__brand-d {
    display: block;
  }

  .tec-header__brand-m,
  .tec-header__start {
    display: none;
  }

  .tec-header__nav {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }

  .tec-header__actions {
    gap: var(--tec-s3);
  }
}

/* ---------- TEC-03 · Menú global (<1024 px) ---------- */
.tec-menu {
  box-sizing: border-box;
  inline-size: min(100%, 420px);
  max-inline-size: 100%;
  block-size: 100%;
  max-block-size: 100%;
  margin: 0 auto 0 0;
  padding: 0;
  border: 0;
  background: var(--tec-surface-card);
  color: var(--tec-text-primary);
  font-family: var(--tec-font-sans);
  font-synthesis: none;
  letter-spacing: normal;
}

.tec-menu::backdrop {
  background: rgb(48 41 36 / 45%);
}

/* Sin JS: el disparador es un enlace al panel, visible por :target y cerrable con un enlace. */
.tec-menu:target:not([open]) {
  position: fixed;
  inset: 0;
  z-index: var(--tec-z-panel);
  display: block;
  overflow: auto;
}

.tec-menu__inner {
  display: flex;
  flex-direction: column;
  gap: var(--tec-s6);
  padding: var(--tec-s3) var(--tec-gutter) var(--tec-s8);
}

.tec-menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tec-s3);
}

.tec-menu__title {
  margin: 0;
  color: var(--tec-text-secondary);
  font-size: var(--tec-type-eyebrow);
  font-weight: 700;
  line-height: var(--tec-leading-eyebrow);
  letter-spacing: var(--tec-tracking-eyebrow);
  text-transform: uppercase;
}

.tec-menu__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tec-menu__list li + li {
  border-block-start: var(--tec-border-width) solid var(--tec-border-decorative);
}

.tec-menu__link {
  display: flex;
  align-items: center;
  min-block-size: 56px;
  color: var(--tec-text-primary);
  font-family: var(--tec-font-serif);
  font-size: var(--tec-type-h3);
  line-height: var(--tec-leading-h3);
  text-decoration: none;
}

.tec-menu__link[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--tec-accent-decorative);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

.tec-menu__link:focus-visible,
.tec-menu .tec-header__icon:focus-visible {
  outline: var(--tec-focus-width) solid var(--tec-focus-light);
  outline-offset: var(--tec-focus-offset);
}

@media (prefers-reduced-motion: reduce) {
  .tec-header *,
  .tec-header::before,
  .tec-menu * {
    transition: none !important;
  }
}
