/* ==========================================================================
   Componentes compartidos: carrito, modales, tarjetas de producto, avisos
   ========================================================================== */
.scrim { position: fixed; inset: 0; z-index: 90; background: rgba(20, 22, 27, .5); opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
.scrim.is-open { opacity: 1; visibility: visible; transition: opacity .3s; }

/* ---------- Carrito lateral ---------- */
.drawer { position: fixed; top: 0; right: 0; z-index: 100; height: 100%; width: min(410px, 100%); background: #fff; display: flex; flex-direction: column; transform: translateX(100%); visibility: hidden; box-shadow: -20px 0 50px rgba(8,36,62,.18); transition: transform .4s var(--ease), visibility 0s .4s; }
.drawer.is-open { transform: none; visibility: visible; transition: transform .4s var(--ease); }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 10px 22px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 18px; }
.drawer__items { flex: 1; overflow: auto; padding: 0 22px; }
.drawer__foot { padding: 18px 22px 22px; border-top: 1px solid var(--line); }
.drawer__total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.drawer__total span:first-child { color: var(--muted); }
.drawer__total strong { font-size: 22px; color: var(--brand); }
.drawer__empty { text-align: center; color: var(--muted); padding: 80px 12px; }
.drawer__empty .ico { font-size: 34px; color: #b4b7c0; margin-bottom: 10px; }

.line { animation: rise .4s var(--ease) both; display: flex; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.line__img { width: 60px; height: 60px; flex: none; border-radius: var(--r-sm); background: var(--soft) center/cover no-repeat; }
.line__name { flex: 1; min-width: 0; line-height: 1.35; }
.line__name b { display: block; margin-top: 4px; font-weight: 700; }
.qty { display: flex; align-items: center; border: 1px solid #c5c7cf; border-radius: var(--r-md); }
.qty button { width: 30px; height: 32px; display: grid; place-items: center; }
.qty button:hover { background: var(--soft); }
.qty span { min-width: 24px; text-align: center; font-weight: 600; }

/* ---------- Modal ----------
   El fondo (backdrop) y el panel son hermanos y el panel va por encima
   (z-index: 1); así un clic dentro del panel nunca llega al fondo. */
.modal { position: fixed; inset: 0; z-index: 110; display: none; place-items: center; padding: 16px; }
.modal.is-open { display: grid; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8, 24, 40, .62); backdrop-filter: blur(3px); animation: fadeIn .3s both; }
.modal__panel { position: relative; z-index: 1; width: 100%; max-width: 1120px; max-height: 94vh; overflow: auto; background: #fff; border-radius: 14px; box-shadow: 0 30px 80px rgba(8, 24, 40, .45); animation: modalIn .45s var(--ease) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }
.modal__close { position: absolute; top: 12px; right: 12px; z-index: 5; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; font-size: 20px; background: #fff; box-shadow: 0 2px 10px rgba(8,36,62,.18); transition: background-color .2s, transform .3s var(--ease); }
.modal__close:hover { background: var(--soft); transform: rotate(90deg); }

/* ---------- Detalle de producto ---------- */
.detail { display: grid; grid-template-columns: 1.15fr 1fr; gap: 44px; padding: 36px; }
.detail > div { min-width: 0; }
.detail__info { animation: rise .6s .12s var(--ease) both; align-self: center; }

/* Galería: pista de fotos que se desliza, flechas, contador y miniaturas */
.gallery__main { position: relative; overflow: hidden; aspect-ratio: 1; border-radius: var(--r-lg); background: var(--soft); touch-action: pan-y; user-select: none; }
.gallery__track { display: flex; height: 100%; transition: transform .55s var(--ease); will-change: transform; }
.gallery__slide { flex: 0 0 100%; height: 100%; background: var(--soft) center/contain no-repeat; }
.gallery__nav { position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.94); color: var(--brand); font-size: 22px; box-shadow: 0 4px 16px rgba(8,36,62,.22); opacity: 0; transition: opacity .25s, transform .25s var(--ease), background-color .2s, color .2s; }
.gallery__nav--prev { left: 12px; transform: translateX(-8px); }
.gallery__nav--next { right: 12px; transform: translateX(8px); }
.gallery__main:hover .gallery__nav, .gallery__nav:focus-visible { opacity: 1; transform: none; }
.gallery__nav:hover { background: var(--brand); color: #fff; }
.gallery__nav:active { transform: scale(.92); }
.gallery__nav .icon { width: 1em; height: 1em; }
.gallery__count { position: absolute; left: 12px; bottom: 12px; z-index: 2; padding: 3px 11px; border-radius: 999px; background: rgba(8,36,62,.72); color: #fff; font-size: 12.5px; font-weight: 600; backdrop-filter: blur(4px); }
.gallery__thumbs { display: flex; gap: 8px; margin-top: 12px; padding-bottom: 4px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin; }
.gallery__thumbs button { flex: none; width: 66px; height: 66px; border-radius: var(--r-sm); background: var(--soft) center/cover no-repeat; border: 2px solid transparent; opacity: .6; transition: opacity .25s, border-color .25s, transform .25s var(--ease); }
.gallery__thumbs button:hover { opacity: 1; transform: translateY(-2px); }
.gallery__thumbs button.is-on { opacity: 1; border-color: var(--brand); }
@media (hover: none) { .gallery__nav { opacity: 1; transform: none; } }

.detail h2 { font-size: 28px; margin: 0 0 12px; padding-right: 36px; }
.line__tag { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.lowstock { display: inline-block; margin-top: 8px; padding: 3px 12px; border-radius: 999px; background: #fbf3dc; color: var(--gold-700); font-size: 13px; font-weight: 600; }
.detail__code { margin: -4px 0 10px; font-size: 13.5px; color: var(--muted); }
.detail__code b { padding: 2px 8px; border-radius: var(--r-sm); background: var(--soft); color: var(--brand); letter-spacing: .03em; }
.detail__price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; }
.detail__price strong { font-size: 34px; letter-spacing: -.02em; color: var(--brand); }
.detail__desc { color: var(--ink-2); line-height: 1.65; white-space: pre-line; margin: 16px 0 24px; }
.detail__desc--general { margin: 16px 0 0; color: var(--ink); }
.detail__desc--general + .detail__desc { margin-top: 10px; }
.soldout { display: inline-block; margin-top: 8px; padding: 3px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Tarjeta de producto ---------- */
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes frameSpin { to { --a: 360deg; } }
/* Marco dorado de línea fina: un destello recorre el borde de cada producto. */
.card { position: relative; display: flex; flex-direction: column; padding: 10px 10px 12px; border-radius: 12px; background: #fff; transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.card::before { content: ""; position: absolute; inset: 0; z-index: 2; padding: 1px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--a), rgba(189,159,78,.45) 0deg, rgba(189,159,78,.45) 200deg, var(--gold-300) 280deg, #fff3c4 320deg, var(--gold-300) 345deg, rgba(189,159,78,.45) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: frameSpin 5s linear infinite; }
.card.in:hover { box-shadow: 0 14px 34px rgba(189,159,78,.22); }
.card:hover::before { animation-duration: 2.4s; }
.card.rv { opacity: 0; transform: translateY(26px); }
.card.rv.in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.card.in:hover { transform: translateY(-5px); transition-delay: 0s; }
.card__open { display: block; width: 100%; text-align: center; }
.card__media { position: relative; display: grid; place-items: center; overflow: hidden; aspect-ratio: 1; border-radius: var(--r-md); background: var(--soft); font-size: 48px; color: #b4b7c0; box-shadow: 0 0 0 rgba(8,36,62,0); transition: box-shadow .45s var(--ease); }
.card__img { position: absolute; inset: 0; background: center/cover no-repeat; transition: transform .8s var(--ease); }
.card:hover .card__media { box-shadow: 0 16px 34px rgba(8,36,62,.18); }
.card:hover .card__img { transform: scale(1.08); }
.card__title { margin-top: 12px; font-size: 14.5px; line-height: 1.35; font-weight: 500; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.card__open:hover .card__title { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.card__price { display: flex; align-items: baseline; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.price { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.price small { font-size: 12.5px; font-weight: 600; margin-right: 3px; color: var(--ink-2); }
.old { font-size: 13px; color: #8b8f9c; text-decoration: line-through; }
.off { font-size: 13px; font-weight: 700; color: var(--accent); }
.add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 38px; margin-top: 10px; border: 1px solid var(--brand); color: var(--brand); border-radius: var(--r-md); font-size: 13.5px; font-weight: 600; transition: background-color .2s, color .2s, transform .2s var(--ease), box-shadow .3s; }
.add .icon { transition: transform .35s var(--ease); }
.add:hover:not(:disabled) { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(13,58,97,.25); }
.add:hover:not(:disabled) .icon { transform: translateX(-2px) rotate(-8deg); }
.add:active:not(:disabled) { transform: scale(.96); }
.add.is-pop { animation: pop .45s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); background: var(--gold); border-color: var(--gold); color: var(--brand-900); } 100% { transform: scale(1); } }
.add:disabled { border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.tag { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 2px 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; background: #fff; color: var(--ink); }
.tag--out { color: var(--muted); }

.empty { grid-column: 1 / -1; text-align: center; padding: 72px 16px; color: var(--muted); }
.empty .ico { font-size: 34px; color: #b4b7c0; margin-bottom: 10px; }
.empty b { display: block; font-size: 18px; color: var(--ink); margin-bottom: 4px; }

/* ---------- Aviso (toast) ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 300; max-width: 90%; transform: translate(-50%, 90px); opacity: 0; pointer-events: none; background: var(--brand-900); color: #fff; padding: 12px 22px; border-radius: 999px; border: 1px solid rgba(214,187,112,.5); box-shadow: 0 12px 30px rgba(8,36,62,.3); font-size: 14px; text-align: center; transition: transform .45s var(--ease), opacity .3s; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 860px) { .detail { grid-template-columns: 1fr; padding: 16px 16px 24px; gap: 22px; } .detail h2 { font-size: 23px; } .gallery__main { border-radius: var(--r-md); } .gallery__thumbs button { width: 56px; height: 56px; } }
