/**
 * Carrito BICM Servicios — MISMO componente que bicm-main usa en /editorial/
 * (mismas clases .bicm-cart-*, mismas curvas de animación --smooth), solo
 * con --green como acento en vez de --teal, para diferenciar esta tienda
 * del resto del sitio. Ver page-editorial.php (MAIN/bicm-main) — origen.
 *
 * Reemplaza por completo al cajón viejo (.cart-drawer/.drawer-*), que vivía
 * en un localStorage propio desincronizado del carrito real de WooCommerce.
 */

/* ══════════════════════ BOTÓN FLOTANTE ══════════════════════
   Cajón anclado abajo a la izquierda, no un modal centrado: se abre solo
   al agregar algo y deja seguir navegando la página detrás. El botón
   flotante vive en la misma esquina para que el cajón nazca de él. */
.bicm-cart-fab {
  position: fixed; left: clamp(14px,2vw,32px); bottom: clamp(14px,2vw,32px); z-index: 640;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border: 0; background: #000; color: #fff; cursor: pointer;
  font-family: var(--font); font-size: clamp(12px,.95vw,14px); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.45);
  transform-origin: left bottom;
  transition: background .3s ease, transform .4s var(--smooth), opacity .3s ease;
}
.bicm-cart-fab:hover, .bicm-cart-fab:focus-visible { background: var(--green); transform: translateY(-2px); }
.bicm-cart-fab[hidden] { display: none; }
/* Al abrir el cajón el botón se retira hacia abajo: el cajón lo sustituye. */
body.bicm-cart-open .bicm-cart-fab { opacity: 0; transform: translateY(8px) scale(.97); pointer-events: none; }
.bicm-cart-fab__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--green); color: #fff; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bicm-cart-fab:hover .bicm-cart-fab__count { background: #fff; color: #000; }
/* Latido al sumar una pieza: confirma la acción sin robar la atención. */
.bicm-cart-fab__count.is-bump { animation: bicmCartBump .38s var(--smooth); }
@keyframes bicmCartBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ══════════════════════ CAJÓN ══════════════════════
   Velo tenue: solo insinúa la profundidad, no bloquea la lectura. */
.bicm-cart-drawer {
  position: fixed; inset: 0; z-index: 645;
  background: rgba(8,8,8,.28);
  opacity: 0; pointer-events: none;
  transition: opacity .4s var(--smooth);
}
.bicm-cart-drawer.is-open { opacity: 1; pointer-events: auto; }

.bicm-cart-box {
  position: fixed; left: clamp(14px,2vw,32px); bottom: clamp(14px,2vw,32px);
  width: min(420px, calc(100vw - clamp(28px,4vw,64px)));
  max-height: min(76vh, 720px);
  display: flex; flex-direction: column;
  background: #fff; color: #000;
  padding: clamp(22px,2.4vw,32px);
  box-shadow: 0 30px 80px -16px rgba(0,0,0,.5);
  transform-origin: left bottom;
  /* Nace del botón: sube desde su posición y escala. */
  transform: translateY(14px) scale(.985); opacity: 0;
  transition: transform .45s var(--smooth), opacity .3s ease;
}
.bicm-cart-drawer.is-open .bicm-cart-box { transform: none; opacity: 1; }

.bicm-cart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex: 0 0 auto; }
.bicm-cart-title {
  margin: 0; font-size: clamp(20px,1.9vw,26px); font-weight: 700; letter-spacing: -.03em; text-transform: uppercase;
}
.bicm-cart-close {
  border: 0; background: transparent; color: #000; cursor: pointer; padding: 4px;
  font-family: var(--font); font-size: clamp(11px,.85vw,13px); font-weight: 700; letter-spacing: .045em; text-transform: uppercase;
  opacity: .5; transition: opacity .2s ease;
}
.bicm-cart-close:hover, .bicm-cart-close:focus-visible { opacity: 1; }

/* Zona con scroll propio: la cabecera y el pie quedan siempre visibles. */
.bicm-cart-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 calc(clamp(22px,2.4vw,32px) * -1); padding: 0 clamp(22px,2.4vw,32px);
}
.bicm-cart-scroll::-webkit-scrollbar { width: 3px; }
.bicm-cart-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); }

.bicm-cart-items { margin-top: clamp(14px,1.6vw,20px); display: flex; flex-direction: column; }
.bicm-cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid rgba(0,0,0,.09);
  animation: bicmCartItemIn .38s var(--smooth) both;
}
@keyframes bicmCartItemIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}
.bicm-cart-item__img {
  width: 44px; height: 44px; flex: 0 0 auto; overflow: hidden; background: #f2f2f2;
}
.bicm-cart-item__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bicm-cart-item__info { flex: 1 1 auto; min-width: 0; }
.bicm-cart-item__title {
  font-size: clamp(13px,1vw,15px); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; line-height: 1.2;
}
.bicm-cart-item__meta { font-size: .8em; color: #999; margin-top: 2px; }
.bicm-cart-item__price { font-size: .86em; color: #777; margin-top: 3px; font-variant-numeric: tabular-nums; }
.bicm-cart-item__remove {
  border: 0; background: transparent; color: #bbb; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 4px; flex: 0 0 auto;
  transition: color .2s ease, transform .3s var(--smooth);
}
.bicm-cart-item__remove:hover { color: #000; transform: rotate(90deg); }

/* Datos que una línea pide antes de pagar (ej. nombre del seleccionado).
   Van debajo del renglón, a todo el ancho del cajón. */
.bicm-cart-item { flex-wrap: wrap; }
.bicm-cart-item__fields { flex: 1 0 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.bicm-cart-field span {
  display: block; margin-bottom: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #777;
}
.bicm-cart-field input {
  width: 100%; padding: 10px 12px; border: 1px solid rgba(0,0,0,.2);
  font-family: var(--font); font-size: 14px; background: #fff; color: #000;
}
.bicm-cart-field input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
/* Falta un dato: el botón se ve apagado, pero sigue respondiendo al clic para
   poder decirle al cliente qué falta (un botón deshabilitado no explica nada). */
.bicm-cart-checkout.is-blocked { opacity: .55; }

/* ══════════════════════ AVISO AL VOLVER DE STRIPE ══════════════════════
   Portado tal cual de /editorial/ (bicm-main), con --green en vez de --teal:
   velo con desenfoque, caja blanca que sube y se asienta, texto en cascada. */
.bicm-return-panel {
  position: fixed; inset: 0; z-index: 700; display: flex; align-items: center; justify-content: center;
  padding: clamp(16px,3vw,56px);
  background: rgba(8,8,8,.62);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
  opacity: 0; pointer-events: none;
  transition: opacity .4s var(--smooth);
}
.bicm-return-panel.is-open { opacity: 1; pointer-events: auto; }
.bicm-return-panel[hidden] { display: none; }
.bicm-return-box {
  position: relative; width: min(560px, 100%);
  background: #fff; color: #000; padding: clamp(30px,3.6vw,56px);
  box-shadow: 0 40px 100px -20px rgba(0,0,0,.55);
  transform: translateY(14px) scale(.99);
  transition: transform .5s var(--smooth);
}
.bicm-return-panel.is-open .bicm-return-box { transform: none; }
.bicm-return-body { display: flex; flex-direction: column; min-width: 0; }
.bicm-return-body > * { opacity: 0; transform: translateY(8px); }
.bicm-return-panel.is-open .bicm-return-body > * {
  opacity: 1; transform: none;
  transition: opacity .4s ease, transform .45s var(--smooth);
}
.bicm-return-panel.is-open .bicm-return-body > *:nth-child(1) { transition-delay: .08s; }
.bicm-return-panel.is-open .bicm-return-body > *:nth-child(2) { transition-delay: .12s; }
.bicm-return-panel.is-open .bicm-return-body > *:nth-child(3) { transition-delay: .16s; }
.bicm-return-panel.is-open .bicm-return-body > *:nth-child(4) { transition-delay: .20s; }
.bicm-return-label {
  margin: 0; font-size: clamp(10px,.78vw,13px); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--green);
}
.bicm-return-panel.is-error .bicm-return-label { color: #000; }
.bicm-return-title {
  margin: clamp(8px,.9vw,14px) 0 0;
  font-size: clamp(26px,3vw,42px); font-weight: 700; letter-spacing: -.03em; line-height: .95; text-transform: uppercase;
}
.bicm-return-text {
  margin: clamp(12px,1.4vw,20px) 0 0;
  font-size: clamp(13px,1vw,15px); font-weight: 500; line-height: 1.55;
  letter-spacing: .045em; text-transform: uppercase; color: #444;
}
.bicm-return-btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: clamp(18px,2.1vw,28px); padding: clamp(14px,1.4vw,20px) 16px;
  border: 0; background: var(--green); color: #fff; cursor: pointer;
  font-family: var(--font);
  font-size: clamp(13px,1vw,16px); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  transition: color .3s ease, transform .3s var(--smooth);
}
.bicm-return-panel.is-error .bicm-return-btn { background: #000; }
.bicm-return-btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: #000;
  transform: translateY(101%); transition: transform .38s var(--smooth);
}
.bicm-return-panel.is-error .bicm-return-btn::before { background: var(--green); }
.bicm-return-btn:hover::before, .bicm-return-btn:focus-visible::before { transform: none; }
.bicm-return-btn:active { transform: scale(.985); }
@media (max-width: 720px) {
  .bicm-return-box { max-height: 88vh; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .bicm-return-panel, .bicm-return-box, .bicm-return-body > *,
  .bicm-return-btn, .bicm-return-btn::before { transition: none !important; }
  .bicm-return-body > * { opacity: 1 !important; transform: none !important; }
}
.bicm-cart-empty { margin-top: clamp(14px,1.6vw,20px); color: #777; font-size: clamp(13px,1vw,15px); line-height: 1.5; }
.bicm-cart-empty[hidden] { display: none; }

.bicm-cart-foot { flex: 0 0 auto; padding-top: clamp(14px,1.6vw,18px); }
.bicm-cart-total {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-top: 0; padding-top: clamp(12px,1.4vw,16px); border-top: 2px solid #000;
  font-size: clamp(18px,1.7vw,24px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.bicm-cart-total[hidden] { display: none; }
.bicm-cart-total small { font-size: clamp(10px,.75vw,12px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #777; }

/* Botón principal: el barrido de color entra desde abajo en vez de un
   cambio de fondo seco — el mismo gesto en todo el sitio. */
.bicm-cart-checkout {
  position: relative; overflow: hidden; isolation: isolate; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: clamp(16px,1.9vw,26px); padding: clamp(14px,1.4vw,20px) 16px;
  border: 0; background: var(--green); color: #fff; cursor: pointer;
  font-family: var(--font);
  font-size: clamp(13px,1vw,16px); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  transition: color .3s ease, transform .3s var(--smooth);
}
.bicm-cart-checkout::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: #000;
  transform: translateY(101%); transition: transform .38s var(--smooth);
}
.bicm-cart-checkout:hover::before, .bicm-cart-checkout:focus-visible::before { transform: none; }
.bicm-cart-checkout:active { transform: scale(.985); }
.bicm-cart-checkout[hidden] { display: none; }
.bicm-cart-checkout[disabled] { background: rgba(0,0,0,.09); color: rgba(0,0,0,.4); cursor: default; transform: none; }
.bicm-cart-checkout[disabled]::before { display: none; }

.bicm-cart-status { margin-top: clamp(10px,1.2vw,16px); font-size: clamp(12px,.95vw,14px); line-height: 1.4; }
.bicm-cart-status[hidden] { display: none; }
.bicm-cart-status.is-error { color: var(--red); }
.bicm-cart-status.is-ok { color: var(--green); font-weight: 700; }

/* Selector de cantidad dentro de cada fila del carrito. */
.bicm-qty__control { display: flex; align-items: center; border: 1px solid rgba(0,0,0,.25); flex: 0 0 auto; }
.bicm-qty__btn { width: 28px; height: 28px; border: 0; background: #fff; cursor: pointer; font-size: 15px; line-height: 1; font-family: var(--font); }
.bicm-qty__btn:hover { background: rgba(116,183,67,.1); }
.bicm-qty__btn:disabled { opacity: .3; pointer-events: none; }
.bicm-qty__value { min-width: 26px; text-align: center; font-size: 13px; font-family: var(--font); }
/* Cantidad sin controles: productos "vendidos individualmente" (ej. la cuota
   de impresión, que lleva el nombre de UN seleccionado). */
.bicm-qty__fixed {
  min-width: 28px; text-align: center; font-size: 13px; font-family: var(--font);
  color: #777; flex: 0 0 auto;
}

/* ══════════════════════ PÁGINA DE PRODUCTO ══════════════════════
   Dos columnas (imagen / datos) con el mismo lenguaje del resto del
   sitio. Vive aquí y no en style.css porque reusa .bicm-cart-checkout
   y .bicm-cart-status como botón y aviso. */
/* Contenedor: el header es fixed (4rem), igual que en .tienda-page,
   .bicm-page y .cart-page. Esta clase no tenía regla y el header tapaba
   el inicio del contenido. */
.producto-page { min-height: 100vh; padding-top: 4rem; background: #fff; }

.bicm-producto {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(20px,3.5vw,56px) clamp(24px,4vw,64px);
  padding: clamp(24px,4vw,56px) 1.5rem clamp(48px,6vw,96px);
  align-items: start;
}
@media (min-width: 768px) { .bicm-producto { padding-left: 3rem; padding-right: 3rem; } }

/* Volver a la tienda: el producto vive dentro de Tienda, y sin esto la
   única salida era el botón "atrás" del navegador. */
.bicm-producto-back {
  grid-column: 1 / -1; justify-self: start;
  display: inline-flex; align-items: center; gap: .5em; min-height: 44px;
  font-size: clamp(11px,.8vw,13px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(0,0,0,.5); text-decoration: none; transition: color .2s ease;
}
.bicm-producto-back svg { width: 1.1em; height: 1.1em; transition: transform .25s var(--smooth); }
.bicm-producto-back:hover, .bicm-producto-back:focus-visible { color: #000; }
.bicm-producto-back:hover svg, .bicm-producto-back:focus-visible svg { transform: translateX(-3px); }

/* La imagen se ve COMPLETA (contain): las fotos de WooCommerce son
   cuadradas, y en 4/5 con cover se perdían los lados — el mismo criterio
   que ya se aplicó a las portadas de catálogo en bicm-main. */
.bicm-producto-media { position: relative; background: #f2f2f2; aspect-ratio: 1/1; overflow: hidden; }
.bicm-producto-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bicm-producto-media-vacia { width: 100%; height: 100%; background: rgba(0,0,0,.05); }
.bicm-producto-info { display: flex; flex-direction: column; min-width: 0; }
/* Pesos a 700: Gill Sans no tiene 800 ni 900, el navegador los falsificaba. */
.bicm-producto-title {
  font-size: clamp(28px,3.4vw,48px); font-weight: 700; line-height: .95;
  letter-spacing: -.03em; text-transform: uppercase; margin: .5rem 0 0;
}
.bicm-producto-price {
  font-size: clamp(24px,2.4vw,34px); font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-bottom: 1.25rem;
}
.bicm-producto-price del { opacity: .4; font-weight: 500; margin-right: .4em; }
/* Cuerpo a la escala de contenido del sitio (.bicm-text de main). */
.bicm-producto-desc {
  font-size: clamp(14px,1.15vw,16px); font-weight: 500; letter-spacing: .012em;
  color: rgba(0,0,0,.6); line-height: 1.65; margin-bottom: 1.75rem;
}
.bicm-producto-desc p { margin-bottom: .875rem; }
.bicm-producto-agotado { font-size: clamp(14px,1.15vw,16px); color: rgba(0,0,0,.45); }

/* Campos que pide el producto antes de agregarse (ej. nombre del seleccionado).
   Etiqueta con la escala de rótulos de main; campo de esquina recta como el
   resto de controles del sitio (el selector de cantidad del carrito tampoco
   lleva radio). 16px en el campo: iOS hace zoom automático al enfocar
   cualquier input con letra menor a 16px. */
.bicm-producto-campos { display: flex; flex-direction: column; gap: .875rem; margin-bottom: 1.25rem; }
.bicm-producto-campo label {
  display: block; font-size: clamp(11px,.8vw,13px); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(0,0,0,.5); margin-bottom: .375rem;
}
.bicm-producto-campo input {
  width: 100%; padding: .8rem .875rem; border: 1px solid rgba(0,0,0,.2);
  border-radius: 0; font-family: inherit; font-size: 16px; background: #fff;
  transition: border-color .2s ease;
}
.bicm-producto-campo input:hover { border-color: rgba(0,0,0,.4); }
.bicm-producto-campo input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.bicm-producto-add { margin-top: 0; }
.bicm-producto-status { margin-top: .75rem; }

/* Formulario nativo de WooCommerce (productos variables): se le da el mismo
   aire, ya que los estilos del plugin están desactivados en este tema. */
.bicm-producto-info form.cart { display: flex; flex-direction: column; gap: .875rem; }
/* Mismo trato que .bicm-producto-campo: esquina recta, 16px (sin zoom de
   iOS), rótulos a la escala de main en vez de 10px con peso 800 falsificado. */
.bicm-producto-info form.cart .quantity input {
  width: 5rem; padding: .7rem .5rem; text-align: center;
  border: 1px solid rgba(0,0,0,.2); border-radius: 0; font-family: inherit; font-size: 16px;
}
.bicm-producto-info form.cart table.variations { width: 100%; border-collapse: collapse; }
.bicm-producto-info form.cart table.variations th,
.bicm-producto-info form.cart table.variations td { display: block; text-align: left; padding: 0 0 .5rem; }
.bicm-producto-info form.cart table.variations label {
  font-size: clamp(11px,.8vw,13px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(0,0,0,.5);
}
.bicm-producto-info form.cart select {
  width: 100%; padding: .75rem .75rem; border: 1px solid rgba(0,0,0,.2);
  border-radius: 0; font-family: inherit; font-size: 16px; background: #fff; cursor: pointer;
}

/* Aviso bajo la descripción (ej. "te pediremos el nombre al pagar"). */
.bicm-producto-nota {
  margin: -.75rem 0 1.5rem; padding: .75rem .9rem;
  border-left: 3px solid var(--green); background: rgba(116,183,67,.07);
  font-size: clamp(13px,1vw,15px); font-weight: 500; line-height: 1.5; color: rgba(0,0,0,.7);
}
.bicm-producto-info form.cart button.single_add_to_cart_button {
  align-self: flex-start; padding: clamp(14px,1.4vw,20px) 28px;
  border: 0; background: var(--green); color: #fff; cursor: pointer;
  font-family: var(--font); font-size: clamp(13px,1vw,16px);
  font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  transition: background .3s ease, transform .3s var(--smooth);
}
.bicm-producto-info form.cart button.single_add_to_cart_button:hover { background: #000; }
.bicm-producto-info form.cart button.single_add_to_cart_button:active { transform: scale(.985); }

@media (max-width: 860px) {
  .bicm-producto { grid-template-columns: 1fr; }
  /* 1/1 completo como en escritorio, con tope para que en tableta a una
     columna no se vuelva un cuadrado de 700px. */
  .bicm-producto-media { max-width: 560px; }
}

@media (max-width: 640px) {
  /* En móvil el cajón toma todo el ancho y se apoya en el borde inferior:
     el gesto natural del pulgar queda sobre el botón de pedido. */
  .bicm-cart-box {
    left: 0; right: 0; bottom: 0;
    width: 100%; max-height: 86vh;
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    transform-origin: center bottom;
    transform: translateY(100%); opacity: 1;
  }
  .bicm-cart-drawer.is-open .bicm-cart-box { transform: none; }
  .bicm-cart-scroll { margin: 0 -18px; padding: 0 18px; }
  .bicm-cart-fab { left: 50%; transform: translateX(-50%); bottom: 18px; }
  .bicm-cart-fab:hover, .bicm-cart-fab:focus-visible { transform: translateX(-50%) translateY(-2px); }
  body.bicm-cart-open .bicm-cart-fab { transform: translateX(-50%) translateY(12px) scale(.94); }
}

/* Sin movimiento: todo aparece ya colocado, sin transiciones ni resortes. */
@media (prefers-reduced-motion: reduce) {
  .bicm-cart-drawer, .bicm-cart-box, .bicm-cart-fab, .bicm-cart-checkout,
  .bicm-cart-checkout::before, .bicm-cart-item__remove {
    transition: none !important;
  }
  .bicm-cart-item, .bicm-cart-fab__count.is-bump { animation: none !important; }
}
