/* ==========================================================================
   PAGE CONDITIONS GÉNÉRALES DE VENTE (vue/cgv.php)
   S'appuie sur les variables et composants de css/chavigny.css
   ========================================================================== */

.cg {
    --cg-pro: #2a2b2e;
    --cg-conso: #76777b;
    --cg-conso-bg: #efefef;
    background: var(--ch-white);
    color: var(--ch-text);
    font-family: var(--ch-font);
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.cg-head {
    padding: 22px 0 32px;
    border-bottom: 1px solid var(--ch-border);
    background: var(--ch-grey-light);
}

.cg-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    font-size: .85rem;
}

.cg-breadcrumb li {
    display: inline-flex;
    align-items: center;
    color: var(--ch-grey-dark);
}

.cg-breadcrumb li + li::before {
    content: "";
    width: 6px;
    height: 6px;
    margin: 0 12px;
    border-top: 1.5px solid var(--ch-grey);
    border-right: 1.5px solid var(--ch-grey);
    transform: rotate(45deg);
}

.cg-breadcrumb a {
    color: var(--ch-grey-dark);
    text-decoration: none;
}

.cg-breadcrumb a:hover {
    color: var(--ch-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cg-breadcrumb [aria-current] {
    color: var(--ch-text);
    font-weight: 700;
}

.cg-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 32px;
}

.cg-kicker {
    margin: 0 0 4px;
    color: var(--ch-red);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.cg-title {
    margin: 0;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: 700;
    line-height: 1.15;
}

.cg-subtitle {
    margin: 8px 0 0;
    color: var(--ch-grey-dark);
}

.cg-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.cg-meta li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    font-size: .85rem;
}

.cg-meta i {
    color: var(--ch-red);
}

.cg-meta strong {
    color: var(--ch-text);
}

.cg-print {
    background: var(--ch-white);
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */
.cg-body {
    padding-top: 32px;
    padding-bottom: 72px;
}

.cg-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

/* --------------------------------------------------------------------------
   Sommaire
   -------------------------------------------------------------------------- */
.cg-toc {
    position: sticky;
    top: calc(var(--ch-header-main-h) + var(--ch-header-nav-h) + 16px);
}

.cg-toc-card {
    overflow: hidden;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-lg);
    background: var(--ch-white);
}

.cg-toc-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 16px 18px 12px;
    border: 0;
    background: none;
    color: var(--ch-text);
    font-family: inherit;
    text-align: left;
    cursor: default;
}

.cg-toc-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.cg-toc-title i {
    color: var(--ch-red);
}

/* Libellé du chapitre en cours et chevron : affichés en mode replié (mobile) */
.cg-toc-current,
.cg-toc-chevron {
    display: none;
}

.cg-toc-progress {
    height: 3px;
    margin: 0 18px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--ch-grey-light);
}

.cg-toc-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--ch-red);
    transition: width .15s linear;
}

.cg-toc-list {
    max-height: calc(100vh - var(--ch-header-main-h) - var(--ch-header-nav-h) - 120px);
    margin: 0;
    padding: 10px 8px 12px;
    overflow-y: auto;
    list-style: none;
    scrollbar-width: thin;
}

.cg-toc-link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--ch-radius-sm);
    color: var(--ch-grey-dark);
    font-size: .88rem;
    line-height: 1.35;
    text-decoration: none;
    transition: background .2s var(--ch-ease), color .2s var(--ch-ease);
}

.cg-toc-num {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .74rem;
    font-weight: 700;
    transition: background .2s var(--ch-ease), color .2s var(--ch-ease);
}

.cg-toc-link:hover {
    background: var(--ch-grey-light);
    color: var(--ch-text);
}

.cg-toc-link.is-current {
    background: var(--ch-red-soft);
    color: var(--ch-red);
    font-weight: 700;
}

.cg-toc-link.is-current .cg-toc-num {
    background: var(--ch-red);
    color: var(--ch-white);
}

.cg-toc-link:focus-visible {
    outline: 2px solid var(--ch-red);
    outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   Chapitres
   -------------------------------------------------------------------------- */
.cg-content {
    min-width: 0;
    max-width: 860px;
}

.cg-chapter {
    padding: 0 0 36px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--ch-border);
    scroll-margin-top: calc(var(--ch-header-main-h) + var(--ch-header-nav-h) + 20px);
}

.cg-chapter-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 18px;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: clamp(1.2rem, 1.05rem + .5vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
}

.cg-chapter-title:focus {
    outline: none;
}

.cg-num {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--ch-red);
    color: var(--ch-white);
    font-size: 1rem;
    font-weight: 700;
}

.cg-chapter p {
    margin: 0 0 14px;
    color: var(--ch-grey-dark);
    font-size: .98rem;
    line-height: 1.75;
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

.cg-chapter a {
    color: var(--ch-red);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.cg-chapter strong {
    color: var(--ch-text);
}

.cg-sub {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 26px 0 12px;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: 1.05rem;
    font-weight: 700;
}

.cg-sub span {
    color: var(--ch-red);
}

.cg-subsub {
    margin: 20px 0 10px;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: .98rem;
    font-weight: 700;
}

.cg-highlight {
    padding: 14px 18px;
    border-left: 4px solid var(--ch-red);
    border-radius: 0 var(--ch-radius-sm) var(--ch-radius-sm) 0;
    background: var(--ch-grey-light);
    color: var(--ch-text) !important;
    font-weight: 600;
    text-align: left !important;
}

/* Listes */
.cg-list {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.cg-list li {
    position: relative;
    margin-bottom: 8px;
    padding-left: 26px;
    color: var(--ch-grey-dark);
    font-size: .98rem;
    line-height: 1.7;
}

.cg-list li::before {
    content: "";
    position: absolute;
    top: .7em;
    left: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ch-red);
}

.cg-list-roman {
    counter-reset: cg-roman;
}

.cg-list-roman li {
    padding-left: 40px;
    counter-increment: cg-roman;
}

.cg-list-roman li::before {
    content: "(" counter(cg-roman, lower-roman) ")";
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    color: var(--ch-red);
    font-weight: 700;
}

.cg-quote {
    margin: 0 0 16px;
    padding: 14px 18px;
    border-left: 4px solid var(--ch-grey);
    border-radius: 0 var(--ch-radius-sm) var(--ch-radius-sm) 0;
    background: var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-style: italic;
    line-height: 1.7;
}

/* Encadrés selon le public concerné */
.cg-box {
    margin: 18px 0;
    padding: 18px 22px 6px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: #fcfcfc;
}

.cg-box-conso {
    border-color: var(--ch-border);
    background: var(--cg-conso-bg);
}

.cg-box .cg-sub:first-of-type {
    margin-top: 18px;
}

.cg-public {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px !important;
    padding: 5px 12px;
    border-radius: var(--ch-radius-pill);
    font-size: .8rem !important;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.4 !important;
    text-align: left !important;
}

.cg-public-pro {
    background: var(--cg-pro);
    color: var(--ch-white) !important;
}

.cg-public-conso {
    background: var(--cg-conso);
    color: var(--ch-white) !important;
}

/* Coordonnées RGPD */
.cg-contact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 4px 0 16px;
}

.cg-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    color: var(--ch-grey-dark);
    font-size: .92rem;
    line-height: 1.5;
}

.cg-contact-item > span:last-child {
    min-width: 0;
}

.cg-contact-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ch-red-soft);
    color: var(--ch-red);
}

.cg-contact-label {
    display: block;
    margin-bottom: 2px;
    color: var(--ch-grey);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.cg-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    padding: 22px 24px;
    border-radius: var(--ch-radius-lg);
    background: var(--ch-grey-light);
}

.cg-end p {
    margin: 0;
    color: var(--ch-text);
    font-weight: 700;
}

/* Retour en haut */
.cg-top {
    position: fixed;
    z-index: 800;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--ch-red);
    box-shadow: 0 8px 22px rgba(208, 52, 58, .35);
    color: var(--ch-white);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.cg-top[hidden] {
    display: none;
}

.cg-top:hover,
.cg-top:focus-visible {
    background: var(--ch-red-dark);
    outline: none;
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
    .cg-layout {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 28px;
    }
}

/* Sommaire replié, fixé sous le header, qui affiche le chapitre en cours */
@media (max-width: 991.98px) {
    .cg-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .cg-toc {
        z-index: 50;
        top: 0;
        margin: 0 -4px;
    }

    .cg-toc-card {
        box-shadow: var(--ch-shadow);
    }

    .cg-toc-toggle {
        padding: 12px 16px;
        cursor: pointer;
    }

    .cg-toc-title {
        flex-shrink: 0;
    }

    .cg-toc-current {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        color: var(--ch-grey-dark);
        font-size: .88rem;
        font-weight: 600;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .cg-toc-chevron {
        display: inline-block;
        flex-shrink: 0;
        color: var(--ch-grey-dark);
        transition: transform .25s var(--ch-ease);
    }

    .cg-toc-toggle[aria-expanded="true"] .cg-toc-chevron {
        transform: rotate(180deg);
    }

    .cg-toc-progress {
        margin: 0;
        border-radius: 0;
    }

    .cg-toc-list {
        display: none;
        max-height: 60vh;
    }

    .cg-toc.is-open .cg-toc-list {
        display: block;
    }

    .cg-content {
        max-width: none;
    }

    .cg-chapter {
        scroll-margin-top: 80px;
    }
}

@media (max-width: 767.98px) {
    .cg-head {
        padding-bottom: 24px;
    }

    .cg-head-actions,
    .cg-print {
        width: 100%;
    }

    .cg-meta li {
        font-size: .8rem;
    }

    .cg-chapter {
        padding-bottom: 28px;
        margin-bottom: 28px;
    }

    .cg-chapter p,
    .cg-list li {
        font-size: .95rem;
        text-align: left;
    }

    .cg-num {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: .9rem;
    }

    .cg-box {
        padding: 16px 16px 4px;
    }

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

    .cg-end {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .cg-top {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cg *,
    .cg *::before,
    .cg *::after {
        transition: none !important;
    }
}

/* --------------------------------------------------------------------------
   Impression : texte seul, sur toute la largeur
   -------------------------------------------------------------------------- */
@media print {
    .ch-header,
    header.ch-header,
    .ch-footer,
    footer.ch-footer,
    .ch-drawer,
    .cg-breadcrumb,
    .cg-head-actions,
    .cg-toc,
    .cg-end,
    .cg-top {
        display: none !important;
    }

    .cg-head {
        padding: 0 0 12px;
        border: 0;
        background: none;
    }

    .cg-meta li {
        padding: 0 12px 0 0;
        background: none;
    }

    .cg-body {
        padding: 12px 0 0;
    }

    .cg-layout {
        display: block;
    }

    .cg-content {
        max-width: none;
    }

    .cg-chapter {
        break-inside: auto;
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    .cg-chapter-title {
        break-after: avoid;
    }

    .cg-chapter p,
    .cg-list li {
        color: #000;
        font-size: 10.5pt;
        line-height: 1.5;
    }

    .cg-num,
    .cg-public-pro,
    .cg-public-conso {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
