/*
 * MCR v2.0-alpha2
 * Responsive compatibility layer for the historical MCR pages.
 * Loaded after each page's legacy inline styles so the original desktop
 * identity is preserved while fixed-width layouts can adapt to small screens.
 */

html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: #f8f8ff;
}

img {
  max-width: 100%;
}

#header,
#subtitle,
#marque,
#content,
#content_sc,
#content_index,
#footer,
#subfooter {
  width: 100% !important;
  max-width: 930px;
}

/* Shared navigation: the old pages use both <ul> and the historical <u1>. */
#subtitle nav,
#marque nav {
  width: 100%;
  height: 100%;
}

#subtitle nav > ul,
#subtitle nav > u1,
#marque nav > ul,
#marque nav > u1 {
  display: flex;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

#subtitle nav li,
#marque nav li {
  display: block;
}

#marque nav > ul,
#marque nav > u1 {
  justify-content: center;
  gap: 48px;
}

#subtitle nav a {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

/* Home: restore the original portfolio treatment. */
#content_index {
  height: 590px !important;
}

#content_index .portfolio-item-wrapper {
  background-color: #f8f8ff;
}

#content_index .portfolio-context,
#content_index .portfolio-context h2 {
  color: #4e4e4e;
  border-color: #4e4e4e;
}

#content_index .portfolio-context a:link,
#content_index .portfolio-context a:visited {
  color: #4e4e4e;
}

#content_index .portfolio-context a:hover,
#content_index .portfolio-context a:focus {
  color: #d16f4e;
  text-decoration: underline;
}

#content_index .portfolio-items article:hover img {
  opacity: 0.1;
  transform: rotate(-5deg) scale(1.8);
}

#content_index .portfolio-items article:hover .portfolio-context {
  opacity: 1;
  transform: scale(1);
}

/* The slider library creates an empty caption bar even when no caption is used. */
#slider .mc-caption-bg,
#slider .mc-caption-bg2,
#slider .mc-caption {
  display: none !important;
}

/* The logo is optically aligned with the surrounding copyright text. */
#footer img[src$="copyright.png"] {
  vertical-align: middle;
  transform: translateY(-2px);
}

/* Historical content images keep their desktop size but never overflow. */
#content img,
#content_sc img {
  height: auto;
}

/* Contact: two aligned columns on desktop, one fluid column on mobile. */
.contact-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  align-items: start;
  padding: 15px 0 0 !important;
}

.contact-layout > article,
.contact-layout > #formulaire {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
}

.contact-layout .cfg-contactform {
  width: 100% !important;
  margin: 0 !important;
}

.contact-layout .cfg-label {
  margin: 0 0 6px;
}

.contact-layout .cfg-label > div,
.contact-layout .cfg-element-content > div {
  text-align: center !important;
}

.contact-layout .cfg-element-content input[type="text"],
.contact-layout .cfg-element-content textarea {
  display: block;
  width: 100% !important;
  max-width: none;
}

.contact-layout .cfg-submit {
  width: 110px !important;
  margin: 0 auto !important;
}

@media (max-width: 960px) {
  body {
    padding-right: 14px;
    padding-left: 14px;
  }

  #header,
  #subtitle,
  #marque,
  #content,
  #content_sc,
  #content_index,
  #footer,
  #subfooter {
    margin-right: auto !important;
    margin-left: auto !important;
  }

  #header,
  #subtitle,
  #marque,
  #content,
  #content_sc,
  #content_index,
  #footer,
  #subfooter {
    background-size: 100% auto;
  }

  #header {
    height: auto !important;
    min-height: 96px;
    padding-top: 0 !important;
    aspect-ratio: 930 / 200;
    background-size: 100% 100%;
  }

  #header > a {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
  }

  #header > a > img {
    width: 67.53% !important;
    height: auto !important;
  }

  #footer,
  #subfooter {
    background-size: 100% 100%;
  }

  /* Home on narrow screens: one stable hero, then a compact 2 x 2 menu. */
  #content_index {
    height: auto !important;
    padding: 12px !important;
    background-repeat: repeat-y;
  }

  #content_index > section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  #content_index > section > article:first-child {
    grid-column: 1 / -1;
  }

  #aside1,
  #aside2,
  #aside3,
  #aside4 {
    position: relative !important;
    inset: auto !important;
    width: 100%;
  }

  #sliderFrame,
  #slider,
  #slider div.sliderInner {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 603 / 348;
  }

  #slider.mcr-home-slider,
  #slider.mcr-home-slider * {
    box-sizing: border-box;
  }

  #slider.mcr-home-slider {
    overflow: hidden;
    background: #f8f8ff;
  }

  #slider.mcr-home-slider > a {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 350ms ease;
  }

  #slider.mcr-home-slider > a.is-active {
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
  }

  #slider.mcr-home-slider > a > img {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }

  .mcr-home-slider-dots {
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: 10px;
    left: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
  }

  .mcr-home-slider-dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border: 1px solid rgba(78, 78, 78, 0.75);
    border-radius: 50%;
    background: rgba(248, 248, 255, 0.85);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    pointer-events: auto;
  }

  .mcr-home-slider-dot.is-active {
    border-color: #d16f4e;
    background: #d16f4e;
  }

  #content_index .portfolio-items {
    margin: 0 !important;
  }

  #content_index .portfolio-items article {
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
  }

  #content_index .portfolio-item-wrapper,
  #content_index .portfolio-item-wrapper > img {
    width: 100% !important;
  }

  #content_index .portfolio-item-wrapper > img {
    display: block;
    aspect-ratio: 278 / 149;
    object-fit: cover;
  }
}

@media (max-width: 800px) {
  #subtitle {
    height: auto !important;
    min-height: 75px;
    line-height: normal !important;
    background-size: 100% 100%;
  }

  #subtitle nav > ul,
  #subtitle nav > u1 {
    min-height: 75px;
    padding: 15px 10px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 24px;
  }

  #subtitle nav a {
    font-size: 14px;
  }

  #marque {
    line-height: normal !important;
    background-size: 100% 100%;
  }

  #marque nav > ul,
  #marque nav > u1 {
    min-height: 42px;
    padding: 10px 16px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 28px;
  }

  #content,
  #content_sc {
    height: auto !important;
    padding-top: 0 !important;
    overflow: hidden;
    background-repeat: repeat-y;
  }

  #content section > article,
  #content_sc section > article {
    float: none !important;
    width: 100% !important;
    padding: 16px 14px 24px;
  }

  #content .image,
  #content_sc .image {
    display: block;
    width: 100%;
  }

  #content .image img,
  #content_sc .image img,
  #content figure img,
  #content_sc figure img {
    float: none !important;
    display: block;
    width: 100% !important;
    max-width: 600px;
    height: auto !important;
    margin-right: auto;
    margin-left: auto;
  }

  #content #text,
  #content_sc #text,
  #content aside#text,
  #content_sc aside#text {
    position: static !important;
    width: 100% !important;
    margin-top: 16px;
    padding: 0;
    line-height: 1.45;
  }

  #content #inter,
  #content_sc #inter {
    width: 100%;
    overflow: hidden;
  }

  #content #inter img,
  #content_sc #inter img {
    width: 100% !important;
    height: auto !important;
  }

  #formulaire {
    float: none !important;
    width: 100% !important;
    padding: 0 14px 24px;
  }

  .contact-layout {
    display: block;
    padding: 15px 0 0 !important;
  }

  .contact-layout > article {
    margin-bottom: 30px !important;
  }

  .contact-layout > #formulaire {
    padding: 0;
  }

  #formulaire input,
  #formulaire textarea,
  #formulaire select {
    max-width: 100%;
    box-sizing: border-box;
  }

  #footer {
    min-height: 50px;
    padding: 8px 12px;
    line-height: 1.5 !important;
  }

  #subfooter {
    height: auto !important;
    min-height: 45px;
    padding: 8px 10px 15px !important;
  }

  #subfooter img {
    width: auto;
    max-height: 28px;
  }

}

@media (max-width: 520px) {
  body {
    padding-right: 8px;
    padding-left: 8px;
  }

  #header {
    min-height: 76px;
  }

  #header > a > img {
    width: 78% !important;
  }

  #subtitle nav > ul,
  #subtitle nav > u1 {
    padding: 13px 7px;
    gap: 9px 16px;
  }

  #subtitle nav a {
    font-size: 13px;
  }

  #content_index .portfolio-context h2,
  #content_index .portfolio-context h2 a {
    font-size: clamp(12px, 3.7vw, 16px);
    line-height: 1.1;
  }
}

@media (hover: none) {
  #content_index .portfolio-context {
    top: auto;
    bottom: 0;
    height: auto;
    min-height: 52px;
    padding: 10px 12px;
    opacity: 1;
    background: rgba(248, 248, 255, 0.92);
    transform: none;
  }

  #content_index .portfolio-context p {
    display: none;
  }

  #content_index .portfolio-items article:hover img {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #content_index .portfolio-items article *,
  #slider * {
    transition-duration: 0.01ms !important;
  }
}
