/* ==========================================================================
   Lapmaster Wolters — interior hero + heading/paragraph spacing
   Append to the END of styles-NEW.css (or load after it).

   ALSO DELETE these inline <style> rules from the interior template(s) —
   they pin the caption to the top and cause the uneven bottom spacing:
     .carousel-caption.custom-caption-width { top: 200px; }
     @media (max-width: 991.98px) {
       .carousel-caption.custom-caption-width { top: auto; }
       #heroCarousel .carousel-caption { left: 15px; right: 15px; top: 5rem; }
     }
   (The rules below override them anyway, so nothing breaks if one is missed.)
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. INTERIOR HERO
   - Text is centered vertically in the space BELOW the fixed navbar, so the
     gap above the heading equals the gap below the last line.
   - Height follows screen WIDTH only (no vh), so resizing the window
     height no longer changes the hero. Every interior hero, image or
     video, is the same height at a given width.
   - If the text needs more room, the hero grows and keeps the equal
     top/bottom padding (no clipping).
   - The HOMEPAGE is excluded: its body is also class="interior", but its
     slide has .no-overlay and its video has text baked in, so it keeps the
     original full 16:9 height. (:not(:has(.no-overlay)) on every rule.)
   -------------------------------------------------------------------------- */
:root {
  --hero-nav-h: 71px;        /* fallback navbar height; the site's JS sets the
                                real one in --nav-stack-height, used first */
  --hero-area: clamp(320px, 220px + 22vw, 640px);
                             /* hero height below the navbar:
                                375 -> 320 | 768 -> 389 | 1024 -> 445
                                1440 -> 537 | 1920 -> 640 */
  --hero-pad: 40px;          /* minimum space above AND below the text */
  --hero-gutter-l: 15px;     /* current left inset, kept as-is */
  --hero-gutter-r: 30px;
}
@media (min-width: 768px)  { :root { --hero-nav-h: 81px;  --hero-pad: 56px; } }
@media (min-width: 992px)  { :root { --hero-nav-h: 112px; --hero-pad: 64px;
                                     --hero-gutter-l: 128px; --hero-gutter-r: 15px; } }
@media (min-width: 1536px) { :root { --hero-pad: 80px; } }

body.interior #heroCarousel:not(:has(.no-overlay)),
body.interior #heroCarousel:not(:has(.no-overlay)):has(.video-bg),
body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-inner { height: auto; }

body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-item {
  height: auto;
  min-height: calc(var(--nav-stack-height, var(--hero-nav-h)) + var(--hero-area));
  padding-top: var(--nav-stack-height, var(--hero-nav-h));
                                    /* image runs under the navbar; text area starts below it */
}

/* styles-NEW.css pushes video heroes down with margin-top: var(--nav-stack-height).
   Undo that so video heroes sit under the navbar exactly like image heroes. */
body.interior #heroCarousel:not(:has(.no-overlay)):has(.video-bg) { margin-top: 0; }
body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-item.active,
body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-item-next,
body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-item-prev {
  display: flex;
  flex-direction: column;
  justify-content: center;          /* text centered vertically */
}

body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-caption {
  position: relative;
  inset: auto;                      /* kills top:200px / top:5rem / bottom:15% / left:* */
  width: auto;
  margin: 0 var(--hero-gutter-r) 0 var(--hero-gutter-l);
  padding: var(--hero-pad) 0;       /* equal top and bottom */
  z-index: 2;
}

/* Rhythm inside the caption: h2 -16- rule -24- h3 -16- p */
body.interior #heroCarousel:not(:has(.no-overlay)) hr {
  display: block;                   /* inline-block added ~5px of stray line-box space */
  margin: 1rem 0 1.5rem;
}
body.interior #heroCarousel:not(:has(.no-overlay)) h3 { margin-bottom: 1rem; }
body.interior #heroCarousel:not(:has(.no-overlay)) p  { margin-bottom: 1rem; }
body.interior #heroCarousel:not(:has(.no-overlay)) .carousel-caption > :last-child { margin-bottom: 0; }

/* Video heroes: the video fills the hero like a background image (cropped
   to fit), so video pages match image pages instead of following 16:9. */
body.interior #heroCarousel:not(:has(.no-overlay)) .video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  z-index: 0;
}

/* Hero h2: smooth scale instead of jumping 32px -> 70px at 1536px */
body.interior #heroCarousel:not(:has(.no-overlay)) h2 { font-size: clamp(2rem, 1rem + 3.2vw, 4.375rem); }


/* --------------------------------------------------------------------------
   2. BODY HEADINGS + PARAGRAPHS
   Headings get space ABOVE them when they follow body copy, so a heading
   sits closer to its own content than to the previous section.
   Low specificity on purpose — component styles (.bkc, .service-card,
   accordions, timeline) still win.
   -------------------------------------------------------------------------- */
:root {
  --flow-h2: 3rem;     /* 48px space before an h2 that follows copy */
  --flow-h3: 2rem;     /* 32px */
  --flow-h4: 1.5rem;   /* 24px */
}
@media (min-width: 1536px) {
  :root { --flow-h2: 4rem; --flow-h3: 2.5rem; }
}

:where(p, ul, ol, figure, table, blockquote) + h2 { margin-top: var(--flow-h2); }
:where(p, ul, ol, figure, table, blockquote) + h3 { margin-top: var(--flow-h3); }
:where(p, ul, ol, figure, table, blockquote) + h4 { margin-top: var(--flow-h4); }

/* h2 -> its content stays 32px (h2 margin-bottom: 2rem, unchanged). */

h3 { margin-bottom: 0.75rem; line-height: 1.3; }   /* was Bootstrap 0.5rem */
h4 { margin-bottom: 0.5rem;  line-height: 1.3; }

/* p line-height was a fixed 31.2px: fine at 20.8px text (>=1536px) but
   1.95x at the 16px used everywhere else. Unitless keeps it proportional. */
p { line-height: 1.6; }
@media (min-width: 1536px) { p { line-height: 1.5; } }   /* = today's 31.2px */

/* Product-page h1 was a fixed 5.625rem (90px) at every width and ran
   off-screen on phones ("Flatness Gauges", "AC 400 D"). */
section.content h1 {
  font-size: clamp(2.5rem, 1rem + 4.5vw, 5.625rem);
  line-height: 0.95;
}
