/**
 * Domotique — catégorie CMS 102 (Wi‑Fi + Bus fusionnés)
 * Charte Fusion : panneaux, nav catalogue, grilles vidéo 16:9
 */

/* Page hub Domotique */
.page-cms-category.cms-category-id-102.somef-lot-a-hub {
  max-width: 72rem;
}

.page-cms-category.cms-category-id-102 .somef-lot-a-hub__intro {
  margin-bottom: var(--spacing-xl, 2rem);
}

.page-cms-category.cms-category-id-102 .somef-lot-a-hub__intro .somef-cms-cat-banner {
  margin-bottom: 0;
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.06));
}

.page-cms-category.cms-category-id-102 .somef-lot-a-hub__intro .somef-cms-cat-banner img {
  max-height: clamp(12rem, 28vw, 18rem);
}

/* Conteneur principal */
.somef-cms-domotique {
  --domotique-gap: var(--spacing-lg, 1.5rem);
  margin-top: var(--spacing-md, 1rem);
}

/* Sommaire — contraste WCAG AA, focus visible, cible min. 44×44 px */
.somef-cms-domotique__nav {
  margin: 0 0 var(--spacing-xl, 2rem);
  padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.25rem);
  background: var(--color-bg-light, #f8f9fa);
  border: 1px solid var(--color-border, #d8d8d8);
  border-radius: var(--border-radius-md, 8px);
}

.somef-cms-domotique__nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md, 1rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.somef-cms-domotique__nav-item {
  margin: 0;
  padding: 0;
}

.somef-cms-domotique__nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.5rem;
  min-height: 2.75rem; /* 44 px — WCAG 2.5.5 */
  padding: 0.625rem 1.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: #1e2a31; /* ~12:1 sur #fff */
  background: #fff;
  border: 2px solid #2b3c45; /* ≥3:1 avec fond clair, pas de gris */
  border-radius: var(--border-radius-md, 8px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.somef-cms-domotique__nav-link:hover {
  color: #fff;
  background: #a82835;
  border-color: #a82835;
  box-shadow: 0 2px 8px rgba(168, 40, 53, 0.28);
  text-decoration: none;
}

.somef-cms-domotique__nav-link:focus {
  outline: none;
}

.somef-cms-domotique__nav-link:focus-visible {
  color: #1e2a31;
  background: #fff;
  border-color: #1e2a31;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2b3c45; /* anneau focus ≥3:1 */
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Nav + liens CMS : blanc dès que le fond est rouge */
.page-cms-category .somef-cms-domotique__nav-link:hover,
.page-cms-category .somef-cms-domotique__nav-link:active,
.somef-page-cms .somef-cms-domotique__nav-link:hover,
.somef-page-cms .somef-cms-domotique__nav-link:active {
  color: #fff;
  text-decoration: none;
}

.somef-cms-domotique__nav-link:active {
  color: #fff;
  background: #8f222e;
  border-color: #8f222e;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

/* Sections + ancres */
.somef-cms-domotique__section {
  scroll-margin-top: 6rem;
  margin-bottom: var(--spacing-xxl, 3rem);
}

.somef-cms-domotique__section:last-child {
  margin-bottom: 0;
}

.somef-cms-domotique__header {
  margin-bottom: var(--domotique-gap);
  text-align: center;
}

.somef-cms-domotique__section-title {
  margin: 0 0 var(--spacing-xs, 0.5rem);
  font-family: var(--font-family-bold);
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent-blue, #2b3c45);
  line-height: var(--line-height-tight, 1.25);
}

.somef-cms-domotique__section-title::after {
  content: '';
  display: block;
  width: 3rem;
  height: 2px;
  margin: var(--spacing-sm, 0.75rem) auto 0;
  background: var(--color-primary, #d33343);
}

.somef-cms-domotique__section-desc {
  margin: 0 auto;
  max-width: 42rem;
  font-size: clamp(0.9375rem, 0.9rem + 0.15vw, 1.0625rem);
  line-height: 1.55;
  color: var(--color-text-muted, #666);
}

/* Panneau contenu (carte Fusion) */
.somef-cms-domotique__panel {
  padding: var(--spacing-lg, 1.5rem);
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.04));
}

/* Grille média + texte */
.somef-cms-domotique__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--spacing-xl, 2rem);
  align-items: start;
}

.somef-cms-domotique__layout--reverse {
  direction: rtl;
}

.somef-cms-domotique__layout--reverse > * {
  direction: ltr;
}

.somef-cms-domotique__media {
  display: flex;
  flex-direction: column;
  gap: var(--domotique-gap);
}

.somef-cms-domotique__figure {
  margin: 0;
  border-radius: var(--border-radius-md, 8px);
  overflow: hidden;
  line-height: 0;
  background: var(--color-bg-light, #f3f5f6);
}

.somef-cms-domotique__figure img {
  width: 100%;
  height: auto;
  max-height: 11rem;
  object-fit: cover;
  display: block;
}

.somef-cms-domotique__figure--contain img {
  max-height: 9rem;
  object-fit: contain;
  padding: var(--spacing-sm, 0.75rem);
  box-sizing: border-box;
}

/* Portrait appareillages (330×421) — pages Système 43 / 45 */
.somef-cms-domotique__figure--portrait {
  max-width: min(20rem, 100%);
  margin-inline: auto;
}

.somef-cms-domotique__figure--portrait img {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: 330 / 421;
  object-fit: cover;
}

.somef-cms-domotique__doc-list {
  list-style: none;
  padding: 0;
  margin: var(--spacing-md, 1rem) 0 0;
}

.somef-cms-domotique__doc-list li {
  margin: 0 0 var(--spacing-sm, 0.75rem);
}

.somef-cms-domotique__doc-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--color-accent-blue, #2b3c45);
  text-decoration: none;
}

.somef-cms-domotique__doc-list a:hover {
  color: var(--color-primary, #d33343);
}

.somef-cms-domotique__video-ratio video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
  border-radius: inherit;
}

.somef-cms-domotique__video {
  margin: 0;
}

.somef-cms-domotique__video-ratio {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--border-radius-md, 8px);
  background: var(--color-bg-dark, #252122);
  box-shadow: 0 4px 16px rgba(37, 33, 34, 0.12);
}

.somef-cms-domotique__video-ratio iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.somef-cms-domotique__prose {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding: var(--spacing-sm, 0.75rem) 0;
}

.somef-cms-domotique__prose :where(p) {
  margin: 0 0 var(--spacing-md, 1rem);
  font-size: clamp(0.9375rem, 0.9rem + 0.1vw, 1rem);
  line-height: 1.65;
  color: var(--color-text, #333);
}

.somef-cms-domotique__prose :where(p:last-child) {
  margin-bottom: 0;
}

.somef-cms-domotique__lead {
  margin-top: var(--spacing-xs, 0.5rem);
  margin-bottom: var(--spacing-md, 1rem);
  padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.25rem);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-accent-blue, #2b3c45);
  background: linear-gradient(135deg, rgba(211, 51, 67, 0.06) 0%, rgba(43, 60, 69, 0.04) 100%);
  border-inline-start: 3px solid var(--color-primary, #d33343);
  border-radius: 0 var(--border-radius-md, 8px) var(--border-radius-md, 8px) 0;
}

/* CTA → catégories produits (294, 71, 226) — fond clair uniquement, pas de gris sur rouge */
.somef-cms-domotique__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-md, 1rem);
  margin-top: var(--spacing-lg, 1.5rem);
  padding: var(--spacing-lg, 1.25rem);
  background: #fff;
  border: 1px solid var(--color-border, #e8e8e8);
  border-radius: var(--border-radius-md, 8px);
}

/* Primaire rouge : texte blanc sur tous les états (écrase .page-cms a:hover) */
.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary),
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary),
.somef-page-cms .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: #fff;
  background: #a82835;
  border: 2px solid #a82835;
  border-radius: var(--border-radius-sm, 4px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):hover,
.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):focus,
.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):active,
.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):visited,
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):hover,
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):focus,
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):active,
.somef-page-cms .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):hover {
  color: #fff;
  text-decoration: none;
}

.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):hover,
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):hover,
.somef-page-cms .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):hover {
  background: #8f222e;
  border-color: #8f222e;
  box-shadow: 0 3px 10px rgba(168, 40, 53, 0.28);
}

.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):focus {
  outline: none;
}

.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):focus-visible,
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):focus-visible {
  color: #fff;
  background: #a82835;
  border-color: #1e2a31;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2b3c45;
}

.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):active,
.page-cms-category .somef-cms-domotique a.somef-cms-domotique__cta:not(.somef-cms-domotique__cta--secondary):active {
  background: #8f222e;
  border-color: #8f222e;
}

/* Secondaire : contour bleu nuit sur blanc (≥4.5:1), jamais gris sur fond rouge */
.somef-cms-domotique__cta--secondary {
  color: #2b3c45;
  background: #fff;
  border: 2px solid #2b3c45;
  box-shadow: none;
}

.somef-cms-domotique__cta--secondary:hover {
  color: #fff;
  background: #2b3c45;
  border-color: #2b3c45;
  box-shadow: 0 2px 8px rgba(43, 60, 69, 0.2);
  text-decoration: none;
}

.somef-cms-domotique__cta--secondary:focus-visible {
  color: #2b3c45;
  background: #fff;
  border-color: #1e2a31;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2b3c45;
}

/* Pas d’écrasement par les styles globaux .btn / .btn-secondary */
.somef-cms-domotique__actions .somef-cms-domotique__cta--secondary.btn,
.somef-cms-domotique__actions a.somef-cms-domotique__cta--secondary {
  color: #2b3c45;
  background-color: #fff;
  border-color: #2b3c45;
}

/* Galerie vidéos Wi‑Fi */
.somef-cms-domotique__gallery {
  margin-top: var(--spacing-xl, 2rem);
  padding-top: var(--spacing-xl, 2rem);
  border-top: 1px solid var(--color-border, #e8e8e8);
}

.somef-cms-domotique__gallery-title {
  margin: 0 0 var(--spacing-lg, 1.5rem);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted, #666);
}

.somef-cms-domotique__video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-lg, 1.25rem);
  max-width: 44rem;
  margin-inline: auto;
}

.somef-cms-domotique__video-grid .somef-cms-domotique__video {
  max-width: 100%;
}

.somef-cms-domotique__video-grid .somef-cms-domotique__video-ratio {
  padding-bottom: 56.25%;
  border-radius: var(--border-radius-md, 8px);
}

@media screen and (min-width: 1100px) {
  .somef-cms-domotique__video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: none;
    gap: var(--spacing-md, 1rem);
  }
}

/* Reset RTE / legacy dans la zone Domotique */
.somef-lot-a-hub__intro .somef-cms-domotique :where(ul, ol) {
  list-style: none;
  padding: 0;
  margin: 0;
}

.somef-lot-a-hub__intro .somef-cms-domotique :where(.video, .vid, .row, .col-md-3, .col-md-6, .col-md-12) {
  all: unset;
  display: revert;
}

.somef-lot-a-hub__intro .somef-cms-domotique .clearfix {
  display: none;
}

/* Tablet */
@media screen and (max-width: 992px) {
  .somef-cms-domotique__layout,
  .somef-cms-domotique__layout--reverse {
    grid-template-columns: 1fr;
    direction: ltr;
  }

  .somef-cms-domotique__layout--reverse > * {
    direction: ltr;
  }

  .somef-cms-domotique__video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .somef-cms-domotique__panel {
    padding: var(--spacing-md, 1rem);
  }
}

/* Mobile */
@media screen and (max-width: 576px) {
  .somef-cms-domotique__nav {
    padding: var(--spacing-sm, 0.75rem);
  }

  .somef-cms-domotique__nav-list {
    gap: var(--spacing-sm, 0.75rem);
  }

  .somef-cms-domotique__nav-link {
    flex: 1 1 calc(50% - 0.375rem);
    min-width: 0;
    width: 100%;
  }

  .somef-cms-domotique__video-grid {
    grid-template-columns: 1fr;
    max-width: 22rem;
  }

  .somef-cms-domotique__figure img {
    max-height: 9rem;
  }

  .somef-cms-domotique__header {
    text-align: left;
  }

  .somef-cms-domotique__section-title::after {
    margin-left: 0;
    margin-right: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .somef-cms-domotique__nav-link {
    transition: none;
  }
}
