/* Myaree Dental website v2.1 (21-11-2026 AWST): menu format + even page fill.
   Add-on only. Loads after every earlier file and replaces none of them.
   Every rule sits under html:not(.adh-menu21-off), so ?adh_menu21=0 turns all of it off in that tab.
   Page-fill rules (part C) never apply on the home page: they skip html[data-adh-page="home"] (set by the v1.7 header line). */

/* ---------- A. Desktop menu bar (1081px and wider) ---------- */
@media (min-width:1081px){
  /* A1. The menu list inherited the phone drawer's 100dvh height and 24px bottom padding, which pushed the
         items 12px above the middle of the bar. Give it its natural height so items sit on the bar's centre line. */
  html:not(.adh-menu21-off) .adh-root .site-header #menu:not(.open){
    height:auto !important;
    max-height:none !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
    top:auto !important;
    align-self:center;
  }
  /* A2. Logo | menu | tools. The menu stays centred in the bar, but never closer than the gap to the logo or
         the tools (it was 4px from the tools at 1280-1920). The same layout runs at every desktop width. */
  html:not(.adh-menu21-off).adh-menu-v12 .adh-root .site-header .container.nav,
  html:not(.adh-menu21-off).adh-menu-v12 .adh-root .site-header .nav{
    display:grid !important;
    grid-template-columns:minmax(max-content,1fr) auto minmax(max-content,1fr) !important;
    column-gap:clamp(20px,2.2vw,32px) !important;
    justify-content:stretch !important;
  }
  html:not(.adh-menu21-off).adh-menu-v12 .adh-root .site-header .nav > nav{
    grid-column:2 !important;
    justify-self:center !important;
    width:max-content !important;
    flex:none !important;
  }
  html:not(.adh-menu21-off).adh-menu-v12 .adh-root .site-header .nav > .brand{grid-column:1 !important;justify-self:start !important}
  html:not(.adh-menu21-off).adh-menu-v12 .adh-root .site-header .nav > .nav-cta{grid-column:3 !important;justify-self:end !important}
  /* A3. Even spacing: equal padding on every item and no extra list gap, so the space between one item and
         the next is the same whether or not the item has a dropdown arrow. */
  html:not(.adh-menu21-off) .adh-root .site-header #menu:not(.open){gap:0 !important}
  /* Home stays in the menu at every desktop width (it was dropped between 1081 and 1279px only). */
  html:not(.adh-menu21-off).h3 .adh-root .site-header #menu:not(.open) > li:first-child:has(> a[href="/"]){display:list-item !important}
  html:not(.adh-menu21-off) .adh-root .site-header #menu:not(.open) > li > a,
  html:not(.adh-menu21-off) .adh-root .site-header #menu:not(.open) > li > button{
    padding-left:clamp(.42rem,.55vw,.6rem) !important;
    padding-right:clamp(.42rem,.55vw,.6rem) !important;
    min-height:44px;
    display:inline-flex !important;
    align-items:center;
  }

  /* ---------- B. Dropdowns ---------- */
  /* B1. Wide dropdowns line up exactly with the white bar (they were 1400px wide on a 1200px bar, and the
         Education one sat off-centre). Fade-in only, so no sideways jump while it opens. */
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega.mega-wide{
    left:0 !important;
    right:0 !important;
    width:auto !important;
    max-width:none !important;
    margin:0 !important;
    transform:none !important;
  }
  /* Education keeps its place under its own button (set by the existing menu script) and its width.
     One section per row, each list in two even columns (Learn 3 + 3, Families 1 + 1) instead of 6 / 2. */
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega.mega-2{
    grid-template-columns:minmax(0,1fr) !important;
  }
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega.mega-2 .mega-col ul{
    grid-template-columns:repeat(2,minmax(0,1fr));
    column-gap:.5rem;
  }
  html:not(.adh-menu21-off) .adh-root .has-sub.open > .sub.mega.mega-wide,
  html:not(.adh-menu21-off) .adh-root .has-sub.open > .sub.mega.mega-2{animation-name:adh21-sub-in !important}
  /* B2. Treatments: three even columns of eight (the script pairs the six groups), instead of six ragged
         columns (6/5/4/2/3/4) with wrapped names. Scrolls inside itself on short laptop screens. */
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega.mega-6.adh21-stacked{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:.4rem 1.4rem !important;
    max-height:calc(100vh - var(--adh21-subtop,140px) - 16px) !important;
    max-height:calc(100dvh - var(--adh21-subtop,140px) - 16px) !important;
    overflow-y:auto !important;
    overscroll-behavior:contain;
  }
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega-6 .adh21-stack{display:flex;flex-direction:column;gap:.5rem;min-width:0}
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega-6.adh21-stacked .mega-feat{grid-column:1/-1}
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega-6.adh21-stacked .mega-h{font-size:.76rem}
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega.mega-6.adh21-stacked a{font-size:.92rem}
  /* B3. A hover bridge over the gap between the bar and a dropdown, so moving the pointer down never closes it. */
  html:not(.adh-menu21-off) .adh-root .site-header .has-sub.open > .sub.mega > .adh21-bridge{
    position:absolute;left:0;right:0;top:-26px;height:26px;display:block;
  }
  /* B4. Small dropdowns keep inside the bar on narrow desktops (the script sets the shift). */
  html:not(.adh-menu21-off) .adh-root .site-header .sub.mega.mega-1{translate:var(--adh21-shift,0) 0}
}
@keyframes adh21-sub-in{from{opacity:0}to{opacity:1}}
html:not(.adh-menu21-off) .adh21-bridge{display:none}

/* B5. Group headings in the dropdowns and the phone menu (Restorative, Cosmetic, Learn...) are links: give
       them a 24px-tall tap area (WCAG 2.2, 2.5.8). Text does not move. */
html:not(.adh-menu21-off) .adh-root .sub.mega .mega-h a{
  display:inline-block !important;
  padding-top:5px !important;
  padding-bottom:5px !important;
  margin-top:-5px;
  margin-bottom:-5px;
  min-height:24px;
  box-sizing:border-box;
}

/* ---------- Phone and tablet menu (1080px and narrower) ---------- */
@media (max-width:1080px){
  /* M1. The close button sits where the menu button was (the script measures it), not on top of the
         language and phone buttons in the dark top strip. */
  html:not(.adh-menu21-off).adh-mnav-open .adh-root .burger[aria-expanded="true"]{
    top:var(--adh21-bx-top,1rem) !important;
    right:var(--adh21-bx-right,1rem) !important;
  }
  /* The menu button leaves the row when it turns into the close button; keep its slot so Book and the
     tool icons do not slide under the close button. */
  html:not(.adh-menu21-off).adh-mnav-open .adh-root .site-header .nav-cta:has(> .burger[aria-expanded="true"])::after{
    content:"";
    flex:0 0 var(--adh21-bw,40px);
    width:var(--adh21-bw,40px);
    height:1px;
  }
  /* M2. The sheet always starts below the close button. */
  html:not(.adh-menu21-off).adh-menu-v12.adh-mnav-open .adh-root #menu.open{
    max-height:calc(100dvh - var(--adh21-sheet-top,84px)) !important;
  }
  /* M3. "I want to..." tiles: 7 tiles in 2 columns left Shop alone in the last row. An odd last tile spans the row. */
  html:not(.adh-menu21-off) .mn12-intents > :last-child:nth-child(odd){grid-column:1/-1}
}

/* ---------- C. Even page fill (every page except home) ---------- */
/* C1. One content width. Some sections were narrowed to 900, 960 or 1040px and pushed in from the left
       edge every other section uses, giving ragged left edges (120 / 200 / 270px at 1440). They now use the
       site's standard width; paragraphs keep a comfortable reading length. */
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main .container[style*="max-width:900px"],
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main .container[style*="max-width:960px"],
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main .container[style*="max-width:1040px"]{
  max-width:var(--max,1200px) !important;
}
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main .container[style*="max-width:900px"] p,
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main .container[style*="max-width:960px"] > p{
  max-width:72ch;
}
/* The technology tour video block lines up with the same edges. */
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main .adh-vt-wrap{
  width:min(100% - 2.5rem, var(--max,1200px)) !important;
  max-width:none !important;
  margin-inline:auto !important;
}
/* C2. Grids that left one or two cards alone on the last row. */
@media (min-width:700px){
  /* Treatment "types" cards (3 cards in 2 columns): the odd last card spans the row. */
  html:not(.adh-menu21-off) .adh-root main#main .tfx-types > :last-child:nth-child(odd){grid-column:1/-1}
  /* Health funds treatment picker (9 options in 2 columns): 3 even columns. */
  html:not(.adh-menu21-off) .adh-root main#main .opt-cards.tx-pick{grid-template-columns:repeat(3,minmax(0,1fr)) !important}
}
@media (min-width:900px){
  /* Treatment facts tabs (7 tabs): one even row instead of 4 + 3 at 900-1279px. */
  html:not(.adh-menu21-off) .adh-root main#main .tfx-tabs{grid-template-columns:repeat(7,minmax(0,1fr)) !important}
  /* Prepare: visit type (10 options): 5 + 5 instead of 4 + 4 + 2. */
  html:not(.adh-menu21-off) .adh-root main#main .pv-opts{grid-template-columns:repeat(5,minmax(0,1fr)) !important}
  /* Book: trust list (5 items) on one row instead of 4 + 1. */
  html:not(.adh-menu21-off) .adh-root main#main .trust-list{grid-template-columns:repeat(5,minmax(0,1fr)) !important}
}
@media (min-width:640px){
  /* Technology cards (19): the last row is centred instead of hanging off the left. */
  html:not(.adh-menu21-off) .adh-root main#main .tg-grid{
    display:flex !important;
    flex-wrap:wrap;
    justify-content:center;
    --adh21-cols:2;
    --adh21-gap:12px;
    gap:var(--adh21-gap) !important;
  }
  html:not(.adh-menu21-off) .adh-root main#main .tg-grid > *{
    flex:0 0 calc((100% - (var(--adh21-cols) - 1) * var(--adh21-gap,1rem)) / var(--adh21-cols));
    max-width:calc((100% - (var(--adh21-cols) - 1) * var(--adh21-gap,1rem)) / var(--adh21-cols));
    min-width:0;
  }
}
@media (min-width:900px){html:not(.adh-menu21-off) .adh-root main#main .tg-grid{--adh21-cols:3;--adh21-gap:18px}}
@media (min-width:1200px){html:not(.adh-menu21-off) .adh-root main#main .tg-grid{--adh21-cols:4}}
/* C3. Even vertical rhythm on inner pages: section padding 80px -> 64px on desktop, and the last item in a
       section no longer adds its own bottom margin on top of the padding (gaps of 215-282px become ~130px). */
@media (min-width:1081px){
  html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main > section.section{
    padding-top:64px !important;
    padding-bottom:64px !important;
  }
}
html:not(.adh-menu21-off):not([data-adh-page="home"]) .adh-root main#main > section.section > .container > :last-child{margin-bottom:0 !important}

@media (prefers-reduced-motion:reduce){
  html:not(.adh-menu21-off) .adh-root .has-sub.open > .sub.mega{animation:none !important}
}
