/* The Weight Loss Atlas: site search button, overlay, and header fit. */

/* Header fit. The full menu plus the search and theme buttons needs about 1,400 px, so the
   header row may be wider than the page column, and the compact menu now starts below 1,440 px
   (it used to start below 1,200 px, and the theme button was already being squeezed above that). */
.site-header .wrap { max-width: 1400px; }
@media (min-width: 1200px) and (max-width: 1439px) {
  .menu-btn { display: inline-flex; }
  .nav { display: none; position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + var(--header-h)); bottom: 0; flex-direction: column; align-items: stretch; gap: .2rem; overflow-y: auto; background: var(--bg); border-top: 1px solid var(--line); padding: .8rem max(16px, env(safe-area-inset-left, 0px)) 2rem; }
  .nav.open { display: flex; }
  body.menu-open { overflow: hidden; }
  .nav-link { padding: .9rem .6rem; font-size: 1.08rem; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none !important; }
  .nav-group { border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
  .nav-trigger { display: block; width: 100%; text-align: left; padding: .9rem .6rem .3rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); pointer-events: none; box-shadow: none !important; }
  .nav-trigger::after { display: none; }
  .nav-menu, .nav-group:hover .nav-menu { display: grid; position: static; min-width: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
  .nav-menu::before { display: none; }
  .nav-menu a { padding: .65rem .6rem; }
  .nav-cta { margin: .8rem 0 0; text-align: center; padding: .85rem 1rem; font-size: 1.05rem; }
}
/* Small phones: keep the name, search, theme and menu buttons on one row. */
@media (max-width: 440px) {
  .site-header .wrap { gap: .35rem; }
  .site-header .brand span { font-size: .9rem; }
  .site-header .icon-btn { width: 2.125rem; height: 2.125rem; }
}

/* Search overlay */
#site-search { position: fixed; inset: 0; z-index: 2000; display: none; background: rgba(15, 27, 45, .5); padding: 8vh 1rem 1rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#site-search.is-open { display: block; }
#site-search .ss-panel { max-width: 660px; margin: 0 auto; background: var(--surface, #fff); color: var(--ink, #0f1b2d); border: 1px solid var(--line, #d6e0ec); border-radius: 14px; box-shadow: 0 18px 50px rgba(15, 27, 45, .28); overflow: hidden; }
#site-search .ss-bar { display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem; border-bottom: 1px solid var(--line, #d6e0ec); }
#site-search .ss-bar svg { flex: none; color: var(--muted, #506178); }
#site-search input { flex: 1; min-width: 0; border: 0; outline: 0; box-shadow: none; background: transparent; color: inherit; font: inherit; font-size: 1.05rem; padding: .35rem 0; }
#site-search input::placeholder { color: var(--muted, #506178); }
#site-search .ss-close { flex: none; border: 1px solid var(--line, #d6e0ec); background: transparent; color: var(--muted, #506178); border-radius: 8px; font: inherit; font-size: .8rem; padding: .25rem .55rem; cursor: pointer; }
#site-search .ss-close:hover { background: var(--surface-2, #edf3fa); }
#site-search .ss-body { max-height: min(62vh, 520px); overflow-y: auto; padding: .4rem; }
#site-search .ss-label { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #506178); padding: .5rem .6rem .25rem; }
#site-search .ss-list { list-style: none; margin: 0; padding: 0; }
#site-search .ss-item a { display: block; padding: .6rem .7rem; border-radius: 10px; text-decoration: none; color: inherit; }
#site-search .ss-item a:hover, #site-search .ss-item a.is-active { background: var(--surface-2, #edf3fa); }
#site-search .ss-item a:focus-visible { outline: 2px solid var(--focus, #c98a0a); outline-offset: -2px; }
#site-search .ss-top { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
#site-search .ss-title { font-weight: 600; color: var(--teal-ink, #133b78); }
#site-search .ss-tag { font-size: .72rem; color: var(--muted, #506178); border: 1px solid var(--line, #d6e0ec); border-radius: 999px; padding: .05rem .5rem; white-space: nowrap; }
#site-search .ss-snip { display: block; margin-top: .15rem; font-size: .9rem; line-height: 1.4; color: var(--muted, #506178); }
#site-search mark { background: var(--saffron-wash, #fcefd2); color: inherit; border-radius: 3px; padding: 0 .1em; }
#site-search .ss-empty { padding: 1rem .8rem; color: var(--muted, #506178); }
#site-search .ss-empty a { color: var(--teal, #1b4f9c); }
#site-search .ss-foot { border-top: 1px solid var(--line, #d6e0ec); padding: .5rem .9rem; font-size: .78rem; color: var(--muted, #506178); }
@media (max-width: 640px) {
  #site-search { padding: .6rem; }
  #site-search .ss-body { max-height: 70vh; }
  #site-search .ss-foot { display: none; }
}
body.ss-lock { overflow: hidden; }
@media print { #site-search, #site-search-btn { display: none !important; } }
