/*
 * Shared base for every page.
 *
 * These rules used to be copied into index.html, mashups.php and name.php, so a
 * change meant three edits — and they had already drifted. Anything that really
 * does differ per page (body padding, h1 size, that page's layout) stays in that
 * page's own <style>, which loads after this file and wins on equal specificity.
 *
 * Loaded as /styles.css?v=YYYYMMDD. hcdn caches static files for a week, so bump
 * the query string whenever this file changes, exactly like themes.js.
 */

:root {
    --primary: #00ffcc;
    --secondary: #111;
    --accent: #00ddb0;
    --card-bg: #222;
    --gradient: linear-gradient(135deg, #111, #1e1e1e);
}

body {
    font-family: Arial, sans-serif;
    background: var(--gradient);
    /* The gradient used to end at the body box and then start again below it,
       which showed as a horizontal band across the foot of the driver and
       permalink pages. flow-root keeps the page's trailing margin inside the
       body (it used to collapse through it, ending the box ~60px early) and
       min-height fills the viewport on a short page, so the box the gradient
       paints into is now always at least as tall as the page. */
    box-sizing: border-box;
    color: white;
    display: flow-root;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Two parent portraits side by side: the generator cards and the browse cards. */
.mashup-image-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.mashup-parent-image {
    flex: 1 1 0;
    /* A flex item refuses to shrink below its content's min-content width by
       default, which made the portrait carrying a photo wider than the one
       showing a stand-in and pushed the pair past the card edge. */
    min-width: 0;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #111;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: bold;
}

/* Both the headshot and the stand-in fill their half exactly. */
.mashup-parent-image > img,
.mashup-parent-image > .driver-placeholder {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.mashup-parents {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 5px;
}

.mashup-count {
    color: var(--primary);
    font-weight: bold;
}

/* Deceased drivers: the portrait is desaturated wherever a parent portrait
   appears — generator, browse cards, permalink — so all three use one marker. */
.mashup-parent-image.is-deceased,
.driver-image-placeholder.is-deceased,
.parent-driver-image.is-deceased {
    filter: grayscale(1) brightness(0.75);
}

/* Credit lines for headshots that came from Wikimedia Commons. CC BY and
   CC BY-SA require them next to the photo. */
.mashup-credits {
    color: #777;
    font-size: 0.68rem;
    margin: -2px 0 8px;
}

.mashup-credits:empty,
.driver-credit:empty {
    display: none;
}

.driver-credit a,
.mashup-credits a,
.parent-driver-credit a {
    color: var(--primary);
    text-decoration: none;
}

.share-link:hover,
.share-btn:hover {
    background: rgba(0, 255, 204, 0.14);
}

.empty-message {
    color: #aaa;
    font-style: italic;
}

/* ------------------------------------------------------------------ header */

/* Full-bleed bar above the page's own padding: each page declares --page-pad-*,
   so the logo sits at the true top edge instead of inside the content gutter. */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 14px;
    /* The bar bleeds by the page padding but pads to its own constant, so the
       logo starts at the same x on every page instead of inheriting each
       page's 30px or 40px gutter. */
    margin: calc(-1 * var(--page-pad-block, 0px)) calc(-1 * var(--page-pad-inline, 0px)) 26px;
    padding: 8px var(--header-inset, 30px);
    --header-inset: clamp(16px, 2.4vw, 30px);
    /* The logo artwork sits on its own charcoal plate (#25272c), so the bar uses
       that colour: the plate then blends instead of showing as a rectangle, and
       it stays put while the team themes recolour the page behind it. */
    background: #25272c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    text-decoration: none;
}

/* branding/logo.png is the lockup cropped to the MixTheGrid wordmark (aspect
   ~4.67:1), so the bar shows a readable mark rather than the whole car-and-text
   artwork shrunk to illegibility. */
.brand-logo {
    display: block;
    height: clamp(32px, 3.8vw, 52px);
    width: auto;
    max-width: 62vw;
    object-fit: contain;
}

/* Text stand-in until branding/logo.png exists, and the fallback if that image
   fails to load, so the bar is never a broken-image icon. */
.brand-wordmark {
    color: #fff;
    font-size: clamp(1.05rem, 4.2vw, 1.45rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.brand-wordmark em {
    color: #ff2b3d;
    font-style: italic;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2.8vw, 24px);
    /* Pushed right, and stays right if the bar wraps on a narrow screen. */
    margin-left: auto;
}

.site-nav-link {
    padding: 5px 0;
    border-bottom: 2px solid transparent;
    color: #e6e7e9;
    font-size: clamp(0.85rem, 3.2vw, 0.98rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

.site-nav-link:hover {
    border-bottom-color: rgba(0, 255, 204, 0.55);
    color: #fff;
}

.site-nav-link[aria-current="page"] {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

/* Three items (Mashups, Drivers, Theme) plus a wordmark is tight below ~420px. */
@media (max-width: 420px) {
    .site-nav-link {
        font-size: 0.76rem;
        letter-spacing: 0.015em;
    }
}
