/* ==============================================================
   Bloc Cartographie Résilience
   Adapté depuis carto-resilience-standalone.html
   ============================================================== */

.builder.cartographie_resilience {
    padding-top: clamp(40px, 5vw, 80px);
    padding-bottom: clamp(64px, 8vw, 128px);
}

.cartographie_resilience {
    --ctres-white: #ffffff;
    --ctres-grey: #f5f5f5;
    --ctres-grey-lift: #fafafa;
    --ctres-dark-grey: #e6e6e6;
    --ctres-blue: #00355f;
    --ctres-light-blue: #093c64;
    --ctres-azur: #00B7CE;
    --ctres-red: #cd0823;
    --ctres-gold: #B8860B;
    --ctres-text: var(--ctres-blue);
    --ctres-text-muted: rgba(0, 53, 95, 0.65);
    --ctres-text-dim: rgba(0, 53, 95, 0.40);
    --ctres-border: var(--ctres-dark-grey);
    --ctres-border-soft: rgba(0, 53, 95, 0.08);
    --ctres-radius: 8px;
    --ctres-radius-lg: 12px;
    --ctres-transition: all 0.3s ease;
    --ctres-shadow-sm: 0 2px 8px rgba(0, 53, 95, 0.05);
    --ctres-shadow-md: 0 10px 30px rgba(0, 53, 95, 0.08);
    --ctres-shadow-lg: 0 24px 60px rgba(0, 53, 95, 0.14);
    position: relative;
    color: var(--ctres-text);
    font-family: inherit;
}

.cartographie_resilience button {
    font: inherit;
    color: inherit;
    background: none;
    cursor: pointer;
}

/* ── Header ─────────────────────────────── */
.ctres__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 320px);
    gap: 48px;
    align-items: end;
    margin-bottom: clamp(40px, 5vw, 72px);
    padding-bottom: 40px;
    border-bottom: 1px solid var(--ctres-border);
}
.ctres__header-left { min-width: 0; }

.ctres__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ctres-azur);
    margin: 0 0 20px;
}
.ctres__eyebrow::before {
    content: "";
    width: 32px;
    height: 2px;
    background: var(--ctres-azur);
}
.ctres__eyebrow em { font-style: normal; color: var(--ctres-blue); }

.ctres__display {
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ctres-blue);
    margin: 0 0 18px;
    text-wrap: balance;
}
.ctres__display-accent { color: var(--ctres-blue); }

.ctres__lede {
    font-size: 16px;
    line-height: 1.6;
    color: var(--ctres-text-muted);
    max-width: 58ch;
    margin: 0;
}

.ctres__stats {
    display: grid;
    gap: 20px;
    padding: 24px;
    background: var(--ctres-white);
    border-radius: var(--ctres-radius-lg);
    box-shadow: var(--ctres-shadow-sm);
}
.ctres__stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--ctres-border);
}
.ctres__stat:last-child { border-bottom: 0; }
.ctres__stat-num {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--ctres-blue);
}
.ctres__stat[data-phase="total"] .ctres__stat-num { color: var(--ctres-blue); }
.ctres__stat:not([data-phase="total"]) .ctres__stat-num { color: var(--phase-color, var(--ctres-blue)); }
.ctres__stat-label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ctres-text-dim);
    font-weight: 500;
}

/* Total : détaché des 3 phases pour montrer qu'il n'est pas leur somme */
.ctres__stat[data-phase="total"] {
    padding: 14px 16px;
    margin-bottom: 16px;
    background: rgba(0, 53, 95, 0.06);
    border: 1px solid rgba(0, 53, 95, 0.12);
    border-radius: 12px;
}
.ctres__stat[data-phase="total"] .ctres__stat-num {
    font-size: 44px;
    font-weight: 800;
}
.ctres__stat[data-phase="total"] .ctres__stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ctres-blue);
}
.ctres__stat[data-phase="total"] + .ctres__stat { padding-top: 12px; }

/* ── Cycle timeline ─────────────────────── */
.ctres__cycle {
    position: relative;
    margin: 0 0 clamp(28px, 4vw, 48px);
    padding: 48px 0 8px;
}
.ctres__cycle-track {
    position: absolute;
    top: 76px;
    left: 16.66%;
    right: 16.66%;
    height: 2px;
    background: var(--ctres-blue);
    opacity: 0.25;
    border-radius: 2px;
}
.ctres__cycle-progress {
    position: absolute;
    top: 76px;
    height: 2px;
    background: var(--ctres-blue);
    opacity: 0.85;
    border-radius: 2px;
    transition: left 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), right 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.4s ease;
    z-index: 1;
}
.ctres__cycle-nodes {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: relative;
    z-index: 2;
}
.ctres__cycle-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border: 0;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
}
.ctres__cycle-index {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.24em;
    color: var(--ctres-text-dim);
    margin-bottom: 12px;
}
.ctres__cycle-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--ctres-white);
    border: 2px solid var(--ctres-border);
    transition: all 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
    box-shadow: 0 0 0 6px var(--ctres-white);
}
.ctres__cycle-node:hover .ctres__cycle-dot:not([data-active="true"]) {
    border-color: var(--phase-color);
    transform: scale(1.15);
}
.ctres__cycle-dot[data-active="true"] {
    background: var(--phase-color);
    border-color: var(--phase-color);
    transform: scale(1.35);
    box-shadow: 0 0 0 8px var(--ctres-white), 0 0 0 10px rgba(0, 53, 95, 0.08);
}
.ctres__cycle-title {
    margin-top: 22px;
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ctres-text-muted);
    transition: color 0.3s ease;
    line-height: 1;
}
.ctres__cycle-node[aria-selected="true"] .ctres__cycle-title { color: var(--phase-color); }
.ctres__cycle-intent {
    margin-top: 6px;
    font-size: 13px;
    color: var(--ctres-text-muted);
    line-height: 1.4;
    max-width: 24ch;
}
.ctres__cycle-count {
    margin-top: 10px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ctres-text-dim);
    font-variant-numeric: tabular-nums;
}
.ctres__cycle-count b {
    color: var(--phase-color);
    font-weight: 700;
    font-size: 13px;
}

/* ── Toolbar ────────────────────────────── */
.ctres__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 0 4px 20px;
    border-bottom: 1px solid var(--ctres-border);
    margin-bottom: 20px;
}
.ctres__toolbar-phase {
    font-size: 15px;
    font-weight: 500;
    color: var(--ctres-text-muted);
}
.ctres__toolbar-phase b {
    color: var(--ctres-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ctres__toolbar-count {
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--ctres-text-dim);
    text-transform: uppercase;
    font-weight: 500;
}

/* ── Grid + Cards ───────────────────────── */
.ctres__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.ctres__grid[hidden] { display: none; }
@media (max-width: 1100px) { .ctres__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .ctres__grid { grid-template-columns: 1fr; } }

.ctres__card {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--ctres-border);
    border-radius: var(--ctres-radius-lg);
    padding: 10px;
    cursor: pointer;
    transition: var(--ctres-transition);
    text-align: left;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 260px;
    overflow: hidden;
}
.ctres__card:hover, .ctres__card.is-focused, .ctres__card:focus-visible {
    box-shadow: var(--ctres-shadow-md);
    transform: translateY(-3px);
    outline: none;
}
.ctres__card-top {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}
.ctres__card-logo-box {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    background: var(--ctres-grey);
    border-radius: var(--ctres-radius);
    display: grid;
    place-items: center;
    padding: 8px;
    overflow: hidden;
}
.ctres__card-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.ctres__card-logo-fallback {
    font-size: 10px;
    color: var(--ctres-text-muted);
    text-align: center;
    line-height: 1.1;
    padding: 4px;
    font-weight: 700;
}
.ctres__card-id {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
}
.ctres__card-index-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ctres__card-index {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: var(--ctres-text-dim);
    font-variant-numeric: tabular-nums;
}
.ctres__card-coverage { display: flex; gap: 4px; }
.ctres__card-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ctres-dark-grey);
}
.ctres__card-dot.is-on { background: var(--dot-color, var(--ctres-blue)); }

.ctres__card-company {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ctres-text-muted);
    line-height: 1.2;
    margin-top: 2px;
}
.ctres__card-product {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ctres-blue);
    letter-spacing: -0.01em;
    margin: 0 0 10px;
}
.ctres__card-spec {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ctres-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ctres__card-bottom {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--ctres-border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ctres__card-statut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--ctres-text-muted);
    text-transform: uppercase;
}
.ctres__card-statut::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ctres-text-dim);
}
.ctres__card-statut[data-kind="op"]::before    { background: #16a34a; }
.ctres__card-statut[data-kind="proto"]::before { background: var(--ctres-gold); }
.ctres__card-statut[data-kind="test"]::before  { background: var(--ctres-azur); }

.ctres__card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--phase-color);
    transition: gap 0.3s ease;
}
.ctres__card-cta svg { width: 10px; height: 10px; }
.ctres__card:hover .ctres__card-cta { gap: 10px; }

/* ── Scrim + Drawer ─────────────────────── */
.ctres__scrim {
    position: fixed; inset: 0;
    background: rgba(0, 53, 95, 0.42);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease; z-index: 99998;
}
.ctres__scrim.is-open { opacity: 1; pointer-events: auto; }

.ctres__drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(520px, 100%);
    background: #ffffff;
    padding: 48px clamp(28px, 3vw, 44px) 40px;
    transform: translateX(100%);
    transition: transform 0.42s cubic-bezier(0.22, 0.72, 0.22, 1);
    z-index: 99999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: -24px 0 60px rgba(0, 53, 95, 0.14);
    color: var(--ctres-blue);
}
.ctres__drawer.is-open { transform: translateX(0); }

.ctres__drawer-close {
    position: absolute; top: 20px; right: 20px;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    color: var(--ctres-blue);
    border: 1px solid var(--ctres-border);
    border-radius: 50%;
    transition: var(--ctres-transition);
}
.ctres__drawer-close:hover {
    color: var(--ctres-white);
    background: var(--ctres-blue);
    border-color: var(--ctres-blue);
}
.ctres__drawer-close svg { width: 12px; height: 12px; }

.ctres__drawer-phase {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--phase-color, var(--ctres-blue));
    margin: 0 0 24px;
}
.ctres__drawer-phase::before {
    content: "";
    width: 10px; height: 10px; border-radius: 50%;
    background: currentColor;
}

.ctres__drawer-header {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}
.ctres__drawer-logo-wrap {
    flex: 0 0 96px;
    height: 96px;
    display: grid;
    place-items: center;
    background: var(--ctres-grey);
    border: 1px solid var(--ctres-border);
    border-radius: var(--ctres-radius);
    padding: 10px;
}
.ctres__drawer-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.ctres__drawer-title-block { flex: 1; min-width: 0; }
.ctres__drawer-company {
    font-size: clamp(22px, 2.6vw, 28px);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.1;
    color: var(--ctres-blue);
    margin: 0 0 6px;
    text-wrap: balance;
}
.ctres__drawer-contact {
    font-size: 13px;
    color: var(--ctres-text-muted);
    margin: 0;
    line-height: 1.4;
}
.ctres__drawer-contact a {
    color: var(--ctres-blue);
    text-decoration: none;
    border-bottom: 1px solid var(--ctres-azur);
    padding-bottom: 1px;
}
.ctres__drawer-contact a:hover { color: var(--ctres-azur); }

.ctres__drawer-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 6px;
    background: var(--ctres-blue);
    color: var(--ctres-white);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    transition: var(--ctres-transition);
    margin-bottom: 28px;
    align-self: flex-start;
}
.ctres__drawer-cta:hover {
    background: var(--ctres-light-blue);
    color: var(--ctres-white);
}
.ctres__drawer-cta svg { width: 12px; height: 12px; }

.ctres__drawer-sep {
    border: 0;
    height: 1px;
    background: var(--ctres-border);
    margin: 4px 0 24px;
}
.ctres__drawer-block { margin-bottom: 22px; }
.ctres__drawer-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ctres-text-dim);
    margin: 0 0 8px;
}
.ctres__drawer-product {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ctres-blue);
    margin: 0;
    letter-spacing: -0.01em;
}
.ctres__drawer-spec {
    font-size: 15px;
    line-height: 1.55;
    color: var(--ctres-text-muted);
    margin: 0;
}
.ctres__statut {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--ctres-grey);
    border: 1px solid var(--ctres-border);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ctres-blue);
}
.ctres__statut::before {
    content: "";
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ctres-text-dim);
}
.ctres__statut[data-kind="op"]::before    { background: #16a34a; }
.ctres__statut[data-kind="proto"]::before { background: var(--ctres-gold); }
.ctres__statut[data-kind="test"]::before  { background: var(--ctres-azur); }

.ctres__drawer-others {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
    list-style: none;
}
.ctres__drawer-others button {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px;
    background: var(--ctres-grey);
    border: 1px solid var(--ctres-border);
    border-radius: 6px;
    color: var(--ctres-blue);
    transition: var(--ctres-transition);
    cursor: pointer;
}
.ctres__drawer-others button:hover {
    background: var(--ctres-white);
    border-color: var(--phase-color);
    color: var(--phase-color);
    transform: translateX(3px);
}

.ctres__drawer-coverage {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.ctres__cov {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 8px 14px;
    background: var(--ctres-grey);
    color: var(--ctres-text-dim);
    border: 1px solid var(--ctres-border);
    border-radius: 6px;
}
.ctres__cov::before {
    content: "";
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--dot-color, currentColor);
    opacity: 0.4;
}
.ctres__cov.is-on::before { opacity: 1; }
.ctres__cov.is-on {
    border-color: var(--dot-color);
    color: var(--dot-color);
    background: rgba(0, 53, 95, 0.04);
}

.ctres__drawer-hint {
    margin-top: auto;
    padding-top: 28px;
    font-size: 12px;
    color: var(--ctres-text-dim);
    letter-spacing: 0.04em;
}

/* ── Footnote ───────────────────────────── */
.ctres__footnote {
    margin-top: 48px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--ctres-border);
    font-size: 11px;
    font-weight: 500;
    color: var(--ctres-text-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.ctres__footnote a {
    color: var(--ctres-blue);
    text-decoration: none;
    border-bottom: 1px solid var(--ctres-azur);
    padding-bottom: 2px;
    transition: var(--ctres-transition);
}
.ctres__footnote a:hover { color: var(--ctres-azur); }

/* ── Responsive ────────────────────────── */
@media (max-width: 900px) {
    .ctres__header { grid-template-columns: 1fr; gap: 32px; }
    .ctres__stats { grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 20px; }
    .ctres__stat { flex-direction: column; align-items: flex-start; padding: 0; border-bottom: 0; }
    .ctres__stat-num { font-size: 24px; }
    .ctres__cycle { padding-top: 32px; }
    .ctres__cycle-track, .ctres__cycle-progress { top: 60px; }
    .ctres__cycle-title { font-size: 20px; }
    .ctres__cycle-intent { display: none; }
    .ctres__drawer { padding: 40px 24px 32px; }
    .ctres__drawer-header { flex-direction: column; align-items: flex-start; }
    .ctres__drawer-logo-wrap { flex: 0 0 80px; height: 80px; }
    .ctres__footnote { flex-direction: column; gap: 8px; }
}
@media (max-width: 500px) {
    .ctres__stats { grid-template-columns: repeat(2, 1fr); }
    .ctres__cycle-nodes { gap: 4px; }
    .ctres__cycle-title { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .cartographie_resilience *,
    .cartographie_resilience *::before,
    .cartographie_resilience *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
