/* ============================================================================
   BASE — reset, elementos y utilidades
============================================================================ */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Evita el salto de layout cuando aparece la scrollbar */
  scrollbar-gutter: stable;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Bloquea el scroll del fondo cuando hay una hoja/modal abierta */
body.is-locked { overflow: hidden; }

/* --- Tipografía ---------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--f-title);
  font-weight: 700;
  text-transform: uppercase;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-title);
  text-wrap: balance;
}

h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
h4 { font-size: var(--t-base); }

p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

a:hover { color: var(--c-accent); }

strong, b { font-weight: 600; }

small { font-size: var(--t-sm); }

code, kbd, pre { font-family: var(--f-mono); }

::selection {
  background: var(--c-accent);
  color: var(--c-accent-text);
}

/* --- Media --------------------------------------------------------------- */

img, picture, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  background: var(--c-bg-alt);
  /* Las fotos de producto son la pieza principal: nunca se deforman */
  object-fit: cover;
}

/* --- Formularios --------------------------------------------------------- */

input, textarea, select, button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  border-radius: var(--radius);
}

button { cursor: pointer; }

button:disabled, input:disabled, select:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* iOS zoomea al enfocar inputs con font-size < 16px */
@media (max-width: 767px) {
  input, select, textarea { font-size: 16px; }
}

/* --- Foco: visible y con el acento --------------------------------------- */

:focus { outline: none; }

:focus-visible {
  outline: var(--bw-thick) solid var(--c-accent);
  outline-offset: 2px;
}

/* --- Scrollbar ----------------------------------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-dim); }

/* ============================================================================
   UTILIDADES
============================================================================ */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--flush { padding-inline: 0; }

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-6); }

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }

/* Etiqueta de sistema: mayúsculas chicas y espaciadas */
.label {
  font-family: var(--f-title);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--c-text-dim);
  line-height: 1;
}

.mono {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: var(--tracking-wide);
}

.dim { color: var(--c-text-dim); }
.accent { color: var(--c-accent); }

.hr {
  height: var(--bw);
  background: var(--c-border);
  border: none;
}

/* Separador con el acento, para cortar secciones */
.hr--accent { height: var(--bw-thick); background: var(--c-accent); }

.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;
}

.is-hidden { display: none !important; }

/* Scroll horizontal de chips en mobile, sin barra visible */
.scroller {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.scroller::-webkit-scrollbar { display: none; }
.scroller > * { flex: 0 0 auto; scroll-snap-align: start; }

/* Aparición al montar contenido async */
.fade-in { animation: fadeIn var(--dur-slow) var(--ease) both; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
