/* ============================================================================
   Five Detailing Co. — Quote Builder
   Loaded only on the Build Your Custom Quote page.
============================================================================ */

/* ── Page-level reset ──────────────────────────────────────────────────── */
.qb-main { background: var(--cream); padding: 0; margin: 0; }

.qb {
    background: var(--cream);
    min-height: calc(100vh - 240px);
    padding-block: clamp(2rem, 4vw, 4rem);
    position: relative;
    overflow: hidden;
}
.qb::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 15% 0%, rgba(162, 48, 64, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 100%, rgba(24, 34, 66, 0.05) 0%, transparent 55%);
    pointer-events: none; z-index: 0;
}
.qb__inner { position: relative; z-index: 1; max-width: 1180px; }

/* ── Top bar (back + progress) ─────────────────────────────────────────── */
.qb__bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: clamp(2rem, 4vw, 3.5rem);
}
.qb__back {
    justify-self: start;
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(24, 34, 66, 0.18);
    color: var(--ink);
    padding: 0.6rem 1.1rem 0.6rem 0.85rem;
    border-radius: 999px;
    font-family: var(--font-display);
    font-weight: 600; font-size: 0.85rem;
    letter-spacing: 0.04em; text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-out-quart), opacity 0.25s ease;
}
.qb__back:hover { background: var(--navy); border-color: var(--navy); color: var(--white); }
.qb__back.is-hidden { visibility: hidden; opacity: 0; pointer-events: none; }

.qb__progress { justify-self: center; text-align: center; width: 280px; max-width: 100%; }
.qb__progress-bar { height: 4px; border-radius: 999px; background: rgba(24, 34, 66, 0.10); overflow: hidden; }
.qb__progress-fill {
    display: block; height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--burgundy-light), var(--burgundy));
    border-radius: 999px;
    transition: width 0.5s var(--ease-out-quart);
}
.qb__progress-label {
    margin: 0.6rem 0 0;
    font-family: var(--font-display);
    font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--muted); font-weight: 600;
}

/* ── Step stage ────────────────────────────────────────────────────────── */
.qb__stage { position: relative; min-height: 460px; }
.qb-step {
    position: absolute; inset: 0;
    opacity: 0; transform: translateY(18px);
    pointer-events: none;
    transition: opacity 0.55s var(--ease-out-quart), transform 0.55s var(--ease-out-quart);
    text-align: center;
}
.qb-step.is-active { opacity: 1; transform: translateY(0); pointer-events: auto; position: relative; }
.qb-step.is-leaving { opacity: 0; transform: translateY(-18px); }
.qb-step--narrow { max-width: 580px; margin: 0 auto; }

.qb-step__eyebrow {
    font-family: 'Caveat', 'Pacifico', cursive;
    color: var(--burgundy); font-size: 1.4rem; margin: 0 0 0.6rem;
}
.qb-step__heading {
    font-family: var(--font-display); color: var(--navy);
    font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.02em;
    margin: 0 auto 0.85rem; max-width: 18ch; text-wrap: balance; font-weight: 800;
}
.qb-step__subhead {
    margin: 0 auto clamp(2rem, 4vw, 3rem);
    max-width: 540px; color: var(--muted);
    font-size: clamp(1rem, 1.2vw, 1.1rem); line-height: 1.55; text-wrap: pretty;
}
.qb-step__actions {
    display: flex; gap: 0.85rem; justify-content: center; align-items: center;
    margin-top: 2rem; flex-wrap: wrap;
}
.qb-step__actions--single { margin-top: 1.75rem; }

/* ── Tiles (single-select large choice cards) ──────────────────────────── */
.qb-tiles { display: grid; gap: clamp(1.25rem, 2vw, 1.75rem); margin: 0 auto; max-width: 1080px; }
.qb-tiles--three { grid-template-columns: repeat(3, 1fr); }
.qb-tiles--four  { grid-template-columns: repeat(4, 1fr); }
.qb-tiles--compact { max-width: 960px; }

.qb-tile {
    appearance: none;
    background: var(--white);
    border: 2px solid rgba(24, 34, 66, 0.10);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 2.5vw, 2.25rem);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    gap: 1.25rem;
    cursor: pointer; color: var(--ink);
    box-shadow: 0 1px 2px rgba(15, 21, 48, 0.04);
    transition: transform 0.4s var(--ease-out-quart), border-color 0.3s ease, box-shadow 0.4s var(--ease-out-quart), background-color 0.3s ease;
    position: relative; overflow: hidden;
    min-height: 280px;
    text-align: center;
}
.qb-tile::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 35%, rgba(162, 48, 64, 0.08) 0%, transparent 65%);
    opacity: 0; transition: opacity 0.35s ease;
}
.qb-tile:hover, .qb-tile:focus-visible {
    transform: translateY(-6px); border-color: var(--burgundy);
    box-shadow: 0 18px 40px rgba(24, 34, 66, 0.12); outline: none;
}
.qb-tile:hover::before, .qb-tile:focus-visible::before { opacity: 1; }
.qb-tile.is-selected { border-color: var(--burgundy); background: rgba(162, 48, 64, 0.04); }

.qb-tile__graphic { display: block; width: 100%; max-width: 280px; height: auto; position: relative; z-index: 1; }
.qb-tile__graphic img { width: 100%; height: auto; display: block; transition: transform 0.5s var(--ease-out-quart); }
.qb-tile:hover .qb-tile__graphic img, .qb-tile:focus-visible .qb-tile__graphic img { transform: scale(1.04); }

.qb-tile__label {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--navy); position: relative; z-index: 1;
}

/* Text-led tiles (Step 2 service tiles) — icon + label + subtext, no big image */
.qb-tile--text {
    min-height: 240px;
    justify-content: center;
    gap: 1rem;
    padding: clamp(2rem, 3vw, 2.75rem) clamp(1.25rem, 2vw, 1.75rem);
}
.qb-tile__icon {
    width: 56px; height: 56px;
    color: var(--burgundy);
    display: inline-flex; align-items: center; justify-content: center;
    position: relative; z-index: 1;
}
.qb-tile__icon svg { width: 100%; height: 100%; }
.qb-tile__sub {
    font-size: 0.95rem; color: var(--muted); line-height: 1.45;
    max-width: 26ch; margin: 0; position: relative; z-index: 1;
}
.qb-tile--feature {
    border-color: rgba(162, 48, 64, 0.35);
}
.qb-tile__badge {
    position: absolute; top: 14px; right: 14px;
    background: var(--burgundy); color: #fff;
    font-family: var(--font-display); font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
    padding: 0.3rem 0.55rem; border-radius: 999px;
    z-index: 2;
}

/* ── Checkbox tiles (add-ons) ─────────────────────────────────────────── */
.qb-checks {
    display: grid; gap: 0.75rem;
    grid-template-columns: repeat(2, 1fr);
    max-width: 760px; margin: 0 auto;
    text-align: left;
}
.qb-check {
    display: flex; align-items: center; gap: 0.85rem;
    background: var(--white);
    border: 1.5px solid rgba(24, 34, 66, 0.10);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.25s var(--ease-out-quart);
    user-select: none;
}
.qb-check input { position: absolute; opacity: 0; pointer-events: none; }
.qb-check__box {
    flex: 0 0 22px; width: 22px; height: 22px;
    border: 1.5px solid rgba(24, 34, 66, 0.30);
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    position: relative;
}
.qb-check__box::after {
    content: "";
    width: 12px; height: 6px;
    border-left: 2.4px solid #fff;
    border-bottom: 2.4px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px) scale(0);
    transition: transform 0.18s var(--ease-out-quart);
}
.qb-check__label {
    font-family: var(--font-display); font-weight: 600;
    color: var(--ink); font-size: 1rem; line-height: 1.3;
}
.qb-check:hover { border-color: var(--burgundy); transform: translateY(-1px); }
.qb-check.is-checked { border-color: var(--burgundy); background: rgba(162, 48, 64, 0.04); }
.qb-check.is-checked .qb-check__box { background: var(--burgundy); border-color: var(--burgundy); }
.qb-check.is-checked .qb-check__box::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.qb-btn {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700;
    font-size: 0.95rem; letter-spacing: 0.05em; text-transform: uppercase;
    padding: 0.95rem 1.6rem;
    border-radius: 999px;
    border: 1.5px solid transparent;
    cursor: pointer; text-decoration: none;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-out-quart);
}
.qb-btn--lg { padding: 1.1rem 2.2rem; font-size: 1rem; }
.qb-btn--primary { background: var(--burgundy); color: #fff; }
.qb-btn--primary:hover { background: var(--burgundy-dark); transform: translateY(-2px); }
.qb-btn--ghost {
    background: transparent; color: var(--navy);
    border-color: rgba(24, 34, 66, 0.25);
}
.qb-btn--ghost:hover { background: rgba(24, 34, 66, 0.04); border-color: var(--navy); }

/* ── Lead form ────────────────────────────────────────────────────────── */
.qb-form {
    display: grid; gap: 1rem;
    grid-template-columns: 1fr 1fr;
    max-width: 580px; margin: 0 auto;
    text-align: left;
}
.qb-field { display: flex; flex-direction: column; gap: 0.4rem; }
.qb-field--wide { grid-column: 1 / -1; }
.qb-field__label {
    font-family: var(--font-display); font-weight: 600;
    font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--navy);
}
.qb-field input {
    appearance: none; background: var(--white);
    border: 1.5px solid rgba(24, 34, 66, 0.15);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    font-family: var(--font-body); font-size: 1rem; color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.qb-field input:focus {
    outline: none; border-color: var(--burgundy);
    box-shadow: 0 0 0 4px rgba(162, 48, 64, 0.12);
}
.qb-form .qb-step__actions { grid-column: 1 / -1; }

/* ── Quote display ────────────────────────────────────────────────────── */
.qb-step--quote { max-width: 720px; margin: 0 auto; }
.qb-quote {
    background: var(--white);
    border: 1px solid rgba(24, 34, 66, 0.10);
    border-radius: var(--radius-lg);
    padding: clamp(2rem, 4vw, 3rem);
    box-shadow: 0 20px 50px rgba(15, 21, 48, 0.06);
    text-align: left;
}
.qb-quote__list { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.qb-quote__item {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px dashed rgba(24, 34, 66, 0.10);
}
.qb-quote__item:last-child { border-bottom: 0; }
.qb-quote__item-label { font-family: var(--font-body); font-size: 1rem; color: var(--ink); }
.qb-quote__item-price {
    font-family: var(--font-display); font-weight: 700;
    color: var(--navy); font-size: 1.05rem;
    flex: 0 0 auto;
}
.qb-quote__total {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    padding: 1.25rem 0 1.5rem;
    border-top: 2px solid var(--navy);
    margin-top: 0.5rem;
}
.qb-quote__total-label {
    font-family: var(--font-display); font-weight: 700;
    font-size: 0.85rem; letter-spacing: 0.15em; text-transform: uppercase;
    color: var(--navy);
}
.qb-quote__total-value {
    font-family: var(--font-display); font-weight: 800;
    font-size: clamp(2rem, 4vw, 2.6rem);
    color: var(--burgundy); letter-spacing: -0.01em;
}
.qb-quote__disclaimer {
    font-size: 0.85rem; line-height: 1.5; color: var(--muted);
    margin: 0; padding-top: 0.5rem;
    text-align: center;
}
.qb-quote .qb-step__actions { margin-top: 1.5rem; }
.qb-quote__restart {
    appearance: none; background: transparent; border: 0;
    color: var(--muted); font-family: var(--font-display);
    font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
    cursor: pointer; padding: 0.6rem 1rem;
    display: block; margin: 1rem auto 0;
    text-decoration: underline; text-underline-offset: 4px;
    transition: color 0.2s ease;
}
.qb-quote__restart:hover { color: var(--burgundy); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .qb-tiles--four { grid-template-columns: repeat(2, 1fr); max-width: 720px; }
}
@media (max-width: 860px) {
    .qb-tiles--three { grid-template-columns: 1fr; max-width: 440px; }
    .qb-tiles--four  { grid-template-columns: 1fr; max-width: 440px; }
    .qb-tile { min-height: 220px; }
    .qb-tile--text { min-height: 180px; }
    .qb__bar { grid-template-columns: auto 1fr auto; }
    .qb__progress { width: 100%; }
    .qb-checks { grid-template-columns: 1fr; max-width: 440px; }
    .qb-form { grid-template-columns: 1fr; max-width: 440px; }
}
@media (max-width: 480px) {
    .qb__bar { gap: 0.75rem; }
    .qb__back span { display: none; }
    .qb__back { padding: 0.55rem 0.65rem; }
}

/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .qb-step, .qb-tile, .qb-tile__graphic img, .qb__progress-fill,
    .qb-check, .qb-btn, .qb-check__box::after { transition: none !important; }
}
