/* ==========================================================================
   Black Friday 2026 · Talleres Palmosauto · 055 Creative (23/11/2026)
   Sección de la portada (#black-friday) + popup (lo crea black-friday.js).
   Ofertas: documento del taller «Ofertas del taller (26-10)» y rótulos del
   reel 05 Black Friday. En las ofertas no se usa «revisión» (equipo, 05/11).
   Para quitarlo todo: borrar la <section id="black-friday"> de index.html y
   las líneas de black-friday.css / black-friday.js de cada página.
   Movimiento (Emil Kowalski): solo transform y opacity, ease-out fuerte,
   entrada 260 ms y salida más rápida (160 ms); con movimiento reducido, solo opacidad.
   ========================================================================== */

:root {
  --bf-red: var(--rd-red, #d7141c);
  --bf-night: var(--rd-night, #0b0c0e);
  --bf-ease: cubic-bezier(.23, 1, .32, 1);
}

/* ---------- Sello «flash» (petición de Manuel, 11/11: ofertas con un flash) ---------- */
.bf-flash {
  position: relative; display: inline-grid; place-items: center;
  width: var(--bf-flash, 7.5rem); aspect-ratio: 1;
  color: #fff; font-family: var(--font-display); line-height: .9; text-align: center;
  rotate: -10deg; flex: none;
}
.bf-flash::before {
  content: ""; position: absolute; inset: 0; background: var(--bf-red);
  clip-path: polygon(50% 0%, 58% 12%, 72% 4%, 74% 19%, 89% 16%, 84% 30%, 98% 35%, 88% 46%, 100% 56%, 86% 63%, 93% 77%, 78% 78%, 77% 93%, 63% 87%, 54% 100%, 45% 88%, 31% 96%, 28% 81%, 13% 84%, 17% 69%, 2% 63%, 13% 52%, 0% 42%, 14% 35%, 8% 21%, 23% 20%, 24% 5%, 38% 12%);
}
.bf-flash span { position: relative; font-size: calc(var(--bf-flash, 7.5rem) * .26); letter-spacing: .01em; }

/* ---------- Sección de la portada ---------- */
#black-friday {
  background: var(--bf-night); color: #fff;
  padding-block: clamp(5rem, 10vw, 8.5rem);
}
#black-friday .bf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 3rem; }
#black-friday h2 {
  font-family: var(--font-display); font-weight: 400; line-height: .88;
  font-size: var(--rd-t-display, clamp(3.4rem, 8.4vw, 9rem)); letter-spacing: -.005em; margin: 0;
}
#black-friday h2 .bf-rojo { color: var(--bf-red); }
#black-friday h2 small { display: block; font-size: .42em; color: #fff; margin-top: .35em; }
#black-friday .bf-intro { max-width: 34ch; font-size: var(--rd-t-lead, 1.25rem); line-height: 1.45; color: rgb(255 255 255 / .9); margin: 0; }

.bf-lista { list-style: none; margin: clamp(3rem, 6vw, 4.5rem) 0 0; padding: 0; display: grid; gap: 1px; background: rgb(255 255 255 / .16); grid-template-columns: repeat(3, 1fr); }
.bf-lista > li { background: var(--bf-night); padding: 2rem clamp(1.25rem, 2.4vw, 2.25rem) 2.25rem; display: flex; flex-direction: column; gap: .9rem; }
.bf-lista > li:first-child { padding-left: 0; }
.bf-lista > li:last-child { padding-right: 0; }
.bf-si { font-size: var(--rd-t-small, .875rem); color: rgb(255 255 255 / .78); margin: 0; }
.bf-que { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 3vw, 2.75rem); line-height: .95; margin: 0; }
.bf-regalo { font-size: var(--rd-t-body, 1.0625rem); line-height: 1.5; color: #fff; margin: 0; }
.bf-regalo strong { color: #fff; background: var(--bf-red); padding: 0 .3em; font-weight: 600; }

/* La del limpiaparabrisas, destacada (Manuel: «especial hincapié… con un flash») */
.bf-lista > li.bf-top { position: relative; }
.bf-top .bf-fila { display: flex; align-items: center; gap: 1rem; }
.bf-top .bf-flash { --bf-flash: 6.5rem; margin-top: -.5rem; }
.bf-mes { display: inline-block; align-self: flex-start; background: #fff; color: var(--bf-night); font-weight: 600; font-size: var(--rd-t-small, .875rem); padding: .2rem .6rem; }

.bf-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.bf-nota { font-size: var(--rd-t-small, .875rem); color: rgb(255 255 255 / .78); margin: 0; }

/* Botón propio (misma forma que los de la web: esquina cortada) */
.bf-btn {
  --cut: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 3.5rem; padding: 0 1.75rem;
  background: var(--bf-red); color: #fff; font-weight: 600; font-size: 1rem; text-decoration: none;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  transition: transform 160ms var(--bf-ease), background-color 200ms ease;
}
.bf-btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
.bf-btn:active { transform: scale(.97); }
.bf-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.bf-btn-linea { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; clip-path: none; }
@media (hover: hover) and (pointer: fine) {
  .bf-btn:hover { background: #b3101a; }
  .bf-btn-linea:hover { background: rgb(255 255 255 / .08); }
}

@media (max-width: 900px) {
  .bf-lista { grid-template-columns: 1fr; background: none; gap: 0; }
  .bf-lista > li, .bf-lista > li:first-child, .bf-lista > li:last-child { padding: 1.75rem 0; border-top: 1px solid rgb(255 255 255 / .16); }
  .bf-top .bf-flash { --bf-flash: 5.5rem; }
}

/* ---------- Popup v2 (27/11/2026) ----------
   Se ve una vez por visita: admite una entrada con gracia (Emil: «rare/first-time
   → can add delight»), pero solo transform, opacity, clip-path y un blur pequeño.
   Orden: caja 0 ms → barra roja 120 → «Black» 180 → «Friday» 250 → ofertas 320/380/440
   → sello 560 (rebote y chispas) → botones 600/660 → brillo del botón 1,1 s.
   Salida: 180 ms, todo junto. Con movimiento reducido, solo opacidad. */
.bf-dialog {
  --e-out: cubic-bezier(.23, 1, .32, 1);
  --e-pop: cubic-bezier(.34, 1.56, .64, 1); /* rebote corto */
  width: min(32rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem);
  padding: 0; border: 0; margin: auto; overflow: auto; overscroll-behavior: contain;
  background: var(--bf-night); color: #fff;
  box-shadow: 0 40px 90px -30px rgb(0 0 0 / .8), 0 0 0 1px rgb(255 255 255 / .08);
  opacity: 0; transform: translateY(28px) scale(.94); filter: blur(8px);
}
@supports (transition-timing-function: linear(0, 1)) {
  .bf-dialog { --e-pop: linear(0, .006, .025 2.8%, .101 6.1%, .539 18.9%, .721 25.3%, .849 31.5%, .937 38.1%, .968 41.8%, .991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.9%, 1); }
}
.bf-dialog.is-open {
  opacity: 1; transform: none; filter: none;
  transition: opacity 320ms var(--e-out), transform 520ms var(--e-pop), filter 420ms var(--e-out);
}
.bf-dialog.is-open.is-closing {
  opacity: 0; transform: translateY(10px) scale(.97);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}
.bf-dialog::backdrop { background: rgb(11 12 14 / 0); backdrop-filter: blur(0); transition: background-color 300ms ease-out, backdrop-filter 300ms ease-out; }
.bf-dialog.is-open::backdrop { background: rgb(11 12 14 / .66); backdrop-filter: blur(6px); }
.bf-dialog.is-open.is-closing::backdrop { background: rgb(11 12 14 / 0); backdrop-filter: blur(0); transition-duration: 180ms; }

/* Caja: grano y un resplandor rojo, como las portadas negras de los posts */
.bf-caja {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 2.5rem 1.75rem 1.75rem;
  background:
    radial-gradient(120% 70% at 100% 0%, rgb(215 20 28 / .28), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Barra roja de arriba: se dibuja de izquierda a derecha */
.bf-caja::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--bf-red);
  transform-origin: left; transform: scaleX(0);
}
.bf-dialog.is-open .bf-caja::before { transform: none; transition: transform 700ms var(--e-out) 120ms; }

.bf-cerrar {
  position: absolute; top: .6rem; right: .5rem; z-index: 2; width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer;
  opacity: 0; transition: transform 160ms var(--bf-ease), background-color 200ms ease, opacity 300ms ease;
}
.bf-dialog.is-open .bf-cerrar { opacity: 1; transition-delay: 0ms, 0ms, 400ms; }
.bf-cerrar svg { width: 1.4rem; height: 1.4rem; transition: transform 300ms var(--e-out); }
.bf-cerrar:active { transform: scale(.9); }
.bf-cerrar:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
@media (hover: hover) and (pointer: fine) {
  .bf-cerrar:hover { background: rgb(255 255 255 / .1); }
  .bf-cerrar:hover svg { transform: rotate(90deg); }
}

/* Titular: cada palabra sube desde una máscara */
.bf-dialog .bf-titulo { font-family: var(--font-display); font-weight: 400; font-size: clamp(3.4rem, 14vw, 4.75rem); line-height: .88; margin: 0; padding-right: 2.5rem; }
.bf-dialog .bf-titulo .bf-rojo { color: var(--bf-red); }
.bf-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .06em; margin-bottom: -.06em; }
.bf-w > span { display: inline-block; transform: translateY(105%); }
.bf-dialog.is-open .bf-w > span { transform: none; transition: transform 640ms var(--e-out) 180ms; }
.bf-dialog.is-open .bf-w + .bf-w > span { transition-delay: 250ms; }

/* Lo que entra escalonado */
.bf-dialog .bf-sub, .bf-dialog li, .bf-dialog .bf-btn, .bf-dialog .bf-nota { opacity: 0; transform: translateY(12px); }
.bf-dialog.is-open .bf-sub, .bf-dialog.is-open li, .bf-dialog.is-open .bf-btn, .bf-dialog.is-open .bf-nota {
  opacity: 1; transform: none;
  transition: opacity 420ms var(--e-out) var(--d, 0ms), transform 520ms var(--e-out) var(--d, 0ms);
}
.bf-dialog .bf-sub { --d: 260ms; }
.bf-dialog li:nth-child(1) { --d: 320ms; }
.bf-dialog li:nth-child(2) { --d: 380ms; }
.bf-dialog li:nth-child(3) { --d: 440ms; }
.bf-dialog .bf-btn { --d: 600ms; }
.bf-dialog .bf-btn + .bf-btn { --d: 660ms; }
.bf-dialog .bf-nota { --d: 720ms; }
/* Al pulsar, el botón responde al momento (sin el retraso de la entrada) */
.bf-dialog.is-open .bf-btn { transition: opacity 420ms var(--e-out) var(--d), transform 160ms var(--bf-ease), background-color 200ms ease; }
.bf-dialog.is-open .bf-btn:active { transform: scale(.97); }

.bf-dialog .bf-sub { margin: .7rem 0 0; font-size: 1rem; color: rgb(255 255 255 / .85); }
.bf-dialog ul { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.bf-dialog li { padding: .9rem 0; border-top: 1px solid rgb(255 255 255 / .16); font-size: 1rem; line-height: 1.4; }
.bf-dialog li b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1; margin-bottom: .2rem; }
.bf-dialog li.bf-top { display: flex; align-items: center; gap: 1rem; }
.bf-dialog .bf-acciones { display: grid; gap: .6rem; margin-top: 1.35rem; }
.bf-dialog .bf-nota { margin-top: .9rem; }

/* Sello «Gratis»: cae girando con rebote, suelta chispas y luego la estrella gira despacio */
.bf-dialog li.bf-top .bf-flash { --bf-flash: 4.8rem; transform: scale(.35) rotate(-50deg); opacity: 0; }
.bf-dialog.is-open li.bf-top .bf-flash { transform: none; opacity: 1; transition: transform 620ms var(--e-pop) 560ms, opacity 160ms ease-out 560ms; }
.bf-dialog.is-open .bf-flash::before { animation: bf-gira 24s linear 1.2s infinite; }
@keyframes bf-gira { to { transform: rotate(360deg); } }
.bf-chispas { position: absolute; inset: 0; pointer-events: none; }
.bf-chispas i {
  position: absolute; left: 50%; top: 50%; width: 4px; height: 12px; margin: -6px 0 0 -2px; border-radius: 2px;
  background: #fff; opacity: 0;
}
.bf-chispas i:nth-child(odd) { background: var(--bf-red); height: 9px; }
.bf-chispas i:nth-child(1) { --a: 0deg; }   .bf-chispas i:nth-child(2) { --a: 45deg; }
.bf-chispas i:nth-child(3) { --a: 90deg; }  .bf-chispas i:nth-child(4) { --a: 135deg; }
.bf-chispas i:nth-child(5) { --a: 180deg; } .bf-chispas i:nth-child(6) { --a: 225deg; }
.bf-chispas i:nth-child(7) { --a: 270deg; } .bf-chispas i:nth-child(8) { --a: 315deg; }
.bf-dialog.is-open .bf-chispas i { animation: bf-chispa 560ms var(--e-out) 780ms both; }
@keyframes bf-chispa {
  0%   { opacity: 0; transform: rotate(var(--a)) translateY(-1.2rem) scaleY(.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-3.6rem) scaleY(1); }
}

/* Brillo que recorre el botón de WhatsApp: una vez al entrar y luego cada pocos segundos */
.bf-btn-brillo { position: relative; overflow: hidden; isolation: isolate; }
.bf-btn-brillo::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .38) 50%, transparent 65%);
  transform: translateX(-110%);
}
.bf-dialog.is-open .bf-btn-brillo::after { animation: bf-brillo 4.8s var(--bf-ease) 1.1s infinite; }
@keyframes bf-brillo { 0% { transform: translateX(-110%); } 22%, 100% { transform: translateX(110%); } }

@media (prefers-reduced-motion: reduce) {
  .bf-dialog, .bf-dialog.is-open, .bf-dialog.is-open.is-closing { transform: none; filter: none; transition: opacity 200ms ease; }
  .bf-dialog .bf-sub, .bf-dialog li, .bf-dialog .bf-btn, .bf-dialog .bf-nota,
  .bf-w > span, .bf-caja::before, .bf-dialog li.bf-top .bf-flash { transform: none !important; opacity: 1 !important; transition: none !important; }
  .bf-flash::before, .bf-chispas i, .bf-btn-brillo::after { animation: none !important; }
  .bf-chispas { display: none; }
  .bf-btn, .bf-cerrar, .bf-cerrar svg { transition: none; }
  .bf-btn:active, .bf-cerrar:active { transform: none; }
}
