/* Site styles on top of site.css. site.css comes from the design as is: keep it in sync with the design, don't edit it. */

/* Fonts are self-hosted (no requests to Google Fonts), latin subset only: the site is English. */
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('../fonts/onest-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url('../fonts/onest-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url('../fonts/onest-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src: url('../fonts/onest-latin-700-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

/*
 * Header stays on top while the page scrolls. Anchor jumps ("#contact") stop below it, not under it,
 * and scroll smoothly unless the visitor asked the system for less motion.
 */
.hdr {
    position: sticky;
    top: 0;
}
html {
    scroll-padding-top: 77px; /* .hdr-bar min-height + border */
}
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}
/* Open mobile menu is taller than a small screen: it scrolls inside, the header stays */
.mnav {
    max-height: calc(100dvh - 77px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Email and phone on the dark contact card: the default link colour (mint-deep) is barely visible on night */
.site .dlist a {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: var(--night-3);
    text-underline-offset: 4px;
}
.site .dlist a:hover {
    color: var(--mint);
    text-decoration-color: currentColor;
}

/*
 * Two fields in a row: a label wrapping to two lines pushed its input below the neighbour's.
 * The fields share the row's tracks (label, input, error), so inputs line up whatever the label length.
 */
@container (min-width: 760px) {
    .fgrid-2 {
        grid-template-rows: auto auto auto;
        row-gap: 0;
    }
    .fgrid-2 > .field {
        grid-row: span 3;
        grid-template-rows: subgrid;
        row-gap: 0; /* .field's 8px gap would add up with the margins below */
    }
    .fgrid-2 > .field > .label {
        align-self: end;
        margin-bottom: 8px;
    }
    .fgrid-2 > .field > .ferr {
        margin-top: 8px;
    }
}

/* The design's big footer wordmark is left out; its margin kept the bottom row apart from the links above */
.ftr .ftr-bottom {
    margin-top: 48px;
}
@container (max-width: 759px) {
    .ftr .ftr-bottom {
        margin-top: 36px;
    }
}

/* Legal pages menu: the design styles it as buttons switching the text, on the site these are links to the pages */
.site .lnav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--line);
    background: var(--surface);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.site .lnav a:hover {
    border-color: var(--ink);
    color: var(--ink);
}
.site .lnav a[aria-current="page"] {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

/* Legal page tag: .prose is a flex column, without this the tag stretches to the full width */
.prose > .tag {
    align-self: flex-start;
}

/*
 * Enquiry form chips are labels with a hidden checkbox or radio (the design toggles .is-on with JS):
 * the checked state comes from the input itself, so the form also works without JS.
 */
label.chip:has(input:checked) {
    background: var(--mint);
    border-color: var(--mint);
    color: var(--ink);
    font-weight: 600;
}
label.chip .ico {
    display: none;
}
label.chip:has(input:checked) .ico {
    display: inline-block;
}
.fset.has-error label.chip:has(input:checked) {
    border-color: var(--mint);
}

/* Phone number: only when "Phone" is the preferred contact method */
.form .phone-field {
    display: none;
}
.form:has(input[name="contact_method"][value="phone"]:checked) .phone-field {
    display: grid;
}

/* Alpine: hide toggled blocks until Alpine has started */
[x-cloak] {
    display: none !important;
}
