/* HIGHLIGHTS SECTION - the "Best Unit Available" / "Best Commercial Space
   Available" tabbed showcase: a deep espresso panel carrying ivory .unit-card
   cards, gold active states and the "Follow us" cards. The title image and the
   static showcase cards were replaced by a text heading, accessible tabs and
   dynamic cards. */

.best-unit-section{
    /* The Properties column is max-width:1140px inside 24px of section
       padding, i.e. min(1140px, 100% - 48px) centered. Using exactly
       that width keeps the panel's left/right edges flush with the
       Properties column at every viewport, not just wide ones (a plain
       max-width would fill the whole viewport between ~769px and
       ~1188px while Properties stays inset). */
    width:min(1140px, calc(100% - 48px));

    /* The gap above the panel is the Properties section's own 64px
       bottom padding (one shared vertical rhythm); 64px below closes
       the page the same way. */
    margin:0 auto 64px;

    padding:44px 40px 40px;

    /* Deep espresso with a faint warm light from the upper left, edged
       by a gold hairline. */
    background:
        radial-gradient(120% 90% at 0% 0%, rgba(184,138,68,.14), rgba(184,138,68,0) 55%),
        linear-gradient(165deg,#34200f 0%,#2a1a10 55%,#22150c 100%);
    border:1px solid rgba(217,184,114,.22);
    border-radius:24px;
    box-shadow:0 24px 56px rgba(var(--sg-shadow),.28), inset 0 1px 0 rgba(255,255,255,.05);
}

/* When there are no properties, script.js hides the whole Properties
   section, so its bottom padding stops separating the panel from the
   hero — restore the same 64px gap for that case only. */
.properties-section:has(#propertyGridSection[style*="display: none"]) ~ .best-unit-section,
.properties-section:has(#propertyGridSection[style*="display:none"]) ~ .best-unit-section{
    margin-top:64px;
}

/* The nav lands on #highlightsSection, whose offset comes from
   --nav-offset in components/Navbar/navbar.css. */

.best-unit-section[hidden]{
    display:none;
}

/* Socials-only view (no vacant units, but links exist): the heading stays
   and the tab row steps aside, so drop the head's trailing margin. */
.best-unit-section.is-socials-only .best-unit-head{
    margin-bottom:0;
}

/* HEAD */

.best-unit-head{
    margin-bottom:28px;
}

.best-unit-heading{
    margin:0 0 22px;

    font-family:'Fraunces',Georgia,serif;
    /* Same size as .properties-label — one set of section headings */
    font-size:2.6rem;
    font-weight:600;
    line-height:1.15;
    letter-spacing:-.02em;
    color:#fbf6ec;
}

/* TABS */

.best-unit-tabs{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}

.best-unit-tab{
    padding:10px 20px;

    border:1px solid rgba(255,255,255,.16);
    border-radius:999px;

    background:rgba(255,255,255,.04);
    color:#e9dcc6;

    cursor:pointer;

    font-family:inherit;
    font-size:.84rem;
    font-weight:600;
    letter-spacing:.02em;

    transition:background .2s ease, color .2s ease, border-color .2s ease;
}

.best-unit-tab:hover{
    background:rgba(255,255,255,.1);
    border-color:rgba(217,184,114,.5);
    color:#fff;
}

.best-unit-tab.is-active{
    background:var(--sg-gold-grad);
    border-color:transparent;
    color:var(--sg-espresso);
}

.best-unit-tab:focus-visible{
    outline:3px solid rgba(217,184,114,.55);
    outline-offset:2px;
}

/* PANELS */

.best-unit-panel[hidden]{
    display:none;
}

/* GRID */

.best-unit-grid{
    display:flex;
    gap:24px;
    overflow-x:auto;
    /* Swiping the row sideways must not drag the page with it. */
    overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch;
    padding:4px 2px 14px;

    scrollbar-color:rgba(217,184,114,.4) transparent;
}

/* 1–3 cards: centered, like the Properties rows above. Auto margins
   (rather than justify-content:center) absorb the free space when the
   row fits and collapse to zero once it overflows, so a long row
   still scrolls from its first card — justify-content:center would
   clip the row's left edge inside overflow-x:auto. */
.best-unit-grid > :first-child{ margin-left:auto; }
.best-unit-grid > :last-child{ margin-right:auto; }

.best-unit-grid::-webkit-scrollbar{
    height:8px;
}

.best-unit-grid::-webkit-scrollbar-thumb{
    background:rgba(217,184,114,.35);
    border-radius:8px;
}

.best-unit-grid::-webkit-scrollbar-track{
    background:transparent;
}

.best-unit-grid[hidden]{
    display:none;
}

/* EMPTY STATE */

.best-unit-empty{
    margin:0;
    padding:30px 20px;

    background:rgba(255,255,255,.05);
    border:1px dashed rgba(217,184,114,.32);
    border-radius:14px;

    text-align:center;
    color:#dccfb9;
    font-size:.92rem;
}

/* CARD */

.unit-card{
    width:270px;
    min-width:270px;
    position:relative;

    background:var(--sg-ivory);
    border-radius:16px;
    overflow:hidden;

    box-shadow:0 14px 32px rgba(10,6,3,.32);
}

/* IMAGE */

.unit-image{
    display:block;
    width:100%;
    height:170px;
    object-fit:cover;
    background:var(--sg-sand);
}

/* CONTENT */

.unit-content{
    padding:18px 18px 20px;
}

/* Property type — a small gold eyebrow above the unit name */
.unit-content h4{
    margin:0 0 6px;

    font-size:.68rem;
    font-weight:700;
    letter-spacing:.14em;
    text-transform:uppercase;
    color:var(--sg-gold-deep);
}

/* LOCATION */

.unit-location{
    display:flex;
    align-items:center;
    gap:6px;

    font-size:.78rem;
    line-height:1.4;
    color:var(--sg-muted);
}

.unit-location img{
    width:14px;
    height:14px;
    opacity:.7;
}

/* UNIT DETAILS */

.unit-details{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:10px;

    margin-top:16px;
}

.unit-left h3{
    margin:0;

    font-family:'Fraunces',Georgia,serif;
    font-size:1.35rem;
    font-weight:600;
    line-height:1.2;
    letter-spacing:-.012em;
    color:var(--sg-ink);
}

.unit-left p{
    margin:2px 0 0;

    font-size:.8rem;
    font-weight:500;
    color:var(--sg-muted);
}

/* PRICE */

.unit-price{
    font-size:.9rem;
    font-weight:700;
    line-height:1.2;
    color:var(--sg-brand-dark);
    text-align:right;

    /* increase to lower the price */
    padding-bottom:3px;
}

/* DIVIDER */

.unit-divider{
    border:none;
    border-top:1px solid var(--sg-line-soft);
    margin:16px 0 14px;
}

/* SPEC CHIPS */

.unit-chips{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.unit-chip{
    display:inline-flex;
    align-items:center;
    gap:6px;

    padding:5px 10px;
    border-radius:8px;

    background:var(--sg-cream);
    color:var(--sg-text);

    font-size:.72rem;
    font-weight:600;
}

.unit-chip img{
    width:15px;
    height:15px;
    opacity:.75;
}

/* LOADING SKELETON */

.sk-card{
    pointer-events:none;
}

.sk-image{
    height:170px;
    background:var(--sg-sand);
}

.sk-line{
    height:12px;
    margin:10px 0;
    border-radius:6px;
    background:var(--sg-sand);
}

.sk-line.w80{ width:80%; }
.sk-line.w60{ width:60%; }
.sk-line.w40{ width:40%; }

.sk-image,
.sk-line{
    animation:sk-pulse 1.2s ease-in-out infinite;
}

@keyframes sk-pulse{
    0%,100%{ opacity:1; }
    50%{ opacity:.55; }
}

/* SEARCH TOGGLE (in the tab header row) */

.best-unit-headrow{
    display:flex;
    align-items:center;
    /* The filter button sits right next to the tabs it works with,
       instead of at the far end of the panel. */
    justify-content:flex-start;
    gap:10px;
    flex-wrap:wrap;
}

.unit-search-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    /* Same height as a tab so the row reads as one control group */
    width:40px;
    height:40px;
    flex-shrink:0;

    border:1px solid rgba(255,255,255,.16);
    border-radius:50%;

    background:rgba(255,255,255,.04);
    color:#e9dcc6;

    cursor:pointer;

    transition:background .2s ease, color .2s ease, border-color .2s ease;
}

.unit-search-toggle:hover,
.unit-search-toggle[aria-expanded="true"]{
    background:rgba(255,255,255,.1);
    border-color:rgba(217,184,114,.5);
    color:var(--sg-gold-bright);
}

.unit-search-toggle:focus-visible{
    outline:3px solid rgba(217,184,114,.55);
    outline-offset:2px;
}

.unit-search-toggle:disabled{
    opacity:.5;
    cursor:default;
}

.unit-search-toggle[hidden]{
    display:none;
}

/* SEARCH PANEL */

.unit-search-panel{
    margin-bottom:22px;
    padding:24px 26px;

    /* The four question groups sit side by side on wide screens (instead
       of one tall left-hand column) and stack on narrow ones. */
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:20px 30px;

    background:var(--sg-ivory);
    border:1px solid var(--sg-line-soft);
    border-radius:16px;
    box-shadow:0 14px 32px rgba(10,6,3,.3);
}

.unit-search-panel[hidden]{
    display:none;
}

.unit-search-group{
    margin-bottom:0;
}

.unit-search-group:last-of-type{
    margin-bottom:0;
}

.unit-search-group-label{
    display:block;
    margin-bottom:10px;

    font-size:.7rem;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.12em;
    color:var(--sg-gold-deep);
}

.unit-search-chips{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.unit-search-chip{
    padding:8px 15px;

    border:1px solid var(--sg-line);
    border-radius:999px;

    background:#fff;
    color:var(--sg-text);

    cursor:pointer;

    font-family:inherit;
    font-size:.82rem;
    font-weight:600;

    transition:background .18s ease, color .18s ease, border-color .18s ease;
}

.unit-search-chip:hover{
    background:var(--sg-cream);
    border-color:var(--sg-gold);
}

.unit-search-chip.is-selected{
    background:var(--sg-espresso);
    border-color:var(--sg-espresso);
    color:#fbf6ec;
}

.unit-search-chip:focus-visible{
    outline:3px solid rgba(184,138,68,.5);
    outline-offset:2px;
}

.unit-search-actions{
    grid-column:1 / -1;
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    padding-top:6px;
}

.unit-search-find{
    padding:11px 24px;

    border:none;
    border-radius:999px;

    background:var(--sg-espresso);
    color:#fbf6ec;

    cursor:pointer;

    font-family:inherit;
    font-size:.82rem;
    font-weight:600;
    letter-spacing:.04em;

    transition:background .2s ease;
}

.unit-search-find:hover:not(:disabled){
    background:var(--sg-brand);
}

.unit-search-find:disabled{
    opacity:.45;
    cursor:not-allowed;
}

.unit-search-find:focus-visible,
.unit-search-reset:focus-visible{
    outline:3px solid rgba(184,138,68,.5);
    outline-offset:2px;
}

.unit-search-reset{
    padding:11px 22px;

    border:1px solid var(--sg-line);
    border-radius:999px;

    background:transparent;
    color:var(--sg-text);

    cursor:pointer;

    font-family:inherit;
    font-size:.82rem;
    font-weight:600;

    transition:background .2s ease, border-color .2s ease;
}

.unit-search-reset:hover{
    background:var(--sg-cream);
    border-color:var(--sg-gold);
}

/* SEARCH RESULTS */

.unit-search-results[hidden]{
    display:none;
}

.unit-search-results-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
    margin-bottom:18px;
}

.unit-search-results-title{
    margin:0;

    font-family:'Fraunces',Georgia,serif;
    font-size:1.4rem;
    font-weight:600;
    letter-spacing:-.012em;
    color:#fbf6ec;
}

.unit-search-back{
    padding:9px 18px;

    border:1px solid rgba(255,255,255,.22);
    border-radius:999px;

    background:rgba(255,255,255,.05);
    color:#e9dcc6;

    cursor:pointer;

    font-family:inherit;
    font-size:.8rem;
    font-weight:600;

    transition:background .2s ease, border-color .2s ease, color .2s ease;
}

.unit-search-back:hover{
    background:rgba(255,255,255,.12);
    border-color:rgba(217,184,114,.55);
    color:#fff;
}

.unit-search-back:focus-visible{
    outline:3px solid rgba(217,184,114,.55);
    outline-offset:2px;
}

.unit-search-empty-link{
    margin-left:4px;

    color:var(--sg-gold-bright);
    font-weight:700;
    text-decoration:underline;
    text-underline-offset:3px;
}

.unit-search-note{
    margin:14px 0 0;
    padding:12px 16px;

    border:1px solid var(--sg-bad-line);
    border-radius:12px;

    background:var(--sg-bad-bg);
    color:var(--sg-bad);

    font-size:.86rem;
    font-weight:600;
}

.unit-search-note[hidden]{
    display:none;
}

/* RESULT CARD EXTRAS */

.unit-card-clickable{
    cursor:pointer;
    transition:transform .2s ease, box-shadow .2s ease;
}

@media (hover:hover){
.unit-card-clickable:hover{
    transform:translateY(-4px);
    box-shadow:0 20px 40px rgba(10,6,3,.42), 0 0 0 1px rgba(217,184,114,.6);
}
}

.unit-card-clickable:focus-visible{
    outline:3px solid rgba(217,184,114,.7);
    outline-offset:3px;
}

.unit-card-badge{
    position:absolute;
    top:12px;
    left:12px;
    z-index:2;

    padding:5px 11px;
    border-radius:6px;

    background:rgba(42,26,16,.9);
    border:1px solid rgba(217,184,114,.45);
    color:var(--sg-gold-bright);

    font-size:.66rem;
    font-weight:700;
    letter-spacing:.1em;
    text-transform:uppercase;
}

.unit-reason-chips{
    display:flex;
    flex-wrap:wrap;
    gap:6px;

    margin-top:14px;
    padding-top:14px;
    border-top:1px solid var(--sg-line-soft);
}

.unit-reason-label{
    flex-basis:100%;
    margin-bottom:2px;

    font-size:.66rem;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.12em;
    color:var(--sg-muted);
}

.unit-reason-chip{
    display:inline-flex;
    align-items:center;

    padding:4px 10px;
    border-radius:8px;

    background:#f7eed9;
    color:#7a5a1f;

    font-size:.72rem;
    font-weight:600;
}

/* RESPONSIVE */

@media screen and (max-width:768px){

    /* 18px side margins = .properties-section's 18px side padding at
       this width (responsive-base.css), so the panel's edges line up
       with the Properties column on phones; the vertical rhythm is
       one value — 48px, from the Properties section's own padding.
       width:auto drops the desktop min() rule — the fixed 18px
       margins do the same job here. */
    .best-unit-section{
        width:auto;
        margin:0 18px 48px;
        padding:30px 24px 28px;
        border-radius:20px;
    }

    /* Same as .properties-label at this width (responsive-base.css) */
    .best-unit-heading{
        font-size:2.1rem;
    }

}

@media screen and (max-width:480px){

    /* Sides stay 18px (= .properties-section side padding), so the
       panel keeps lining up with the Properties column. */
    .best-unit-section{
        margin:0 18px 48px;
        padding:24px 18px 22px;
        border-radius:18px;
    }

    /* .properties-label has no separate ≤480 size, so neither does
       this heading — both stay 2.1rem from the ≤768 rule above. */
    .best-unit-heading{
        font-size:2.1rem;
    }

    /* The tabs may wrap onto two lines on narrow phones, but the
       filter button must stay at the right of the tabs row rather
       than dropping onto its own line below them. A two-column grid
       keeps the tabs flexible (they wrap inside their column) and
       pins the button to the row's top-right. */
    .best-unit-headrow{
        /* Tabs wrap inside the first column; the filter button stays
           pinned beside the first tab row. */
        display:grid;
        grid-template-columns:minmax(0,max-content) auto;
        justify-content:start;
        align-items:start;
    }

    .best-unit-tab{
        padding:9px 14px;
        font-size:.8rem;
    }

    .unit-card{
        width:236px;
        min-width:236px;
    }

    .unit-search-toggle{
        width:40px;
        height:40px;
    }

    .unit-search-panel{
        padding:18px 16px;
    }

    .unit-search-chip{
        padding:7px 12px;
        font-size:.78rem;
    }

    .unit-search-find,
    .unit-search-reset{
        padding:9px 16px;
    }

    .unit-search-results-title{
        font-size:1.15rem;
    }

}

/* TOUCH — finger-sized targets for the tabs, filter and chips. Placed last
   so it wins over the ≤480px sizes above. */
@media (pointer:coarse){

    .best-unit-tab{
        min-height:44px;
    }

    .unit-search-toggle{
        width:44px;
        height:44px;
    }

    .unit-search-chip{
        min-height:40px;
    }

    .unit-search-find,
    .unit-search-reset{
        min-height:44px;
    }

    .unit-search-back{
        min-height:40px;
    }
}
