/*
 * Compatibility layer for the Drupal 11 / Bootstrap 5 theme markup.
 *
 * The original AICI styles were written against Drupal 8 and Bootstrap 3.
 * Keep fixes here small and explicit so the historical stylesheet remains the
 * visual source of truth.
 */

/* Drupal 8 used this utility name before Bootstrap supplied its own helper. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* The modern Views exposed form no longer receives Bootstrap 3 form-inline. */
.recherche form.views-exposed-form,
.bloc-recherche form.views-exposed-form {
  padding: 15px 20px 10px;
}

.recherche form.views-exposed-form > .d-flex,
.bloc-recherche form.views-exposed-form > .d-flex {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
}

/* Page titles are rendered inside the property layout itself. */
#block-pagetitle {
  display: none;
}

/* Bootstrap 5 renders the content region without its historical wrapper. */
.path-node .main-container > .row > section {
  margin-top: -55px;
}

/*
 * The fees page already positions its introductory block with the historical
 * .fw-before-content offset. Applying the Drupal 11 content-region offset to
 * the whole section a second time makes the main menu cover the page title.
 */
.page-node-116 .main-container > .row > section {
  margin-top: 0;
}

/* The management-page hero has its own historical negative offset. */
.page-node-13 .main-container > .row > section {
  margin-top: 0;
}

/* The buy-page hero also carries its own historical vertical positioning. */
.page-node-87 .main-container > .row > section {
  margin-top: 0;
}

/* The sell-page hero already owns the historical vertical offset. */
.page-node-57 .main-container > .row > section {
  margin-top: 0;
}

/* The visible heading is supplied by the full-width fees block. */
.page-node-116 #block-title {
  display: none;
}

/* The management-page hero already contains the visible page heading. */
.page-node-13 #block-title {
  display: none;
}

/* The buy-page hero is the visible page heading. */
.page-node-87 #block-title {
  display: none;
}

/* The sell-page hero contains the visible page heading. */
.page-node-57 #block-title {
  display: none;
}

/* The tenant-page hero contains the visible page heading. */
.page-node-121 #block-title {
  display: none;
}

/* Restore rules that formerly depended on this block being a <section>. */
.page-node-57 #block-titreentrevendreresponsive .field--name-body {
  margin-top: -30px;
  margin-right: 15px;
  margin-bottom: 0;
  margin-left: 15px;
}

.page-node-57 #block-titreentrevendreresponsive .titre {
  min-height: 82px !important;
  line-height: 40px;
}

/*
 * Drupal 8 rendered this block as <section>; Drupal 11 renders it as <div>.
 * Restore the title rules whose legacy selector depended on the old element.
 */
.page-node-87 #block-titreenteteacheter .titre {
  text-align: center;
  text-transform: uppercase;
  font-family: 'ITCAvantGardeStd-Bold', Arial, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 30px;
  line-height: 40px;
  color: #002e60;
  letter-spacing: 4px;
  word-spacing: 6px;
  background-image: url('/themes/custom/aici/images/Rectangle.jpg');
  background-repeat: no-repeat;
  background-position: center 75%;
}

/* Restore the compact Drupal 8 Mailchimp form presentation. */
.page-node-87 .bloc-newsletter form {
  align-items: center;
}

.page-node-87 .bloc-newsletter .form-item-mergevars-email > label {
  display: none;
}

.page-node-87 .bloc-newsletter .form-item-mergevars-email,
.page-node-87 .bloc-newsletter .form-actions {
  margin: 0;
}

.page-node-87 .bloc-newsletter .form-submit {
  border-color: #d8a766 !important;
  background-color: #d8a766 !important;
  color: #fff !important;
}

/*
 * Bootstrap 5 paints every table cell and adds a full grid. The original
 * design lets the page background show through and only separates the rows.
 */
.page-node-116 #block-detailshonoraires .table {
  margin-bottom: 20px;
  background-color: transparent !important;
}

.page-node-116 #block-detailshonoraires .table > thead,
.page-node-116 #block-detailshonoraires .table > tbody,
.page-node-116 #block-detailshonoraires .table > thead > tr,
.page-node-116 #block-detailshonoraires .table > tbody > tr {
  background-color: transparent !important;
}

.page-node-116 #block-detailshonoraires .table > :not(caption) > * > * {
  padding: 8px;
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-left: 0 !important;
  border-top: 1px solid #ddd !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

.page-node-116 #block-detailshonoraires .table > thead:first-child > tr:first-child > * {
  border-top: 0 !important;
}

.path-recherche-immobilier #wrapper-contanainer {
  background-color: #e6e6e6;
}

.recherche form.views-exposed-form .mb-3,
.recherche form.views-exposed-form .form-actions,
.bloc-recherche form.views-exposed-form .mb-3,
.bloc-recherche form.views-exposed-form .form-actions {
  margin: 0;
}

.recherche form.views-exposed-form .form-item-typeoffre,
.bloc-recherche form.views-exposed-form .form-item-typeoffre {
  display: flex;
  align-items: center;
  gap: 20px;
}

.recherche form.views-exposed-form label,
.bloc-recherche form.views-exposed-form label {
  margin: 0;
  color: #002e60;
  font-family: 'ITCAvantGardeStd-Demi', Arial, sans-serif;
  font-size: 16px;
  text-transform: uppercase;
}

.recherche form.views-exposed-form .form-select,
.bloc-recherche form.views-exposed-form .form-select {
  width: 225px;
  height: 50px;
  padding: 6px 18px;
  border: 1px solid #ccc;
  border-radius: 0;
  background-color: #fff;
  color: #666;
}

.recherche form.views-exposed-form .form-actions .button,
.bloc-recherche form.views-exposed-form .form-actions .button {
  height: 50px;
  margin: 0;
}

/* Bootstrap 5's menu-column component replaces the former inline footer list. */
#block-aici-footer > ul.nav,
#block-aici-footer .nav.flex-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}

#block-aici-footer .nav-item {
  display: inline-block;
}

#block-aici-footer .nav-link {
  padding: 0 10px;
  border-right: 1px solid #d8a868;
  color: #666;
  font-family: 'woodfordbourne-regular', Arial, sans-serif;
  font-size: 15px;
  text-transform: uppercase;
}

#block-aici-footer .nav-item:last-child .nav-link {
  border-right: 0;
}

/* Restore the Drupal 8 Webform sizing with the Drupal 11 form markup. */
.webform-submission-formulaire-de-contact-form .form-type-textfield .form-control,
.webform-submission-formulaire-de-contact-form .form-type-webform-email-multiple .form-control,
.webform-submission-formulaire-de-contact-form .form-type-tel .form-control,
.webform-submission-formulaire-de-contact-form .form-select {
  width: 100%;
  height: 55px;
  margin-bottom: 25px;
  border: 1px solid #d8a765;
  border-radius: 0;
}

.webform-submission-formulaire-de-contact-form .form-select {
  padding-right: 40px;
  appearance: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #d8a765 50%),
    linear-gradient(135deg, #d8a765 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.webform-submission-formulaire-de-contact-form .form-item-email .description {
  display: none;
}

.webform-submission-formulaire-de-contact-form .iti {
  display: block;
  width: 100%;
  margin-bottom: 25px;
}

.webform-submission-formulaire-de-contact-form .iti .form-control {
  margin-bottom: 0;
}

.webform-submission-formulaire-de-contact-form .form-textarea {
  width: 100%;
  height: 375px;
}

.webform-submission-formulaire-de-contact-form #edit-flexbox {
  clear: both;
  margin-right: 0;
  margin-left: 0;
}

.webform-submission-formulaire-de-contact-form #edit-actions {
  width: 100%;
  text-align: center;
}

.webform-submission-formulaire-de-contact-form #edit-actions-submit {
  display: inline-block;
  width: auto;
  min-width: 154px;
  height: auto;
}

/* CAPTCHA 2.x uses a fieldset instead of Bootstrap's former panel markup. */
.webform-submission-formulaire-de-contact-form > fieldset.captcha {
  display: flex;
  clear: both;
  flex-direction: column;
  min-width: 0;
  margin: 0 0 20px;
  padding: 0 15px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.webform-submission-formulaire-de-contact-form > fieldset.captcha > legend {
  float: none;
  width: calc(100% + 30px);
  margin: 0 -15px 15px;
  padding: 10px 15px;
  border-bottom: 1px solid #ddd;
  border-radius: 3px 3px 0 0;
  background-color: #f5f5f5;
  color: #333;
  font-size: 16px;
  line-height: 1.42857143;
}

.webform-submission-formulaire-de-contact-form > fieldset.captcha > legend.form-required::after {
  display: none;
}

.webform-submission-formulaire-de-contact-form .captcha__description {
  order: 1;
  margin: 0 0 10px;
  color: #777;
  font-size: 12px;
}

.webform-submission-formulaire-de-contact-form .captcha__element {
  order: 2;
}

/*
 * Drupal 11 changed the Layout Builder field-block class used by the property
 * gallery. Restore the three-column gallery and keep the existing Colorbox
 * links as full-size, consistently cropped thumbnails.
 */
.page-node-type-biens-immobiliers
  .block-field-blocknodebiens-immobiliersfield-image
  .field__label {
  height: auto;
  margin: 0 0 20px;
  color: #002e60;
  font-family: 'ITCAvantGardeStd-Bk', Arial, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 30px;
  font-weight: normal;
  letter-spacing: 5px;
  text-align: center;
  text-transform: uppercase;
}

.page-node-type-biens-immobiliers
  .block-field-blocknodebiens-immobiliersfield-image
  .field__items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.page-node-type-biens-immobiliers
  .block-field-blocknodebiens-immobiliersfield-image
  .field__item {
  min-width: 0;
}

.page-node-type-biens-immobiliers
  .block-field-blocknodebiens-immobiliersfield-image
  .field__item > a {
  display: block;
  float: none;
  width: 100%;
  margin: 0;
  cursor: zoom-in;
}

.page-node-type-biens-immobiliers
  .block-field-blocknodebiens-immobiliersfield-image
  .field__item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 235;
  object-fit: cover;
}

/* Accessible full-size viewer for the property gallery. */
body.property-gallery-lightbox-open {
  overflow: hidden;
}

.property-gallery-lightbox {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(48px, 1fr) minmax(0, auto) minmax(48px, 1fr);
  align-items: center;
  justify-items: center;
  padding: 60px 70px 35px;
  background: rgba(0, 23, 49, 0.94);
}

.property-gallery-lightbox[hidden] {
  display: none !important;
}

.property-gallery-lightbox__figure {
  grid-column: 2;
  margin: 0;
  text-align: center;
}

.property-gallery-lightbox__image {
  display: block;
  width: auto;
  max-width: calc(100vw - 200px);
  height: auto;
  max-height: calc(100vh - 125px);
  margin: auto;
  object-fit: contain;
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.45);
}

.property-gallery-lightbox__caption {
  min-height: 24px;
  padding-top: 12px;
  color: #fff;
  font-size: 16px;
  letter-spacing: 2px;
}

.property-gallery-lightbox__close,
.property-gallery-lightbox__previous,
.property-gallery-lightbox__next {
  border: 0;
  background: transparent;
  color: #fff;
  font-family: Arial, sans-serif;
  line-height: 1;
  cursor: pointer;
}

.property-gallery-lightbox__close:focus-visible,
.property-gallery-lightbox__previous:focus-visible,
.property-gallery-lightbox__next:focus-visible {
  outline: 2px solid #d8a766;
  outline-offset: 4px;
}

.property-gallery-lightbox__close {
  position: absolute;
  top: 18px;
  right: 25px;
  padding: 8px 14px;
  font-size: 48px;
}

.property-gallery-lightbox__previous,
.property-gallery-lightbox__next {
  padding: 15px;
  font-size: 72px;
}

.property-gallery-lightbox__previous {
  grid-column: 1;
}

.property-gallery-lightbox__next {
  grid-column: 3;
}

/*
 * The historical social-menu rule uses width: 50%. As a Bootstrap 5 flex
 * item it makes the three desktop footer columns wider than their row and
 * sends the last one to a second line.
 */
@media only screen and (min-width: 769px) {
  .footer_top .region-footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .footer_top .region-footer-top > #block-titrepiedpage {
    flex: 0 0 100%;
    width: 100%;
  }

  .footer_top .region-footer-top > #block-plandusite,
  .footer_top .region-footer-top > #block-reseausociaux,
  .footer_top .region-footer-top > #block-menutoprigthaccueil {
    flex: 0 0 33.333333%;
    width: 33.333333%;
    max-width: 33.333333%;
    float: none;
    margin-right: 0;
    margin-left: 0;
  }
}

@media only screen and (max-width: 768px) {
  .path-node .main-container > .row > section {
    margin-top: 0;
  }

  /* Keep the complete navigation visible before the fees panel. */
  .page-node-116 .fw-before-content.area {
    top: 0 !important;
  }

  .page-node-13 .fw-before-content.area {
    top: 0 !important;
    margin-right: 15px;
    margin-left: 15px;
  }

  .page-node-13 #block-titreentetegestionlocative .titre {
    min-height: 0;
    padding-bottom: 30px;
    background-position: center bottom;
  }

  .page-node-87 .fw-before-content.area {
    top: 0 !important;
  }

  .page-node-87 #block-titreenteteacheter .titre {
    min-height: 0 !important;
    padding-bottom: 30px;
    background-position: center bottom;
  }

  .page-node-57 .fw-before-content.area {
    top: 0 !important;
  }

  .page-node-57 #block-titreentrevendreresponsive .titre {
    min-height: 163px !important;
    margin-bottom: 24px;
    padding-bottom: 30px;
    background-position: center bottom;
  }

  /* Long rental titles must not be clipped on narrow phones. */
  .page-node-121 .louer-proprietaire .cole-decal-bien .bien-row {
    height: auto !important;
    min-height: 230px;
    padding-bottom: 30px;
  }

  /* Drupal 11 renders the congress hero as a <div>, not a <section>. */
  .page-node-124 #block-entetecongres .titre {
    height: auto;
    min-height: 0 !important;
    margin-bottom: 24px;
    padding-bottom: 30px;
    background-position: center bottom;
  }

  .page-node-124 #block-title {
    display: none;
  }

  /* Display both fee columns inside the viewport instead of a clipped table. */
  .page-node-116 #block-detailshonoraires .table-responsive {
    overflow: visible;
  }

  .page-node-116 #block-detailshonoraires .field--name-body {
    padding-right: 20px;
    padding-left: 20px;
  }

  .page-node-116 #block-detailshonoraires .table {
    width: 100% !important;
    table-layout: fixed;
  }

  .page-node-116 #block-detailshonoraires .table > :not(caption) > * > * {
    padding-right: 6px;
    padding-left: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .page-node-116 #block-detailshonoraires .table > :not(caption) > * > *:first-child {
    width: 55% !important;
  }

  .page-node-116 #block-detailshonoraires .table > :not(caption) > * > *:last-child {
    width: 45% !important;
  }

  #block-navigationprincipale,
  #block-navigationprincipale-2,
  #block-navigationprincipale .menu--main,
  #block-navigationprincipale-2 .menu--main {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .recherche form.views-exposed-form,
  .bloc-recherche form.views-exposed-form {
    width: 100%;
    padding: 20px 15px;
  }

  .recherche form.views-exposed-form > .d-flex,
  .bloc-recherche form.views-exposed-form > .d-flex {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  .recherche form.views-exposed-form .form-item-typeoffre,
  .bloc-recherche form.views-exposed-form .form-item-typeoffre {
    display: block;
    width: 100%;
  }

  .recherche form.views-exposed-form label,
  .bloc-recherche form.views-exposed-form label {
    display: block;
    margin-bottom: 8px;
  }

  .recherche form.views-exposed-form .form-select,
  .recherche form.views-exposed-form .form-actions,
  .recherche form.views-exposed-form .form-actions .button,
  .bloc-recherche form.views-exposed-form .form-select,
  .bloc-recherche form.views-exposed-form .form-actions,
  .bloc-recherche form.views-exposed-form .form-actions .button {
    width: 100%;
  }
}

@media only screen and (max-width: 991px) {
  .page-node-type-biens-immobiliers
    .block-field-blocknodebiens-immobiliersfield-image
    .field__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media only screen and (max-width: 600px) {
  .page-node-type-biens-immobiliers
    .block-field-blocknodebiens-immobiliersfield-image
    .field__items {
    grid-template-columns: 1fr;
  }

  .page-node-type-biens-immobiliers
    .block-field-blocknodebiens-immobiliersfield-image
    .field__label {
    font-size: 22px;
    line-height: 1.35;
  }

  .property-gallery-lightbox {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 55px 4px 20px;
  }

  .property-gallery-lightbox__image {
    max-width: calc(100vw - 96px);
    max-height: calc(100vh - 105px);
  }

  .property-gallery-lightbox__close {
    top: 8px;
    right: 8px;
    font-size: 40px;
  }

  .property-gallery-lightbox__previous,
  .property-gallery-lightbox__next {
    padding: 6px;
    font-size: 52px;
  }
}
