/**
 * Structural CSS fixes for Drupal-generated markup that the theme's own
 * stylesheets (style.css / colors.css) aren't responsible for — kept in
 * a separate file so the designer's stylesheets stay untouched.
 */

/*
 * Drupal core's "view" render element (used by drupal_view() to embed
 * the Product Range / Related Products views inside a ".row.g-4" grid)
 * always wraps its output in a fixed ".views-element-container" div
 * (see \Drupal\views\Element\View::preRenderViewElement()). That div
 * sits between ".row.g-4" and the ".col-*" cards, breaking Bootstrap's
 * grid, which requires ".col-*" to be a direct child of ".row". Setting
 * "display: contents" removes it from the box model without removing it
 * from the DOM, so the cards become effectively direct children again.
 */
.row.g-4 > .views-element-container {
  display: contents;
}

/*
 * Product/category/news card thumbnails (rendered via Drupal's image
 * formatter, e.g. the "products_card"/"news_card" image styles) carry
 * their native width/height HTML attributes (e.g. 640x400) with no CSS
 * constraint. Inside a narrower 3-column card, that lets the image
 * overflow its ".ph" box and overlap the neighbouring card. Scoping the
 * fix to ".ph" (the card's designated image container) keeps it from
 * affecting unrelated images elsewhere on the site.
 */
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*
 * Bootstrap's ".ratio" sizes its *direct* children, but Drupal renders an
 * oEmbed video inside two nested field wrapper divs, so the iframe keeps
 * the fixed width/height the media formatter gave it (e.g. 200x113) and
 * sits in the corner of the box. ".ratio" is position:relative and the
 * wrappers are static, so absolutely positioning the iframe makes it fill
 * the ratio box regardless of how deeply Drupal nests it.
 */
.ratio iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/*
 * The main navigation is navbar-expand-lg, so it goes horizontal at 992px.
 * German labels are long enough that the six items plus the Enquire button
 * no longer fit between 992px and roughly 1200px, and "Unternehmen" wrapped
 * onto a second row. Tightening the link padding across that band buys back
 * the space without changing the breakpoint, which would otherwise hide a
 * navigation that English and Russian still fit comfortably.
 *
 * !important is required, not preferred: style.css sets
 *   a.nav-link { padding-left: 15px !important; padding-right: 15px !important }
 * so specificity alone cannot win. That file is off limits, hence this.
 */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .navbar-expand-lg .navbar-nav a.nav-link {
    padding-right: 8px !important;
    padding-left: 8px !important;
    font-size: 16px;
  }
}

/*
 * Exposed filter buttons must never wrap mid-label: "Zurücksetzen" broke
 * across two lines and spilled out of its column before the surrounding
 * column was allowed to size to its content.
 */
.views-exposed-form .form-actions .button {
  white-space: nowrap;
}
