:root {
    --color-text: #1d1d1f;
    --color-bg: #ffffff;
    /* Corporate blue: the blue at the centre of the logo. Other shades are derived from it. */
    --color-brand: #0c599a;
    --color-brand-dark: #0a477b;      /* hover/pressed (80%) */
    --logo-shadow: drop-shadow(2px 3px 1.2px rgb(0 0 0 / 0.2));   /* grey shadow under the logo bike */
    --color-nav: #555b66;
    --color-nav-arrow: #b4b9c2;
    --color-panel: #eef3f8;           /* corporate blue at 7% on white */
    --color-rule: #d3e1ed;            /* corporate blue at 18% on white */
    --color-footer: #e9ecf1;
    --color-footer-text: #4a4f58;
    --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Oswald", "Arial Narrow", sans-serif;
}

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

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.0625rem;      /* 17px: Barlow is a little narrow, so slightly larger reads better */
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

/* Titles and subtitles use the display font */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Header: logo on the left, two-row menu on the right */

.site-header {
    border-bottom: 1px solid var(--color-rule);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Logo: bike and wordmark, both vector artwork from the original logo EPS */
.site-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.site-logo__bike {
    display: block;
    flex-shrink: 0;
    /* Grey shadow down and to the right, as on the original logo */
    filter: var(--logo-shadow);
}

/* Wordmark: the original lettering, as outlines from the logo EPS */
.site-logo__wordmark {
    display: block;
}

/* Navigation */

/* If the menu won't fit beside the logo it wraps underneath; keep it on the right */
.site-nav {
    margin-left: auto;
}

.site-nav__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    display: block;
    padding: 0.3rem 0;
    color: var(--color-nav);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.15s;
}

/* Up-right arrow before each item, as on the old site (\FE0E keeps it from rendering as an emoji) */
.site-nav a::before {
    content: "\2197\FE0E";
    display: inline-block;
    margin-right: 0.25em;
    color: var(--color-nav-arrow);
    font-family: system-ui, sans-serif;
    font-size: 1.2em;
    font-weight: 900;
    line-height: 1;
    transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.is-active {
    color: var(--color-brand);
}

.site-nav a:hover::before,
.site-nav a:focus-visible::before,
.site-nav a.is-active::before {
    color: var(--color-brand);
}

.site-nav a.is-active {
    box-shadow: inset 0 -2px var(--color-brand);
}

.nav-toggle {
    display: none;
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-brand);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* Mid-size screens: slightly smaller menu so it still fits beside the logo */

@media (min-width: 768px) and (max-width: 1199px) {
    .site-nav__row {
        gap: 0 0.8rem;
    }

    .site-nav a {
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) and (max-width: 1099px) {
    .site-nav__row {
        gap: 0 0.6rem;
    }

    .site-nav a {
        font-size: 0.85rem;
    }
}

/* Small screens: collapse the menu behind the toggle button */

@media (max-width: 767px) {
    .nav-toggle {
        display: block;
    }

    .site-nav {
        display: none;
        flex-basis: 100%;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-nav__row {
        flex-direction: column;
    }

    .site-nav a {
        padding: 0.65rem 0;
        border-top: 1px solid var(--color-rule);
    }

    .site-nav a.is-active {
        box-shadow: none;
    }
}

/* Main content grows so the footer sits at the bottom of short pages */

main.container {
    flex: 1 0 auto;
    width: 100%;
}

/* Footer */

.site-footer {
    margin-top: 2rem;
    background: var(--color-footer);
    color: var(--color-footer-text);
    font-size: 0.9rem;
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 2rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: inherit;
    text-decoration-color: rgb(0 0 0 / 0.25);
    text-underline-offset: 2px;
}

.site-footer a:hover {
    color: var(--color-brand);
    text-decoration-color: currentColor;
}

.site-footer__name {
    font-weight: 600;
}

.site-footer__sep {
    margin: 0 0.4rem;
    opacity: 0.4;
}

/* Page title and strapline */

.page-title {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-brand);
}

.page-title h1 {
    margin: 0;
    font-size: 2.5rem;
    color: var(--color-brand);
}

.strapline {
    margin: 0.25rem 0 0;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Page layout: sidebar on the left (as on the old site), stacked under the body on small screens */

.page--with-sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .page--with-sidebar {
        grid-template-columns: 280px 1fr;
        gap: 3rem;
    }

    .page--with-sidebar .page__sidebar {
        grid-column: 1;
        grid-row: 1;
    }

    .page--with-sidebar .page__body {
        grid-column: 2;
    }
}

.page__sidebar {
    font-size: 0.95rem;
    padding: 1.25rem;
    background: var(--color-panel);
    border-radius: 4px;
    align-self: start;
}

/* Markdown content */

.prose > :first-child {
    margin-top: 0;
}

.prose > :last-child {
    margin-bottom: 0;
}

.prose h2 {
    font-size: 1.5rem;
    color: var(--color-brand);
}

.prose h3 {
    font-size: 1.15rem;
}

.prose ul {
    padding-left: 1.25rem;
}

/* Bike listings */

.bikes {
    margin-top: 2rem;
}

.bike {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.25rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--color-rule);
}

.bike__photos {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.bike__photos a {
    display: block;
    border-radius: 3px;
    overflow: hidden;
    line-height: 0;
}

.bike__photos img {
    display: block;
    transition: opacity 0.15s;
}

.bike__photos a:hover img,
.bike__photos a:focus-visible img {
    opacity: 0.85;
}

/* Stand-in for a missing photo: thumbnail-sized, faint logo bike, short note */
.photo-placeholder {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 160px;
    height: 120px;
    padding-bottom: 0.55rem;
    border-radius: 3px;
    background: var(--color-panel);
    overflow: hidden;
}

.photo-placeholder::before {
    content: "";
    position: absolute;
    inset: 14px 30px 30px;
    background: url("/img/logo-bike.svg") center / contain no-repeat;
    filter: grayscale(1);
    opacity: 0.18;
}

.photo-placeholder span {
    position: relative;
    color: #8a93a3;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bike__details {
    flex: 1 1 240px;
}

.prose .bike__title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    text-transform: none;
}

.bike__details p {
    margin: 0;
    font-size: 0.9rem;      /* 15px: smaller than page text, so titles lead when scanning a list */
    line-height: 1.5;
}

/* Lightbox */

body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgb(0 0 0 / 0.88);
}

.lightbox[hidden] {
    display: none;
}

.lightbox__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 3.5rem 4.5rem;
}

.lightbox__figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 10rem);
    background: #222;
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.5);
    transition: opacity 0.15s;
}

.lightbox.is-loading .lightbox__img {
    opacity: 0.4;
}

.lightbox__caption {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    width: 100%;
    margin-top: 0.75rem;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.1rem;
}

.lightbox__count {
    flex-shrink: 0;
    opacity: 0.7;
}

.lightbox__close,
.lightbox__nav {
    position: absolute;
    border: 0;
    background: rgb(255 255 255 / 0.12);
    color: #fff;
    font: 300 2.5rem/1 var(--font-display);
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox__close:hover,
.lightbox__nav:hover,
.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
    background: rgb(255 255 255 / 0.28);
}

.lightbox__close {
    top: 0.75rem;
    right: 0.75rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    font-size: 2rem;
}

.lightbox__nav {
    top: 50%;
    width: 3rem;
    height: 4.5rem;
    margin-top: -2.25rem;
    border-radius: 4px;
    display: none;
}

.lightbox.has-nav .lightbox__nav {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chevrons drawn with borders so they sit exactly in the middle of the button */
.lightbox__nav::before {
    content: "";
    width: 0.85rem;
    height: 0.85rem;
    border-top: 3px solid currentColor;
    border-right: 3px solid currentColor;
}

.lightbox__nav--prev::before {
    margin-left: 0.5rem;           /* only two sides are drawn, so shift the box to centre the visible chevron */
    transform: rotate(-135deg);
}

.lightbox__nav--next::before {
    margin-right: 0.5rem;
    transform: rotate(45deg);
}

.lightbox__nav--prev {
    left: 0.75rem;
}

.lightbox__nav--next {
    right: 0.75rem;
}

@media (max-width: 600px) {
    .lightbox__inner {
        padding: 3.5rem 0.5rem 5.5rem;
    }

    .lightbox__nav {
        top: auto;
        bottom: 0.75rem;
        margin-top: 0;
        height: 3.5rem;
    }
}

/* Racing parts: logo links for each make */

.makes {
    margin: 1.5rem 0;
}

.makes__list,
.prose .makes__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.makes__link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 4.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-rule);
    border-radius: 4px;
    background: var(--color-bg);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.makes__link:hover,
.makes__link:focus-visible {
    border-color: var(--color-brand);
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
}

.makes__link.is-active {
    border-color: var(--color-brand);
    box-shadow: inset 0 0 0 1px var(--color-brand);
}

.makes__logo {
    display: block;
    width: auto;
    height: 1.6rem;             /* same height for every logo; their own width/height attributes vary */
    max-width: 100%;
    min-width: 0;
    object-fit: contain;
}

.makes__text {
    color: var(--color-brand);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Captioned photos in the left-hand column (About, Tribute) */

.page-photos {
    display: grid;
    gap: 1.25rem;
}

.page__sidebar > :not(.page-photos) + .page-photos {
    margin-top: 1.25rem;
}

.page-photo {
    margin: 0;
}

.page-photo a {
    display: block;
    border-radius: 3px;
    overflow: hidden;
    line-height: 0;
}

.page-photo img {
    display: block;
    width: 100%;
    height: auto;
    transition: opacity 0.15s;
}

.page-photo a:hover img,
.page-photo a:focus-visible img {
    opacity: 0.85;
}

.page-photo figcaption {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--color-footer-text);
}

/* Cookie consent banner: Accept and Reject are deliberately the same style (equal prominence) */

.cookie-banner {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 900;
    max-width: 46rem;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--color-rule);
    border-top: 4px solid var(--color-brand);
    border-radius: 6px;
    box-shadow: 0 10px 32px rgb(0 0 0 / 0.18);
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
}

.cookie-banner__text {
    flex: 1 1 22rem;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cookie-banner__text strong {
    display: block;
    margin-bottom: 0.15rem;
    color: var(--color-brand);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.cookie-banner__buttons {
    display: flex;
    gap: 0.6rem;
    flex: 0 0 auto;
}

.cookie-button {
    min-width: 6.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 1.1rem;
    border: 2px solid var(--color-brand);
    border-radius: 4px;
    background: var(--color-brand);
    color: #fff;
    font: inherit;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
}

.cookie-button:hover,
.cookie-button:focus-visible {
    background: var(--color-brand-dark);
    border-color: var(--color-brand-dark);
}

.cookie-button:focus-visible {
    outline: 3px solid #f2b300;
    outline-offset: 2px;
}

@media (max-width: 520px) {
    .cookie-banner {
        right: 0.5rem;
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.9rem 1rem;
    }

    .cookie-banner__buttons {
        width: 100%;
    }

    .cookie-button {
        flex: 1;
    }
}

[data-cookie-settings][hidden] {
    display: none;
}

/* Narrow phones: scale the logo so the Menu button still fits beside it */
@media (max-width: 480px) {
    .site-logo__bike {
        width: 72px;
        height: auto;
    }

    .site-logo__wordmark {
        width: 139px;
        height: auto;
    }

    .site-header__inner {
        flex-wrap: nowrap;
        gap: 0.75rem;
    }

    .site-nav.is-open {
        position: absolute;
        right: 0;
        left: 0;
        top: 100%;
        z-index: 20;
        padding: 0 1rem 0.5rem;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-rule);
    }

    .site-header {
        position: relative;
    }
}
