/* OctroiMer — simulateur de taxes à l'import dans les DROM */

:root {
    --ocean-900: #06344a;
    --ocean-700: #0b4f6c;
    --ocean-500: #1a7aa3;
    --lagoon: #12a39a;
    --lagoon-soft: #e3f6f4;
    --sun: #ffb347;
    --coral: #f2694a;
    --sand: #f7f3ea;

    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --text: #13232e;
    --text-muted: #5b6b77;
    --border: #dde5eb;
    --focus: #1a7aa3;
    --error: #c2412d;
    --error-soft: #fdecea;

    --seg-goods: #0b4f6c;
    --seg-shipping: #7fa7bd;
    --seg-droits_douane: #8e5bd6;
    --seg-octroi_de_mer: #12a39a;
    --seg-octroi_de_mer_regional: #6fd3c9;
    --seg-tva: #ffb347;
    --seg-fees: #f2694a;
    /* French Polynesia and New Caledonia */
    --seg-taxation_forfaitaire: #d4519b;
    --seg-tdl: #2f8f5b;
    --seg-tgc: #ffb347;
    --seg-autres_taxes: #b08d57;
    --seg-forfait_alcool: #8f2d63;
    --seg-droit_de_quai: #12a39a;
    --seg-taxe_entree: #12a39a;
    --seg-droit_entree: #12a39a;
    --seg-taxe_speciale: #6fd3c9;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgb(6 52 74 / 0.06), 0 8px 24px rgb(6 52 74 / 0.07);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b141a;
        --surface: #121e26;
        --surface-2: #17252f;
        --text: #e6eef3;
        --text-muted: #9bb0bd;
        --border: #24363f;
        --lagoon-soft: #10302e;
        --error-soft: #3a1d18;
        --seg-goods: #4f9cc4;
        --seg-shipping: #3d5d6e;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
        color-scheme: dark;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--ocean-500);
}

a:hover {
    color: var(--lagoon);
}

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

h1, h2, h3 {
    line-height: 1.2;
    margin: 0;
}

code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.9em;
}

.container {
    width: min(1180px, 100% - 32px);
    margin-inline: auto;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    padding: 8px 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    z-index: 10;
}

.skip-link:focus {
    top: 12px;
}

/* ---------- Header ---------- */

.site-header {
    background: var(--ocean-900);
    color: #fff;
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-block: 14px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.brand:hover {
    color: #fff;
}

.brand__logo {
    width: 34px;
    height: 34px;
    color: var(--ocean-700);
}

.brand__name strong {
    color: var(--lagoon);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.site-nav a {
    color: #cfe3ec;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.95rem;
}

.site-nav a:hover {
    color: #fff;
    background: rgb(255 255 255 / 0.08);
}

.site-nav a[aria-current="page"] {
    color: var(--ocean-900);
    background: #fff;
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 10%, rgb(255 179 71 / 0.35) 0, transparent 22%),
        linear-gradient(160deg, var(--ocean-900) 0%, var(--ocean-700) 55%, #0f6f83 100%);
    color: #fff;
    padding-block: 40px 160px;
}

/* Hero text stays above the waves. */
.hero > .container {
    position: relative;
    z-index: 1;
}

/* Two waves at the bottom of the hero, drawn in stretchable SVG masks so they span the full
   width of any screen: a translucent lagoon swell behind, the page-coloured wave in front. */
.hero::before,
.hero::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px 0;
    -webkit-mask: var(--wave) no-repeat 0 0 / 100% 100%;
    mask: var(--wave) no-repeat 0 0 / 100% 100%;
}

/* Two swells in one mask: a light band (half opacity) above a denser one. */
.hero::before {
    height: 165px;
    background: linear-gradient(90deg, rgb(18 163 154 / 0.75), rgb(111 211 201 / 0.55) 55%, rgb(255 179 71 / 0.55));
    --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 165' preserveAspectRatio='none'%3E%3Cpath fill-opacity='.45' d='M0 28C240 112 480 112 720 62S1200 0 1440 46V165H0Z'/%3E%3Cpath d='M0 76C200 138 420 138 640 96S1060 30 1300 72S1400 116 1440 108V165H0Z'/%3E%3C/svg%3E");
}

.hero::after {
    height: 110px;
    background: var(--bg);
    --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 110' preserveAspectRatio='none'%3E%3Cpath d='M0 62C180 6 360 6 540 46S900 108 1080 60S1320 8 1440 36V110H0Z'/%3E%3C/svg%3E");
}

@media (max-width: 560px) {
    .hero::before {
        height: 100px;
    }

    .hero::after {
        height: 70px;
    }
}

.eyebrow {
    margin: 0 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sun);
}

.hero h1 {
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    letter-spacing: -0.02em;
    max-width: 22ch;
}

.lead {
    max-width: 62ch;
    margin: 14px 0 0;
    font-size: 1.08rem;
    color: #d5e7ef;
}

.page-hero {
    padding-block: 36px 150px;
}

/* ---------- Layout & cards ---------- */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 24px;
    align-items: start;
    margin-top: -64px;
    position: relative;
    padding-bottom: 48px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.card__title {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.result-panel {
    position: sticky;
    top: 16px;
}

/* ---------- Form ---------- */

.sim-form {
    display: grid;
    gap: 14px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.step:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.step__num {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--lagoon-soft);
    color: var(--lagoon);
    font-weight: 700;
    font-size: 0.9rem;
}

.step__title {
    font-size: 1.02rem;
}

.step__optional {
    margin-left: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

.field {
    display: grid;
    gap: 6px;
    margin: 0;
    min-width: 0;
}

fieldset.field {
    border: 0;
    padding: 0;
}

.field__label {
    font-weight: 600;
    font-size: 0.93rem;
    padding: 0;
}

.field__label.required::after {
    content: " *";
    color: var(--coral);
}

.field__help {
    margin: 0;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.field__error {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--error);
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    min-height: 46px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:hover,
select:hover {
    border-color: var(--ocean-500);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--ocean-500);
    box-shadow: 0 0 0 3px rgb(26 122 163 / 0.22);
}

.field--error input,
.field--error select {
    border-color: var(--error);
    background: var(--error-soft);
}

.select {
    position: relative;
}

.select select {
    appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.select::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.input-affix {
    position: relative;
}

.input-affix input {
    padding-right: 36px;
    font-variant-numeric: tabular-nums;
}

.input-affix__suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.choice-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.choice-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.35;
    transition: border-color 0.15s, background 0.15s;
}

.choice-card:hover {
    border-color: var(--ocean-500);
}

.choice-card:has(input:checked) {
    border-color: var(--lagoon);
    background: var(--lagoon-soft);
    box-shadow: inset 0 0 0 1px var(--lagoon);
}

.choice-card input,
.checkbox input {
    accent-color: var(--lagoon);
    margin: 3px 0 0;
    flex: none;
    width: 16px;
    height: 16px;
}

.checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.92rem;
    cursor: pointer;
}

.grid-2,
.grid-3 {
    display: grid;
    gap: 14px;
    align-items: start;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.articles {
    display: grid;
    gap: 12px;
}

.articles__list {
    display: grid;
    gap: 12px;
}

.article {
    position: relative;
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    min-width: 0;
}

.article__title {
    padding: 0 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lagoon);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.article__remove {
    position: absolute;
    top: 8px;
    right: 10px;
    font: 600 0.82rem var(--font);
    color: var(--error);
    background: none;
    border: 0;
    padding: 4px 6px;
    cursor: pointer;
}

.article__remove:hover {
    text-decoration: underline;
}

.article__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.7fr);
    gap: 12px;
    align-items: start;
}

.article .advanced {
    padding: 8px 12px;
}

.article .advanced summary {
    font-size: 0.88rem;
}

.articles__add {
    justify-self: start;
}

.advanced {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: var(--surface-2);
}

.advanced summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ocean-500);
}

.advanced[open] summary {
    margin-bottom: 8px;
}

.advanced__intro {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.advanced .field__label {
    font-size: 0.85rem;
}

/* Expert rates: label, input and error share one row each across the columns (subgrid), so the
   inputs stay aligned even when a label wraps on two lines. Not needed once stacked on phones. */
@media (min-width: 561px) {
    .advanced .grid-3 {
        row-gap: 0;
    }

    .advanced .grid-3 > .field {
        grid-row: span 3;
        display: grid;
        grid-template-rows: subgrid;
        row-gap: 6px;
    }

    .advanced .grid-3 > .field > .field__label {
        align-self: end;
    }
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    border-radius: 999px;
    padding: 12px 22px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--coral);
    color: #fff;
    font-size: 1.05rem;
    box-shadow: 0 6px 18px rgb(242 105 74 / 0.35);
}

.btn--primary:hover {
    background: #e05535;
}

.btn--block {
    width: 100%;
    margin-top: 6px;
}

.btn--ghost {
    background: transparent;
    color: var(--ocean-500);
    border-color: var(--border);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn--ghost:hover {
    border-color: var(--ocean-500);
}

/* ---------- Result ---------- */

.result {
    border-top: 5px solid var(--lagoon);
}

.result__context {
    margin: 0 0 14px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.result__label {
    margin: 0;
    font-weight: 600;
}

.result__amount {
    margin: 2px 0 6px;
    font-size: clamp(2.3rem, 5vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ocean-700);
    font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
    .result__amount {
        color: #7cc7e6;
    }
}

/* Unknown carrier: "158,00 € à 184,00 €", a little smaller so that it fits on one line on most screens. */
.result__amount--range {
    font-size: clamp(1.8rem, 4.2vw, 2.5rem);
}

.result__amount-to {
    font-size: 0.55em;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-muted);
}

.result__sub {
    margin: 0 0 18px;
    color: var(--text-muted);
}

.result__local {
    margin: -4px 0 6px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.result__sub strong {
    color: var(--text);
}

.total-cost {
    margin: 0 0 18px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-variant-numeric: tabular-nums;
}

.total-cost__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 3px 0;
}

.total-cost dt {
    color: var(--text-muted);
}

.total-cost dd {
    margin: 0;
    white-space: nowrap;
}

/* "1 158,00 € à 1 176,00 €" may break before "à" on narrow screens (amounts never break: no-break spaces). */
.amount-range {
    white-space: normal;
}

.amount-range__to {
    white-space: nowrap;
}

.total-cost__row--total {
    margin-top: 6px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
    font-size: 1.2rem;
    font-weight: 800;
}

.total-cost__row--total dt {
    color: var(--text);
}

.breakdown tfoot .breakdown__total th,
.breakdown tfoot .breakdown__total td {
    border-top: 2px solid var(--border);
    font-size: 1.1rem;
}

.stack {
    display: flex;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-2);
    gap: 2px;
}

.stack__part {
    display: block;
    min-width: 3px;
}

.stack__part--goods { background: var(--seg-goods); }
.stack__part--shipping { background: var(--seg-shipping); }
.stack__part--droits_douane { background: var(--seg-droits_douane); }
.stack__part--octroi_de_mer { background: var(--seg-octroi_de_mer); }
.stack__part--octroi_de_mer_regional { background: var(--seg-octroi_de_mer_regional); }
.stack__part--tva { background: var(--seg-tva); }
.stack__part--taxation_forfaitaire { background: var(--seg-taxation_forfaitaire); }
.stack__part--tdl { background: var(--seg-tdl); }
.stack__part--tgc { background: var(--seg-tgc); }
.stack__part--autres_taxes { background: var(--seg-autres_taxes); }
.stack__part--forfait_alcool { background: var(--seg-forfait_alcool); }
.stack__part--droit_de_quai { background: var(--seg-droit_de_quai); }
.stack__part--taxe_entree { background: var(--seg-taxe_entree); }
.stack__part--droit_entree { background: var(--seg-droit_entree); }
.stack__part--taxe_speciale { background: var(--seg-taxe_speciale); }
.stack__part--fees { background: var(--seg-fees); }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    padding: 0;
    margin: 10px 0 18px;
    list-style: none;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.legend__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: baseline;
}

.breakdown {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
    font-variant-numeric: tabular-nums;
}

.breakdown th,
.breakdown td {
    padding: 9px 6px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.breakdown thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

.breakdown tbody th {
    font-weight: 500;
}

.breakdown small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.breakdown .num {
    text-align: right;
    white-space: nowrap;
}

.breakdown__muted {
    color: var(--text-muted);
}

.breakdown__subtotal th,
.breakdown__subtotal td {
    font-weight: 700;
    background: var(--surface-2);
}

.breakdown tfoot th,
.breakdown tfoot td {
    font-weight: 800;
    font-size: 1.02rem;
    border-bottom: 0;
    padding-top: 12px;
}

.result__subtitle {
    margin: 20px 0 8px;
    font-size: 1rem;
}

.result__hint {
    margin: -4px 0 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breakdown--carriers .pill {
    font-size: 0.72rem;
    padding: 1px 7px;
    margin-left: 4px;
}

.breakdown--carriers tr.is-chosen th,
.breakdown--carriers tr.is-chosen td {
    background: var(--lagoon-soft);
}

.items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.items__row {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.items__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-variant-numeric: tabular-nums;
}

.items__meta {
    margin: 2px 0 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.items__taxes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.notices {
    margin: 16px 0 0;
    padding: 12px 14px 12px 32px;
    background: var(--surface-2);
    border-left: 3px solid var(--sun);
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    color: var(--text-muted);
}

.notices li + li {
    margin-top: 6px;
}

.result__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

/* ---------- How it works ---------- */

.how__steps {
    counter-reset: how;
    list-style: none;
    padding: 0;
    margin: 12px 0 16px;
    display: grid;
    gap: 14px;
}

.how__steps li {
    counter-increment: how;
    display: grid;
    grid-template-columns: 32px 1fr;
    column-gap: 10px;
}

.how__steps li::before {
    content: counter(how);
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ocean-700);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.how__steps span {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.how__formula {
    margin: 0;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--lagoon-soft);
    overflow-x: auto;
}

.how__more {
    margin: 16px 0 0;
    font-weight: 600;
}

/* ---------- Content pages ---------- */

.content {
    margin-top: -56px;
    position: relative;
    padding-bottom: 48px;
    display: grid;
    /* minmax(0, …) keeps a wide table from stretching the column: it scrolls inside .table-wrap instead. */
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.prose {
    max-width: 75ch;
}

.prose h2 {
    font-size: 1.35rem;
    margin: 28px 0 10px;
}

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

.prose p,
.prose li {
    color: var(--text);
}

.prose .formula {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--lagoon-soft);
    overflow-x: auto;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rates {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.rates th,
.rates td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.rates thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.rates td.num,
.rates th.num {
    text-align: center;
    white-space: nowrap;
}

.rates small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.rates--compact {
    min-width: 0;
    max-width: 640px;
}

.rates__subtitle {
    font-size: 1.02rem;
    margin: 22px 0 6px;
}

.rates tbody tr:hover {
    background: var(--surface-2);
}

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--lagoon-soft);
    color: var(--lagoon);
    font-weight: 600;
}

.pill--muted {
    background: var(--surface-2);
    color: var(--text-muted);
}

.pill--elevee {
    background: var(--lagoon-soft);
    color: var(--lagoon);
}

.pill--moyenne {
    background: rgb(255 179 71 / 0.18);
    color: #a8620a;
}

.pill--faible {
    background: var(--error-soft);
    color: var(--error);
}

@media (prefers-color-scheme: dark) {
    .pill--moyenne {
        color: var(--sun);
    }

    .pill--faible {
        color: #ff8f7a;
    }
}

.fact .fact__source {
    margin-top: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
}

.fact__source .pill {
    font-size: 0.75rem;
    margin-right: 4px;
}

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.fact {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.fact h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.fact p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.fact .fact__value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

/* ---------- API documentation ---------- */

.docs {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
}

.docs__toc {
    position: sticky;
    top: 16px;
    padding: 18px 20px;
}

.docs__toc-title {
    margin: 0 0 8px;
    font-weight: 700;
}

.docs__toc ol {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
}

.docs__main {
    display: grid;
    gap: 24px;
    min-width: 0;
}

.site-footer__territories {
    margin: 0 0 8px;
    font-size: 0.85rem;
}

/* Error pages (404, 500…). */
.error-page {
    display: grid;
    gap: 18px;
}

.error-page__cta {
    margin: 0;
}

.error-page__links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 12px 32px;
}

.error-page__links ul {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 6px;
}

/* Territory pages (/octroi-de-mer/…). */
.territory__cta {
    margin: 18px 0 0;
}

a.btn,
a.btn:hover {
    text-decoration: none;
}

a.btn--primary:hover {
    color: #fff;
}

.doc-table td small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Product names and examples wrap, unlike the API field names. */
.territory__table td:first-child {
    white-space: normal;
}

.territory__table {
    min-width: 520px;
}

.territory__links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 6px 20px;
    padding-left: 20px;
}

/* Product pages (/octroi-de-mer/produit/…). */
.category__facts {
    margin-top: 18px;
}

.category__warning {
    padding-left: 14px;
}

.category__table td small a {
    color: inherit;
}

/* SEO content under the simulator: a card per block, FAQ as disclosure widgets. */
.seo {
    display: grid;
    gap: 24px;
    padding-bottom: 48px;
}

.seo__territories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.seo__territory {
    display: grid;
    gap: 4px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s;
}

.seo__territory:hover {
    color: var(--text);
    border-color: var(--lagoon);
    transform: translateY(-1px);
}

.seo__territory strong {
    font-size: 1.02rem;
}

.seo__territory span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.seo__territory em {
    font-style: normal;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ocean-500);
}

.faq {
    display: grid;
    gap: 8px;
}

.faq details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 12px 16px;
}

.faq summary {
    cursor: pointer;
    font-weight: 700;
}

.faq details[open] summary {
    margin-bottom: 8px;
}

.faq details p {
    margin: 0;
    color: var(--text-muted);
}

/* Guide and legal pages: same table of contents as the API documentation, next to the article. */
.guide {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.guide > .prose {
    min-width: 0;
}

.prose h2[id],
#prelevements {
    scroll-margin-top: 16px;
}

@media (max-width: 920px) {
    .guide {
        grid-template-columns: minmax(0, 1fr);
    }
}

.docs__main > article {
    scroll-margin-top: 16px;
    /* Let long code lines scroll inside their block instead of widening the page. */
    min-width: 0;
}

.prose--wide {
    max-width: none;
}

.prose h3 {
    font-size: 1.05rem;
    margin: 22px 0 8px;
}

.prose :not(pre) > code {
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.85em;
    overflow-wrap: anywhere;
}

.docs__note {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.method {
    display: inline-block;
    min-width: 48px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #1a7aa3;
    color: #fff;
    font: 700 0.75rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
    text-align: center;
    vertical-align: middle;
}

.method--post {
    background: var(--lagoon);
}

h2 .method {
    font-size: 0.85rem;
    margin-right: 6px;
}

.doc-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 12px 0;
}

.doc-table th,
.doc-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.doc-table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.doc-table td:first-child {
    white-space: nowrap;
}

/* Sentences rather than codes in the first column. */
.doc-table--text td:first-child {
    white-space: normal;
    min-width: 14ch;
}

.code-block {
    position: relative;
    margin: 10px 0 16px;
}

.code-block pre,
.console pre {
    margin: 0;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: #0b1d26;
    color: #d8ecf3;
    font: 0.84rem/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
    overflow: auto;
    max-height: 480px;
    tab-size: 2;
}

.code-block__label {
    position: absolute;
    top: 8px;
    left: 14px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7fa7bd;
}

.code-block__label + .code-block__copy + pre {
    padding-top: 32px;
}

.code-block__copy {
    position: absolute;
    top: 8px;
    right: 8px;
    font: 600 0.75rem var(--font);
    color: #d8ecf3;
    background: rgb(255 255 255 / 0.08);
    border: 1px solid rgb(255 255 255 / 0.16);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
}

.code-block__copy:hover {
    background: rgb(255 255 255 / 0.16);
}

.console {
    display: grid;
    gap: 10px;
}

.console > * {
    min-width: 0;
}

.console__input {
    width: 100%;
    font: 0.88rem/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    resize: vertical;
}

.console__input:focus {
    outline: none;
    border-color: var(--ocean-500);
    box-shadow: 0 0 0 3px rgb(26 122 163 / 0.22);
}

.console__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.console__status {
    margin: 6px 0;
    font-weight: 700;
}

.console__status--ok {
    color: var(--lagoon);
}

.console__status--error {
    color: var(--error);
}

@media (max-width: 920px) {
    .docs {
        grid-template-columns: 1fr;
    }

    .docs__toc {
        position: static;
    }
}

/* ---------- House ads (Reboot Solution, Refactia) ---------- */

/* Brand colours: Reboot Solution red #ff1414, Refactia navy #1d2a43 and turquoise #01b5c8. */
.promo {
    --promo-from: #15171d;
    --promo-to: #4f0c10;
    --promo-glow: rgb(255 20 20 / 0.42);
    --promo-ink: #d10f0f;
    --promo-check: #ff5a5a;
    position: relative;
    overflow: hidden;
    container-type: inline-size;
    margin-top: 16px;
    border-radius: var(--radius);
    color: #fff;
    background:
        radial-gradient(circle at 105% -10%, var(--promo-glow), transparent 45%),
        radial-gradient(circle at -10% 120%, rgb(255 255 255 / 0.08), transparent 40%),
        linear-gradient(135deg, var(--promo-from), var(--promo-to));
    box-shadow: var(--shadow);
}

.promo--refactia {
    --promo-from: #1d2a43;
    --promo-to: #0a6f80;
    --promo-glow: rgb(1 181 200 / 0.5);
    --promo-ink: #1d2a43;
    --promo-check: #3fd6e6;
}

.promo :focus-visible {
    outline-color: #fff;
}

.promo__inner {
    display: grid;
    gap: 16px;
    padding: 22px 22px 24px;
}

.promo__body {
    display: grid;
    gap: 12px;
    min-width: 0;
}

/* The illustration only shows when the card is wide enough to keep the text comfortable. */
.promo__visual {
    display: none;
}

.promo__visual svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 18px rgb(0 0 0 / 0.25));
}

@container (min-width: 580px) {
    .promo__inner {
        grid-template-columns: minmax(0, 1fr) 160px;
        align-items: center;
        gap: 22px;
        padding: 26px 28px;
    }

    .promo__visual {
        display: block;
    }
}

.promo__meta {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
}

.promo__logo {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 5px;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
    color: var(--promo-ink);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.promo__logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.promo__brand {
    font-size: 0.9rem;
    font-weight: 700;
}

.promo__label {
    margin-left: auto;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.14);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(255 255 255 / 0.85);
}

.promo__title {
    margin: 2px 0 0;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.promo__text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgb(255 255 255 / 0.82);
}

.promo__points {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.promo__points li {
    padding: 4px 11px;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.12);
    border: 1px solid rgb(255 255 255 / 0.2);
    font-size: 0.76rem;
    font-weight: 600;
}

.promo__argument {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin: 0;
    font-size: 0.86rem;
    font-weight: 600;
}

.promo__argument::before {
    content: "✓";
    flex: none;
    font-weight: 800;
    color: var(--promo-check);
}

.promo__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    margin-top: 4px;
    padding: 11px 20px;
    border-radius: 999px;
    background: #fff;
    color: var(--promo-ink);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 20px rgb(0 0 0 / 0.22);
    transition: transform 0.15s, box-shadow 0.15s;
}

.promo__cta:hover {
    color: var(--promo-ink);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgb(0 0 0 / 0.28);
}

.promo__cta span {
    transition: transform 0.15s;
}

.promo__cta:hover span {
    transform: translateX(3px);
}

.promo-band {
    padding-block: 8px 40px;
}

.promo-band__title {
    margin: 0 0 6px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.promo-band__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 18px;
}

.promo-band .promo {
    margin-top: 6px;
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.87rem;
    color: var(--text-muted);
}

.site-footer__inner {
    padding-block: 22px 28px;
}

.site-footer p {
    margin: 0 0 8px;
    max-width: 90ch;
}

.site-footer__meta {
    font-size: 0.8rem;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--ocean-500);
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    color: var(--lagoon);
}

/* ---------- Cookie consent ---------- */

.consent {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgb(6 52 74 / 0.12);
}

.consent__inner {
    display: flex;
    align-items: center;
    gap: 14px 28px;
    padding-block: 16px;
}

.consent__text {
    flex: 1;
    font-size: 0.9rem;
}

.consent__text p {
    margin: 0;
}

.consent__title {
    font-weight: 700;
}

.consent__actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Refusing must be as easy and visible as accepting: both buttons look the same. */
.consent__button {
    background: var(--ocean-700);
    color: #fff;
    padding: 10px 24px;
}

.consent__button:hover {
    background: var(--ocean-500);
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
    .layout {
        /* minmax(0, …): a wide table scrolls in its card instead of widening the page. */
        grid-template-columns: minmax(0, 1fr);
    }

    .result-panel {
        position: static;
    }
}

@media (max-width: 560px) {
    .card {
        padding: 18px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .article__grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.6fr);
    }

    .article__grid > :first-child {
        grid-column: 1 / -1;
    }

    .hero {
        padding-block: 28px 100px;
    }

    .breakdown {
        font-size: 0.86rem;
    }

    .breakdown th,
    .breakdown td {
        padding: 8px 4px;
    }

    .consent__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .consent__button {
        flex: 1;
    }
}

/* ---------- Print ---------- */

@media print {
    .consent,
    .promo,
    .promo-band,
    .site-header,
    .hero,
    .card--form,
    .result__actions,
    .site-nav {
        display: none !important;
    }

    .layout {
        display: block;
        margin: 0;
    }

    .card {
        box-shadow: none;
        border: 0;
    }

    .stack__part,
    .legend__dot {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}
