/*
 * Responsive fixes on top of the original WordPress theme CSS.
 * Loaded after every theme/plugin stylesheet (see src/app/(site)/[[...slug]]/page.tsx).
 * At widths where the original layout works, nothing here applies, so those
 * sizes stay pixel-identical to the original site.
 */

/*
 * The Boyc theme wraps all page content in a Bootstrap-style `.row` with
 * -15px side margins but no matching column padding, so content is 30px wider
 * than the screen and starts 15px off its left edge. On wide screens the
 * 1300px content box has room to spare and this is invisible; below that,
 * text is cut off at the screen edges (e.g. the FAQ heading around 1100-1330px,
 * paragraphs on phones) and phones can scroll the page sideways.
 */
@media (max-width: 1365px) {
  .pxl-content-wrap.row,
  #pxl-footer-elementor .row {
    margin-left: 0;
    margin-right: 0;
  }
}

/*
 * Between the tablet layout (Elementor adds side padding up to 1024px) and
 * the width where the 1300px content box fits with room to spare, boxed
 * sections ran edge to edge with no gutter. Keep 30px on each side there;
 * from 1366px up this resolves to the original 1300px.
 */
@media (min-width: 1025px) and (max-width: 1365px) {
  :is(.pxl-content-wrap, #pxl-footer-elementor) .e-con-boxed > .e-con-inner {
    max-width: min(var(--content-width), calc(100% - 60px));
  }
}

/*
 * The closed mobile menu is parked at left:-100vw, which only hides it if it
 * is no wider than the screen. Below 350px it is wider (up to the 350px max
 * width), so a pale strip of it showed down the left edge of every page.
 */
@media (max-width: 349px) {
  .elementskit-navbar-nav-default.elementskit-menu-offcanvas-elements:not(.active) {
    left: calc(-100vw - 50px);
  }
}

/*
 * Hero heading on /standalone/ and /ev-mounted-mobile/: at 35px the word
 * "ARCHITECTURE" is wider than small phones, so it ran off the screen.
 */
@media (max-width: 374px) {
  .elementor .elementor-element.elementor-element-c0f0050 .pxl-heading .pxl-item--title {
    font-size: 9vw;
  }
}

/*
 * Icon + text feature boxes (three per row) on the standalone / EV pages:
 * on tablets the columns are too narrow for an icon beside the text, so long
 * words ("ENVIRONMENTAL") overflowed the screen. Put the icon above the text,
 * as Elementor already does on phones.
 */
@media (min-width: 768px) and (max-width: 1024px) {
  :is(.elementor-element-709c75c3, .elementor-element-e571af0) .elementor-widget-icon-box .elementor-icon-box-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/*
 * Pages that had no <h1> on WordPress have their hero heading promoted from
 * <h2> to <h1 data-ul-promoted> (scripts/useloop/import-wordpress.py, NO_H1). The theme styles
 * the bare tags differently (h1: line-height 1, letter-spacing -3.6px), so give
 * these the h2 values at the h2 rule's own specificity (0,0,1): they beat the
 * theme's h1 rule by coming later, and lose to anything more specific, as the
 * h2 did.
 */
h1:where([data-ul-promoted]) {
  letter-spacing: -1.44px;
  line-height: 1.208;
}

/*
 * The home hero slider had an <h1> on each of its four slides; slides 2-4 are
 * <h2 data-ul-demoted> now (one <h1> per page). Its own rules (wp-custom-css)
 * target `.lpx-content h1`, so they are repeated here for those, at the same
 * specificity, together with the theme's bare-h1 values they inherited.
 */
.lpx-hero-slider .lpx-content h2:where([data-ul-demoted]) {
  letter-spacing: -3.6px;
  color: #fff;
  font-size: 55px;
  line-height: 1;
  margin: 0;
  text-transform: uppercase;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(40px);
  transition:
    opacity 1s ease,
    filter 1s ease,
    transform 1s ease;
}
@media (max-width: 768px) {
  .lpx-hero-slider .lpx-content h2:where([data-ul-demoted]) {
    font-size: 34px;
    line-height: 1.05;
    margin-bottom: 15px;
    letter-spacing: 1px;
  }
}
.lpx-hero-slider .lpx-slide.lpx-active .lpx-content h2:where([data-ul-demoted]) {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}
