/* Thara Tropical Villa — interactive floor plan.
   Modelled on lenvalproperties.com/projects/project-j (see CONTEXT.md for the measured reference values).
   Uses the site's brand tokens (--cream, --charcoal, --moss, --gold, --taupe, --serif, --sans) from public/css/tokens.css. */

/* ---- Section ---- */
.fp-intro { max-width: 70rem; margin: 0 auto; padding: 4rem 1.25rem 2rem; text-align: center; }
.fp-intro h2 { margin: 0; font: 400 clamp(2.25rem, 1.6rem + 3vw, 3.75rem)/1.05 var(--serif); letter-spacing: -.01em; }
.fp-intro h2 em { font-style: italic; color: var(--moss); }
.fp-intro p { margin: .75rem 0 0; color: var(--taupe); }

.fp-wrap { max-width: 75rem; margin: 0 auto 5rem; padding: 0 1.25rem; }
.fp { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 1.5rem 3rem rgb(47 46 41 / .14); }
.fp > img { display: block; width: 100%; height: auto; }

/* ---- Cursor light (desktop): a soft warm glow trail drawn on a canvas over the plan, blended with "screen" ---- */
.fp__light { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; opacity: .5; z-index: 1; }

/* ---- Pins (reference: 29px white circle, 14px plus) ---- */
.fp-pin { --size: 1.625rem; position: absolute; z-index: 2; width: var(--size); height: var(--size); padding: 0; border: 0; border-radius: 50%;
          background: #fff; color: var(--charcoal); cursor: pointer; display: grid; place-items: center;
          transform: translate(-50%, -50%) scale(0);
          transition: transform .6s cubic-bezier(.25,1,.5,1), background-color .3s ease, color .3s ease; }
/* bigger invisible tap area so small pins stay easy to hit */
.fp-pin::after { content: ""; position: absolute; inset: -.6rem; border-radius: 50%; }
.fp.is-in .fp-pin { transform: translate(-50%, -50%) scale(1); transition-delay: calc(var(--i) * 70ms); }
.fp.is-in .fp-pin:hover, .fp.is-in .fp-pin.is-active { transform: translate(-50%, -50%) scale(1.12); transition-delay: 0s; }
.fp-pin.is-active { background: var(--moss); color: var(--cream); }
.fp-pin:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

/* plus: a fixed horizontal bar + a vertical bar that turns a quarter (to make a minus) on hover/open,
   and carries on turning back to a plus on leave (rotation driven from floorplan.js, like the reference) */
.fp-pin__h, .fp-pin__v { position: absolute; background: currentColor; border-radius: 1px; }
.fp-pin__h { width: .75rem; height: 1.25px; }
.fp-pin__v { width: 1.25px; height: .75rem; transform: rotate(var(--rot, 0deg)); transition: transform .8s cubic-bezier(.25,1,.5,1); }

/* ripples: several thin white rings growing from the pin's edge to twice its size and fading out
   (reference: 1.2 s, ease-in, rings 0.2 s apart, looping) */
.fp-pin__ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid #fff; pointer-events: none; opacity: 0;
                animation: fp-ripple var(--ripple, 1.8s) cubic-bezier(.5,0,.75,0) infinite; animation-delay: calc(var(--r) * var(--gap, .3s)); }
.fp-pin.is-active .fp-pin__ring { animation: none; opacity: 0; }
@keyframes fp-ripple { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.1); opacity: 0; } }

/* ---- Connector lines: a straight bracket from the card to its targets (e.g. tubs card -> both tubs) ---- */
.fp-links { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 49; pointer-events: none; overflow: visible; }
.fp-link__line { fill: none; stroke: #fff; stroke-width: 1.25; stroke-linecap: square; stroke-linejoin: miter; filter: drop-shadow(0 0 1.5px rgb(0 0 0 / .45));
                 stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.fp-link__ring { fill: none; stroke: #fff; stroke-width: 1.25; opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.4); filter: drop-shadow(0 0 1.5px rgb(0 0 0 / .45)); }
.fp-link__dot { fill: #fff; opacity: 0; }
/* draw order: trunk, then both branches together, then the end rings */
.fp-link.is-in .fp-link__trunk  { stroke-dashoffset: 0; transition: stroke-dashoffset .3s cubic-bezier(.5,0,.75,0) .15s; }
.fp-link.is-in .fp-link__branch { stroke-dashoffset: 0; transition: stroke-dashoffset .6s cubic-bezier(.25,1,.5,1) .45s; }
.fp-link.is-in .fp-link__ring { opacity: 1; transform: scale(1); transition: opacity .3s ease .95s, transform .5s cubic-bezier(.25,1,.5,1) .95s; }
.fp-link.is-in .fp-link__dot { opacity: 1; transition: opacity .3s ease .95s; }
@media (prefers-reduced-motion: reduce) { .fp-link__line { stroke-dashoffset: 0; } .fp-link__ring, .fp-link__dot { opacity: 1; transform: none; } }

/* ---- Multi-spot effects (tubs card) ---- */
/* spotlight: the plan dims, soft circles of light stay over each spot */
.fp-spot { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: rgb(30 30 26 / .5); opacity: 0; transition: opacity .6s ease;
           -webkit-mask-composite: source-in; mask-composite: intersect; }
.fp-spot.is-on { opacity: 1; }
/* twin ripples: rings rippling on each spot */
.fp-mark { position: absolute; z-index: 2; width: 1.625rem; height: 1.625rem; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity .4s ease calc(var(--k) * .12s); }
.fp-mark::after { content: ""; position: absolute; inset: 35%; border-radius: 50%; background: #fff; box-shadow: 0 0 6px rgb(0 0 0 / .35); }
.fp-mark.is-on { opacity: 1; }
.fp-mark__ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid #fff; opacity: 0;
                 animation: fp-ripple 1.8s cubic-bezier(.5,0,.75,0) infinite; animation-delay: calc(var(--r) * .3s); }
/* curve: one fine arc between the spots */
.fp-curve { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.fp-curve__line { fill: none; stroke: #fff; stroke-width: 1.25; stroke-linecap: round; filter: drop-shadow(0 0 1.5px rgb(0 0 0 / .45));
                  stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.fp-curve.is-on .fp-curve__line { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s cubic-bezier(.25,1,.5,1) .15s; }
.fp-curve__dot { fill: #fff; opacity: 0; filter: drop-shadow(0 0 1.5px rgb(0 0 0 / .45)); }
.fp-curve.is-on .fp-curve__dot { opacity: 1; transition: opacity .3s ease .2s; }
/* two pins: the extra pin only shows in this mode; both glow together while the card is open */
.fp-pin--twin { display: none; }
.fp--twopins .fp-pin--twin { display: grid; }
.fp-pin.is-twin-hot { box-shadow: 0 0 0 4px rgb(255 255 255 / .35), 0 0 18px rgb(255 255 255 / .55); }
/* photos inside the card */
.fp-card__photos { display: none; }
.fp-card.has-photos .fp-card__photos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 1.1rem 0 0; }
.fp-card.has-one-photo .fp-card__photos { grid-template-columns: 1fr; }

.fp-card__photos figure { margin: 0; }
.fp-card__photos img { display: block; width: 100%; height: auto; aspect-ratio: var(--ratio, 4 / 5); object-fit: cover; border-radius: 3px; }
.fp-card__photos figcaption { margin-top: .35rem; font: 400 .625rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: rgb(247 247 239 / .75); }
.fp-card.has-photos .fp-card__desc { margin-top: 1rem; }
@media (prefers-reduced-motion: reduce) { .fp-mark__ring { animation: none; } .fp-curve__line { stroke-dashoffset: 0; } }

/* ---- Card ---- */
.fp-card { position: fixed; left: 0; top: 0; z-index: 50; width: min(22rem, calc(100vw - 2rem)); padding: 1.1rem 1.4rem 1.3rem;
           background: rgb(47 46 41 / .78); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
           color: var(--cream); pointer-events: none; visibility: hidden; will-change: transform;
           clip-path: inset(0 0 100% 0); transition: clip-path .5s cubic-bezier(.2,.8,.2,1), visibility 0s linear .5s; }
.fp-card.is-open { visibility: visible; clip-path: inset(0 0 0 0); transition: clip-path .55s cubic-bezier(.2,.8,.2,1), visibility 0s; }
.fp-card.is-pinned { pointer-events: auto; }
.fp-card__num { font: 400 .6875rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.fp-card__title { margin: .55rem 0 0; font: 400 1.9rem/1.05 var(--serif); letter-spacing: -.01em; }
.fp-card__desc { margin: 1.6rem 0 0; font: 300 .95rem/1.5 var(--sans); color: rgb(247 247 239 / .9); }
.fp-card__num, .fp-card__title, .fp-card__desc { opacity: 0; transform: translateY(.75rem); transition: opacity .4s ease, transform .5s cubic-bezier(.2,.8,.2,1); }
.fp-card.is-open .fp-card__num   { opacity: 1; transform: none; transition-delay: .12s; }
.fp-card.is-open .fp-card__title { opacity: 1; transform: none; transition-delay: .2s; }
.fp-card.is-open .fp-card__desc  { opacity: 1; transform: none; transition-delay: .28s; }
.fp-card__close { display: none; }

/* ---- Phones: smaller pins; the card becomes a bottom sheet ---- */
@media (max-width: 40rem) {
  .fp-pin { --size: 1.375rem; }
  .fp-pin__h { width: .625rem; } .fp-pin__v { height: .625rem; }
  .fp-card { left: 0 !important; top: auto !important; bottom: 0; width: 100%; padding: 1.4rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
             border-radius: 14px 14px 0 0; background: rgb(47 46 41 / .9); pointer-events: auto;
             clip-path: none; transform: translateY(105%) !important; transition: transform .45s cubic-bezier(.2,.8,.2,1), visibility 0s linear .45s; }
  .fp-card.is-open { transform: none !important; transition: transform .5s cubic-bezier(.2,.8,.2,1), visibility 0s; }
  .fp-card__close { display: grid; place-items: center; position: absolute; top: .75rem; right: .75rem; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
                    background: rgb(247 247 239 / .12); color: var(--cream); font: 300 1.5rem/1 var(--sans); cursor: pointer; }
  .fp-card__title { font-size: 1.6rem; padding-right: 3rem; }
  .fp-card__desc { margin-top: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .fp-pin__ring { animation: none; opacity: 0; }
  .fp-pin, .fp-pin__v, .fp-card, .fp-card__num, .fp-card__title, .fp-card__desc { transition: none !important; }
  .fp__light { display: none; }
}
