/*
 * Phase 29 — locked header/search polish.
 * Scope: hamburger glyph, desktop menu readability and search dialog only.
 */

/* 1) Neutralize the legacy span-generated hamburger so only the three intended bars render. */
body.sam-phase29-ui .sam-header-system .sam-menu-toggle{
  overflow:hidden;
  isolation:isolate;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle > span.sam-menu-toggle__icon{
  position:relative!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:center!important;
  width:22px!important;
  height:18px!important;
  min-width:22px!important;
  min-height:18px!important;
  gap:4px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  transform:none;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle > span.sam-menu-toggle__icon::before,
body.sam-phase29-ui .sam-header-system .sam-menu-toggle > span.sam-menu-toggle__icon::after{
  content:none!important;
  display:none!important;
  width:0!important;
  height:0!important;
  background:transparent!important;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle .sam-menu-toggle__icon > i{
  position:relative!important;
  inset:auto!important;
  display:block!important;
  flex:0 0 2px!important;
  width:22px!important;
  height:2px!important;
  min-height:2px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:999px!important;
  background:currentColor!important;
  box-shadow:none!important;
  font-style:normal!important;
  transform-origin:center!important;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle .sam-menu-toggle__icon > i:nth-child(2){
  width:16px!important;
  align-self:flex-end!important;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle[aria-expanded="true"] .sam-menu-toggle__icon > i:nth-child(1){
  transform:translateY(6px) rotate(45deg)!important;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle[aria-expanded="true"] .sam-menu-toggle__icon > i:nth-child(2){
  width:0!important;
  opacity:0!important;
}
body.sam-phase29-ui .sam-header-system .sam-menu-toggle[aria-expanded="true"] .sam-menu-toggle__icon > i:nth-child(3){
  transform:translateY(-6px) rotate(-45deg)!important;
}

/* 2) Increase desktop menu readability without changing the header structure. */
@media(min-width:1281px){
  body.sam-phase29-ui .sam-header-desktop-nav .sam-menu > li > a{
    padding-inline:clamp(7px,.68vw,11px)!important;
    font-size:clamp(.78rem,.81vw,.89rem)!important;
    font-weight:800!important;
    letter-spacing:.052em!important;
  }
}
@media(min-width:1025px) and (max-width:1280px){
  body.sam-phase29-ui .sam-header-desktop-nav .sam-menu > li > a{
    padding-inline:5px!important;
    font-size:.75rem!important;
    font-weight:800!important;
    letter-spacing:.048em!important;
  }
}

/* 3) Search overlay: one fixed viewport, no page-level horizontal/vertical scrollbars. */
html:has(body.sam-phase29-ui.sam-ui-locked){
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
body.sam-phase29-ui.sam-ui-locked{
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
body.sam-phase29-ui .sam-search-overlay{
  position:fixed!important;
  inset:0!important;
  width:auto!important;
  max-width:none!important;
  height:100dvh!important;
  min-height:100dvh!important;
  max-height:100dvh!important;
  box-sizing:border-box!important;
  align-items:center!important;
  justify-content:center!important;
  padding:clamp(20px,3.2vw,46px)!important;
  overflow:hidden!important;
  overscroll-behavior:none!important;
  background:
    radial-gradient(circle at 12% 12%,rgba(255,177,22,.13),transparent 29%),
    radial-gradient(circle at 91% 88%,rgba(79,112,255,.1),transparent 31%),
    rgba(5,6,10,.965)!important;
}
body.sam-phase29-ui .sam-search-overlay::before,
body.sam-phase29-ui .sam-search-overlay::after{
  opacity:.6;
}
body.sam-phase29-ui .sam-search-dialog{
  position:relative!important;
  width:min(1040px,calc(100vw - 72px))!important;
  max-width:100%!important;
  max-height:calc(100dvh - 72px)!important;
  min-width:0!important;
  display:grid!important;
  grid-template-columns:minmax(0,1.42fr) minmax(280px,.66fr)!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  border-radius:26px!important;
  border-color:rgba(255,255,255,.11)!important;
  background:linear-gradient(145deg,rgba(16,18,27,.99),rgba(8,9,14,.995))!important;
  box-shadow:0 36px 110px rgba(0,0,0,.55),inset 0 1px 0 rgba(255,255,255,.055)!important;
}
body.sam-phase29-ui .sam-search-main,
body.sam-phase29-ui .sam-search-routes{
  min-width:0!important;
  box-sizing:border-box!important;
}
body.sam-phase29-ui .sam-search-main{
  padding:clamp(32px,4vw,52px)!important;
  overflow:hidden!important;
}
body.sam-phase29-ui .sam-search-eyebrow{
  margin-bottom:15px!important;
  font-size:.64rem!important;
  letter-spacing:.14em!important;
}
body.sam-phase29-ui .sam-search-main > p{
  margin-bottom:10px!important;
}
body.sam-phase29-ui .sam-search-main h2{
  max-width:650px!important;
  font-size:clamp(2.65rem,4.25vw,4.35rem)!important;
  line-height:.93!important;
  text-wrap:balance;
}
body.sam-phase29-ui .sam-search-note{
  max-width:620px!important;
  margin:17px 0 23px!important;
  color:rgba(255,255,255,.6)!important;
  font-size:.9rem!important;
  line-height:1.65!important;
}
body.sam-phase29-ui .sam-search-form,
body.sam-phase29-ui .sam-search-form__field{
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}
body.sam-phase29-ui .sam-search-form__field{
  display:grid!important;
  grid-template-columns:44px minmax(0,1fr) auto!important;
  gap:10px!important;
  padding:8px!important;
  border:1px solid rgba(255,255,255,.13)!important;
  border-radius:18px!important;
  background:rgba(255,255,255,.045)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 20px 48px rgba(0,0,0,.22)!important;
}
body.sam-phase29-ui .sam-search-form__icon{
  width:44px!important;
  height:44px!important;
  border-radius:12px!important;
}
body.sam-phase29-ui .sam-search-main input[type="search"]{
  appearance:none!important;
  -webkit-appearance:none!important;
  width:100%!important;
  min-width:0!important;
  min-height:44px!important;
  margin:0!important;
  padding:0 3px!important;
  border:0!important;
  border-radius:0!important;
  outline:0!important;
  background:transparent!important;
  color:#fff!important;
  caret-color:#ffb116!important;
  box-shadow:none!important;
  font-size:clamp(.98rem,1.45vw,1.22rem)!important;
  font-weight:600!important;
  line-height:1.3!important;
}
body.sam-phase29-ui .sam-search-main input[type="search"]::placeholder{
  color:rgba(255,255,255,.42)!important;
  opacity:1!important;
}
body.sam-phase29-ui .sam-search-main input[type="search"]::-webkit-search-decoration,
body.sam-phase29-ui .sam-search-main input[type="search"]::-webkit-search-cancel-button,
body.sam-phase29-ui .sam-search-main input[type="search"]::-webkit-search-results-button,
body.sam-phase29-ui .sam-search-main input[type="search"]::-webkit-search-results-decoration{
  -webkit-appearance:none!important;
}
body.sam-phase29-ui .sam-search-main input[type="search"]:-webkit-autofill,
body.sam-phase29-ui .sam-search-main input[type="search"]:-webkit-autofill:hover,
body.sam-phase29-ui .sam-search-main input[type="search"]:-webkit-autofill:focus{
  -webkit-text-fill-color:#fff!important;
  -webkit-box-shadow:0 0 0 1000px #12141b inset!important;
  transition:background-color 9999s ease-out 0s!important;
}
body.sam-phase29-ui .sam-search-main .search-submit{
  min-width:104px!important;
  min-height:44px!important;
  padding:0 19px!important;
  border:0!important;
  border-radius:12px!important;
  background:#ffb116!important;
  color:#111318!important;
  box-shadow:0 9px 22px rgba(255,177,22,.16)!important;
  font-size:.86rem!important;
}
body.sam-phase29-ui .sam-search-main .search-submit:hover,
body.sam-phase29-ui .sam-search-main .search-submit:focus-visible{
  background:#ffc342!important;
  outline:3px solid rgba(255,177,22,.22)!important;
  outline-offset:2px!important;
}
body.sam-phase29-ui .sam-search-shortcuts{
  margin-top:16px!important;
  gap:7px!important;
}
body.sam-phase29-ui .sam-search-shortcuts a{
  padding:6px 9px!important;
  font-size:.71rem!important;
}
body.sam-phase29-ui .sam-search-routes{
  justify-content:center!important;
  padding:clamp(28px,3vw,42px) clamp(22px,2.5vw,32px)!important;
  overflow:hidden!important;
}
body.sam-phase29-ui .sam-search-routes__label{
  margin-bottom:12px!important;
}
body.sam-phase29-ui .sam-search-routes > a{
  grid-template-columns:30px minmax(0,1fr) 17px!important;
  gap:11px!important;
  padding:15px 0!important;
}
body.sam-phase29-ui .sam-search-routes > a b{
  font-size:.88rem!important;
}
body.sam-phase29-ui .sam-search-routes > a small{
  font-size:.68rem!important;
}
body.sam-phase29-ui .sam-search-close{
  top:18px!important;
  right:18px!important;
  width:52px!important;
  height:52px!important;
  border-radius:15px!important;
  background:rgba(17,19,27,.82)!important;
}

/* Compact desktop fallback for short laptop viewports. */
@media(min-width:901px) and (max-height:760px){
  body.sam-phase29-ui .sam-search-overlay{padding:20px 56px!important}
  body.sam-phase29-ui .sam-search-dialog{max-height:calc(100dvh - 40px)!important}
  body.sam-phase29-ui .sam-search-main{padding:29px 38px!important}
  body.sam-phase29-ui .sam-search-main h2{font-size:clamp(2.35rem,3.8vw,3.75rem)!important}
  body.sam-phase29-ui .sam-search-note{margin:13px 0 17px!important;font-size:.82rem!important}
  body.sam-phase29-ui .sam-search-eyebrow{margin-bottom:11px!important}
  body.sam-phase29-ui .sam-search-shortcuts{margin-top:12px!important}
  body.sam-phase29-ui .sam-search-routes{padding:25px 28px!important}
  body.sam-phase29-ui .sam-search-routes > a{padding:12px 0!important}
}

/* Tablet/mobile: keep the viewport locked and use one controlled internal vertical flow only. */
@media(max-width:900px){
  body.sam-phase29-ui .sam-search-overlay{
    align-items:flex-start!important;
    padding:72px 12px 14px!important;
  }
  body.sam-phase29-ui .sam-search-dialog{
    width:100%!important;
    max-height:calc(100dvh - 86px)!important;
    grid-template-columns:1fr!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    border-radius:20px!important;
    scrollbar-width:thin;
    scrollbar-color:rgba(255,177,22,.55) transparent;
  }
  body.sam-phase29-ui .sam-search-main{
    padding:27px 20px!important;
    overflow:visible!important;
  }
  body.sam-phase29-ui .sam-search-main h2{
    font-size:clamp(2.25rem,10.5vw,3.35rem)!important;
  }
  body.sam-phase29-ui .sam-search-form__field{
    grid-template-columns:minmax(0,1fr)!important;
    padding:10px!important;
  }
  body.sam-phase29-ui .sam-search-form__icon{display:none!important}
  body.sam-phase29-ui .sam-search-main input[type="search"]{
    min-height:46px!important;
    padding:0 7px!important;
  }
  body.sam-phase29-ui .sam-search-main .search-submit{
    width:100%!important;
  }
  body.sam-phase29-ui .sam-search-routes{
    padding:24px 20px 27px!important;
    overflow:visible!important;
  }
  body.sam-phase29-ui .sam-search-close{
    top:11px!important;
    right:11px!important;
    width:48px!important;
    height:48px!important;
    border-radius:13px!important;
  }
}

@media(max-width:480px){
  body.sam-phase29-ui .sam-search-shortcuts > span{width:100%;margin-bottom:2px}
  body.sam-phase29-ui .sam-search-shortcuts a{font-size:.68rem!important}
}

@media(prefers-reduced-motion:reduce){
  body.sam-phase29-ui .sam-header-system .sam-menu-toggle .sam-menu-toggle__icon > i{
    transition:none!important;
  }
}
