/* ===================================================================
 * LAYOUT — grid system, contenedores, secciones, esqueleto.
 * No define colores ni componentes: solo estructura espacial.
 * Cargado tras base.css.
 * =================================================================*/

/* ---------- LAYOUT GLOBAL DEL SITIO ---------- */

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

.site__main {
  flex: 1 0 auto;
  position: relative;
  z-index: var(--z-content);
}

/* iter-31: aire extra al final en móvil para que el botón flotante
 * WhatsApp (position:fixed, bottom derecha) no tape la última card al
 * llegar al pie de página. En desktop el botón queda más alto y apenas
 * solapa, no hace falta el padding. */
@media (max-width: 768px) {
  .site__main {
    padding-bottom: 96px;
  }
}

/* ---------- GRIDS DE PROPÓSITO GENERAL ---------- */

.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }
.grid--cards { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }

@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- FLEX HELPERS ---------- */

.flex {
  display: flex;
  gap: var(--space-4);
}

.flex--col   { flex-direction: column; }
.flex--wrap  { flex-wrap: wrap; }
.flex--center{ align-items: center; justify-content: center; }
.flex--between { justify-content: space-between; align-items: center; }

/* ---------- CAPA DE FONDO PARA BURBUJAS CANVAS ---------- */

#horreo-bubbles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-canvas-bg);
  opacity: 1;
  /*
   * Capa GPU propia para que el canvas no fuerce repaint del documento.
   * Sin combinar con position:fixed conflictivo (a diferencia del header).
   */
  will-change: transform;
}

#horreo-cursor-trail {
  will-change: transform;
}

/* En reduced-motion mostramos un fondo decorativo estático en lugar del canvas */
@media (prefers-reduced-motion: reduce) {
  #horreo-bubbles-canvas {
    display: none;
  }
  .site::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(circle at 15% 80%, rgba(201,169,97,0.08), transparent 30%),
      radial-gradient(circle at 85% 20%, rgba(201,169,97,0.06), transparent 30%);
    pointer-events: none;
    z-index: var(--z-canvas-bg);
  }
}

/* ---------- CAPA DE ESTELA DE CURSOR (solo desktop) ---------- */

#horreo-cursor-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-cursor);
}
