/* ============================================================
   FindMyFlat — style.css  (fixed layout)
   Aesthetic: Refined Editorial / Luxury Minimal
   Palette: Warm Off-White · Deep Charcoal · Brass Gold Accent
   ============================================================ */

/* ── Custom Properties ────────────────────────────────────── */
:root {
    --bg:           #F7F5F2;
    --surface:      #FFFFFF;
    --border:       #E2DDD8;
    --border-focus: #B08D57;
    --text-primary: #1C1917;
    --text-body:    #44403C;
    --text-muted:   #A8A29E;
    --accent:       #B08D57;
    --accent-dark:  #8C6D3F;
    --accent-light: #F4ECD9;
    --error:        #C0392B;
    --error-bg:     #FEF2F0;
    --success:      #27AE60;

    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  20px;

    --shadow-card: 0 4px 32px rgba(28,25,23,.08), 0 1px 4px rgba(28,25,23,.04);
    --shadow-btn:  0 4px 16px rgba(176,141,87,.35);

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* prevent any horizontal overflow at the body level */
    overflow-x: hidden;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
    position: relative;
    background-color: var(--text-primary);
    background-image:
        radial-gradient(ellipse 80% 60% at 70% 50%, rgba(176,141,87,.15) 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    color: #FFFFFF;
    padding: 80px 24px 100px;
    text-align: center;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.hero__inner {
    max-width: 640px;
    margin: 0 auto;
}
.hero__badge {
    display: inline-block;
    background: rgba(176,141,87,.18);
    border: 1px solid rgba(176,141,87,.4);
    color: #D4AF6E;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 24px;
}
.hero__title {
    font-family: var(--font-display);
    font-size: clamp(34px, 6vw, 60px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #FFFFFF;
    margin-bottom: 20px;
}
.hero__sub {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255,255,255,.65);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.7;
}
.hero__scroll-hint {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255,255,255,.35);
    letter-spacing: .06em;
    white-space: nowrap;
    animation: bob 2.5s ease-in-out infinite;
}
@keyframes bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(5px); }
}

/* ── Main / Card ──────────────────────────────────────────── */
.main {
    /* ← KEY FIX: use a real max-width + side padding so the card
         never exceeds the viewport. Never use calc() with margin
         tricks that can cause overflow on small screens. */
    width: 100%;
    max-width: 860px;
    margin: -40px auto 60px;
    padding: 0 16px;        /* side breathing room on all screens */
    position: relative;
    z-index: 1;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    /* ← KEY FIX: hidden was clipping the grid children */
    overflow: visible;
    /* add a border so the card edge is visible without overflow:hidden */
    border: 1px solid rgba(226,221,216,.6);
    animation: riseIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes riseIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Card Header ──────────────────────────────────────────── */
.card__header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border);
    /* rounded top corners */
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--surface);
}
.card__step {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
.card__title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.card__desc {
    font-size: 13.5px;
    color: var(--text-muted);
}

/* ── Fieldsets ────────────────────────────────────────────── */
fieldset {
    border: none;
    padding: 28px 32px;
    border-bottom: 1px solid var(--border);
}
fieldset:last-of-type {
    border-bottom: none;
}
.fieldset__legend {
    display: block;
    float: left;
    width: 100%;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 18px;
}

/* ── Form Grid ─────────────────────────────────────────────
   KEY FIX: use minmax so columns shrink gracefully instead
   of creating fixed widths that overflow the card.
   ───────────────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));   /* ← minmax(0,1fr) prevents overflow */
    gap: 16px;
    margin-bottom: 16px;
    /* clear the floated legend */
    clear: both;
}
.form-row:last-child { margin-bottom: 0; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* ensure group never overflows its grid cell */
    min-width: 0;
}

/* ── Labels ───────────────────────────────────────────────── */
label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: .01em;
}
.req { color: var(--accent); }

/* ── Inputs & Select ──────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select {
    /* ← KEY FIX: width:100% is relative to the flex/grid container,
         which already has min-width:0 — so this can never overflow. */
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    -webkit-appearance: none;
    appearance: none;
}
input::placeholder { color: var(--text-muted); }

input:hover,
select:hover { border-color: #C4BDB5; }

input:focus,
select:focus {
    border-color: var(--border-focus);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(176,141,87,.14);
}

/* ── Select Wrapper ───────────────────────────────────────── */
.select-wrap {
    position: relative;
    min-width: 0;
}
.select-wrap select {
    cursor: pointer;
    padding-right: 36px;
}
.select-arrow {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

/* ── Validation States ────────────────────────────────────── */
input.is-invalid,
select.is-invalid {
    border-color: var(--error);
    background: var(--error-bg);
}
input.is-invalid:focus,
select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}
input.is-valid { border-color: var(--success); }

.error-msg {
    font-size: 12px;
    color: var(--error);
    min-height: 16px;
    display: block;
    font-weight: 500;
}

/* ── Submit Section ───────────────────────────────────────── */
.form-submit {
    padding: 24px 32px 32px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    /* round the bottom corners */
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--text-primary);
    color: #FFFFFF;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    opacity: 0;
    transition: opacity var(--transition);
}
.btn-submit:hover::before  { opacity: 1; }
.btn-submit:hover          { box-shadow: var(--shadow-btn); transform: translateY(-1px); }
.btn-submit:active         { transform: translateY(0); }
.btn-submit:disabled       { opacity: .6; cursor: not-allowed; }

.btn-submit__text,
.btn-submit__icon { position: relative; z-index: 1; }
.btn-submit__icon { transition: transform var(--transition); }
.btn-submit:hover .btn-submit__icon { transform: translateX(4px); }

.form-note {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── ─────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ─────────────────────────────────────────────────────────── */

/* Tablet: 601–900px — keep 2-col but tighten padding */
@media (max-width: 900px) {
    .main { max-width: 100%; }
    .card__header,
    fieldset,
    .form-submit { padding-left: 24px; padding-right: 24px; }
}

/* Mobile: ≤600px — single column, compact padding */
@media (max-width: 600px) {
    .hero { padding: 56px 20px 72px; }
    .hero__scroll-hint { display: none; }

    .main { margin-top: -20px; padding: 0 10px; }

    .card { border-radius: var(--radius-md); }

    .card__header,
    fieldset,
    .form-submit {
        padding-left: 18px;
        padding-right: 18px;
    }
    .card__header { padding-top: 24px; padding-bottom: 20px; }
    fieldset       { padding-top: 22px; padding-bottom: 22px; }

    /* ← KEY FIX: stack all fields vertically on small screens */
    .form-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .btn-submit {
        width: 100%;
        justify-content: center;
    }

    .card__title { font-size: 21px; }
}

/* Very small phones (≤360px) */
@media (max-width: 360px) {
    .card__header,
    fieldset,
    .form-submit {
        padding-left: 14px;
        padding-right: 14px;
    }
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select {
        font-size: 16px; /* prevents iOS zoom on focus */
    }
}
