/* ==========================================================================
   JSS — Page & component CSS: mobile shell, catalogue, project, tools, print
   ========================================================================== */

/* ---------- Mobile drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 300; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(8,16,26,.5); opacity: 0; transition: opacity var(--dur); }
.drawer.open .drawer__scrim { opacity: 1; }
.drawer__panel { position: absolute; inset: 0 0 0 auto; width: min(400px, 88vw); background: var(--warm-white); box-shadow: var(--shadow-3); transform: translateX(100%); transition: transform var(--dur) var(--ease); display: flex; flex-direction: column; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer.open .drawer__panel { transform: translateX(0); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--warm-white); z-index: 2; }
.drawer__head img { height: 48px; width: auto; }
.drawer__nav { padding: 10px 12px 20px; }
.drawer__nav > ul > li { border-bottom: 1px solid var(--line); }
.drawer__nav > ul > li:last-child { border-bottom: none; }
.drawer__nav > ul > li > a, .m-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 15px 14px; font-family: var(--serif); font-weight: 500; font-size: 1.2rem; color: var(--ink); border-radius: var(--r-sm); text-align: left; min-height: 54px; cursor: pointer; list-style: none; transition: background var(--dur), color var(--dur); }
.m-disclosure > summary::-webkit-details-marker, .m-disclosure > summary::marker { display: none; content: ""; }
.m-disclosure > summary svg { width: 20px; height: 20px; flex: none; color: var(--gold-deep); transition: transform var(--dur); }
.m-disclosure[open] > summary { color: var(--gold-deep); }
.m-disclosure[open] > summary svg { transform: rotate(180deg); }
.drawer__nav > ul > li > a:hover, .m-disclosure > summary:hover { background: var(--sand); color: var(--gold-deep); }
.m-disclosure ul { padding: 2px 8px 12px 14px; display: grid; gap: 2px; }
.m-disclosure ul a { display: block; padding: 11px 14px; color: var(--muted); font-weight: 550; font-size: .98rem; border-radius: var(--r-sm); min-height: 44px; }
.m-disclosure ul a:hover { color: var(--gold-deep); background: var(--sand); }
.m-disclosure ul li:first-child a { color: var(--gold-deep); font-weight: 650; }
.drawer__cta { padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; border-top: 1px solid var(--line); margin-top: auto; background: var(--sand); }

/* ---------- Bottom navigation (app style) ---------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--paper); border-top: 1px solid var(--line); display: none; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -2px 12px rgba(12,22,34,.06); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 6px; font-size: .68rem; font-weight: 600; color: var(--muted); position: relative; min-height: 56px; justify-content: center; }
.bottom-nav a[aria-current="page"] { color: var(--gold-deep); }
.bottom-nav svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.bottom-nav .count { position: absolute; top: 4px; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--gold); color: #23180a; font-size: .62rem; font-weight: 800; display: none; place-items: center; }
.bottom-nav .count.show { display: grid; }

@media (max-width: 900px) {
  .primary-nav { display: none; }
  .header__inner { justify-content: space-between; }
  .header__util { margin-left: auto; gap: 2px; }
  .header__util .desktop-only { display: none; }
  .btn-menu { display: inline-flex; align-items: center; justify-content: center; }
  /* clear tap target for the menu on mobile */
  .site-header:not(.is-transparent) .btn-menu { border: 1px solid var(--line-2); border-radius: var(--r-sm); }
  .site-header.is-transparent .btn-menu { border: 1px solid rgba(255,255,255,.35); border-radius: var(--r-sm); }
}
@media (max-width: 768px) {
  .bottom-nav { display: grid; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .site-footer { margin-bottom: 0; }
}

/* ---------- Sticky mobile action bar (project pages) ---------- */
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; background: var(--paper); border-top: 1px solid var(--line); display: none; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 16px rgba(12,22,34,.1); }
.action-bar .btn { flex: 1; }
@media (max-width: 768px) { .has-action-bar .bottom-nav { display: none; } .has-action-bar { padding-bottom: 0; } .action-bar { display: flex; } }

/* ---------- Catalogue ---------- */
.catalogue { display: grid; grid-template-columns: 288px 1fr; gap: 28px; align-items: start; }
@media (max-width: 980px) { .catalogue { grid-template-columns: 1fr; } }
.filters { position: sticky; top: calc(var(--header-h) + 12px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 18px 18px; max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; }
.filter-group { padding: 16px 0; border-bottom: 1px solid var(--line); }
.filter-group:last-child { border-bottom: none; }
.filter-group > h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; font-family: var(--sans); }
.filter-group label.check { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: .9rem; cursor: pointer; }
.filter-group label.check input { width: 17px; height: 17px; accent-color: var(--gold-deep); }
.filter-group .range-row { display: flex; gap: 8px; }
.filter-group select, .filter-group input[type="number"] { width: 100%; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); min-height: 44px; }
.cat-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cat-count { font-weight: 650; }
.cat-count b { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); }
.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.view-toggle button { padding: 8px 12px; color: var(--muted); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.results-grid.list-view { grid-template-columns: 1fr; }
.results-grid.list-view .pcard { flex-direction: row; }
.results-grid.list-view .pcard__media { width: 300px; aspect-ratio: 4/3; flex: none; }
@media (max-width: 620px) { .results-grid.list-view .pcard { flex-direction: column; } .results-grid.list-view .pcard__media { width: 100%; } }
.filter-bar-mobile { display: none; gap: 10px; margin-bottom: 16px; }
.filter-bar-mobile .btn { flex: 1; }
.only-mobile, .only-mobile-flex { display: none; }
@media (max-width: 980px) {
  .filters { display: none; }
  .filter-bar-mobile { display: flex; }
  .filters.sheet-open { display: block; position: fixed; inset: 0; z-index: 320; background: var(--warm-white); max-height: 100vh; border-radius: 0; padding: 0 20px 100px; overflow-y: auto; }
  .filters.sheet-open .only-mobile-flex { display: flex; position: sticky; top: 0; background: var(--warm-white); padding-block: 16px; border-bottom: 1px solid var(--line); margin-inline: -20px; padding-inline: 20px; z-index: 2; }
  .only-mobile { display: block; }
}
@media (max-width: 980px) { .cat-toolbar .desktop-only { display: none; } }

/* Filter sheet (mobile) */
.filter-sheet { position: fixed; inset: 0; z-index: 300; visibility: hidden; }
.filter-sheet.open { visibility: visible; }
.filter-sheet__scrim { position: absolute; inset: 0; background: rgba(8,16,26,.5); opacity: 0; transition: opacity var(--dur); }
.filter-sheet.open .filter-sheet__scrim { opacity: 1; }
.filter-sheet__panel { position: absolute; inset: auto 0 0 0; max-height: 88vh; background: var(--warm-white); border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(100%); transition: transform var(--dur) var(--ease); display: flex; flex-direction: column; }
.filter-sheet.open .filter-sheet__panel { transform: translateY(0); }
.filter-sheet__head, .filter-sheet__foot { padding: 16px 20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.filter-sheet__head { border-bottom: 1px solid var(--line); }
.filter-sheet__foot { border-top: 1px solid var(--line); background: var(--warm-white); }
.filter-sheet__body { overflow-y: auto; padding: 0 20px; }

.empty-state { text-align: center; padding: 60px 20px; border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.empty-state svg { width: 48px; height: 48px; stroke: var(--muted-2); fill: none; stroke-width: 1.5; margin: 0 auto 16px; }

/* ---------- Project page ---------- */
.project-hero { position: relative; }
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16/8; }
.gallery img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gallery > :first-child { grid-row: span 2; }
/* fewer than 5 images: no empty cells */
.gallery--n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.gallery--n1 > :first-child { grid-row: auto; }
.gallery--n2 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr; }
.gallery--n2 > :first-child { grid-row: auto; }
.gallery--n3 { grid-template-columns: 2fr 1fr; }
.gallery--n4 > :nth-child(4) { grid-column: span 2; }
.gallery__more { position: absolute; right: 16px; bottom: 16px; }
@media (max-width: 720px) { .gallery { grid-template-columns: 1fr 1fr; aspect-ratio: 4/3; } .gallery > :first-child { grid-row: span 1; grid-column: span 2; } .gallery > :nth-child(n+4) { display: none; } }
.proj-layout { display: grid; grid-template-columns: 1fr 360px; gap: 40px; align-items: start; }
@media (max-width: 980px) { .proj-layout { grid-template-columns: 1fr; } }
.proj-aside { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; }
/* taller than the screen? scroll inside the sticky sidebar so the brochure form and adviser card stay reachable */
@media (min-width: 981px) { .proj-aside { max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px 6px 2px 2px; margin: -2px -6px -2px -2px; } }
@media (max-width: 980px) { .proj-aside { position: static; } }
.fact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
@media (max-width: 760px) { .fact-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .fact-grid { grid-template-columns: 1fr; } }
.fact { background: var(--paper); padding: 16px; }
.fact .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact .v { font-weight: 700; font-size: 1.05rem; margin-top: 4px; color: var(--ink); }
.amenity-cat { margin-bottom: 20px; }
.amenity-cat h4 { margin-bottom: 10px; }
.amenity-list { display: flex; flex-wrap: wrap; gap: 8px; }
.amenity-list span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; background: var(--sand); border-radius: var(--r-pill); font-size: .87rem; }
.amenity-list svg { width: 15px; height: 15px; stroke: var(--gold-deep); fill: none; stroke-width: 1.8; }
.pay-timeline { display: grid; gap: 2px; }
.pay-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pay-bar { height: 8px; border-radius: 4px; background: var(--stone); overflow: hidden; margin-top: 6px; }
.pay-bar > span { display: block; height: 100%; background: var(--gradient-gold); }
.pay-pct { font-family: var(--serif); font-size: 1.3rem; color: var(--gold-deep); }
.advisory-view { display: grid; gap: 16px; }
.advisory-col h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.advisory-col.strength h4 { color: var(--success); }
.advisory-col.consider h4 { color: var(--warn); }
.advisory-col.limit h4 { color: var(--danger); }
.advisory-col ul { display: grid; gap: 8px; }
.advisory-col li { display: flex; gap: 8px; font-size: .92rem; }
.advisory-col li::before { content: "—"; color: var(--muted-2); }
.brochure-panel { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--sand); }
.brochure-panel img { width: 74px; height: 100px; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow-1); flex: none; }
.brochure-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.brochure-actions[hidden], .brochure-gate[hidden], .brochure-gate__done[hidden] { display: none; }
.brochure-gate { flex-basis: 100%; border-top: 1px solid var(--line-2); padding-top: 14px; }
.brochure-gate__intro { font-size: .88rem; font-weight: 600; margin-bottom: 12px; }
.brochure-gate .form-field { margin-bottom: 12px; }
.brochure-gate .form-note { margin-top: 8px; }
.brochure-gate__hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.brochure-gate__done { flex-basis: 100%; font-size: .88rem; color: var(--success); font-weight: 600; }
.adviser-card { padding: 20px; text-align: center; }
.adviser-card img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; box-shadow: var(--shadow-1); }
.adviser-card .brn { font-size: .8rem; color: var(--muted); }
.floorplan-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.floorplan-tabs button { padding: 8px 14px; border: 1px solid var(--line-2); border-radius: var(--r-pill); font-weight: 600; font-size: .87rem; }
.floorplan-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.price-lockup { font-family: var(--serif); font-size: 2rem; color: var(--ink); line-height: 1; }
.price-lockup small { font-family: var(--sans); font-size: .8rem; color: var(--muted); font-weight: 600; display: block; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(6,10,16,.94); display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 6px; }
.lightbox__close, .lightbox__nav { position: absolute; background: rgba(255,255,255,.12); color: #fff; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; }
.lightbox__close { top: 20px; right: 20px; }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__nav.prev { left: 16px; } .lightbox__nav.next { right: 16px; }
.lightbox__count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; }
.lightbox svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2; }

/* ---------- Tools / calculators ---------- */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 820px) { .calc { grid-template-columns: 1fr; } }
.calc__inputs { display: grid; gap: 4px; }
.calc__result { background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 28px; position: sticky; top: calc(var(--header-h) + 16px); }
.calc__result h3 { color: #fff; }
.result-big { font-family: var(--serif); font-size: clamp(2rem, 1.4rem + 3vw, 3.2rem); color: var(--gold-2); line-height: 1; margin: 8px 0; }
.result-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.14); font-size: .95rem; }
.result-row b { font-weight: 700; }
.range-input { display: grid; gap: 6px; margin-bottom: 14px; }
.range-input .rl { display: flex; justify-content: space-between; font-size: .88rem; }
.range-input .rl b { font-weight: 700; }
.range-input input[type="range"] { width: 100%; accent-color: var(--gold-deep); height: 30px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.seg button { padding: 8px 16px; font-weight: 600; font-size: .88rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* Compare */
.compare-table { min-width: 720px; }
.compare-table th:first-child, .compare-table td:first-child { position: sticky; left: 0; background: var(--sand); z-index: 1; font-weight: 700; }
.compare-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.compare-slot { border: 2px dashed var(--line-2); border-radius: var(--r-md); padding: 20px; text-align: center; min-height: 140px; display: grid; place-items: center; }

/* Match finder */
.matcher { max-width: 680px; margin-inline: auto; }
.matcher__card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: clamp(24px, 4vw, 44px); }
.matcher__progress { height: 6px; background: var(--stone); border-radius: 3px; overflow: hidden; margin-bottom: 24px; }
.matcher__progress > span { display: block; height: 100%; background: var(--gradient-gold); transition: width var(--dur); }
.matcher__opts { display: grid; gap: 12px; margin: 20px 0; }
.matcher__opt { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border: 1.5px solid var(--line-2); border-radius: var(--r-md); font-weight: 600; text-align: left; transition: border-color var(--dur), background var(--dur); }
.matcher__opt:hover, .matcher__opt[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.matcher__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }

/* ---------- Editorial / content ---------- */
.prose { max-width: 72ch; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose ul { display: grid; gap: 8px; padding-left: 1.2em; list-style: disc; }
.prose ol { display: grid; gap: 8px; padding-left: 1.2em; list-style: decimal; }
.prose a:not(.btn) { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { border-left: 3px solid var(--gold); padding-left: 18px; font-style: italic; color: var(--muted); }
.toc { background: var(--sand); border-radius: var(--r-md); padding: 20px 24px; }
.toc a { display: block; padding: 5px 0; color: var(--fg); font-weight: 550; }
.toc a:hover { color: var(--gold-deep); }
.author-line { display: flex; align-items: center; gap: 12px; font-size: .88rem; color: var(--muted); }
.author-line img { width: 40px; height: 40px; border-radius: 50%; }

/* ---------- Reveal animation ---------- */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }

/* ---------- Map placeholder ---------- */
.map-embed { aspect-ratio: 16/9; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--stone); position: relative; }
.map-static { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; background: linear-gradient(135deg, #eef2f6, #e3e9ef); }
.map-static svg { width: 40px; height: 40px; stroke: var(--navy-2); fill: none; stroke-width: 1.5; margin-bottom: 10px; }

/* ---------- Print ---------- */
@media print {
  .site-header, .bottom-nav, .action-bar, .drawer, .filter-sheet, .back-to-top, .site-footer .footer__news, .pcard__save, .search-widget, .lightbox { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  .hero { min-height: auto; color: #000; }
  .hero::after { display: none; }
  .proj-layout { grid-template-columns: 1fr; }
  a[href]::after { content: ""; }
  .card, .fact-grid { box-shadow: none; break-inside: avoid; }
  .section { padding-block: 16px; }
}
