/* Sebas Granda Real Estate · immersive property gallery + demo status */

.sg-gallery-trigger,
button.sg-prop__media,
button.sg-living__cell,
button.sg-sheet__hero,
.sg-sheet__gallery-trigger {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: inherit;
  font: inherit;
  text-align: inherit;
  background: transparent;
  cursor: zoom-in;
}

.sg-gallery-trigger:focus-visible,
button.sg-prop__media:focus-visible,
button.sg-living__cell:focus-visible,
button.sg-sheet__hero:focus-visible,
.sg-sheet__gallery-trigger:focus-visible {
  outline: 2px solid var(--champagne-hi, #e6ca8c);
  outline-offset: 4px;
}

.sg-prop__media::before,
.sg-living__cell::before,
.sg-sheet__hero::before,
.sg-sheet__gallery-trigger::before {
  content: "";
  position: absolute;
  z-index: 4;
  right: 16px;
  bottom: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(239, 234, 226, .32);
  border-radius: 50%;
  background:
    linear-gradient(rgba(239, 234, 226, .8), rgba(239, 234, 226, .8)) 50% 45% / 11px 1px no-repeat,
    linear-gradient(90deg, rgba(239, 234, 226, .8), rgba(239, 234, 226, .8)) 50% 45% / 1px 11px no-repeat,
    radial-gradient(circle at 44% 41%, transparent 0 6px, rgba(239, 234, 226, .78) 6.5px 7.5px, transparent 8px),
    linear-gradient(45deg, transparent 46%, rgba(239, 234, 226, .78) 47% 53%, transparent 54%) 66% 66% / 11px 11px no-repeat,
    rgba(5, 7, 10, .5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .24);
  opacity: 0;
  transform: translate3d(0, 5px, 0);
  transition: opacity 240ms ease, transform 320ms cubic-bezier(.22, .61, .36, 1), border-color 240ms ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sg-prop__media:hover::before,
.sg-prop__media:focus-visible::before,
.sg-living__cell:hover::before,
.sg-living__cell:focus-visible::before,
.sg-sheet__hero:hover::before,
.sg-sheet__hero:focus-visible::before,
.sg-sheet__gallery-trigger:hover::before,
.sg-sheet__gallery-trigger:focus-visible::before {
  opacity: 1;
  transform: none;
  border-color: rgba(230, 202, 140, .76);
}

.sg-sheet__hero,
.sg-sheet__gallery-trigger { position: relative; overflow: hidden; }
.sg-sheet__gallery-trigger { height: 100%; }
.sg-sheet__gallery-trigger img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------
   Immersive lightbox
   ------------------------------------------------------------------ */

.sg-lightbox[hidden] { display: none !important; }

.sg-lightbox {
  --sg-lb-ui: rgba(239, 234, 226, .92);
  --sg-lb-muted: rgba(239, 234, 226, .58);
  --sg-lb-line: rgba(239, 234, 226, .16);
  --sg-lb-gold: var(--champagne-hi, #e6ca8c);
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  color: var(--sg-lb-ui);
  opacity: 0;
  visibility: hidden;
  transition: opacity 360ms ease, visibility 0s linear 360ms;
  isolation: isolate;
}

.sg-lightbox.is-mounted {
  visibility: visible;
  transition-delay: 0s;
}

.sg-lightbox.is-open { opacity: 1; }
.sg-lightbox.is-closing { pointer-events: none; }

.sg-lightbox__scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(23, 20, 17, .25), rgba(3, 4, 6, .95) 72%),
    rgba(3, 4, 6, .92);
  opacity: 0;
  transition: opacity 380ms ease;
}

.sg-lightbox.is-open .sg-lightbox__scrim { opacity: 1; }

.sg-lightbox__dialog {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  outline: none;
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition: opacity 280ms ease 110ms, transform 420ms cubic-bezier(.22, .61, .36, 1) 80ms;
}

.sg-lightbox.is-open .sg-lightbox__dialog {
  opacity: 1;
  transform: none;
}

.sg-lightbox__topbar {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: max(18px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 14px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--sg-lb-line);
  background: linear-gradient(180deg, rgba(5, 7, 10, .86), rgba(5, 7, 10, .18));
}

.sg-lightbox__identity { min-width: 0; }
.sg-lightbox__eyebrow {
  margin: 0 0 3px;
  color: var(--sg-lb-gold);
  font: 500 .62rem/1.2 Jost, system-ui, sans-serif;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.sg-lightbox__title {
  overflow: hidden;
  margin: 0;
  color: var(--sg-lb-ui);
  font: 400 clamp(1rem, 1.7vw, 1.35rem)/1.15 Italiana, Georgia, serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-lightbox__counter {
  min-width: 72px;
  margin: 0;
  color: var(--sg-lb-muted);
  font: 400 .72rem/1 Jost, system-ui, sans-serif;
  letter-spacing: .18em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sg-lightbox__close,
.sg-lightbox__nav,
.sg-lightbox__zoom-btn {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(239, 234, 226, .2);
  border-radius: 50%;
  color: var(--sg-lb-ui);
  background: rgba(5, 7, 10, .44);
  box-shadow: 0 16px 46px rgba(0, 0, 0, .16);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sg-lightbox__close:hover,
.sg-lightbox__nav:hover,
.sg-lightbox__zoom-btn:hover,
.sg-lightbox__close:focus-visible,
.sg-lightbox__nav:focus-visible,
.sg-lightbox__zoom-btn:focus-visible {
  color: var(--sg-lb-gold);
  border-color: rgba(230, 202, 140, .7);
  background: rgba(13, 12, 11, .76);
  outline: none;
}

.sg-lightbox__close:active,
.sg-lightbox__nav:active,
.sg-lightbox__zoom-btn:active { transform: scale(.96); }

.sg-lightbox__close svg,
.sg-lightbox__nav svg,
.sg-lightbox__zoom-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.sg-lightbox__viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
}

.sg-lightbox__stage {
  position: absolute;
  inset: 18px clamp(76px, 7vw, 118px) 20px;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  cursor: zoom-in;
}

.sg-lightbox.is-zoomed .sg-lightbox__stage { cursor: grab; }
.sg-lightbox.is-dragging .sg-lightbox__stage { cursor: grabbing; }

.sg-lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: 50% 50%;
  transition: opacity 220ms ease, transform 160ms ease-out;
  will-change: transform;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.sg-lightbox__image.is-ready { opacity: 1; }
.sg-lightbox.is-dragging .sg-lightbox__image,
.sg-lightbox.is-pinching .sg-lightbox__image { transition: opacity 180ms ease; }

.sg-lightbox__nav {
  position: absolute;
  z-index: 7;
  top: 50%;
  transform: translateY(-50%);
}

.sg-lightbox__nav:active { transform: translateY(-50%) scale(.96); }
.sg-lightbox__nav--prev { left: max(18px, env(safe-area-inset-left)); }
.sg-lightbox__nav--next { right: max(18px, env(safe-area-inset-right)); }

.sg-lightbox__zoom {
  position: absolute;
  z-index: 7;
  right: max(18px, env(safe-area-inset-right));
  bottom: 20px;
  display: flex;
  gap: 8px;
}

.sg-lightbox__zoom-btn { width: 40px; height: 40px; }
.sg-lightbox__zoom-btn[disabled] { opacity: .34; cursor: default; }
.sg-lightbox__zoom-btn[disabled]:active { transform: none; }

.sg-lightbox__hint {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 24px;
  margin: 0;
  padding: 7px 11px;
  border: 1px solid rgba(239, 234, 226, .12);
  border-radius: 999px;
  color: rgba(239, 234, 226, .58);
  background: rgba(5, 7, 10, .42);
  font: 400 .62rem/1.2 Jost, system-ui, sans-serif;
  letter-spacing: .08em;
  transform: translateX(-50%);
  transition: opacity 220ms ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sg-lightbox.is-zoomed .sg-lightbox__hint { opacity: 0; }

.sg-lightbox__footer {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 102px;
  padding: 12px max(24px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  border-top: 1px solid var(--sg-lb-line);
  background: linear-gradient(0deg, rgba(5, 7, 10, .9), rgba(5, 7, 10, .32));
}

.sg-lightbox__caption {
  max-width: 40rem;
  margin: 0;
  color: var(--sg-lb-muted);
  font: 300 .78rem/1.5 Jost, system-ui, sans-serif;
}

.sg-lightbox__thumbs {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  max-width: min(52vw, 680px);
  overflow-x: auto;
  padding: 3px 2px 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 202, 140, .4) transparent;
}

.sg-lightbox__thumb {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 74px;
  width: 74px;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(239, 234, 226, .15);
  background: #0a0a0b;
  cursor: pointer;
  opacity: .58;
  transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.sg-lightbox__thumb img { width: 100%; height: 100%; object-fit: cover; }
.sg-lightbox__thumb:hover,
.sg-lightbox__thumb:focus-visible,
.sg-lightbox__thumb[aria-selected="true"] {
  opacity: 1;
  border-color: var(--sg-lb-gold);
  outline: none;
}
.sg-lightbox__thumb[aria-selected="true"] { transform: translateY(-2px); }

.sg-lightbox__flight {
  position: fixed;
  z-index: 460;
  margin: 0;
  object-fit: cover;
  pointer-events: none;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .36);
  will-change: transform, opacity, border-radius;
}

body.sg-lightbox-open { overflow: hidden !important; }
body.sg-lightbox-open .sg-demo-status { opacity: 0; visibility: hidden; transform: translate3d(-50%, -50%, 0) scale(.94); }
body.sg-sheet-open .sg-demo-status { opacity: 0; visibility: hidden; }

/* ------------------------------------------------------------------
   Persistent DEMO / under-construction micro-scene
   ------------------------------------------------------------------ */

.sg-demo-status {
  position: fixed;
  z-index: 84;
  top: 50%;
  left: 50%;
  right: auto;
  width: 118px;
  padding: 10px 9px 9px;
  border: 1px solid rgba(201, 169, 106, .24);
  background: linear-gradient(145deg, rgba(8, 9, 11, .83), rgba(17, 15, 12, .72));
  box-shadow: 0 18px 46px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .03);
  color: #efeae2;
  text-align: center;
  transform: translate3d(-50%, -50%, 0);
  transition: opacity 220ms ease, visibility 220ms ease, transform 300ms ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.sg-demo-status::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(239, 234, 226, .05);
  pointer-events: none;
}

.sg-demo-status__scene {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto 5px;
  overflow: visible;
}

.sg-demo-status__title {
  display: block;
  color: var(--champagne-hi, #e6ca8c);
  font: 500 .66rem/1.1 Jost, system-ui, sans-serif;
  letter-spacing: .22em;
  text-indent: .22em;
}

.sg-demo-status__sub {
  display: block;
  margin-top: 3px;
  color: rgba(239, 234, 226, .68);
  font: 300 .55rem/1.2 Jost, system-ui, sans-serif;
  letter-spacing: .08em;
}

.sg-demo-status__foundation,
.sg-demo-status__wall,
.sg-demo-status__roof,
.sg-demo-status__window,
.sg-demo-status__detail {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sg-demo-status__foundation { color: rgba(239, 234, 226, .5); stroke-width: 1.2; }
.sg-demo-status__wall,
.sg-demo-status__roof { color: #c9a96a; stroke-width: 1.4; stroke-dasharray: 120; stroke-dashoffset: 120; animation: sg-demo-build 8s cubic-bezier(.25, .75, .25, 1) infinite; }
.sg-demo-status__roof { animation-delay: .32s; }
.sg-demo-status__window { color: rgba(239, 234, 226, .7); stroke-width: 1; opacity: 0; animation: sg-demo-window 8s ease infinite; }
.sg-demo-status__detail { color: rgba(201, 169, 106, .42); stroke-width: .8; }
.sg-demo-status__worker { transform-origin: 28px 50px; animation: sg-demo-worker 8s ease-in-out infinite; }
.sg-demo-status__arm { transform-origin: 31px 45px; animation: sg-demo-hammer 8s cubic-bezier(.5, 0, .5, 1) infinite; }
.sg-demo-status__spark { fill: #e6ca8c; opacity: 0; animation: sg-demo-spark 8s ease-out infinite; }

@keyframes sg-demo-build {
  0%, 5% { stroke-dashoffset: 120; opacity: .15; }
  28%, 72% { stroke-dashoffset: 0; opacity: 1; }
  82%, 100% { stroke-dashoffset: 120; opacity: .12; }
}

@keyframes sg-demo-window {
  0%, 22%, 82%, 100% { opacity: 0; }
  34%, 72% { opacity: 1; }
}

@keyframes sg-demo-worker {
  0%, 6%, 38%, 100% { transform: translateY(0); }
  17% { transform: translateY(-1px); }
  28% { transform: translateY(.5px); }
}

@keyframes sg-demo-hammer {
  0%, 7%, 12%, 18%, 24%, 32%, 100% { transform: rotate(0deg); }
  9%, 15%, 21%, 27% { transform: rotate(-24deg); }
}

@keyframes sg-demo-spark {
  0%, 8%, 13%, 19%, 25%, 31%, 100% { opacity: 0; transform: scale(.4); }
  10%, 16%, 22%, 28% { opacity: .9; transform: scale(1); }
}

@media (max-width: 860px) {
  .sg-lightbox__topbar { min-height: 64px; padding: max(12px, env(safe-area-inset-top)) 14px 10px; gap: 10px; }
  .sg-lightbox__eyebrow { display: none; }
  .sg-lightbox__title { font-size: .96rem; }
  .sg-lightbox__counter { min-width: 60px; font-size: .65rem; }
  .sg-lightbox__close { width: 40px; height: 40px; }
  .sg-lightbox__stage { inset: 10px 12px 66px; }
  .sg-lightbox__nav { top: auto; bottom: 12px; transform: none; width: 42px; height: 42px; }
  .sg-lightbox__nav:active { transform: scale(.96); }
  .sg-lightbox__nav--prev { left: 12px; }
  .sg-lightbox__nav--next { right: 12px; }
  .sg-lightbox__zoom { right: 50%; bottom: 13px; transform: translateX(50%); }
  .sg-lightbox__zoom-btn { width: 38px; height: 38px; }
  .sg-lightbox__hint { bottom: 72px; max-width: calc(100% - 36px); white-space: nowrap; }
  .sg-lightbox__footer { display: block; min-height: 82px; padding: 9px 12px max(10px, env(safe-area-inset-bottom)); }
  .sg-lightbox__caption { display: none; }
  .sg-lightbox__thumbs { justify-content: flex-start; max-width: 100%; }
  .sg-lightbox__thumb { flex-basis: 58px; width: 58px; }

  .sg-demo-status {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: 82px;
    padding: 7px 6px 6px;
    transform: translate3d(-50%, -50%, 0);
  }
  .sg-demo-status__scene { margin-bottom: 2px; }
  .sg-demo-status__title { font-size: .56rem; }
  .sg-demo-status__sub { font-size: .48rem; }
  body.sg-lightbox-open .sg-demo-status { transform: translate3d(-50%, -50%, 0) scale(.94); }
}

@media (max-width: 420px) {
  .sg-lightbox__title { max-width: 48vw; }
  .sg-lightbox__hint { font-size: .55rem; }
  .sg-demo-status { width: 74px; }
}

@media (hover: none) {
  .sg-prop__media::before,
  .sg-living__cell::before,
  .sg-sheet__hero::before,
  .sg-sheet__gallery-trigger::before { opacity: .72; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-lightbox,
  .sg-lightbox__scrim,
  .sg-lightbox__dialog,
  .sg-lightbox__image,
  .sg-lightbox__thumb,
  .sg-demo-status { transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .sg-lightbox__flight { display: none !important; }
  .sg-demo-status__wall,
  .sg-demo-status__roof,
  .sg-demo-status__window,
  .sg-demo-status__worker,
  .sg-demo-status__arm,
  .sg-demo-status__spark { animation: none !important; }
  .sg-demo-status__wall,
  .sg-demo-status__roof { stroke-dashoffset: 0; opacity: 1; }
  .sg-demo-status__window { opacity: 1; }
}

body.sg-native-fullscreen .sg-demo-status { opacity: 0; visibility: hidden; }
