/* Shared layout corrections for desktop, tablet and phone. */
.mad-newsletter-form.one-line input[type="email"] { padding-inline-end: 4.5rem; }
.mad-icon-box-content, .mad-widget, .mad-tab, .mad-gallery-item { min-width: 0; }
.mad-icon-box-content a, .mad-icon-box-title, .mad-widget p { overflow-wrap: anywhere; }

/* Keep the home contact card in normal flow rather than over the photographs. */
.page-home .home-contact-section .mad-colorizer-bg-color.with-map {
  position: relative; inset: auto !important; width: 100% !important; height: auto;
  transform: none !important; padding: 48px 0; background: #f8f4ec;
}
.page-home .home-contact-section .with-map > .mad-section-element {
  position: relative; inset: auto !important; transform: none !important;
  width: min(1280px, calc(100% - 64px)); margin: 0 auto !important;
  border-radius: 16px; padding: clamp(24px, 3.4vw, 52px);
}
.page-home .home-contact-section .mad-section-texture { display: none; }

/* Preserve the full project notice while aligning the surrounding photo tiles. */
.page-home .mad-instafeed .mad-grid.item-col-5 {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0; width: 100%;
}
.page-home .mad-instafeed .mad-grid.item-col-5 > .mad-col {
  width: auto !important; max-width: none; min-width: 0; padding: 0;
}
.page-home .mad-instafeed .mad-col > a { aspect-ratio: 1; overflow: hidden; background: #fff; }
.page-home .mad-instafeed .mad-col > a > img[width][height] {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.page-home .mad-instafeed .home-project-notice > a > img[width][height] { object-fit: contain; }
.page-home .mad-instafeed .mad-col > a::before { display: none; }
.page-home .mad-instafeed .home-project-notice a:focus-visible { outline: 3px solid #bf3030; outline-offset: -3px; }

/* Every category remains reachable on touch screens. */
@media (max-width: 992px) {
  .page-menu .mad-tabs-nav.justify-content-center {
    justify-content: flex-start !important; overflow-x: auto; overflow-y: hidden;
    padding: 8px 0 16px; scrollbar-width: thin; scroll-padding-inline: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .page-menu .mad-tabs-nav > span { flex: 0 0 auto; }
  .page-menu .mad-tabs-nav a { padding: 8px 0; }
}

/* Two gallery columns on tablets; one generous column on phones. */
@media (min-width: 576px) and (max-width: 769px) {
  .page-gallery .mad-gallery.item-col-3 > .mad-gallery-item { width: 50% !important; }
}

@media (max-width: 575px) {
  .page-home .home-contact-section .mad-colorizer-bg-color.with-map { padding-block: 28px; }
  .page-home .home-contact-section .with-map > .mad-section-element { width: calc(100% - 32px); padding: 24px; }
  .page-home .mad-instafeed .mad-grid.item-col-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-home .mad-instafeed .home-project-notice { grid-column: 1 / -1; }
  .page-home .mad-instafeed .home-project-notice > a { aspect-ratio: 3 / 2; }
}

/* Scale the shared header to the available screen, keeping touch targets roomy. */
@media (min-width: 770px) and (max-width: 1199px) {
  .mad-header { padding-block: 20px; }
  .mad-header .mad-logo img[width][height] { width: 260px; height: auto; }
  .mad-header .mad-header-items > .mad-header-item { margin-bottom: 16px !important; }
  .mad-header .mad-navigation-container { width: 100%; justify-content: center; }
}
@media (max-width: 769px) {
  .mad-header { padding-block: 18px; }
  .mad-header .mad-header-items {
    flex-wrap: nowrap !important; align-items: center; justify-content: space-between;
    gap: 20px; margin: 0; padding: 0;
  }
  .mad-header .mad-header-items > .mad-header-item {
    width: auto !important; flex: 0 1 auto; min-width: 0;
    margin: 0 !important; text-align: left !important;
  }
  .mad-header .mad-header-items > .mad-navigation-container {
    width: auto !important; flex: 0 0 auto; justify-content: flex-end;
  }
  .mad-header .mad-logo img[width][height] { width: clamp(200px, 60vw, 280px); height: auto; }
  .mad-header .mad-mobile-nav-btn { width: 52px; height: 52px; margin: 0; }
}
@media (max-width: 992px) {
  .page-menu .mad-tabs:not(.mad-tabs--unstyled) .mad-tabs-nav { font-size: clamp(1.1rem, 2.7vw, 1.35rem); line-height: 1.5; }
}
@media (max-width: 575px) {
  .page-menu .mad-tabs .mad-tabs-nav.justify-content-center {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px; padding-block: 4px 16px; overflow: visible;
    width: 100%;
  }
  .page-menu .mad-tabs .mad-tabs-nav > span { min-width: 0; margin: 0 !important; }
  .page-menu .mad-tabs .mad-tabs-nav a { min-height: 44px; padding-block: 10px; white-space: normal; }
}
/* Leave room for the page content below titles on smaller screens. */
@media (max-width: 1199px) {
  .mad-breadcrumb { padding-block: clamp(64px, 8vw, 104px); }
}
@media (max-width: 769px) {
  .page-menu .mad-content > .container > .mad-section:first-child,
  .page-gallery .mad-content > .container > .mad-section:first-child { padding-top: 56px; }
}
