/* Phone menu: on narrow screens the main navigation folds behind a three-line
   (hamburger) button and slides in from the right. site.js opens and closes it.
   On wider screens nothing here applies and the menu shows as before.
   Loaded after each page's own styles, so these rules win on phones. */

.menu-btn,.nav-mark{display:none}

@media(max-width:700px){
  html{scroll-padding-top:84px}
  /* The closed panel waits just past the right edge of the screen. Safari on
     iPhone can count that as page width and let the whole page drift sideways
     (off-center photos, words cut off at the edges), so nothing may stick out
     to the side. "clip", unlike "hidden", keeps the sticky header working. */
  html{overflow-x:hidden;overflow-x:clip}
  body{overflow-x:clip}
  /* one compact row that stays at the top while scrolling: logo left, button right */
  header{position:sticky;top:0;z-index:30}
  .hrow{flex-direction:row;justify-content:space-between;align-items:center;gap:12px;padding:12px 20px}
  .wmImg{height:26px;max-width:100%;object-fit:contain;object-position:left center}
  .hrow > a:first-child{min-width:0}

  .menu-btn{display:block;flex:none;position:relative;z-index:62;width:44px;height:44px;margin-right:-10px;padding:0;
    border:0;border-radius:4px;background:none;color:var(--navy);cursor:pointer;-webkit-tap-highlight-color:transparent}
  .menu-btn:focus-visible{outline:2px solid var(--red);outline-offset:2px}
  .menu-btn span{position:absolute;left:10px;width:24px;height:2px;border-radius:1px;background:currentColor;
    transition:transform .25s ease,opacity .2s ease}
  .menu-btn span:nth-child(1){top:14px}
  .menu-btn span:nth-child(2){top:21px}
  .menu-btn span:nth-child(3){top:28px}
  /* open: the three lines turn into an X */
  .menu-btn[aria-expanded="true"] span:nth-child(1){transform:translateY(7px) rotate(45deg)}
  .menu-btn[aria-expanded="true"] span:nth-child(2){opacity:0}
  .menu-btn[aria-expanded="true"] span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

  /* the panel */
  nav#site-nav{position:fixed;top:0;right:0;bottom:0;z-index:61;width:min(82vw,320px);overflow-y:auto;
    display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;justify-content:flex-start;gap:0;
    padding:84px 28px 32px;background:#fff;box-shadow:-12px 0 32px rgba(31,45,61,.18);
    transform:translateX(100%);visibility:hidden;pointer-events:none;transition:transform .28s ease,visibility 0s linear .28s}
  nav#site-nav.is-away{display:none}
  .nav-open nav#site-nav{transform:none;visibility:visible;pointer-events:auto;transition:transform .28s ease}
  /* the navy sailboat mark at the top of the open panel, across from the X; it links home */
  nav#site-nav a.nav-mark{display:block;position:absolute;top:8px;left:22px;padding:6px;border:0;border-radius:4px;line-height:0}
  nav#site-nav a.nav-mark img{display:block;height:42px;width:auto}
  nav#site-nav a.nav-mark:focus-visible{outline:2px solid var(--red);outline-offset:0}
  nav#site-nav a{display:block;padding:16px 0;font-size:20px;font-weight:500;color:var(--navy);
    border-bottom:1px solid var(--line)}
  nav#site-nav a:hover{color:var(--red);border-bottom-color:var(--line)}
  nav#site-nav a[aria-current]{color:var(--red);font-weight:600;border-bottom-color:var(--line)}

  /* dims the page behind the open panel; a tap on it closes the menu */
  .nav-backdrop{position:fixed;inset:0;z-index:60;background:rgba(31,45,61,.45);opacity:0;visibility:hidden;
    transition:opacity .28s ease,visibility 0s linear .28s}
  .nav-open .nav-backdrop{opacity:1;visibility:visible;transition:opacity .28s ease}
  html.nav-open,html.nav-open body{overflow:hidden}
}

@media(max-width:700px) and (prefers-reduced-motion:reduce){
  nav#site-nav,.nav-backdrop,.menu-btn span{transition:none}
}
