/* ============================================================
   SOS Medco — Design system
   Palette extraite du logo : cercles entrelacés bleu sarcelle,
   vert et orange autour d'une croix médicale.
   ============================================================ */

:root {
  /* Couleurs primaires (bleus du logo) */
  --c-primary:       #1B5E7B;
  --c-primary-dark:  #14425C;
  --c-primary-ink:   #0F2F42;
  /* Secondaire (verts du logo) */
  --c-green:         #3D9B8F;
  --c-green-light:   #7FC4A4;
  /* Accent conversion (orange du logo) */
  --c-accent:        #E8883A;
  --c-accent-dark:   #C96F24;
  /* Neutres */
  --c-bg:            #F7FAF9;
  --c-surface:       #FFFFFF;
  --c-border:        #DCE7E4;
  --c-text:          #21343E;
  --c-text-soft:     #55707C;
  /* Typo */
  --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(15, 47, 66, .08);
  --shadow-lift: 0 6px 24px rgba(15, 47, 66, .14);
  --maxw: 1160px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.65;
  font-size: 1.0625rem;
}
img { max-width: 100%; height: auto; }
a { color: var(--c-primary); }
a:hover { color: var(--c-primary-dark); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
#site-header {
  background: var(--c-surface);
  border-bottom: 3px solid var(--c-primary);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.logo-wrap { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--c-primary-ink); }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text strong { font-size: 1.25rem; letter-spacing: .3px; }
.logo-text span { font-size: .78rem; color: var(--c-text-soft); }

#main-nav { display: flex; align-items: center; gap: .25rem; }
#main-nav > a, .nav-drop-btn {
  display: inline-block; padding: .55rem .85rem; border-radius: 6px;
  text-decoration: none; color: var(--c-text); font-weight: 600; font-size: .95rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
#main-nav > a:hover, .nav-drop-btn:hover { background: var(--c-bg); color: var(--c-primary-dark); }
#main-nav > a.active, .nav-dropdown.active .nav-drop-btn { color: var(--c-primary); }
#main-nav .nav-cta {
  background: var(--c-accent); color: #fff; margin-left: .5rem;
}
#main-nav .nav-cta:hover, #main-nav .nav-cta.active { background: var(--c-accent-dark); color: #fff; }

.nav-dropdown { position: relative; }
.nav-drop-menu {
  position: absolute; top: 100%; left: 0; min-width: 320px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); padding: .5rem; display: none; flex-direction: column;
}
.nav-dropdown.open .nav-drop-menu { display: flex; }
.nav-drop-menu a {
  padding: .6rem .8rem; border-radius: 6px; text-decoration: none;
  color: var(--c-text); font-size: .95rem;
}
.nav-drop-menu a:hover { background: var(--c-bg); color: var(--c-primary-dark); }

.hamburger { display: none; background: none; border: 0; cursor: pointer; padding: .5rem; }
.hamburger span { display: block; width: 26px; height: 3px; background: var(--c-primary-ink); margin: 5px 0; border-radius: 2px; transition: .25s; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--c-primary-dark) 0%, var(--c-primary) 55%, var(--c-green) 100%);
  color: #fff; padding: 4rem 0 4.5rem;
}
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.2; margin-bottom: 1rem; }
.hero p.lead { font-size: 1.15rem; opacity: .93; margin-bottom: 1.75rem; max-width: 40rem; }
.hero-visual { text-align: center; }
.hero-visual img { width: min(420px, 88%); height: auto; filter: drop-shadow(0 10px 28px rgba(0,0,0,.3)); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; padding: .8rem 1.6rem; border-radius: 8px;
  font-weight: 700; text-decoration: none; font-size: 1rem;
  transition: transform .15s, box-shadow .15s; border: 2px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-dark); color: #fff; box-shadow: var(--shadow-lift); }
.btn-outline { border-color: #fff; color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,.14); color: #fff; }
.btn-outline-dark { border-color: var(--c-primary); color: var(--c-primary); }
.btn-outline-dark:hover { background: var(--c-primary); color: #fff; }
.btn-row { display: flex; gap: .9rem; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section { padding: 3.5rem 0; }
.section-alt { background: var(--c-surface); border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.section-head { max-width: 46rem; margin-bottom: 2.25rem; }
.section-head h2 { font-size: 1.75rem; color: var(--c-primary-ink); margin-bottom: .6rem; }
.section-head p { color: var(--c-text-soft); }
.kicker {
  display: inline-block; font-size: .78rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--c-green); margin-bottom: .5rem;
}

/* ---------- Cartes piliers ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.card-tag { font-size: .78rem; font-weight: 700; color: var(--c-green); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .5rem; }
.card h3 { font-size: 1.18rem; color: var(--c-primary-ink); margin-bottom: .6rem; line-height: 1.35; }
.card h3 a { text-decoration: none; color: inherit; }
.card h3 a:hover { color: var(--c-primary); }
.card p { font-size: .95rem; color: var(--c-text-soft); flex: 1; }
.card .card-link { margin-top: 1rem; font-weight: 700; text-decoration: none; color: var(--c-accent-dark); }
.card .card-link:hover { text-decoration: underline; }

/* ---------- Flux actualités ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.news-card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.news-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.news-thumb { aspect-ratio: 16/9; object-fit: cover; width: 100%; background: var(--c-border); }
.news-body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.news-meta { font-size: .82rem; color: var(--c-text-soft); margin-bottom: .45rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.news-meta .cat { color: var(--c-green); font-weight: 700; }
.news-body h3 { font-size: 1.08rem; line-height: 1.4; margin-bottom: .5rem; }
.news-body h3 a { text-decoration: none; color: var(--c-primary-ink); }
.news-body h3 a:hover { color: var(--c-primary); }
.news-body p { font-size: .93rem; color: var(--c-text-soft); flex: 1; }

/* ---------- Carrousel actualités ---------- */
.carousel { position: relative; display: flex; align-items: stretch; gap: .6rem; }
.carousel-viewport { overflow: hidden; flex: 1; }
.carousel-track { display: flex; gap: 1.5rem; transition: transform .45s ease; will-change: transform; }
.carousel-slide { flex: 0 0 calc((100% - 3rem) / 3); display: flex; flex-direction: column; }
.carousel-btn {
  align-self: center; flex: 0 0 auto;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-primary);
  font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
  transition: background .15s, color .15s, transform .15s;
}
.carousel-btn:hover { background: var(--c-primary); color: #fff; transform: scale(1.06); }
.carousel-btn[disabled] { opacity: .35; cursor: default; transform: none; }
.carousel-btn[disabled]:hover { background: var(--c-surface); color: var(--c-primary); }
.carousel-dots {
  position: absolute; left: 0; right: 0; bottom: -1.6rem;
  display: flex; justify-content: center; gap: .5rem;
}
.carousel-dots button {
  width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0;
  background: var(--c-border); cursor: pointer; transition: background .15s, transform .15s;
}
.carousel-dots button.active { background: var(--c-primary); transform: scale(1.25); }
@media (max-width: 980px) { .carousel-slide { flex-basis: calc((100% - 1.5rem) / 2); } }
@media (max-width: 640px) { .carousel-slide { flex-basis: 100%; } .carousel-btn { display: none; } }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 2.5rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .5rem .95rem; border-radius: 6px; text-decoration: none; font-weight: 600;
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
}
.pagination a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pagination .current { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pagination .disabled { opacity: .45; }

/* ---------- Contenu long (piliers, articles) ---------- */
.page-hero {
  background: linear-gradient(120deg, var(--c-primary-dark), var(--c-primary));
  color: #fff; padding: 3rem 0 3.25rem;
}
/* Image d'illustration en fond du bandeau : voile sombre dégradé pour garder
   le titre très lisible (contraste AAA côté texte), image cover à droite. */
.page-hero.has-bg {
  background:
    linear-gradient(100deg, rgba(15, 47, 66, .93) 0%, rgba(17, 55, 78, .88) 45%, rgba(20, 66, 92, .55) 100%),
    var(--hero-bg) center right / cover no-repeat;
  padding: 3.6rem 0 3.6rem;
}
.page-hero h1 {
  font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.25; max-width: 54rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.page-hero .lead { margin-top: .9rem; font-size: 1.1rem; opacity: .95; max-width: 50rem; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.breadcrumb { font-size: .85rem; margin-bottom: 1rem; opacity: .9; }
.breadcrumb a { color: #fff; }

/* Boutons de partage (dans le bandeau) */
.share-row { display: flex; align-items: center; gap: .55rem; margin-top: 1.4rem; flex-wrap: wrap; }
.share-label { font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff;
  border: 1px solid rgba(255, 255, 255, .35);
  transition: background .15s, transform .15s;
}
.share-btn:hover { background: var(--c-accent); border-color: var(--c-accent); color: #fff; transform: translateY(-2px); }

/* Ce bloc porte aussi la classe .container : garder sa gouttière latérale
   (1.25rem), sinon le texte se colle aux bords sur mobile. */
.article-layout { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(240px, 1fr); gap: 3rem; padding: 3rem 1.25rem; }
/* Garde-fou : les enfants larges (tableaux) scrollent dans leur propre boîte
   au lieu d'étirer la colonne de grille. */
.article-content, .sidebar { min-width: 0; }
.article-content h2 { font-size: 1.55rem; color: var(--c-primary-ink); margin: 2.4rem 0 1rem; padding-bottom: .45rem; border-bottom: 2px solid var(--c-green-light); }
.article-content h2:first-child { margin-top: 0; }
.article-content h3 { font-size: 1.22rem; color: var(--c-primary); margin: 1.8rem 0 .8rem; }
.article-content h4 { font-size: 1.05rem; color: var(--c-primary-ink); margin: 1.4rem 0 .6rem; }
.article-content p { margin-bottom: 1.05rem; }
.article-content ul, .article-content ol { margin: 0 0 1.2rem 1.4rem; }
.article-content li { margin-bottom: .45rem; }
.article-content a { font-weight: 600; }
.article-content .fig { margin: 1.5rem 0; }
.article-content .fig img { border-radius: var(--radius); box-shadow: var(--shadow); }

/* Tableaux de synthèse */
.article-content table {
  width: 100%; border-collapse: collapse; margin: 1.4rem 0 1.8rem;
  background: var(--c-surface); box-shadow: var(--shadow); border-radius: var(--radius);
  overflow: hidden; font-size: .95rem;
}
.article-content th {
  background: var(--c-primary); color: #fff; text-align: left;
  padding: .75rem .9rem; font-weight: 700;
}
.article-content td { padding: .7rem .9rem; border-top: 1px solid var(--c-border); vertical-align: top; }
.article-content tbody tr:nth-child(even) { background: #F2F7F5; }
.table-scroll { overflow-x: auto; }

/* Encadrés */
.callout {
  border-left: 4px solid var(--c-green); background: #EEF6F3;
  padding: 1.1rem 1.3rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0;
}
.callout.warn { border-color: var(--c-accent); background: #FDF3E9; }
.callout strong:first-child { color: var(--c-primary-ink); }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; align-self: start; position: sticky; top: 96px; }
.sidebar-box {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow);
}
.sidebar-box h2, .sidebar-box h3 { font-size: 1.02rem; color: var(--c-primary-ink); margin-bottom: .8rem; }
.sidebar-box ul { list-style: none; }
.sidebar-box li { margin-bottom: .6rem; font-size: .93rem; }
.sidebar-box .toc a { text-decoration: none; color: var(--c-text-soft); }
.sidebar-box .toc a:hover { color: var(--c-primary); }
.sidebar-cta { background: linear-gradient(135deg, var(--c-primary), var(--c-green)); color: #fff; border: 0; }
.sidebar-cta h2, .sidebar-cta h3 { color: #fff; }
.sidebar-cta p { font-size: .92rem; margin-bottom: 1rem; opacity: .93; }

/* Bandeau CTA */
.cta-band { background: linear-gradient(120deg, var(--c-primary-dark), var(--c-primary)); color: #fff; text-align: center; }
.cta-band h2 { font-size: 1.6rem; margin-bottom: .7rem; }
.cta-band p { max-width: 42rem; margin: 0 auto 1.6rem; opacity: .92; }

/* ---------- Publicité boutique SOS Ehpad ---------- */
.promo-box h2 { color: var(--c-accent-dark); }
.promo-card {
  display: flex; gap: .7rem; align-items: center;
  padding: .6rem; margin-bottom: .55rem; border-radius: 8px;
  border: 1px solid var(--c-border); text-decoration: none; color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
}
.promo-card:hover { border-color: var(--c-accent); box-shadow: var(--shadow); }
.promo-card-img { width: 52px; height: 52px; object-fit: contain; border-radius: 6px; background: #fff; flex: 0 0 52px; }
.promo-card-body { display: flex; flex-direction: column; gap: .15rem; font-size: .86rem; line-height: 1.35; }
.promo-card-body strong { color: var(--c-primary-ink); }
.promo-card-price { color: var(--c-accent-dark); font-weight: 700; }
.promo-badge { font-style: normal; background: var(--c-accent); color: #fff; border-radius: 4px; padding: 0 .35rem; font-size: .72rem; }
.promo-all { display: block; margin-top: .6rem; font-size: .85rem; font-weight: 700; text-decoration: none; color: var(--c-primary); }
.promo-all:hover { text-decoration: underline; }

.promo-endcta {
  display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--c-primary-dark), var(--c-primary));
  border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 2.2rem 0 0;
  color: #fff;
}
.promo-endcta-img { width: 92px; height: 92px; flex: 0 0 92px; object-fit: contain; background: #fff; border-radius: 10px; }
.promo-endcta-body { flex: 1; min-width: 220px; }
.promo-endcta-kicker { font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--c-green-light); margin: 0 0 .25rem; }
.promo-endcta-title { font-size: 1.06rem; font-weight: 800; margin: 0 0 .3rem; }
.promo-endcta-arg { font-size: .88rem; opacity: .88; margin: 0; }
.promo-endcta-actions { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.promo-endcta-more { color: rgba(255,255,255,.85); font-size: .8rem; text-align: center; text-decoration: underline; }
@media (max-width: 640px) { .promo-endcta-actions { width: 100%; } }

/* Fiche produit dynamique */
.fiche-head { display: flex; gap: 1.6rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.6rem; }
.fiche-img { width: min(320px, 100%); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.fiche-buy { flex: 1; min-width: 240px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.fiche-price { font-size: 1.7rem; font-weight: 800; color: var(--c-primary-ink); margin-bottom: .8rem; }
.fiche-price s { font-size: 1.05rem; color: var(--c-text-soft); margin-left: .5rem; }
.fiche-note { font-size: .8rem; color: var(--c-text-soft); margin-top: .7rem; }
.fiche-short { font-size: 1.05rem; }
.fiche-desc img { border-radius: 8px; }
/* Le HTML boutique est dépouillé de ses styles (promoCleanHtml) : la charte locale fait foi. */
.fiche-desc, .fiche-desc p, .fiche-desc li, .fiche-desc td { color: var(--c-text); }
.fiche-desc h2, .fiche-desc h3, .fiche-desc h4, .fiche-desc strong { color: var(--c-primary-ink); }
.fiche-desc em { color: var(--c-text-soft); }
.fiche-desc table { font-size: .92rem; }
.fiche-desc, .fiche-short { overflow-wrap: break-word; }

/* ---------- Encart transparence IA ---------- */
.encart-ia {
  display: flex; gap: 1rem; align-items: flex-start;
  margin-top: 2.5rem; padding: 1.2rem 1.4rem;
  background: #F2F7F5; border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-green); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .92rem; color: var(--c-text-soft);
}
.encart-ia-icon { font-size: 1.5rem; line-height: 1; }
.encart-ia p { margin: 0 0 .4rem; }
.encart-ia p:last-child { margin-bottom: 0; }
.encart-ia strong { color: var(--c-primary-ink); }
.encart-ia a { font-weight: 700; color: var(--c-primary); }

/* ---------- Footer ---------- */
#site-footer { background: var(--c-primary-ink); color: #C8D8DE; margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 2.5rem; padding: 3rem 1.25rem 2rem; }
.footer-brand p { font-size: .92rem; margin-top: .8rem; }
.footer-brand strong { color: #fff; }
.footer-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--c-green-light); margin-bottom: .9rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: .55rem; }
.footer-col a { color: #C8D8DE; text-decoration: none; font-size: .92rem; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-sources { margin-top: .3rem; }
.footer-title + .footer-title, ul + .footer-title { margin-top: 1.4rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding: 1.2rem 1.25rem; font-size: .82rem; opacity: .8; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero p.lead { margin-inline: auto; }
  .btn-row { justify-content: center; }
  /* minmax(0, …) et non 1fr : sinon un enfant large (tableau de synthèse)
     élargit la piste et pousse tout l'article hors de l'écran. */
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .hamburger { display: block; }
  /* #main-nav uniquement : un sélecteur nav nu attraperait aussi les
     breadcrumb/pagination/legal-toc et les sortirait du flux. */
  #main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--c-surface); flex-direction: column; align-items: stretch;
    padding: .8rem 1.25rem 1.2rem; border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-lift);
  }
  #main-nav.open { display: flex; }
  #main-nav .nav-cta { margin-left: 0; text-align: center; }
  .nav-drop-menu { position: static; box-shadow: none; border: 0; padding-left: 1rem; min-width: 0; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media print {
  #site-header, #site-footer, .sidebar, .cta-band, .pagination { display: none !important; }
  .article-layout { grid-template-columns: 1fr; padding: 0; }
  body { background: #fff; font-size: 11pt; }
  .article-content a { color: #000; text-decoration: none; }
}
