/* Shared UX layer for the project pages (Stars, City Square, Ten Point explorers + Safwa and the hub page).
   Loaded after each explorer's own stylesheet. "X" is replaced at build time by the three explorer roots. */

/* ---------- Plan: unit status on the drawing ---------- */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-unit.ux-av{background:rgba(215,186,103,.16);box-shadow:inset 0 0 0 1.5px rgba(166,128,40,.85)}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-unit.ux-na{background:repeating-linear-gradient(135deg,rgba(25,24,21,.22) 0 2px,rgba(25,24,21,.04) 2px 7px);box-shadow:none}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-unit.ux-av:hover,:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-unit.ux-na:hover{background:rgba(215,186,103,.34);box-shadow:inset 0 0 0 2px #a68028}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-unit.ux-av[aria-pressed=true],:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-unit.ux-na[aria-pressed=true]{background:rgba(215,186,103,.42);box-shadow:inset 0 0 0 3px #a68028}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-legend{display:flex;flex-wrap:wrap;gap:6px 16px;padding:10px 16px 0;font-size:12px;color:var(--muted)}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-legend span{display:inline-flex;align-items:center;gap:7px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-legend i{display:inline-block;width:16px;height:12px;border-radius:2px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-legend .av i{background:rgba(215,186,103,.3);box-shadow:inset 0 0 0 1.5px #a68028}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-legend .na i{background:repeating-linear-gradient(135deg,rgba(25,24,21,.5) 0 3px,rgba(25,24,21,.15) 3px 7px)}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-legend .out i{border:1px dashed #888e9a}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-canvas{touch-action:manipulation}

/* hover card on the plan (mouse only) */
.ux-tip{position:fixed;z-index:2147483100;pointer-events:none;background:#191815;color:#fff;border-radius:10px;padding:9px 12px;font:13px/1.6 Cairo,system-ui,sans-serif;direction:rtl;box-shadow:0 10px 30px #0004;max-width:240px;opacity:0;transform:translateY(4px);transition:opacity .12s,transform .12s}
.ux-tip.on{opacity:1;transform:none}
.ux-tip b{display:block;font-size:20px;line-height:1.2;letter-spacing:-.01em}
.ux-tip .st{display:inline-block;margin:3px 0 2px;padding:0 8px;border-radius:99px;font-size:11.5px;background:#3a352b}
.ux-tip .st.ok{background:#d7ba67;color:#191815}
.ux-tip .pr{display:block;font-weight:700;font-variant-numeric:tabular-nums}
.ux-tip .hint{display:block;color:#bfb8a8;font-size:11px}

/* full-screen plan zoom controls */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-zoom{position:absolute;z-index:3;inset-inline-start:12px;bottom:calc(52px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:6px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-zoom button{width:46px;height:46px;border-radius:50%;border:1px solid #d9d2c1;background:#fff;color:#191815;font:600 24px/1 system-ui,sans-serif;box-shadow:0 6px 18px #0002;cursor:pointer;display:grid;place-items:center}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .ux-zoom button:disabled{opacity:.4}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-expanded{z-index:2147483000!important}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-expanded .plan-scroll{touch-action:pan-x pan-y;position:relative}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-expanded .plan-stage.ux-sized{margin:0}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-expanded .ux-hint{position:absolute;z-index:3;top:10px;left:50%;transform:translateX(-50%);background:#191815e6;color:#fff;font-size:12px;padding:5px 12px;border-radius:99px;pointer-events:none;white-space:nowrap;transition:opacity .4s}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-expanded .ux-hint.off{opacity:0}

/* Stars has no full-screen plan of its own on phones and tablets: same behaviour as City/Ten */
@media(max-width:1190px){
#perfect-stars-explorer .plan-panel.plan-expanded:not([hidden]){position:fixed;inset:0;display:flex;flex-direction:column;border-radius:0;padding-block:env(safe-area-inset-top) env(safe-area-inset-bottom)}
#perfect-stars-explorer .plan-expanded .plan-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
#perfect-stars-explorer .plan-expanded .plan-stage.zoomed{width:max(180%,1050px);margin:0;padding:0}
#perfect-stars-explorer .plan-expanded .plan-tools button{background:var(--navy);color:#fff}
body:has(#perfect-stars-explorer .plan-expanded:not([hidden])){overflow:hidden}
#perfect-stars-explorer .plan-expanded .plan-header{padding-block:10px}
#perfect-stars-explorer .plan-expanded .plan-header p,#perfect-stars-explorer .plan-expanded .plan-note{display:none}
}

/* ---------- Compare: chosen units as chips, each removable ---------- */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .comparison-bar #comparison-codes{display:flex!important;flex-wrap:wrap;gap:6px;direction:rtl;margin-top:6px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .compare-chip,#perfect-safwa .compare-chip{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:0 6px 0 10px;border:1px solid #6d6146;border-radius:99px;background:#2b271e;color:#fff;font:700 13px/1 Cairo,system-ui,sans-serif;cursor:pointer}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .compare-chip span,#perfect-safwa .compare-chip span{display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#ffffff1f;font-size:15px;line-height:1}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .compare-chip:hover span,#perfect-safwa .compare-chip:hover span{background:#d7ba67;color:#191815}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .compare-chip:focus-visible,#perfect-safwa .compare-chip:focus-visible{outline:2px solid #d7ba67;outline-offset:2px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .comparison-table thead th{position:relative}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .compare-remove{position:absolute;top:6px;inset-inline-end:6px;width:30px;height:30px;border-radius:50%;border:1px solid var(--line);background:#fff;color:var(--ink);font-size:17px;line-height:1;cursor:pointer;display:grid;place-items:center}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .compare-remove:hover{background:var(--navy);color:#fff;border-color:var(--navy)}
#perfect-safwa .compare-bar{position:fixed;z-index:60;left:50%;bottom:20px;transform:translateX(-50%);width:min(640px,calc(100% - 24px));display:flex;align-items:center;gap:14px;padding:12px 14px;background:#0f2f52;color:#fff;border-radius:12px;box-shadow:0 12px 34px #0b1d3044}
#perfect-safwa .compare-bar-copy{flex:1;min-width:0}
#perfect-safwa .compare-bar strong{display:block;font-size:12px;color:#c9daec;margin-bottom:6px}
#perfect-safwa .compare-bar-units{display:flex;flex-wrap:wrap;gap:6px}
#perfect-safwa .compare-chip{border-color:#3d6487;background:#173f68}
#perfect-safwa .compare-chip small{font-size:11px;font-weight:400;color:#c9daec}
#perfect-safwa .compare-chip:hover span{background:#fff;color:#0f2f52}
#perfect-safwa .compare-bar .action{white-space:nowrap;background:#fff;color:#0f2f52;border-color:#fff}
#perfect-safwa .compare-bar .action:disabled{background:#ffffff26;color:#dbe6f1;border-color:transparent}
#perfect-safwa .compare-bar-clear{width:36px;height:36px;flex:none;border-radius:50%;border:1px solid #ffffff40;background:transparent;color:#fff;font-size:20px;line-height:1;cursor:pointer}
#perfect-safwa.has-comparison{padding-bottom:110px}
body:has(.comparison-bar:not([hidden])) .ux-jump,body:has(#compare-bar:not([hidden])) .ux-jump{display:none!important}

/* ---------- Desktop: more room ---------- */
@media(min-width:1191px){
#perfect-stars-explorer,#perfect-city-square.on-project-page,#perfect-10point{
 width:min(1320px,calc(100vw - 48px));margin-inline:calc((100% - min(1320px,calc(100vw - 48px))) / 2)}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .workspace.wrap,:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .wrap{width:100%}
/* plan view: the floor buttons are above the plan, so the floor column steps aside and the plan gets its width */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .workspace:has(#plan-panel:not([hidden])){grid-template-columns:minmax(0,1fr) 320px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .workspace:has(#plan-panel:not([hidden])) > .floor-rail{display:none}
/* keep the whole floor on screen */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-stage:not(.zoomed) .plan-canvas{width:min(100%,calc((100vh - 230px) * var(--ux-ar,1.5)));margin-inline:auto}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-stage:not(.zoomed) .plan-canvas img{width:100%}
#perfect-stars-explorer .plan-stage:not(.zoomed){padding-left:0}
}

/* ---------- Phone ---------- */
@media(max-width:760px){
/* one side gutter instead of three */
.pph{padding-inline:6px!important}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .wrap,:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .workspace.wrap{width:100%}
/* compare bars sit above the site's bottom menu (72px) */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .comparison-bar{bottom:calc(84px + env(safe-area-inset-bottom))!important}
#perfect-safwa .compare-bar{bottom:calc(84px + env(safe-area-inset-bottom));padding:10px 10px 10px 8px;gap:8px}
#perfect-safwa .compare-bar .action{padding-inline:10px;font-size:12px}

/* compact unit rows: about 4x more units per screen; the whole row opens the unit */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .unit-grid{gap:8px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .unit-card{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"top price" "type type" "metrics actions";align-items:center;column-gap:10px;padding:10px 14px 4px;border-radius:12px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .unit-card:hover{transform:none}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-top{grid-area:top;display:flex;align-items:center;justify-content:flex-start;gap:8px;min-width:0}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-code{font-size:23px;line-height:1.3}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-type{grid-area:type;margin:0!important;font-size:12px}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-metrics{grid-area:metrics;margin:0!important;gap:16px!important;justify-content:flex-start}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-metrics dt{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-metrics dd,:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-metrics .area{font-size:14px!important;font-weight:600;line-height:1.7}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-price{grid-area:price;border:0!important;padding:0!important;text-align:left}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-price>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-price p{font-size:17px!important;line-height:1.35}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-price small{display:block;font-size:11px!important;margin:0}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-actions{grid-area:actions;border:0!important;padding:0!important;justify-content:flex-end}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-actions .view-unit{position:absolute;inset:0;z-index:1;opacity:0;min-height:0!important;width:100%}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .card-actions .compare-toggle{position:relative;z-index:2;min-height:40px!important;padding-inline:8px!important;font-size:12px!important}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .unit-card:has(.view-unit:focus-visible){outline:3px solid #a48637;outline-offset:2px}

/* search gets the full row */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .search-field input{font-size:16px!important}

/* plan inline: tapping it opens the full-screen plan at that spot */
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-panel:not(.plan-expanded) .plan-scroll{cursor:zoom-in}
:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-panel:not(.plan-expanded) .plan-tools [data-action="plan-zoom"]{background:var(--navy)!important;color:#fff!important;border-color:var(--navy)!important}

/* hub page above the explorer */
.pph p.pph-lead.ux-more{display:none}
.pph.ux-open p.pph-lead.ux-more{display:block}
.pph .ux-read{display:inline-flex;align-items:center;min-height:40px;padding:0;border:0;background:none;color:#000;font:700 15px Cairo,sans-serif;text-decoration:underline;text-underline-offset:4px;cursor:pointer}
.pph ul.pph-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:14px}
.pph ul.pph-facts li{padding:8px 9px;font-size:11.5px;line-height:1.5}
.pph ul.pph-facts b{font-size:16px}
.pph .pb{margin:16px 0}
.pph .pb-item{grid-template-columns:auto minmax(0,1fr) auto!important;padding:10px 12px;gap:2px 12px}
.pph .pb-ico{width:40px;height:40px;font-size:22px}
.pph .pb-txt b{font-size:15px}
.pph .pb-txt span{font-size:12px}
.pph .pb-open{grid-column:auto!important;font-size:0;gap:0;width:46px;min-height:46px;padding:0}
.pph .pb-open svg{width:20px;height:20px;font-size:20px}

/* jump to the units */
.ux-jump{position:fixed;z-index:60;left:50%;bottom:calc(86px + env(safe-area-inset-bottom));transform:translate(-50%,0);display:inline-flex;align-items:center;gap:8px;min-height:46px;padding:0 20px;border:0;border-radius:99px;background:#191815;color:#fff;font:700 15px Cairo,sans-serif;box-shadow:0 10px 26px #0004;cursor:pointer;transition:opacity .2s,transform .2s;white-space:nowrap}
.ux-jump b{color:#d7ba67;font-variant-numeric:tabular-nums}
.ux-jump[hidden]{display:inline-flex;opacity:0;pointer-events:none;transform:translate(-50%,12px)}
}
/* Safwa on phones: one column, plan photo beside the details instead of two narrow tall cards */
@media(max-width:690px){
#perfect-safwa .catalog-results .grid{grid-template-columns:minmax(0,1fr)!important;gap:8px}
#perfect-safwa .catalog-card{display:grid;grid-template-columns:112px minmax(0,1fr);align-items:stretch}
#perfect-safwa .catalog-card:hover{transform:none}
#perfect-safwa .catalog-card-photo{height:100%;display:flex;align-items:center;border-inline-end:1px solid var(--line)}
#perfect-safwa .catalog-card-photo img{height:auto;max-height:200px;aspect-ratio:1/1.15}
#perfect-safwa .catalog-card-copy{padding:8px 10px 2px}
#perfect-safwa .catalog-card-top h3{font-size:19px;line-height:1.4}
#perfect-safwa .catalog-card-facts{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:4px 0}
#perfect-safwa .catalog-card-facts > div:last-child{grid-column:auto}
#perfect-safwa .catalog-card-facts dt{font-size:10.5px}
#perfect-safwa .catalog-card-facts dd{font-size:12.5px}
#perfect-safwa .catalog-card .booking-terms{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin-top:4px;padding-block:6px}
#perfect-safwa .catalog-card .booking-terms > div{padding:4px 6px}
#perfect-safwa .catalog-card .booking-terms dt{font-size:10.5px}
#perfect-safwa .catalog-card .booking-terms dd{font-size:13px}
#perfect-safwa .catalog-card-actions button{min-height:40px}
}
@media(min-width:761px){.ux-jump,.pph .ux-read{display:none!important}}
@media(prefers-reduced-motion:reduce){.ux-tip,.ux-jump,:is(#perfect-stars-explorer,#city-square-explorer,#tenpoint-explorer) .plan-expanded .ux-hint{transition:none}}
