/**
 * Fletcher Homes - Frontend Styles
 * Enqueue this from your child theme or the plugin itself.
 * Uses CSS custom properties so it adapts to your brand colour per development.
 */

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --fh-primary:       #1a3c5e;
    --fh-primary-dark:  #0f2540;
    --fh-accent:        #c9a84c;
    --fh-green:         #2d8a4e;
    --fh-green-lt:      #e8f5ee;
    --fh-red:           #c0392b;
    --fh-red-lt:        #fdf0ef;
    --fh-orange:        #e67e22;
    --fh-orange-lt:     #fef5ec;
    --fh-purple:        #7b5ea7;
    --fh-purple-lt:     #f3effa;
    --fh-blue-lt:       #e8f0f7;
    --fh-gray:          #f5f6fa;
    --fh-border:        #e1e4e8;
    --fh-text:          #2c3e50;
    --fh-muted:         #636e72;
    --fh-radius:        8px;
    --fh-shadow:        0 2px 12px rgba(0,0,0,.08);
    --fh-shadow-hover:  0 6px 24px rgba(0,0,0,.12);

    /* Per-development brand colours (overridden inline) */
    --dev-color:        var(--fh-primary);
    --dev-color-dark:   var(--fh-primary-dark);
}

/* ─── Status Badges ─────────────────────────────────────────────────────────── */
.fh-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    line-height: 1.4;
}
.fh-status-badge--available   { background: var(--fh-green-lt);  color: var(--fh-green); }
.fh-status-badge--coming_soon { background: #fff9e6; color: #7a5c00; }
.fh-status-badge--reserved    { background: var(--fh-orange-lt); color: #7a3a00; }
.fh-status-badge--sold_stc    { background: var(--fh-purple-lt); color: var(--fh-purple); }
.fh-status-badge--sold        { background: var(--fh-red-lt);    color: var(--fh-red); }

/* Dot prefix for available status */
.fh-status-badge--available::before {
    content: '';
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--fh-green);
}

/* ─── Development Status ───────────────────────────────────────────────────── */
.fh-dev-status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background: var(--dev-color, var(--fh-primary));
    color: #fff;
}

/* ─── Plots Grid ────────────────────────────────────────────────────────────── */
.fh-plots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

/* ─── Plot Card ─────────────────────────────────────────────────────────────── */
.fh-plot-card {
    background: #fff;
    border: 1px solid var(--fh-border);
    border-radius: var(--fh-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--fh-shadow);
    transition: box-shadow .2s ease, transform .2s ease;
    position: relative;
}
.fh-plot-card:hover {
    box-shadow: var(--fh-shadow-hover);
    transform: translateY(-2px);
}

/* Top colour bar based on status */
.fh-plot-card::before {
    content: '';
    display: block;
    height: 3px;
    background: var(--fh-border);
}
.fh-plot-card--available::before   { background: var(--fh-green); }
.fh-plot-card--coming_soon::before { background: #f0c040; }
.fh-plot-card--reserved::before    { background: var(--fh-orange); }
.fh-plot-card--sold_stc::before    { background: var(--fh-purple); }
.fh-plot-card--sold::before        { background: var(--fh-red); }

/* Sold/unavailable cards slightly muted */
.fh-plot-card--sold,
.fh-plot-card--sold_stc { opacity: .82; }

.fh-plot-card__image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--fh-gray);
}
.fh-plot-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.fh-plot-card:hover .fh-plot-card__image img {
    transform: scale(1.03);
}

.fh-plot-card__body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.fh-plot-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.fh-plot-card__number {
    font-size: 12px;
    font-weight: 600;
    color: var(--fh-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.fh-plot-card__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--fh-primary);
    margin: 0 0 10px;
    line-height: 1.3;
}

.fh-plot-card__meta {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.fh-plot-card__meta li {
    font-size: 12px;
    color: var(--fh-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.fh-plot-card__meta li::before {
    content: '·';
    color: var(--fh-border);
}
.fh-plot-card__meta li:first-child::before { display: none; }

.fh-plot-card__price {
    margin: auto 0 14px;
    padding-top: 12px;
    border-top: 1px solid var(--fh-border);
}
.fh-price-was {
    display: block;
    font-size: 12px;
    color: var(--fh-muted);
    text-decoration: line-through;
    margin-bottom: 2px;
}
.fh-price-now {
    font-size: 22px;
    font-weight: 800;
    color: var(--fh-primary);
    line-height: 1;
}

.fh-plot-card__includes {
    font-size: 11px;
    color: var(--fh-muted);
    margin: 0 0 14px;
    line-height: 1.4;
}

.fh-plot-card__sold-label {
    display: block;
    text-align: center;
    padding: 10px;
    background: var(--fh-gray);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fh-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.fh-btn {
    display: inline-block;
    padding: 11px 24px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all .2s ease;
    border: 2px solid transparent;
}
.fh-btn--primary {
    background: var(--dev-color, var(--fh-primary));
    border-color: var(--dev-color, var(--fh-primary));
    color: #fff;
}
.fh-btn--primary:hover {
    background: var(--dev-color-dark, var(--fh-primary-dark));
    border-color: var(--dev-color-dark, var(--fh-primary-dark));
    color: #fff;
}
.fh-btn--outline {
    background: transparent;
    border-color: var(--dev-color, var(--fh-primary));
    color: var(--dev-color, var(--fh-primary));
}
.fh-btn--outline:hover {
    background: var(--dev-color, var(--fh-primary));
    color: #fff;
}
.fh-btn--full { display: block; width: 100%; }

/* ─── Property Meta Strip ───────────────────────────────────────────────────── */
.fh-property-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}
.fh-property-meta li {
    font-size: 13px;
    color: var(--fh-muted);
    padding: 6px 16px;
    border-right: 1px solid var(--fh-border);
    display: flex;
    align-items: center;
    gap: 5px;
}
.fh-property-meta li:first-child { padding-left: 0; }
.fh-property-meta li:last-child  { border-right: none; }
.fh-property-meta span { font-weight: 700; color: var(--fh-text); font-size: 16px; }

/* ─── Floorplans ────────────────────────────────────────────────────────────── */
.fh-floorplans { margin: 24px 0; }
.fh-floorplan  { margin-bottom: 32px; }
.fh-floorplan-name {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--fh-muted);
    margin: 0 0 12px;
}
.fh-floorplan-image img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--fh-border);
    border-radius: var(--fh-radius);
    background: var(--fh-gray);
    padding: 16px;
}
.fh-floorplan-details {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--fh-text);
}

/* ─── Matterport ────────────────────────────────────────────────────────────── */
.fh-matterport {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    border-radius: var(--fh-radius);
    overflow: hidden;
    background: #000;
    margin: 24px 0;
}
.fh-matterport iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ─── Popup / Promo ─────────────────────────────────────────────────────────── */
.fh-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.fh-popup[aria-hidden="false"] {
    opacity: 1;
    pointer-events: all;
}
.fh-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    cursor: pointer;
}
.fh-popup__inner {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 36px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    transform: translateY(20px);
    transition: transform .35s cubic-bezier(.16,1,.3,1);
    border-top: 4px solid var(--dev-color, var(--fh-primary));
}
.fh-popup[aria-hidden="false"] .fh-popup__inner {
    transform: translateY(0);
}
.fh-popup__close {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--fh-muted);
    line-height: 1;
    padding: 4px 8px;
}
.fh-popup__close:hover { color: var(--fh-text); }
.fh-popup__title {
    font-size: 22px;
    font-weight: 800;
    color: var(--fh-primary);
    margin: 0 0 10px;
    line-height: 1.2;
}
.fh-popup__intro {
    font-size: 16px;
    color: var(--fh-text);
    margin: 0 0 16px;
    line-height: 1.5;
}
.fh-popup__body { font-size: 14px; color: var(--fh-muted); line-height: 1.7; }

/* Popup JS */
.fh-popup__overlay,
.fh-popup__close {
    /* These need JS - see fh-frontend.js */
}

/* ─── No plots message ─────────────────────────────────────────────────────── */
.fh-no-plots {
    padding: 40px;
    text-align: center;
    color: var(--fh-muted);
    background: var(--fh-gray);
    border-radius: var(--fh-radius);
    border: 1px solid var(--fh-border);
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .fh-plots-grid {
        grid-template-columns: 1fr;
    }
    .fh-popup__inner {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .fh-plots-grid {
        grid-template-columns: 1fr;
    }
    .fh-price-now { font-size: 18px; }
}
