/* Hand-written overrides for this migration.
 *
 * DELIBERATELY OUTSIDE site/public/styles/ (gotcha 49): tools/port-css.mjs owns
 * that directory and clears it on every run, so a hand-written sheet placed there
 * is deleted by the next port with no error anywhere.
 *
 * Keep this file minimal. Anything that can come from the ported cascade should.
 *
 * 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 }
 *
 * which is (1,2,1) AND !important. A hide written as a plain
 * `.mg-blog-hidden { display:none !important }` is (0,1,0), so with !important on
 * both sides SPECIFICITY decides and Duda's rule wins — the element stays visible
 * and nothing in the console says so. Every gate below therefore repeats its class
 * three times behind `#dm`, giving (1,3,0), which outranks (1,2,1) on class count
 * without depending on source order. Do not "tidy" the repetition away.
 */

/* 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;
}

/* BLOG INDEX — this site withholds most of its posts, and the numbers are this
 * site's own, measured rather than carried:
 *
 *   /blog declares data-paginate-total-elements="28" and visible-items="9",
 *   and serves exactly 9 distinct data-blog-post-alias values.
 *   The control is an APPEND-style <a class="more-posts-text-container">
 *   ("Show More"), not a numbered pager. Driving it on live goes
 *   9 -> 18 -> 27 -> 28, after which the control removes itself.
 *   blog.rss independently declares 28 items, and so does the sitemap
 *   (28 entries at priority 0.8). Three independent sources agree.
 *
 * A static build has no Duda backend, so all 28 cards ship per band and the 19
 * extras are stamped mg-blog-hidden with data-mg-blog-page in live's own batch
 * size (57 = 19 x 3 bands). runtime.js reveals them a batch at a time. This rule
 * is what hides them initially. */
#dm .mg-blog-hidden.mg-blog-hidden.mg-blog-hidden {
  display: none !important;
}

/* display:none DOES NOT CHANGE CHILD INDICES, so shipping the withheld cards
 * silently moves which card is :last-child — gotcha 69.
 *
 * Duda's own rule is `.postArticle:not(:last-child){padding-bottom:Npx}`, and the
 * ported cascade here carries it at ten different values (10px through 100px) for
 * the different bands and widgets. On live the 9th card IS the last child and
 * takes none of it. In our build the 9th card is followed by 19 hidden siblings,
 * so it stops matching :last-child and GAINS that padding, pushing "Show More"
 * and the whole footer down by a constant amount at every width — a constant
 * absolute delta at every width is the signature of ONE shared element rather
 * than a per-page fault.
 *
 * Keyed on `:has(+ .postArticle.mg-blog-hidden)` rather than on a stamped class,
 * because that tracks the SEQUENCE as batches are revealed instead of pinning the
 * initial state; runtime.js does not have to re-stamp anything as cards appear.
 *
 * Specificity: Duda's rule is (0,2,1) and not !important, so this (0,4,1) plain
 * rule wins on merit without needing one. */
#dm .postArticle:not(.mg-blog-hidden):has(+ .postArticle.mg-blog-hidden) {
  padding-bottom: 0;
}

/* NO .mg-only-<band> RULES HERE, and their absence is a measured decision rather
 * than an omission.
 *
 * The pipeline this repo inherited emits three copies of a per-device widget
 * (.dmPhotoGallery, .mainBlog, .imageWidget, the map host) inside ONE content
 * band and gates them by class. That is right where the build ships one body for
 * two bands. This build ships THREE content bands whole, because the tablet
 * content differs from desktop on 37 of 37 pages and the phone content on 36 of
 * 37 — so a widget fork inside the desktop band duplicates a widget the tablet
 * band already carries.
 *
 * Measured with the fork still on: the home page's gallery shipped three times,
 * #dmFirstContainer came out 9756px against live's 3636, and the page scored
 * 76.801% at 1440. The fork is off in build-pages.py, `mg-only-` appears zero
 * times in dist, and these rules would now match nothing. A rule that matches
 * nothing is not free — it is the next reader's evidence that a mechanism is in
 * use when it is not. */
