/* PROPERTIES SECTION SHELL — label + grid

   The heading lives outside #propertyGridSection because script.js
   replaces that element's innerHTML wholesale (loadPublicProperties()).
   This wrapper gives the label and the grid one shared max-width so they
   read as a single titled section. */
/* 64px top/bottom — one shared vertical rhythm: this bottom padding
   is also the gap to the Highlights panel, whose own margin is 0. */
/* Warm paper page background, so the whole page shares one tone with the
   brown brand. The Properties band is transparent so there is no seam
   above the Highlights panel. */
body{
    background:var(--sg-paper);
}

.properties-section{
    padding:80px 24px 64px;
    background:transparent;
}

/* script.js hides only the grid when there are no properties
   (section.style.display = 'none'), so the heading would be left
   floating above nothing. Hide the wrapper with it. Both the spaced
   ("display: none;") and unspaced serialisations are matched. */
.properties-section:has(#propertyGridSection[style*="display: none"]),
.properties-section:has(#propertyGridSection[style*="display:none"]){
    display:none;
}

.properties-section-head{
    max-width:1140px;
    margin:0 auto 44px;
    text-align:center;
}

.properties-label{
    margin:0;
    font-family:'Fraunces',Georgia,serif;
    font-size:2.6rem;
    font-weight:600;
    line-height:1.15;
    letter-spacing:-.02em;
    color:var(--sg-ink);
}

/* Short gold rule under the label — scales with the heading so the
   proportion stays the same */
.properties-label::after{
    content:'';
    display:block;
    width:64px;
    height:2px;
    border-radius:2px;
    margin:18px auto 0;
    background:var(--sg-gold-grad);
}

/* PROPERTY GRID */

/* A wrapping flex row, not a fixed grid: cards grow equally up to a
   cap (see .card below) and every line is centered, so 1, 2, 3, 4, 5
   or 7 cards always read as balanced rows (a lone remainder card sits
   centered under a full row instead of hugging the left edge). */
.property-grid{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;

    max-width: 1140px;
    margin: 0 auto;
    min-height: 80px; /* keep space while loading */
}

/* Loading spinner shown while Supabase data is fetching. Occupies the
   full first row (flex item, so width does it instead of grid-column). */
.property-grid-loading {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.pg-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(184,138,68,.22);
    border-top-color: var(--sg-gold);
    border-radius: 50%;
    animation: pg-spin .7s linear infinite;
}

@keyframes pg-spin { to { transform: rotate(360deg); } }


.card{
    background:var(--sg-ivory);
    border:1px solid var(--sg-line-soft);
    border-radius:18px;
    overflow:hidden;
    box-shadow:0 1px 2px rgba(var(--sg-shadow),.04), 0 12px 30px rgba(var(--sg-shadow),.07);

    /* Equal-height flex column so content grows and the footer
       button stays pinned to the bottom, aligned across all cards */
    display:flex;
    flex-direction:column;

    /* As a flex item of .property-grid: cards on one line grow to
       equal widths, shrink on narrow screens, and never pass 380px —
       the width a card gets in a full 3-across row — so a lone or
       remainder card matches its neighbours instead of stretching. */
    flex:1 1 360px;
    min-width:min(280px,100%);
    max-width:380px;

    transition:transform .3s cubic-bezier(.2,.7,.3,1),
               box-shadow .3s ease,
               border-color .3s ease;
}

/* Hover lifts only on devices that really hover: on a touchscreen :hover
   sticks to the last card tapped. */
@media (hover:hover){
.card:hover{
    transform:translateY(-5px);
    border-color:rgba(184,138,68,.5);
    box-shadow:0 2px 4px rgba(var(--sg-shadow),.05), 0 24px 48px rgba(var(--sg-shadow),.15);
}
}

.card-image{
    position:relative;
    height:220px;
    overflow:hidden;
    background:var(--sg-sand);
}

/* A short dark fade along the foot of the photo keeps the price tag
   legible on bright pictures. */
.card-image::after{
    content:'';
    position:absolute;
    inset:auto 0 0;
    height:46%;
    background:linear-gradient(180deg, rgba(31,19,11,0), rgba(31,19,11,.5));
    pointer-events:none;
}

.card-image img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
    transition:transform .6s cubic-bezier(.2,.7,.3,1);
}

@media (hover:hover){
.card:hover .card-image img{
    transform:scale(1.05);
}
}

/* Price tag — sits over the cover, bottom-left to line up with the
   left-aligned text stack below it */
.price{
    position:absolute;
    bottom:16px;
    left:16px;
    z-index:1;

    background:rgba(42,26,16,.9);
    color:#f6e7c5;
    border:1px solid rgba(217,184,114,.4);

    padding:7px 14px;
    border-radius:8px;

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

    box-shadow:0 8px 20px rgba(20,12,6,.3);
}

.card-content{
    padding:24px 26px 26px;

    /* Grow to fill the card and lay children top-to-bottom so the
       button is pushed to the bottom via margin-top:auto */
    flex:1;
    display:flex;
    flex-direction:column;
}

.card-content h3{
    margin:0 0 8px;
    font-family:'Fraunces',Georgia,serif;
    font-size:1.32rem;
    font-weight:600;
    line-height:1.25;
    letter-spacing:-.012em;
    color:var(--sg-ink);
    text-align:left;
}

/* LOCATION */

.location{
    display:flex;
    align-items:flex-start;
    gap:8px;

    margin-bottom:18px;
    padding-bottom:18px;
    border-bottom:1px solid var(--sg-line-soft);

    color:var(--sg-muted);
    font-size:.84rem;
    font-weight:500;
    line-height:1.5;
}

.location .info-icon{
    width:16px;
    height:16px;
    margin-top:2px;
    opacity:.7;
}

/* Addresses vary in length — cap at two lines rather than letting one
   card grow taller than its neighbours */
.location span{
    display:-webkit-box;
    -webkit-line-clamp:2;
    line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
}

/* Clickable location → Google Maps (properties.js) */
.location.location-link{
    color:var(--sg-muted);
    text-decoration:none;
    cursor:pointer;
    transition:color .18s ease, text-decoration-color .18s ease;
}
.location.location-link:hover,
.location.location-link:focus-visible{
    color:var(--sg-brand-dark);
    text-decoration:underline;
    text-decoration-color:var(--sg-gold);
    text-underline-offset:3px;
}
.location.location-link:focus-visible{
    outline:2px solid rgba(184,138,68,.6);
    outline-offset:2px;
    border-radius:4px;
}

.info-icon{
    width:20px;
    height:20px;
    object-fit:contain;
    flex-shrink:0;
}

/* PROPERTY INFO — two stat columns on a tinted panel */

.property-info{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:18px;

    padding:16px 18px;
    margin-bottom:22px;

    background:var(--sg-cream);
    border:1px solid var(--sg-line-soft);
    border-radius:12px;
}

.left-side{
    min-width:0;
}

.floor-details{
    margin:8px 0 0;

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

.empty-floor{
    height:21px;
}

.right-side{
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:10px;

    text-align:left;
}

.icon-label{
    display:flex;
    align-items:center;
    gap:8px;

    font-size:.88rem;
    font-weight:600;
    color:var(--sg-ink);
}

.icon-label .info-icon{
    opacity:.75;
}

.available{
    display:inline-flex;
    align-items:center;

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

    background:var(--sg-ok-bg);
    border:1px solid var(--sg-ok-line);
    color:var(--sg-ok);
    font-size:.7rem;
    font-weight:700;
    letter-spacing:.03em;
}

/* BUTTON */

.view-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:10px;

    width:100%;
    margin:auto 0 0;

    padding:15px 18px;

    border:1px solid var(--sg-espresso);
    border-radius:10px;

    /* Primary action on a light surface = espresso. */
    background:var(--sg-espresso);
    color:#fbf6ec;

    cursor:pointer;

    font-family:inherit;
    font-size:.78rem;
    font-weight:600;
    letter-spacing:.14em;
    text-transform:uppercase;

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

/* Decorative arrow — CSS only, so the button's markup is untouched */
.view-btn::after{
    content:'→';
    font-size:1.05rem;
    line-height:1;
    color:var(--sg-gold-bright);
    transition:transform .2s ease;
}

@media (hover:hover){
.view-btn:hover{
    background:var(--sg-brand);
    border-color:var(--sg-brand);
}

.view-btn:hover::after{
    transform:translateX(4px);
}
}

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