/* Checkout: contact / delivery / payment form plus a sticky order summary.
   Reuses the brand tokens and the cart's own button classes. */

/* No container of its own — see the note on .cart-page__breadcrumb. This one
   also capped at 1200px, so checkout was narrower than the site at every width,
   not only on a phone. */

.checkout__breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.checkout__breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.checkout__breadcrumb a:hover {
    color: var(--ink);
}

.checkout__breadcrumb svg {
    width: 0.75rem;
    height: 0.75rem;
}

.checkout__breadcrumb span {
    color: var(--ink);
    font-weight: 500;
}

.checkout__title {
    margin: 0 0 2rem;
    font-family: var(--font-display, inherit);
    font-weight: 400;
    font-size: clamp(1.5rem, 4vw, 1.875rem);
    color: var(--ink);
}

.checkout__errors {
    margin: 0 0 1.5rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent-dark);
    font-size: 0.875rem;
    font-weight: 500;
}

.checkout__grid {
    display: grid;
    gap: 2rem;
    align-items: start;
}

/* Without this the summary's product name — nowrap, meant to be cut with an
   ellipsis — measured at its full length instead, and a grid item's automatic
   minimum is exactly that measurement: the column came out 461px wide inside a
   339px page. Truncation only starts working once the item may shrink. */
.checkout__grid > * {
    min-width: 0;
}

@media (min-width: 1024px) {
    .checkout__grid {
        grid-template-columns: 1fr 360px;
    }
}

.checkout__main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.checkout__aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .checkout__aside {
        position: sticky;
        top: 5rem;
    }
}

.checkout__submit svg {
    width: 1rem;
    height: 1rem;
}

.checkout__terms {
    margin: 0;
    padding: 0 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
}

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

.checkout-card {
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
}

.checkout-card__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
    font-family: var(--font-display, inherit);
    font-size: 1rem;
    font-weight: 400;
    color: var(--ink);
}

.checkout-card__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 400;
}

/* ── Fields ─────────────────────────────────────────────────── */

.checkout-fields {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .checkout-fields {
        grid-template-columns: 1fr 1fr;
    }
}

.checkout-field--wide {
    grid-column: 1 / -1;
}

.checkout-field__label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.checkout-field__input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.checkout-field__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.checkout-field__input--area {
    resize: vertical;
}

.checkout-field.has-error .checkout-field__input {
    border-color: var(--accent);
}

.checkout-field__error,
.checkout-field__hint {
    margin: 0.375rem 0 0;
    font-size: 0.75rem;
}

.checkout-field__error {
    color: var(--accent);
}

.checkout-field__hint {
    color: var(--muted);
}

/* ── Radio option cards ─────────────────────────────────────── */

.checkout-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.checkout-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border: 2px solid var(--line);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: border-color 0.15s;
}

.checkout-option:hover {
    border-color: color-mix(in srgb, var(--ink) 30%, transparent);
}

.checkout-option.is-selected {
    border-color: var(--ink);
    background: var(--paper);
}

.checkout-option__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.checkout-option__icon {
    font-size: 1.25rem;
    line-height: 1;
}

.checkout-option__body {
    flex: 1;
    min-width: 0;
}

.checkout-option__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.checkout-option__sub {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}

.checkout-option__mark {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--line);
    border-radius: 50%;
}

.checkout-option.is-selected .checkout-option__mark {
    border-color: var(--ink);
    background:
        radial-gradient(circle, var(--ink) 0 0.25rem, transparent 0.25rem);
}

.checkout-pickup {
    margin: 0;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    font-size: 0.875rem;
    color: var(--ink);
}

/* ── City autocomplete ──────────────────────────────────────── */

.checkout-field--autocomplete {
    position: relative;
}

.checkout-suggest {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    max-height: 15rem;
    margin: 0.25rem 0 0;
    padding: 0.25rem;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.checkout-suggest__item {
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-md, 0.5rem);
    font-size: 0.875rem;
    color: var(--ink);
    cursor: pointer;
}

.checkout-suggest__item:hover {
    background: var(--surface-2);
}

/* ── Order summary ──────────────────────────────────────────── */

.checkout-summary__lines {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkout-summary__line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkout-summary__media {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--paper);
    font-size: 1.5rem;
}

.checkout-summary__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.checkout-summary__body {
    flex: 1;
    min-width: 0;
}

.checkout-summary__name {
    margin: 0;
    overflow: hidden;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkout-summary__meta {
    margin: 0;
    font-size: 0.625rem;
    color: var(--muted);
}

.checkout-summary__price {
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.checkout-summary__rows {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.checkout-summary__row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--muted);
}

.checkout-summary__row > span:last-child {
    color: var(--ink);
}

.checkout-summary__free {
    color: #059669;
    font-weight: 500;
}

.checkout-summary__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
    font-weight: 600;
    color: var(--ink);
}

.checkout-summary__total strong {
    font-family: var(--font-display, inherit);
    font-weight: 400;
    font-size: 1.25rem;
}

/* ── Success ────────────────────────────────────────────────── */

.checkout-success {
    max-width: 36rem;
    margin: 0 auto;
    padding: 5rem 1rem;
    text-align: center;
}

.checkout-success__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: #d1fae5;
    color: #059669;
}

.checkout-success__mark svg {
    width: 2rem;
    height: 2rem;
}

.checkout-success__title {
    margin: 0 0 0.75rem;
    font-family: var(--font-display, inherit);
    font-weight: 400;
    font-size: 1.5rem;
    color: var(--ink);
}

.checkout-success__text {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--muted);
}

.checkout-success__number {
    margin: 1rem 0 1.5rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.checkout-success__number strong {
    font-size: 1.125rem;
    color: var(--ink);
}

.checkout-success__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2rem;
}
