/* ═══════════════════════════════════════════════════════════════
   ENIGME MAGAZINE v2 — Catalogo Revista con Sidebar + Zoom
   La Casa ENIGME — Experiencia Editorial de Lujo
   ═══════════════════════════════════════════════════════════════ */

/* ── TIPOGRAFIA GLOBAL: NEGRITA ── */
.mag, .mag * { font-weight: 700 !important; }
.mag .mag__cover-brand,
.mag .mag__chapter-title { font-weight: 400 !important; }

/* ── LAYOUT PRINCIPAL: SIDEBAR + CATALOGO ── */
.mag {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: #FAF9F6;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}

/* ── SIDEBAR IZQUIERDO ── */
.mag__sidebar {
  background: #F5F0E8;
  border-right: 1px solid #1C1C1C;
  display: flex;
  flex-direction: column;
  padding: 30px 0;
  overflow-y: auto;
}

.mag__sidebar-brand {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  color: #1C1C1C;
  text-align: center;
  padding: 0 20px 25px;
  border-bottom: 1px solid rgba(28,28,28,0.15);
  margin-bottom: 20px;
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.mag__sidebar-section {
  padding: 0;
  list-style: none;
  margin: 0;
}

.mag__sidebar-section li {
  border-bottom: 1px solid rgba(28,28,28,0.06);
}

.mag__sidebar-section button {
  width: 100%;
  text-align: left;
  padding: 14px 25px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(28,28,28,0.5);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.mag__sidebar-section button:hover {
  color: #1C1C1C;
  background: rgba(28,28,28,0.04);
  padding-left: 30px;
}

.mag__sidebar-section button.active {
  color: #1C1C1C;
  background: rgba(28,28,28,0.06);
  border-left: 2px solid #1C1C1C;
}

.mag__sidebar-bottom {
  margin-top: auto;
  padding: 20px 25px;
  border-top: 1px solid rgba(28,28,28,0.08);
}

.mag__sidebar-bottom a {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.5rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(28,28,28,0.35);
  text-decoration: none;
  padding: 8px 0;
  transition: color 0.3s ease;
}

.mag__sidebar-bottom a:hover { color: #1C1C1C; }

/* ── AREA PRINCIPAL (catalogo + nav) ── */
.mag__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 15px 20px;
  height: 100vh;
}

/* ── LIBRO ABIERTO (spread view) ── */
.mag__book {
  width: 100%;
  max-width: 900px;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 90px);
  perspective: 2500px;
  position: relative;
  overflow: hidden;
  border: 2px solid #1C1C1C;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.1);
  border-radius: 3px;
}

/* Lomo central del libro */
.mag__book::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,0.15), rgba(0,0,0,0.05), rgba(0,0,0,0.15));
  z-index: 20;
  pointer-events: none;
}

/* Sombra interna del lomo */
.mag__book::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06) 40%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 60%, transparent);
  z-index: 19;
  pointer-events: none;
}

/* ── CONTENEDOR DE PAGINAS (spread = 2 paginas visibles) ── */
.mag__pages {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* ── PAGINA BASE ── */
.mag__page {
  overflow: hidden;
  background: #FAF9F6;
  display: none;
  min-height: 0;
  border: 1px solid rgba(28,28,28,0.12);
}

.mag__page--left {
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid rgba(0,0,0,0.08);
}

.mag__page--right {
  display: flex;
  flex-direction: column;
  grid-column: 2;
  grid-row: 1;
  border-left: 1px solid rgba(0,0,0,0.08);
}

/* ── ZOOM ── */
.mag__page--zoomed {
  cursor: zoom-out;
  overflow: auto;
}

.mag__page--zoomed > * {
  transform: scale(1.5);
  transform-origin: top left;
  width: 66.67%;
}

.mag__zoom-btn {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: rgba(28,28,28,0.8);
  border: 1px solid rgba(203,170,99,0.3);
  color: #CBAA63;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.mag__zoom-btn:hover {
  background: #CBAA63;
  color: #1C1C1C;
}

.mag__zoom-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* ── ANIMACION (fade para spread) ── */
/* Animations handled by JS toggling display via --left/--right classes */


/* ═══════════════════════════════════════
   PORTADA / CAPITULO / CONTRAPORTADA
   ═══════════════════════════════════════ */

.mag__page--cover,
.mag__page--chapter,
.mag__page--back {
  align-items: center;
  justify-content: center;
  background: #FAF9F6;
  color: #1C1C1C;
  text-align: center;
  padding: 20px;
}

.mag__cover-brand {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  font-weight: 300;
  color: #1C1C1C;
  margin-bottom: 15px;
}

.mag__cover-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.55rem, 1.2vw, 0.7rem);
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #888888;
  font-weight: 400;
  margin-bottom: 30px;
}

.mag__cover-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #1C1C1C, transparent);
  margin-bottom: 25px;
}

.mag__cover-year {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  letter-spacing: 0.4em;
  color: rgba(28,28,28,0.35);
  font-weight: 300;
}

.mag__chapter-kicker {
  font-family: 'Cinzel', serif;
  font-style: italic;
  font-size: clamp(0.65rem, 1.2vw, 0.8rem);
  color: #888888;
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 400;
}

.mag__chapter-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 300;
  margin-bottom: 15px;
}

.mag__chapter-desc {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  line-height: 2;
  color: rgba(28,28,28,0.5);
  max-width: 420px;
  letter-spacing: 1.5px;
  font-weight: 300;
}

.mag__chapter-count {
  margin-top: 25px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.5rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(28,28,28,0.3);
}

.mag__back-logo {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.2rem, 3vw, 2rem);
  letter-spacing: 0.5em;
  color: #1C1C1C;
  margin-bottom: 25px;
  font-weight: 400;
}

.mag__back-links {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.mag__back-links a {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(28,28,28,0.5);
  text-decoration: none;
  padding: 8px 18px;
  border: 1px solid rgba(28,28,28,0.2);
  transition: all 0.3s ease;
}

.mag__back-links a:hover { color: #1C1C1C; border-color: #1C1C1C; }


/* ═══════════════════════════════════════
   PAGINA HERO (1 PRODUCTO)
   ═══════════════════════════════════════ */

/* Hero: vertical layout inside half-page */
.mag__page--hero {
  display: flex;
  flex-direction: column;
  background: #FAF9F6;
}

.mag__hero-img {
  flex: 3;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #F0EEEA;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mag__hero-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.mag__hero-info {
  flex: 2;
  min-height: 0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  position: relative;
  overflow-y: auto;
}

.mag__hero-info .mag__ref {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.45rem;
  letter-spacing: 3px;
  color: #888888;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.mag__hero-info .mag__name {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 2vw, 1.6rem);
  letter-spacing: 0.12em;
  color: #1C1C1C;
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 12px;
}

.mag__hero-info .mag__lema {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.75rem, 1.3vw, 0.95rem);
  line-height: 1.8;
  color: #555555;
  margin-bottom: 15px;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.mag__hero-info .mag__material {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.45rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888888;
  border: 1px solid rgba(216, 195, 188, 0.4);
  padding: 4px 10px;
  margin-bottom: 18px;
  font-weight: 400;
}

.mag__price-block { margin-bottom: 15px; }

.mag__price-old {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.6rem, 1vw, 0.7rem);
  color: #888888;
  text-decoration: line-through;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 3px;
}

.mag__price {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  letter-spacing: 3px;
  color: #1C1C1C;
  font-weight: 700;
}

/* Cart button */
.mag__cart-row {
  display: flex;
  width: 100%;
  max-width: 280px;
  border: 1px solid #1C1C1C;
  height: 38px;
  overflow: hidden;
}

.mag__qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 60px;
  background: #FAFAFA;
  border-right: 1px solid rgba(216, 195, 188, 0.4);
}

.mag__qty button {
  width: 30%; height: 100%; font-size: 0.9rem; color: #888;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; font-family: 'Montserrat', sans-serif;
}
.mag__qty button:hover { color: #1C1C1C; background: rgba(216, 195, 188, 0.2); }

.mag__qty span {
  font-size: 0.65rem; font-weight: 600; color: #1C1C1C;
  flex-grow: 1; text-align: center; font-family: 'Montserrat', sans-serif;
}

.mag__btn-add {
  flex-grow: 1; background: #1C1C1C; color: #FFFFFF;
  font-family: 'Montserrat', sans-serif; font-size: 0.45rem;
  letter-spacing: 2.5px; text-transform: uppercase; font-weight: 600;
  cursor: pointer; transition: all 0.3s ease; border: none; padding: 0 12px;
}
.mag__btn-add:hover { background: #CBAA63; color: #1C1C1C; }
.mag__btn-add.added { background: #CBAA63; color: #1C1C1C; }

/* Fav button */
.mag__btn-fav {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  background: rgba(255,255,255,0.95); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1); z-index: 10; cursor: pointer;
  border: 1px solid rgba(216, 195, 188, 0.4); transition: all 0.3s ease; color: #888;
}
.mag__btn-fav:hover { transform: scale(1.1); color: #1C1C1C; }
.mag__btn-fav svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.mag__btn-fav.active { background: #1C1C1C; border-color: #1C1C1C; }
.mag__btn-fav.active svg { fill: #CBAA63; stroke: #CBAA63; }


/* ═══════════════════════════════════════
   PAGINA DUAL FOTOS (PLATA)
   ═══════════════════════════════════════ */

.mag__page--dual-photo {
  background: #F0EEEA;
}

.mag__dual-img { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #F0EEEA; }
.mag__dual-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.mag__dual-bar {
  grid-column: 1 / -1; grid-row: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #1C1C1C; color: #FFFFFF;
}
.mag__dual-bar .mag__name { font-family: 'Cinzel', serif; font-size: clamp(0.7rem, 1.3vw, 0.9rem); letter-spacing: 0.12em; font-weight: 500; }
.mag__dual-bar .mag__price { font-family: 'Cinzel', serif; font-size: clamp(0.9rem, 1.5vw, 1.2rem); letter-spacing: 2px; color: #CBAA63; font-weight: 700; }


/* ═══════════════════════════════════════
   PAGINA VIDEO (PLATA)
   ═══════════════════════════════════════ */

.mag__page--video {
  background: #0a0a0a;
  overflow: hidden;
}

.mag__video-container {
  position: relative;
  overflow: hidden;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.mag__video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.mag__video-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #1C1C1C; border-top: 1px solid rgba(203,170,99,0.2);
}
.mag__video-bar .mag__name { font-family: 'Cinzel', serif; font-size: clamp(0.65rem, 1.2vw, 0.8rem); letter-spacing: 0.12em; color: #FFFFFF; font-weight: 400; }
.mag__video-bar .mag__cart-row { max-width: 220px; height: 34px; border-color: rgba(203,170,99,0.4); }
.mag__video-bar .mag__btn-add { background: #CBAA63; color: #1C1C1C; font-size: 0.4rem; }
.mag__video-bar .mag__btn-add:hover { background: #FFFFFF; }
.mag__video-bar .mag__qty { background: rgba(255,255,255,0.05); border-right-color: rgba(203,170,99,0.2); }
.mag__video-bar .mag__qty button { color: #CBAA63; }
.mag__video-bar .mag__qty span { color: #FFFFFF; }

.mag__video-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border: 2px solid rgba(203,170,99,0.6); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(5px); transition: all 0.3s ease; z-index: 5;
}
.mag__video-play:hover { background: rgba(203,170,99,0.2); border-color: #CBAA63; transform: translate(-50%, -50%) scale(1.1); }
.mag__video-play svg { width: 20px; height: 20px; fill: #CBAA63; margin-left: 2px; }
.mag__video-play.playing { opacity: 0; pointer-events: none; }


/* Full-image page */
.mag__page--img-full {
  background: #F0EEEA;
  position: relative;
}

.mag__fullimg {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mag__fullimg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mag__fullimg-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 15px;
  background: linear-gradient(transparent, rgba(250,249,246,0.85));
  display: flex;
  align-items: center;
  justify-content: space-between;
}



/* ═══════════════════════════════════════
   NAVEGACION
   ═══════════════════════════════════════ */

.mag__nav {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  flex-shrink: 0;
  background: rgba(250,249,246,0.95);
  backdrop-filter: blur(10px);
  padding: 6px 15px;
  border: 1px solid rgba(28,28,28,0.15);
}

.mag__nav-arrow {
  width: 34px; height: 34px;
  border: 1px solid rgba(28,28,28,0.25); background: #FAF9F6;
  color: #1C1C1C; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.3s ease; font-family: 'Montserrat', sans-serif;
}
.mag__nav-arrow:hover { background: #1C1C1C; color: #FAF9F6; border-color: #1C1C1C; }
.mag__nav-arrow:disabled { opacity: 0.2; cursor: default; pointer-events: none; }
.mag__nav-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.mag__counter {
  font-family: 'Cinzel', serif; font-size: 0.7rem; letter-spacing: 3px;
  color: rgba(28,28,28,0.5); min-width: 70px; text-align: center; user-select: none;
}

/* Click zones */
.mag__click-left, .mag__click-right {
  position: absolute; top: 0; width: 12%; height: 100%; z-index: 5; cursor: pointer;
}
.mag__click-left { left: 0; cursor: w-resize; }
.mag__click-right { right: 0; cursor: e-resize; }

/* Chapter indicator top-center */
.mag__chapter-indicator {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  font-family: 'Cinzel', serif; font-size: 0.5rem; letter-spacing: 3px;
  text-transform: uppercase; color: rgba(28,28,28,0.25); z-index: 10; pointer-events: none;
}


/* ═══════════════════════════════════════
   TOAST
   ═══════════════════════════════════════ */

.mag__dimensions {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.45rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888888;
  display: block;
  margin-top: 4px;
  font-weight: 400;
}

.mag__size {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.45rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888888;
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border: 1px solid rgba(216,195,188,0.4);
  font-weight: 400;
}

.mag__toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(30px);
  background: #1C1C1C; color: #FAF9F6; border: 1px solid #1C1C1C;
  padding: 10px 22px; font-family: 'Montserrat', sans-serif; font-size: 0.5rem;
  letter-spacing: 2px; text-transform: uppercase; font-weight: 600;
  z-index: 900; opacity: 0; transition: all 0.3s ease; pointer-events: none;
}
.mag__toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ═══════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
  .mag {
    grid-template-columns: 110px 1fr;
  }

  .mag__sidebar { padding: 12px 0; }
  .mag__sidebar-brand { font-size: 0.6rem; letter-spacing: 0.12em; padding: 0 8px 12px; }
  .mag__sidebar-section button { font-size: 0.38rem; letter-spacing: 1.5px; padding: 9px 10px; }
  .mag__sidebar-bottom { padding: 12px 10px; }
  .mag__sidebar-bottom a { font-size: 0.38rem; padding: 5px 0; }

  .mag__main { padding: 5px; }
  .mag__book { max-height: none; }
  .mag__book::after, .mag__book::before { display: none; }

  /* Mobile: single page view, not spread */
  .mag__pages { grid-template-columns: 1fr; }

  /* Images full, no padding */
  .mag__hero-img img { padding: 0; }
  .mag__dual-img img { padding: 0; }

  .mag__hero-info { padding: 10px 12px; align-items: center; text-align: center; }
  .mag__hero-info .mag__name { text-align: center; font-size: clamp(0.85rem, 3.5vw, 1.1rem); }
  .mag__hero-info .mag__lema { font-size: 0.65rem; line-height: 1.5; }
  .mag__cart-row { max-width: 100%; }

  .mag__video-bar { flex-direction: column; gap: 6px; padding: 8px 10px; }
  .mag__video-bar .mag__cart-row { max-width: 100%; }


  /* Mobile: slide instead of 3D flip */
  @keyframes magFlipOut { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(-100%); opacity: 0; } }
  @keyframes magFlipIn { 0% { transform: translateX(100%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
  @keyframes magFlipOutRev { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(100%); opacity: 0; } }
  @keyframes magFlipInRev { 0% { transform: translateX(-100%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }

  .mag__cover-brand { font-size: clamp(1.6rem, 7vw, 2.2rem); letter-spacing: 0.3em; }
  .mag__chapter-title { font-size: clamp(1.3rem, 5vw, 1.8rem); }
}
