/* ==========================================================================
   Page Tarifs — N22 J1 (V3 : « Quel est votre besoin ? » → deux cartes-liens par usage → trois tailles/prix de la formule choisie ; aides après les prix).
   Fichier PROPRE à la page (chargé via $header_extra_css dans arbo/tarifs.php) : aucune règle de copropole-main.css n'est modifiée.
   Colonne, menu latéral, en-tête et pied de page de Copropole : NON TOUCHÉS (le bloc s'adapte à la largeur réelle du conteneur).
   Variables : celles du design system (copropole-main.css :root). Pas de ressource externe, pas de framework.
   ========================================================================== */

.tarifs-bloc { container-type: inline-size; container-name: tarifs; margin: 10px 0 6px; padding: 0 10px; box-sizing: border-box; }
.tarifs-bloc [hidden] { display: none !important; }
/* Neutralise les règles desktop globales « .public-site p { left:15px; width:560px } » / « h2, h3 { left:15px } » à l'intérieur du bloc */
.public-site .tarifs-bloc p, .public-site .tarifs-bloc h2, .public-site .tarifs-bloc h3, .tarifs-bloc p, .tarifs-bloc h2, .tarifs-bloc h3 { position: static; left: 0; width: auto; max-width: 100%; text-indent: 0; box-sizing: border-box; }
.tarifs-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.public-site a.tarifs-choix:focus-visible, .tarifs-cta:focus-visible, .tarifs-disclosure summary:focus-visible, .tarifs-fermer-btn:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }
.public-site .tarifs-sous-titre a, .tarifs-compare a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

/* --- Zone de choix par BESOIN : titre, puis deux cartes-liens égales (toute la surface cliquable) --- */
.tarifs-bloc .tarifs-orientation-titre { margin: 0 0 10px; padding: 0; font-size: 1.1rem; line-height: 1.25; font-weight: 700; text-align: center; color: var(--text-dark); }
.tarifs-orientation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.public-site a.tarifs-choix { display: grid; grid-auto-rows: min-content; align-content: start; row-gap: 4px; min-width: 0; min-height: 112px; margin: 0; padding: 10px 12px; box-sizing: border-box;
    background: #fff; color: var(--text-dark); text-decoration: none; text-align: left; border: 2px solid var(--border-light); border-radius: 10px; cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease; -webkit-tap-highlight-color: transparent; }
.public-site a.tarifs-choix:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.public-site a.tarifs-choix[aria-current="true"] { border-color: var(--primary); background: #fdf3f2; }
.tarifs-choix .tarifs-besoin { font-size: .96rem; line-height: 1.2; font-weight: 700; color: var(--text-dark); }
.tarifs-choix .tarifs-formule { font-size: 1.05rem; line-height: 1.2; font-weight: 700; color: var(--primary); }
.tarifs-choix[aria-current="true"] .tarifs-formule::after { content: " \2713"; }
.tarifs-choix .tarifs-benefice { font-size: .84rem; line-height: 1.3; color: var(--text-medium); }

/* --- Transition vers les prix : une seule ligne discrète --- */
.tarifs-bloc .tarifs-transition { margin: 10px 0 7px; padding: 0; font-size: .92rem; line-height: 1.25; font-weight: 600; text-align: center; color: var(--text-dark); }

/* --- Trois cartes : colonnes égales selon la largeur RÉELLE du conteneur ; empilées et compactes dès qu'une carte serait trop étroite --- */
.tarifs-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; --rows: 3; }
.tarifs-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 8px; min-width: 0; margin: 0; padding: 14px 14px; box-sizing: border-box;
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.tarifs-entete { min-width: 0; }
.tarifs-bloc h3.tarifs-nom, .tarifs-nom { margin: 0; font-size: .94rem; line-height: 1.2; color: var(--text-dark); }
.tarifs-bloc .tarifs-lots { margin: 2px 0 0; font-size: .9rem; line-height: 1.3; color: var(--text-medium); }
.tarifs-bloc .tarifs-prix { margin: 0; line-height: 1.1; text-align: right; white-space: nowrap; }
.tarifs-montant { display: block; font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.tarifs-unite { display: block; margin-top: 2px; font-size: .85rem; color: var(--text-medium); }
.tarifs-cta { grid-column: 1 / -1; width: 100%; max-width: none; min-height: 44px; margin: 0; box-sizing: border-box; text-align: center; }
.tarifs-cta-off, .tarifs-cta-off:hover { cursor: not-allowed; background: var(--bg-marge); color: #5a4a4a; text-shadow: none; white-space: nowrap; font-size: .92rem; padding-left: 6px; padding-right: 6px; border: 0; box-shadow: none; transform: none; opacity: 1; }
@container tarifs (min-width: 480px) {
    .tarifs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), auto); column-gap: 8px; row-gap: 0; }
    .tarifs-card { grid-row: span var(--rows); grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid; row-gap: 8px; justify-items: stretch; align-items: start; padding: 12px 10px; text-align: center; }
    .tarifs-card > * { text-align: center; }
    .tarifs-bloc .tarifs-prix { text-align: center; }
    .tarifs-card .tarifs-cta { align-self: end; }
}
@supports not (grid-template-rows: subgrid) { @container tarifs (min-width: 480px) { .tarifs-card { display: flex; flex-direction: column; align-items: stretch; } .tarifs-card .tarifs-cta { margin-top: auto; } } }
@container tarifs (max-width: 479px) {
    .tarifs-cta { max-width: none; }
}

.tarifs-bloc .tarifs-devis { margin: 8px 0 0; text-align: center; font-size: .92rem; color: var(--text-medium); }
.tarifs-bloc .tarifs-reassurance { margin: 4px 0 0; text-align: center; font-size: .92rem; color: var(--text-dark); }
.tarifs-bloc .tarifs-habilitation { margin: 2px 0 0; text-align: center; font-size: .88rem; color: var(--text-medium); }

/* --- Aides repliables APRÈS les prix : lots puis comparaison (jamais de bulle, aucun prix essentiel à l'intérieur) --- */
.tarifs-aides { margin: 12px 0 0; text-align: center; }
.tarifs-disclosure { margin: 0 0 8px; text-align: left; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md); }
.tarifs-disclosure summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 14px; font-size: .95rem; font-weight: 600; color: var(--primary); cursor: pointer; list-style: none; }
.tarifs-disclosure summary::-webkit-details-marker { display: none; }
.tarifs-disclosure summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 150ms ease; }
.tarifs-disclosure[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.tarifs-disclosure[open] summary { border-bottom: 1px solid var(--border-light); }
.tarifs-bloc .tarifs-disclosure > p { margin: 0; padding: 10px 14px 12px; font-size: .88rem; line-height: 1.45; color: var(--text-dark); text-align: left; }
.tarifs-bloc .tarifs-disclosure > p + p { padding-top: 0; }
.tarifs-compare { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .86rem; line-height: 1.3; }
.tarifs-compare th, .tarifs-compare td { padding: 8px 9px; border-top: 1px solid var(--border-light); vertical-align: top; text-align: center; }
.tarifs-compare thead th { border-top: 0; font-size: .88rem; color: var(--text-dark); }
.tarifs-compare tbody th, .tarifs-compare thead th:first-child { width: 50%; text-align: left; text-align: left; font-weight: 500; color: var(--text-dark); }
.tarifs-compare td:nth-child(2), .tarifs-compare td:nth-child(3), .tarifs-compare thead th:nth-child(2), .tarifs-compare thead th:nth-child(3) { width: 25%; }
.tarifs-compare td { vertical-align: middle; }
.tarifs-compare .tarifs-coche { display: block; margin: 0 auto; width: 19px; height: 19px; fill: none; stroke: #187A43; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tarifs-compare td { color: var(--text-medium); }
.tarifs-bloc .tarifs-noscript { margin: 12px 0 0; text-align: center; font-size: .9rem; color: var(--text-medium); }

/* Conteneur étroit : tableau compact en grille (libellé | AGile | Intégrale), sans défilement horizontal ; la ligne « Qui souscrit » (texte) passe en blocs */
@container tarifs (max-width: 479px) {
    .tarifs-compare, .tarifs-compare thead, .tarifs-compare tbody { display: block; }
    .tarifs-compare tr { display: grid; grid-template-columns: minmax(0, 1fr) 64px 84px; border-top: 1px solid var(--border-light); }
    .tarifs-compare thead tr { border-top: 0; }
    .tarifs-compare th, .tarifs-compare td { width: auto !important; border-top: 0; padding: 7px 6px; }
    .tarifs-compare tbody th { padding-left: 12px; }
    .tarifs-compare tr:not(.tarifs-ligne-texte) td { display: flex; align-items: center; justify-content: center; }
    .tarifs-compare tr.tarifs-ligne-texte { grid-template-columns: minmax(0, 1fr); }
    .tarifs-compare tr.tarifs-ligne-texte th, .tarifs-compare tr.tarifs-ligne-texte td { padding: 7px 12px 0; text-align: left; font-weight: 400 !important; }
    .tarifs-compare tr.tarifs-ligne-texte th { font-weight: 500 !important; }
    .tarifs-compare tr.tarifs-ligne-texte td:last-child { padding-bottom: 9px; }
    .tarifs-compare tr.tarifs-ligne-texte td::before { content: attr(data-l) " : "; color: var(--text-medium); }
}

@media (prefers-reduced-motion: reduce) {
    .tarifs-choix, .tarifs-disclosure summary::after { transition-duration: 1ms; }
}

/* --- Zone de choix en conteneur étroit (mobile) : deux cartes sur UNE ligne, texte complet qui passe à la ligne --- */
@container tarifs (max-width: 479px) {
    .tarifs-orientation { gap: 8px; }
    .public-site a.tarifs-choix { min-height: 0; padding: 9px 10px; row-gap: 4px; }
    .tarifs-choix .tarifs-besoin { font-size: .9rem; line-height: 1.2; }
    .tarifs-choix .tarifs-formule { font-size: 1rem; }
    .tarifs-choix .tarifs-benefice { font-size: .82rem; line-height: 1.3; }
    .tarifs-bloc .tarifs-orientation-titre { margin-bottom: 8px; }
    .tarifs-bloc .tarifs-transition { margin: 10px 0 6px; }
}
/* --- Très étroit (≈ 320 px, conteneur < 300 px) : deux lignes compactes empilées, structure horizontale (nom à gauche, promesse à droite) --- */
@container tarifs (max-width: 299px) {
    .tarifs-orientation { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .public-site a.tarifs-choix { position: relative; grid-template-columns: 4.8rem minmax(0, 1fr); column-gap: 8px; row-gap: 2px; padding: 7px 10px; }
    .tarifs-choix .tarifs-besoin { grid-column: 1 / -1; }
    .tarifs-choix .tarifs-formule { grid-column: 1; align-self: start; }
    .tarifs-choix[aria-current="true"] .tarifs-formule::after { content: none; }
    .public-site a.tarifs-choix[aria-current="true"]::after { content: "\2713"; position: absolute; top: 6px; right: 10px; font-weight: 700; color: var(--primary); }
    .tarifs-bloc .tarifs-transition { font-size: .8rem; margin: 8px 0 6px; }
    .tarifs-choix .tarifs-benefice { grid-column: 2; font-size: .8rem; line-height: 1.25; }
}

/* --- V3C : une seule ligne sous la grille Intégrale (le tarif de lancement n'est pas permanent) --- */
.tarifs-bloc .tarifs-lancement { margin: 7px 0 0; font-size: .85rem; line-height: 1.35; text-align: center; color: var(--text-medium); }

/* --- J3 : deux sections du comparatif (intertitres sobres, non cliquables) --- */
.tarifs-compare tr.tarifs-section th { width: auto; padding: 7px 12px; text-align: left; font-size: .82rem; font-weight: 700; letter-spacing: .01em; color: var(--text-dark); background: #faf3f2; border-top: 1px solid var(--border-light); }
.tarifs-compare tbody tr.tarifs-section:first-child th { border-top: 0; }
@container tarifs (max-width: 479px) {
    .tarifs-compare tr.tarifs-section { grid-template-columns: minmax(0, 1fr); }
    .tarifs-compare tr.tarifs-section th { padding: 7px 12px; }
}
