/* 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: THIS SITE DOES HAVE A PAGER, and it withholds most of the posts.
 *
 * Measured on live: /blog declares data-paginate-total-elements="29" and
 * visible-items="10", and renders exactly 10 distinct data-blog-post-alias values.
 * The control is an APPEND-style <a class="more-posts-text-container"> ("Show
 * More"), not a numbered nav — driving it goes 10 -> 20 -> 29, after which the
 * control removes itself. blog.rss independently declares 29 items.
 *
 * A static build has no Duda backend, so all 26 cards ship and the extras are
 * stamped mg-blog-hidden with data-mg-blog-page in live's own batch size;
 * runtime.js reveals them a batch at a time. This rule is what hides them
 * initially, so unlike the port it came from it is NOT a no-op here. */
#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.
 *
 * Duda's own rule is `.postArticle:not(:last-child){padding-bottom:Npx}` — this
 * cascade carries it at 100px, 20px and 10px for the three bands. On live the
 * 10th card IS the last child and takes none of it. In our build the 10th card is
 * followed by 19 hidden siblings, so it stops matching :last-child and GAINS that
 * padding, pushing the control and the whole footer down by a constant amount at
 * every width — the signature of one shared element rather than a per-page fault.
 *
 * Keyed on `:has(+ .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;
}

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

/* MEDIA-SLIDER FILM ROLE — NO OVERRIDE, and that is the measured answer.
 *
 * An earlier revision added a filmstrip rule here, reasoning from the SERVED html
 * where the film role carries `.gDtRCy` with position:absolute, right:-200%,
 * flex-direction:row and translateX(-0%). That was WRONG, and it is recorded
 * rather than quietly deleted because the reasoning is seductive.
 *
 * The served html is the authority for what the RUNTIME WRITES, but this rule is
 * not something the runtime writes — it belongs to the pre-hydration render. Once
 * the component hydrates it re-renders under a different generated class and the
 * filmstrip rule is simply not applied.
 *
 * MEASURED on live, settled, at 1440:
 *     class="sc-gEvEer jKjUdt"  position:relative  display:block
 *     left:0px  right:0px  transform:none  children:2
 *
 * which is precisely what this build already produced WITHOUT any override. So
 * the correct action here is to add nothing.
 *
 * INHERITED CONTEXT, RETARGETED TWICE NOW. The paragraph that stood here described
 * a slider on a client two migrations back, and the retarget before this one
 * replaced it with a claim about cristosgaragedoors' /reviews page — a page this
 * site does not have. Neither was ever a fact about insulationspecialistusa.net.
 * The general lesson both recorded still holds and is why the block above adds
 * nothing: a slider showing a different photograph than live is usually the CAPTURE
 * landing on a different slide, not a CSS defect, and the remedy is to exclude it
 * from the pixel gate and verify it per element.
 *
 * CENSUSED ON THIS SITE (tools/census-structure.mjs, 159 captures, <style>/<script>
 * stripped first): .flexslider is on 24 of 53 pages, identically on all three bands.
 * There is also exactly ONE .bgGallerySlide, on a single page, and photo galleries
 * on 2. Whether any of them auto-advances is measured BEFORE anything is excluded,
 * and each exclusion is recorded in visual-diff.config.json's hiddenRegions with the
 * measurement behind it — a hidden region gets no pixel coverage at all, so the
 * per-element check is the only coverage it has.
 */

/* ---------------------------------------------------------------------------
 * ACCORDION OPEN STATE — recovering a rule the live CSS read could not see.
 *
 * Duda's FAQ accordion is a styled-component driven by Duda's runtime, which is
 * correctly not ported. The markup and the ported cascade both arrive intact, so
 * the widget PAINTS in its settled state and the pixel gate scores the page
 * 0.000% — while every click is inert. CENSUSED HERE: an accordion (matched on
 * data-grab, not on a class token — styled-components generate their class names,
 * so a class regex finds nothing on these) is present on 30 of 53 pages, identically
 * on all three bands.
 *
 * The state is a generated class on the panel host, and the two names are NOT
 * hardcoded here for the reason gotcha 75 gives: styled-components mint a fresh
 * instance name per render. What IS measured is the mechanism —
 *
 *     closed: .dygwmn { overflow:hidden; transition:max-height .3s ease-out;
 *                       height:auto; max-height:0px; }
 *
 * — so the transition runs on MAX-HEIGHT, and opening means raising it.
 *
 * THE OPEN RULE IS ABSENT FROM THE PORTED CASCADE, and that is not a porting
 * mistake. styled-components insert their rules through the CSSOM, so a class
 * only exists in a document's sheet if that component actually RENDERED with it.
 * No panel is ever open on a freshly loaded page, so `.gnWefg` — the open class
 * live uses — appears in ZERO of the ported sheets while `.dygwmn` appears in 4.
 * Restoring it is recovering a sheet the live read could not reach, which is the
 * same situation gotcha 46 describes for a slider's resting state, arrived at
 * from the opposite direction.
 *
 * Keyed on our own class rather than Duda's generated one so nothing here depends
 * on a name that changes per render. Repeated behind #dm to clear Duda's own
 * per-widget `!important` display rules (gotcha 70).
 *
 * Lives in gm/, NOT in styles/: port-css cleans its own hashed output from that
 * directory on every run and would take this file with it (gotcha 49).
 * ------------------------------------------------------------------------- */
#dm .mg-acc-open.mg-acc-open.mg-acc-open {
  max-height: 2000px;
}


/* DRAWER CARET TAP TARGET.
 *
 * The caret is an inline <span class="icon"> inside the label's anchor. Giving the
 * span itself a min-width/min-height turns it into a box wide enough to wrap, and
 * the arrows end up floating above and to the right of their labels — so the touch
 * area is supplied by an invisible ::after instead, leaving the caret's own inline
 * footprint untouched. ::before is already in use for the arrow glyph and its
 * rotate(180deg) open state, so ::after is free.
 *
 * Biased to the RIGHT of the caret, into the empty part of the anchor: the label
 * text ends at the caret, and the anchor runs on to the drawer's edge, so the space
 * is there for the taking without eating into the label's own tap area. */
#dm .layout-drawer .unifiednav__item_has-sub-nav > .nav-item-text .icon {
  position: relative;
}
#dm .layout-drawer .unifiednav__item_has-sub-nav > .nav-item-text .icon::after {
  content: '';
  position: absolute;
  top: -14px;
  bottom: -14px;
  left: -6px;
  width: 64px;
}

/* COLLAPSED SUBMENU GROUP IN THE DRAWER.
 *
 * Needed because the ported cascade opens the group containing the CURRENT page
 * without adding any class to the <li> — measured on /service-area, the submenu
 * stands at 308px with max-height 3200px while the <li> says only
 * `unifiednav__item-wrap`. runtime.js stamps mg-sub-closed at load so the class
 * and the rendered state cannot disagree.
 *
 * `max-height` clips the CONTENT box, so the <ul>'s own vertical padding survives
 * it and a "closed" group still stands a few px tall showing a sliver of the panel.
 * Duda sets that padding as `[data-auto="sub-pages"] { padding-top: 10px !important }`,
 * so the collapsed state has to answer with !important or it loses at any
 * specificity. Border collapsed with it for the same reason. */
#dm .layout-drawer .unifiednav__item-wrap.mg-sub-closed > .unifiednav__container_sub-nav {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  overflow: hidden !important;
}

/* The collapsed group's CARET must point down too.
 *
 * The same current-page cascade rule that opened the group also rotates its arrow
 * 180deg, so on /service-area the Service Area caret rendered as "^" over a group
 * that mg-sub-closed had just shut — the arrow claiming open while the panel was
 * closed. Reset it with the collapsed state.
 *
 * Rotates `.icon::before`, NOT `.icon`: the icon span carries a per-band
 * `transform: scale()` of its own, and overriding that instead would resize the
 * glyph while leaving the rotation exactly where it was. */
#dm .layout-drawer .unifiednav__item-wrap.mg-sub-closed > .unifiednav__item > .nav-item-text .icon::before {
  transform: rotate(0deg) !important;
}

/* LEGAL PAGES — /privacy-policy and /terms-and-conditions.
 *
 * Duda's reset zeroes `margin` on p, ul and h2, so a page built straight from the
 * fleet template renders as one unbroken slab with every heading pressed against
 * the paragraph above it. The rhythm has to be set explicitly.
 *
 * Repeated selector for specificity rather than !important, so a future page-level
 * rule can still win on merit. */
#dm .mg-legal.mg-legal {
  text-align: left;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}
#dm .mg-legal.mg-legal .mg-legal-h2 {
  margin: 2.25rem 0 0.75rem;
  line-height: 1.3;
}
#dm .mg-legal.mg-legal > .mg-legal-h2:first-child { margin-top: 0; }
#dm .mg-legal.mg-legal .mg-legal-p {
  margin: 0 0 1rem;
  line-height: 1.65;
}
#dm .mg-legal.mg-legal .mg-legal-ul {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
  list-style: disc;
}
#dm .mg-legal.mg-legal .mg-legal-ul li {
  margin: 0 0 0.4rem;
  line-height: 1.6;
  list-style: disc;
}
/* The legal pages sit on the site's light page background, so the links take the
 * body ink rather than a hardcoded colour — see the footer/contact rules below,
 * which face the opposite background and cannot share one value. */
#dm .mg-legal.mg-legal a {
  text-decoration: underline;
}

/* FOOTER LEGAL LINKS — a single line under the copyright.
 *
 * ALIGNMENT follows the copyright block's OWN, measured per band rather than
 * assumed: this site centres .copyright at 375, 768 AND 1440, so these are centred
 * at all three. (The fleet's usual left-on-desktop / centred-on-phone split is a
 * per-site fact, and forcing it here would strand these under a centred line.)
 *
 * INK is chosen for the background ACTUALLY BEHIND the links, walked up to the
 * first ancestor with a real colour: the copyright strip is white,
 * rgb(255,255,255), NOT the dark footer above it, and the copyright text on it is
 * rgb(52,52,51). So these take that same dark ink. Inheriting would pick up the
 * page ink, and copying the contact form's light-on-dark value would ship white
 * on white — the failure that passes every "the links are present" check. */
#dm .mg-legal-links {
  text-align: center;
  padding: 0.5rem 1rem 0.25rem;
  line-height: 1.6;
}
#dm .mg-legal-links a {
  color: rgb(52, 52, 51);
  text-decoration: underline;
  font-size: 0.85rem;
}
#dm .mg-legal-links a:hover,
#dm .mg-legal-links a:focus {
  color: rgb(0, 0, 0);
}
#dm .mg-legal-links .mg-legal-sep {
  color: rgb(52, 52, 51);
  margin: 0 0.5rem;
  font-size: 0.85rem;
}

/* CONTACT FORM LEGAL LINE.
 *
 * `clear: both` is the load-bearing declaration. Duda wraps the submit in
 * `.dmformsubmit.dmWidget.R`, which is FLOATED (measured: float:left, bottom 1985
 * against a last field bottom of 1974), so without it this block flows up beside
 * the button and lands ABOVE the last field while still being last in the markup.
 *
 * The space above is PADDING, not margin: a margin collapses against the preceding
 * widget's box and measures 0 at every width while the declaration still reads
 * fine in the CSS.
 *
 * Ink is for the background actually behind the form, measured as
 * rgb(255,255,255) — the same white as the copyright strip, so the same dark ink.
 * Kept left-aligned with the form's own fields rather than centred like the
 * footer's copy. */
#dm .mg-form-legal {
  clear: both;
  display: block;
  padding-top: 15px;
  text-align: left;
  line-height: 1.6;
  white-space: nowrap;
}
#dm .mg-form-legal a {
  color: rgb(52, 52, 51);
  text-decoration: underline;
  font-size: 0.85rem;
}
#dm .mg-form-legal a:hover,
#dm .mg-form-legal a:focus { color: rgb(0, 0, 0); }
#dm .mg-form-legal .mg-legal-sep {
  color: rgb(52, 52, 51);
  margin: 0 0.5rem;
  font-size: 0.85rem;
}

/* HOMEPAGE HERO SUBHEADING — centre it on every band.
 *
 * "Hire a trusted pest control company serving in Phoenix, az" (widget id
 * 1054868266) is the only heading in that column without an alignment class: the
 * one directly above it, "Protect Your Property From Pests", carries
 * `text-align-center`, so the pair rendered centred-then-left. Measured left at
 * 375, 768 and 1440, on live as well as here.
 *
 * Requested at review, so a deliberate deviation from live rather than a port fix.
 *
 * Nothing in the cascade targets this h2 at all — the left alignment is INHERITED
 * — so a plain declaration on the element wins without needing !important. The
 * attribute selector rather than an id selector because the id begins with a
 * digit, and it also catches the per-band duplicate of the same widget, which is
 * what makes this hold on all three devices. */
#dm [id="1054868266"] h2 {
  text-align: center;
}
