/* contentbox-responsive.css
 * Retrofits responsive behaviour onto ContentBox's fixed-px output.
 * Loaded after all other contentbox-runtime*.css files.
 * Scoped under .is-wrapper to stay out of the admin shell.
 *
 * Why: ContentBox saves content with hard-coded `.size-60`, `.is-section-100`,
 * fixed pixel <img> widths. Its responsive `clamp()` rule only fires under a
 * `.v2` ancestor — our content uses `.box-v2`, so the clamp never fires.
 * This file (a) retargets the clamp onto `.box-v2`, (b) caps section min-height
 * below 970px, (c) forces fluid images, (d) wraps row columns on mobile,
 * (e) fluidises `.is-content-NNN` containers.
 */

/* ---------- 1. Fluid typography under .box-v2 ------------------------- */
/* ContentBox ships a clamp rule scoped to `.v2:not(.v3)` ancestor, but our
 * saved content wraps in `.box-v2` so the rule never fires. Re-target it
 * for tablet + mobile only — leave ≥971px desktop at the author's design size
 * so existing pages don't visually shrink. */
@media (max-width: 970px) {
  .is-wrapper.box-v2 [class*="size-"],
  .is-wrapper .box-v2 [class*="size-"] {
    --scale-base: clamp(1620, 1620 + ((var(--fs) - 20) * 15), 1920);
    font-size: clamp(
      var(--min-fs, calc(var(--fs) * 1px)),
      calc(var(--fs) / var(--scale-base) * 100vw),
      calc(var(--fs) * 1px)
    ) !important;
  }
}

/* ---------- 2. Section min-height caps ------------------------------- */
/* Match the runtime's own selector specificity: it ships
 *   .is-wrapper div.is-section-100 { min-height: 100vh }  (0,2,1)
 *   .is-section-100 .is-box:not(.box-autofit) { min-height: 100vh }
 * so we need at least the same specificity + later cascade.
 * The .is-box rule is critical: hero sections wrap content in
 * .is-section-100 > .is-boxes > .is-box.is-box-N and EACH .is-box is forced
 * to 100vh — on mobile they stack vertically so a 2-box section becomes
 * 2 * 100vh tall. Cap them all. */
@media (max-width: 970px) {
  .is-wrapper div.is-section-100,
  .is-wrapper div.is-section-auto,
  .is-wrapper .is-section-100 .is-box:not(.box-autofit),
  .is-wrapper .is-section-auto .is-box:not(.box-autofit),
  .is-wrapper .is-boxes,
  .is-wrapper .is-boxes > .is-box {
    min-height: auto !important;
    height: auto !important;
  }
  /* The flex `.is-boxes` row layout becomes a column on mobile via
   * ContentBox's own breakpoint, but force it here as a safety net. */
  .is-wrapper .is-boxes {
    flex-direction: column !important;
  }
}

/* ---------- 3. Fluid images ------------------------------------------ */
@media (max-width: 970px) {
  .is-wrapper img {
    max-width: 100% !important;
    height: auto !important;
  }
  .is-wrapper img[style*="object-fit"] {
    object-fit: contain !important;
  }
}

/* ---------- 4. Container width fluidity ------------------------------ */
@media (max-width: 970px) {
  .is-wrapper [class*="is-content-"] {
    max-width: 100% !important;
  }
}

/* ---------- 5. Column wrap on small screens -------------------------- */
/* Rows are nowrap on desktop (see section 10 — the base `.is-wrapper .row`
 * no longer sets flex-wrap, so it inherits the runtime's `flex-wrap:initial`).
 * Wrapping + full-width column stacking is intentionally MOBILE-ONLY and
 * applies to all `.is-wrapper .row` (not just `.row.clearfix`). */
@media (max-width: 970px) {
  .is-wrapper .is-container,
  .is-wrapper .row {
    flex-wrap: wrap !important;
  }
  .is-wrapper .row > .column,
  .is-wrapper .row > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
  }
}

/* ---------- 6. Edge padding tighter on mobile ------------------------ */
@media (max-width: 540px) {
  .is-wrapper [class*="edge-x-"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ---------- 7. Overflow guard --------------------------------------- */
@media (max-width: 970px) {
  .is-wrapper { overflow-x: hidden; }
}

/* ---------- 8. Vimeo background-video wrapper ------------------------ */
/* ContentBox saves Vimeo background videos inside a .vimeo-wrapper that
 * holds the player iframe. The wrapper itself is positioned by ContentBox's
 * runtime (absolute fill of its parent .is-section/.is-box). The iframe
 * inside it needs its own sizing so it covers the wrapper while preserving
 * the 16:9 aspect ratio at any viewport.
 *   - 100vw / 56.25vw  → fill viewport width at 16:9 (no letterbox top/btm)
 *   - 177.77vh / 100vh → fill viewport height at 16:9 (no pillarbox sides)
 *   - position+translate centers the iframe regardless of which dimension
 *     is the binding constraint.
 * Applied identically in the live editor, /view preview, and tenant SSR. */
.vimeo-wrapper iframe {
  width: 100vw;
  height: 56.25vw;
  min-height: 100vh;
  min-width: 177.77vh;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ---------- 9. Bootstrap-style responsive embed wrapper -------------- */
/* Reproduces .embed-responsive / .embed-responsive-16by9 so embedded
 * iframes (YouTube, Vimeo, forms, etc.) inside saved page content keep
 * their aspect ratio without needing the full Bootstrap stylesheet
 * pulled in. The 56.25% bottom padding gives 16:9; the absolutely-
 * positioned iframe inside fills the resulting box.
 * Used by ContentBox-saved content across editor, /view, /transfer, and
 * the public SSR. */
.embed-responsive {
  position: relative;
  display: block;
  height: 0;
  padding: 0;
  overflow: hidden;
  margin-top: 1.4em;
  margin-bottom: 1em;
}

.embed-responsive.embed-responsive-16by9 {
  padding-bottom: 56.25%;
}

/* The wrapper collapses to height:0 + padding-bottom:%. The embedded media
 * (iframe, embed, object, video) must be absolutely positioned to fill the
 * resulting padding box — without this, an iframe with HTML width/height
 * attributes (e.g. <iframe width="560" height="315">) renders inside a
 * zero-height box and is invisible. */
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

/* ---------- 10. Bootstrap-style 12-col grid (scoped) ----------------- */
/* contentbox-runtime.css ships `.row { display: flex }` and `.column
 * { width: 100% }` but NO `.col-*` width rules. Saved content using
 * Bootstrap grid classes (e.g. <div class="row"><div class="col-md-12">
 * <iframe>) collapses: flex children with no flex-basis shrink to
 * content width, and the embed-responsive wrapper has intrinsic width
 * zero, so the iframe never gets a size. Caused video pages on site 194
 * to render blank.
 *
 * Provide the minimum Bootstrap-3-compatible grid the saved markup
 * expects. Scoped under .is-wrapper so the admin shell's own grid
 * usage (if any) is untouched. */
.is-wrapper .row {
  display: flex;
  margin-right: -15px;
  margin-left: -15px;
}

/* ...but a plain `<div class="column">` does NOT match the `[class*="col-"]`
   rule below that pads those 15px back in -- no hyphen -- so ContentBox's own
   templates take the outward pull with nothing compensating. Inside a
   container with 16px of mobile padding that left a 1px gutter and body text
   ran to the screen edge.

   Columns already stack full-width under 970px, so the gutter is decorative
   there: drop it and let the container padding show. Must come AFTER the rule
   above -- media queries add no specificity, so this wins on source order
   alone. Desktop is deliberately untouched. */
@media (max-width: 970px) {
  .is-wrapper .row {
    margin-left: 0;
    margin-right: 0;
  }
}

/* `:not(.is-col-tool)` excludes the editor's column toolbar overlay
 * (<div class="is-tool is-col-tool">), which the substring `[class*="col-"]`
 * would otherwise match and break its absolute positioning. */
.is-wrapper [class*="col-"]:not(.is-col-tool) {
  position: relative;
  width: 100%;
  min-height: 1px;
  padding-right: 15px;
  padding-left: 15px;
  box-sizing: border-box;
}

/* Extra-small (xs) — always-on */
.is-wrapper .col-xs-1,.is-wrapper .col-1{flex:0 0 8.333333%;max-width:8.333333%}
.is-wrapper .col-xs-2,.is-wrapper .col-2{flex:0 0 16.666667%;max-width:16.666667%}
.is-wrapper .col-xs-3,.is-wrapper .col-3{flex:0 0 25%;max-width:25%}
.is-wrapper .col-xs-4,.is-wrapper .col-4{flex:0 0 33.333333%;max-width:33.333333%}
.is-wrapper .col-xs-5,.is-wrapper .col-5{flex:0 0 41.666667%;max-width:41.666667%}
.is-wrapper .col-xs-6,.is-wrapper .col-6{flex:0 0 50%;max-width:50%}
.is-wrapper .col-xs-7,.is-wrapper .col-7{flex:0 0 58.333333%;max-width:58.333333%}
.is-wrapper .col-xs-8,.is-wrapper .col-8{flex:0 0 66.666667%;max-width:66.666667%}
.is-wrapper .col-xs-9,.is-wrapper .col-9{flex:0 0 75%;max-width:75%}
.is-wrapper .col-xs-10,.is-wrapper .col-10{flex:0 0 83.333333%;max-width:83.333333%}
.is-wrapper .col-xs-11,.is-wrapper .col-11{flex:0 0 91.666667%;max-width:91.666667%}
.is-wrapper .col-xs-12,.is-wrapper .col-12{flex:0 0 100%;max-width:100%}

@media (min-width: 768px) {
  .is-wrapper .col-md-1{flex:0 0 8.333333%;max-width:8.333333%}
  .is-wrapper .col-md-2{flex:0 0 16.666667%;max-width:16.666667%}
  .is-wrapper .col-md-3{flex:0 0 25%;max-width:25%}
  .is-wrapper .col-md-4{flex:0 0 33.333333%;max-width:33.333333%}
  .is-wrapper .col-md-5{flex:0 0 41.666667%;max-width:41.666667%}
  .is-wrapper .col-md-6{flex:0 0 50%;max-width:50%}
  .is-wrapper .col-md-7{flex:0 0 58.333333%;max-width:58.333333%}
  .is-wrapper .col-md-8{flex:0 0 66.666667%;max-width:66.666667%}
  .is-wrapper .col-md-9{flex:0 0 75%;max-width:75%}
  .is-wrapper .col-md-10{flex:0 0 83.333333%;max-width:83.333333%}
  .is-wrapper .col-md-11{flex:0 0 91.666667%;max-width:91.666667%}
  .is-wrapper .col-md-12{flex:0 0 100%;max-width:100%}
}

@media (min-width: 576px) {
  .is-wrapper .col-sm-1{flex:0 0 8.333333%;max-width:8.333333%}
  .is-wrapper .col-sm-2{flex:0 0 16.666667%;max-width:16.666667%}
  .is-wrapper .col-sm-3{flex:0 0 25%;max-width:25%}
  .is-wrapper .col-sm-4{flex:0 0 33.333333%;max-width:33.333333%}
  .is-wrapper .col-sm-5{flex:0 0 41.666667%;max-width:41.666667%}
  .is-wrapper .col-sm-6{flex:0 0 50%;max-width:50%}
  .is-wrapper .col-sm-7{flex:0 0 58.333333%;max-width:58.333333%}
  .is-wrapper .col-sm-8{flex:0 0 66.666667%;max-width:66.666667%}
  .is-wrapper .col-sm-9{flex:0 0 75%;max-width:75%}
  .is-wrapper .col-sm-10{flex:0 0 83.333333%;max-width:83.333333%}
  .is-wrapper .col-sm-11{flex:0 0 91.666667%;max-width:91.666667%}
  .is-wrapper .col-sm-12{flex:0 0 100%;max-width:100%}
}

@media (min-width: 992px) {
  .is-wrapper .col-lg-1{flex:0 0 8.333333%;max-width:8.333333%}
  .is-wrapper .col-lg-2{flex:0 0 16.666667%;max-width:16.666667%}
  .is-wrapper .col-lg-3{flex:0 0 25%;max-width:25%}
  .is-wrapper .col-lg-4{flex:0 0 33.333333%;max-width:33.333333%}
  .is-wrapper .col-lg-5{flex:0 0 41.666667%;max-width:41.666667%}
  .is-wrapper .col-lg-6{flex:0 0 50%;max-width:50%}
  .is-wrapper .col-lg-7{flex:0 0 58.333333%;max-width:58.333333%}
  .is-wrapper .col-lg-8{flex:0 0 66.666667%;max-width:66.666667%}
  .is-wrapper .col-lg-9{flex:0 0 75%;max-width:75%}
  .is-wrapper .col-lg-10{flex:0 0 83.333333%;max-width:83.333333%}
  .is-wrapper .col-lg-11{flex:0 0 91.666667%;max-width:91.666667%}
  .is-wrapper .col-lg-12{flex:0 0 100%;max-width:100%}
}

/* ---------- 11. Legacy box.css parity ------------------------------- */
/* Corrects two rules where our runtime diverges from the legacy box.css the
 * imported content was authored against. Scoped under .is-wrapper and loaded
 * last so they win over the runtime's own (equal-specificity) rules.
 *
 * (a) Display heading: runtime ships `.is-container .display h1` at 3.2rem and
 *     drops line-height + text-transform. Restore the legacy design. */
.is-wrapper .display h1 {
  font-weight: 800;
  font-size: 3rem;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Display paragraph: legacy box.css renders `.display p` italic. */
.is-wrapper .display p {
  font-style: italic;
}

/* (b) Light text on dark sections: runtime only sets a near-white `*` rule
 *     (#ffffffed) that loses to blok-preset heading colours. Force pure #fff
 *     on the container and every text element, matching legacy box.css. */
.is-wrapper .is-light-text,
.is-wrapper .is-light-text h1,
.is-wrapper .is-light-text h2,
.is-wrapper .is-light-text h3,
.is-wrapper .is-light-text h4,
.is-wrapper .is-light-text h5,
.is-wrapper .is-light-text h6,
.is-wrapper .is-light-text p,
.is-wrapper .is-light-text li {
  /* !important: the runtime's `.is-container .is-light-text *:not(svg):not(path)`
   * rule is specificity (0,2,2) — higher than this (0,2,1) — and sets #ffffffed.
   * !important guarantees pure #fff wins (matches legacy box.css). */
  color: #fff;
}

/* ---------- 12. Blog layout ----------------------------------------- */
/* The blog article container (.blog-main) wraps ContentBox content in
 * .box-v2 > .is-container, which carries the default section padding. Zero it
 * so the blog body aligns with the blog layout's own gutters. */
.blog-main .box-v2 .is-container {
  padding: 0;
  max-width: 100%;
}

/* ---------- 13. Footer width ---------------------------------------- */
/* Constrain the footer's inner ContentBox wrapper so footer content lines up
 * with the page's max content width instead of stretching full-bleed. */
#is-wrapper-footer .is-container {
  max-width: 80rem;
}

/* ---------- 14. Legacy typography parity (TEMP, global) ------------- */
/* Reproduces the legacy box.css/custom.css + Bootstrap base treatment the
 * imported content was authored against: Open Sans body, light (300) weight,
 * line-height ~2 (body) / ~1.4 (headings), and #212529 text colour.
 * Low-specificity base so per-element blok-preset fonts/colours still win
 * (headings keep their heading font, paragraphs theirs; only base/list text
 * picks up Open Sans). NOTE: applied to ALL .is-wrapper content for now —
 * revisit to scope to imported sites only. */
.is-wrapper {
  font-family: "Open Sans", sans-serif;
  font-weight: 300;
  font-size: 1.07rem; /* legacy base text ≈ 17.12px (Bootstrap $font-size-base) */
  line-height: 2;
  color: #212529;
}
.is-wrapper h1, .is-wrapper h2, .is-wrapper h3,
.is-wrapper h4, .is-wrapper h5, .is-wrapper h6 {
  font-weight: 300;
  line-height: 1.4;
}
.is-wrapper p, .is-wrapper li {
  font-weight: 300;
  line-height: 2;
}
/* Legacy heading size scale, only for headings WITHOUT an explicit size-NN
 * class so ContentBox-authored sizes are preserved. Matches the original
 * Bootstrap-derived defaults: h1 37.76px … h6 20.8px at a 16px root. */
.is-wrapper h1:not([class*="size-"]) { font-size: 2.36rem; }
.is-wrapper h2:not([class*="size-"]) { font-size: 2rem; }
.is-wrapper h3:not([class*="size-"]) { font-size: 1.73rem; }
.is-wrapper h4:not([class*="size-"]) { font-size: 1.6rem; }
.is-wrapper h5:not([class*="size-"]) { font-size: 1.48rem; }
.is-wrapper h6:not([class*="size-"]) { font-size: 1.3rem; }

/* ---------- 15. List indentation ------------------------------------ */
/* content.css ships `.is-container>div>div:not([data-html]) ul/ol
 * { padding-inline-start: 20px }` (specificity 0,2,3) which halves the legacy
 * box.css/Bootstrap list indent. Restore the legacy 40px indent (browser
 * default) with a matching-structure, higher-specificity selector. Margin
 * (0 0 16px) and disc bullets already match — only the indent differed. */
.is-wrapper .is-container > div > div:not([data-html]) ul,
.is-wrapper .is-container > div > div:not([data-html]) ol {
  padding-left: 40px;
  margin: 0 0 16px;
}

/* ---------- 16. Image spacing --------------------------------------- */
/* Match the legacy box.css default vertical rhythm around in-content images. */
.is-wrapper img {
  margin: 1.4rem 0 1rem;
}
