:root {
  --sol-dorado-claro: #ffd23f;
  --sol-dorado: #f5b700;
  /* Versión oscura del dorado, solo para texto sobre fondos claros: #f5b700
     da 1.8:1 de contraste sobre blanco (falla WCAG AA); esta da 5:1. */
  --sol-dorado-texto: #8f6900;
  --sol-rojo: #e2231a;
  --sol-oscuro: #1c1210;
  --sol-blanco: #fffdf7;
  --sol-gris: #6b7280;
  --sol-radio: 16px;
  --sol-sombra: 0 8px 24px rgba(28, 18, 16, 0.14);

  /* Tokens que cambian según el tema del visor */
  --bg: var(--sol-blanco);
  --surface: #ffffff;
  --text: var(--sol-oscuro);
  --text-muted: var(--sol-gris);
  --border: #dfe7ea;
  --img-placeholder: #eef6f8;

  --font-display: "Oswald", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17110f;
    --surface: #241b18;
    --text: #f5ece6;
    --text-muted: #b9a89f;
    --border: #3a2b26;
    --img-placeholder: #2a201c;
    --sol-sombra: 0 8px 24px rgba(0, 0, 0, 0.4);
    /* Sobre fondo oscuro el dorado original ya tiene contraste de sobra */
    --sol-dorado-texto: var(--sol-dorado);
  }
}

:root[data-theme="dark"] {
  --bg: #17110f;
  --surface: #241b18;
  --text: #f5ece6;
  --text-muted: #b9a89f;
  --border: #3a2b26;
  --img-placeholder: #2a201c;
  --sol-sombra: 0 8px 24px rgba(0, 0, 0, 0.4);
  --sol-dorado-texto: var(--sol-dorado);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
}

h1, h2 {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 6%;
  background: var(--bg);
  box-shadow: 0 2px 10px rgba(2, 48, 71, 0.06);
}

.logo {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 56px;
  width: 56px;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 28px;
  font-weight: 600;
}

.nav a:hover {
  color: var(--sol-dorado-texto);
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25d366;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  box-shadow: var(--sol-sombra);
  transition: transform 0.15s ease;
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
}

/* Hero */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--sol-oscuro);
  line-height: 0;
  border: none;
  padding: 0;
  cursor: pointer;
}

.hero-img {
  width: 100%;
  max-height: 620px;
  object-fit: cover;
  animation: fade-in-up 0.6s ease both;
  transition: transform 0.4s ease;
}

.hero:hover .hero-img {
  transform: scale(1.015);
}

/* Banners promocionales secundarios */
.promos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 4px;
  background: var(--surface);
}

.promo-tile {
  display: block;
  overflow: hidden;
  line-height: 0;
  width: 100%;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
}

.promo-tile img {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.promo-tile--arriba img {
  object-position: top;
}

.promo-tile:hover img {
  transform: scale(1.03);
}

.btn-primary {
  display: inline-block;
  background: var(--sol-dorado);
  color: var(--sol-oscuro);
  font-family: var(--font-display);
  font-weight: 600;
  padding: 14px 32px;
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: 0.3px;
  box-shadow: var(--sol-sombra);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--sol-dorado-claro);
}

/* Colecciones */
.colecciones {
  padding: 56px 6% 20px;
  text-align: center;
}

.colecciones h2 {
  font-size: 2rem;
  margin: 0 0 32px;
  color: var(--text);
}

.colecciones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
}

.coleccion-tile {
  position: relative;
  border: none;
  padding: 0;
  border-radius: var(--sol-radio);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  box-shadow: var(--sol-sombra);
  background: var(--img-placeholder);
}

.coleccion-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 22px;
  transition: transform 0.35s ease;
}

.coleccion-tile:hover img {
  transform: scale(1.08);
}

.coleccion-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(28, 18, 16, 0.75) 0%, rgba(28, 18, 16, 0) 45%);
}

.coleccion-nombre {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  z-index: 2;
}

/* Página dedicada de una colección (se muestra al hacer clic en una tarjeta) */
.coleccion-pagina {
  animation: fade-in-up 0.4s ease both;
}

/* Migas de pan: Inicio / Colección actual */
.migas {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 6% 0;
  font-size: 0.85rem;
}

.catalogo .migas {
  margin: 0 0 6px;
}

.migas-inicio {
  border: none;
  background: none;
  padding: 6px 0;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.migas-inicio:hover {
  color: var(--sol-rojo);
}

.migas-sep {
  color: var(--text-muted);
}

.migas-actual {
  color: var(--text);
  font-weight: 700;
}

.coleccion-banner {
  position: relative;
  margin: 14px 6% 0;
  border-radius: var(--sol-radio);
  overflow: hidden;
  aspect-ratio: 21 / 9;
  background: var(--img-placeholder);
}

.coleccion-banner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--img-placeholder);
}

.coleccion-banner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px 32px;
  background: linear-gradient(to top, rgba(28, 18, 16, 0.8) 0%, rgba(28, 18, 16, 0.15) 55%, rgba(28, 18, 16, 0) 80%);
  color: white;
}

.coleccion-banner-eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.75rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--sol-dorado-claro);
  margin-bottom: 6px;
}

.coleccion-banner-overlay h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
}

.coleccion-banner-overlay p {
  margin: 0;
  max-width: 480px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
}

.coleccion-banner-talles {
  margin-top: 8px !important;
  font-weight: 700;
  color: var(--sol-dorado-claro) !important;
}

@media (max-width: 640px) {
  .coleccion-banner {
    aspect-ratio: 4 / 5;
  }
}

/* Filters */
.filtros {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0 10px;
}

.filtro-btn {
  border: 2px solid var(--sol-rojo);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  padding: 9px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.95rem;
}

.filtro-btn:hover {
  background: rgba(33, 158, 188, 0.1);
}

.filtro-btn.activo {
  background: var(--sol-rojo);
  color: white;
}

/* Catalog grid */
.catalogo {
  padding: 30px 6% 80px;
}

.catalogo-header {
  text-align: center;
  margin-bottom: 8px;
}

.catalogo-talles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.talle-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  background: var(--img-placeholder);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
}

.talle-chip strong {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
}

.talle-chip span {
  color: var(--text-muted);
}

.catalogo-header h2 {
  font-size: 2rem;
  margin: 0 0 8px;
}

.catalogo-header p {
  color: var(--text-muted);
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 26px;
  margin-top: 36px;
}

.card {
  background: var(--surface);
  border-radius: var(--sol-radio);
  overflow: hidden;
  box-shadow: var(--sol-sombra);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-6px);
}

.card-imagen-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--img-placeholder);
}

.card-imagen-wrap {
  overflow: hidden;
}

.card-imagen-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.card:hover .card-imagen-wrap img {
  transform: scale(1.08);
}

.badge-destacado {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--sol-dorado);
  color: var(--sol-oscuro);
  font-size: 0.72rem;
  font-family: var(--font-display);
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-categoria {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sol-rojo);
  font-weight: 700;
}

.card-nombre {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}

.card-colores {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding-top: 10px;
}

.card-precio-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-precio-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.card-precio {
  font-size: 1.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
}

.card-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Link de derivación a revendedores (precio ancla): a propósito NO es un botón
   de compra directa — ver comentario de negocio junto al precio en script.js. */
.card-btn {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: var(--sol-rojo);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: normal;
  cursor: pointer;
}

.card-btn[data-intencion="mayorista"] {
  color: var(--sol-dorado-texto);
}

.card-btn:hover {
  text-decoration: underline;
}

.vacio {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  display: none;
}

/* Footer */
.footer {
  background: var(--sol-oscuro);
  color: rgba(255, 255, 255, 0.85);
  padding: 46px 6% 26px;
  text-align: center;
}

.footer-logo-img {
  height: 72px;
  width: 72px;
  object-fit: contain;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--sol-blanco);
  padding: 6px;
}

.footer p {
  margin: 6px 0;
  font-size: 0.9rem;
}

.footer-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  background: #25d366;
  color: white;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-nav button {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0;
}

.footer-nav button:hover {
  color: var(--sol-dorado-claro);
}

.footer-nota {
  margin-top: 26px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 640px) {
  .nav {
    display: none;
  }
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 48, 71, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.abierto {
  display: flex;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--sol-radio);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.modal p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.modal-cerrar {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

#form-contacto {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#form-contacto label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

#form-contacto input,
#form-contacto select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-weight: 400;
  background: #ffffff;
  color: #1c1210;
}

#form-contacto input:focus,
#form-contacto select:focus {
  outline: none;
  border-color: var(--sol-rojo);
}

.nota-talle {
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.campo-colecciones {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.campo-colecciones-titulo {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.campo-colecciones-nota {
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
}

.colecciones-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.check-coleccion {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 400 !important;
  color: var(--text);
  cursor: pointer;
}

.check-coleccion input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--sol-rojo);
  cursor: pointer;
}

.modal-ayuda {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Efectos: scroll-reveal, carga progresiva, header compacto, micro-interacciones,
   transición entre vistas y lightbox de producto.
   ========================================================================== */

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

/* Scroll-reveal: los elementos aparecen al entrar en pantalla */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Carga progresiva de fotos (blur-up): nítidas recién cuando terminan de cargar */
.foto-progresiva {
  filter: blur(16px);
  transform: scale(1.04);
}

.foto-progresiva.cargada {
  filter: blur(0);
  transform: scale(1);
  transition: filter 0.5s ease, transform 0.5s ease;
}

/* Header que se compacta al scrollear */
.header {
  transition: padding 0.25s ease, box-shadow 0.25s ease;
}

.logo-img {
  transition: height 0.25s ease;
}

.header--compacto {
  padding: 10px 6%;
  box-shadow: 0 4px 16px rgba(28, 18, 16, 0.12);
}

.header--compacto .logo-img {
  height: 42px;
}

/* Feedback táctil al presionar botones */
.btn-primary:active,
.btn-whatsapp:active,
.footer-whatsapp:active,
.card-btn:active,
.filtro-btn:active,
.coleccion-tile:active {
  transform: scale(0.96);
}

/* Transición cruzada entre portada / colección / catálogo completo */
@keyframes vista-fade-out {
  to {
    opacity: 0;
  }
}

.vista-fade-out {
  animation: vista-fade-out 0.18s ease forwards;
}

.vista-fade-in {
  animation: fade-in-up 0.35s ease both;
}

/* Foto de producto: da la pauta de que se puede ampliar */
.card-imagen-wrap {
  cursor: zoom-in;
}

/* Lightbox: ver la foto del producto en grande */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 5, 0.88);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.lightbox-overlay.abierto {
  display: flex;
}

/* Mientras está ampliada, el visor pasa a scroll normal para poder recorrer la foto */
.lightbox-overlay.zoom-activo {
  display: block;
  overflow: auto;
  text-align: center;
  padding: 0;
}

.lightbox-overlay img {
  width: auto;
  height: auto;
  max-width: min(90vw, 720px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: fade-in-up 0.25s ease both;
  cursor: zoom-in;
  touch-action: pinch-zoom;
}

.lightbox-overlay img.zoom {
  max-width: none;
  max-height: none;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  margin: 40px;
  cursor: grab;
}

.lightbox-overlay img.zoom:active {
  cursor: grabbing;
}

.lightbox-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
}

.lightbox-overlay.zoom-activo .lightbox-hint {
  display: none;
}

.lightbox-cerrar {
  position: absolute;
  top: 22px;
  right: 28px;
  border: none;
  background: none;
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
