/* ==========================================================================
   La Trastienda — Tokens de diseño + reset
   Fase 1. No depende de fonts.css ni de ningún recurso externo.
   ========================================================================== */

:root {
  /* ---- Color ---- */
  --color-brown: #5c3822;
  --color-brown-light: #7a5438;
  --color-brown-dark: #3e250f;
  --color-blue: #1c3c62;
  --color-blue-light: #2a5a8f;
  --color-cream: #faf6f1;
  --color-cream-dark: #f0e8dd;
  --color-white: #ffffff;
  --color-text: #2d2319;
  --color-text-light: #6b5c4f;
  --color-focus: #1c3c62;
  --color-focus-on-dark: var(--color-cream);
  --color-error: #8c2b17;

  /* Acentos de estado/destacado — se usan con moderación */
  --color-status-green: #15803d;         /* Verde hoja para "Abierto", frescura */
  --color-status-green-bg: #dcfce7;      /* Fondo suave del badge "Abierto" */
  --color-accent-amber: #d97706;         /* Ámbar cálido para insignias destacadas */
  --color-accent-amber-bg: #fef3c7;      /* Fondo suave del badge ámbar */

  /* Sombras basadas en marrón + alpha, nunca negro puro */
  --shadow-sm: 0 1px 2px rgba(92, 56, 34, 0.12);
  --shadow-md: 0 4px 12px rgba(92, 56, 34, 0.16);
  --shadow-lg: 0 8px 24px rgba(92, 56, 34, 0.2);
  --shadow-card-hover: 0 10px 30px rgba(92, 56, 34, 0.18), 0 2px 6px rgba(92, 56, 34, 0.1);

  /* ---- Espaciado (escala de 4px) ---- */
  --space-4: 0.25rem;
  --space-8: 0.5rem;
  --space-12: 0.75rem;
  --space-16: 1rem;
  --space-24: 1.5rem;
  --space-32: 2rem;
  --space-48: 3rem;
  --space-64: 4rem;
  --space-80: 5rem;
  --space-120: 7.5rem;

  /* ---- Radios ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* ---- Tipografía ----
     Familias reales se activan en fonts.css; aquí solo la pila con fallback.
     'X Fallback' son las @font-face ajustadas por métrica (ver fonts.css)
     que evitan salto de layout (CLS) mientras carga la fuente real. */
  --font-display: 'DM Serif Display', 'DM Serif Display Fallback', Georgia, 'Times New Roman', serif;
  --font-body: 'Montserrat', 'Montserrat Fallback', Arial, Helvetica, sans-serif;

  --font-weight-regular: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Escala fluida (clamp) — se usa en style.css sobre h1-h3 y cifras
     destacadas para no necesitar media queries de tamaño de texto */
  --font-size-h1: clamp(2.25rem, 1.8rem + 2vw, 3.5rem);
  --font-size-h2: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --font-size-h3: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --font-size-body: 1rem;
  --font-size-small: 0.875rem;

  --line-height-heading: 1.15;
  --line-height-body: 1.6;

  /* ---- Objetivos táctiles ---- */
  --touch-target-min: 24px;
  --touch-target-comfortable: 44px;

  /* ---- Transiciones ----
     Centralizadas para poder anularlas de golpe en prefers-reduced-motion */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;

  /* ---- Escala de z-index ----
     Centralizada para que header, menú móvil, botón flotante y banner
     de consentimiento no compitan entre sí sin querer. */
  --z-header: 100;
  --z-mobile-nav: 200;
  --z-floating-button: 300;
  --z-mobile-action-bar: 350;   /* Por debajo del banner de consentimiento */
  --z-consent-banner: 400;
  --z-skip-link: 500;
}

/* ---- Breakpoints de referencia (documentación, no variables CSS) ----
   480px  → móvil grande
   768px  → tablet
   1024px → tablet grande / portátil pequeño
   1280px → escritorio
   Los media queries reales viven en responsive.css (Fase 2) con estos
   valores literales; CSS no permite usar custom properties dentro de
   @media sin duplicar la hoja, así que se documentan aquí como referencia
   única para no desincronizar los breakpoints entre componentes. */

/* ==========================================================================
   Reset — mínimo, moderno, pensado para no pelear con la accesibilidad
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* "Scroll suave en anclas internas" (sección 6.3 del plan) se resuelve
     aquí, no en main.js: es un anchor <a href="#seccion"> nativo, el
     navegador ya hace el scroll. La regla de prefers-reduced-motion de
     más abajo lo desactiva con !important, así que no hace falta
     duplicar esa lógica en JS. */
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

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

img,
video {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration-thickness: max(1px, 0.0625em);
  text-underline-offset: 0.15em;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--line-height-heading);
  text-wrap: balance;
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }

p, li {
  text-wrap: pretty;
}

table {
  border-collapse: collapse;
}

/* ---- Foco visible, siempre ----
   3px + offset 2px, color de marca. Nunca se elimina el foco sin
   sustituirlo por algo igual o más visible (WCAG 2.4.7 / 2.4.11). */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Navegadores sin soporte de :focus-visible (fallback conservador) */
:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Preferencias del sistema ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --color-text-light: var(--color-text);
    --shadow-sm: 0 0 0 1px var(--color-text);
    --shadow-md: 0 0 0 1px var(--color-text);
    --shadow-lg: 0 0 0 1px var(--color-text);
  }

  :focus-visible {
    outline-width: 4px;
  }
}
