/**
 * EasyBuild — the page builder RESPONSIVE sheet (S07-O8).
 *
 * Everything here is device-scoped, and every device rule is a CONTAINER query evaluated against
 * the PAGE's own width, not the viewport's. That is the whole point: the builder's canvas sheet is
 * 390 px wide inside a 1500 px browser, so a viewport media query could never show an author what
 * a phone sees. .eb-pb-page (the published page's <main>) and .ebb-page (the canvas sheet — see
 * admin/assets/css/builder.css) both declare the "ebpage" container, so the SAME rules resolve on
 * both sides at the same width.
 *
 * BREAKPOINTS ARE UNCHANGED from the viewport media queries this replaces:
 *   mobile <= 640px  ·  tablet 641-1024px  ·  desktop >= 1025px
 *
 * BROWSER SUPPORT, stated honestly: container queries need Chrome/Edge 105+, Safari 16+,
 * Firefox 110+ (2022-23). An older browser sees the DESKTOP styling — every device rule simply
 * does not apply. There is deliberately NO @media fallback copy: two rule sets covering the same
 * breakpoints would BOTH apply inside the builder (whose viewport is the desktop's while its sheet
 * is 390 px) and fight each other, which is the bug this file exists to remove.
 *
 * Two mechanisms, both fed by modules/pages-funnels/trait-responsive.php:
 *   token classes  eb-t-sc-<key>-<value> / eb-m-sc-<key>-<value> — carrying the EXACT declarations
 *                  of the desktop .eb-sc-* rules in public-pagebuilder.css.
 *                  tests/test-builder-responsive.php reads both files and reds if any desktop rule
 *                  has no prefixed twin, so the two cannot drift apart.
 *   px triples     --ebc-<slug> / -t / -m on the element, read back here through the fallback
 *                  chain. `!important` because the desktop value is an INLINE declaration, and an
 *                  inline declaration beats any author rule without it. The class is emitted only
 *                  when an override exists, so nothing here touches a page that has none.
 *
 * Token / rem values only — 0 hex, like the sheet it extends.
 */

/* THE CONTAINER. Declared on the published page root; the canvas sheet declares the same name in
   builder.css. If this file fails to load, nothing below applies and the page renders desktop. */
.eb-pb-page { container-type: inline-size; container-name: ebpage; }

/* ============================ TABLET — 641px to 1024px ==================================== */
@container ebpage (min-width: 641px) and (max-width: 1024px) {
  /* Per-device HIDE — the same three classes, now measured against the PAGE. This is what makes
     the canvas at 768 px hide a tablet-hidden element instead of showing it. */
  .eb-hide-tablet { display: none !important; }

  .eb-t-sc-align-left { text-align: left; }
  .eb-t-sc-align-center { text-align: center; }
  .eb-t-sc-align-right { text-align: right; }
  .eb-t-sc-size-tiny { font-size: .75rem; }
  .eb-t-sc-size-small { font-size: .875rem; }
  .eb-t-sc-size-medium { font-size: 1rem; }
  .eb-t-sc-size-large { font-size: 1.375rem; }
  .eb-t-sc-size-giant { font-size: 2rem; }
  .eb-t-sc-size-full { font-size: 2.75rem; }
  .eb-t-sc-margin-none { margin: 0; }
  .eb-t-sc-margin-small { margin: var(--eb-space-2); }
  .eb-t-sc-margin-medium { margin: var(--eb-space-4); }
  .eb-t-sc-margin-large { margin: var(--eb-space-6); }
  .eb-t-sc-shadow-none { box-shadow: none; }
  .eb-t-sc-shadow-small { box-shadow: var(--eb-shadow-sm); }
  .eb-t-sc-shadow-medium { box-shadow: var(--eb-shadow-md); }
  .eb-t-sc-shadow-large { box-shadow: var(--eb-shadow-lg); }
  .eb-t-sc-lineheight-tight { line-height: 1.2; }
  .eb-t-sc-lineheight-normal { line-height: 1.4; }
  .eb-t-sc-lineheight-relaxed { line-height: 1.6; }
  .eb-t-sc-lineheight-loose { line-height: 1.8; }
  .eb-t-sc-textshadow-none { text-shadow: none; }
  .eb-t-sc-textshadow-small { text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
  .eb-t-sc-textshadow-medium { text-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
  .eb-t-sc-textshadow-large { text-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
  .eb-t-sc-corners-none { border-radius: 0; }
  .eb-t-sc-corners-small { border-radius: var(--eb-radius-sm); }
  .eb-t-sc-corners-medium { border-radius: var(--eb-radius); }
  .eb-t-sc-corners-large { border-radius: var(--eb-radius-lg); }
  .eb-t-sc-corners-round { border-radius: var(--eb-radius-pill); }
  .eb-t-sc-weight-regular { font-weight: 400; }
  .eb-t-sc-weight-medium { font-weight: 500; }
  .eb-t-sc-weight-bold { font-weight: 700; }
  .eb-t-sc-weight-black { font-weight: 900; }
  .eb-t-sc-bg-none { background: transparent; }
  .eb-t-sc-bg-primary { background: var(--eb-primary); color: var(--eb-navy); --eb-text: var(--eb-navy); --eb-text-muted: var(--eb-navy); --eb-field-edge: var(--eb-navy); }
  .eb-t-sc-bg-navy { background: var(--eb-navy); color: var(--eb-on-navy); --eb-text: var(--eb-on-navy); --eb-text-muted: var(--eb-on-navy); --eb-field-edge: var(--eb-on-navy); }
  .eb-t-sc-bg-cta { background: var(--eb-cta); color: var(--eb-navy); --eb-text: var(--eb-navy); --eb-text-muted: var(--eb-navy); --eb-field-edge: var(--eb-ink); }
  .eb-t-sc-bg-muted { background: var(--eb-surface-2); color: var(--eb-text-base); --eb-text: var(--eb-text-base); --eb-text-muted: var(--eb-text-muted-base); --eb-field-edge: var(--eb-band-edge); }
  .eb-t-sc-bg-surface { background: var(--eb-surface); color: var(--eb-text-base); --eb-text: var(--eb-text-base); --eb-text-muted: var(--eb-text-muted-base); --eb-field-edge: var(--eb-band-edge); }
  .eb-t-sc-color-primary { color: var(--eb-primary-hover); }
  .eb-t-sc-color-navy { color: var(--eb-navy-text); }
  .eb-t-sc-color-cta { color: var(--eb-cta-text); }
  .eb-t-sc-color-muted { color: var(--eb-text-muted); }
  .eb-t-sc-color-surface { color: var(--eb-surface-text); }

  /* The px triples. Doubled class = specificity (0,2,0), so these also clear the base sheet's
     .eb-pb-comp:last-child rule rather than losing to it the way a single class would. */
  .eb-rvp-margin.eb-rvp-margin { margin: var(--ebc-margin-t, var(--ebc-margin)) !important; }
  .eb-rvp-padding.eb-rvp-padding { padding: var(--ebc-padding-t, var(--ebc-padding)) !important; }
  .eb-rvp-radius.eb-rvp-radius { border-radius: var(--ebc-radius-t, var(--ebc-radius)) !important; }
  .eb-rvp-bg.eb-rvp-bg { background: var(--ebc-bg-t, var(--ebc-bg)) !important; }
  .eb-rvp-border.eb-rvp-border { border: var(--ebc-border-t, var(--ebc-border)) !important; }

  /* Section background PATTERN, per device. Same overlay geometry as the desktop block in
     public-pagebuilder.css; `none` is a real value here because turning a pattern OFF on one
     device is a thing an author does. */
  .eb-t-secpat-dots::before, .eb-t-secpat-grid::before, .eb-t-secpat-diagonal::before,
  .eb-t-secpat-checks::before, .eb-t-secpat-none::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .55;
  }
  .eb-t-secpat-none::before { background-image: none; }
  .eb-t-secpat-dots::before {
    background-image: radial-gradient(var(--eb-border) 1.5px, transparent 1.6px);
    background-size: 16px 16px;
  }
  .eb-t-secpat-grid::before {
    background-image: linear-gradient(var(--eb-border) 1px, transparent 1px),
                      linear-gradient(90deg, var(--eb-border) 1px, transparent 1px);
    background-size: 24px 24px;
  }
  .eb-t-secpat-diagonal::before {
    background-image: repeating-linear-gradient(45deg, var(--eb-border) 0, var(--eb-border) 1px, transparent 1px, transparent 10px);
  }
  .eb-t-secpat-checks::before {
    background-image: linear-gradient(45deg, var(--eb-border) 25%, transparent 25%, transparent 75%, var(--eb-border) 75%),
                      linear-gradient(45deg, var(--eb-border) 25%, transparent 25%, transparent 75%, var(--eb-border) 75%);
    background-size: 24px 24px; background-position: 0 0, 12px 12px; opacity: .25;
  }
}

/* ============================ MOBILE — up to 640px ======================================== */
@container ebpage (max-width: 640px) {
  .eb-hide-mobile { display: none !important; }

  .eb-m-sc-align-left { text-align: left; }
  .eb-m-sc-align-center { text-align: center; }
  .eb-m-sc-align-right { text-align: right; }
  .eb-m-sc-size-tiny { font-size: .75rem; }
  .eb-m-sc-size-small { font-size: .875rem; }
  .eb-m-sc-size-medium { font-size: 1rem; }
  .eb-m-sc-size-large { font-size: 1.375rem; }
  .eb-m-sc-size-giant { font-size: 2rem; }
  .eb-m-sc-size-full { font-size: 2.75rem; }
  .eb-m-sc-margin-none { margin: 0; }
  .eb-m-sc-margin-small { margin: var(--eb-space-2); }
  .eb-m-sc-margin-medium { margin: var(--eb-space-4); }
  .eb-m-sc-margin-large { margin: var(--eb-space-6); }
  .eb-m-sc-shadow-none { box-shadow: none; }
  .eb-m-sc-shadow-small { box-shadow: var(--eb-shadow-sm); }
  .eb-m-sc-shadow-medium { box-shadow: var(--eb-shadow-md); }
  .eb-m-sc-shadow-large { box-shadow: var(--eb-shadow-lg); }
  .eb-m-sc-lineheight-tight { line-height: 1.2; }
  .eb-m-sc-lineheight-normal { line-height: 1.4; }
  .eb-m-sc-lineheight-relaxed { line-height: 1.6; }
  .eb-m-sc-lineheight-loose { line-height: 1.8; }
  .eb-m-sc-textshadow-none { text-shadow: none; }
  .eb-m-sc-textshadow-small { text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
  .eb-m-sc-textshadow-medium { text-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
  .eb-m-sc-textshadow-large { text-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
  .eb-m-sc-corners-none { border-radius: 0; }
  .eb-m-sc-corners-small { border-radius: var(--eb-radius-sm); }
  .eb-m-sc-corners-medium { border-radius: var(--eb-radius); }
  .eb-m-sc-corners-large { border-radius: var(--eb-radius-lg); }
  .eb-m-sc-corners-round { border-radius: var(--eb-radius-pill); }
  .eb-m-sc-weight-regular { font-weight: 400; }
  .eb-m-sc-weight-medium { font-weight: 500; }
  .eb-m-sc-weight-bold { font-weight: 700; }
  .eb-m-sc-weight-black { font-weight: 900; }
  .eb-m-sc-bg-none { background: transparent; }
  .eb-m-sc-bg-primary { background: var(--eb-primary); color: var(--eb-navy); --eb-text: var(--eb-navy); --eb-text-muted: var(--eb-navy); --eb-field-edge: var(--eb-navy); }
  .eb-m-sc-bg-navy { background: var(--eb-navy); color: var(--eb-on-navy); --eb-text: var(--eb-on-navy); --eb-text-muted: var(--eb-on-navy); --eb-field-edge: var(--eb-on-navy); }
  .eb-m-sc-bg-cta { background: var(--eb-cta); color: var(--eb-navy); --eb-text: var(--eb-navy); --eb-text-muted: var(--eb-navy); --eb-field-edge: var(--eb-ink); }
  .eb-m-sc-bg-muted { background: var(--eb-surface-2); color: var(--eb-text-base); --eb-text: var(--eb-text-base); --eb-text-muted: var(--eb-text-muted-base); --eb-field-edge: var(--eb-band-edge); }
  .eb-m-sc-bg-surface { background: var(--eb-surface); color: var(--eb-text-base); --eb-text: var(--eb-text-base); --eb-text-muted: var(--eb-text-muted-base); --eb-field-edge: var(--eb-band-edge); }
  .eb-m-sc-color-primary { color: var(--eb-primary-hover); }
  .eb-m-sc-color-navy { color: var(--eb-navy-text); }
  .eb-m-sc-color-cta { color: var(--eb-cta-text); }
  .eb-m-sc-color-muted { color: var(--eb-text-muted); }
  .eb-m-sc-color-surface { color: var(--eb-surface-text); }

  .eb-rvp-margin.eb-rvp-margin { margin: var(--ebc-margin-m, var(--ebc-margin-t, var(--ebc-margin))) !important; }
  .eb-rvp-padding.eb-rvp-padding { padding: var(--ebc-padding-m, var(--ebc-padding-t, var(--ebc-padding))) !important; }
  .eb-rvp-radius.eb-rvp-radius { border-radius: var(--ebc-radius-m, var(--ebc-radius-t, var(--ebc-radius))) !important; }
  .eb-rvp-bg.eb-rvp-bg { background: var(--ebc-bg-m, var(--ebc-bg-t, var(--ebc-bg))) !important; }
  .eb-rvp-border.eb-rvp-border { border: var(--ebc-border-m, var(--ebc-border-t, var(--ebc-border))) !important; }

  .eb-m-secpat-dots::before, .eb-m-secpat-grid::before, .eb-m-secpat-diagonal::before,
  .eb-m-secpat-checks::before, .eb-m-secpat-none::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .55;
  }
  .eb-m-secpat-none::before { background-image: none; }
  .eb-m-secpat-dots::before {
    background-image: radial-gradient(var(--eb-border) 1.5px, transparent 1.6px);
    background-size: 16px 16px;
  }
  .eb-m-secpat-grid::before {
    background-image: linear-gradient(var(--eb-border) 1px, transparent 1px),
                      linear-gradient(90deg, var(--eb-border) 1px, transparent 1px);
    background-size: 24px 24px;
  }
  .eb-m-secpat-diagonal::before {
    background-image: repeating-linear-gradient(45deg, var(--eb-border) 0, var(--eb-border) 1px, transparent 1px, transparent 10px);
  }
  .eb-m-secpat-checks::before {
    background-image: linear-gradient(45deg, var(--eb-border) 25%, transparent 25%, transparent 75%, var(--eb-border) 75%),
                      linear-gradient(45deg, var(--eb-border) 25%, transparent 25%, transparent 75%, var(--eb-border) 75%);
    background-size: 24px 24px; background-position: 0 0, 12px 12px; opacity: .25;
  }

  /* KARTRA STACKS COLUMNS ON MOBILE. Below 641 px every column of a row is full width, whatever
     twelfths it claims on wider devices — one fixed rule, not a per-device width model (per-device
     column widths are a later order). `!important` because the twelfths are an inline flex-basis.
     The offset (a left margin in twelfths) goes with it: a stacked column starts at the edge. */
  .eb-pb-col { flex: 0 0 100% !important; max-width: 100% !important; margin-left: 0 !important; }
}

/* ============================ DESKTOP — 1025px and wider ================================== */
@container ebpage (min-width: 1025px) {
  .eb-hide-desktop { display: none !important; }
}
