/* LEARN-NAV-DROPDOWN-1: the Learn drop-down in the site header.
 *
 * John, 2026-11-07: "I was thinking drop down" — a drop-down under the Learn tab.
 *
 * DESKTOP (> 760px): the Learn link stays a link; the chevron next to it opens a panel.
 * MOBILE (<= 760px): the chevron sits at the right of the Learn row in the hamburger sheet and
 * expands the same list inline.
 *
 * Only the site's own tokens and fonts are used (--night, --night-2, --on-night, --on-night-2,
 * --accent-bright, --card, --ink, --ink-2, --line, --radius-sm, --s1..--s5, --fs-*). No external
 * font, no CDN.
 */

/* ------------------------------------------------------------------ the chevron button */
/* The chevron button.
   The negative margin is NOT used: at the narrow desktop widths the nav's own rule gives the
   links only 3px of side padding, so a negative margin would push the chevron INTO the link's
   box and the two would overlap (tests/browser/web_button_spec.mjs checks that they do not). The
   wrapper's gap brings the chevron close to the word instead. */
.site-nav__learn-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--on-night-2);
  cursor: pointer;
}
.site-nav__learn-toggle:hover, .site-nav__learn-toggle:focus-visible { color: var(--on-night); background: var(--night-2); }
.site-nav__learn-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring-dark); }
.site-nav__learn-chevron { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.site-nav__learn-toggle.is-open .site-nav__learn-chevron { transform: rotate(180deg); }
.site-nav__learn-chevron { transition: transform .12s ease; }
/* The wrapper holds the Learn link, the desktop chevron and its panel, and the mobile chevron and
   its list. It is the panel's positioning context. */
.site-nav__learn { position: relative; display: inline-flex; align-items: center; gap: 0; flex: none; }
/* The chevron only exists on the desktop nav; the mobile one is built by the sheet. */
@media (max-width: 760px) { .site-nav__learn > [data-learn-nav-toggle='desktop'] { display: none; } }
/* The sheet's chevron only exists in the sheet, which is the mobile layout. */
.site-nav__learn > [data-learn-nav-toggle='mobile'] { display: none; }

/* ------------------------------------------------------------------ the desktop panel */
.learn-nav-panel {
  position: absolute; top: 100%; right: 0; z-index: 40;
  width: min(320px, calc(100vw - 2 * var(--s4)));
  margin-top: var(--s1);
  padding: var(--s2);
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.learn-nav-panel[hidden] { display: none; }
/* The panel belongs to the desktop nav; at the mobile breakpoint the chevron lives in the sheet. */
@media (max-width: 760px) { .learn-nav-panel { display: none; } }
.learn-nav-panel__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
/* The panel is a LIGHT card, but the links sit inside the (dark) site nav, and ".site-nav a" sets a
   light colour for the nav's own rows. These rules are scoped to the panel and are specific enough
   to win, so the rows are dark ink on the light card (15.9:1) and not light grey on cream. */
.site-nav .learn-nav-item__link {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; min-height: 44px; justify-content: center;
  background: transparent; box-shadow: none;
}
.site-nav .learn-nav-item__link:hover, .site-nav .learn-nav-item__link:focus-visible { background: var(--accent-wash); color: var(--ink); box-shadow: none; }
.site-nav .learn-nav-item__link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.site-nav .learn-nav-item__label { font: 600 var(--fs-sm)/1.35 var(--font-body); }
.site-nav .learn-nav-item__live { color: var(--accent); font: 700 var(--fs-xs)/1.4 var(--font-body); }
/* LEARN-MENU-1: the dark nav rule ".site-nav a" (white-space: nowrap; flex: none) also reached these rows, so a long live line could not wrap and the row grew past the card. Rows now wrap inside the card. */
.learn-nav-panel__list { grid-template-columns: minmax(0, 1fr); }
.learn-nav-item { min-width: 0; }
.site-nav .learn-nav-item__link { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.site-nav .learn-nav-item__label, .site-nav .learn-nav-item__live { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
/* The featured row (Bills to watch) is bigger, like the landing page's featured tile. */
.learn-nav-item--featured { margin-bottom: var(--s1); }
.site-nav .learn-nav-item--featured .learn-nav-item__link { border-left: 4px solid var(--accent-bright); padding: var(--s3) var(--s3) var(--s3) calc(var(--s3) - 4px); }
.site-nav .learn-nav-item--featured .learn-nav-item__label { font: 600 var(--fs-md)/1.3 var(--font-display); }
.site-nav .learn-nav-item--featured .learn-nav-item__live { font-size: var(--fs-sm); }

/* HEADER-STICKY-REGRESSION-1: the panel hangs off the Learn nav item, which is its own
 * positioning context (".site-nav__learn { position: relative; }" above), so the header does NOT
 * need "position: relative" for the panel to be placed correctly.
 * This rule used to set "position: relative", which silently overrode the site header's
 * "position: sticky; top: 0" (web/css/trace.css) and stopped the header sticking at EVERY
 * width, while every sticky offset below it (the Community Vibe pill, the level chips, the
 * person tabs) still assumed a stuck header. That left the pill and the chips floating with a
 * band of half-cut card content showing in the gap above them.
 * "position: sticky" is itself a positioning context, so stating it here keeps the intent
 * explicit and survives a later stylesheet re-ordering. */
.site-header { position: sticky; top: 0; }
.site-header__inner { position: relative; }

/* ------------------------------------------------------------------ the mobile expander */
/* The Learn row, its chevron and the expanded list share the ONE wrapper, so the link and the
   chevron sit on ONE row of the sheet's column layout (the sheet is a flex column). */
@media (max-width: 760px) {
  .site-nav.is-open .site-nav__learn {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  }
  .site-nav.is-open .site-nav__learn > a[data-nav="learn"] { flex: 1 1 auto; min-width: 0; }
  /* The MOBILE chevron only. The desktop one is hidden at this width (see the rule above), and
     this rule must not switch it back on: it is scoped to the mobile button. */
  .site-nav.is-open .site-nav__learn > [data-learn-nav-toggle='mobile'] {
    display: inline-flex; width: 44px; height: 44px; flex: none; margin-left: 0;
    color: var(--on-night-2); border-radius: 12px;
  }
  .site-nav.is-open .site-nav__learn > [data-learn-nav-toggle='mobile']:hover,
  .site-nav.is-open .site-nav__learn > [data-learn-nav-toggle='mobile']:focus-visible { background: var(--night-2); color: var(--on-night); }
  /* The list expands INLINE inside the sheet: no nested scroll container, the sheet scrolls. */
  .site-nav__learn-list { list-style: none; margin: 0; padding: 0 0 0 var(--s3); width: 100%; flex: 1 0 100%; }
  .site-nav__learn-list[hidden] { display: none; }
  .site-nav__learn-item { display: block; }
  /* The sheet is DARK, so these rows are light text on the dark sheet. The rules are scoped to the
     sheet so they win against the panel's light-card rules above. */
  .site-nav.is-open .site-nav__learn-item .learn-nav-item__link {
    min-height: 48px; justify-content: center; color: var(--on-night); font-size: 1rem;
    border-left: 1px solid rgba(255, 255, 255, .18); border-radius: 0; background: transparent;
  }
  .site-nav.is-open .site-nav__learn-item .learn-nav-item__link:hover,
  .site-nav.is-open .site-nav__learn-item .learn-nav-item__link:focus-visible { background: var(--night-2); color: var(--on-night); }
  .site-nav.is-open .site-nav__learn-item .learn-nav-item__label { font: 500 1rem/1.4 var(--font-body); }
  .site-nav.is-open .site-nav__learn-item--featured .learn-nav-item__label { font: 600 1.05rem/1.35 var(--font-display); }
  .site-nav.is-open .site-nav__learn-item--featured .learn-nav-item__live { color: var(--accent-bright); }
}
