/* Monserrat Bungalows · components.css
   Estados y piezas que crea o necesita main.js. El tema (styles.css) puede pisar
   cualquier token; acá sólo se usan con fallback a los valores del brief. */

/* ---------- utilidades ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ---------- bloqueo de scroll (menú abierto / lightbox) ---------- */
html.is-scroll-locked { overflow: hidden; scrollbar-gutter: stable; }
body.nav-open { overflow: hidden; }

/* ---------- reveal ---------- */
.reveal-ready [data-reveal],
.reveal-ready [data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 600ms var(--ease, cubic-bezier(.2, .7, .2, 1)),
    transform 600ms var(--ease, cubic-bezier(.2, .7, .2, 1));
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal-ready [data-reveal].is-visible,
.reveal-ready [data-reveal-stagger] > .is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- CTA sticky mobile (posición y look en styles.css; .sticky-ready lo pone main.js) ---------- */
.sticky-ready [data-sticky-cta] {
  transition:
    opacity 300ms var(--ease, cubic-bezier(.2, .7, .2, 1)),
    translate 300ms var(--ease, cubic-bezier(.2, .7, .2, 1)),
    visibility 0s linear 0s;
}
.sticky-ready [data-sticky-cta]:not(.is-visible) {
  opacity: 0;
  translate: 0 16px;
  visibility: hidden;
  pointer-events: none;
  transition-delay: 0s, 0s, 300ms;
}

/* ---------- formulario ---------- */
[aria-invalid="true"] {
  border-color: var(--clay, #A4502F);
  box-shadow: 0 0 0 1px var(--clay, #A4502F);
}
[data-error-for] { color: var(--clay, #A4502F); }
/* vacíos: ocultos visualmente pero presentes, para que aria-live anuncie al llenarse */
[data-error-for]:empty,
[data-form-status]:empty {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
[data-stepper] [aria-disabled="true"] { opacity: .4; cursor: not-allowed; }

/* ---------- mapa (facade → iframe) ---------- */
[data-map].is-loaded iframe {
  display: block;
  width: 100%; height: 100%;
  border: 0;
}

/* ---------- lightbox ---------- */
.lightbox {
  --lb-fade: 250ms;
  --lb-x: 200ms;
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  overflow: hidden;
  background: rgba(28, 38, 32, .96);
  background: color-mix(in srgb, var(--ink, #1C2620) 96%, transparent);
  color: var(--lichen, #BFC8B8);
  font-family: var(--font-text, Figtree, system-ui, sans-serif);
  opacity: 0;
  transition: opacity var(--lb-fade) var(--ease, cubic-bezier(.2, .7, .2, 1));
}
.lightbox::backdrop { background: transparent; }
.lightbox.is-open { opacity: 1; }

.lightbox__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 88px;
  touch-action: pinch-zoom;
}
.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%; height: 100%;
  margin: 0;
}
.lightbox__frame {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%;
  place-items: center;
  transform: scale(.98);
  transition: transform var(--lb-fade) var(--ease, cubic-bezier(.2, .7, .2, 1));
}
.lightbox.is-open .lightbox__frame { transform: none; }
.lightbox__img {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgb(0 0 0 / .35);
  opacity: 0;
  transition:
    opacity var(--lb-x) var(--ease, cubic-bezier(.2, .7, .2, 1)),
    transform var(--lb-x) var(--ease, cubic-bezier(.2, .7, .2, 1));
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__img:not([src]) { display: none; }
.lightbox .lightbox__img.is-active { opacity: 1; }
.lightbox__img:not(.is-active) { pointer-events: none; }

.lightbox__caption {
  flex: none;
  max-width: 62ch;
  margin: 0;
  text-align: center;
  font-size: var(--step--1, .875rem);
  line-height: 1.3;
  color: var(--lichen, #BFC8B8);
}
.lightbox__counter {
  position: absolute;
  top: 18px; left: 20px;
  margin: 0;
  line-height: 48px;
  font-size: var(--step--1, .875rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  color: var(--lichen, #BFC8B8);
}
.lightbox.is-single .lightbox__counter { display: none; }

.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgb(250 247 241 / .1);
  color: var(--paper, #FAF7F1);
  cursor: pointer;
  transition: background-color 150ms var(--ease, cubic-bezier(.2, .7, .2, 1));
  -webkit-tap-highlight-color: transparent;
}
.lightbox__btn[hidden] { display: none; }
.lightbox__btn:focus-visible {
  outline: 2px solid var(--paper, #FAF7F1);
  outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .lightbox__btn:hover { background: rgb(250 247 241 / .2); }
}
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev,
.lightbox__next { bottom: max(16px, env(safe-area-inset-bottom)); }
.lightbox__prev { left: calc(50% - 56px); }
.lightbox__next { right: calc(50% - 56px); }

@media (min-width: 768px) {
  .lightbox__stage { padding: 72px 96px 56px; }
  .lightbox__prev,
  .lightbox__next { bottom: auto; top: 50%; margin-top: -24px; }
  .lightbox__prev { left: 24px; }
  .lightbox__next { right: 24px; }
}

/* spinner sólo si la foto tarda */
.lightbox__stage.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 32px; height: 32px;
  margin: -16px 0 0 -16px;
  border: 2px solid rgb(191 200 184 / .3);
  border-top-color: var(--lichen, #BFC8B8);
  border-radius: 50%;
  animation: lb-spin .9s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* ---------- movimiento reducido: sin desplazamientos ni escalas, fades ≤150ms ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal-ready [data-reveal],
  .reveal-ready [data-reveal-stagger] > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .sticky-ready [data-sticky-cta],
  .sticky-ready [data-sticky-cta]:not(.is-visible) { translate: none; transition-duration: 150ms, 0s, 0s; }
  .sticky-ready [data-sticky-cta]:not(.is-visible) { transition-delay: 0s, 0s, 150ms; }
  .lightbox { --lb-fade: 150ms; --lb-x: 150ms; }
  .lightbox__frame,
  .lightbox__img { transform: none !important; transition-property: opacity; }
  .lightbox__stage.is-loading::after { animation-duration: 2.4s; }
  .media:hover img,
  a:hover > .media img { transform: none !important; }
}

@media print {
  .reveal-ready [data-reveal],
  .reveal-ready [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; }
  [data-sticky-cta], .lightbox { display: none !important; }
}
