/* ============================================================
   WEATHERING — Page "Les règles"
   Réutilise les variables globales de style.css
   ============================================================ */

.rules-page {
    /* Hauteur réelle du header (le bouton BOUTIQUE le rend plus haut que les 72px globaux) */
    --header-height: 92px;
    background-color: var(--color-teal-dark);
    color: var(--color-text-light);
}

/* Les ancres (QR codes, sommaire) ne doivent pas passer sous le header fixe */
.rules-page [id] {
    scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

/* ---------- EN-TÊTE ---------- */

/* Le bandeau passe sous le header, transparent en haut de page comme sur l'accueil */
.rules-hero {
    background-color: var(--color-teal);
    padding: calc(var(--header-height) + 3rem) 0 3.5rem;
}

.rules-hero h1 {
    color: var(--color-white);
    font-size: clamp(2.5rem, 6vw, 5rem);
    margin-bottom: 1rem;
}

.rules-tagline {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.2vw, 1.75rem);
    text-transform: uppercase;
    color: var(--color-white);
    margin-bottom: 2rem;
}

.rules-tagline .highlight {
    background: url('../img/subtitle.png') no-repeat center / 100% 100%;
    padding: 6px 16px 8px;
    display: inline-block;
}

.rules-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.rules-facts li {
    background-color: var(--color-teal-dark);
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 1rem;
}

.rules-facts-note {
    opacity: 0.7;
    font-size: 0.85rem;
}

.rules-credits {
    font-size: 0.95rem;
    opacity: 0.8;
    margin-bottom: 0;
}

/* ---------- SOMMAIRE ---------- */

.rules-toc {
    background-color: #18383A;
    border-radius: 20px;
    padding: 1.5rem;
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
    max-height: calc(100vh - var(--header-height) - 3rem);
    overflow-y: auto;
    scrollbar-width: none;
}

.rules-toc::-webkit-scrollbar { display: none; }

.rules-toc summary {
    font-family: var(--font-display);
    font-size: 1.4rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-white);
    list-style: none;
    cursor: pointer;
}

.rules-toc summary::-webkit-details-marker { display: none; }

.rules-toc nav { margin-top: 1rem; }

.rules-toc ol { margin: 0; }

.rules-toc ol ol {
    margin: 0.2rem 0 0.4rem 0.9rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(245, 241, 232, 0.2);
}

.rules-toc a {
    display: block;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    color: rgba(245, 241, 232, 0.8);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.rules-toc ol ol a { font-size: 0.88rem; }

.rules-toc a:hover { color: var(--color-white); background-color: rgba(255, 255, 255, 0.06); }

.rules-toc a.active {
    color: var(--color-white);
    background-color: var(--color-coral-light);
    font-weight: 600;
}

@media (min-width: 992px) {
    .rules-toc summary { pointer-events: none; }
}

@media (max-width: 991.98px) {
    .rules-toc {
        position: static;
        max-height: none;
        padding: 1rem 1.25rem;
    }

    .rules-toc summary {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .rules-toc summary::after {
        content: '+';
        font-size: 1.6rem;
        line-height: 1;
    }

    .rules-toc[open] summary::after { content: '−'; }
}

/* ---------- SECTIONS ---------- */

.rules-content { max-width: 960px; }

.rules-section {
    padding-bottom: 3rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid rgba(245, 241, 232, 0.15);
}

.rules-section:last-child { border-bottom: none; margin-bottom: 0; }

.rules-section h2 {
    color: var(--color-white);
    margin-bottom: 1.5rem;
    position: relative;
}

.rules-section h3 {
    color: var(--color-white);
    margin: 2rem 0 1rem;
    position: relative;
}

.rules-section h4 {
    color: var(--color-white);
    font-size: 1.3rem;
    margin: 0;
}

.rules-section p,
.rules-section li,
.rules-section dd {
    font-size: 1.05rem;
    line-height: 1.7;
}

.rules-section a:not(.btn-coral):not(.anchor-link) {
    color: var(--color-white);
    text-decoration: underline;
    text-decoration-color: var(--color-coral);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.rules-section a:not(.btn-coral):not(.anchor-link):hover { color: var(--color-coral); }

.phase-tag {
    display: inline-block;
    background-color: var(--color-coral-light);
    border-radius: 6px;
    padding: 4px 14px 6px;
    margin-right: 0.5rem;
    font-size: 0.75em;
    vertical-align: middle;
}

/* Lien d'ancre "#" affiché au survol des titres (copie le lien de la section) */
.anchor-link {
    position: absolute;
    left: -1.1em;
    top: 0;
    padding-right: 0.3em;
    color: var(--color-coral);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

h2:hover > .anchor-link,
h3:hover > .anchor-link,
.anchor-link:focus { opacity: 1; }

@media (max-width: 1199.98px) {
    .anchor-link { display: none; }
}

/* ---------- LISTES ---------- */

.rules-list {
    padding-left: 1.25rem;
    margin-bottom: 1.5rem;
}

.rules-list li { margin-bottom: 0.6rem; }
.rules-list li::marker { color: var(--color-coral); }

.rules-steps {
    counter-reset: step;
    list-style: none;
    padding-left: 0;
}

.rules-steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 3.25rem;
    margin-bottom: 1.25rem;
}

.rules-steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background-color: var(--color-teal);
    color: var(--color-white);
    font-family: var(--font-display);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rules-dl dt {
    font-family: var(--font-display);
    font-weight: 400;
    text-transform: uppercase;
    color: var(--color-white);
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}

.rules-dl dd {
    margin: 0.2rem 0 1.1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--color-coral);
}

/* ---------- TEXTES SPÉCIFIQUES ---------- */

.rules-lore {
    font-style: italic;
    opacity: 0.9;
}

.rules-note {
    font-size: 0.95rem !important;
    opacity: 0.85;
    margin-top: 0.5rem;
}

.rules-example {
    font-style: italic;
    opacity: 0.85;
}

.rules-highlight {
    background-color: var(--color-teal);
    border-radius: var(--radius-card);
    padding: 1rem 1.25rem;
}

/* ---------- ENCARTS ---------- */

.rules-callout {
    background-color: #18383A;
    border-left: 4px solid var(--color-teal);
    border-radius: var(--radius-card);
    padding: 1.5rem 1.75rem;
    margin: 1.75rem 0;
}

.rules-callout h3 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.1rem, 1.6vw, 1.4rem);
}

.rules-callout-gold { border-left-color: #F2C14E; }
.rules-callout-gold h3 { color: #F2C14E; }

.rules-callout-coral { border-left-color: var(--color-coral-light); }

.rules-box {
    background-color: var(--color-teal);
    border-radius: var(--radius-card);
    padding: 1.5rem 1.75rem;
    height: 100%;
}

.rules-box h3 { margin-top: 0; }
.rules-box-sub { opacity: 0.8; margin-top: -0.5rem; }
.rules-box ul { padding-left: 1.25rem; margin: 0; }
.rules-box li::marker { color: var(--color-coral); }

.camp-card {
    border-radius: var(--radius-card);
    padding: 1.5rem 1.75rem;
    height: 100%;
    background-color: var(--color-teal);
}

.camp-card h3 { margin-top: 0; }
.camp-lobbyistes { background-color: var(--color-coral-dark); }

/* ---------- TRANSITION ---------- */

.transition-step {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    background-color: #18383A;
    border-radius: var(--radius-card);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
}

.transition-step h3 { margin-top: 0; }

.transition-num {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: var(--color-coral-light);
    color: var(--color-white);
    font-family: var(--font-display);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 575.98px) {
    .transition-step { flex-direction: column; padding: 1.25rem; }
}

/* ---------- TABLEAUX ---------- */

.rules-table-wrap {
    border-radius: var(--radius-card);
    margin-bottom: 1.5rem;
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #18383A;
    color: var(--color-text-light);
    font-size: 1rem;
}

.rules-table th,
.rules-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(245, 241, 232, 0.12);
    vertical-align: top;
}

.rules-table thead th {
    background-color: var(--color-teal);
    color: var(--color-white);
    font-family: var(--font-display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.rules-table tbody th { font-weight: 600; color: var(--color-white); }
.rules-table tbody tr:last-child th,
.rules-table tbody tr:last-child td { border-bottom: none; }

.rules-table-sub {
    display: block;
    font-weight: 400;
    font-size: 0.85rem;
    opacity: 0.75;
}

.rules-table-actions td:last-child { white-space: nowrap; font-weight: 600; }

.rules-table-config { text-align: center; min-width: 560px; }
.rules-table-config th,
.rules-table-config td { vertical-align: middle; }
.rules-table-config thead .col-ecolos { background-color: var(--color-teal); }
.rules-table-config thead .col-lobbyistes { background-color: var(--color-coral-dark); }
.rules-table-config tbody td:nth-child(n+5) { background-color: rgba(155, 45, 58, 0.18); }
.rules-table-config tbody td { font-size: 1.15rem; font-weight: 600; }

/* Échelle météo : du gris orageux au jaune radieux */
.weather-table { min-width: 560px; }
.weather-table td { width: 42%; }
.weather-pv {
    text-align: center;
    white-space: nowrap;
    font-family: var(--font-display);
    font-weight: 400 !important;
    font-size: 1.1rem;
    color: var(--color-text-dark) !important;
    vertical-align: middle !important;
}
.weather-table .w-0 .weather-pv { background-color: #5E5A5B; color: var(--color-white) !important; }
.weather-table .w-1 .weather-pv { background-color: #7A7E86; color: var(--color-white) !important; }
.weather-table .w-2 .weather-pv { background-color: #979FA8; }
.weather-table .w-3 .weather-pv { background-color: #B4C0C4; }
.weather-table .w-4 .weather-pv { background-color: #BFD8C7; }
.weather-table .w-5 .weather-pv { background-color: #D8E7A6; }
.weather-table .w-6 .weather-pv { background-color: #F0E48A; }
.weather-table .w-7 .weather-pv { background-color: #F2C14E; }

/* ---------- PERSONNAGES ---------- */

.camp-title { margin-top: 2.5rem !important; }

.character-card {
    background-color: var(--color-teal);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.character-lobby { background-color: #5A2530; }

.character-card header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.character-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.character-role {
    margin: 0 !important;
    font-size: 0.85rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.character-stars {
    margin-left: auto;
    color: #F2C14E;
    letter-spacing: 2px;
    font-size: 1.1rem;
    white-space: nowrap;
}

.character-synergy { font-size: 0.95rem !important; opacity: 0.9; }

.character-tip {
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 0.9rem;
    border-top: 1px dashed rgba(245, 241, 232, 0.3);
    font-size: 0.95rem !important;
}

/* ---------- FAMILLES ---------- */

.family-card {
    border-radius: var(--radius-card);
    padding: 1.5rem;
    height: 100%;
    background-color: #18383A;
    border-top: 5px solid var(--color-teal);
}

.family-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.family-count {
    font-family: var(--font-body);
    text-transform: none;
    font-size: 0.85rem;
    opacity: 0.7;
    margin-left: auto;
}

.family-anthropique { border-top-color: #9B7B6B; }
.family-atmospherique { border-top-color: #B8C9D9; }
.family-oceanique { border-top-color: #3E8FC4; }
.family-terrestre { border-top-color: #6FA65A; }

/* ---------- BOUTON COMMANDER ---------- */

/* btn-shape.svg garde ses proportions : sur un libellé long, la forme se limite à la
   largeur du texte. Cette variante s'étire sur tout le bouton, avec une marge réduite. */
.rules-cta .btn-coral { padding: 18px 32px !important; }
.rules-cta .btn-coral::before,
.rules-cta .btn-coral::after {
    -webkit-mask-image: url('../svg/btn-shape-wide.svg');
    mask-image: url('../svg/btn-shape-wide.svg');
}

/* ---------- ICONOGRAPHIE ---------- */

.icono-example {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background-color: #18383A;
    border-radius: var(--radius-card);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

/* Carte complète, même taille pour tous les exemples */
.icono-visual { flex-shrink: 0; }
.icono-visual img { height: 209px; width: auto; }

/* ---------- COMPTE-TOURS ---------- */

.turn-counters { margin: 2rem 0; text-align: center; }

.turn-counters-cards {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.turn-counters-cards img { height: 300px; width: auto; }

.turn-counters figcaption {
    margin-top: 0.9rem;
    font-size: 0.95rem;
    opacity: 0.85;
}

@media (max-width: 575.98px) {
    .turn-counters-cards { gap: 0.75rem; }
    .turn-counters-cards img { height: auto; width: calc(50% - 0.375rem); }
}

/* ---------- SCHÉMAS ---------- */

.rules-schema { margin: 2rem 0; text-align: center; }

.rules-schema img {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 760px;
    height: auto;
    border-radius: var(--radius-card);
}

.rules-schema figcaption {
    margin-top: 0.9rem;
    font-size: 0.95rem;
    opacity: 0.85;
}

/* ---------- RETOUR EN HAUT ---------- */

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    isolation: isolate;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

/* Rond rouge avec l'ombre crème décalée des boutons du site */
.back-to-top::before,
.back-to-top::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    transition: background-color var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.back-to-top::before { background-color: var(--color-coral-light); z-index: -1; }
.back-to-top::after { background-color: var(--color-coral-shadow); transform: translate(3px, 3px); z-index: -2; }

.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

.back-to-top:hover,
.back-to-top:focus { color: var(--color-white); }
.back-to-top:hover::before,
.back-to-top:focus::before { background-color: var(--color-coral-dark); }
.back-to-top:hover::after,
.back-to-top:focus::after { opacity: 0; transform: translate(0, 0); }

/* ---------- MOBILE ---------- */

@media (max-width: 575.98px) {
    .rules-hero { padding: calc(var(--header-height) + 1.5rem) 0 2.5rem; }
    .rules-callout,
    .rules-box,
    .camp-card { padding: 1.25rem; }
    .rules-steps > li { padding-left: 2.75rem; }
    .rules-table-actions td:last-child { white-space: normal; }
    .icono-example { flex-direction: column; align-items: flex-start; padding: 1.25rem; }
    .back-to-top { right: 1rem; bottom: 1rem; width: 48px; height: 48px; }
}
