/* ==========================================================================
   BuyNew Main — Global Stylesheet
   ========================================================================== */

/* ── Custom properties ───────────────────────────────────────────────────── */

:root {
    /* Brand */
    --brand:          #6d28d9;
    --brand-mid:      #7c3aed;
    --brand-light:    #ede9fe;
    --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Text */
    --text-1: #111827;
    --text-2: #374151;
    --text-3: #6b7280;
    --text-4: #9ca3af;

    /* Backgrounds */
    --bg-1:   #ffffff;
    --bg-2:   #f9fafb;
    --bg-3:   #f3f4f6;

    /* Borders */
    --border: #e5e7eb;

    /* Feedback */
    --success: #059669;
    --error:   #dc2626;
    --warning: #d97706;

    /* Typography */
    --font: 'Inter', system-ui, -apple-system, sans-serif;

    /* Layout */
    --container: 1200px;

    /* Radii */
    --radius:    8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .12);
}

/* ── CSS Reset ───────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

img,
video,
svg {
    max-width: 100%;
    display: block;
}

/* ── Base typography ─────────────────────────────────────────────────────── */

body {
    font-family: var(--font);
    font-size: 16px;
    color: var(--text-2);
    line-height: 1.6;
    background: var(--bg-1);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Headings ────────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
    color: var(--text-1);
    font-weight: 700;
    line-height: 1.25;
}

h1 { font-size: clamp(32px, 5vw, 56px); }
h2 { font-size: clamp(26px, 4vw, 40px); }
h3 { font-size: clamp(20px, 3vw, 28px); }
h4 { font-size: clamp(16px, 2.5vw, 20px); font-weight: 600; }

/* ── Links ───────────────────────────────────────────────────────────────── */

a {
    color: var(--brand);
    text-decoration: none;
    transition: color .15s ease;
}

a:hover {
    color: var(--brand-mid);
}

/* ── Layout helpers ──────────────────────────────────────────────────────── */

.container {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 24px;
}

.section {
    padding-block: 80px;
}

.section-header {
    text-align: center;
    max-width: 640px;
    margin-inline: auto;
    margin-bottom: 48px;
}

.section-title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--text-1);
}

.section-subtitle {
    font-size: 17px;
    color: var(--text-3);
    margin-top: 12px;
    line-height: 1.6;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity .15s ease, box-shadow .15s ease, background .15s ease;
    white-space: nowrap;
}

.btn:hover {
    opacity: .9;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
}

.btn-primary:hover {
    color: #fff;
    opacity: .88;
}

.btn-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-1);
}

.btn-secondary:hover {
    background: var(--bg-2);
    color: var(--text-1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--brand);
    color: var(--brand);
}

.btn-outline:hover {
    background: var(--brand-light);
    color: var(--brand);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

/* ── Pill buttons (design system) ───────────────────────────────────────── */

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: fit-content;
    height: 44px;
    padding: 0 24px;
    border-radius: 99px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .15s ease;
}

.btn-pill:hover {
    opacity: .8;
    text-decoration: none;
}

.btn-pill--solid {
    background-color: var(--color-black);
    color: var(--color-white);
    border: none;
}

.btn-pill--solid:hover {
    color: var(--color-white);
}

.btn-pill--outline {
    background-color: transparent;
    border: 2px solid var(--color-black);
    color: var(--color-black);
}

.btn-pill--outline:hover {
    color: var(--color-black);
}

.btn-pill--full {
    width: 100%;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.badge-available {
    background: #d1fae5;
    color: #065f46;
}

.badge-reserved {
    background: #fef3c7;
    color: #92400e;
}

.badge-sold {
    background: #fee2e2;
    color: #991b1b;
}

.badge-coming-soon {
    background: #dbeafe;
    color: #1e40af;
}

.badge-scheme {
    background: var(--brand-light);
    color: var(--brand);
}

/* ── Status spans (inline) ────────────────────────────────────────────────── */

.status--available,
.status--reserved,
.status--sold,
.status--coming-soon,
.status--unknown {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.status--available   { background: #d1fae5; color: #065f46; }
.status--reserved    { background: #fef3c7; color: #92400e; }
.status--sold        { background: #fee2e2; color: #991b1b; }
.status--coming-soon { background: #dbeafe; color: #1e40af; }
.status--unknown     { background: var(--bg-3); color: var(--text-3); }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text-1);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
    -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-4);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .15);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-error {
    font-size: 13px;
    color: var(--error);
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ── API error state ─────────────────────────────────────────────────────── */

.api-error {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-3);
}

.api-error__icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.api-error__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 8px;
}

.api-error__message {
    font-size: 15px;
    color: var(--text-3);
}

/* ── Accessibility ───────────────────────────────────────────────────────── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Development Card ────────────────────────────────────────────────────── */

.dev-card {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
}

.dev-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    color: inherit;
    text-decoration: none;
}

.dev-card__image {
    position: relative;
    height: 230px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background-color: #e8e8e8;
    flex-shrink: 0;
}

.dev-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dev-card__badges {
    position: absolute;
    inset: 0;
    top: 5px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 8px;
    pointer-events: none;
}

.dev-card__badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.dev-card__badge {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 700;
    white-space: nowrap;
}

.dev-card__badge--new {
    background-color: var(--color-black);
    color: var(--color-white);
    font-size: 10px;
    letter-spacing: 0.6px;
}

.dev-card__save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    cursor: pointer;
    color: var(--color-black);
    pointer-events: all;
    transition: background .15s ease;
}

.dev-card__save:hover {
    background: rgba(255, 255, 255, 0.4);
}

.dev-card__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 12px 24px;
    height: 100%;
}

.dev-card__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dev-card__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.dev-card__name {
    font-family: var(--font-body);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-black);
}

.dev-card__price {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.dev-card__price-from {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-black);
}

.dev-card__price-amount {
    font-family: var(--font-body);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-black);
}

.dev-card__location {
    display: flex;
    align-items: center;
    line-height: 1.5;
}

.dev-card__town {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    color: #747474;
}

.dev-card__developer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    color: #747474;
    margin-left: 6px;
}

.dev-card__dot {
    line-height: 1;
}

.dev-card__desc {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-black);
}

.dev-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
}

.dev-card__cta {
    flex-shrink: 0;
}

.dev-card__homes {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #747474;
    white-space: nowrap;
    text-align: right;
}


/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .section {
        padding-block: 56px;
    }

    .container {
        padding-inline: 16px;
    }
}
