/* ============================================================
   Refinement layer — alignment, premium polish, animation hooks
   Loaded last so it overrides earlier rules.
   ============================================================ */

/* ---- Community detail: indicative market stats row ---- */
.cm-stats { display: flex; flex-wrap: wrap; gap: clamp(1.6rem, 4vw, 3.5rem); padding: 1.5rem 0; border-block: 1px solid var(--line-light); margin: 1.4rem 0 2.6rem; }
.cm-stat b { font-family: var(--serif); font-weight: 400; font-size: clamp(1.5rem, 1rem + 1.6vw, 2.2rem); line-height: 1; display: block; }
.cm-stat span { font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--on-light-soft); margin-top: .45rem; display: block; }

/* ---- Community-card labels: brand red, never gold ---- */
.comm-card__body .k { color: var(--accent-2) !important; }

/* ---- Keyholes that "unlock" (turn) on hover — list rows + cards ---- */
.row__go svg.keyhole { width: 17px; height: 18px; transition: transform .55s var(--ease); }
.row:hover .row__go { transform: none; background: var(--accent); color: #fff; }
.row:hover .row__go svg.keyhole { transform: rotate(90deg); }
.comm-card { cursor: pointer; }
.comm-card__link { position: absolute; inset: 0; z-index: 3; }
.comm-card__arrow svg.keyhole { width: 16px; height: 17px; transition: transform .55s var(--ease); }
.comm-card:hover .comm-card__arrow { transform: none; background: var(--accent); }
.comm-card:hover .comm-card__arrow svg.keyhole { transform: rotate(90deg); }

/* ---- Testimonial stars: custom SVG, brand red ---- */
.qcard__stars { display: inline-flex; gap: 4px; color: var(--accent); font-size: 0; }
.qcard__stars svg { width: 14px; height: 14px; }

/* ---- Smoother page-to-page navigation: gentle fade-in on load ---- */
@keyframes pageFade { from { opacity: 0; } to { opacity: 1; } }
body { animation: pageFade .5s ease both; }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }

/* ============================================================
   Services page: day → night sky that animates on scroll
   ============================================================ */
/* One continuous page-tall gradient inside the shell (JS sets the stops) */
/* Fixed sky that animates day → sunset → night as you scroll (kept inside the white frame) */
.sky-bg {
  position: fixed; inset: var(--frame); z-index: -2; border-radius: var(--frame-radius);
  overflow: hidden; pointer-events: none;
}
.sky-sun {
  position: absolute; left: 50%; top: 76%; width: 75vmax; height: 75vmax;
  transform: translate(-50%, -50%); border-radius: 50%; filter: blur(10px); pointer-events: none;
  background: radial-gradient(circle, rgba(255,186,120,.55) 0%, rgba(255,186,120,0) 60%);
}
/* Cream wash for daytime legibility — JS fades it to 0 by night for a seamless join */
.sky-veil { position: fixed; inset: var(--frame); z-index: -1; border-radius: var(--frame-radius); pointer-events: none; }
/* On Services the sections are transparent so the sky shows straight through */
body[data-page="our-services"] .shell { background: transparent; }
body[data-page="our-services"] .section.standard,
body[data-page="our-services"] .section.lite { background: transparent; }
body[data-page="our-services"] .card { background: rgba(251,248,241,0.92); }
body[data-page="our-services"] .phero__media img { opacity: .62; }
body[data-page="our-services"] .phero::after {
  background: linear-gradient(180deg, rgba(20,16,26,0.28) 0%, rgba(20,16,26,0.06) 38%, rgba(20,16,26,0.66) 100%);
}
/* the CTA IS the night — its dark ink now matches the sky above it (veil = 0) → no seam */
body[data-page="our-services"] .cta { background: var(--ink); }

/* ---- CTA heading: balanced + truly centred (no one-word-per-line) ---- */
.cta__head { max-width: min(92%, 60rem); }
.cta__head h2 { text-wrap: balance; }

/* A touch more line spacing on multi-line editorial headings — 1.02 reads cramped */
.sec-head h2, .phero h1, .cta__head h2 { line-height: 1.1; }

/* ---- Contact intro sub-line on one line ---- */
body[data-page="contact"] .phero__sub { max-width: none; }

/* ---- Custom dropdown: red scrollbar + native wheel scroll ---- */
.csel__menu { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; overscroll-behavior: contain; }
.csel__menu::-webkit-scrollbar { width: 8px; }
.csel__menu::-webkit-scrollbar-track { background: transparent; }
.csel__menu::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* ---- Bookmark (save) button: centre the icon ---- */
.pcard__fav { display: grid; place-items: center; }
.pcard__fav svg { width: 17px; height: 19px; }

/* ---- Nav: reserve the sign-in slot so it doesn't jolt on load ---- */
.auth-slot { min-width: 64px; display: flex; justify-content: flex-end; align-items: center; }

/* ---- Auth modal: room for the close button + locked create-account ---- */
.auth-card { padding-top: 3.6rem; }
.auth-x { top: 1rem; right: 1rem; }
.auth-tabs button.locked { opacity: .55; cursor: not-allowed; display: inline-flex; align-items: center; justify-content: center; gap: .5em; }
.auth-tabs button.locked svg { width: 11px; height: 11px; }

/* ---- Avoid orphan / widow last lines in body copy ---- */
/* Short/medium blocks: balance so a single word never sits on its own line */
.svcblock li, .card p, .cta-card p, .comm-card__body p, .qcard blockquote,
.split__text p, .standard__head p, .sec-head p, .sec-head.two .desc-col p,
.empty p, .hero__sub, .phero__sub, .shift__copy, .pd-features li,
.contact-line span, .row__main p { text-wrap: balance; }
/* Long-form prose: pretty (no orphans, without reflowing everything) */
.prose p, .pd-body p, .legal-body p, .form__aside p { text-wrap: pretty; }

/* ---- Service tabs: drop the checkered-flag motif, tidy headings ---- */
.svc__flag { display: none !important; }
.svc__panel-text h3 { font-size: clamp(1.7rem, 1.1rem + 1.7vw, 2.4rem); line-height: 1.04; margin-bottom: clamp(1rem, 1.6vw, 1.5rem); }
.svc__panel-text h3 em, .svc__panel-text h3 .nb { white-space: nowrap; }

/* ---- Shift intro: spacing + supporting copy + quick enquiry ---- */
.shift__intro { gap: clamp(2rem, 4vw, 3.2rem); padding-block: 9.5rem 5rem; }
.shift__brandline { gap: clamp(1.2rem, 2.5vw, 2rem); }
.shift__brandline img { margin-bottom: .3rem; }
.shift__brandline .lead {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.4rem, 1.5rem + 3.2vw, 4.6rem); line-height: 1.08; letter-spacing: -.02em;
}
.shift__brandline .lead em { font-style: italic; }
/* HJ monogram cross-fades black → white as the background darkens */
.shift__logo { position: relative; display: inline-block; line-height: 0; }
.shift__logo .lg-light { position: absolute; inset: 0; opacity: var(--t); }
.shift__logo .lg-dark { opacity: calc(1 - var(--t)); }
/* WhatsApp button: green glow on hover, not the default red */
.shift__wa:hover { box-shadow: 0 14px 34px -14px rgba(31, 174, 84, 0.55) !important; }
.shift__copy {
  max-width: 52ch; margin: .2rem auto 0; font-size: var(--step-1); line-height: 1.5;
  color: color-mix(in srgb, var(--on-dark-soft) calc(var(--t) * 100%), var(--on-light-soft));
}
.shift__cta { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }
.shift__wa { --bg: #1fae54; --fg: #fff; }
.shift__wa svg { width: 18px; height: 18px; }
.shift__form {
  width: min(580px, 100%); margin: .6rem auto 0; text-align: left;
  display: grid; grid-template-columns: 1fr 1fr; gap: .7rem;
  background: rgba(20,18,16,.55); border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg); padding: 1.4rem; backdrop-filter: blur(8px);
  animation: quickIn .5s var(--ease);
}
@keyframes quickIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.shift__form[hidden] { display: none; }
.shift__form .full { grid-column: 1 / -1; }
.shift__form input, .shift__form textarea {
  font: inherit; font-size: .95rem; width: 100%; padding: .8em .9em; border-radius: 11px;
  background: rgba(246,241,231,.06); border: 1px solid var(--line-dark); color: var(--cream);
}
.shift__form input::placeholder, .shift__form textarea::placeholder { color: var(--on-dark-faint); }
.shift__form input:focus, .shift__form textarea:focus { outline: none; border-color: var(--accent); }
.shift__form-note { color: var(--on-dark-faint); font-size: .72rem; text-align: center; margin: .2rem 0 0; }

/* ---- "The new standard for Dubai" — true centre ---- */
.standard__head { text-align: center; margin-inline: auto; max-width: 24ch; }
.standard__head h2, .standard__head p { margin-inline: auto; }

/* ---- Editorial mosaic: equalise heights, kill the gap under wide image ---- */
.standard__grid { align-items: start; }
.feat--tall, .feat--wide { aspect-ratio: auto; height: clamp(300px, 33vw, 470px); }
.feat--img { aspect-ratio: auto; height: clamp(280px, 28vw, 410px); }
.feat--quote { aspect-ratio: auto; }
.feat--quote .feat__quote { min-height: clamp(280px, 28vw, 410px); }

/* ---- Static, fully-covering images (parallax translate removed) ---- */
[data-parallax] { overflow: hidden; }
[data-parallax] img { height: 100% !important; top: 0 !important; bottom: 0 !important; object-fit: cover; }
/* Property cards: make the image fill the media area (no badge pushing it down) */
.pcard__media img { position: absolute !important; inset: 0; width: 100%; height: 100%; }

/* ---- Featured-listings header: one-line heading + button ---- */
.feat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: clamp(2rem, 4vw, 3rem); }
.feat-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.9rem, 1rem + 2.6vw, 3.1rem); line-height: 1.04; letter-spacing: -.02em; white-space: nowrap; }
.feat-head h2 em { color: var(--accent); font-style: italic; }
.feat-head .eyebrow { margin-bottom: .9rem; }
.feat-head .btn { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 760px){ .feat-head h2 { white-space: normal; } }

/* ---- Nav: truly centre the links regardless of left/right widths ---- */
@media (min-width: 961px) {
  .nav { display: grid !important; grid-template-columns: 1fr auto 1fr; }
  .nav__logo { justify-self: start; }
  .nav__links { justify-self: center; }
  .nav__right { justify-self: end; }
}

/* ---- Stats: centre numbers + labels within each column ---- */
.stats__grid .stat { text-align: center; }
.stats__grid .stat__label { justify-content: center; }

/* ---- Stats: animate the label in with the number ---- */
.stat.is-in .stat__num { animation: statPop .7s var(--ease) both; }
.stat.is-in .stat__label { animation: statLabel .8s var(--ease) .25s both; }
@keyframes statPop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes statLabel { from { opacity: 0; transform: translateY(10px); letter-spacing: .04em; } to { opacity: 1; transform: none; letter-spacing: .12em; } }

/* ---- CTA: one-line eyebrow, editorial (un-boxed) cards, ripple canvas ---- */
.cta { position: relative; overflow: hidden; isolation: isolate; }
.cta > .wrap { position: relative; z-index: 2; }
.cta canvas.ripple { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.cta__head .eyebrow { white-space: nowrap; }
.cta__head h2 em { white-space: nowrap; }
.cta__grid { gap: clamp(1.6rem, 3vw, 3rem); }
.cta-card {
  background: none; border: none; border-top: 1px solid rgba(246,241,231,.22);
  border-radius: 0; padding: 1.5rem 0 0; min-height: 0; backdrop-filter: none;
  transition: border-color .45s var(--ease), transform .45s var(--ease);
}
.cta-card:hover { background: none; transform: translateY(-4px); border-top-color: var(--accent); box-shadow: none; }
.cta-card .k { font-family: var(--mono); color: var(--accent-2); }
.cta-card h3 { margin-top: .2rem; }
/* On mobile the CTA cards stack — centre them to match the centred heading */
@media (max-width: 720px) {
  .cta__grid { text-align: center; }
  .cta-card { align-items: center; }
  .cta-card .k, .cta-card .go { justify-content: center; }
}
.cta-card .go { color: var(--cream); }
.cta-card:hover .go { color: var(--accent-2); }

/* ---- Premium contact icons (badge them) ---- */
.contact-line { align-items: center; gap: 1.1rem; padding: 1.1rem 0; }
.contact-line svg {
  width: 42px; height: 42px; padding: 11px; flex: 0 0 auto; margin: 0;
  border: 1px solid var(--line-light); border-radius: 50%;
  color: var(--accent); stroke-width: 1.5; transition: background .3s, color .3s, border-color .3s;
}
.contact-line:hover svg { background: var(--accent); color: #fff; border-color: var(--accent); }
.contact-line b { font-family: var(--serif); font-size: 1.05rem; font-weight: 400; margin-bottom: .1rem; }

/* ---- Premium forms + custom selects ---- */
.form { background: linear-gradient(180deg, var(--paper), var(--cream)); box-shadow: 0 30px 70px -50px rgba(13,12,10,.5); }
.field label, .filters .field label { font-size: .6rem; letter-spacing: .16em; }
.field input, .field textarea, .field select { border-radius: 12px; background: #fff; transition: border-color .3s, box-shadow .3s; }
.field input:focus, .field textarea:focus { box-shadow: 0 0 0 3px rgba(209,44,26,.1); }
.form__aside h2 em { white-space: nowrap; }
.form .btn, .pd-aside .btn { letter-spacing: .14em; }

/* Custom select control (replaces native dropdown styling) */
.csel { position: relative; }
/* In the listings filter bar, match the brand dropdowns to the input/RESET sizing */
.filters .csel__btn { font-size: .92rem; padding: .6em .7em; border-radius: 10px; background: var(--cream); }
.csel__btn { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: .5em;
  font: inherit; font-size: var(--step-0); color: var(--on-light); background: #fff;
  border: 1px solid var(--line-light); border-radius: 12px; padding: .8em .9em; cursor: pointer; transition: border-color .3s, box-shadow .3s; }
.csel__btn[data-placeholder="true"] { color: var(--on-light-faint); }
.csel__btn .chev { width: 14px; height: 14px; color: var(--accent); transition: transform .3s; flex: 0 0 auto; }
.csel.open .csel__btn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(209,44,26,.1); }
.csel.open .csel__btn .chev { transform: rotate(180deg); }
.csel__menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--paper); border: 1px solid var(--line-light); border-radius: 14px; padding: .4rem;
  max-height: 280px; overflow-y: auto; box-shadow: 0 26px 60px -28px rgba(13,12,10,.45);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s; }
.csel.open .csel__menu { opacity: 1; visibility: visible; transform: none; }
.csel__opt { padding: .6em .8em; border-radius: 9px; font-size: .92rem; cursor: pointer; color: var(--on-light); transition: background .2s, color .2s; }
.csel__opt:hover { background: var(--paper-2); }
.csel__opt.sel { background: var(--accent); color: #fff; }
.csel__opt[data-placeholder="true"] { color: var(--on-light-faint); }
/* dark variant for selects on ink (filters reuse light; shift form none) */

/* ---- Communities page: balance the giant header, tidy rows ---- */
.communities .sec-head, .communities .sec-head.two { max-width: none; }
/* Two-column header: lead can shrink (min 0) so big words wrap; desc keeps a
   guaranteed minimum width so its text never collapses to one word per line. */
.sec-head.two {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(min(100%, 340px), 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: end; max-width: none;
}
.sec-head.two .lead-col h2 { font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); line-height: 1.04; }
.sec-head.two .desc-col p { color: var(--on-light-soft); font-size: var(--step-1); line-height: 1.5; max-width: 42ch; }
#communities .desc-col p { font-size: var(--step-0); line-height: 1.55; max-width: 50ch; }

/* Card titles: keep long words (e.g. "Personalisation") inside the card */
.card h3 { font-size: clamp(1.35rem, 1rem + 1vw, 1.7rem); overflow-wrap: break-word; hyphens: auto; }

/* FAQ toggle: crisp, centred, on-brand plus → × (built from two hairlines) */
.faq__q .ic { position: relative; width: 32px; height: 32px; font-size: 0; color: var(--on-light); }
.faq__q .ic::before, .faq__q .ic::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 12px; height: 1.5px; background: currentColor; border-radius: 2px;
  transform: translate(-50%, -50%);
}
.faq__q .ic::after { transform: translate(-50%, -50%) rotate(90deg); }
.faq__q:hover .ic { border-color: var(--accent); color: var(--accent); }
.faq__item.open .faq__q .ic { color: #fff; }
@media (max-width: 820px){ .sec-head.two { grid-template-columns: 1fr; } }

.row { grid-template-columns: 11ch 1fr auto; gap: 2.4rem; align-items: start; }
.row__k { padding-top: .7rem; }
.row__main h3 { line-height: 1.05; }
/* On mobile the label sits on its own line so the text gets the full width (no left-squash) */
@media (max-width: 620px) {
  .row { grid-template-columns: 1fr auto; gap: .8rem 1.2rem; align-items: center; }
  .row__k { grid-column: 1 / -1; padding-top: 0; width: auto; }
  .row__main { grid-column: 1; }
}
/* Bigger, tappable consent checkbox on every screen */
.form__consent input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--accent); margin-top: .1rem; }
/* The WhatsApp float overlaps the hero scroll cue on small screens — hide the cue there */
@media (max-width: 720px) { .hero__scroll { display: none; } }
/* Darken the hero/intro image scrim on mobile so overlaid text stays legible */
@media (max-width: 720px) {
  .phero::after { background: linear-gradient(180deg, rgba(13,12,10,0.62) 0%, rgba(13,12,10,0.52) 45%, rgba(13,12,10,0.86) 100%); }
}
.split__text h2 .nb { white-space: nowrap; }

/* ---- Properties: "best homes" copy width, browse intro ---- */
.empty p { max-width: 60ch; }
.empty h2 { max-width: 16ch; margin-inline: auto; }

/* ---- Horizontal scroll-on-scroll rails ---- */
[data-hscroll] { overflow: hidden; }
[data-hscroll] .rail { overflow: visible; margin-inline: 0; padding-inline: 0;
  grid-auto-columns: clamp(280px, 30vw, 400px); will-change: transform; }
.hscroll-hint { font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--on-light-faint); margin-top: 1rem; display: flex; align-items: center; gap: .5em; }
@media (prefers-reduced-motion: reduce) { [data-hscroll] .rail { overflow-x: auto; } }
/* On mobile the GSAP pin is disabled — let the rail be swiped horizontally by touch */
@media (max-width: 759px) {
  [data-hscroll] { overflow: visible; }
  [data-hscroll] .rail { overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
}

/* ---- Spinning key accent (properties) ---- */
.keyspin { display: grid; place-items: center; margin: 1.5rem 0; }
.keyspin svg { width: 54px; height: 54px; color: var(--accent); animation: keyturn 9s linear infinite; transform-origin: 50% 50%; }
@keyframes keyturn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .keyspin svg { animation: none; } }
