/* Generation page (VEH-248): templates/pages/generation.ejs and the gen-* partials.
   Colours come from main.css tokens; the brand accent from data-brand. */

.gp-container {
    /* 1400px like the header (testing feedback 03.11) */
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gp-phone-only {
    display: none;
}

.gp-section {
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--color-border);
}

.gp-section--white { background: var(--color-bg); }
.gp-section--grey { background: var(--color-surface); }

.gp-h3 {
    margin: 0;
    font-size: var(--font-size-xl);
    line-height: 1.2;
    font-weight: 700;
    color: var(--accent);
}

.gp-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.gp-head-link,
.gp-section-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.gp-head-link:hover,
.gp-section-link:hover { color: var(--accent-dark); }

.gp-eyebrow {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.gp-eyebrow--accent { color: var(--accent); }

.gp-fine {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.gp-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.gp-version-title,
.gp-strip-code,
.gp-neighbour-name,
.gp-dialog-title {
    font-family: 'Roboto Flex', var(--font-primary);
    font-weight: 700;
    font-variation-settings: 'wght' 700, 'wdth' 84;
    letter-spacing: -0.005em;
}

/* No-photo stand-in: the brand gradient with the generation's name */
.gp-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #FFFFFF;
    font-family: 'Roboto Flex', var(--font-primary);
    font-weight: 700;
    font-variation-settings: 'wght' 700, 'wdth' 84;
    text-align: center;
    overflow-wrap: anywhere;
}

/* ---------- 1. Hero ---------- */

.gp-hero {
    padding: var(--spacing-lg) 0;
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 100%);
    border-bottom: 1px solid var(--color-border);
}

.gp-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 520px;
    /* The typical car above the share tiles (testing feedback 07.11) */
    grid-template-areas:
        "head media"
        "typical media"
        "tiles media";
    grid-template-rows: auto auto 1fr;
    column-gap: 48px;
    row-gap: var(--spacing-sm);
    align-items: start;
}

.gp-hero-head { grid-area: head; display: flex; flex-direction: column; gap: var(--spacing-sm); }
.gp-hero-media { grid-area: media; align-self: center; }
.gp-tiles { grid-area: tiles; }
.gp-typical-link { grid-area: typical; }

.gp-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size-sm);
}

.gp-crumbs li + li::before {
    content: '›';
    margin-right: 6px;
    opacity: 0.5;
}

.gp-crumbs a { color: var(--text-primary); text-decoration: none; }
.gp-crumbs a:hover { color: var(--accent); }
.gp-crumbs [aria-current] { font-weight: 600; }

.gp-hero-title {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.gp-hero-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 4px;
}

.gp-hero-text { display: flex; flex-direction: column; gap: 10px; }

.gp-hero-text h1 {
    margin: 0;
    font-size: 40px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.gp-hero-sub {
    margin: 0;
    font-size: var(--font-size-lg);
    line-height: 1.5;
    color: var(--text-secondary);
}

.gp-gallery { max-width: 520px; }

.gp-placeholder--hero {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-lg);
    font-size: 32px;
    box-shadow: var(--shadow-lg);
}

.gp-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.gp-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}

.gp-tile-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.gp-flag-rs {
    width: 15px;
    height: 10px;
    margin-right: 2px;
    vertical-align: -1px;
    border-radius: 1px;
    box-shadow: 0 0 0 1px var(--color-border);
}
.gp-flag-rs-red { fill: var(--flag-rs-red); }
.gp-flag-rs-blue { fill: var(--flag-rs-blue); }
.gp-flag-rs-white { fill: var(--flag-rs-white); }

.gp-tile-value {
    /* labels wrap differently (a "?" may take a second line): the values share the bottom line */
    margin-top: auto;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.gp-typical-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 20px;
    padding: 14px 18px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    color: var(--text-primary);
    text-decoration: none;
}

.gp-typical-main { display: flex; flex-direction: column; gap: 2px; }

.gp-typical-price {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--accent-dark);
    white-space: nowrap;
}

.gp-typical-car {
    grid-column: 1 / -1;
    font-size: var(--font-size-sm);
    line-height: 1.45;
    color: var(--text-secondary);
}

.gp-typical-more {
    grid-row: 1;
    grid-column: 2;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

/* ---------- 2. Generation strip ---------- */

.gp-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    padding-bottom: 4px;
}

.gp-strip-card {
    /* 8 generations (BMW 5 Series) fit the desktop row at 120px; fewer share the whole row
       (testing feedback 02.11: four E-Class cards at 136px left half the row empty) */
    flex: 1 0 120px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    color: var(--text-primary);
    text-decoration: none;
    scroll-snap-align: start;
}

a.gp-strip-card:hover { border-color: var(--accent-light); }

.gp-strip-card--self {
    border: 2px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, var(--color-bg));
}

.gp-strip-card--current { border: 2px dashed var(--accent-light); }

.gp-strip-thumb {
    display: block;
    width: 100%;
    /* the mockup's 136 × 64 at the narrowest; a wider card keeps the shape, not a sliver */
    height: auto;
    aspect-ratio: 17 / 8;
    max-height: 140px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--color-surface);
    font-size: 16px;
}

/* the no-photo stand-in keeps its gradient over the thumbnail's grey */
.gp-strip-thumb.gp-placeholder {
    display: flex;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    line-height: 1.1;
}

.gp-badge,
.gp-badge-spacer {
    align-self: flex-start;
    height: 18px;
}

.gp-badge {
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.gp-badge--current { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent-dark); }

.gp-strip-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    column-gap: 6px;
}

.gp-strip-code { font-size: 20px; line-height: 1.1; }

.gp-strip-years,
.gp-strip-offers {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

.gp-strip-offers { font-size: 13px; }

.gp-strip-bar {
    height: 4px;
    border-radius: 2px;
    background: #EDEDED;
}

.gp-strip-bar span {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: #9AA8BF;
}

.gp-strip-card--self .gp-strip-bar span { background: var(--accent); }

.gp-strip-price {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    min-height: 1.5em;
}

/* ---------- 3. History ---------- */

.gp-history {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.gp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 7%, transparent);
    color: var(--accent-dark);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.gp-ncap-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.gp-ncap-link:hover { text-decoration: underline; }

.gp-stars { display: inline-flex; gap: 2px; }
.gp-stars svg.on path { fill: var(--accent); stroke: var(--accent); }
.gp-stars svg.off path { fill: none; stroke: var(--accent); }

.gp-ncap-protocol {
    font-weight: 400;
    color: var(--text-secondary);
}

.gp-history-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr 1fr;
    gap: var(--spacing-sm);
    align-items: stretch;
}

.gp-history-grid--no-new { grid-template-columns: 1fr 1fr; }
.gp-history-grid--one-side { grid-template-columns: 1.6fr 1fr; }
.gp-history-grid--no-new.gp-history-grid--one-side { grid-template-columns: minmax(0, 480px); }

.gp-neighbour {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    color: var(--text-primary);
    text-decoration: none;
}

.gp-neighbour-name { font-size: 20px; color: var(--accent); }

.gp-neighbour:hover { border-color: var(--accent-light); }
.gp-neighbour:hover .gp-neighbour-name { color: var(--accent-dark); }

.gp-neighbour-text {
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-secondary);
    /* key_features stands in until the summary exists — longer than a card line */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.gp-whats-new {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--spacing-sm) 20px;
    border: 2px solid var(--accent);
    border-radius: 10px;
    background: var(--color-bg);
}

.gp-whats-new ul { margin: 0; padding-left: 20px; }
.gp-whats-new li { margin: 0 0 6px; line-height: 1.5; }

/* Toggletip */
.gp-tip { position: relative; display: inline-flex; }

.gp-tip-button {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.gp-tip-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gp-tip-text {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text-primary);
    /* A tip can sit inside an uppercase, nowrap metric label */
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    text-align: left;
}

/* Inside a small metric label (not-drivable share): a smaller button on the label's line */
.gp-tile-label .gp-tip,
.brand-hero-metric-label .gp-tip { position: relative; vertical-align: middle; margin-left: 2px; }

/* Hangs off its button on a phone too (unlike the history chips' tips below): keepOnScreen shifts it */
.gp-tile-label .gp-tip.is-ready .gp-tip-text,
.brand-hero-metric-label .gp-tip.is-ready .gp-tip-text {
    left: 50%;
    right: auto;
    width: max-content;
    max-width: min(300px, calc(100vw - 32px));
    transform: translateX(calc(-50% + var(--gp-tip-shift, 0px)));
}

.gp-tile-label .gp-tip-button,
.brand-hero-metric-label .gp-tip-button {
    width: 16px;
    height: 16px;
    font-size: 10px;
}

/* With JS the text becomes a bubble; without JS it stays inline after the button */
.gp-tip.is-ready .gp-tip-text {
    position: absolute;
    z-index: 20;
    left: 50%;
    bottom: calc(100% + 8px);
    width: max-content;
    max-width: 300px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    /* --gp-tip-shift: set by js/generation-page.js to keep the bubble on screen */
    transform: translateX(calc(-50% + var(--gp-tip-shift, 0px)));
    visibility: hidden;
}

.gp-tip.is-ready:not(.is-open) .gp-tip-text { display: none; }
.gp-tip.is-open .gp-tip-text { visibility: visible; }

/* ---------- 4. Versions (4A / 4B) ---------- */

#tipicne .gp-h3 { margin-bottom: var(--spacing-sm); }

.gp-versions--4a {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 48px;
    padding: 28px;
}

.gp-versions--typical-only { grid-template-columns: minmax(0, 480px); }
.gp-versions--list-only { grid-template-columns: minmax(0, 1fr); }
.gp-cta--inline { align-self: flex-start; margin-top: 12px; }

.gp-versions-typical { display: flex; flex-direction: column; gap: 8px; }

.gp-big-price {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.05;
    color: var(--accent-dark);
    white-space: nowrap;
}

.gp-typical-line { font-size: 15px; line-height: 1.5; }

.gp-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    margin-top: 8px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--accent);
    color: #FFFFFF;
    font-size: var(--font-size-base);
    font-weight: 700;
    text-decoration: none;
    text-align: center;
}

.gp-cta:hover { background: var(--accent-dark); color: #FFFFFF; }

.gp-versions-list { display: flex; flex-direction: column; }
.gp-versions-list > .gp-eyebrow { padding-bottom: 4px; }

.gp-version-row {
    display: grid;
    grid-template-columns: 150px 1fr 190px;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 0;
    border-bottom: 1px solid #EDEDED;
}

.gp-version-name { display: flex; flex-direction: column; }
.gp-version-title { font-size: 20px; line-height: 1.15; }
.gp-version-spec { font-size: 13px; color: var(--text-secondary); }

.gp-version-share { display: flex; align-items: center; gap: 10px; }

.gp-share-bar {
    flex-grow: 1;
    height: 10px;
    border-radius: 5px;
    background: #EDEDED;
}

.gp-share-bar span {
    display: block;
    height: 10px;
    border-radius: 5px;
    background: var(--accent);
}

.gp-share-text {
    width: 108px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

.gp-share-text strong { color: var(--text-primary); font-size: var(--font-size-base); }

.gp-version-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.gp-price-text {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.gp-price-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    background: var(--color-bg);
    color: var(--accent-dark);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.gp-price-button:hover,
.gp-price-button[aria-expanded="true"] {
    background: color-mix(in srgb, var(--accent) 8%, var(--color-bg));
    color: var(--accent-dark);
}

.gp-typical-sentence { margin: 12px 0 0; font-size: 15px; }
.gp-versions .gp-section-link { margin-top: 10px; align-self: flex-start; }

.gp-versions--4b { display: flex; flex-direction: column; gap: 18px; }

.gp-4b-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--spacing-sm); }
.gp-4b-title { font-size: var(--font-size-xl); font-weight: 700; }
.gp-accent-dark { color: var(--accent-dark); }
.gp-4b-head .gp-typical-line { font-size: var(--font-size-sm); color: var(--text-secondary); }

.gp-4b-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.gp-4b-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
}

.gp-4b-card-head { display: flex; align-items: baseline; justify-content: space-between; }
.gp-4b-card .gp-version-title { font-size: var(--font-size-xl); }
.gp-4b-card .gp-version-spec { font-size: var(--font-size-sm); }
.gp-4b-share { font-size: 28px; font-weight: 800; color: var(--accent-dark); }
.gp-4b-price { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.gp-mix {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
}

.gp-mix-axis { display: flex; flex-direction: column; gap: 6px; }
.gp-mix-title { font-size: 13px; font-weight: 700; }

.gp-mix-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #EDEDED;
}

.gp-mix-seg--0 { background: var(--accent); }
.gp-mix-seg--1 { background: color-mix(in srgb, var(--accent) 40%, var(--color-bg)); }
.gp-mix-seg--2 { background: color-mix(in srgb, var(--accent) 20%, var(--color-bg)); }

.gp-mix-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.gp-mix-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.gp-mix-swatch { width: 10px; height: 10px; border-radius: 2px; }

/* ---------- 5. Configurations ---------- */

.gp-configs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: 18px;
}

.gp-fuel-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.gp-chips-label {
    margin-right: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.gp-fuel-chip {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #D0D0D0;
    background: var(--color-bg);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
}

.gp-fuel-chip.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #FFFFFF;
}

.gp-fuel-chip[disabled] { cursor: default; opacity: 0.8; }
.gp-chip-count { font-weight: 400; }

.gp-config-table { padding: 18px 10px; }

.gp-config-header,
.gp-config-row {
    display: grid;
    /* the last column holds the flagged best-offers button (?offers=true) and is empty without it */
    grid-template-columns: 200px 90px minmax(0, 1fr) 170px 80px 72px auto;
    gap: var(--spacing-sm);
    padding: 12px 14px;
}

.gp-config-header {
    align-items: end;
    padding-top: 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--text-primary);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.gp-col-price { display: flex; flex-direction: column; gap: 4px; }

.gp-axis {
    position: relative;
    height: 16px;
    text-transform: none;
    font-weight: 400;
}

.gp-axis span {
    position: absolute;
    transform: translateX(-50%);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* the edge ticks stay inside the column */
.gp-axis span:first-child { transform: none; }
.gp-axis span:last-child { transform: translateX(-100%); }

.gp-config-list { margin: 0; padding: 0; list-style: none; }

.gp-config-row {
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.gp-config-row.is-popular { background: color-mix(in srgb, var(--l-light-emerald) 12%, transparent); }
.gp-config-row[hidden] { display: none; }

.gp-config-name { display: flex; flex-direction: column; min-width: 0; }
.gp-config-title { display: flex; align-items: center; gap: 8px; }
.gp-config-title .gp-version-title { font-size: 21px; }
.gp-config-spec { font-size: 13px; color: var(--text-secondary); }

.gp-popular {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--l-light-emerald);
    color: #14532D;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.gp-config-offers { font-size: var(--font-size-base); font-weight: 700; }

.gp-config-price,
.gp-config-mileage { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.gp-range-track {
    position: relative;
    display: block;
    height: 12px;
    border-radius: 6px;
    background: #ECEEF2;
}

.gp-range-track--thin { height: 8px; border-radius: 4px; }

.gp-range-all,
.gp-range-mid {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: inherit;
}

.gp-range-all { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.gp-range-mid { background: var(--accent); }

.gp-range-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.gp-range-labels > span:last-child:not(:first-child) { color: var(--text-secondary); }
.gp-range-fair { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.gp-range-raw { color: var(--text-secondary); }
.gp-range-raw-note { font-size: 12px; }
.gp-range-labels > span { white-space: nowrap; }

.gp-config-local,
.gp-config-days { font-size: 15px; }

.gp-best-offers {
    display: none; /* js/offers.js shows it with ?offers=true */
    min-height: 40px;
    width: 150px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent);
    background: var(--color-bg);
    color: var(--accent);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
}

.gp-config-list > .offer-row { padding: 12px 14px; }

.gp-no-offers {
    margin: var(--spacing-sm) 0 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.gp-no-offers strong { color: var(--text-primary); }
.gp-last-seen { color: var(--text-secondary); }

/* ---------- 7. Same years of the brand ---------- */

.gp-bm-name { display: flex; align-items: center; gap: 8px; min-width: 0; }

.gp-code-badge {
    flex-shrink: 0;
    padding: 1px 6px;
    border: 1px solid #D5D5D5;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.gp-brand-years .bm-card-photo.gp-placeholder { font-size: 17px; }
.gp-new-on-sale { color: var(--accent-dark); font-weight: 600; }

/* ---------- Listings dialog ---------- */

.gp-dialog {
    margin: auto; /* the global reset drops the UA's centring */
    width: min(840px, calc(100vw - 32px));
    max-height: 70vh;
    padding: 28px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    color: var(--text-primary);
}

.gp-dialog[open] { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.gp-dialog::backdrop { background: rgba(10, 16, 28, 0.5); }

.gp-dialog-head { display: flex; align-items: flex-start; gap: 12px; }
.gp-dialog-titles { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
.gp-dialog-title { font-size: 28px; line-height: 1.15; }
.gp-dialog-sub { font-size: 15px; color: var(--text-secondary); }

.gp-dialog-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--text-secondary);
    cursor: pointer;
}

.gp-dialog-close svg { flex-shrink: 0; width: 18px; height: 18px; }

.gp-dialog-block { display: flex; flex-direction: column; gap: 8px; }

.gp-dialog-sites {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.gp-site-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 10px 16px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
    text-decoration: none;
}

.gp-site-link:hover { border-color: var(--accent-light); }
.gp-site-link img { flex-shrink: 0; width: 20px; height: 20px; }
.gp-site-link img.is-rounded { border-radius: 3px; }
.gp-site-name { flex-grow: 1; }
.gp-site-link svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--text-secondary); }

.gp-dialog-cv { padding-top: var(--spacing-sm); border-top: 1px solid var(--color-border); }
.gp-dialog-cv-title { font-size: var(--font-size-base); font-weight: 700; }
.gp-cv-banner { align-self: center; max-width: 100%; overflow: hidden; }

.gp-cv-discount {
    align-self: flex-end;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
}

.gp-cv-discount strong { color: var(--accent); }

/* ---------- Tablet ---------- */

@media (max-width: 1024px) {
    .gp-container { padding: 0 var(--spacing-md); }

    .gp-hero-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "head" "media" "typical" "tiles";
        grid-template-rows: none;
    }

    .gp-hero-media { align-self: start; }
    .gp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .gp-versions--4a { grid-template-columns: minmax(0, 1fr); gap: 22px; }

    .gp-config-header { display: none; }

    .gp-config-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name offers"
            "price price"
            "action action";
        gap: 8px;
        padding: 14px 0;
    }

    .gp-config-table { padding: 4px 14px; }
    .gp-config-name { grid-area: name; }
    .gp-config-offers { grid-area: offers; align-self: baseline; font-size: 15px; }
    .gp-config-price { grid-area: price; }
    .gp-config-action { grid-area: action; }
    .gp-config-mileage,
    .gp-config-local,
    .gp-config-days { display: none; }
    .gp-config-row .gp-phone-only { display: inline; }
    .gp-config-spec { font-size: var(--font-size-sm); }
    .gp-range-labels { font-size: var(--font-size-sm); }
}

/* ---------- Phone ---------- */

@media (max-width: 600px) {
    .gp-container { padding: 0 var(--spacing-sm); }
    .gp-section { padding: var(--spacing-sm) 0; }
    .gp-h3 { font-size: 20px; }

    .gp-hero { padding: 20px 0; }
    .gp-hero-logo { display: none; }
    .gp-hero-text h1 { font-size: 28px; letter-spacing: -0.3px; }
    .gp-hero-sub { font-size: var(--font-size-base); line-height: 1.45; }
    .gp-crumbs ol { font-size: 13px; }

    .gp-typical-link { grid-template-columns: minmax(0, 1fr); align-items: start; }
    .gp-typical-price { font-size: 26px; }
    .gp-typical-more { grid-row: auto; grid-column: auto; }

    .gp-strip-card { flex: 0 0 118px; }
    .gp-strip-thumb { height: 56px; }

    .gp-history { padding: var(--spacing-sm); }
    /* the tooltip spans the chip list instead of hanging off a button near the edge */
    .gp-chips { position: relative; }
    .gp-chip { position: static; flex-wrap: wrap; row-gap: 2px; }
    .gp-tip { position: static; }
    .gp-tip.is-ready .gp-tip-text {
        left: 0;
        right: 0;
        width: auto;
        max-width: none;
        transform: none;
    }
    .gp-ncap-link { white-space: nowrap; }
    .gp-history-grid,
    .gp-history-grid--no-new,
    .gp-history-grid--one-side {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .gp-whats-new { grid-column: 1 / -1; order: -1; }
    .gp-neighbour { padding: 12px; }
    .gp-neighbour-name { font-size: 17px; }
    .gp-neighbour-text { -webkit-line-clamp: 4; line-clamp: 4; }
    .gp-history-grid--no-new.gp-history-grid--one-side { grid-template-columns: minmax(0, 1fr); }
    /* One neighbour only: it takes the row the missing one would share */
    .gp-history-grid--one-side .gp-neighbour { grid-column: 1 / -1; }

    .gp-versions--4a { padding: var(--spacing-sm); }
    .gp-big-price { font-size: 32px; }

    .gp-version-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .gp-version-share { display: none; }
    .gp-version-row .gp-phone-only { display: inline; }

    .gp-4b-cards { grid-template-columns: minmax(0, 1fr); }
    .gp-mix { grid-auto-flow: row; }
    .gp-4b-title { font-size: 20px; }

    .gp-fuel-chip { padding: 6px 12px; }
    .gp-configs-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 10px; }

    .gp-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 85vh;
        margin: auto 0 0;
        padding: 20px var(--spacing-sm) 24px;
        border-radius: 16px 16px 0 0;
    }

    .gp-dialog-title { font-size: 22px; }
    .gp-dialog-sites { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
