/* Hand-written overrides for this migration.
 *
 * DELIBERATELY OUTSIDE site/public/styles/ (gotcha 49): tools/port-css.mjs owns
 * that directory and clears its own hashed outputs on every run, so a hand-written
 * sheet placed there is deleted by the next port with no error anywhere — on one
 * site that silently removed the sheet that hides the inactive device bands, and
 * all three headers then rendered at every width.
 *
 * Keep this file minimal. Anything that can come from the ported cascade should.
 */

/* The honeypot. Positioned off-screen rather than display:none — bots skip
 * obviously-hidden fields, and taking it out of flow means it costs no layout,
 * which the pixel gate would otherwise measure. */
.mg-hp {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* SPECIFICITY NOTE — read before editing any rule below.
 *
 * Duda emits a per-widget rule for EVERY widget on the site, shaped
 *
 *     #dm .dmBody div.u_1213107879 { display: block !important }
 *
 * That is specificity (1,2,1) and it is `!important`. A hide written as a plain
 * `.mg-only-t { display:none !important }` is (0,1,0), so `!important` on both
 * sides means SPECIFICITY decides and Duda's rule wins — the element stays
 * visible and nothing in the console says so.
 *
 * Measured: with the plain selector, /blog rendered all THREE per-device widget
 * copies at once — 30 cards against live's 10, document height 7640px against
 * live's 3548px, and the gate scored 59.4%.
 *
 * So every gate below repeats its class three times behind `#dm`, giving (1,3,0),
 * which outranks (1,2,1) on class count without relying on source order. Do not
 * "tidy" the repetition away.
 */

/* Blog index: /blog serves 10 of 65 posts and pages the rest from Duda's backend,
 * which we do not have. All 65 ship; runtime.js shows one page of 10 at a time. */
#dm .mg-blog-hidden.mg-blog-hidden.mg-blog-hidden {
  display: none !important;
}

/* PER-DEVICE WIDGET FORKS.
 *
 * Duda builds .dmPhotoGallery and .mainBlog client-side and the three device
 * documents genuinely differ, so build-pages.py emits each widget three times and
 * stamps the copies mg-only-d / mg-only-t / mg-only-m. Without these rules ALL
 * THREE render at every width — which is exactly what the first gate run showed:
 * / came back at 77% with a +10458px height delta and /blog at 62% with +10150,
 * both of them simply the same widget painted three times over.
 *
 * The band boundaries are Duda's own, read out of the ported cascade: mobile
 * <=767, tablet 768-1024, desktop >=1025.
 *
 * These hide rather than remove, deliberately — the elements stay in the document
 * so the runtime can still address them, and display:none costs no layout.
 *
 * Only the INACTIVE bands are hidden, inside the media queries. The active band is
 * never touched, so it keeps whatever `display` the ported cascade gives it — an
 * earlier version hid all three and restored one with `display: revert`, which
 * reverts past the author cascade to the UA default and would have replaced the
 * widget's real display value with a plain `block`. */
@media (max-width: 767px) {
  #dm .mg-only-d.mg-only-d.mg-only-d,
  #dm .mg-only-t.mg-only-t.mg-only-t {
    display: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  #dm .mg-only-d.mg-only-d.mg-only-d,
  #dm .mg-only-m.mg-only-m.mg-only-m {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  #dm .mg-only-t.mg-only-t.mg-only-t,
  #dm .mg-only-m.mg-only-m.mg-only-m {
    display: none !important;
  }
}

/* PARALLAX ATTACHMENT, MEASURED PER BAND (gotchas 22 and 44).
 *
 * Duda freezes parallax on touch in ITS RUNTIME, not in CSS. The ported cascade
 * therefore carries `background-attachment: fixed !important` at every width,
 * while live actually computes:
 *
 *     desktop 1440 = fixed      tablet 768 = scroll      mobile 375 = scroll
 *
 * (tools/probe-attachment.mjs, and tools/probe-fixed-bg.mjs confirms exactly ONE
 * element site-wide computes fixed with a real background image: u_1758549802 on
 * the home page. That probe scrolls to settle first — an earlier version read the
 * computed style ~2s after load, before Duda paints backgrounds from
 * data-background-image, and reported zero fixed backgrounds site-wide.)
 *
 * Left `fixed` below 1025px, the background attaches to the VIEWPORT, so a
 * full-page capture sizes it to the whole document and renders a completely
 * different crop of the same photograph.
 *
 * SPECIFICITY: Duda's own rule is `#dm .dmBody div.u_1758549802` — (1,2,1) and
 * !important. A `[class*=dmSectionParall]` selector is (0,1,0) and loses. The
 * class is repeated three times behind #dm for (1,3,0), which outranks it on
 * class count without depending on source order. Both of Duda's spellings are
 * matched — it ships dmSectionParallaxNew AND dmSectionParallex.
 *
 * Scoped to <=1024px, which is the band edge measured on this site (the desktop
 * header takes over at 1025). */
@media (max-width: 1024px) {
  #dm [class*="dmSectionParall"][class*="dmSectionParall"][class*="dmSectionParall"] {
    background-attachment: scroll !important;
  }
}
