/* =========================================================
   Contessa Med — catalogue & fiches soins
   S'appuie sur style.css (variables, header, boutons, footer)
   ========================================================= */

.main-nav a[aria-current="page"]::after { transform: scaleX(1); }
.cm-loading { color: var(--muted); padding: 40px 0; }

/* ---------- En-tête de page ---------- */
.cm-hero { padding: 64px 0 28px; position: relative; overflow: hidden; }
.cm-hero::before {
  content: ""; position: absolute; width: 640px; height: 640px; border-radius: 50%;
  inset-inline-end: -240px; top: -260px; pointer-events: none;
  background: radial-gradient(circle, rgba(230, 198, 126, .26), transparent 65%);
}
.cm-hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.8rem); max-width: 20ch; position: relative; }
.cm-hero .lead { position: relative; }

/* ---------- Barre d'outils ---------- */
.cm-toolbar {
  position: sticky; top: 76px; z-index: 40;
  background: rgba(254, 247, 237, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-block: 1px solid var(--line); padding: 14px 0;
}
.cm-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
.cm-tabs::-webkit-scrollbar { display: none; }
.cm-tabs a {
  flex: none; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  font-size: .9rem; color: var(--navy); white-space: nowrap; transition: background .2s, border-color .2s, color .2s;
}
.cm-tabs a:hover { border-color: var(--gold); }
.cm-tabs a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: var(--ivory); }

.cm-filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cm-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.cm-search svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--gold-dark); stroke-width: 1.6; }
.cm-search input {
  width: 100%; font: 400 .95rem var(--f-body); color: var(--navy);
  background: #fff; border: 1px solid rgba(27, 42, 85, .14); border-radius: 999px;
  padding: 10px 16px; padding-inline-start: 42px;
}
.cm-search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196, 154, 69, .18); }
.cm-tagfilter { display: flex; gap: 6px; flex-wrap: wrap; }
.cm-tagfilter button {
  font: 400 .82rem var(--f-body); color: var(--muted); background: transparent;
  border: 1px dashed var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.cm-tagfilter button[aria-pressed="true"] { color: var(--navy-deep); border-style: solid; border-color: var(--gold); background: rgba(196, 154, 69, .14); font-weight: 500; }

/* ---------- Liste ---------- */
.cm-list { padding: 40px 0 90px; }
.cm-group + .cm-group { margin-top: 72px; }
.cm-group-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.cm-group-head h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: .2em; }
.cm-group-head p { margin: 0; color: var(--muted); max-width: 62ch; font-size: .98rem; }
.cm-group-head .card-link { flex: none; }

.cm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.cm-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid rgba(196, 154, 69, .25); border-radius: var(--radius);
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s;
}
.cm-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: var(--gold); }
.cm-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.cm-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--cream); overflow: hidden; }
.cm-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.cm-card:hover .cm-thumb img { transform: scale(1.04); }
.cm-ai-chip {
  position: absolute; inset-inline-start: 10px; bottom: 10px; z-index: 2;
  font-size: .7rem; letter-spacing: .04em; color: var(--ivory);
  background: rgba(17, 27, 58, .72); padding: 3px 9px; border-radius: 999px;
  max-width: calc(100% - 20px); line-height: 1.4;
}
.cm-style-schematic-illustration { background: var(--navy); }
.cm-illus .cm-compare-stage { aspect-ratio: 1 / 1; background: var(--navy); }
.cm-card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.cm-card h3 { font-size: 1.45rem; margin-bottom: .3em; }
.cm-card-short { font-size: .92rem; color: var(--muted); line-height: 1.6; flex: 1; margin-bottom: 14px; }
.cm-card-meta { display: flex; gap: 18px; margin: 0 0 16px; padding-top: 12px; border-top: 1px solid rgba(196, 154, 69, .2); }
.cm-card-meta dt { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dark); font-weight: 500; }
.cm-card-meta dd { margin: 0; font-size: .9rem; color: var(--navy); font-weight: 400; }
:lang(ar) .cm-card-meta dt, :lang(zh) .cm-card-meta dt, :lang(ar) .cm-ai-chip { letter-spacing: 0; }

.cm-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cm-badge { font-size: .72rem; font-weight: 500; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--gold-dark); background: rgba(196, 154, 69, .08); }
.cm-badge-populaire { background: var(--gold-grad); color: var(--navy-deep); border-color: transparent; }
.cm-badge-non-chirurgical { color: var(--navy); border-color: rgba(27, 42, 85, .2); background: rgba(27, 42, 85, .05); }

.cm-empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.cm-error { text-align: start; color: var(--text); max-width: 680px; margin: 0 auto; }

/* ---------- Placeholder élégant (image manquante) ---------- */
.cm-ph {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(circle at 30% 20%, #fff 0%, var(--ivory) 45%, var(--cream) 100%);
  color: var(--gold-dark); text-align: center; padding: 16px;
}
.cm-ph::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(196, 154, 69, .35); border-radius: calc(var(--radius) - 8px); pointer-events: none; }
.cm-ph-mark { font-family: var(--f-script); font-size: 4rem; line-height: 1; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .2em; }
.cm-ph-line { width: 40px; height: 1px; background: var(--gold); }
.cm-ph-text { font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; }
:lang(ar) .cm-ph-text, :lang(zh) .cm-ph-text { letter-spacing: .02em; font-size: .85rem; }
[data-media].is-missing .cm-ph { display: flex; }
[data-media].is-missing img, [data-media].is-missing .cm-ai-chip { display: none; }

/* ---------- Fiche : fil d'Ariane & hero ---------- */
.cm-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .84rem; color: var(--muted); padding-top: 22px; }
.cm-crumbs a:hover { color: var(--gold-dark); }
.cm-crumbs span[aria-current] { color: var(--navy); }

.cm-p-hero { padding: 28px 0 56px; position: relative; overflow: hidden; }
.cm-p-hero::before {
  content: ""; position: absolute; width: 700px; height: 700px; border-radius: 50%;
  inset-inline-end: -200px; top: -220px; pointer-events: none;
  background: radial-gradient(circle, rgba(230, 198, 126, .26), transparent 65%);
}
.cm-p-hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; position: relative; }
.cm-p-intro h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.cm-p-intro .kicker:hover { color: var(--navy); }
.cm-p-intro .cm-badges { margin-top: 4px; }

/* ---------- Curseur avant / après ---------- */
.cm-compare { margin: 0; width: min(480px, 100%); justify-self: center; }
.cm-compare-stage {
  --pos: 50%;
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; touch-action: pan-y;
  border-radius: 28px; background: var(--cream);
  outline: 1px solid var(--gold); outline-offset: 10px;
  box-shadow: 0 40px 80px -40px rgba(17, 27, 58, .45);
  user-select: none;
}
.cm-compare-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.cm-before-wrap { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cm-ba-label {
  position: absolute; top: 14px; z-index: 3; font-size: .72rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ivory); background: rgba(17, 27, 58, .62); padding: 4px 11px; border-radius: 999px;
}
.cm-ba-before { left: 14px; }
.cm-ba-after { right: 14px; }
:lang(ar) .cm-ba-label, :lang(zh) .cm-ba-label { letter-spacing: 0; font-size: .82rem; }
.cm-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--gold-light); z-index: 2; pointer-events: none; }
.cm-handle span {
  position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--navy); border: 2px solid var(--gold-light);
  box-shadow: 0 8px 20px -6px rgba(17, 27, 58, .6);
}
.cm-handle span::before, .cm-handle span::after {
  content: ""; position: absolute; top: 50%; width: 0; height: 0; border: 6px solid transparent; transform: translateY(-50%);
}
.cm-handle span::before { left: 7px; border-right-color: var(--gold-light); }
.cm-handle span::after { right: 7px; border-left-color: var(--gold-light); }
.cm-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; z-index: 4;
  opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none;
}
.cm-range:focus-visible + .cm-ph, .cm-compare-stage:focus-within { outline-color: var(--navy); }
.cm-compare-stage.is-missing .cm-handle,
.cm-compare-stage.is-missing .cm-range,
.cm-compare-stage.is-missing .cm-ba-label,
.cm-compare-stage.is-missing .cm-before-wrap { display: none; }
.cm-compare-stage .cm-ph-mark { font-size: 6rem; }

.cm-compare figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 22px; text-align: center; font-size: .8rem; color: var(--muted); }
.cm-cap-ai { color: var(--gold-dark); font-weight: 500; }
.cm-cap-ph { display: none; }
.cm-compare:has(.is-missing) .cm-cap-ai, .cm-compare:has(.is-missing) .cm-cap-hint { display: none; }
.cm-compare:has(.is-missing) .cm-cap-ph { display: block; }

/* ---------- L'essentiel ---------- */
.cm-facts-wrap { padding: 0 0 20px; }
.cm-facts-title { font-size: 1.1rem; font-family: var(--f-body); font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: 14px; }
:lang(ar) .cm-facts-title, :lang(zh) .cm-facts-title { letter-spacing: .04em; }
.cm-facts {
  display: grid; grid-template-columns: repeat(7, 1fr); margin: 0;
  background: #fff; border: 1px solid rgba(196, 154, 69, .3); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cm-fact { padding: 20px 18px; border-inline-start: 1px solid rgba(196, 154, 69, .2); }
.cm-fact:first-child { border-inline-start: 0; }
.cm-fact svg { width: 22px; height: 22px; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.cm-fact dt { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); line-height: 1.35; margin-bottom: 6px; }
:lang(ar) .cm-fact dt, :lang(zh) .cm-fact dt { letter-spacing: 0; font-size: .82rem; }
.cm-fact dd { margin: 0; font-family: var(--f-display); font-size: 1.2rem; font-weight: 600; color: var(--navy); line-height: 1.25; font-variant-numeric: lining-nums; }
.cm-card-meta dd, .cm-journey p, .step-n { font-variant-numeric: lining-nums; }

/* ---------- Corps de la fiche ---------- */
.cm-p-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 64px; padding-top: 56px; padding-bottom: 90px; align-items: start; }
.cm-sec { padding-bottom: 34px; margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.cm-sec:last-child { border-bottom: 0; margin-bottom: 0; }
.cm-sec h2 { font-size: clamp(1.7rem, 2.6vw, 2.15rem); margin-bottom: .55em; }
.cm-sec > p { max-width: 70ch; }
.cm-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
.cm-checks li { position: relative; padding-inline-start: 30px; color: var(--navy); font-weight: 400; }
.cm-checks li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .38em; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold-grad);
  -webkit-mask: radial-gradient(circle, #000 60%, transparent 62%);
}
.cm-checks li::after {
  content: ""; position: absolute; inset-inline-start: 6px; top: calc(.38em + 4px); width: 5px; height: 8px;
  border: solid var(--ivory); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg);
}

.cm-journey { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.cm-journey li { display: grid; grid-template-columns: 46px 1fr; gap: 18px; position: relative; padding-bottom: 22px; }
.cm-journey li:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 22.5px; top: 48px; bottom: 2px; width: 1px; background: var(--line); }
.cm-journey .step-n { margin: 0; background: var(--ivory); }
.cm-journey h3, .cm-journey h4 { font-family: var(--f-display); font-size: 1.3rem; color: var(--ink); margin: 6px 0 .2em; font-weight: 600; }
.cm-journey p { margin: 0; color: var(--muted); font-size: .96rem; }

.cm-note {
  margin-top: 18px; padding: 16px 18px; border-radius: 14px; font-size: .88rem; color: var(--text);
  background: var(--cream); border-inline-start: 3px solid var(--gold);
}
.cm-sec .faq summary { font-size: 1.2rem; }

.cm-aside { position: sticky; top: 100px; }
.cm-aside-card { background: var(--navy-deep); color: rgba(254, 247, 237, .8); border-radius: 22px; padding: 30px 26px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.cm-aside-card .kicker { color: var(--gold-light); margin: 0; }
.cm-aside-card h3 { color: var(--ivory); margin: 0; }
.cm-aside-card p { font-size: .93rem; margin: 0 0 6px; }
.cm-aside-card .btn-outline, .cm-btn-light { color: var(--ivory); border-color: var(--gold-light); }
.cm-aside-card .btn-outline:hover, .cm-btn-light:hover { background: rgba(230, 198, 126, .12); }

.cm-related .cm-group-head { border-color: rgba(196, 154, 69, .35); }
.cm-cta { text-align: center; }
.cm-cta .lead { margin-inline: auto; }
.cm-cta .hero-ctas { justify-content: center; }
.cm-cta .fineprint { max-width: 62ch; }

.cm-notfound { padding: 90px 24px 120px; text-align: center; }
.cm-notfound .kicker::before { display: none; }
.cm-notfound .lead { margin-inline: auto; }

/* ---------- Pages pré-rendues : filtres, besoins, maillage interne ---------- */
.cm-card[hidden], .cm-group[hidden], .cm-filters[hidden], .cm-empty[hidden] { display: none !important; }
.cm-group-head h2 a:hover { color: var(--gold-dark); }
.cm-needs { margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--line); }
.cm-needs h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: 28px; }
.cm-needs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.cm-needs h3 { font-family: var(--f-body); font-size: .78rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--navy-deep); margin-bottom: 12px; }
:lang(ar) .cm-needs h3, :lang(zh) .cm-needs h3 { letter-spacing: .02em; font-size: .92rem; }
.cm-needs ul, .cm-more ul { list-style: none; margin: 0; padding: 0; }
.cm-needs li + li { margin-top: 8px; }
.cm-needs a, .cm-more a { color: var(--text); transition: color .2s; }
.cm-needs a:hover, .cm-more a:hover { color: var(--gold-dark); }
.cm-more { margin-top: 44px; }
.cm-more h2 { font-family: var(--f-body); font-size: .8rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: 14px; }
:lang(ar) .cm-more h2, :lang(zh) .cm-more h2 { letter-spacing: .02em; font-size: .92rem; }
.cm-more ul { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-more li a { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; background: rgba(255, 255, 255, .6); }
.cm-more li a:hover { border-color: var(--gold); }
.cm-crumbs { padding-bottom: 4px; }
.cm-hero + .cm-toolbar { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .cm-facts { grid-template-columns: repeat(4, 1fr); }
  .cm-fact:nth-child(5) { border-inline-start: 0; }
  .cm-fact:nth-child(n+5) { border-top: 1px solid rgba(196, 154, 69, .2); }
  .cm-p-body { grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; }
}
@media (max-width: 920px) {
  .cm-grid { grid-template-columns: repeat(2, 1fr); }
  .cm-p-hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .cm-compare { width: min(400px, 100%); }
  .cm-p-body { grid-template-columns: 1fr; }
  .cm-needs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm-aside { position: static; }
  .cm-toolbar { top: 76px; }
}
@media (max-width: 600px) {
  .cm-hero { padding: 36px 0 18px; }
  .cm-toolbar { padding: 10px 0; position: static; }
  .cm-compare { width: min(320px, 100%); }
  .cm-tabs { margin-inline: -16px; padding-inline: 16px; margin-bottom: 8px; }
  .cm-search { flex-basis: 100%; max-width: none; }
  .cm-tagfilter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .cm-tagfilter::-webkit-scrollbar { display: none; }
  .cm-tagfilter button { flex: none; }
  .cm-grid { grid-template-columns: 1fr; gap: 18px; }
  .cm-group-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cm-group + .cm-group { margin-top: 52px; }
  .cm-p-hero { padding-bottom: 36px; }
  .cm-compare-stage { border-radius: 22px; outline-offset: 6px; }
  .cm-facts { grid-template-columns: repeat(2, 1fr); }
  .cm-fact { border-inline-start: 0; border-top: 1px solid rgba(196, 154, 69, .2); padding: 16px 14px; }
  .cm-fact:nth-child(even) { border-inline-start: 1px solid rgba(196, 154, 69, .2); }
  .cm-fact:nth-child(-n+2) { border-top: 0; }
  .cm-fact:last-child { grid-column: 1 / -1; border-inline-start: 0; }
  .cm-fact dd { font-size: 1.08rem; }
  .cm-checks { grid-template-columns: 1fr; }
  .cm-needs-grid { grid-template-columns: 1fr; gap: 22px; }
  .cm-p-body { padding-top: 36px; padding-bottom: 60px; }
  .cm-cta .hero-ctas .btn { width: 100%; }
}
