/* Font face declarations */
@font-face {
    font-family: 'AUTHENTIC Sans';
    src: url('fonts/authentic-sans-60.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'AUTHENTIC Sans';
    src: url('fonts/authentic-sans-90.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'AUTHENTIC Sans';
    src: url('fonts/authentic-sans-130.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'AUTHENTIC Sans';
    src: url('fonts/authentic-sans-150.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

/* Variables CSS */
:root {
    --color-text: #000000;
    --color-background: #FFFFFF;
    --color-accent: #FF0000;

    /* Marker status colors */
    --marker-active: #000000;
    /* Active: at least one future event */
    --marker-en-formation: #888888;
    /* En formation: no events at all */
    --marker-endormi: #888888;
    /* Endormi: no events in last 4 months */

    --gutter: 2rem;
    --gutters: calc(2 * var(--gutter));
    --section-full: calc(100vw - var(--gutters));
    --section-max: min(1200px, var(--section-full));


    --section-min-width: 1080px;
    --section-max-width: 1200px;
    --section-min-width-desktop: 1080px;
    --section-max-width-desktop: 1200px;
    --section-min-width-tablet: ;
    --section-max-width-tablet: ;
    --section-min-width-mobile: ;
    --section-max-width-mobile: ;
    --spacing-xsmall: 0.5rem;
    --spacing-small: 1rem;
    --spacing-normal: 2rem;
    --spacing-large: 4rem;
    --spacing-xlarge: 6rem;

    /* Font styles - fluid scaling with clamp() */
    --font-geant: 600 clamp(64px, 9vw, 112px)/1.05 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-tres-grand: 600 clamp(48px, 7vw, 78px)/1.2 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-colophon: 400 clamp(28px, 5vw, 42px)/1.25 'AUTHENTIC Sans', system-ui, sans-serif;

    --font-colophon-bold: 600 clamp(28px, 5vw, 42px)/1.25 'AUTHENTIC Sans', system-ui, sans-serif;

    --font-normal-bold: 600 clamp(24px, 2.5vw, 32px)/1.2 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-normal: 400 clamp(24px, 2.5vw, 32px)/1.2 'AUTHENTIC Sans', system-ui, sans-serif;

    --font-grand: 400 clamp(28px, 5vw, 32px)/1.25 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-grand-bold: 600 clamp(28px, 5vw, 32px)/1.25 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-moyen-gras: 700 20px/24px 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-moyen: 400 20px/24px 'AUTHENTIC Sans', system-ui, sans-serif;
    --font-menu: 300 22px/26px 'AUTHENTIC Sans', system-ui, sans-serif;

    /* Step animation timing */
    --step-animation-delay: 0.5s;
}

/* Minimal reset - site specific */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: var(--font-moyen);
    color: var(--color-text);
    background: var(--color-background);
    position: relative;
    min-height: 100vh;
    overflow-x: clip;
    /* Prevent horizontal scroll from wave animation */
}

/* Hide SVG symbol definitions */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

h1,
h2 {
    text-align: center;
}

h1 {
    font: var(--font-geant);
}

h2 {
    font: var(--font-tres-grand);
}

h1,
h2,
h3 {
    text-wrap: pretty;
}

/* Focus outline for keyboard navigation */
:focus-visible {
    outline: 0.8px solid var(--color-text);
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Reset lists only where needed (nav, grids, custom components) */
#main-nav ul,
#benefits ul,
.testimonials,
#steps .infographic ol,
.circles-list,
figure.co2-compare ul.histogram,
#mobile-search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}

a {
    text-decoration: none;
    color: inherit;
    text-underline-offset: 5px;
    transition: text-underline-offset 0.1s;

    &:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
    }
}

img {
    max-width: 100%;
    height: auto;
}

hr {
    margin: 0;
    border: 0;
}

p {
    margin-block-start: 0;
    margin-block-end: 1em;
    text-wrap: pretty;
}

/* Workaround for the missing œ character in AUTHENTIC Sans */
o-e {
    letter-spacing: -0.15em;
    margin-inline-end: 0.15em;
}

/* Workaround for the missing ê character in AUTHENTIC Sans */
e-circ {
    letter-spacing: -0.52em;
    margin-inline-end: 0.52em;
}


/* Fix superscript messing up line-height */
sup,
sub {
    line-height: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;

    &:focus {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        height: auto;
        padding: 1em 2em;
        margin: 0;
        overflow: visible;
        clip: auto;
        white-space: normal;
        z-index: 9999;
        background: var(--color-text);
        color: var(--color-background);
        font: var(--font-moyen-gras);
    }
}

/* Layout principal */

main {
    padding: 0;
}

main section {
    max-width: min(var(--section-max-width), calc(100vw - 4rem));
    margin: var(--spacing-xlarge) auto;
}

/* Header */
#site-header {
    display: flex;
    align-items: center;
    padding: 20px;
    height: 66px;
    width: 100%;
    border-bottom: 1px solid var(--color-text);

    nav {
        display: flex;
        gap: 30px;
        margin-left: auto;

        a {
            font: var(--font-menu);
        }
    }
}

#header-bar {
    display: contents;
}

#site-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font: var(--font-menu);

    img,
    svg {
        width: 44px;
        height: 44px;
    }

    &:hover {
        text-decoration: none;
    }
}

/* Hamburger menu button - hidden on desktop */
#menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 44px;
    height: 44px;
    position: relative;

    span span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--color-text);
        position: absolute;
        left: 10px;
        transition: transform 0.3s, opacity 0.3s;

        &:nth-child(1) {
            top: 14px;
        }

        &:nth-child(2) {
            top: 21px;
        }

        &:nth-child(3) {
            top: 28px;
        }
    }

    &[aria-expanded="true"] span span {
        &:nth-child(1) {
            transform: rotate(45deg);
            top: 21px;
        }

        &:nth-child(2) {
            opacity: 0;
        }

        &:nth-child(3) {
            transform: rotate(-45deg);
            top: 21px;
        }
    }
}



/* Section intro */
#intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 65px);
    width: var(--section-min-width);

    p {
        font: var(--font-grand);
    }
}

.digit {
    width: 48px;
    aspect-ratio: 48/66;
    stroke-width: 3px;
}

/* Hero animation - positioned between intro and hero section */
#hero-animation {
    width: 100%;
    height: 1600px;
    margin-top: -500px;
    margin-bottom: -500px;
    pointer-events: none;
}

/* Section hero */

.wave-path {
    fill: none;
    stroke: var(--color-text);
    stroke-width: 1.5;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

/* Section benefits - container query for 4-col/2-col/mobile reflow */
#benefits {

    container-type: inline-size;


    ul {
        display: grid;
        justify-content: center;
        grid-template-columns: repeat(4, 240px);
        gap: 2rem;
        margin-bottom: var(--spacing-large);

        li {
            text-align: center;

            img {
                aspect-ratio: 1;
                max-width: min(128px, 45cqw);
                margin-inline: auto;
            }

            h3 {
                font: var(--font-moyen-gras);
                margin-bottom: 0.5rem;
                text-wrap: balance;
                text-align: left;
                hyphens: auto;
            }

            p {
                text-align: left;
                font: var(--font-moyen);

            }
        }
    }


    @container (max-width: 900px) {
        ul {
            grid-template-columns: repeat(2, 240px);
        }
    }

    @container (max-width: 500px) {
        ul {
            grid-template-columns: 1fr 1fr;
            gap: 1rem;

            li {
                letter-spacing: -0.2px;
                margin-bottom: 1rem;

                p {
                    font-size: calc(1cqw + 16px);
                    margin-top: 0;
                    margin-bottom: auto;
                    hyphens: auto;
                }
            }
        }
    }



}

/* Section divider */
.section-divider {
    width: 100%;
    height: 1px;
    background: var(--color-text);
    margin: var(--spacing-normal) 0;
}

/* Section steps - completely override main section defaults */
#steps {
    position: relative;
    overflow: visible;
}

.steps-content {}



.steps-content>p {
    font: var(--font-grand);
    margin: 0 auto;

}

/* Base button styles */
.button {
    display: inline-block;
    background: var(--color-background);
    border: 1px solid var(--color-text);
    text-align: center;
    color: var(--color-text);
    cursor: pointer;

    &:hover {
        text-decoration: none;
        background: var(--color-text);
        color: var(--color-background);
    }
}



.cta {
    position: relative;
    z-index: 10;
    display: block;
    margin: 8rem auto 6rem;
    text-align: center;
    white-space: nowrap;
}

.cta a {
    padding: 2rem;
    font: var(--font-grand);
    margin: 0 auto;
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    width: 100%;
    margin-block-start: var(--spacing-xlarge);
    border-top: 1px solid var(--color-text);

    nav {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    address {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
        font-style: normal;
    }

    a {
        font: var(--font-menu);
    }
}

/* ===========================================
   STEPS SECTION - Mobile First
   Base: Simple centered list
   Tablet+: Complex circular arrangement
   =========================================== */

/* Mobile: no special wrapper styling needed */

/* Mobile: hide wave animation and circle SVG */
/* Mobile: hide wave animation (contains circle too) */
#steps .wave-wrapper #wave-animation {
    display: none;
}

/* Mobile: simple centered list */
#steps .infographic ol {
    margin: 0 auto;
    max-width: 400px;
}

#steps figure { margin:0; }

#steps .infographic ol li {
    position: static;
    /* Ensure normal document flow on mobile */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
    font: var(--font-grand-bold);
    text-wrap: pretty;
    width: auto;
    /* Reset any width constraints */
    aspect-ratio: auto;
    /* No forced aspect ratio on mobile */
}

#steps .infographic ol li a {
    display: contents;
    text-decoration: none;
}

/* Mobile: digit SVG centered above text */
#steps .infographic ol li .digit {
    position: static;
    /* Normal flow, not absolute */
    display: block;
    width: 36px;
    height: 50px;
    margin-bottom: 0.75rem;
    overflow: visible;
    /* Allow non-scaling stroke to extend */
}

/* Mobile: hide tails (only shown in circular desktop layout) */
#steps .infographic ol li .tail {
    display: none;
}

/* ===========================================
   STEPS - Tablet+ Layout (circular arrangement)
   =========================================== */
@media (min-width: 769px) {

    /* Wrapper just holds the two layers */
    #steps .wave-wrapper {
        position: relative;
    }

    /* Wave animation - full viewport width, behind everything */
    #steps .wave-wrapper #wave-animation {
        display: block;
        position: absolute;
        left: calc(-50vw + 50%);
        width: 100vw;
        top: -15%;
        height: 130%;
        z-index: 0;
        pointer-events: none;
    }

    #steps .wave-wrapper #wave-animation svg {
        width: 100%;
        height: 100%;
    }

    /* OL is the main sizing element and container for cqw units */
    #steps .infographic ol {
        position: relative;
        width: min(1280px, calc(100% - 4rem));
        max-width: none;
        aspect-ratio: 1;
        margin: 0 auto;
        z-index: 1;
        container-type: size;
    }

    /* Circle as pseudo-element on OL */
    #steps .infographic ol::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 42%;
        aspect-ratio: 1;
        transform: translate(-50%, -50%);
        border: 1.5px solid black;
        border-radius: 50%;
        pointer-events: none;
    }

    /* Step boxes - all sizing relative to OL */
    #steps .infographic ol li {
        position: absolute;
        text-align: left;
        font-size: 2.2cqw;
        display: block;
        margin: 0;
        aspect-ratio: 1;
        /* Square box, stable for tail positioning */
    }

    /* Inline SVG digit styling (cqw units for OL-relative sizing) */
    #steps .infographic ol li .digit {
        position: absolute;
        top: max(-6.5cqw, -54px);
        left: -.5cqw;
        width: 3cqw;
        aspect-ratio: 36 / 50;
        stroke-width: 0.25cqw;
        overflow: visible;
        /* Allow non-scaling stroke to extend */

    }

    /* Tails connecting boxes to circle - SVG elements sized in cqw (OL units) */
    #steps .infographic ol li .tail {
        display: block;
        /* Override mobile display: none */
        position: absolute;
        width: 5cqw;
        /* % of OL width - consistent across all tails */
        aspect-ratio: 50 / 61;
        overflow: visible;
        /* Allow non-scaling stroke to extend */
        transform-origin: center;
        z-index: -1;
        stroke-width: min(0.25cqw, 1.5px);
    }

    /* Tail positions set in steps-positioning.css (cqw from nearest edge) */

    /* Per-step absolute positions (fallbacks - overridden by steps-positioning.css) */
    #steps .infographic ol li:nth-child(1) {
        top: 10%;
        left: 2.5%;
    }

    #steps .infographic ol li:nth-child(2) {
        top: 6.25%;
        left: 60%;
    }

    #steps .infographic ol li:nth-child(3) {
        top: 31.25%;
        left: 66.25%;
    }

    #steps .infographic ol li:nth-child(4) {
        top: 56.25%;
        left: 66.25%;
    }

    #steps .infographic ol li:nth-child(5) {
        top: 77.5%;
        left: 60%;
    }

    #steps .infographic ol li:nth-child(6) {
        top: 85%;
        left: 12.5%;
    }

    #steps .infographic ol li:nth-child(7) {
        top: 56.25%;
        left: 2.5%;
    }

    #steps .infographic ol li:nth-child(8) {
        top: 31.25%;
        left: 2.5%;
    }

}

/* Responsive Breakpoints */

/* Testimonials grid - auto-reflows 1/2/3 columns
       Inscribed square math: padding = (1 - 1/√2) / 2 ≈ 15% */
.testimonials {
    margin: 6rem auto;
    max-width: var(--section-max-width);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 400px));
    justify-content: center;
    gap: clamp(2rem, 5vw, 4rem);

    li {
        position: relative;
        aspect-ratio: 1;
        padding: 26% 12%;
        border: 2px solid var(--color-text);
        border-radius: 49%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin-block: var(--spacing-normal);

        &:nth-child(even) {
            margin-top: -2rem;

            .tail {
                transform: rotate(180deg);
                left: auto;
                right: 70px;
            }
        }

        .tail {
            position: absolute;
            bottom: -35px;
            left: 80px;
            width: 50px;
            height: 61px;
            transform: rotate(90deg);
            stroke-width: 1.5px;
        }
    }

    blockquote {
        margin: 0;
        font: var(--font-moyen-gras);
        font-size: clamp(14px, 4vw, 20px);
        line-height: 1.2;

        p {
            margin: 0;
        }
    }

    cite {
        font: var(--font-moyen);
        font-size: clamp(12px, 3vw, 14px);
        line-height: 1rem;
        font-style: normal;

        strong {
            font-weight: 700;
        }
    }
}

/* Details/Summary - Accordion style */
main details {
    border-top: 1px solid currentColor;
    interpolate-size: allow-keywords;

    &::details-content {
        height: 0;
        overflow: clip;
        transition: height 0.3s ease, content-visibility 0.3s ease allow-discrete;
    }

    &[open]::details-content {
        height: auto;
    }

    summary {
        position: relative;
        cursor: pointer;
        list-style: none;
        margin-block: var(--spacing-normal);
        padding-right: 2em;

        &::-webkit-details-marker {
            display: none;
        }

        &::after {
            content: '';
            position: absolute;
            right: 0.5em;
            top: 0;
        }
    }
}

body.a-propos details {
    summary {
        img {
            display: block;
            width: 48px;
            margin: 0 auto var(--spacing-small);
        }

        h3 {
            font: var(--font-grand-bold);
            margin: 0;
            max-width: 50rem;
        }
    }

    &> :not(summary) {
        max-width: 50rem;
    }

    &>p,
    &>ul {
        font: var(--font-moyen);
        margin-top: var(--spacing-small);
    }

    &>p:first-of-type {
        margin-top: var(--spacing-normal);
    }
}

/* Wide screens: img positioned left */
@media (min-width: 768px) {
    #huit-etapes details {
        --step-img-size: 48px;
        --step-img-margin: var(--spacing-normal);
        padding-left: calc(var(--step-img-size) + var(--step-img-margin) * 2);

        summary {
            position: relative;

            svg {
                position: absolute;
                left: calc(-1 * (var(--step-img-size) + var(--step-img-margin)));
                top: 0;
                margin: 0;
                width: 48px;
                aspect-ratio: 48/66;
            }
        }
    }
}

/* À propos page - Section addiction */
#addiction {
    blockquote {
        max-width: 47ch;
        margin: 3rem auto;
        font: var(--font-normal);
        font-size: ;
        text-align: center;

        strong {
            font-weight: 600;
        }
    }
}

/* .intro: 2-column layout that reflows to 1-column
       on narrow portrait viewports (<900px AND taller than wide) */
.intro {
    columns: 2;
    column-gap: clamp(2rem, 5vw, 65px);
    max-width: var(--section-max-width);
    font: var(--font-grand);
    margin: 4rem auto;
}


#addiction .intro p {
    display: inline;
    margin: 0;
}

@media (max-width: 900px) and (aspect-ratio < 1) {
    .intro {
        columns: 1;
    }

    .intro p {
        display: block;
        margin-block: 1em;
    }

    .intro p:first-child {
        margin-block-start: 0;
    }
}

/* À propos page - Section huit-etapes */
#huit-etapes {
    .intro-bold {
        font: var(--font-grand-bold);
        text-align: center;
        max-width: 42ch;
        margin: 3rem auto;
    }

    .intro-text {
        font: var(--font-grand);
        text-align: center;
        max-width: 53ch;
        margin: 3rem auto 4em;
    }
}

/* À propos page - Section retablissement */
#retablissement {
    .source {
        margin-top: 2rem;
        font-style: italic;
    }
}


/* Current page nav link - uses body class set on each page */
body.a-propos #main-nav a[href="a-propos.html"],
body.les-cercles #main-nav a[href="les-cercles.html"],
body.colophon #main-nav a[href="colophon.html"] {
    font-weight: 600;
}

/* Colophon link: hidden by default, shown only on colophon page */
#site-header nav a.colophon-link {
    display: none;
}

body.colophon #site-header nav a.colophon-link {
    display: inline;
}

/* ==========================================================================
   Colophon Page Styles
   ========================================================================== */
body.colophon {
    main {
        font: var(--font-grand);

        section {
            padding-block: var(--spacing-small);
        }

        #conclusion {
            font: var(--font-colophon-bold);
            padding-block: 2em;
            text-align: center;
        }

        #dev {
            padding-bottom: var(--spacing-small);
        }

        a {
            text-decoration: underline;

            &:hover {
                opacity: 0.7;
            }
        }
    }

    section {
        font: var(--font-grand);
    }

    #coherence p {
        margin-block: 0;
    }

    #credits {
        margin-top: 4rem;
        font: var(--font-normal-bold);
    }

    a {
        text-underline-offset: 3px;
        text-decoration-thickness: 1px;

        &:hover {
            text-underline-offset: 2.5px;
            text-decoration-thickness: 2px;
        }
    }

    table {
        width: 100%;
        border-collapse: collapse;
        margin: 2rem 0;

        thead {
            border-bottom: 2px solid var(--color-text);
        }

        th {
            font-weight: 600;
            text-align: left;
            padding: 16px 12px;
        }

        td {
            padding: 16px 12px;
            border-bottom: 1px solid #333333;
        }

        tbody tr:last-child td {
            border-bottom: none;
        }
    }

    sup a {
        text-decoration: none;
        opacity: 0.6;

        &:hover {
            opacity: 1;
        }
    }


}

#manifeste {
    text-align: center;
    font: var(--font-colophon-bold);
}

#coherence {
    font: var(--font-colophon);
    text-align: center;
    text-wrap: pretty;
}

#politique-donnees {
    margin-block-end: 0.25rem;
    font: var(--font-grand);
}

#attribution {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));


    h2,
    h3,
    p {
        font: var(--font-grand);
        margin: 0;
        padding: 0;
        text-align: left;
    }

    h2 {

        a {
            text-decoration: none;
        }
    }

    h3 {
        font: var(--font-grand-bold);

    }

    ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    h2,
    li {
        margin-block-end: var(--spacing-normal);
    }
}

#sources {
    h3 {
        font: var(--font-grand);
    }

    dl {
        font: var(--font-moyen);
    }

    dt {
        font-weight: 600;
        margin-block-start: 1em;

        &::after {
            content: " :";
            color: transparent;
        }

        &:target::after {
            animation: source-highlight 2s linear;
            animation-iteration-count: 4;
        }
    }

    dd {
        margin-inline-start: unset;
    }
}


@keyframes source-highlight {

    0%,
    70% {
        color: currentColor;
    }

    75%,
    100% {
        color: transparent;
    }
}


#conclusion {}

/* Colophon: CO2 comparison visualization */
figure.co2-compare {
    margin-block: var(--spacing-large);
    margin-inline: 0;

    figcaption {
        font: var(--font-moyen);
        padding-top: var(--spacing-xsmall);
        border-top: 1px solid currentColor;
    }

    ul.histogram {
        li {
            margin-block: 2rem;
        }

        li>* {
            vertical-align: baseline;
        }

        .label {
            display: block;
            margin-bottom: 0.25rem;
            font: var(--font-petit);
        }

        .bar {
            display: inline-block;
            height: 0.75em;
            background: var(--color-text);
            width: calc((var(--co2) / var(--co2-max)) * 100%);
            margin-right: 0.5rem;
        }

        li.highlight .bar {
            opacity: 1;
        }

        .value {
            font: var(--font-petit);
            font-weight: 600;
            text-wrap: nowrap;
        }

        /* CO2 value appears inline after label on hover */
        .label::after {
            content: attr(data-co2);
            opacity: 0;
            margin-inline: var(--spacing-small);
            transition: all 0.05s;
        }

        li:hover .label::after {
            opacity: 0.6;
            margin-inline: var(--spacing-normal) 0;
        }


    }

}

/* A-propos page: no padding on section headings */
body.a-propos section>h2 {
    padding: 0;
}

/* A-propos page: sticky section navigation */
#page-nav {
    display: flex;
    justify-content: space-evenly;
    padding: 1.5rem max(var(--spacing-small), 3vw);
    gap:1rem;
    background: var(--color-background);
    position: sticky;
    top: 0;
    z-index: 10000;
    container-type: inline-size;
    border-bottom: 1px solid;
    flex-wrap: wrap;
    a {
        white-space: nowrap;
        font-weight: 200;
        font-size: clamp(16px, 1.4vw, 24px);
        margin-inline: var(--spacing-xsmall);

        &.active {
            font-weight: 600;
        }
    }

    .short {
        display: none;
    }

    @container (max-width: 1100px) {

        a {
            min-width:44cqw;
            text-align:center;
            text-size: clamp(16px, 1.8vw, 24px);
        }
    }

    &~main section[id] {
        scroll-margin-top: 120px;
    }
}

/* Les Cercles page */


#map-section {
    position: relative;
    width: 100%;
    height: calc(100vh - 66px - 200px);
    min-height: 250px;
    max-height: 650px;
    padding: 0;
    margin: 0;
    max-width: none;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    border-bottom: 1px solid var(--color-text);
    filter: grayscale(100%);
}

/* Map search field */
#map-search {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

#search-input {
    width: 280px;
    padding: 1rem;
    border: 1px solid var(--color-text);
    font: var(--font-moyen);
    font-size: 16px;
}

/* Circles dropdown list */
#circles-list {
    position: absolute;
    top: 77px;
    left: 20px;
    z-index: 1000;
    background: var(--color-background);
    border: 1px solid var(--color-text);
    min-width: 280px;
    max-width: 320px;
}

#circles-list-toggle {
    display: none;
}

/* CARET component */
.caret-expander::after,
main details summary::after,
.country-header::after {
    content: ' ';
    width: 0.5em;
    height: 0.5em;
    margin: 0.25em;
    transform-origin: 0.375em 0.375em;
    display: block;
    border: 0 solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform 0.15s;
}


.caret-expander::after,
main details[open] summary::after,
.country-section[open] .country-header::after {
    transform: rotate(225deg);
}

#circles-list-content {
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
}

.country-section {
    border-bottom: 1px solid #e0e0e0;
    interpolate-size: allow-keywords;

    &::details-content {
        height: 0;
        overflow: clip;
        transition: height 0.2s ease;
    }

    &[open]::details-content {
        height: auto;
    }
}

.country-header {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-background);
    border: none;
    font: var(--font-moyen);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;

    &::marker {
        content: none;
    }

    &::-webkit-details-marker {
        display: none;
    }

    &:hover {
        background: #f5f5f5;
    }
}

.circles-list li {
    padding: 0.5rem 1rem 0.5rem 2rem;
    font: var(--font-moyen);
    cursor: pointer;
    border-top: 1px solid #f0f0f0;

    &:hover {
        background: #f5f5f5;
    }
}

/* Mobile search (hidden on desktop) */
#mobile-search-trigger {
    display: none;
}

#mobile-search-modal {
    display: none;
}

/* Override maplibre popup styles */
.maplibregl-popup-content {
    max-width: 400px;
    padding: 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid black;

    :focus-visible {
        outline: none;
        box-shadow: none;
    }
}

.maplibregl-popup-close-button {
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    line-height: 0.8rem;
    padding: 0 0 0.2rem;
    border-radius: 1px;
}

/* Circle popup styles */
.circle-popup {
    font-family: 'AUTHENTIC Sans', system-ui, sans-serif;
    min-width: 280px;

    h3 {
        font-size: 1.5rem;
        font-weight: 600;
        margin: 0 0 0.75rem 0;
    }

    p {
        font-size: 0.9rem;
        line-height: 1.4;
        margin: 0.25rem 0 !important;
    }

    strong {
        font-weight: 600;
    }

    a {
        color: var(--color-text);
    }

    &--construction {
        color: #555555;

        h3,
        p,
        a {
            color: #555555;
        }
    }

    a.popup-button {
        margin-top: 0.75rem;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        font-weight: 600;
        text-decoration: none !important;
        color: var(--color-text) !important;

        &:hover {
            color: var(--color-background) !important;
        }
    }
}

.popup-message {
    margin-top: 0.75rem;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.3;
}

.popup-button {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none !important;
    color: var(--color-text) !important;

    &:hover {
        color: var(--color-background) !important;
    }
}

/* Popup button group for inscription/contact actions */
.popup-btn-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.popup-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
}

.popup-btn-primary {
    background: var(--color-text, #333);
    color: var(--color-background, #fff);
}

.popup-btn-primary:hover {
    opacity: 0.9;
}

.popup-btn-secondary {
    background: #eee;
    color: var(--color-text, #333);
    border: 1px solid #ccc;
}

.popup-btn-secondary:hover {
    background: #ddd;
}

/* Map title section */
#map-title {
    text-align: center;

    h1 {
        font: var(--font-tres-grand);
        margin: 0;
    }
}

#circle-intro {
    .intro-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: clamp(2rem, 5vw, 65px);
        max-width: var(--section-min-width);
        margin: 0 auto 8rem;
    }

    article {
        font: var(--font-grand);
    }

    h2 {
        font: var(--font-grand-bold);
        text-align: left;
        margin-bottom: 1.5rem;
        padding: 0;
    }

    p {
        margin-bottom: 1rem;
    }
}

/* Contact form - simplified, semantic */
#circle-form {
    max-width: 60ch;
    min-width: unset;
    margin: 0 auto;
    interpolate-size: allow-keywords;

    h2 {
        font: var(--font-grand-bold);
        text-align: left;
        margin-bottom: var(--spacing-normal);
        padding: 0;
    }

    /* Dynamic title with back link */
    .form-title-dynamic {
        display: none;
        position: relative;
        margin-bottom: 1.5rem;
    }

    .form-title-dynamic .back-link {
        text-decoration: none;
        margin-right: 0.5rem;
        cursor: pointer;
    }

    .form-title-dynamic .back-link:hover {
        opacity: 0.7;
    }

    .form-title-dynamic .close-link {
        display: none;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        text-decoration: none;
        font-size: 1.5rem;
        padding: 0.25rem 0.5rem;
        cursor: pointer;
    }

    .form-title-dynamic .close-link:hover {
        opacity: 0.7;
    }

    /* Form mode: inscription or contact */
    &.mode-inscription .form-title-default,
    &.mode-contact .form-title-default,
    &.mode-success .form-title-default {
        display: none;
    }

    &.mode-inscription .form-title-dynamic,
    &.mode-contact .form-title-dynamic,
    &.mode-success .form-title-dynamic {
        display: block;
    }

    /* Hide city/initiative/contact fields in inscription/contact modes */
    &.mode-inscription .field-city,
    &.mode-inscription .field-initiative,
    &.mode-inscription .field-contact-preference,
    &.mode-contact .field-city,
    &.mode-contact .field-initiative,
    &.mode-contact .field-contact-preference {
        display: none;
    }

    /* Message field optionality hint */
    &.mode-inscription .field-message label::after {
        content: " (optionnel)";
        font-weight: normal;
        font-style: italic;
    }

    /* Success state shows close button */
    &.mode-success .close-link {
        display: block;
    }

    &.mode-success:not(.mode-inscription):not(.mode-contact) .back-link {
        display: none;
    }

    /* Form collapse animation */
    &.mode-success form {
        height: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
    }

    &:not(.mode-success) form {
        height: auto;
        opacity: 1;
    }
}

/* Success state box */
.form-success[hidden] {
    display: none;
}

.form-success:not([hidden]) {
    --anim-border: 150ms;
    --anim-text: 100ms;
    --anim-text-delay: 150ms;

    position: relative;
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;

    p {
        font-size: 1.1rem;
        line-height: 1.6;
        opacity: 0;
        animation: fadeInText var(--anim-text) ease-out var(--anim-text-delay) forwards;
    }

    &::after {
        content: '';
        position: absolute;
        inset: 45% 48%;
        border: 1px solid #000;
        animation: boxOpen var(--anim-border) ease-out forwards;
        pointer-events: none;
    }
}

@keyframes fadeInText {
    to {
        opacity: 1;
    }
}

@keyframes boxOpen {
    from {
        inset: 45% 48%;
    }

    to {
        inset: 0;
    }
}

/* Form transitions */
#circle-form form {
    transition: height 400ms ease-out, opacity 300ms ease-out;
}

/* Form highlight animation (when scrolled to) */
@keyframes highlight-form {
    0% {
        box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.3);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

#circle-form.highlighted {
    animation: highlight-form 1.5s ease-out;
}

/* Form message styles */
.form-message-error {
    background: #fff;
    color: #000;
    border: 3px solid #000;
    padding: 1rem;
    margin-bottom: 1rem;
}

#contact-form {
    label {
        display: block;
        margin-top: var(--spacing-small);
    }

    input[type="text"],
    input[type="email"],
    textarea {
        display: block;
        width: 100%;
        padding: var(--spacing-small);
        margin-top: var(--spacing-xsmall);
        border: 1px solid currentColor;
        font: var(--font-moyen);
    }

    textarea {
        resize: vertical;
        min-height: 200px;
    }

    fieldset {
        border: none;
        padding: 0;
        margin-block-start: var(--spacing-normal);

        legend {
            font: var(--font-moyen);
        }

        p {
            margin-block-start: var(--spacing-xsmall);
            margin-block-end: var(--spacing-normal);

            label {
                margin-block: 0;
                padding-block: var(--spacing-xsmall);
                cursor: pointer;
            }
        }
    }

    input[type="radio"] {
        -webkit-appearance: none;
        appearance: none;
        width: 0.9em;
        height: 0.88em;
        font-size: var(--font-moyen);
        margin: 2px var(--spacing-xsmall);
        border: 1.5px solid var(--color-text);
        border-radius: 48%;
        vertical-align: text-bottom;
        cursor: pointer;
        position: relative;
        flex-shrink: 0;

        &:checked {
            background: var(--color-text);
        }
    }

    button {
        padding: var(--spacing-small) var(--spacing-normal);
        background: var(--color-background);
        border: 1px solid var(--color-text);
        font: var(--font-moyen);
        color: var(--color-text);
        cursor: pointer;

        &:hover {
            background: var(--color-text);
            color: var(--color-background);
        }

        &:disabled {
            opacity: 0.6;
            cursor: wait;
        }
    }
}

.form-disclaimer {
    text-align: center;
    margin-top: var(--spacing-small);
    margin-block-end: var(--spacing-large);
    font: var(--font-moyen);
}

.form-message {
    padding: var(--spacing-small);
    margin: var(--spacing-small) 0;

    &.success {
        background: #d4edda;
        color: #155724;
        border: 1px solid #c3e6cb;
    }

    &.error {
        background: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
    }
}

/* Scroll-triggered staggered animation for steps */
#steps .infographic ol li {
    opacity: 0;

    span {
        display: inline-block;
    }
}

/* Set --step-index per child (Safari doesn't support sibling-index) */
#steps .infographic ol li:nth-child(1) {
    --step-index: 1;
}

#steps .infographic ol li:nth-child(2) {
    --step-index: 2;
}

#steps .infographic ol li:nth-child(3) {
    --step-index: 3;
}

#steps .infographic ol li:nth-child(4) {
    --step-index: 4;
}

#steps .infographic ol li:nth-child(5) {
    --step-index: 5;
}

#steps .infographic ol li:nth-child(6) {
    --step-index: 6;
}

#steps .infographic ol li:nth-child(7) {
    --step-index: 7;
}

#steps .infographic ol li:nth-child(8) {
    --step-index: 8;
}

#steps .infographic.steps-visible ol li {
    animation: stepReveal 0.5s ease-out forwards;
    animation-delay: calc(var(--step-animation-delay) * var(--step-index));
}

@keyframes stepReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 1200px) {
    :root {
        --section-min-width: 700px;
        --section-max-width: 900px;
    }

    #hero {
        margin-block: var(--spacing-xlarge);
    }
}

/* 1000px breakpoint eliminated - all rules now use clamp() */

@media (max-width: 768px) {
    :root {
        --section-min-width: 320px;
        --section-max-width: 100%;
        --step-animation-delay: 0.5s;
    }

    h2 {
        padding: 0;
    }

    #site-header {
        padding: 0;
        flex-wrap: wrap;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 10000;
        background: var(--color-background);

        nav {
            display: none;
            flex-direction: column;
            gap: 1rem;
            padding: 1rem;
            border-top: 1px solid var(--color-text);

            &.menu-open {
                display: flex;
                flex: 1;
            }

            a {
                text-align: center;
            }
        }
    }

    #page-nav {
        display: none;
    }

    #header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        width: 100%;
    }

    #site-title {
        flex: 1;
        font-size: clamp(16px, 4.5vw, 22px);

        img,
        svg {
            width: 32px;
            height: 32px;
        }
    }

    #menu-toggle {
        display: block;
    }

    main {

        section {
            margin: var(--spacing-large) auto;
            padding: 0;
            width: var(--section-full);
        }
    }

    #intro {
        display: block;
        width: unset;
    }

    #hero {
        margin-block: var(--spacing-normal);
    }

    #hero-animation {
        margin-top: -600px;
        margin-bottom: -600px;
    }


    .cta {
        a {
            font: var(--font-moyen);
        }
    }

    #steps>h2 {
        font: var(--font-geant);
    }
    .steps-content {
        margin-bottom: 6rem;
    }

    footer {
        flex-direction: column;
        gap: 2rem;
        padding: 2rem 1rem;

        nav,
        address {
            align-items: flex-start;
        }
    }

    .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
        display: none;
    }

    #map-section {
        height: calc(100vh - 120px - 180px);
        min-height: 250px;
        max-height: 400px;
    }

    #circles-list {
        min-width: 240px;
        max-width: 90%;
        left: 10px;
        top: 70px;
    }

    #map-search {
        top: 10px;
        left: 10px;
    }

    #search-input {
        width: 200px;
        padding: 0.75rem;
        font-size: 14px;
    }

    /* Mobile: hide desktop controls, show mobile trigger */
    #circles-list,
    #map-search {
        display: none;
    }

    #mobile-search-trigger {
        display: flex;
        position: absolute;
        top: 10px;
        left: 10px;
        z-index: 1000;
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
        background: var(--color-background);
        border: 1px solid var(--color-text);
        border-radius: 4px;
        cursor: pointer;

        &:focus {
            outline-color: var(--color-text);
        }
    }

    #mobile-search-modal {
        position: fixed;
        inset: 0;
        z-index: 2000;
        background: var(--color-background);

        &:not([hidden]) {
            display: flex;
            flex-direction: column;
        }

        .modal-content {
            display: flex;
            flex-direction: column;
            height: 100dvh;
            max-height: 100dvh;
        }

        .modal-header {
            display: flex;
            gap: 0.5rem;
            padding: 1rem;
            border-bottom: 1px solid var(--color-text);
        }
    }

    #mobile-search-input {
        flex: 1;
        padding: 0.75rem 1rem;
        font: var(--font-moyen);
        border: 1px solid var(--color-text);
        border-radius: 4px;
    }

    #mobile-search-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background: none;
        border: none;
        cursor: pointer;
    }

    #mobile-circles-list {
        flex: 1;
        overflow-y: auto;
        list-style: none;
        margin: 0;
        padding: 0;

        li {
            padding: 1rem;
            font: var(--font-moyen);
            border-bottom: 1px solid #e0e0e0;
            cursor: pointer;

            &:active {
                background: #f0f0f0;
            }
        }

        .no-results {
            padding: 2rem 1rem;
            text-align: center;
            color: #666;
        }
    }

    #circle-intro .intro-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    #circle-form {
        padding: 0 1rem;

        h2 {
            font: var(--font-grand-bold);
        }
    }

    #addiction {
        margin-top: var(--spacing-large);

    }


}