.ri-product-page {
  --ri-ink: #14243a;
  --ri-ink-2: #24384f;
  --ri-muted: #617083;
  --ri-line: #dce4ec;
  --ri-soft: #f5f8fb;
  --ri-soft-2: #eef4f8;
  --ri-accent: #1f6f9e;
  --ri-accent-dark: #174f72;
  --ri-accent-soft: #eaf4fa;
  --ri-gold: #b98a3d;
  --ri-gold-soft: #fbf5e9;
  --ri-success: #2d6a4f;
  --ri-success-soft: #eef8f2;
  --ri-danger: #a84444;
  --ri-danger-soft: #fff1f1;
  --ri-radius: 18px;
  --ri-shadow: 0 14px 36px rgba(20, 36, 58, .08);
  color: var(--ri-ink);
  font-size: 1rem;
  line-height: 1.72;
  max-width: 1120px;
  margin-inline: auto;
}

.ri-product-page * { box-sizing: border-box; }
.ri-product-page > * + * { margin-top: 2.25rem; }
.ri-product-page p { margin: 0 0 1rem; }
.ri-product-page ul,
.ri-product-page ol { margin: .75rem 0 1rem; }
.ri-product-page a {
  color: var(--ri-accent-dark);
  text-decoration-thickness: .08em;
  text-underline-offset: .16em;
}
.ri-product-page h2,
.ri-product-page h3,
.ri-product-page h4 {
  color: var(--ri-ink);
  line-height: 1.22;
  letter-spacing: -.012em;
}
.ri-product-page h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
}
.ri-product-page h3 {
  margin: 1.5rem 0 .75rem;
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
}
.ri-product-page h4 { margin: 1rem 0 .55rem; font-size: 1.05rem; }

/* Fallback : un ancien HTML simple reste propre meme sans classes avancees. */
.ri-product-page > p:first-child {
  display: inline-block;
  margin: 0 0 .8rem;
  padding: .42rem .72rem;
  border-radius: 999px;
  background: var(--ri-accent-soft);
  color: var(--ri-accent-dark);
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.ri-product-page > p:nth-child(2) {
  max-width: 78ch;
  color: var(--ri-muted);
  font-size: 1.08rem;
}

/* Hero produit */
.ri-product-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.55rem, 3.4vw, 3rem);
  border: 1px solid #d5e2ec;
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 0%, rgba(31, 111, 158, .13), transparent 36%),
    linear-gradient(135deg, #ffffff 0%, #f3f8fb 58%, #eef5f9 100%);
  box-shadow: var(--ri-shadow);
}
.ri-product-hero::after {
  content: "";
  position: absolute;
  right: -72px;
  bottom: -96px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(31, 111, 158, .13);
  border-radius: 50%;
}
.ri-product-hero > * { position: relative; z-index: 1; }
.ri-product-hero .ri-eyebrow,
.ri-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .8rem;
  padding: .4rem .72rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d7e4ed;
  color: var(--ri-accent-dark);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.ri-product-subtitle {
  margin: 0 0 .65rem;
  color: var(--ri-ink);
  font-size: clamp(1.28rem, 2.2vw, 1.75rem);
  font-weight: 750;
  line-height: 1.3;
}
.ri-product-hero .ri-lead,
.ri-hero-copy {
  max-width: 78ch;
  margin-bottom: 0;
  color: var(--ri-muted);
  font-size: clamp(1.02rem, 1.4vw, 1.13rem);
}

/* Chiffres cles */
.ri-keyfacts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .95rem;
}
.ri-keyfact {
  min-height: 118px;
  padding: 1.12rem 1.15rem;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(20, 36, 58, .045);
}
.ri-keyfact strong {
  display: block;
  color: var(--ri-accent-dark);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.2;
}
.ri-keyfact span {
  display: block;
  margin-top: .42rem;
  color: var(--ri-muted);
  font-size: .9rem;
  line-height: 1.4;
}

/* Sommaire */
.ri-toc {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--ri-line);
  border-radius: 16px;
  background: var(--ri-soft);
}
.ri-toc strong {
  display: block;
  margin-bottom: .65rem;
  color: var(--ri-ink);
  font-size: 1.03rem;
}
.ri-toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .35rem 1.3rem;
  margin: 0;
  padding-left: 1.25rem;
}
.ri-toc a { text-decoration: none; font-weight: 650; }
.ri-toc a:hover { text-decoration: underline; }

/* Sections */
.ri-product-section {
  padding: clamp(1.35rem, 2.5vw, 2.25rem);
  border: 1px solid var(--ri-line);
  border-radius: var(--ri-radius);
  background: #fff;
}
.ri-product-section.ri-section-soft { background: var(--ri-soft); }
.ri-product-section > :last-child { margin-bottom: 0; }
.ri-section-intro { max-width: 82ch; color: var(--ri-muted); font-size: 1.03rem; }
.ri-section-kicker {
  display: block;
  margin-bottom: .45rem;
  color: var(--ri-accent);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* Grilles et cartes */
.ri-product-grid,
.ri-profile-grid,
.ri-risk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.ri-card,
.ri-profile-card,
.ri-risk-card {
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--ri-line);
  border-radius: 14px;
  background: #fff;
}
.ri-card > :last-child,
.ri-profile-card > :last-child,
.ri-risk-card > :last-child { margin-bottom: 0; }
.ri-profile-card.ri-profile-fit {
  border-color: #cfe4d7;
  background: var(--ri-success-soft);
}
.ri-profile-card.ri-profile-avoid,
.ri-risk-card {
  border-color: #eed7d7;
  background: var(--ri-danger-soft);
}

/* Etapes / leviers */
.ri-steps {
  counter-reset: ri-step;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.ri-step {
  position: relative;
  min-height: 130px;
  padding: 1.15rem 1.15rem 1.15rem 4rem;
  border: 1px solid var(--ri-line);
  border-radius: 15px;
  background: #fff;
}
.ri-step::before {
  counter-increment: ri-step;
  content: counter(ri-step);
  position: absolute;
  top: 1.05rem;
  left: 1.05rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--ri-ink);
  color: #fff;
  font-weight: 800;
}
.ri-step h3,
.ri-step h4 { margin-top: 0; }

/* Tableaux */
.ri-product-table-wrap,
.ri-product-page > table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ri-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(20, 36, 58, .04);
}
.ri-product-page > table,
.ri-product-table {
  width: 100%;
  border-collapse: collapse;
}
.ri-product-table { min-width: 580px; }
.ri-product-page > table th,
.ri-product-page > table td,
.ri-product-table th,
.ri-product-table td {
  padding: .86rem .95rem;
  border: 0;
  border-bottom: 1px solid var(--ri-line);
  text-align: left;
  vertical-align: top;
}
.ri-product-page > table tr:last-child th,
.ri-product-page > table tr:last-child td,
.ri-product-table tr:last-child th,
.ri-product-table tr:last-child td { border-bottom: 0; }
.ri-product-page > table th,
.ri-product-table th {
  width: 36%;
  background: var(--ri-soft);
  color: var(--ri-ink);
  font-weight: 750;
}

/* Notes, fiscalite, vigilance */
.ri-note,
.ri-warning,
.ri-fiscal-box,
.ri-analysis-box {
  padding: 1.12rem 1.2rem;
  border-radius: 14px;
  border-left: 4px solid var(--ri-accent);
  background: var(--ri-soft);
}
.ri-warning {
  border-left-color: var(--ri-gold);
  background: var(--ri-gold-soft);
}
.ri-fiscal-box {
  border: 1px solid #cfe0ed;
  border-left: 4px solid var(--ri-accent);
  background: var(--ri-accent-soft);
}
.ri-analysis-box {
  border: 1px solid #d8e0e7;
  border-left: 4px solid var(--ri-ink-2);
  background: #f7f9fb;
}
.ri-note > :last-child,
.ri-warning > :last-child,
.ri-fiscal-box > :last-child,
.ri-analysis-box > :last-child { margin-bottom: 0; }

.ri-checklist { margin: .5rem 0 0; padding-left: 1.2rem; }
.ri-checklist li + li { margin-top: .45rem; }

/* CTA : le bouton pointe toujours vers le formulaire du theme en bas de page. */
.ri-product-cta {
  position: relative;
  overflow: hidden;
  padding: clamp(1.55rem, 3vw, 2.6rem);
  border-radius: 20px;
  background: linear-gradient(135deg, #16273d 0%, #203e59 100%);
  color: #fff;
  box-shadow: var(--ri-shadow);
}
.ri-product-cta::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -70px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(255,255,255,.055);
}
.ri-product-cta > * { position: relative; z-index: 1; }
.ri-product-cta h2,
.ri-product-cta h3 { color: #fff; }
.ri-product-cta p { max-width: 75ch; color: #eef4f8; }
.ri-product-cta .ri-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: .3rem;
  padding: .78rem 1.2rem;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 999px;
  background: #fff;
  color: var(--ri-ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  transition: transform .18s ease, box-shadow .18s ease;
}
.ri-product-cta .ri-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 22px rgba(0,0,0,.16);
}

.ri-disclaimer {
  padding-top: .85rem;
  border-top: 1px solid var(--ri-line);
  color: var(--ri-muted);
  font-size: .88rem;
  line-height: 1.55;
}

#contact-conseiller { scroll-margin-top: 120px; }

@media (max-width: 980px) {
  .ri-keyfacts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ri-toc ol { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .ri-product-page { font-size: .97rem; }
  .ri-product-page > * + * { margin-top: 1.6rem; }
  .ri-product-hero { border-radius: 18px; }
  .ri-keyfacts,
  .ri-product-grid,
  .ri-profile-grid,
  .ri-risk-grid,
  .ri-steps { grid-template-columns: 1fr; }
  .ri-keyfact { min-height: 0; }
  .ri-product-section { padding: 1.15rem; }
  .ri-product-page > table { display: block; overflow-x: auto; }
  .ri-product-table { min-width: 520px; }
  .ri-product-cta { border-radius: 18px; }
  .ri-product-cta .ri-button { width: 100%; }
}


@media (prefers-reduced-motion: reduce) {
  .ri-product-page *,
  .ri-product-page *::before,
  .ri-product-page *::after { scroll-behavior: auto !important; transition: none !important; }
}


/* Pages produit HTML : conserver la sidebar du theme lorsqu'elle est affectee a la page. */
body.ri-product-html-page #secondary,
body.ri-product-html-page aside.sidebar,
body.ri-product-html-page .sidebar-primary {
  display: block;
}

/* Visuel editorial principal insere dans le corps de la fiche produit. */
.ri-product-visual {
  margin: 1.4rem 0 2rem;
  overflow: hidden;
  border: 1px solid var(--ri-line);
  border-radius: var(--ri-radius);
  background: #fff;
  box-shadow: var(--ri-shadow);
}
.ri-product-visual img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}
.ri-product-visual figcaption {
  margin: 0;
  padding: .6rem .85rem;
  color: var(--ri-muted);
  font-size: .82rem;
  line-height: 1.4;
  background: #f8fafc;
  border-top: 1px solid var(--ri-line);
}

/* Maillage semantique / ressources internes */
.ri-related {
  padding: clamp(1.35rem, 2.5vw, 2.2rem);
  border: 1px solid var(--ri-line);
  border-radius: var(--ri-radius);
  background: linear-gradient(135deg, #f7fafc 0%, #eef5f9 100%);
}
.ri-related > :last-child { margin-bottom: 0; }
.ri-related-intro {
  max-width: 78ch;
  margin-bottom: 1rem !important;
  color: var(--ri-muted);
}
.ri-related-grid {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  gap: .85rem;
  align-items: stretch;
}
.ri-related-card {
  position: relative;
  display: flex !important;
  flex: 1 1 0 !important;
  flex-direction: column;
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  min-height: 0;
  margin: 0 !important;
  float: none !important;
  grid-column: auto !important;
  grid-row: auto !important;
  box-sizing: border-box;
  padding: .9rem 2.55rem .9rem 1rem;
  border: 1px solid #d7e2eb;
  border-radius: 14px;
  background: #fff;
  color: var(--ri-ink) !important;
  text-decoration: none !important;
  box-shadow: 0 5px 16px rgba(20, 36, 58, .04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ri-related-card::after {
  content: "→";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ri-accent);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  transition: transform .18s ease;
}
.ri-related-card:hover {
  transform: translateY(-2px);
  border-color: #b8cedd;
  box-shadow: 0 9px 22px rgba(20, 36, 58, .08);
}
.ri-related-card:hover::after {
  transform: translate(3px, -50%);
}
.ri-related-type {
  display: block;
  margin-bottom: .32rem;
  color: var(--ri-accent);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.ri-related-card strong {
  display: block;
  margin-bottom: .28rem;
  color: var(--ri-ink);
  font-size: 1.03rem;
  line-height: 1.35;
}
.ri-related-card span:last-child {
  color: var(--ri-muted);
  font-size: .9rem;
  line-height: 1.42;
}

.ri-contact-anchor {
  display: block;
  position: relative;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  visibility: hidden;
  scroll-margin-top: 120px;
}


/* Responsive du bloc de maillage (place en fin de fichier pour priorite de cascade). */
@media (max-width: 820px) {
  .ri-related-grid {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
  }
  .ri-related-card {
    flex: 1 1 auto !important;
    width: 100% !important;
  }
}
/* Bridge 4.14: wrapper for verified YouTube embeds and native WordPress video.
   CSS only: does not authorize/import iframes or alter the media source. */
.ri-video-embed {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
}
.ri-video-embed iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}
.ri-video-embed video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}
.ri-video-embed .wp-video {
    width: 100% !important;
    max-width: 100%;
}
