/* ============================================================
   Vizu Memórias · memorias-lightbox.css
   Lightbox compartilhado (<dialog> + comparador antes/depois)
   + ampliação nas fotos do feed principal (.par-abrir / .hero-ampliar).
   Carregado APÓS memorias.css (e memorias-album.css no álbum) —
   herda as vars de tema; o dialog usa cores literais (sala escura).
   ============================================================ */

/* ---------- feed: botão de ampliação (reset transparente) ---------- */
.par-abrir {
  border: 0; padding: 0; background: none;
  font: inherit; color: inherit; cursor: pointer; text-align: inherit;
  display: block; width: 100%; position: relative;
}
/* o díptico da prova mantém o grid de duas colunas mesmo virando botão */
button.diptico { display: grid; }

/* affordance "Ampliar" — mesmo visual do .alb-zoom do álbum */
.par-zoom, .hero-ampliar::after {
  position: absolute; right: 14px; bottom: 14px; z-index: 2;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase;
  color: #EFE3CF; background: rgba(11, 10, 8, .68); padding: 5px 10px;
  opacity: 0; transition: opacity .35s var(--ease);
}
.hero-ampliar::after { content: 'Ampliar'; }

/* capa: overlay transparente sobre a polaroid principal
   (z-index 3 — acima das imgs absolutas de morph previstas) */
.hero-ampliar {
  position: absolute; inset: 0; z-index: 3;
  display: block; border: 0; padding: 0; margin: 0;
  background: transparent; cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .par-abrir:hover .par-zoom, .par-abrir:focus-visible .par-zoom,
  .hero-ampliar:hover::after, .hero-ampliar:focus-visible::after { opacity: 1; }
}
/* touch: sem hover — a pista "ampliar" fica visível e o toque abre o comparador */
@media (hover: none), (pointer: coarse) {
  .par-zoom, .hero-ampliar::after { opacity: .92; }
}

/* ---------- lightbox: sala escura fixa (cores literais — independe do tema) ---------- */
.alb-lb {
  border: none; padding: clamp(.8rem, 2vw, 1.2rem); margin: auto;
  background: transparent; color: #EFE3CF;
  /* width explícita: o fit-content nativo do <dialog> colapsava o palco
     (filhos do .cmp-stage são todos absolutos — largura intrínseca ~0) */
  width: min(1100px, 96vw);
  max-width: min(1100px, 96vw);
}
.alb-lb::backdrop { background: rgba(6, 5, 3, .9); }
.alb-lb[open] { display: grid; gap: .8rem; }

/* abertura/fechamento suaves — só com movimento permitido; sem a media
   query o dialog abre/fecha seco (estado base intocado, sem JS-dependência) */
@media (prefers-reduced-motion: no-preference) {
  .alb-lb {
    opacity: 0; transform: scale(.97);
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .alb-lb::backdrop { opacity: 0; transition: opacity .25s cubic-bezier(.22, .61, .36, 1); }
  .alb-lb.is-in { opacity: 1; transform: none; }
  .alb-lb.is-in::backdrop { opacity: 1; }
  .alb-lb.is-out { opacity: 0; transform: scale(.97); }
  .alb-lb.is-out::backdrop { opacity: 0; }
}
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lb-selo { display: inline-flex; align-items: baseline; gap: 8px; color: #D8C3A5; opacity: .85; }
.lb-selo svg { height: 10px; width: auto; fill: currentColor; }
.lb-selo span { font-family: var(--font-mono); font-size: 9px; letter-spacing: .3em; text-transform: uppercase; }
.lb-close {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(20, 16, 13, .8); color: #EFE3CF;
  border: 1px solid rgba(216, 195, 165, .35);
  transition: border-color .3s var(--ease), background .3s var(--ease), transform .2s var(--ease);
}
.lb-close:hover { border-color: #D8C3A5; background: rgba(36, 26, 20, .9); }
.lb-close:active { transform: scale(.94); }
.lb-info { display: grid; gap: .35rem; justify-items: center; text-align: center; }
.lb-caption { font-family: var(--font-title); font-style: italic; font-size: 1.35rem; color: #EFE3CF; }
.lb-desc { font-size: .88rem; color: #B8AC9C; max-width: 56ch; }
.lb-modes { display: flex; gap: .5rem; margin-top: .45rem; }
.lb-mode {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; cursor: pointer;
  color: #D8C3A5; background: transparent;
  border: 1px solid rgba(216, 195, 165, .35); border-radius: 999px;
  padding: 8px 15px; min-height: 36px;
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease), transform .2s var(--ease);
}
.lb-mode:hover { color: #EFE3CF; border-color: #D8C3A5; background: rgba(216, 195, 165, .1); }
.lb-mode:active { transform: scale(.97); }
/* alvo de toque confortável (WCAG 2.5.5) em ponteiros grossos */
@media (pointer: coarse) { .lb-mode { min-height: 44px; } }

/* comparador (portado de restauracao.css, re-tematizado sépia/dourado) */
.cmp-stage {
  position: relative;
  --ar: 0.75;  /* largura/altura; sobrescrito por inline style + JS */
  --pos: 50%;
  aspect-ratio: var(--ar);
  width: min(100%, calc(min(70vh, 720px) * var(--ar)));
  margin-inline: auto; overflow: hidden;
  background: #14100D;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .6);
  touch-action: pan-y;
}
.cmp-stage:focus-within { outline: 2px solid #B89A62; outline-offset: 3px; }
.cmp-after, .cmp-before { object-fit: cover; }
.cmp-after { position: absolute; inset: 0; width: 100%; height: 100%; }
.cmp-before-clip { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp-before { position: absolute; inset: 0; width: 100%; height: 100%; }

/* antes abaixo da resolução do palco (.is-soft via JS): véu sutil + grão
   no lado do antes — mesmo data-URI feTurbulence do grão do papel */
.cmp-before-clip.is-soft .cmp-before { filter: blur(.4px) contrast(1.02); }
.cmp-before-clip.is-soft::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' seed='11'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: .07; mix-blend-mode: overlay;
}
.cmp-line {
  position: absolute; top: 0; bottom: 0; left: var(--pos);
  width: 2px; margin-left: -1px; pointer-events: none;
  background: linear-gradient(180deg, transparent, #D8C3A5 14%, #D8C3A5 86%, transparent);
  box-shadow: 0 0 16px rgba(216, 195, 165, .5);
}
.cmp-knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(12, 10, 7, .82); color: #D8C3A5;
  border: 1px solid rgba(184, 154, 98, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
/* micro-resposta do knob: hover/arrasto (o range cobre o palco inteiro) */
@media (hover: hover) and (pointer: fine) {
  .cmp-stage:hover .cmp-knob {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 0 4px rgba(216, 195, 165, .16), 0 6px 18px rgba(0, 0, 0, .45);
  }
}
.cmp-stage:active .cmp-knob {
  transform: translate(-50%, -50%) scale(1.14);
  box-shadow: 0 0 0 6px rgba(216, 195, 165, .2), 0 6px 18px rgba(0, 0, 0, .45);
}
.cmp-range {
  position: absolute; inset: 0; z-index: 3;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: ew-resize;
  -webkit-appearance: none; appearance: none;
}
.cmp-tag {
  position: absolute; bottom: .8rem; z-index: 2; pointer-events: none;
  padding: .3rem .7rem; background: rgba(8, 6, 3, .68);
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: #EFE3CF;
}
.cmp-tag--l { left: .8rem; }
.cmp-tag--r { right: .8rem; }

/* ---------- responsivo + movimento reduzido ---------- */
@media (max-width: 639.98px) {
  .lb-modes { flex-wrap: wrap; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-mode, .lb-close, .par-zoom, .hero-ampliar::after, .cmp-knob { transition: none; }
}
