/* ==========================================================================
   EXTRAS — reformasmalaga.net
   1. Barra de progreso de lectura + sombra del header al hacer scroll
   2. Animación suave de aparición de bloques al hacer scroll
   3. Visor de fotos (lightbox) para los proyectos
   4. Contacto flotante: WhatsApp + horario en vivo (escritorio) / barra inferior (móvil)
   5. Botón "volver arriba"
   Todo se activa desde /assets/extras.js. Para quitarlo: borrar la línea
   `include 'extras.php'` de includes/head-es.php y includes/head-en.php.
   ========================================================================== */

:root {
  --rx-ink: #141416;
  --rx-ink-2: #1c1d1f;
  --rx-cream: #fdf9f1;
  --rx-chalk: #ffffff;
  --rx-border: #ddd8ce;
  --rx-muted: #45474a;
  --rx-brown: #7b5827;
  --rx-gold: #e5a93c;
  --rx-wa: #25d366;
  --rx-ease: cubic-bezier(.2, .7, .2, 1);
  --rx-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --rx-serif: "Noto Serif", Georgia, serif;
}

/* ---------- 1. Progreso de lectura + header ---------- */
.rx-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 70;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--rx-brown), var(--rx-gold));
}
header.fixed { transition: box-shadow .3s ease; }
.rx-scrolled header.fixed { box-shadow: 0 12px 30px -20px rgba(20, 20, 22, .55); }

/* ---------- 2. Aparición al hacer scroll ---------- */
.rx-reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity .75s var(--rx-ease), transform .75s var(--rx-ease) !important;
  transition-delay: var(--rx-delay, 0ms) !important;
}
.rx-reveal.rx-in { opacity: 1; transform: none; }
@media print {
  .rx-reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- 6. Paneles de fondo para titulares ("rx-plate") ---------- */
.rx-plate {
  position: relative;
  isolation: isolate;
  padding: clamp(20px, 2.4vw, 34px) clamp(22px, 2.8vw, 40px) clamp(20px, 2.4vw, 34px) clamp(26px, 3vw, 44px);
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(229, 169, 60, .11), transparent 55%),
    linear-gradient(180deg, #ffffff, #fbf8f2);
  border: 1px solid #e6e0d4;
  box-shadow: inset 0 1px 0 #fff, 0 22px 44px -32px rgba(20, 20, 22, .45);
  overflow: hidden;
}
.rx-plate-wrap { display: flex; flex-direction: column; gap: .55rem; }
.rx-plate::before { /* filete vertical latón → oro */
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--rx-brown), var(--rx-gold));
}
.rx-plate::after { /* cuadrícula de plano técnico que se desvanece */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(123, 88, 39, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 88, 39, .08) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(75% 110% at 100% 0%, #000 0%, transparent 72%);
          mask-image: radial-gradient(75% 110% at 100% 0%, #000 0%, transparent 72%);
}
/* sobre fondo oscuro: cristal ahumado */
.rx-plate.rx-plate-dark {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(229, 169, 60, .14), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025));
  border-color: rgba(253, 249, 241, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 24px 50px -30px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.rx-plate.rx-plate-dark::after {
  background-image:
    linear-gradient(rgba(229, 169, 60, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229, 169, 60, .09) 1px, transparent 1px);
}
/* hero con foto: cristal más denso para leer bien sobre la imagen */
.rx-plate.rx-plate-hero {
  background: linear-gradient(135deg, rgba(20, 20, 22, .62), rgba(20, 20, 22, .34));
  border-color: rgba(253, 249, 241, .16);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  border-radius: 22px;
}
.rx-plate.rx-plate-hero::after { display: none; }
@media (max-width: 767px) {
  .rx-plate { border-radius: 14px; }
  .rx-plate.rx-plate-hero { margin-left: -6px; margin-right: -6px; }
}

/* ---------- 3. Lightbox ---------- */
.rx-zoomable { cursor: zoom-in; }
.rx-zoom-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--rx-ink);
  background: rgba(253, 249, 241, .92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  opacity: 0;
  transform: scale(.85);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.rx-zoom-hint .material-symbols-outlined { font-size: 20px; }
.group:hover .rx-zoom-hint,
.rx-zoomable:focus-visible + .rx-zoom-hint { opacity: 1; transform: none; }
.rx-zoomable:focus-visible { outline: 3px solid var(--rx-gold); outline-offset: -3px; }

html.rx-lock { overflow: hidden; }
.rx-lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 64px 72px 28px;
  background: rgba(14, 14, 16, .93);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .25s ease;
}
.rx-lb[hidden] { display: none; }
.rx-lb.rx-open { opacity: 1; }
.rx-lb-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  transform: scale(.97);
  transition: transform .3s var(--rx-ease);
  touch-action: pan-y;
}
.rx-lb.rx-open .rx-lb-fig { transform: none; }
.rx-lb-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 1400px);
  max-height: calc(100vh - 170px);
  border-radius: 10px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
  background: #222;
  user-select: none;
  -webkit-user-drag: none;
}
.rx-lb-cap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  max-width: min(92vw, 900px);
  text-align: center;
  color: var(--rx-cream);
}
.rx-lb-title { font: 400 20px/1.35 var(--rx-serif); }
.rx-lb-count { font: 600 12px/1 var(--rx-font); letter-spacing: .12em; color: var(--rx-gold); }
.rx-lb-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(253, 249, 241, .22);
  background: rgba(253, 249, 241, .06);
  color: var(--rx-cream);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.rx-lb-btn:hover { background: rgba(253, 249, 241, .16); border-color: rgba(253, 249, 241, .45); }
.rx-lb-btn:focus-visible { outline: 2px solid var(--rx-gold); outline-offset: 3px; }
.rx-lb-btn .material-symbols-outlined { font-size: 26px; }
.rx-lb-close { top: 14px; right: 16px; }
.rx-lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.rx-lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.rx-lb-single .rx-lb-prev, .rx-lb-single .rx-lb-next, .rx-lb-single .rx-lb-count { display: none; }

@media (max-width: 767px) {
  .rx-lb { padding: 64px 10px 24px; }
  .rx-lb-prev, .rx-lb-next { top: auto; bottom: 18px; transform: none; width: 44px; height: 44px; }
  .rx-lb-prev { left: 16px; }
  .rx-lb-next { right: 16px; }
  .rx-lb-img { max-height: calc(100vh - 220px); }
  .rx-lb-title { font-size: 17px; }
}

/* ---------- 4a. Contacto flotante (escritorio / tablet) ---------- */
.rx-dock {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: var(--rx-font);
}
.rx-top {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--rx-border);
  background: var(--rx-chalk);
  color: var(--rx-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 22px -10px rgba(20, 20, 22, .45);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
  margin-right: 8px;
}
.rx-top.rx-show { opacity: 1; transform: none; pointer-events: auto; }
.rx-top:hover { background: var(--rx-cream); }
.rx-top .material-symbols-outlined { font-size: 22px; }

.rx-wa {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--rx-wa);
  box-shadow: 0 14px 30px -10px rgba(37, 211, 102, .65), 0 4px 12px rgba(20, 20, 22, .2);
  transition: transform .2s ease, background .2s ease;
}
.rx-wa:hover { transform: scale(1.06); }
.rx-wa[aria-expanded="true"] { background: var(--rx-ink); box-shadow: 0 14px 30px -12px rgba(20, 20, 22, .7); }
.rx-wa svg { width: 30px; height: 30px; }
.rx-wa .rx-wa-close { display: none; font-size: 26px; }
.rx-wa[aria-expanded="true"] svg { display: none; }
.rx-wa[aria-expanded="true"] .rx-wa-close { display: block; }
.rx-wa::after { /* latido suave al cargar, 3 veces */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--rx-wa);
  animation: rx-ping 2.2s var(--rx-ease) 1.2s 3;
  opacity: 0;
  pointer-events: none;
}
@keyframes rx-ping {
  0% { transform: scale(1); opacity: .7; }
  80%, 100% { transform: scale(1.7); opacity: 0; }
}
.rx-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #9a9a9a;
}
.rx-is-open .rx-dot { background: var(--rx-gold); }
.rx-wa:focus-visible, .rx-top:focus-visible { outline: 3px solid var(--rx-gold); outline-offset: 4px; }

.rx-card {
  width: 320px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--rx-chalk);
  border: 1px solid var(--rx-border);
  box-shadow: 0 30px 60px -24px rgba(20, 20, 22, .55);
  transform-origin: 100% 100%;
  animation: rx-pop .22s var(--rx-ease);
}
.rx-card[hidden] { display: none; }
@keyframes rx-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.rx-card-head {
  padding: 16px 18px 14px;
  background: var(--rx-ink-2);
  color: var(--rx-cream);
}
.rx-card-title { margin: 0; font: 500 18px/1.3 var(--rx-serif); color: var(--rx-cream); }
.rx-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: rgba(253, 249, 241, .8);
}
.rx-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9a9a9a;
  flex: 0 0 auto;
}
.rx-is-open .rx-status::before { background: var(--rx-gold); box-shadow: 0 0 0 4px rgba(229, 169, 60, .2); }
.rx-hours { margin-top: 4px; font-size: 11.5px; color: rgba(253, 249, 241, .55); }
.rx-card-body { padding: 12px; display: grid; gap: 8px; background: var(--rx-cream); }
.rx-act {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--rx-border);
  background: var(--rx-chalk);
  color: var(--rx-ink);
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.rx-act:hover { border-color: var(--rx-brown); transform: translateY(-1px); box-shadow: 0 8px 18px -12px rgba(20, 20, 22, .4); }
.rx-act:focus-visible { outline: 2px solid var(--rx-gold); outline-offset: 2px; }
.rx-act-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(123, 88, 39, .1);
  color: var(--rx-brown);
}
.rx-act-ico svg { width: 20px; height: 20px; }
.rx-act-wa .rx-act-ico { background: rgba(37, 211, 102, .14); color: #128c4a; }
.rx-act-txt { display: flex; flex-direction: column; line-height: 1.25; }
.rx-act-txt strong { font-size: 14px; font-weight: 600; }
.rx-act-txt span { font-size: 12px; color: var(--rx-muted); }

/* ---------- 4b. Barra inferior en móvil ---------- */
.rx-bar { display: none; }
@media (max-width: 767px) {
  /* en móvil el dock solo conserva el asistente (si existe), encima de la barra inferior */
  .rx-dock { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .rx-dock > .rx-wa, .rx-dock > .rx-top, .rx-dock > .rx-card { display: none; }
  body.rx-has-bar { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .rx-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr 1fr 1.25fr;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(253, 249, 241, .96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--rx-border);
    box-shadow: 0 -10px 30px -18px rgba(20, 20, 22, .45);
    font-family: var(--rx-font);
    transition: transform .25s ease;
  }
  .rx-bar.rx-hide { transform: translateY(110%); }
  .rx-bar a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
  }
  .rx-bar a svg { width: 19px; height: 19px; }
  .rx-bar .material-symbols-outlined { font-size: 19px; }
  .rx-bar-call { background: var(--rx-chalk); color: var(--rx-ink); border: 1px solid var(--rx-border); }
  .rx-bar-wa { background: var(--rx-wa); color: #0b3d20; }
  .rx-bar-quote { background: var(--rx-ink); color: var(--rx-cream); }
}

@media (prefers-reduced-motion: reduce) {
  .rx-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .rx-wa::after { animation: none; }
  .rx-card, .rx-lb, .rx-lb-fig { animation: none; transition: none; }
}
