/* =========================================================
   SMALL TOWN MAHJ — FINAL SHARED SITE SHELL
   One header and footer treatment on every route. Decorative side artwork
   belongs to page content only; it never runs behind the fixed header or footer.
   Homepage photo hero remains the intentional unframed exception.
   ========================================================= */

body {
  padding-inline: 0 !important;
}

/* Retire the old viewport-fixed frame so the floral artwork cannot appear
   behind the shared header/footer. Content owns the rails instead. */
body > .mat-edge-frame {
  display: none !important;
}

body > .tabletop-shell {
  width: 100% !important;
  margin-inline: 0 !important;
}

/* Shared header: always full viewport width, regardless of page. */
.site-header.mat-header,
.site-header.mat-header[data-scrolled] {
  right: 0 !important;
  left: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Shared footer: always full viewport width and never framed. */
.site-footer {
  position: relative !important;
  z-index: 20 !important;
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Interior pages: start the framed content field immediately below the fixed
   header. The logo-clearance space lives INSIDE main so the floral rails are
   already visible while page content waits safely below the hanging crest. */
body:not(:has(.home-photo-hero)) > .tabletop-shell {
  padding-top: var(--site-header-height) !important;
}

body:not(:has(.home-photo-hero)) .tabletop-shell > main {
  position: relative !important;
  isolation: isolate;
  width: 100% !important;
  padding-top: var(--site-header-logo-clearance) !important;
  padding-inline: var(--site-side-frame) !important;
  box-sizing: border-box !important;
  background: var(--site-paper) !important;
}

body:not(:has(.home-photo-hero)) .tabletop-shell > main::before,
body:not(:has(.home-photo-hero)) .tabletop-shell > main::after {
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  width: var(--site-side-frame);
  box-sizing: border-box;
  content: '';
  pointer-events: none;
  background-color: var(--mat-porcelain-ivory);
  background-image: var(--mat-frame-art);
  background-repeat: repeat;
  background-position: center;
  background-size: var(--mat-frame-art-size);
}

body:not(:has(.home-photo-hero)) .tabletop-shell > main::before {
  left: 0;
  border-right: var(--mat-rule-width) solid var(--mat-porcelain-blue);
}

body:not(:has(.home-photo-hero)) .tabletop-shell > main::after {
  right: 0;
  border-right: var(--mat-rule-width) solid var(--mat-porcelain-blue);
  transform: scaleX(-1);
  transform-origin: center;
}

body:not(:has(.home-photo-hero)) .tabletop-shell > main > * {
  position: relative;
  z-index: 1;
}

/* Homepage exception: the photo hero remains open/full-width. Its existing
   .home-framed-content wrapper continues to own the floral rails below it. */
body:has(.home-photo-hero) .tabletop-shell > main {
  width: 100% !important;
  padding-inline: 0 !important;
}

/* Mobile/tablet menu: a true compact dropdown tucked beneath the hamburger.
   It should read as navigation, not as another oversized decorative tile. */
@media (max-width: 980px) {
  .site-header.mat-header .site-nav,
  .site-header.mat-header[data-scrolled] .site-nav {
    top: calc(var(--site-header-height) + 5px) !important;
    right: 12px !important;
    left: auto !important;
    width: clamp(142px, 21vw, 185px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(23,75,143,.62) !important;
    border-radius: 8px !important;
    background: rgba(255,249,238,.985) !important;
    box-shadow: 0 8px 20px rgba(0,14,44,.18) !important;
    padding: .22rem .38rem .26rem !important;
  }

  .site-header.mat-header .site-nav::after,
  .site-header.mat-header[data-scrolled] .site-nav::after {
    display: none !important;
    content: none !important;
    background: none !important;
  }

  .site-header.mat-header .site-nav__group,
  .site-header.mat-header .site-nav__group--left,
  .site-header.mat-header .site-nav__group--right {
    grid-column: 1 !important;
    display: grid !important;
    width: 100% !important;
    justify-self: stretch !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .site-header.mat-header .site-nav li {
    width: 100% !important;
  }

  .site-header.mat-header .site-nav .rack-tile,
  .site-header.mat-header .site-nav .rack-tile:hover,
  .site-header.mat-header .site-nav .rack-tile[aria-current='page'] {
    display: flex !important;
    width: 100% !important;
    min-height: 35px !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(23,75,143,.09) !important;
    border-radius: 0 !important;
    outline: 0 !important;
    outline-offset: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #103a70 !important;
    font-size: .62rem !important;
    letter-spacing: .065em !important;
    padding: .45rem .1rem !important;
    text-align: right !important;
    transform: none !important;
  }

  .site-header.mat-header .site-nav__group--right li:last-child .rack-tile {
    border-bottom: 0 !important;
  }

  /* Keep focus from adding a second marker beside the active page. The coral
     dash below is the sole visible active/focus treatment in this compact menu. */
  .site-header.mat-header .site-nav .rack-tile:focus,
  .site-header.mat-header .site-nav .rack-tile:focus-visible {
    outline: 0 !important;
    box-shadow: none !important;
  }

  .site-header.mat-header .site-nav .rack-tile::before {
    right: .1rem !important;
    bottom: 5px !important;
    left: auto !important;
    width: 10px !important;
    height: 2px !important;
    border-radius: 999px !important;
    background: #ef8a78 !important;
  }

  .site-header.mat-header .site-nav .rack-tile[aria-current='page']::before {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 680px) {
  body:not(:has(.home-photo-hero)) .tabletop-shell > main {
    padding-inline: 18px !important;
  }

  body:not(:has(.home-photo-hero)) .tabletop-shell > main::before,
  body:not(:has(.home-photo-hero)) .tabletop-shell > main::after {
    width: 18px;
  }

  .site-header.mat-header .site-nav,
  .site-header.mat-header[data-scrolled] .site-nav {
    top: calc(var(--site-header-height) + 4px) !important;
    right: 9px !important;
    left: auto !important;
    width: 130px !important;
    max-width: calc(100vw - 18px) !important;
    border-radius: 7px !important;
    padding: .18rem .32rem .22rem !important;
  }

  .site-header.mat-header .site-nav .rack-tile,
  .site-header.mat-header .site-nav .rack-tile:hover,
  .site-header.mat-header .site-nav .rack-tile[aria-current='page'] {
    min-height: 34px !important;
    font-size: .58rem !important;
    letter-spacing: .052em !important;
    padding: .42rem .08rem !important;
  }
}
