/*
 * Base funnel styles. NO hard-coded brand colours — everything references the
 * per-brand CSS custom properties emitted by DesignTokens.ToCssVariables()
 * (--brand-color-*, --brand-type-*, --brand-layout-*). Fallbacks keep it usable
 * if a token is turned off for a brand.
 */
:root {
    --_accent: var(--brand-color-accent, #4338ca);
    --_accent-contrast: var(--brand-color-accent-contrast, #ffffff);
    --_bg: var(--brand-color-background, #f7f7fb);
    --_surface: var(--brand-color-surface, #ffffff);
    --_text: var(--brand-color-text, #1a1523);
    --_muted: var(--brand-color-muted, #6b6577);
    --_font: var(--brand-type-font-family-base, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);

    /* Borders and subtle fills. Defaults are black-alpha (fine on light backgrounds);
       DARK brands MUST set colors.border + colors.subtle or these vanish. */
    --_border: var(--brand-color-border, rgba(0, 0, 0, .12));
    --_subtle: var(--brand-color-subtle, rgba(0, 0, 0, .06));

    /* Buttons and inputs are styled independently: a brand may use full pill buttons
       (border-radius: 300px) while keeping inputs only slightly rounded. */
    --_btn-radius: var(--brand-layout-button-radius, 8px);
    --_input-radius: var(--brand-layout-input-radius, 8px);
}

* { box-sizing: border-box; }

/* The colour scheme is brand-driven (tokens.colorScheme), set on <html> by the layout.
   Pinning it stops mobile dark mode restyling form controls behind the brand's back. */

/* Inputs must take the brand surface, not the UA scheme's default field colour
   (which is grey in dark mode and ignores the brand palette entirely). */
button, input, select, textarea { color: var(--_text); }
input, select, textarea { background: var(--_surface); }
input::placeholder { color: var(--_muted); opacity: 1; }

body {
    margin: 0;
    font-family: var(--_font);
    color: var(--_text);
    background: var(--_bg);
    line-height: 1.5;
}

.funnel-header {
    padding: 1rem 1.5rem;
    background: var(--_surface);
    border-bottom: 1px solid var(--_border);
}
.funnel-logo { height: var(--brand-layout-logo-height, 40px); }
.funnel-wordmark { font-weight: 700; font-size: 1.1rem; }

.funnel-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.funnel-footer {
    text-align: center;
    color: var(--_muted);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.funnel-footer a { color: var(--_muted); }
.funnel-footer__contact { display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; }
.funnel-header__home { display: inline-block; line-height: 0; }

h1 {
    font-size: 1.6rem;
    margin: 0 0 .5rem;
    color: var(--brand-color-heading, inherit);
    font-family: var(--brand-type-font-family-heading, inherit);
}
h2 { color: var(--brand-color-heading, inherit); }
.lede { color: var(--_muted); margin-top: 0; }
.muted { color: var(--_muted); }

.product-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin: 1.5rem 0;
}
.product-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.25rem;
    background: var(--_surface);
    border: 1px solid var(--_border);
    border-radius: var(--brand-layout-radius, 12px);
    text-decoration: none;
    color: inherit;
}
.product-card__title { font-weight: 600; }
.product-card__cta { color: var(--_accent); font-weight: 600; }

/* Step content: centred column — headings/straplines centred, forms centred as blocks
   (labels stay left-aligned inside them). */
.funnel-main h1,
.funnel-main .lede,
.funnel-main .notice { text-align: center; }
.step--confirmation { text-align: center; }

.availability-form {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
}
.availability-form input {
    padding: .6rem .75rem;
    border: 1px solid var(--_border);
    border-radius: var(--_input-radius);
    font: inherit;
}

.btn {
    display: inline-block;
    padding: .6rem 1rem;
    border: none;
    border-radius: var(--_btn-radius);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: var(--_text);
    background: var(--_subtle);
}
.btn--primary { background: var(--_accent); color: var(--_accent-contrast); }

.notice {
    padding: .6rem .9rem;
    background: color-mix(in srgb, var(--_accent) 8%, var(--_surface));
    border: 1px solid color-mix(in srgb, var(--_accent) 25%, transparent);
    border-radius: 8px;
}

.availability-form select {
    padding: .6rem .75rem;
    border: 1px solid var(--_border);
    border-radius: var(--_input-radius);
    font: inherit;
    background: var(--_surface);
}

.address-list {
    margin: 1.5rem auto 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    max-width: 480px;
}
.address-list h2 { font-size: 1.1rem; margin: 0 0 .25rem; text-align: center; }
.address-option {
    width: 100%;
    text-align: left;
    padding: .6rem .9rem;
    background: var(--_surface);
    color: var(--_text);
    border: 1px solid var(--_border);
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}
.address-option:hover { border-color: var(--_accent); }

.offer-list,
.offer-grid { display: flex; flex-direction: column; gap: .75rem; margin: 1.25rem 0; }

/* Streaming availability results */
.carrier-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .55rem .9rem;
    margin: 0 auto;
    max-width: 480px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--_accent) 8%, var(--_surface));
    border: 1px solid color-mix(in srgb, var(--_accent) 22%, transparent);
    font-size: .92rem;
}
.carrier-status--done {
    background: color-mix(in srgb, var(--brand-color-success, #16a34a) 10%, var(--_surface));
    border-color: color-mix(in srgb, var(--brand-color-success, #16a34a) 30%, transparent);
}
.carrier-status__spinner {
    width: 14px; height: 14px;
    border: 2px solid color-mix(in srgb, var(--_accent) 30%, transparent);
    border-top-color: var(--_accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* [hidden] must always win — several of these elements have display:flex. */
[hidden] { display: none !important; }

/* Busy state for submit buttons (postcode/address + number search) */
.btn--busy {
    opacity: .85;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}
.btn__spinner {
    width: 14px; height: 14px;
    border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    flex: none;
}

/* Dynamic result filters (appear only when >1 network or >1 term) */
.offer-filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem auto 0;
    padding: .75rem 1rem;
    max-width: 560px;
    background: var(--_surface);
    border: 1px solid var(--_border);
    border-radius: var(--brand-layout-radius, 12px);
}
.filter-group {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    border: none;
    margin: 0;
    padding: 0;
}
.filter-group__label {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--_muted);
    padding: 0;
}
.filter-option {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .88rem;
    cursor: pointer;
    user-select: none;
}
.filter-option input { accent-color: var(--_accent); width: 15px; height: 15px; cursor: pointer; }

.carrier-group { display: flex; flex-direction: column; gap: .75rem; }
.carrier-group__head {
    text-align: left;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--_muted);
    margin-top: .5rem;
}
.offer-group--enter { animation: rise .35s ease-out; }
.offer-card--enter { animation: rise .35s ease-out; }
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.offer-card__chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .2rem 0; }
.chip {
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.chip--carrier {
    background: color-mix(in srgb, var(--brand-color-heading, var(--_accent)) 10%, var(--_surface));
    color: var(--brand-color-heading, var(--_text));
    border: 1px solid color-mix(in srgb, var(--brand-color-heading, var(--_accent)) 25%, transparent);
}
.chip--term {
    background: var(--_subtle);
    color: var(--_muted);
    border: 1px solid var(--_border);
}

/* Skeleton placeholders while the first carrier responds */
.offer-card--skeleton { min-height: 84px; align-items: stretch; }
.offer-card--skeleton .skeleton-line {
    height: 12px;
    border-radius: 6px;
    margin: .35rem 0;
    background: linear-gradient(90deg, var(--_subtle) 25%, var(--_border) 50%, var(--_subtle) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w30 { width: 30%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.offer-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--_surface);
    border: 1px solid var(--_border);
    border-radius: var(--brand-layout-radius, 12px);
}
.offer-card__body { display: flex; flex-direction: column; gap: .15rem; }
.offer-card__title { font-weight: 600; }
.offer-card__subtitle { color: var(--_muted); font-size: .9rem; }
.offer-card__price { font-weight: 600; color: var(--_accent); }
.offer-card__price small { font-weight: 400; color: var(--_muted); }

.summary-card {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .9rem 1.1rem;
    max-width: 420px;
    margin: 0 auto 1.25rem;
    background: var(--_surface);
    border: 1px solid var(--_border);
    border-radius: 8px;
}
.summary-card__title { font-weight: 600; }

.details-form {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 420px;
    margin: 0 auto;
    text-align: left;
}
.details-form label { margin-top: .4rem; }
.details-form input {
    padding: .6rem .75rem;
    border: 1px solid var(--_border);
    border-radius: var(--_input-radius);
    font: inherit;
}
.details-form button { margin-top: 1rem; align-self: stretch; }

/* Back link aligned to the centred form rather than the page edge */
.step-back { max-width: 420px; margin: 1rem auto 0; }

/* Order type (new install vs migration) + addon options on the details step */
.order-type {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    border: none;
    margin: 0 0 1.25rem;
    padding: 0;
}
.order-type .addon-section__title { margin-bottom: .35rem; padding: 0; }

.addon-section { display: flex; flex-direction: column; gap: 1rem; margin-bottom: .75rem; }
.addon-section__title { font-size: 1.05rem; margin: 0; text-align: left; }
.addon-group { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.addon-group__name {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--_muted);
    padding: 0;
}
.addon-group__desc { margin: 0; font-size: .85rem; }
.addon-option {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .8rem;
    background: var(--_surface);
    border: 1px solid var(--_border);
    border-radius: 10px;
    cursor: pointer;
}
.addon-option:has(input:checked) {
    border-color: var(--_accent);
    box-shadow: 0 0 0 1px var(--_accent);
}
.addon-option input { accent-color: var(--_accent); flex: none; }
.addon-option__body { display: flex; flex-direction: column; flex: 1; }
.addon-option__name { font-weight: 600; font-size: .92rem; }
.addon-option__desc { font-size: .8rem; }
.addon-option__price { font-weight: 600; font-size: .9rem; text-align: right; color: var(--_accent); }
.addon-option__price small { color: var(--_muted); font-weight: 400; }
.addon-option__setup { display: block; font-size: .75rem; font-weight: 400; }

.order-summary__row { display: flex; justify-content: space-between; gap: 1rem; }
.order-summary__total { font-weight: 700; border-top: 1px solid var(--_border); padding-top: .4rem; margin-top: .2rem; }
