/*
 * Buy a new bike online: pages/buy-online and its Livewire form
 * (livewire/forms/buy-online-form-new). The form also uses the enquiry and step
 * form styles in forms.css.
 */

.buy-page {
    padding-block: var(--space-5) var(--space-8);
}

.buy-page__layout {
    display: grid;
    gap: var(--space-5);
    align-items: start;
}

/* The bike on the left stays in view beside the steps. */
@media (min-width: 1000px) {
    .buy-page__layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: var(--space-7);
    }

    .buy-bike {
        position: sticky;
        top: calc(var(--header-height) + var(--space-5));
    }
}

@media (min-width: 1280px) {
    .buy-page__layout {
        grid-template-columns: minmax(0, 1fr) 620px;
    }
}


/* The bike
   ========================================================================== */

/* A row with a small photo above the form, then one column beside it. */
.buy-bike {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}

/* Fills the height of the row, so the white behind the photo doesn't float in dark mode. */
.buy-bike__media {
    min-height: 110px;
    background: var(--color-media);
}

.buy-bike__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.buy-bike__body {
    display: grid;
    align-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
}

.buy-bike__title {
    font-size: var(--text-xl);
}

.buy-bike__extra {
    display: grid;
    grid-column: 1 / -1;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.buy-bike__dealer {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    color: var(--color-text);
}

.buy-bike__dealer .icon {
    flex: none;
    margin-top: 2px;
    color: var(--color-accent-text);
}

.buy-bike__dealer b {
    display: block;
}

.buy-bike__help a {
    color: var(--color-accent-text);
    font-weight: 600;
}

@media (min-width: 640px) {
    .buy-bike__body,
    .buy-bike__extra {
        padding: var(--space-5);
    }

    .buy-bike__title {
        font-size: var(--text-2xl);
    }
}

/* Beside the form, the card is as tall as the screen below the back link (116px
   is the space above and below it). The name, price and notes take what they
   need and the photo fills the rest, so the card fits however wide it gets. */
@media (min-width: 1000px) {
    .buy-bike {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(220px, 1fr) auto auto;
        min-height: clamp(560px, calc(100vh - var(--header-height) - 116px), 900px);
    }

    /* Out of the flow, so the photo's own size can't make the card taller. */
    .buy-bike__media {
        position: relative;
    }

    .buy-bike__media img {
        position: absolute;
        inset: 0;
        padding: var(--space-5);
    }
}

.buy-price {
    display: grid;
    justify-items: start;
    gap: 2px;
}

.buy-price__label,
.buy-price__note {
    font-size: var(--text-sm);
}

.buy-price__label {
    color: var(--color-text-muted);
}

.buy-price__amount {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: var(--heading-weight);
    line-height: 1.1;
}

.buy-price__amount span {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
}

.buy-price__note s {
    color: var(--color-text-muted);
}


/* The form
   ========================================================================== */

.buy-form {
    padding: var(--space-5) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}

@media (min-width: 640px) {
    .buy-form {
        padding: var(--space-6);
    }
}

/* One under another, so each choice reads as a full line. */
.buy-choices {
    display: grid;
    gap: var(--space-2);
}

@media (min-width: 480px) {
    .buy-choices--two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.buy-choice small {
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 400;
}

/* The choice made earlier, when a visitor comes back to the step. */
.buy-choice[aria-pressed="true"] {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

.buy-choice[aria-pressed="true"]::after {
    content: "✓";
}

/* The registration is typed into a yellow UK number plate. */
.buy-reg {
    display: grid;
    gap: var(--space-2);
}

.buy-reg__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.buy-plate {
    display: flex;
    flex: 1 1 220px;
    max-width: 300px;
    overflow: hidden;
    border: 2px solid #18181B;
    border-radius: var(--radius-field);
    background: #FFD307;
}

.buy-plate:focus-within {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.buy-plate__band {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    background: #00309A;
    color: #FFFFFF;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
}

.buy-plate__input {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 var(--space-3);
    border: 0;
    background: transparent;
    color: #111111;
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.buy-plate__input::placeholder {
    color: rgb(0 0 0 / 0.3);
}

.buy-plate__input:focus {
    outline: none;
}

.buy-mileage {
    max-width: 240px;
}

/* Back to the yes or no question, beside Next. */
.buy-skip {
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    font-size: var(--text-sm);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.buy-skip:hover {
    color: var(--color-text);
}
