/* Prix Carburants theme: light, calm teal, mobile first. System fonts only. */
:root {
    --fr-bg:#ffffff;
    --fr-bg-alt:#f6f8fa;
    --fr-text:#1f2933;
    --fr-muted:#52606d;
    --fr-brand:#0f766e;
    --fr-brand-soft:#e6f4f2;
    --fr-good:#15803d;
    --fr-bad:#b91c1c;
    --fr-warn:#b45309;
    --fr-border:#e4e7eb;
    --fr-radius:12px;
    /* Form control and button outlines: ≥3:1 against white and --fr-brand-soft (WCAG 1.4.11). */
    --fr-control-border:#7b8794;
    --fr-brand-dark:#0b5a54;
    --fr-warn-soft:#fdf3e7;
    --fr-series-1:#0f766e;
    --fr-series-2:#1d4ed8;
    --fr-series-3:#b45309;
    --fr-series-4:#7e22ce;
    --fr-series-5:#b91c1c;
    --fr-series-6:#374151;
    --fr-gap:1rem;
    --fr-space:1.5rem;
    --fr-shadow:0 1px 2px rgba(31, 41, 51, .06), 0 4px 14px rgba(31, 41, 51, .05);
    --fr-font:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
/* The header wraps to two rows on small phones (about 90px): anchors and focused fields land below it. */
@media (max-width: 479px) { html { scroll-padding-top: 7rem; } }
/* Keep focused elements clear of the fixed consent bar (max 30vh) while it is shown (WCAG 2.4.11). */
html:has(body.fr-consent-visible) { scroll-padding-bottom: 32vh; }

/* hidden always wins over component display rules (.fr-btn is inline-flex). */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--fr-font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--fr-text);
    background: var(--fr-bg-alt);
}

a { color: var(--fr-brand); text-underline-offset: .18em; }
a:hover { color: var(--fr-brand-dark); }

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

h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .6rem; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; margin-top: 0; }
h3 { font-size: 1.0625rem; font-weight: 700; }
p { margin: 0 0 1rem; }

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

.fr-icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.17em; }

/* Header */
.fr-header { background: var(--fr-bg); border-bottom: 1px solid var(--fr-border); position: sticky; top: 0; z-index: 20; }
.fr-header__inner {
    max-width: 1100px; margin: 0 auto; padding: .625rem 1rem;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem;
}
.fr-logo {
    display: inline-flex; align-items: center; gap: .5rem;
    font-weight: 800; font-size: 1.1875rem; letter-spacing: -.01em; color: var(--fr-text); text-decoration: none;
}
.fr-logo .fr-icon { width: 1.9rem; height: 1.9rem; padding: .35rem; border-radius: 50%; background: var(--fr-brand); color: #fff; }
.fr-nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; min-width: 0; }
.fr-nav__list a {
    display: inline-block; padding: .4rem .7rem; border-radius: 999px;
    font-size: .9375rem; font-weight: 600; color: var(--fr-muted); text-decoration: none;
}
@media (max-width: 479px) {
    .fr-header__inner { padding-left: .75rem; padding-right: .75rem; }
    .fr-nav__list a { padding: .4rem .55rem; font-size: .875rem; }
}
.fr-nav__list a:hover { background: var(--fr-brand-soft); color: var(--fr-brand-dark); }

/* Main layout */
.fr-main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }
.fr-main > article, .fr-main > h1 { min-width: 0; }
.fr-aside { min-width: 0; }

@media (min-width: 1024px) {
    .fr-main { padding-top: 2rem; }
    .fr-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
    h1 { font-size: 2.125rem; }
}

.intro { font-size: 1.0625rem; color: var(--fr-muted); max-width: 46rem; }

/* Breadcrumb */
.breadcrumb ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; font-size: .875rem; color: var(--fr-muted); }
.breadcrumb li + li::before { content: "›"; margin: 0 .45rem; color: var(--fr-muted); }
.breadcrumb a { color: var(--fr-muted); }
.breadcrumb a:hover { color: var(--fr-brand-dark); }

/* Cards and sections */
.fr-card, .fr-main article section {
    background: var(--fr-bg); border: 1px solid var(--fr-border); border-radius: var(--fr-radius);
    box-shadow: var(--fr-shadow); padding: 1.125rem 1rem; margin: 0 0 var(--fr-gap);
}
.fr-main article section > :last-child, .fr-card > :last-child { margin-bottom: 0; }
@media (min-width: 768px) {
    .fr-card, .fr-main article section { padding: 1.5rem; }
}
.fr-main article .fr-rankings { margin-top: .25rem; }
.fr-layout__main { min-width: 0; }
.fr-aside > :last-child { margin-bottom: 0; }

/* First-screen price cards: 2-column grid on phones (all fuels visible, nothing hidden behind a scroll). */
.fr-main .fr-top {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 0 0 var(--fr-space);
    padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0;
}
.fr-top__card { display: flex; flex-direction: column; gap: .15rem; margin: 0; padding: .8rem .85rem; border-top: 3px solid var(--fr-brand); }
.fr-top__card p { margin: 0; }
.fr-top__fuel { font-size: .8125rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--fr-muted); }
.fr-top__fuel a { color: inherit; text-decoration: none; }
.fr-top__fuel a:hover { color: var(--fr-brand-dark); text-decoration: underline; }
.fr-top__price { display: flex; align-items: center; gap: .4rem; }
.fr-top__price .fr-price__value { font-size: 1.625rem; color: var(--fr-good); }
.fr-top__price--old .fr-price__value { color: var(--fr-muted); }
.fr-top__station { font-size: .9375rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.fr-top__station a { color: var(--fr-text); }
.fr-top__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; }
.fr-top__areatrend { font-size: .8125rem; color: var(--fr-muted); }
.fr-top__extra { margin-top: .35rem !important; }
.fr-top__none { color: var(--fr-muted); font-size: .9375rem; }
.fr-top__card:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* Narrow cards (about 110px inside at 320px): itinerary pills shrink and may wrap their label. */
.fr-top__card .fr-actions { display: flex; min-width: 0; }
.fr-top__card .fr-btn { max-width: 100%; min-width: 0; padding: .25rem .55rem; font-size: .8125rem; line-height: 1.2; }
@media (min-width: 640px) {
    .fr-main .fr-top { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .85rem; }
    .fr-top__card:last-child:nth-child(odd) { grid-column: auto; }
    .fr-top__price .fr-price__value { font-size: 1.875rem; }
}

.notice, .fr-notice {
    padding: .8rem 1rem; margin: 0 0 var(--fr-gap); border-radius: var(--fr-radius);
    background: var(--fr-warn-soft); border: 1px solid #f3d9b6; border-left: 4px solid var(--fr-warn); color: #6b3a07;
}

/* Prices */
.fr-price, .price { display: inline-flex; flex-direction: column; align-items: flex-start; gap: .1rem; line-height: 1.15; }
.fr-price__value, .price strong {
    font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--fr-text);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.fr-price--best .fr-price__value { color: var(--fr-good); }
.fr-price--old .fr-price__value { color: var(--fr-muted); }
.updated, .fr-price__time { font-size: .8125rem; font-weight: 400; color: var(--fr-muted); }
.mark-old { font-size: .75rem; }

/* Badges */
.fr-badge {
    display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
    line-height: 1.5; background: var(--fr-brand-soft); color: var(--fr-brand-dark); white-space: nowrap;
}
.fr-badge--old, .fr-badge--rupture { background: var(--fr-warn-soft); color: #8a4207; }
.fr-badge--24h { background: var(--fr-brand-soft); color: var(--fr-brand-dark); }
.fr-badge--autoroute { background: #e8eef7; color: #2b4a7a; }

/* Trend */
.trend, .fr-trend { display: inline-flex; align-items: center; gap: .15rem; font-weight: 700; color: var(--fr-muted); }
.trend-up { color: var(--fr-bad); }
.trend-down { color: var(--fr-good); }

/* Buttons and itinerary actions */
.fr-actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.fr-btn, .itinerary a {
    display: inline-flex; align-items: center; gap: .35rem; min-height: 2.25rem; padding: .3rem .75rem;
    border: 1px solid var(--fr-control-border); border-radius: 999px; background: var(--fr-bg);
    color: var(--fr-brand-dark); font-size: .875rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.fr-btn:hover, .itinerary a:hover { background: var(--fr-brand-soft); border-color: var(--fr-brand); }
.fr-btn--primary { background: var(--fr-brand); border-color: var(--fr-brand); color: #fff; }
.fr-btn--primary:hover { background: var(--fr-brand-dark); color: #fff; }

/* Ranking rows */
.ranking, .fr-rankings { list-style: none; margin: 0; padding: 0; counter-reset: fr-rank; }
.fr-rank {
    position: relative; counter-increment: fr-rank;
    /* The price column is capped so a long "mis à jour …" time wraps instead of squeezing the station name. */
    display: grid; grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 10rem); grid-template-areas: "pos main price" ". meta meta";
    gap: .35rem .75rem; align-items: center; padding: .85rem 0; border-top: 1px solid var(--fr-border);
}
.fr-rank:first-child { border-top: 0; padding-top: .25rem; }
.fr-rank::before {
    content: counter(fr-rank); grid-area: pos; align-self: start; width: 2rem; height: 2rem; border-radius: 50%;
    display: grid; place-items: center; background: var(--fr-bg-alt); color: var(--fr-muted);
    font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.fr-rank--best::before { background: var(--fr-brand-soft); color: var(--fr-brand-dark); }
.fr-rank__main { grid-area: main; min-width: 0; }
.fr-rank__name { display: block; font-weight: 700; color: var(--fr-text); text-decoration: none; }
.fr-rank__name:hover { color: var(--fr-brand-dark); text-decoration: underline; }
.address, .fr-rank__address { display: block; font-size: .875rem; color: var(--fr-muted); }
.fr-rank__price { grid-area: price; text-align: right; }
.fr-rank__price .fr-price { align-items: flex-end; }
.fr-rank--best .fr-price__value { color: var(--fr-good); }
.fr-rank__price .fr-price__time { overflow-wrap: anywhere; }
/* Phones: the price goes under the name (value and time on one wrapping line), the name keeps the full width. */
@media (max-width: 479px) {
    .fr-rank { grid-template-columns: 2rem minmax(0, 1fr); grid-template-areas: "pos main" ". price" ". meta"; }
    .fr-rank__price { text-align: left; }
    .fr-rank__price .fr-price { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; }
}
.fr-rank__meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
.distance, .fr-rank__distance { font-size: .875rem; color: var(--fr-muted); }

/* Generic content (step-4 templates, restyled in detail later) */
.departements ul, .communes ul, .around ul {
    list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem .75rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}
.departements li, .communes li { padding: .35rem 0; border-bottom: 1px solid var(--fr-border); }
.count { color: var(--fr-muted); font-size: .875rem; }
.more { margin: 1rem 0 0; font-weight: 600; }
.empty { color: var(--fr-muted); }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tags li { background: var(--fr-brand-soft); color: var(--fr-brand-dark); padding: .2rem .75rem; border-radius: 999px; font-size: .875rem; font-weight: 600; }

/* Wide tables scroll inside their box instead of the page; templates may also wrap a table in .fr-table-wrap. */
.fr-table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; margin: .25rem 0 0; font-variant-numeric: tabular-nums; }
.fr-prices td .fr-price { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: .1rem .6rem; }
.fr-prices .fr-price__value { font-size: 1.25rem; }
.fr-deplist { margin: 0; padding-left: 1.5rem; columns: 14rem; column-gap: 1.5rem; }
.fr-deplist li { padding: .25rem 0; break-inside: avoid; }
.averages ul { list-style: none; margin: 0; padding: 0; }
.averages li { padding: .55rem 0; border-top: 1px solid var(--fr-border); }
.averages li:first-child { border-top: 0; }
.fr-station-address { color: var(--fr-muted); }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--fr-border); vertical-align: top; }
thead th { font-size: .8125rem; font-weight: 700; color: var(--fr-muted); text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child > * { border-bottom: 0; }

/* Footer */
.fr-footer { background: var(--fr-bg); border-top: 1px solid var(--fr-border); font-size: .875rem; color: var(--fr-muted); }
.fr-footer__inner { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 2rem; }
.fr-footer p { margin: 0 0 .4rem; }
.fr-footer__links { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.fr-footer a, .fr-footer .fr-consent-open { color: var(--fr-brand-dark); font-weight: 600; }
/* Footer variant reads as a link; the privacy page one keeps the .fr-btn look. */
.fr-footer .fr-consent-open { background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Legal, privacy and sources pages */
.fr-defs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; margin: 0; }
.fr-defs dt { color: var(--fr-muted); }
.fr-defs dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 479px) { .fr-defs { grid-template-columns: minmax(0, 1fr); } .fr-defs dd { margin-bottom: .5rem; } }

/* Consent bar: fixed bottom, compact (max 30% of the viewport), never modal */
.fr-consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 30vh; overflow-y: auto; background: var(--fr-bg); border-top: 1px solid var(--fr-border); box-shadow: 0 -2px 12px rgba(31, 41, 51, .12); font-size: .875rem; }
.fr-consent[hidden], .fr-consent__options[hidden] { display: none; }
.fr-consent__inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.fr-consent__text { margin: 0; flex: 1 1 18rem; line-height: 1.35; }
.fr-consent__text a { color: var(--fr-brand-dark); font-weight: 600; }
.fr-consent__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.fr-consent__btn { min-height: 2.5rem; padding: .4rem 1rem; font: inherit; font-weight: 600; }
.fr-consent__custom { background: none; border: 0; padding: .4rem .25rem; font: inherit; font-weight: 600; color: var(--fr-brand-dark); text-decoration: underline; cursor: pointer; min-height: 2.5rem; }
.fr-consent__options { flex: 1 1 100%; margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.fr-consent__legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fr-consent__option { display: inline-flex; align-items: center; gap: .4rem; }
.fr-consent button:focus-visible, .fr-consent a:focus-visible, .fr-consent input:focus-visible { outline: 3px solid var(--fr-brand); outline-offset: 2px; }
body.fr-consent-visible { padding-bottom: 30vh; }

/* Map (click to load, see map.js) */
.fr-map__canvas { height: 320px; border-radius: var(--fr-radius); border: 1px solid var(--fr-border); background: var(--fr-bg-alt); }
.fr-map__canvas .leaflet-popup-content { margin: .6rem .8rem; color: var(--fr-text); }
.fr-map__status { color: var(--fr-muted); }
@media (min-width: 1024px) {
    .fr-map__canvas { height: 360px; }
}

/* Price history chart (see chart.js); hidden without JS, the details table remains */
.fr-chart:not(.fr-chart--js) { display: none; }
.fr-chart__ranges { display: flex; gap: .5rem; margin-bottom: .75rem; }
.fr-chart__range[aria-pressed="true"] { background: var(--fr-brand); border-color: var(--fr-brand); color: #fff; }
.fr-chart__canvas { min-height: 300px; overflow: hidden; }
.fr-chart__canvas .u-legend { text-align: left; }
.fr-chart__status { color: var(--fr-muted); }
.fr-chart-fallback > summary { cursor: pointer; margin-bottom: .5rem; }

/* Fill-up savings calculator (see calc.js); hidden without JS */
/* .fr-main prefix: must beat the generic ".fr-main article section" card rule. */
.fr-main .fr-calc { background: var(--fr-brand-soft); border-color: var(--fr-brand-soft); border-radius: var(--fr-radius); padding: 1rem; margin-bottom: 1.5rem; }
.fr-calc h2 { margin-top: 0; }
.fr-calc__fields { display: flex; flex-wrap: wrap; gap: .75rem; }
.fr-calc__field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--fr-muted); }
.fr-calc__field input, .fr-calc__field select { font: inherit; color: var(--fr-text); padding: .5rem; border: 1px solid var(--fr-control-border); border-radius: 8px; background: #fff; min-width: 7rem; }
.fr-calc__hint { font-size: .8125rem; }
.fr-calc__field input:focus-visible, .fr-calc__field select:focus-visible { outline: 3px solid var(--fr-brand); outline-offset: 2px; }
.fr-calc__result { display: block; margin-top: .75rem; font-weight: 700; min-height: 1.5em; }
