/* Design tokens. The palette is taken from the old banner: electric blue, pale sky bars and the grey of the logo. */
@font-face {
    font-family: "Bricolage Grotesque";
    src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
    font-weight: 200 800;
    font-display: swap;
}

@font-face {
    font-family: "Public Sans";
    src: url("fonts/public-sans-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --blue: #0a47e8;
    --blue-dark: #0733b0;
    --sky: #cfe5fa;
    --sky-deep: #a9cff5;
    --haze: #eef6fe;
    --ink: #0b1f4b;
    --on-ink: #c8d8f4;
    --steel: #566072;
    --line: #c9d2de;
    --field: #8593a8;
    --paper: #fff;
    --ok: #15803d;
    --ok-tint: #e7f6ec;
    --warn: #b45309;
    --bad: #b91c1c;
    --bad-tint: #fdecec;
    --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
    --font-body: "Public Sans", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
}

.site-main {
    flex: 1;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
}

h1 {
    margin: 0.25rem 0 1rem;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    letter-spacing: -0.01em;
}

h1:focus {
    outline: none;
}

a {
    color: var(--blue);
}

small {
    font-size: 0.85rem;
}

address {
    font-style: normal;
}

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

/* Page structure */
.wrap {
    width: 100%;
    max-width: 76rem;
    margin-inline: auto;
    padding-inline: 1.25rem;
}

.medium {
    max-width: 56rem;
}

.narrow {
    max-width: 30rem;
}

.page-pad {
    padding-block: 3rem;
}

.with-aside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 2.5rem;
    align-items: start;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 0 1.5rem;
}

.prose {
    max-width: 44rem;
}

.prose h2 {
    margin: 1.5rem 0 0.4rem;
    font-size: 1.3rem;
}

.plain {
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
}

.pre {
    white-space: pre-wrap;
}

.note-right {
    margin: 0.5rem 0;
    text-align: right;
    color: var(--steel);
    font-size: 0.9rem;
}

.big-number {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blue);
}

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

.trap {
    position: absolute;
    left: -9999px;
}

/* Forms */
input:not([type="radio"], [type="checkbox"], [type="hidden"]),
select,
textarea {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--field);
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}

input:not([type="radio"], [type="checkbox"], [type="hidden"]):hover,
select:hover,
textarea:hover {
    border-color: var(--ink);
}

input:not([type="radio"], [type="checkbox"], [type="hidden"]):focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    outline: 2px solid var(--blue);
    outline-offset: 0;
}

textarea {
    display: block;
    resize: vertical;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
}

input[type="radio"],
input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0.15rem 0 0;
    accent-color: var(--blue);
    flex: none;
}

.field {
    margin-bottom: 0.8rem;
}

.field label {
    display: block;
}

.field-label,
.group legend {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.group {
    margin-bottom: 0.9rem;
}

.field-hint {
    display: block;
    margin-top: 0.15rem;
    color: var(--steel);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.span-2 {
    grid-column: 1 / -1;
}

.narrow-form {
    max-width: 26rem;
}

.validation-message {
    margin-top: 0.15rem;
    color: var(--bad);
    font-size: 0.9rem;
}

.invalid {
    border-color: var(--bad) !important;
}

/* Blue and sky mean "chosen" on the checkout pages, and nothing else. */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    border: 1px solid var(--field);
    border-radius: 4px;
    background: var(--paper);
}

.segmented label {
    position: relative;
    padding: 0.5rem 1rem;
    border-left: 1px solid var(--field);
    font-weight: 600;
    cursor: pointer;
}

.segmented label:first-of-type {
    border-left: 0;
    border-radius: 3px 0 0 3px;
}

.segmented label:last-of-type {
    border-radius: 0 3px 3px 0;
}

.segmented label:hover {
    background: var(--haze);
}

.segmented label:has(input:checked) {
    background: var(--blue);
    color: var(--paper);
}

.segmented label:has(input:focus-visible) {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.segmented input {
    position: absolute;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 0.6rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper);
    cursor: pointer;
}

.choice:hover {
    border-color: var(--field);
}

.choice:has(input:checked) {
    border-color: var(--blue);
    background: var(--haze);
    box-shadow: inset 0 0 0 1px var(--blue);
}

.choice:has(input:focus-visible) {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.choice input:focus-visible {
    outline: none;
}

.choice > span {
    flex: 1;
    min-width: 0;
}

.choice-small {
    padding: 0.55rem 0.8rem;
    font-size: 0.95rem;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.choice-grid .choice {
    margin-bottom: 0;
}

.choice-price {
    font-family: var(--font-display);
    font-size: 1.15rem;
    white-space: nowrap;
}

.more {
    margin-top: 0.25rem;
}

.more summary {
    width: fit-content;
    color: var(--blue);
    font-weight: 600;
    cursor: pointer;
}

.more[open] summary {
    margin-bottom: 0.6rem;
}

.step-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.login-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.75rem 0 0;
    font-size: 0.95rem;
}

/* Fields that follow a radio choice. CSS does this, as static SSR has no client code. */
.reveal-alt,
.reveal-shops,
.reveal-driver,
.reveal-leave,
.reveal-own-message {
    display: none;
}

form:has(input[value="Business"]:checked) .reveal-alt,
form:has(input[value="Private"]:checked) .reveal-alt {
    display: block;
}

form:has(input[value="Private"]:checked) .reveal-company,
form:has(.fulfilment input[value="True"]:checked) .delivery-choice {
    display: none;
}

form:has(input[value="GLS"]:checked) .reveal-shops,
form:has(input.allows-driver-message:checked) .reveal-driver,
form:has(input.leave-yes:checked) .reveal-leave,
form:has(option.own-message:checked) .reveal-own-message {
    display: block;
}

/* The order slip on the shipping step follows the checked shipping choice. */
.checkout-frame:has(.ship-options input:checked) .sum .ship-estimate {
    display: none;
}

/* Matched by position, as CSS cannot compare a radio's value with a row. Covers up to 8 choices. */
.checkout-frame:has(.ship-options input.ship-0:checked) .sum .ship-choice.ship-0,
.checkout-frame:has(.ship-options input.ship-1:checked) .sum .ship-choice.ship-1,
.checkout-frame:has(.ship-options input.ship-2:checked) .sum .ship-choice.ship-2,
.checkout-frame:has(.ship-options input.ship-3:checked) .sum .ship-choice.ship-3,
.checkout-frame:has(.ship-options input.ship-4:checked) .sum .ship-choice.ship-4,
.checkout-frame:has(.ship-options input.ship-5:checked) .sum .ship-choice.ship-5,
.checkout-frame:has(.ship-options input.ship-6:checked) .sum .ship-choice.ship-6,
.checkout-frame:has(.ship-options input.ship-7:checked) .sum .ship-choice.ship-7 {
    display: flex;
}

.reveal-alt,
.reveal-shops,
.reveal-driver {
    margin-bottom: 0.9rem;
    padding: 0.9rem 1rem 0.4rem;
    border-left: 3px solid var(--blue);
    background: var(--haze);
}

.reveal-alt .field-hint {
    margin-bottom: 0.6rem;
}

.reveal-driver .field {
    margin-bottom: 0.5rem;
}

@media (prefers-reduced-motion: no-preference) {
    .reveal-alt,
    .reveal-shops,
    .reveal-driver {
        animation: reveal 160ms ease-out;
    }

    .choice,
    .segmented label {
        transition: background-color 120ms, border-color 120ms;
    }
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.reveal-shops h3 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
}

.shop-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.75rem 0 0.6rem;
}

.shop-search input {
    flex: 1 1 8rem;
    width: auto;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--blue);
    border-radius: 3px;
    background: var(--paper);
    color: var(--blue);
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--haze);
}

.btn-primary {
    background: var(--blue);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--blue-dark);
}

.btn-wide {
    width: 100%;
}

.btn-big {
    min-height: 3.25rem;
    padding: 0.7rem 1.6rem;
    font-size: 1.1rem;
}

.btn-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--blue);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Tables and lists */
.product-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list-note {
    color: var(--steel);
    font-size: 0.9rem;
}

.table-scroll {
    position: relative;
    overflow-x: auto;
}

.lines {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.lines th {
    padding: 0.4rem 0.6rem;
    background: var(--sky);
    text-align: left;
}

.lines td {
    padding: 0.55rem 0.6rem;
    border-bottom: 2px dotted var(--sky-deep);
    vertical-align: top;
}

.lines .num {
    text-align: right;
    white-space: nowrap;
}

/* Admin dealer list */
.dealer-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin: 1.25rem 0 1rem;
}

.status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.status-filter a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.4rem;
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--sky-deep);
    border-radius: 999px;
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

.status-filter a:hover {
    background: var(--haze);
}

.status-filter a.active {
    border-color: var(--blue);
    background: var(--blue);
    color: var(--paper);
}

.status-filter .count {
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.dealer-search {
    display: flex;
    flex: 1 1 22rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    max-width: 34rem;
}

.dealer-search input {
    flex: 1 1 14rem;
    width: auto;
}

/* Long e-mail addresses wrap instead of pushing the button out of view. */
.dealers .contact {
    overflow-wrap: anywhere;
}

.dealers .action {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.dealers .action form {
    margin: 0;
}

@media (max-width: 760px) {
    .with-aside {
        grid-template-columns: minmax(0, 1fr);
    }

    .two-col {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid,
    .choice-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .step-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        text-align: center;
    }
}

/* Phones: everything you tap is at least 44 px high. */
@media (max-width: 860px) {
    .login-links a,
    .step-actions > a,
    .more summary,
    .btn-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .step-actions > a {
        justify-content: center;
    }

    .login-links {
        margin-top: 0.25rem;
    }

    .btn {
        min-height: 44px;
    }
}

/* Tables that would be cramped become a list of entries. */
@media (max-width: 560px) {
    .compact-lines .col-minor {
        display: none;
    }

    .stack-table,
    .stack-table tbody,
    .stack-table tr,
    .stack-table td {
        display: block;
        width: 100%;
    }

    .stack-table thead {
        display: none;
    }

    .stack-table tr {
        padding-block: 0.5rem;
        border-bottom: 2px dotted var(--sky-deep);
    }

    .stack-table td {
        padding: 0.1rem 0;
        border: 0;
    }

    .stack-table td:first-child {
        font-weight: 700;
    }

    .stack-table td:first-child a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        font-family: var(--font-display);
        font-size: 1.15rem;
    }

    .stack-table td .btn {
        margin-top: 0.35rem;
    }
}
