/* =========================================================
   SMALL TOWN MAHJ — MAT RESTRAINT PASS
   One floral textile edge. One cobalt piping line. Solid cobalt field.
   Loaded last so this is the final visual authority for the mat/header.
   ========================================================= */

:root {
  --mat-edge-side: clamp(42px, 4.8vw, 64px);
  --mat-edge-top: clamp(54px, 5.6vw, 70px);
  --mat-edge-bottom: var(--mat-edge-side);
  --mat-edge: var(--mat-edge-side);
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  position: relative;
  margin: 0;
  padding: var(--mat-edge-top) var(--mat-edge-side) var(--mat-edge-bottom);
  background: #fff9ee;
}

body::before,
body::after {
  display: none !important;
}

/* ---------------------------------------------------------
   ONE OUTER FLORAL EDGE
   --------------------------------------------------------- */
.mat-edge-frame {
  position: fixed;
  z-index: 390;
  inset: 0;
  pointer-events: none;
}

.mat-edge {
  position: absolute;
  display: block;
  background-color: #fff9ee;
  filter: drop-shadow(0 2px 5px rgba(5,30,68,.1));
}

.mat-edge--top,
.mat-edge--bottom {
  right: 0;
  left: 0;
  background-image: url('/decor/mat-edge-horizontal.svg');
  background-repeat: repeat-x;
  background-position: center bottom;
  background-size: auto 100%;
}

.mat-edge--top {
  top: 0;
  height: calc(var(--mat-edge-top) + 4px);
}

.mat-edge--bottom {
  bottom: 0;
  height: calc(var(--mat-edge-bottom) + 4px);
  transform: scaleY(-1);
  transform-origin: center;
}

.mat-edge--left,
.mat-edge--right {
  top: 0;
  bottom: 0;
  width: calc(var(--mat-edge-side) + 4px);
  background-image: url('/decor/mat-edge-vertical.svg');
  background-repeat: repeat-y;
  background-position: right center;
  background-size: 100% auto;
}

.mat-edge--left { left: 0; }
.mat-edge--right {
  right: 0;
  transform: scaleX(-1);
  transform-origin: center;
}

/* ---------------------------------------------------------
   SOLID COBALT PLAYING FIELD
   --------------------------------------------------------- */
.tabletop-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0 !important;
  background: #083477 !important;
  background-image: none !important;
  box-shadow:
    0 10px 28px rgba(0,18,51,.18),
    inset 0 0 52px rgba(0,12,42,.14) !important;
}

.tabletop-shell::after {
  display: none !important;
}

.tabletop-shell::before {
  z-index: 0 !important;
  inset: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02) !important;
  opacity: 1 !important;
}

.mat-side-ornament { display: none !important; }

.tabletop-shell > *,
.tabletop-shell main,
.tabletop-shell section,
.tabletop-shell footer,
.tabletop-shell header {
  min-width: 0;
  max-width: 100%;
}

.tabletop-shell main {
  overflow-x: clip;
}

/* ---------------------------------------------------------
   HEADER — no second ornamental band
   --------------------------------------------------------- */
.site-header.mat-header {
  top: var(--mat-edge-top);
  height: 88px;
  overflow: visible;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.site-header.mat-header::before,
.site-header.mat-header::after {
  display: none !important;
  background: none !important;
  content: none !important;
}

.site-header.mat-header .site-header__inner {
  min-height: 88px;
}

/* The crest crosses the one floral edge / cobalt boundary. */
.mat-crest,
.site-header.mat-header[data-scrolled] .mat-crest {
  top: -50px;
  width: 148px;
  filter: none;
}

.mat-crest img {
  filter: drop-shadow(0 7px 6px rgba(1,23,62,.17)) drop-shadow(0 1px 1px rgba(255,255,255,.28));
}

/* Desktop navigation sits quietly in the floral edge, not on a second bar. */
.site-header.mat-header .site-nav,
.site-header.mat-header[data-scrolled] .site-nav {
  top: -34px;
}

.site-header.mat-header .site-nav .rack-tile {
  color: #123b70;
  text-shadow: 0 1px rgba(255,255,255,.55);
}

/* ---------------------------------------------------------
   LANDING SCALE / OVERFLOW PROTECTION
   --------------------------------------------------------- */
body:has(.landing-invite) .landing-moments,
body:has(.landing-invite) .landing-about,
body:has(.landing-invite) .landing-invite {
  background: transparent !important;
}

body:has(.landing-invite) .tabletop-hero {
  padding-top: 4.1rem;
}

body:has(.landing-invite) .tabletop-hero .hero-tile {
  width: min(680px, 68vw);
}

body:has(.landing-invite) .landing-about__panel,
body:has(.landing-invite) .landing-about__panel[data-place],
body:has(.landing-invite) .landing-about__panel[data-place][data-visible='true'] {
  width: min(100%, 960px) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-inline: auto !important;
  box-sizing: border-box;
  transform: none !important;
}

body:has(.landing-invite) .landing-about__copy,
body:has(.landing-invite) .landing-about__copy * {
  min-width: 0;
  overflow-wrap: break-word;
}

/* Footer remains a quiet signature after the CTA. */
body:has(.landing-invite) .site-footer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-block: 1.25rem;
}

body:has(.landing-invite) .site-footer__brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}

body:has(.landing-invite) .site-footer__brand img {
  width: 58px;
  height: 58px;
  margin: 0;
  border-width: 3px;
}

body:has(.landing-invite) .site-footer__brand p,
body:has(.landing-invite) .site-footer__invitation,
body:has(.landing-invite) .site-footer__bottom span:last-child {
  display: none;
}

body:has(.landing-invite) .site-footer__nav {
  justify-content: flex-end;
  gap: .55rem .9rem;
}

body:has(.landing-invite) .site-footer__bottom {
  justify-content: center;
  padding-block: .75rem .9rem;
  text-align: center;
}

/* ---------------------------------------------------------
   TABLET
   --------------------------------------------------------- */
@media (max-width: 980px) {
  :root {
    --mat-edge-side: 32px;
    --mat-edge-top: 48px;
    --mat-edge-bottom: 32px;
    --mat-edge: var(--mat-edge-side);
  }

  .site-header.mat-header {
    top: var(--mat-edge-top);
    height: 78px;
  }

  .site-header.mat-header .site-header__inner {
    min-height: 78px;
  }

  .mat-crest,
  .site-header.mat-header[data-scrolled] .mat-crest {
    top: -43px;
    width: 126px;
  }

  .site-header.mat-header .nav-toggle {
    top: -33px;
    right: 0;
  }

  .site-header.mat-header .site-nav,
  .site-header.mat-header[data-scrolled] .site-nav {
    top: 82px;
  }

  body:has(.landing-invite) .tabletop-hero {
    padding-top: 3.5rem;
  }

  body:has(.landing-invite) .tabletop-hero .hero-tile {
    width: min(610px, calc(100% - 30px));
  }
}

/* ---------------------------------------------------------
   MOBILE — 35–40% thinner side floral edge
   Previous side edge was ~38px; this is 24px.
   --------------------------------------------------------- */
@media (max-width: 680px) {
  :root {
    --mat-edge-side: 24px;
    --mat-edge-top: 42px;
    --mat-edge-bottom: 24px;
    --mat-edge: var(--mat-edge-side);
    --mat-header-block: 70px;
    --mat-crest-size: 106px;
    --shell: calc(100% - 18px);
  }

  body {
    padding: var(--mat-edge-top) var(--mat-edge-side) var(--mat-edge-bottom);
  }

  .mat-edge--top {
    height: 46px;
  }

  .mat-edge--bottom {
    height: 28px;
  }

  .mat-edge--left,
  .mat-edge--right {
    width: 28px;
  }

  .site-header.mat-header {
    top: var(--mat-edge-top);
    height: var(--mat-header-block);
  }

  .site-header.mat-header .site-header__inner,
  .tabletop-shell .shell {
    width: calc(100% - 18px) !important;
    max-width: calc(100% - 18px) !important;
    min-width: 0 !important;
    margin-inline: auto !important;
  }

  .site-header.mat-header .site-header__inner {
    min-height: var(--mat-header-block);
  }

  /* Logo is mounted into the floral edge instead of floating in the blue. */
  .mat-crest,
  .site-header.mat-header[data-scrolled] .mat-crest {
    top: -39px;
    width: var(--mat-crest-size);
  }

  /* Quiet three-line control placed inside the upper-right floral edge. */
  .site-header.mat-header .nav-toggle {
    top: -32px;
    right: 0;
    display: inline-grid;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    place-items: center;
    border: 1px solid rgba(23,75,143,.34);
    border-radius: 8px;
    background: rgba(255,249,238,.94);
    box-shadow: 0 2px 6px rgba(3,28,65,.12);
    padding: 0;
  }

  .site-header.mat-header .nav-toggle__face {
    display: grid;
    width: 24px;
    height: auto;
    grid-template-columns: 1fr;
    gap: 4px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    padding: 0;
  }

  .site-header.mat-header .nav-toggle__face i {
    width: 24px;
    height: 2px;
    background: #174b8f;
  }

  .site-header.mat-header .nav-toggle__face i:nth-child(4) {
    display: none;
  }

  .site-header.mat-header .nav-toggle__label {
    display: none;
  }

  .site-header.mat-header .site-nav,
  .site-header.mat-header[data-scrolled] .site-nav {
    top: 78px;
    right: 0;
    left: 0;
    max-width: 100%;
  }

  .tabletop-shell main,
  .tabletop-shell section,
  .tabletop-shell article,
  .tabletop-shell figure,
  .tabletop-shell footer {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:has(.landing-invite) .tabletop-hero {
    padding-top: 3rem;
    padding-bottom: 3.5rem;
  }

  body:has(.landing-invite) .tabletop-hero .hero-stage {
    width: calc(100% - 14px) !important;
    max-width: calc(100% - 14px) !important;
  }

  body:has(.landing-invite) .tabletop-hero .hero-tile {
    width: calc(100% - 32px) !important;
    max-width: 100%;
    padding: 2.35rem 1.2rem 1.9rem;
  }

  body:has(.landing-invite) .tabletop-hero .hero-tile h1 {
    font-size: clamp(3rem, 13.3vw, 4rem);
    line-height: .91;
  }

  body:has(.landing-invite) .hero-tile__intro {
    font-size: .96rem;
    line-height: 1.55;
  }

  body:has(.landing-invite) .landing-about__panel,
  body:has(.landing-invite) .landing-about__panel[data-place],
  body:has(.landing-invite) .landing-about__panel[data-place][data-visible='true'] {
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: .6rem;
    overflow: hidden;
    padding: 2.05rem 1.05rem 1.7rem;
    transform: none !important;
  }

  body:has(.landing-invite) .landing-about__copy h2 {
    font-size: clamp(2.7rem, 11vw, 3.55rem);
  }

  body:has(.landing-invite) .landing-about__copy > p:not(.eyebrow) {
    font-size: .95rem;
    line-height: 1.55;
  }

  body:has(.landing-invite) .landing-about__mark {
    display: none;
  }

  body:has(.landing-invite) .site-footer__top {
    flex-direction: column;
    justify-content: center;
    gap: .85rem;
    padding-block: 1.05rem .75rem;
  }

  body:has(.landing-invite) .site-footer__brand {
    justify-content: center;
  }

  body:has(.landing-invite) .site-footer__brand img {
    width: 50px;
    height: 50px;
  }

  body:has(.landing-invite) .site-footer__nav {
    justify-content: center;
    gap: .4rem .75rem;
    font-size: .76rem;
    text-align: center;
  }
}
