/* =============================================================
   Redesigned listing (property detail) page.
   templates/public/property_detail_rd.html; docs/redesign/BRIEF.md;
   mockup docs/redesign/mockups/listing.dc.html.
   Loaded only by the listing page (after rd.css). Part 1 is the new layout
   (rdl- classes). Part 2 is the component CSS carried over from
   public/property_detail.html for the cards and overlays the new page keeps
   (gallery, lightbox, payment calculator, modals, nearby map, gated cards,
   timeline); those selectors exist only in markup copied from that page.
   ============================================================= */

/* Legacy aliases the carried-over components read. */
:root { --primary: var(--brand-primary); --primary-dark: var(--brand-accent); }

/* ---------- breadcrumb row ---------- */
.rdl-crumbs { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 20px; padding-top: 6px; font-size: 14px; }
.rdl-crumbs__trail { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: center; color: var(--rd-muted); min-width: 0; }
.rdl-crumbs__trail a, .rdl-crumbs__back { min-height: var(--rd-tap); display: inline-flex; align-items: center; }
.rdl-crumbs__trail > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rdl-crumbs__back { font-weight: 600; text-decoration: none; }

/* ---------- gallery: hero + up to six thumbs; one photo on a phone ---------- */
.rdl-gallery-wrap { padding-top: 4px; }
.rd .gallery-container.rdl-gallery {
  --hero-h: clamp(240px, 38vw, 470px);
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 6px;
  height: var(--hero-h); margin: 0; border-radius: var(--rd-radius-card); overflow: hidden; position: relative;
  background: var(--brand-tint);
}
.rd .rdl-gallery--single { grid-template-columns: 1fr !important; }
.rd .rdl-gallery .main-photo { width: 100%; height: var(--hero-h); object-fit: cover; display: block; }
.rd .rdl-gallery .side-photos { height: var(--hero-h); }
/* rd.css sets `.rd img { height: auto }`; the collage cells must fill their grid row. */
.rd .rdl-gallery .side-photo, .rd .rdl-gallery .more-photos-overlay, .rd .rdl-gallery .more-photos-overlay img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rd .lb-thumb img, .rd .lb-grid-item img { height: 100%; }
.rd .rdl-gallery .gallery-viewall-btn { border-radius: var(--rd-radius-btn); min-height: var(--rd-tap); }

/* ---------- two columns: content + sticky contact rail ---------- */
.rdl-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  column-gap: 48px; align-items: start;
  padding-top: 24px; padding-bottom: clamp(48px, 6vw, 72px);
}
.rdl-layout > * { grid-column: 1; min-width: 0; }
.rdl-layout > .rdl-rail { grid-column: 2; grid-row: 1 / span 40; align-self: stretch; }
.rdl-rail .rd-contact { position: sticky; top: 16px; }
.rdl-block { margin-top: 44px; }
.rdl-sechead { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.rdl-subhead { font-size: 16px; font-weight: 700; color: var(--brand-primary); margin: 18px 0 4px; }

/* ---------- price / status / H1 / facts ---------- */
.rdl-head { display: flex; flex-direction: column; gap: 12px; }
.rdl-pricerow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rdl-price { font-family: var(--rd-serif); font-weight: 400; font-size: clamp(36px, 4.4vw, 52px); line-height: 1.05; color: var(--brand-primary); font-variant-numeric: lining-nums; }
.rdl-was { font-size: 15px; color: var(--rd-muted); text-decoration: line-through; }
.rdl-chip-cut { background: #FEF2F2; color: #991B1B; }
.rdl-chip-sold { background: var(--brand-primary); color: var(--brand-base); }
.rdl-chip-no { background: #FEF2F2; color: #991B1B; }
.rdl-dom { font-size: 14px; color: var(--rd-muted); }
.rd .rdl-h1 { font-family: var(--rd-sans); font-size: 20px; font-weight: 600; line-height: 1.35; color: var(--brand-primary); }
.rdl-zip { font-size: 14px; margin-top: -8px; }
.rdl-facts { font-size: 16px; color: var(--brand-body); }
.rdl-facts a { color: inherit; text-decoration: underline; text-decoration-color: var(--brand-warm); text-underline-offset: 3px; }
.rdl-quick { display: none; gap: 10px; }
.rdl-quick .rd-btn { flex: 1 1 0; padding: 0 8px; }
.rdl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rdl-actions .rd-btn svg { flex: none; }
.rdl-actions .action-icon-item.saved, .rdl-actions .rd-btn.saved { border-color: #16A34A; color: #166534; background: #F0FDF4; }
.rdl-compare-icon { display: inline-flex; }
.rdl-lbl-short { display: none; }
.rdl-note { font-size: 15px; line-height: 1.55; padding: 12px 14px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-primary); }
.rdl-note--warn { background: var(--rd-warn-bg); color: var(--rd-warn); }
.rdl-note--no { background: #FEF2F2; color: #991B1B; }
.rdl-note a { font-weight: 700; margin-left: 4px; }
.rdl-sold { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.rdl-sold__team { color: var(--rd-ok); font-weight: 600; }

/* ---------- our data on this home ---------- */
.rdl-data { margin-top: 40px; }
.rd .rdl-answer__num { font-size: 26px; line-height: 1.15; }
.rd-fact__num.is-ok.rdl-answer__num { color: var(--rd-ok); }

/* ---------- contact card on a phone: right after the answers ---------- */
.rdl-rail { margin-top: 0; }

/* ---------- about / details ---------- */
.rdl-desc { font-size: 16px; line-height: 1.7; margin-top: 14px; white-space: pre-line; }
.rd .rdl-attrib { font-size: 14px; color: var(--rd-muted); font-style: normal; margin-top: 12px; }
.rdl-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 24px; margin: 18px 0 0; }
.rdl-dl > div { border-top: 1px solid var(--rd-line); padding: 10px 0; display: flex; flex-direction: column; gap: 2px; }
.rdl-dl dt { font-size: 13px; color: var(--rd-muted); }
.rdl-dl dd { margin: 0; font-weight: 600; color: var(--brand-primary); }
.rdl-layout .extended-details { margin-top: 18px; }

/* ---------- what it costs to own ---------- */
.rdl-cost { display: flex; flex-wrap: wrap; gap: 20px 48px; align-items: flex-start; margin: 16px 0; }
.rdl-cost__total { flex: 0 1 240px; display: flex; flex-direction: column; gap: 4px; }
.rdl-cost__num { font-size: 40px; }
.rdl-rows { flex: 1 1 320px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.rdl-rows > div, .rdl-rows > li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 13px 0; border-top: 1px solid var(--rd-line); }
.rdl-rows > div:last-child, .rdl-rows > li:last-child { border-bottom: 1px solid var(--rd-line); }
.rdl-rows dt { display: flex; flex-direction: column; gap: 2px; }
.rdl-rows dt small { font-size: 12px; color: var(--rd-muted); }
.rdl-rows dd, .rdl-rows__val { margin: 0; font-weight: 600; color: var(--brand-primary); }
.rdl-delta { font-size: 13px; font-weight: 600; }
.rdl-delta.is-down { color: #B91C1C; }
.rdl-delta.is-up { color: #15803D; }

/* ---------- native <details> for the long blocks ---------- */
.rdl-more { margin-top: 16px; border: 1px solid var(--rd-line); border-radius: var(--rd-radius-card); background: var(--brand-base); }
.rdl-more > summary { cursor: pointer; list-style: none; min-height: 52px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; color: var(--brand-primary); }
.rdl-more > summary::-webkit-details-marker { display: none; }
.rdl-more > summary::after { content: '+'; font-size: 22px; line-height: 1; color: var(--brand-accent); }
.rdl-more[open] > summary::after { content: '\2212'; }
.rdl-more > :not(summary) { margin: 0 18px 18px; }
.rdl-more .payment-calc-card { box-shadow: none; border: 0; padding: 0; margin-bottom: 18px; }

/* ---------- data cards (STR summary, TRPA, insurance, permits) ---------- */
.rdl-card { border-top: 1px solid var(--brand-warm); padding-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.rdl-card--plain { border-top: 0; padding-top: 0; }
.rdl-card__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rd .rdl-card__title { font-family: var(--rd-serif); font-weight: 400; font-size: 23px; line-height: 1.25; color: var(--brand-primary); }
.rdl-card__sub { font-size: 14px; color: var(--rd-muted); margin-top: 4px; }
.rdl-card__facts { margin-top: 4px; }
.rdl-card__foot { display: flex; flex-direction: column; gap: 10px; }
.rdl-card__links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.rdl-card__links a { font-size: 14px; font-weight: 600; min-height: var(--rd-tap); display: inline-flex; align-items: center; }
.rdl-fine { font-size: 12.5px; line-height: 1.55; color: var(--rd-muted); }
.rdl-ok { color: var(--rd-ok); }
.rdl-caution { color: var(--rd-caution); }
.rdl-bad { color: #B91C1C; }
.rdl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rdl-team { color: #6D28D9; }
.rdl-bar__labels { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 6px; }
.rdl-bar__track { height: 10px; border-radius: 999px; background: var(--rd-line); overflow: hidden; }
.rdl-bar__fill { height: 100%; border-radius: 999px; background: var(--brand-accent); }
.rdl-bar__fill.is-over { background: var(--brand-warm); }
.rdl-bar p { margin-top: 8px; }
.rdl-ins-total { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rdl-ins-total .rd-numeral { font-size: 28px; white-space: nowrap; }
.rdl-ins-total small { font-family: var(--rd-sans); font-size: 13px; color: var(--rd-muted); }
.rdl-ins-form { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.rdl-ins-form__wide { grid-column: 1 / -1; }
.rdl-permits { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--rd-line); }
.rdl-permits li { padding: 10px 0; border-bottom: 1px solid var(--rd-line); display: flex; flex-direction: column; gap: 3px; }
.rdl-permits__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.rdl-permits__type { font-size: 14px; font-weight: 600; color: var(--brand-body); }

/* cost segregation (inside its <details>) */
.rdl-cs-hero { background: var(--brand-primary); color: var(--brand-base); border-radius: var(--rd-radius-card); padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.rdl-cs-hero__label, .rdl-cs-hero__sub { font-size: 13px; color: var(--rd-on-dark); }
.rd .rdl-cs-hero__num { font-size: 34px; color: var(--brand-base); }
.rdl-cs-notice { background: var(--rd-warn-bg); color: var(--rd-warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.rdl-cs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 20px; }
.rdl-cs-grid > div { border-top: 1px solid var(--rd-line); padding: 10px 0; }
.rdl-cs-k { font-size: 13px; color: var(--rd-muted); }
.rdl-cs-v { font-weight: 600; color: var(--brand-primary); }
.rdl-cs-rate { display: flex; align-items: center; gap: 12px; }
.rdl-cs-rate .rd-select { max-width: 160px; }
.rdl-cs-details > summary { cursor: pointer; font-weight: 600; color: var(--brand-accent); min-height: var(--rd-tap); display: flex; align-items: center; }
.rdl-cs-details #cs-details { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.rdl-cs-steps { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- price and sale history ---------- */
.rdl-timeline { margin-top: 6px; }
.rdl-table-wrap { overflow-x: auto; }
.rdl-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rdl-table th { text-align: left; font-weight: 600; color: var(--rd-muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rd-line); }
.rdl-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rd-line); vertical-align: top; }
.rdl-table tr.is-current td { background: var(--brand-tint); }
.rdl-tag { font-size: 12px; font-weight: 600; }
.rdl-sub { display: block; font-size: 12px; color: var(--rd-muted); }

/* ---------- the town's numbers (dark band) ---------- */
.rdl-town { background: var(--brand-primary); color: var(--brand-base); border-radius: var(--rd-radius-panel); padding: clamp(22px, 3vw, 32px); display: flex; flex-direction: column; gap: 18px; }
.rd .rdl-town .rd-h2 { color: var(--brand-base); }
.rdl-town .rd-link-arrow { align-self: flex-start; }
.rdl-townbtn { margin-top: 20px; }
.rd .town-search-btn { white-space: normal; text-align: center; }

/* ---------- carried-over blocks, restyled to fit ---------- */
.rd .rdl-layout .card { box-shadow: none; border: 1px solid var(--rd-line); border-radius: var(--rd-radius-card); }
.rd .rdl-layout .gated-section { margin: 0 !important; max-width: none !important; padding: 0 !important; }
.rd .rdl-layout .nearby-locations, .rd .rdl-layout .nearby-cities, .rd .rdl-layout .mrb-wrap, .rd .rdl-layout .sa-wrap { max-width: none; padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
.rd .rdl-layout .nearby-locations h2, .rd .rdl-layout .nearby-cities h2 { font-family: var(--rd-serif); font-weight: 400; text-align: left; }
.rd .rdl-layout .city-pills { justify-content: flex-start; }
.rd .rdl-layout .city-pill { min-height: var(--rd-tap); display: inline-flex; align-items: center; }
.rd .modal .contact-form { display: flex; flex-direction: column; gap: 12px; }
.rd .modal .contact-form input { min-height: var(--rd-input-h); padding: 0 14px; border: 1px solid var(--rd-input-line); border-radius: var(--rd-radius-btn); font: inherit; font-size: 16px; }
.pc-note { font-size: 11px; color: #94a3b8; padding-left: 24px; margin: -2px 0 8px; }
.coming-soon-badge { position: absolute; left: 12px; top: 12px; }

/* ---------- under 900px: one column, quick actions, card after the answers ---------- */
@media (max-width: 899px) {
  .rdl-layout { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .rdl-layout > .rdl-rail { grid-column: 1; grid-row: auto; margin-top: 32px; }
  .rdl-rail .rd-contact { position: static; }
  .rdl-quick { display: flex; }
  .rd .gallery-container.rdl-gallery { grid-template-columns: 1fr; }
  .rd .rdl-gallery .side-photos { display: none; }
  .rdl-block { margin-top: 36px; }
  .rdl-data { margin-top: 32px; }
}
@media (max-width: 560px) {
  .rd .gallery-container.rdl-gallery { --hero-h: 240px; margin: 0 calc(-1 * var(--rd-gutter)); border-radius: 0; }
  .rdl-crumbs__trail { display: none; }
  .rdl-price { font-size: 36px; }
  /* Phone: Save / Share / Compare / alert / tour sit in ONE row of equal cells
     (icon over a short label), so the four answers start right under
     Call / Tour / Ask. As wrapping pills they took two and a half rows
     (about 210px) and pushed the answers off the first screen (11/20/26). */
  .rdl-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 6px; }
  .rdl-actions > .share-popover-wrap { display: block; }
  .rdl-actions .rd-btn { flex-direction: column; justify-content: center; gap: 4px; width: 100%; min-height: 52px; padding: 6px 2px; font-size: 12px; line-height: 1.2; white-space: nowrap; }
  .rdl-lbl-long { display: none; }
  .rdl-lbl-short { display: inline; }
  /* Share is the second cell now: open its menu from the cell's left edge, or
     it runs 6px off the screen at 360 wide. */
  .rdl-actions .share-popover { left: 0; right: auto; }
  .rdl-ins-total { align-items: flex-start; }
}
/* --- from public/property_detail.html lines 655-815 --- */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    opacity: 0.9;
}
.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.btn-secondary:hover {
    background: #e2e8f0;
}
.btn-saved {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Card */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1rem;
}

/* Description */
.description {
    color: #475569;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Property Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.detail-label {
    color: #64748b;
    font-size: 0.9rem;
}
.detail-value {
    color: #0f172a;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Extended Property Details — Expandable Sections */
.extended-details { margin-top: 0; }
.detail-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    overflow: hidden;
}
.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.detail-section-header:hover { background: #f8fafc; }
.detail-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}
.detail-section-icon {
    width: 20px; height: 20px;
    color: #64748b;
    flex-shrink: 0;
}
.detail-section-chevron {
    width: 20px; height: 20px;
    color: #94a3b8;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.detail-section.open .detail-section-chevron {
    transform: rotate(180deg);
}
.detail-section-body {
    display: none;
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid #f1f5f9;
}
.detail-section.open .detail-section-body { display: block; }
.detail-section-grid {
    display: flex;
    flex-direction: column;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.65rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label {
    color: #64748b;
    font-size: 0.875rem;
    flex-shrink: 0;
    min-width: 160px;
    margin-right: 1.5rem;
}
.detail-row-value {
    color: #0f172a;
    font-weight: 500;
    font-size: 0.875rem;
    text-align: right;
    word-break: break-word;
    flex: 1;
}
.detail-row-value.feature-list {
    text-align: left;
}
@media (max-width: 768px) {
    .detail-section-header { padding: 0.85rem 1rem; }
    .detail-section-body { padding: 0 1rem 1rem; }
    .detail-row-label { min-width: 120px; }
}

/* Map */
/* --- from public/property_detail.html lines 906-1250 --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    height: 100dvh;
    height: var(--lb-vh, 100dvh);
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    flex-direction: column;
    overscroll-behavior: contain;
}
.lightbox.active {
    display: flex;
}

/* The app-download strip (partials/_app_cta.html) carries z-index 10001,
   so with the page scrolled to the top it paints straight over the
   lightbox and buries the counter, grid toggle and close button. Nothing
   outside the overlay should be reachable while it is open anyway. */
body.lightbox-open #app-cta-strip { display: none !important; }

/* --- Top bar: counter (always visible) + grid toggle + close --- */
.lb-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: calc(env(safe-area-inset-top, 0px) + 8px)
             calc(env(safe-area-inset-right, 0px) + 10px)
             8px
             calc(env(safe-area-inset-left, 0px) + 12px);
    z-index: 5;   /* stays above the grid overlay so close/back always work */
}
.lb-actions { display: flex; align-items: center; gap: 6px; }
.lb-town-link { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; background: rgba(255,255,255,0.16); padding: 9px 14px; border-radius: 999px; transition: background .2s, transform .2s; }
.lb-town-link:hover { background: rgba(255,255,255,0.3); }
.lb-town-short { display: none; }
@media (max-width: 480px) { .lb-town-long { display: none; } .lb-town-short { display: inline; } }
.lb-town-link.at-end { background: #1E5C3A; box-shadow: 0 0 0 2px #fff; transform: scale(1.04); }
/* 44x44 minimum on every control — thumb-sized, per WCAG 2.5.5. */
.lightbox-close, .lb-icon-btn {
    position: static;
    background: rgba(255,255,255,0.16);
    border: none;
    color: white;
    cursor: pointer;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.lightbox-close { font-size: 1.9rem; line-height: 1; }
.lightbox-close:hover, .lb-icon-btn:hover { background: rgba(255,255,255,0.3); }
.lightbox-close:focus-visible, .lb-icon-btn:focus-visible,
.lightbox-nav:focus-visible, .lb-thumb:focus-visible, .lb-grid-item:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
.lightbox-counter {
    position: static;
    transform: none;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(0,0,0,0.4);
    padding: 7px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

/* --- Photo stage --- */
.lb-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.75rem;
    line-height: 1;
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.lightbox-prev { left: max(0.75rem, env(safe-area-inset-left, 0px)); }
.lightbox-next { right: max(0.75rem, env(safe-area-inset-right, 0px)); }

/* Swipe slide layers: full-bleed, GPU-composited, centered image. */
.lb-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    will-change: transform;
    backface-visibility: hidden;
}
#lb-slide-b { visibility: hidden; }
/* Keep the controls clickable above the slide layers. */
.lightbox-close, .lightbox-nav, .lightbox-counter { z-index: 2; }

/* --- Thumbnail strip --- */
.lb-thumbs {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.35) transparent;
    padding: 8px calc(env(safe-area-inset-right, 0px) + 10px)
             calc(env(safe-area-inset-bottom, 0px) + 10px)
             calc(env(safe-area-inset-left, 0px) + 10px);
    z-index: 3;
}
.lb-thumbs::-webkit-scrollbar { height: 6px; }
.lb-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.35); border-radius: 3px; }
.lb-thumb {
    flex: 0 0 auto;
    width: 84px;
    height: 58px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #1e293b;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s, border-color 0.15s;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-thumb:hover { opacity: 0.85; }
.lb-thumb.active { opacity: 1; border-color: #fff; }
/* Single photo (or none): no strip, no grid button. */
.lightbox.single .lb-thumbs,
.lightbox.single #lb-grid-toggle,
.lightbox.single .lightbox-nav { display: none; }

/* --- Grid view --- */
.lb-grid {
    display: none;
    position: absolute;
    inset: 0;
    background: #0b1220;
    z-index: 4;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: calc(env(safe-area-inset-top, 0px) + 64px)
             calc(env(safe-area-inset-right, 0px) + 10px)
             calc(env(safe-area-inset-bottom, 0px) + 20px)
             calc(env(safe-area-inset-left, 0px) + 10px);
}
.lightbox.grid-open .lb-grid { display: block; }
.lightbox.grid-open .lb-thumbs,
.lightbox.grid-open .lightbox-nav { display: none; }
.lb-grid-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);   /* phone */
    gap: 6px;
}
@media (min-width: 768px)  { .lb-grid-inner { grid-template-columns: repeat(4, 1fr); } }  /* tablet */
@media (min-width: 1100px) { .lb-grid-inner { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1500px) { .lb-grid-inner { grid-template-columns: repeat(6, 1fr); } }
.lb-grid-item {
    position: relative;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    cursor: pointer;
}
.lb-grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-grid-item.active { outline: 3px solid #fff; outline-offset: -3px; }

/* --- First-open hint --- */
.lb-hint {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
    background: rgba(15,23,42,0.92);
    color: #fff;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    z-index: 6;
    pointer-events: none;
    max-width: calc(100% - 32px);
    text-align: center;
}
.lightbox.show-hint .lb-hint {
    display: block;
    animation: lbHintFade 5s ease forwards;
}
@keyframes lbHintFade {
    0% { opacity: 0; } 8% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .lightbox.show-hint .lb-hint { animation: none; opacity: 1; }
}
@media (max-width: 768px) {
    .lb-thumb { width: 64px; height: 46px; }
    .lightbox-nav { width: 48px; height: 48px; min-width: 48px; min-height: 48px; font-size: 1.5rem; }
    .lb-hint { bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active {
    display: flex;
}
.modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
}
.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
}
.modal p {
    color: #64748b;
    margin-bottom: 1.5rem;
}
/* Map modal */
.map-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}
.map-modal-overlay.active { display: flex; }
.map-modal {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    max-width: 780px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
}
.map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.map-modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 40px);
}
.map-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 4px;
    border-radius: 6px;
    line-height: 0;
    flex-shrink: 0;
}
.map-modal-close:hover { color: #0f172a; background: #f1f5f9; }
#map-modal-map {
    width: 100%;
    height: 480px;
}
@media (max-width: 600px) {
    #map-modal-map { height: 340px; }
}
.modal-success {
    text-align: center;
    padding: 1rem;
}
.modal-success svg {
    width: 60px;
    height: 60px;
    color: #16a34a;
    margin-bottom: 1rem;
}

/* --- from public/property_detail.html lines 1421-1700 --- */
.payment-calc-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 28px;
    margin-top: 8px;
}
.payment-calc-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px 0;
}
.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}
.pc-total {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
}
.pc-total span {
    font-size: 1rem;
    font-weight: 400;
    color: #64748b;
}
.pc-reset {
    font-size: 0.9rem;
    color: var(--primary);
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    text-decoration: none;
}
.pc-reset:hover { text-decoration: underline; }

/* Stacked color bar */
.pc-bar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}
.pc-bar-seg { transition: width 0.3s ease; }

/* Breakdown rows */
.pc-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 32px;
    margin-bottom: 24px;
}
/* Under "Property taxes" (right column). Placed like the HOA and
   insurance notes, it would push every later row one cell over. */
#pc-tax-note { grid-column: 2; }
.pc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pc-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pc-row-label {
    font-size: 0.9rem;
    color: #334155;
}
.pc-row-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}
.pc-row-value.editable {
    color: var(--primary);
    cursor: pointer;
    border-bottom: 1px dashed var(--primary);
}

/* Bottom parameter panels */
.pc-params {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.pc-param {
    padding: 16px 18px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}
.pc-param:hover { background: #e8eef4; }
.pc-param.active { background: #e0eaf3; outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 8px; z-index: 1; }
.pc-param:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: #cbd5e1;
}
.pc-param-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 4px;
}
.pc-param-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pc-param-value svg {
    color: var(--primary);
    flex-shrink: 0;
}

/* Modal overlay */
.pc-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.pc-modal {
    background: white;
    border-radius: 14px;
    padding: 28px 24px 24px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    position: relative;
    animation: pcModalIn 0.2s ease;
}
@keyframes pcModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pc-modal h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 16px 0;
}
.pc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
}
.pc-modal-close:hover { color: #334155; background: #f1f5f9; }
.pc-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.pc-input-group {
    flex: 1;
}
.pc-input-group input, .pc-input-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
}
.pc-input-group input:focus, .pc-input-group select:focus {
    outline: none;
    border-color: var(--primary);
}
.pc-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) 50%, #e2e8f0 50%);
    outline: none;
    margin: 12px 0;
}
.pc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.pc-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    cursor: pointer;
}
.pc-loan-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pc-loan-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.pc-loan-option:hover { border-color: var(--primary); }
.pc-loan-option.active { border-color: var(--primary); background: #f0f7ff; }
.pc-loan-option input[type="radio"] { accent-color: var(--primary); }
.pc-loan-option-label { font-size: 0.9rem; color: #334155; }

@media (max-width: 640px) {
    .pc-breakdown {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    #pc-tax-note { grid-column: auto; }
    .pc-params {
        grid-template-columns: 1fr;
    }
    .pc-param:not(:last-child)::after {
        right: 15%;
        top: auto;
        bottom: 0;
        width: 70%;
        height: 1px;
    }
    .pc-modal {
        width: 95%;
    }
}

/* --- from public/property_detail.html lines 1746-1839 --- */
.share-popover-wrap {
    position: relative;
}
.share-popover {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 150px;
    z-index: 1000;
    overflow: hidden;
}
.share-popover.open { display: block; }
.share-popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: #1e293b;
    text-align: left;
    transition: background 0.15s;
}
.share-popover-item:hover { background: #f8fafc; }
.share-popover-item svg { flex-shrink: 0; color: #64748b; }

/* Reusable info tooltip — small circular '?' next to a metric
   label that reveals a popover explaining how the number is
   calculated. Currently used on Est. NOI in the STR projection
   card; intentionally generic so other metrics (cap rate,
   occupancy) can reuse the same markup later. Works on hover
   (desktop) AND click/tap (mobile). */
.info-tip { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.info-tip-trigger {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #cbd5e1; color: white;
    border: none; padding: 0; margin: 0;
    font-size: 10px; font-weight: 700; line-height: 14px;
    cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.info-tip-trigger:hover, .info-tip.open .info-tip-trigger { background: #475569; }
/* The dot stays 14px, but a finger needs ~30px: an invisible ring widens the tap area. */
/* Lot facts: 5-6 tiles left one alone below 900px (4 + 1 at 768). */
@media (max-width: 899px) { .lot-facts:has(> :nth-child(5):last-child), .lot-facts:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, 1fr) !important; } }
@media (min-width: 900px) { .lot-facts:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, 1fr) !important; } .lot-facts:has(> :nth-child(7):last-child) { grid-template-columns: repeat(4, 1fr) !important; } }
@media (min-width: 540px) and (max-width: 899px) { .lot-facts:has(> :nth-child(7):last-child) { grid-template-columns: repeat(4, 1fr) !important; } }
@media (max-width: 539px) { .lot-facts:has(> :nth-child(5):last-child), .lot-facts:has(> :nth-child(6):last-child) { grid-template-columns: repeat(2, 1fr) !important; } .lot-facts > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
.info-tip-trigger { position: relative; }
.info-tip-trigger::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
.info-tip-bubble {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    background: #0f172a;
    color: #f1f5f9;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.5;
    font-weight: 400;
    text-align: left;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    z-index: 50;
    pointer-events: none;
}
.info-tip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #0f172a;
}
.info-tip-bubble strong { color: #fbbf24; font-weight: 700; }
.info-tip-bubble code { background: rgba(255,255,255,0.1); padding: 1px 4px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.info-tip:hover .info-tip-bubble,
.info-tip.open .info-tip-bubble { display: block; }

/* Virtual Tour Button */
/* --- from public/property_detail.html lines 1982-2389 --- */
.nearby-cities {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 2.5rem;
}
.nearby-cities h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1rem;
}
.town-browse {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: #334155;
}
.town-browse a { color: #0f172a; font-weight: 600; }
.city-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.city-pill {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: #334155;
    background: white;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}
.city-pill:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}
.city-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
@media (max-width: 768px) {
    .nearby-cities {
        padding: 1rem 1rem 2rem;
    }
}
/* Nearby Properties Section */
.nearby-locations {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 1rem;
}
.nearby-locations h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.25rem;
}
.nearby-locations-grid {
    display: flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    height: 450px;
    max-height: 450px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
}
.nearby-map-col {
    flex: 0 0 70%;
    height: 450px;
    position: relative;
}
#nearby-map {
    width: 100%;
    height: 100%;
}
.nearby-list-col {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    background: white;
}
.nearby-list-header {
    background: #1a2332;
    color: white;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.nearby-list-scroll {
    flex: 1;
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.nearby-list-scroll::-webkit-scrollbar {
    width: 5px;
}
.nearby-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.nearby-list-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.nearby-list-item {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    cursor: pointer;
}
.nearby-list-item:hover,
.nearby-list-item.active {
    background: #f1f5f9;
}
.nearby-list-item-address {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.2rem;
}
.nearby-list-item-details {
    font-size: 0.78rem;
    color: #475569;
    margin-bottom: 0.15rem;
}
.nearby-list-item-type {
    font-size: 0.75rem;
    color: #94a3b8;
}
.nearby-list-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}
.nearby-list-footer a {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.nearby-list-footer a:hover {
    text-decoration: underline;
}
.nearby-price-marker {
    background: none;
    border: none;
}
.price-label {
    background: #1a2332;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.price-label.current {
    background: var(--primary);
}
.price-label.highlighted {
    background: #f59e0b;
    transform: scale(1.15);
}
.nearby-photo-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
}
.nearby-photo-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
}
.nearby-photo-popup a {
    text-decoration: none;
    color: inherit;
    display: block;
}
@media (max-width: 768px) {
    .nearby-locations {
        padding: 1.5rem 1rem 0.5rem;
    }
    .nearby-locations-grid {
        flex-direction: column;
        height: auto;
        max-height: none;
    }
    .nearby-map-col {
        flex: none;
        height: 300px;
        position: relative;
    }
    #nearby-map {
        height: 100%;
    }
    .nearby-list-col {
        flex: none;
    }
    .nearby-list-scroll {
        max-height: 300px;
    }
}

/* Gated Content — Blur Preview with Overlay */
.gated-section {
    position: relative;
}
.gated-section .gated-content {
    display: block;
}
.gated-section:not(.unlocked) .gated-content {
    max-height: 350px;
    overflow: hidden;
    filter: blur(6px);
    -webkit-filter: blur(6px);
    pointer-events: none;
    user-select: none;
}
.gated-section.unlocked .gated-content {
    max-height: none;
    filter: none;
    -webkit-filter: none;
    pointer-events: auto;
    user-select: auto;
}
.gated-section.unlocked .gated-teaser {
    display: none;
}
.gated-teaser {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    max-width: 460px;
    width: 90%;
}
.gated-teaser h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.4rem;
}
.gated-teaser p {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.gate-unlock-btn {
    padding: 0.75rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}
.gate-unlock-btn:hover {
    opacity: 0.9;
}
.gate-unlock-btn svg {
    width: 18px;
    height: 18px;
}

/* Signup Modal */
.signup-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.signup-modal-overlay.active {
    display: flex;
}
.signup-modal {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 440px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.signup-modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}
.signup-modal h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}
.signup-modal p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.signup-modal .modal-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.signup-modal .modal-form input {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.signup-modal .modal-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}
.signup-modal .modal-form button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.signup-modal .modal-form button:hover {
    opacity: 0.9;
}
.signup-modal .modal-step {
    display: none;
}
.signup-modal .modal-step.active {
    display: block;
}
.gate-form button:hover {
    opacity: 0.9;
}
.gate-status {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Market Trends Section */
.market-trends-card {
    border-left: 4px solid #2563eb;
}
.market-trends-card canvas {
    max-height: 280px;
}
/* Chart.js writes an inline pixel width on the canvas at render time and
   doesn't always shrink it later (rotation, late-loading content). Cap
   it so a stale width can never widen the page. */
.market-trends-card canvas,
#str-analysis-card canvas {
    max-width: 100%;
}

/* Legal Consent */
.legal-consent {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-top: 0.75rem;
    text-align: center;
}
.legal-consent a {
    color: #64748b;
    text-decoration: underline;
}

/* ========== STICKY HEADER BAR ========== */
/* --- from public/property_detail.html lines 2508-2813 --- */
.gallery-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    height: 450px;
    position: relative;
    /* Hero height, shared with the "View all photos" button so the button
       stays pinned to the hero when mobile stacks the thumbnails below it
       (where `bottom` would land on a thumbnail instead). */
    --hero-h: 450px;
}
.main-photo {
    width: 100%;
    height: var(--hero-h);
    object-fit: cover;
    cursor: pointer;
}
.main-photo-static { cursor: default; }

/* ========== GALLERY LOADING STATE ==========
   The hero used to sit in a blank white 450px rectangle for the whole
   load — measured at 17.8s LCP on throttled Slow 4G, because the script
   below was pre-fetching all 53 full-size MLS originals (~42 MB) and
   starving the hero request behind them. That storm is gone now, but a
   phone on a mountain pass still waits a beat, and blank space is
   exactly what makes people tap into the void (59 of 295 sessions that
   touched the gallery logged a dead click). Two rules here:
     1. the box is never empty — a skeleton holds it;
     2. a control that cannot work yet must not look like it can.

   <picture> must not become the grid item — display:contents keeps the
   <img> itself as the direct child so the 1fr 1fr layout is unchanged.

   The `source { display: none }` is load-bearing, not tidiness. With
   display:contents on the parent, <source> elements DO become grid
   items: they are zero-height, so the layout still looks right, but
   they claim rows, and this grid has `gap: 4px` — so four sources
   pushed the hero down 8px on desktop / 16px on mobile and clipped the
   same amount off the bottom of the fixed-height, overflow:hidden
   container. Measured before the fix; verified back to 0 after. */
.gallery-container > picture { display: contents; }
.gallery-container source { display: none; }

.main-photo, .side-photo {
    background-color: #e8edf2;
    background-image: linear-gradient(100deg,
        rgba(255,255,255,0) 20%, rgba(255,255,255,0.65) 50%, rgba(255,255,255,0) 80%);
    background-size: 220% 100%;
    background-repeat: no-repeat;
    animation: gallery-skeleton 1.5s ease-in-out infinite;
}
/* Once the bytes are on screen the shimmer has no job — stop animating
   rather than burn compositor frames behind an opaque photo. */
.main-photo.is-loaded, .side-photo.is-loaded {
    animation: none;
    background-image: none;
}
@keyframes gallery-skeleton {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

/* Until the first photo paints, the entry points into the lightbox are
   damped and inert: a tap reads as "not ready yet", not "broken". */
.gallery-container.is-loading .gallery-viewall-btn {
    opacity: 0.45;
    pointer-events: none;
}
.gallery-container.is-loading .main-photo { cursor: progress; }

/* Same idea inside the lightbox: don't hand someone arrows over a blank
   stage while the next full-size photo is still in flight. */
.lightbox.img-loading .lightbox-image { background: #1a1a1a; }
.lightbox.img-loading .lightbox-nav { opacity: 0.35; pointer-events: none; }
.lb-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 34px; height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    pointer-events: none;
    z-index: 2;
    animation: lb-spin 0.8s linear infinite;
}
.lightbox.img-loading .lb-spinner { display: block; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .main-photo, .side-photo, .lb-spinner { animation: none; }
}
.coming-soon-badge {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.80);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    pointer-events: none;
    white-space: nowrap;
}
.coming-soon-badge svg { flex-shrink: 0; opacity: 0.95; }
.side-photos {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    height: 450px;
}
.side-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s;
}
.side-photo:hover {
    opacity: 0.9;
}
.more-photos-overlay {
    position: relative;
}
.more-photos-overlay::after {
    content: attr(data-count);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
}
/* Sits over the bottom-left of the hero photo (the hero is the left grid
   column on desktop and the full width on mobile, so this corner is the
   hero in both cases and never lands on a thumbnail). 44px min height so
   it stays a comfortable touch target on phones. */
/* ── Walkthrough video: tile in the collage + its own viewer ─────── */
/* The tile sits in the side-photos grid, so it inherits that cell's
   size — it must not impose its own dimensions or it breaks the 6-up. */
.video-tile {
    position: relative; cursor: pointer; border-radius: 8px;
    overflow: hidden; background: #1c1917 center/cover no-repeat;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: .4rem; min-height: 0; height: 100%;
    color: #fff; text-align: center;
}
.video-tile:focus-visible { outline: 3px solid #0f6e56; outline-offset: 2px; }
.video-tile-play {
    width: 40px; height: 40px; border-radius: 999px;
    background: rgba(255,255,255,.94); color: #0f6e56;
    display: flex; align-items: center; justify-content: center;
    padding-left: 3px; /* optical centre for the play triangle */
}
.video-tile-locked .video-tile-play { padding-left: 0; color: #1c1917; }
.video-tile-label {
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
    text-shadow: 0 1px 3px rgba(0,0,0,.6); padding: 0 .35rem;
}

/* Same problem, same fix as .lightbox above: the app-download strip
   carries z-index 10001 and would paint over the viewer's title and
   close button. Hide it while the viewer is open rather than starting
   a z-index escalation. */
body.video-viewer-open #app-cta-strip { display: none !important; }
/* The tile clips for its rounded corners, which would also clip the
   tooltip. The locked variant paints via background-image and has no
   child to clip, so it can let the tooltip escape. */
.video-tile-locked { overflow: visible; }
/* Anchored BELOW the tile, not above: .gallery-container clips its
   overflow, and a tooltip above the top-row tile lands outside those
   bounds and is silently cut away. Below keeps it inside the box. */
.video-tile-tip {
    position: absolute;
    left: 50%; top: calc(100% + 8px);
    transform: translateX(-50%);
    width: max(220px, 108%);
    background: #1c1917; color: #fff;
    font-size: .72rem; font-weight: 500; line-height: 1.45;
    text-align: left; padding: .55rem .7rem; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.28);
    opacity: 0; visibility: hidden; transition: opacity .15s ease;
    z-index: 30; pointer-events: none;
}
.video-tile-tip::after {           /* little pointer up to the tile */
    content: ''; position: absolute; bottom: 100%; left: 50%;
    margin-left: -5px; border: 5px solid transparent;
    border-bottom-color: #1c1917;
}
.video-tile-locked:hover .video-tile-tip,
.video-tile-locked:focus .video-tile-tip,
.video-tile-locked:focus-within .video-tile-tip,
.video-tile-locked.tip-open .video-tile-tip {
    opacity: 1; visibility: visible;
}
@media (max-width: 640px) {
    .video-tile-tip { width: 240px; font-size: .7rem; }
}

.video-viewer {
    display: none; position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.94); align-items: center; justify-content: center;
}
.video-viewer.is-open { display: flex; }
.video-viewer-player {
    /* width/height floors matter: a video that has not resolved its
       metadata yet has no intrinsic size and collapses to the browser
       default 300x150, which reads as a broken player rather than a
       loading one. */
    width: min(94vw, 1100px); max-width: 94vw;
    height: min(82vh, 620px); max-height: 82vh;
    background: #000; border-radius: 8px;
}
.video-viewer-bar {
    position: absolute; top: 0; left: 0; right: 0; display: flex;
    align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.25rem; color: #fff;
    background: linear-gradient(rgba(0,0,0,.55), transparent);
}
.video-viewer-title { font-size: .95rem; font-weight: 600; }
.video-viewer-close {
    background: none; border: 0; color: #fff; font-size: 2rem;
    line-height: 1; cursor: pointer; padding: 0 .25rem;
}
.video-viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.14); border: 0; color: #fff;
    font-size: 1.5rem; width: 46px; height: 46px; border-radius: 999px;
    cursor: pointer;
}
.video-viewer-nav:hover { background: rgba(255,255,255,.26); }
.video-viewer-prev { left: 1rem; }
.video-viewer-next { right: 1rem; }
.video-viewer-dots {
    position: absolute; bottom: 1.1rem; left: 0; right: 0;
    display: flex; gap: .4rem; justify-content: center;
}
.video-viewer-dot {
    width: 8px; height: 8px; border-radius: 999px; border: 0;
    background: rgba(255,255,255,.35); cursor: pointer; padding: 0;
}
.video-viewer-dot.is-active { background: #fff; }
@media (max-width: 640px) {
    .video-viewer-player { max-width: 100vw; max-height: 70vh; }
    /* Arrows would sit on top of the video's own scrub bar on a phone;
       the dots and swipe cover navigation there. */
    .video-viewer-nav { display: none !important; }
    .video-tile-play { width: 32px; height: 32px; }
    .video-tile-label { font-size: .62rem; }
}

.gallery-viewall-btn {
    position: absolute;
    left: 1rem;
    /* Anchored to the hero's bottom edge, not the collage's — on mobile the
       collage grows taller than the hero and `bottom` would sit on a thumb. */
    top: calc(var(--hero-h) - 44px - 1rem);
    min-height: 44px;
    padding: 0 1rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.94);
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    transition: background 0.2s, box-shadow 0.2s;
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.gallery-viewall-btn:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.gallery-viewall-btn svg { flex-shrink: 0; }

/* ========== ACTION BUTTONS ROW ========== */
/* --- from public/property_detail.html lines 3368-3437 --- */
.timeline {
    position: relative;
    padding-left: 28px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: #e2e8f0;
}
.timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
}
.timeline-item:last-child {
    padding-bottom: 0;
}
.timeline-dot {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.timeline-dot svg {
    width: 12px;
    height: 12px;
}
.timeline-dot.listed { background: #dbeafe; color: #2563eb; }
.timeline-dot.price_change { background: #fef3c7; color: #d97706; }
.timeline-dot.pending { background: #e0e7ff; color: #4f46e5; }
.timeline-dot.sold { background: #dcfce7; color: #16a34a; }
.timeline-dot.delisted { background: #fee2e2; color: #dc2626; }
.timeline-dot.relisted { background: #dbeafe; color: #2563eb; }
.timeline-date {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 2px;
}
.timeline-event {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}
.timeline-price {
    font-size: 0.9rem;
    color: #475569;
    margin-top: 1px;
}
.timeline-price-prev {
    text-decoration: line-through;
    color: #94a3b8;
    margin-left: 4px;
}
.timeline-price-delta {
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 4px;
    white-space: nowrap;
}
.timeline-price-delta.down { color: #dc2626; }
.timeline-price-delta.up { color: #16a34a; }

/* sold page: the seller value block (same form as today, partials own its styles) */
.rdl-hv { display: flex; flex-direction: column; gap: 12px; }
.rd .rdl-hv .sold-hv-alt { text-align: left; font-size: 15px; }
