/* F2 navigation corrections. Layered after e1.css, which F2 inherits from the D base.

Three defects, all from one root cause: More was a flex SIBLING of .tabsrow rather than part of the
strip, so it could never sit adjacent to the last tab or scroll with it.

1 — More was pushed to the far right on desktop.
   F2 gave .tabsrow `flex: 1 1 auto`, which fills the nav. More is a sibling flex item, so it is still
   pushed to the far edge: measured row width 1193px holding 585px of tabs at justify-content:flex-start,
   leaving ~1175px of dead space between Claims and More. Fix: pack tabs and More together at the start.

2 — More did not scroll with the tabs on a phone.
   With More outside the row, the tabs slid underneath it. One scroller now holds both.

3 — THE MORE MENU WAS CLIPPED AND OFF-SCREEN, and my first attempt caused it.
   Putting `overflow-x: auto` on nav.tabs made the nav a clip box. The dropdown is absolutely
   positioned and descends 210-232px below the 51px strip, so it was cut off at the nav's bottom edge
   and ran off the right edge on a phone (measured clippedByNav true and offscreen true at both 1280px
   and 390px). A nav-level scroller is the WRONG container.

Structure (see assemble_f2.py for why the menu is portalled out):

    nav.tabs                 position:sticky, NOT a scroll container
      .tabscroll             the ONLY overflow-x:auto — clips the strip only
        .wrap.tabsrow        role=tablist: primary tabs + visually hidden utility tabs
        .moremenu            the More disclosure button (its menu is portalled to nav.tabs)
      .morewrap#more-menu    role=menu, absolute against nav.tabs — never clipped

.moremenu stays OUTSIDE role="tablist" (a non-tab child there is an aria-required-children violation,
already hit once in this project) and carries no `tab` class (app.js sets aria-selected on every .tab,
which would make More claim a selected view).

min-width:0 stays load-bearing: without it a flex item refuses to shrink below content width, the strip
grows instead of scrolling, and the document scrolls sideways on a 390px phone.
*/

nav.tabs {
  display: block;
  /* sticky/top/z-index come from styles.css; re-asserted here because this rule replaces e1.css's
     `display:flex` and must not depend on cascade order for positioning. */
  position: sticky; top: 0; z-index: 20;
}

/* The one and only scroll container. It clips the strip and nothing else. */
.tabscroll {
  display: flex; align-items: stretch; gap: 0;
  padding-left: 18px; padding-right: 18px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch;
}
.tabscroll::-webkit-scrollbar { display: none; }

/* The strip is CENTRED in the viewport, per the owner's request (was left-aligned).

   How: .tabscroll is the only overflow-x:auto container, and a flex line inside it is centred with
   `justify-content: center`. Because the scroller never overflows on a wide screen, the free space
   is shared either side and the tabs land mid-viewport. On a narrow screen the content is WIDER than
   the scroller, so there is no free space to distribute and centring is inert: the strip starts at
   the left edge and scrolls, which is the behaviour we want and cannot be centred anyway.

   `margin: 0 auto` is NOT used: auto margins are absorbed differently inside a scroll container and
   were what previously pushed the first tab to x=291 on a 1280px screen. `max-width: none` keeps the
   strip from inheriting the page's 1240px container width, which would re-introduce the offset.
   More stays the LAST item of the same flex line, so it centres with the tabs and follows Claims. */
/* .tabline is the CENTRED unit. It must fill the scroller (flex: 1 1 auto) so that
   `justify-content: center` has free space to distribute; when it shrink-wraps there is no free
   space and the group pins to the left, which is exactly the defect this replaced.

   On a narrow screen the tabs are wider than the viewport, .tabline is clamped to the scroller by
   flex-shrink, and centring becomes inert because the line overflows: the strip starts at the left
   edge and scrolls. Both states fall out of the same rule.

   `width: 100%` is deliberately NOT used: it would fight the shrink behaviour on a phone. */
.tabscroll > .wrap.tabline {
  display: flex; align-items: stretch;
  justify-content: center;
  flex: 1 1 auto; min-width: 0;
  max-width: none; margin-left: 0; margin-right: 0;
  padding-bottom: 0;
  /* No horizontal padding here. The gutter belongs on the SCROLLER, outside the centred box: padding
     on a justify-content:center container is applied before centring, so it shifts the centred line
     by half its own width. Measured with 18px here: group centre 649 vs viewport centre 640, a 9px
     bias. Moving the same 18px to .tabscroll centres the group exactly, and on a phone the strip
     still gets a left inset so the first tab is not flush to the edge. */
  padding-left: 0; padding-right: 0;
}

/* The tablist itself must shrink-wrap: it is a flex item of .tabline and must be as wide as the
   tabs need, so that centring acts on the whole group. If it stretched, the free space would be
   swallowed by the row and More would be pushed back to the edge.

   padding/margin must be cleared here. .tabsrow still carries class="wrap", which brings
   `padding: 0 18px 60px` from styles.css. That padding now sits INSIDE the centred group, so it
   added 18px of empty space on the left of the tabs and none on the right, biasing the whole strip
   9px right of the viewport centre at every width (measured: group centre 649 vs 640 at 1280).
   Measured, not assumed -- an earlier attempt moved the padding between containers without
   identifying this one. */
.tabscroll > .wrap.tabline > .tabsrow {
  flex: 0 1 auto; min-width: 0;
  display: flex; align-items: stretch;
  padding: 0; margin: 0;
}

/* More is the last item in the strip: adjacent to Claims, and it travels off the right edge with the
   last tab on a narrow screen. */
.tabscroll > .wrap.tabline > .moremenu {
  flex: 0 0 auto; min-width: 0;
  display: flex; align-items: center;
  /* No trailing padding: it would bias the centred strip by half its width. The visual gap to the
     edge is not needed once the strip is centred, because on a wide screen neither end touches the
     viewport edge. */
  padding-right: 0;
}

/* A hairline gap so More is visually separated from the last tab rather than reading as a word in the
   list. Sits on the button, not the wrapper, so it never adds width to the strip. */
nav.tabs .moretab { margin-left: 8px; }

@media (max-width: 700px) {
  /* On a narrow screen the strip overflows and fills from the left; a trailing pad only reappears
     as scrollable tail, so it is left at 0 above. */
  .tabscroll > .wrap.tabline { padding-right: 0; }
}

/* The portalled dropdown. Positioned against nav.tabs, which is deliberately NOT a scroll container,
   so the menu descends past the strip without being cut off and can align to the viewport on a phone.

   Measured: with no clipper in the ancestor chain, the menu is fully rendered. The remaining defect
   was vertical, not clipping: at 1280x900 the menu's top sat at y=787 and its last item at y=991, so
   the bottom of the list fell below the fold. `top:100%` anchors it to the nav, which is sticky at the
   top of the viewport, so on a tall page opened near the top of the document there is nowhere to
   descend to. It is now flipped upward when there is not enough room below.
*/
nav.tabs > .morewrap {
  position: absolute; top: 100%; z-index: 40;
  min-width: 232px;
  /* Keep the menu inside the viewport horizontally on a phone. */
  max-width: calc(100vw - 24px);
}
nav.tabs > .morewrap[hidden] { display: none; }

/* Below the strip by default; e1_boot.js adds .f2-menu-up when the open menu would overflow the
   viewport bottom, which anchors its bottom edge to the top of the nav instead. */
nav.tabs > .morewrap.f2-menu-up {
  top: auto; bottom: 100%;
}
