/* Kivaro · estilos del catálogo
   Colores de marca (marca/MARCA.md): negro tinta, blanco crudo y azul cobalto como único acento. */

@font-face {
  font-family: "Archivo";
  src: url("../fuentes/archivo-latin-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --tinta: #171717;
  --crudo: #F5F3EB;
  --cobalto: #244DDE;
  --cobalto-oscuro: #1A3BB0;
  --gris-texto: #55534D;
  --linea: rgba(23, 23, 23, 0.14);
  --fondo-foto: #E8E5DB;
  --margen: 16px;
  --cabecera: 56px;
  --ancho-max: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--cabecera) + 8px); }

body {
  margin: 0;
  background: var(--crudo);
  color: var(--tinta);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

a { color: var(--cobalto); }

:focus-visible { outline: 3px solid var(--cobalto); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.saltar {
  position: absolute; left: var(--margen); top: -100px; z-index: 50;
  background: var(--tinta); color: var(--crudo); padding: 10px 14px; text-decoration: none;
}
.saltar:focus { top: 8px; }

/* ---------- Cabecera ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 20;
  height: var(--cabecera);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--margen);
  background: var(--crudo);
  border-bottom: 1px solid var(--linea);
}
.cabecera__logo { display: block; padding: 6px 0; }
.cabecera__logo img { width: 144px; height: 27px; }
.cabecera__enlace {
  color: var(--tinta); text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 10px 0 10px 12px;
}
.cabecera__enlace:hover { color: var(--cobalto); }

main:focus { outline: none; }

/* ---------- Botón ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px;
  background: var(--cobalto); color: var(--crudo);
  font: inherit; font-weight: 500; text-decoration: none;
  border: 0; border-radius: 0; cursor: pointer;
}
.boton:hover { background: var(--cobalto-oscuro); }
.boton:focus-visible { outline: 3px solid var(--crudo); outline-offset: 0; box-shadow: 0 0 0 6px var(--cobalto); }

/* ---------- Portada ---------- */
.portada {
  position: relative;
  height: clamp(300px, 52svh, 440px);
  overflow: hidden;
  background: var(--tinta);
}
.portada__foto img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 38%;
}
.portada__foto { position: absolute; inset: 0; }
.portada::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(23,23,23,0.82) 0%, rgba(23,23,23,0.35) 45%, rgba(23,23,23,0) 70%);
  pointer-events: none;
}
.portada__texto {
  position: absolute; left: var(--margen); right: var(--margen); bottom: 20px; z-index: 1;
  color: var(--crudo);
}
.portada__marca {
  margin: 0 0 2px; font-weight: 500; font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase;
}
.portada__titulo {
  margin: 0 0 14px; font-weight: 700; font-size: clamp(34px, 10vw, 44px); line-height: 1.02; letter-spacing: -0.01em;
}

/* ---------- Colección ---------- */
.coleccion {
  max-width: var(--ancho-max); margin: 0 auto;
  padding: 20px var(--margen) 40px;
}
.coleccion:focus { outline: none; }
.coleccion__cabeza { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; }
.coleccion__titulo { margin: 0; font-weight: 700; font-size: 22px; line-height: 1.2; }
.aviso { margin: 0; font-size: 12px; color: var(--gris-texto); }

.filtros {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 16px;
}
.filtro {
  flex: 0 0 auto;
  min-height: 40px; padding: 8px 14px;
  background: transparent; color: var(--tinta);
  font: inherit; font-size: 14px; font-weight: 500;
  border: 1px solid var(--linea); border-radius: 999px; cursor: pointer;
}
.filtro:hover { border-color: var(--tinta); }
.filtro[aria-pressed="true"] { background: var(--cobalto); border-color: var(--cobalto); color: var(--crudo); }

.rejilla {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px;
}
.tarjeta a { display: block; color: var(--tinta); text-decoration: none; }
.tarjeta__foto { aspect-ratio: 4 / 5; overflow: hidden; background: var(--fondo-foto); }
.tarjeta__foto img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tarjeta a:hover .tarjeta__foto img { transform: scale(1.03); }
.tarjeta__nombre { display: block; margin-top: 8px; font-weight: 500; font-size: 15px; line-height: 1.3; }
.tarjeta a:hover .tarjeta__nombre { color: var(--cobalto); }
.tarjeta__ref { display: block; font-size: 13px; color: var(--gris-texto); }

/* ---------- Ficha ---------- */
.ficha:focus { outline: none; }
.ficha { max-width: var(--ancho-max); margin: 0 auto; padding: 12px var(--margen) 40px; }
.volver {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: var(--tinta); font-weight: 500; text-decoration: none;
}
.volver:hover { color: var(--cobalto); }
.ficha__cuerpo { display: grid; gap: 20px; margin-top: 4px; }
.ficha__fotos { display: grid; gap: 12px; }
.ficha__ampliar {
  display: block; position: relative; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  background: var(--fondo-foto); aspect-ratio: 4 / 5; overflow: hidden;
}
.ficha__ampliar img { width: 100%; height: 100%; object-fit: cover; }
.ficha__ampliar-etiqueta {
  position: absolute; right: 10px; bottom: 10px;
  background: var(--crudo); color: var(--tinta);
  font-size: 13px; font-weight: 500; padding: 6px 10px;
}
.ficha__categoria { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--gris-texto); }
.ficha__nombre { margin: 4px 0 2px; font-weight: 700; font-size: 30px; line-height: 1.1; }
.ficha__ref { margin: 0 0 16px; font-weight: 500; color: var(--gris-texto); }
.ficha__descripcion { margin: 0 0 20px; max-width: 46ch; }
.ficha__credito { margin: 20px 0 6px; font-size: 12px; color: var(--gris-texto); }

/* ---------- Error ---------- */
.error { max-width: 640px; margin: 0 auto; padding: 48px var(--margen); }
.error h1 { font-size: 26px; margin: 0 0 8px; }

/* ---------- Pie ---------- */
.pie {
  border-top: 1px solid var(--linea);
  padding: 20px var(--margen) calc(24px + env(safe-area-inset-bottom));
  font-size: 12px; color: var(--gris-texto); text-align: center;
}
.pie p { margin: 0 0 4px; }

/* ---------- Visor de foto ---------- */
.visor {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(23, 23, 23, 0.97);
}
.visor::backdrop { background: rgba(23, 23, 23, 0.97); }
.visor[open] { display: flex; align-items: center; justify-content: center; }
.visor__img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.visor__cerrar {
  position: fixed; top: 12px; right: 12px; z-index: 2;
  min-height: 44px; padding: 8px 14px;
  background: var(--crudo); color: var(--tinta);
  font: inherit; font-weight: 500; border: 0; cursor: pointer;
}
.visor__cerrar span[aria-hidden] { font-size: 22px; line-height: 1; }

/* ---------- Tableta y escritorio ---------- */
@media (min-width: 720px) {
  :root { --margen: 24px; }
  .rejilla { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 20px; }
  .ficha__cuerpo { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  .ficha__info { position: sticky; top: calc(var(--cabecera) + 24px); padding-top: 8px; }
  .ficha__nombre { font-size: 38px; }
}

@media (min-width: 900px) {
  .portada {
    height: min(64vh, 600px);
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
    background: var(--crudo);
    max-width: var(--ancho-max); margin: 0 auto;
  }
  .portada::after { display: none; }
  .portada__foto { position: relative; inset: auto; grid-column: 2; grid-row: 1; height: 100%; min-height: 0; overflow: hidden; }
  .portada__texto {
    position: static; grid-column: 1; grid-row: 1; align-self: end;
    color: var(--tinta); padding: 0 var(--margen) 48px;
  }
  .portada__marca { font-size: 15px; }
  .portada__titulo { font-size: clamp(56px, 6.5vw, 88px); margin-bottom: 24px; }
  .coleccion { padding-top: 40px; }
  .coleccion__titulo { font-size: 28px; }
  .filtros { margin: 18px 0 24px; }
}

@media (min-width: 1100px) {
  .rejilla { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cabecera__logo img { width: 176px; height: 33px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
