/* ==========================================================================
   PAGES LEGALES - thomasgensse.fr
   Meme identite que style.css : angles droits, aucun flou, polices systeme,
   palette rouge / or / noir / blanc / gris. Theme clair (le site public
   est clair), sommaire colle a gauche, tableaux qui deviennent des cartes
   sur mobile. A placer a la racine du site, a cote des deux pages HTML.
   ========================================================================== */

:root {
    --rouge: #b40000;
    --rouge-fonce: #8a0000;
    --or: #c9a96e;
    --or-clair: #e8d5b0;
    --noir: #0a0a0a;
    --noir-soft: #1a1a1a;
    --gris-fonce: #2c2c2a;
    --gris-mid: #6b6b6b;
    --gris-clair: #e8e6e1;
    --blanc: #fafaf8;
    --blanc-pur: #ffffff;

    --line: rgba(10, 10, 10, 0.1);
    --line-or: rgba(201, 169, 110, 0.35);

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --wrap: 76rem;
    --topbar: 4.5rem;
    --gutter: clamp(1.1rem, 4vw, 3rem);
    --pad-x: max(var(--gutter), calc((100% - var(--wrap)) / 2));
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--topbar) + 1.5rem);
    scrollbar-width: thin;
    scrollbar-color: var(--gris-clair) var(--blanc);
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding-top: var(--topbar);
    overflow-x: clip;
    color: var(--noir);
    font: 400 1.0625rem/1.7 var(--sans);
    background: var(--blanc);
    -webkit-font-smoothing: antialiased;
}

::selection {
    color: #fff;
    background: var(--rouge);
}

img {
    max-width: 100%;
}

:where(h1, h2, h3) {
    text-wrap: balance;
}

:where(p, li) {
    text-wrap: pretty;
    overflow-wrap: break-word;
}

.skip {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10000;
    padding: 0.7rem 1rem;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    background: var(--rouge);
    transform: translateY(-200%);
}

.skip:focus {
    transform: none;
}


/* ---------- Barre du haut ---------- */
.topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--topbar);
    padding: 0 var(--gutter);
    background: var(--noir);
    border-bottom: 1px solid var(--line-or);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.brand img {
    width: 2.4rem;
    height: 2.4rem;
    object-fit: cover;
    border: 1px solid var(--line-or);
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.brand-text strong {
    font: 600 1.05rem/1.2 var(--serif);
    white-space: nowrap;
}

.brand-text small {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.76rem;
}

.retour {
    flex: 0 0 auto;
    padding: 0.6rem 1.1rem;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.retour:hover,
.retour:focus-visible {
    background: var(--rouge);
    border-color: var(--rouge);
}


/* ---------- Page ---------- */
.legal {
    flex: 1 0 auto;
    padding: clamp(2.5rem, 6vw, 5rem) var(--pad-x) clamp(3rem, 7vw, 6rem);
}

.legal-head {
    max-width: 50rem;
    margin-bottom: clamp(2rem, 5vw, 3.5rem);
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gris-clair);
}

.legal-head h1 {
    margin: 0 0 1rem;
    color: var(--noir);
    font: 600 clamp(2.1rem, 5.5vw, 3.4rem) / 1.05 var(--serif);
    letter-spacing: -0.01em;
}

.legal-head p {
    max-width: 62ch;
    margin: 0 0 0.6rem;
    color: var(--gris-mid);
}

.legal-head .maj {
    margin-top: 1.25rem;
    padding-left: 0.9rem;
    color: var(--noir);
    font-size: 0.95rem;
    border-left: 3px solid var(--rouge);
}

.legal-body {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
}

.toc {
    position: sticky;
    top: calc(var(--topbar) + 2rem);
    max-height: calc(100dvh - var(--topbar) - 4rem);
    overflow-y: auto;
}

.toc-title {
    margin: 0 0 0.75rem;
    color: var(--noir);
    font: 600 1.1rem/1.2 var(--serif);
}

.toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc a {
    display: block;
    padding: 0.35rem 0 0.35rem 0.85rem;
    color: var(--gris-mid);
    font-size: 0.92rem;
    line-height: 1.4;
    text-decoration: none;
    border-left: 2px solid var(--gris-clair);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.toc a:hover,
.toc a:focus-visible {
    color: var(--noir);
    border-left-color: var(--rouge);
}

.legal-content {
    min-width: 0;
}

.legal-content section {
    padding: 2.25rem 0;
    border-top: 1px solid var(--gris-clair);
}

.legal-content section:first-child {
    padding-top: 0;
    border-top: 0;
}

.legal-content h2 {
    margin: 0 0 1rem;
    padding-left: 0.85rem;
    color: var(--rouge);
    font: 600 clamp(1.35rem, 2.5vw, 1.8rem) / 1.25 var(--serif);
    border-left: 3px solid var(--rouge);
}

.legal-content h3 {
    margin: 1.75rem 0 0.5rem;
    color: var(--noir);
    font: 600 1.02rem/1.4 var(--sans);
}

.legal-content p {
    max-width: 70ch;
    margin: 0 0 1rem;
}

.legal-content ul {
    max-width: 70ch;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.legal-content li {
    position: relative;
    padding: 0.25rem 0 0.25rem 1.3rem;
}

.legal-content li::before {
    position: absolute;
    top: 0.95em;
    left: 0;
    width: 0.42rem;
    height: 0.42rem;
    content: "";
    background: var(--rouge);
}

.legal-content a {
    color: var(--rouge);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--or);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
    transition: color 0.2s ease;
}

.legal-content a:hover {
    color: var(--rouge-fonce);
}

.legal-content strong {
    color: var(--noir);
    font-weight: 600;
}

.fiche {
    display: grid;
    grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
    gap: 0.7rem 1.5rem;
    margin: 0 0 1.25rem;
    padding: 1.4rem 1.6rem;
    background: var(--blanc-pur);
    border: 1px solid var(--gris-clair);
    border-left: 3px solid var(--or);
}

.fiche dt {
    color: var(--gris-mid);
}

.fiche dd {
    margin: 0;
    color: var(--noir);
    overflow-wrap: anywhere;
}

.encart {
    max-width: 70ch;
    margin: 0 0 1.25rem;
    padding: 1.1rem 1.4rem;
    background: var(--blanc-pur);
    border: 1px solid var(--gris-clair);
    border-left: 3px solid var(--rouge);
}

.encart p:last-child {
    margin-bottom: 0;
}

mark.todo {
    padding: 0.05em 0.35em;
    color: var(--noir);
    background: rgba(180, 0, 0, 0.09);
    outline: 1px dashed var(--rouge);
    outline-offset: 1px;
}

.table-wrap {
    margin: 0 0 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.97rem;
    background: var(--blanc-pur);
}

caption {
    padding: 0 0 0.6rem;
    color: var(--gris-mid);
    font-size: 0.93rem;
    text-align: left;
}

th,
td {
    padding: 0.8rem 1rem;
    text-align: left;
    vertical-align: top;
    border: 1px solid var(--gris-clair);
}

th {
    color: #fff;
    font-weight: 600;
    background: var(--noir);
}

td:first-child {
    color: var(--noir);
    font-weight: 600;
}

.btn {
    display: inline-block;
    min-height: 2.9rem;
    padding: 0.7rem 1.4rem;
    color: var(--noir);
    font: 600 1rem/1.2 var(--sans);
    text-decoration: none;
    background: var(--blanc-pur);
    border: 1px solid var(--gris-clair);
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
    color: #fff;
    background: var(--rouge);
    border-color: var(--rouge);
}


/* ---------- Pied de page ---------- */
.legal-footer {
    padding: 2rem var(--pad-x) calc(2rem + env(safe-area-inset-bottom, 0px));
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.92rem;
    background: var(--noir);
}

.legal-footer > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 2rem;
}

.legal-footer p {
    margin: 0;
}

.legal-footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.legal-footer a,
.legal-footer button {
    padding: 0;
    color: rgba(255, 255, 255, 0.8);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: 0;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.legal-footer a:hover,
.legal-footer a:focus-visible,
.legal-footer button:hover,
.legal-footer button:focus-visible,
.legal-footer a[aria-current="page"] {
    color: #fff;
    border-bottom-color: var(--or);
}

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


/* ---------- Tablette / mobile ---------- */
@media (max-width: 900px) {

    :root {
        --topbar: 4rem;
    }

    .legal-body {
        display: block;
    }

    .toc {
        position: static;
        max-height: none;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid var(--gris-clair);
    }

    .toc ol {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
        gap: 0 1.5rem;
    }
}

@media (max-width: 700px) {

    .fiche {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.15rem;
        padding: 1.1rem 1.1rem 1.25rem;
    }

    .fiche dd {
        margin-bottom: 0.7rem;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    tr {
        margin-bottom: 0.9rem;
        background: var(--blanc-pur);
        border: 1px solid var(--gris-clair);
    }

    td {
        border: 0;
        border-bottom: 1px solid var(--gris-clair);
    }

    td:last-child {
        border-bottom: 0;
    }

    td::before {
        display: block;
        margin-bottom: 0.15rem;
        color: var(--gris-mid);
        font-size: 0.85rem;
        font-weight: 400;
        content: attr(data-label);
    }

    td:first-child::before {
        content: none;
    }

    .brand-text small {
        display: none;
    }
}

@media (max-width: 600px) {

    .retour {
        padding: 0.55rem 0.9rem;
        font-size: 0.9rem;
    }

    .legal-footer > div {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media print {

    .topbar,
    .toc,
    .legal-footer,
    .btn {
        display: none;
    }

    body {
        padding-top: 0;
        color: #000;
        background: #fff;
    }

    .legal-content h2,
    .legal-content strong,
    .legal-content a,
    .fiche dd,
    td:first-child {
        color: #000;
    }
}
