/* The S3 "Section header" site shell. Markup: src/site-shell.ts (server-rendered); behaviour: site-shell.js.
   Adapted from the approved mockup (docs/design-references/results-designs-r3-2026-11-19/shells/s3-section/shell.css)
   to production tokens (--max 1200px, --gutter, breakpoints 1100 and 760 px) and to both themes:
   - accent emphasis (current text, the 3 px current bar, hover, focus ring) uses --accent-text: yellow on Ink,
     terracotta on Paper; filled yellow controls elsewhere stay yellow;
   - the mockup's dark-only rgba (scrim, fades, popover shadow) has a Paper value or fades to transparent;
   - the mockup's concept-label offsets (translateY(11px), is-low, desktop padding-top 12px) are not ported.
   Two "current" idioms only: a current primary item has accent text; a current section item has a 3 px accent bar.
   Stacking: bar 45 (above in-page layers such as .course-ad-overlay at 40), toasts 35, scrim 50, drawer 51.
   --shell-h (52 px, 72 px from 1100 px) is defined in site.css so page rules can offset sticky items by it. */

[data-site-shell][hidden], [data-site-shell] [hidden] { display: none !important; }
[data-site-shell] a { color: inherit; }
[data-site-shell] :focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
.shell-ico { display: block; width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: square; stroke-linejoin: miter; }

/* In-page anchors, scrollIntoView and keyboard focus land below the sticky row with 8 px of air. A margin on content,
   not html { scroll-padding-top }: with scroll padding the sticky row sat inside the padded zone, so focusing its
   controls (or closing a menu) scrolled the page (S3 fourth pass). Shell controls carry no margin. */
main *, .shell-foot * { scroll-margin-top: calc(var(--shell-h) + 8px); }

/* ---------- row 1: the only sticky part ---------- */
.shell-bar { position: sticky; top: 0; z-index: 45; height: var(--shell-h); background: var(--canvas); border-bottom: 1px solid var(--line); }
.shell-bar-in { display: flex; align-items: center; height: 100%; gap: 4px; }
.shell-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; padding: 0; border: 0; background: transparent; color: var(--foreground); cursor: pointer; text-decoration: none; }
.shell-btn:hover { color: var(--accent-text); }
.shell-btn .shell-ico { width: 22px; height: 22px; }
.shell-menu { margin-left: -10px; }
.shell-mark, .shell-dr-mark { flex: none; padding: 4px 2px; }
.shell-mark { display: block; }
/* No display here: .theme-logo-dark/-light choose which wordmark shows. Both reserve the same box before load. */
.shell-mark img, .shell-dr-mark img { width: auto; height: 22px; max-width: none; aspect-ratio: 2125 / 800; }
/* The current section's name (below 1100 px), in the house navigation style. */
.shell-ctx { display: inline-flex; align-items: center; height: 44px; margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--line-strong);
  font: 400 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--foreground); text-decoration: none; white-space: nowrap; }
/* With a section row the name repeats RESULTS, so it shows only once row 2 has scrolled behind the bar. A CSS scroll
   timeline does this without script: at the top of the page (the first frame) it is always hidden. Browsers without
   scroll timelines keep it hidden; row 2 carries the name at the top of the page. */
.shell-ctx[data-shell-ctx="scroll"] { opacity: 0; visibility: hidden; }
@supports (animation-timeline: scroll()) {
  .shell-ctx[data-shell-ctx="scroll"] { animation: shell-ctx-in linear both; animation-timeline: scroll(root block); animation-range: 20px 40px; }
}
@keyframes shell-ctx-in { from { opacity: 0; visibility: hidden; transform: translateY(4px); } to { opacity: 1; visibility: visible; transform: none; } }
.shell-nav { display: none; }
.shell-tools { display: flex; align-items: center; align-self: stretch; gap: 4px; margin-left: auto; }
.shell-search { margin-right: -10px; }
.shell-acct { display: none; position: relative; }
.shell-acct-menu > summary { list-style: none; }
.shell-acct-menu > summary::-webkit-details-marker { display: none; }

/* ---------- row 2: the section row (Results), in flow ---------- */
.shell-sec { height: 40px; background: var(--panel); border-bottom: 1px solid var(--line); overflow: hidden; }
.shell-sec-in { display: flex; align-items: stretch; height: 100%; }
.shell-sec-name, .shell-tabs a { font: 400 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.shell-sec-name { display: flex; align-items: center; flex: none; padding-right: 12px; border-right: 1px solid var(--line); color: var(--foreground); }
.shell-tabs { position: relative; flex: 1; min-width: 0; margin-right: calc(-1 * var(--gutter)); }
.shell-tabs-sc { display: flex; height: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 0 calc(var(--gutter) + 12px) 0 2px; overscroll-behavior-x: contain; }
.shell-tabs-sc::-webkit-scrollbar { display: none; }
.shell-tabs a { display: flex; align-items: center; flex: none; padding: 0 10px; color: var(--muted-strong); }
.shell-tabs a:hover, .shell-sec-name:hover { color: var(--foreground); }
.shell-tabs a[aria-current], .shell-sec-name[aria-current] { color: var(--foreground); box-shadow: inset 0 -3px 0 var(--accent-text); }
/* Overflow fade for screens narrower than 390 px (site-shell.js sets is-more / is-less); at 390 and up the row fits. */
.shell-tabs::before, .shell-tabs::after { content: ""; position: absolute; top: 0; bottom: 0; width: 56px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.shell-tabs::before { left: 0; width: 12px; background: linear-gradient(90deg, var(--panel), transparent); }
.shell-tabs::after { right: 0; background: linear-gradient(270deg, var(--panel) 25%, transparent); }
.shell-tabs.is-more::after, .shell-tabs.is-less::before { opacity: 1; }

/* ---------- drawer (mobile): left, about 80% wide, over a scrim ---------- */
body.shell-lock { overflow: hidden; }
.shell-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(4, 5, 6, .72); animation: shell-fade .16s ease-out; }
:root[data-theme="light"] .shell-scrim { background: rgba(9, 11, 12, .38); }
.shell-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 51; display: flex; flex-direction: column; width: 80%; max-width: 360px;
  overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border-right: 1px solid var(--line-strong); animation: shell-in .16s ease-out; }
@keyframes shell-in { from { transform: translateX(-28px); opacity: .5; } }
@keyframes shell-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .shell-drawer, .shell-scrim { animation: none; }
  @keyframes shell-ctx-in { from { opacity: 0; visibility: hidden; } to { opacity: 1; visibility: visible; } }
}
/* The close button and wordmark sit exactly where the menu button and wordmark they cover sit. */
.shell-dr-top { display: flex; align-items: center; gap: 4px; flex: none; height: 52px; padding: 0 16px 0 calc(var(--gutter) - 10px); border-bottom: 1px solid var(--line); }
.shell-dr-nav { padding: 8px 0; }
.shell-dr-nav a, .shell-dr-acct a, .shell-dr-acct button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 20px; border: 0; background: transparent;
  text-align: left; text-decoration: none; cursor: pointer; font: 400 13px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--foreground); }
.shell-dr-nav a:hover, .shell-dr-acct a:hover, .shell-dr-acct button:hover, .shell-pop a:hover, .shell-pop button:hover { background: color-mix(in srgb, var(--foreground) 6%, transparent); }
/* current primary item: accent text, as in the desktop nav */
.shell-dr-nav > a[aria-current] { color: var(--accent-text); }
/* One idiom for nested items (Results' sub-destinations and the account items): a hairline rail under the parent's
   left edge, text 17 px in, 40 px rows, muted-strong text. These rules come after the item rule above. */
.shell-dr-sub { margin: 0 0 6px 20px; border-left: 1px solid var(--line); }
.shell-dr-sub a, .shell-dr-sub button { min-height: 40px; padding-left: 16px; color: var(--muted-strong); }
/* current section item: a 3 px accent bar over the rail (row 2 uses the same bar along the bottom) */
.shell-dr-sub a[aria-current] { margin-left: -1px; padding-left: 17px; color: var(--foreground); box-shadow: inset 3px 0 0 var(--accent-text); }
.shell-dr-acct { padding: 10px 0 4px; border-top: 1px solid var(--line); }
.shell-dr-h { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; padding: 0 20px;
  font: 400 13px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.shell-dr-h img { width: 28px; height: 28px; flex: none; object-fit: cover; border: 1px solid var(--line-strong); border-radius: 50%; }
.shell-dr-foot { margin-top: auto; padding: 16px 20px 24px; border-top: 1px solid var(--line); }
.shell-acct-error { margin: 0; padding: 8px 16px; font: 400 13px/1.5 var(--sans); color: var(--foreground); }
[data-account-logout]:disabled { opacity: .5; cursor: wait; }

/* LIGHT MODE toggle, 40 px tall. Pressed (Paper on) is keyed to the root theme, which theme.js sets before the
   first paint, so the pressed look never flashes; theme.js keeps aria-pressed in step. Pressed = filled in ink
   (not yellow: it is a state, not a primary action); the sun stays a line icon like every other shell icon. */
.shell-mode { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 10px; border: 1px solid var(--line-strong); background: transparent;
  color: var(--foreground); cursor: pointer; font: 400 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.shell-mode .shell-ico { width: 18px; height: 18px; }
.shell-mode:hover { border-color: var(--foreground); }
:root[data-theme="light"] .shell-mode { background: var(--foreground); color: var(--canvas); border-color: var(--foreground); }
:root[data-theme="light"] .shell-mode:hover { background: var(--muted-strong); border-color: var(--muted-strong); }

/* ---------- footer: brand, four labelled groups, notes ---------- */
.shell-foot { padding: 32px 0 28px; border-top: 1px solid var(--line); background: var(--canvas); color: var(--muted-strong); font: 400 15px/1.5 var(--sans); }
.shell-foot p { margin: 0; }
/* below 1100 px the tagline sits on the wordmark's baseline (56.1 px of the 64 px tile), not on the tile's middle */
.shell-ft-brand { display: flex; align-items: flex-end; gap: 14px; }
/* the register carries its own ink square and its artwork starts 137/1024 in: pull it left so the ink meets the gutter */
.shell-ft-brand img { width: 64px; height: 64px; flex: none; margin-left: calc(64px * -137 / 1024); }
.shell-ft-brand p { padding-bottom: 2.4px; font: 500 15px/1.3 var(--sans); color: var(--foreground); }
.shell-ft-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; margin-top: 26px; }
.shell-foot .shell-ft-h { margin: 0 0 4px; font: 400 13px/20px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.shell-ft-g ul { margin: 0; padding: 0; list-style: none; }
.shell-ft-g a { display: block; padding: 10px 0; font: 400 15px/20px var(--sans); color: var(--foreground); text-decoration: none; overflow-wrap: anywhere; }
.shell-ft-g a:hover { color: var(--accent-text); }
.shell-foot .shell-ft-note { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font: 400 13px/1.55 var(--sans); color: var(--muted); }
.shell-ft-base { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; font: 400 13px/1 var(--sans); color: var(--muted); }

@media (min-width: 760px) {
  .shell-ft-groups { grid-template-columns: repeat(4, 1fr); gap: 24px; }
  .shell-ft-g a { padding: 4px 0; }
}

/* ---------- desktop: wordmark, inline primary nav, search, account; row 2 the section row ---------- */
@media (min-width: 1100px) {
  .shell-bar-in { gap: 0; }
  .shell-menu, .shell-ctx { display: none; }
  .shell-mark { padding: 6px 2px; }
  .shell-mark img { height: 30px; }
  .shell-btn .shell-ico { width: 24px; height: 24px; }
  .shell-nav { display: flex; gap: 0 26px; margin-left: 52px; font: 400 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
  .shell-nav a { display: inline-flex; align-items: center; height: 44px; color: var(--foreground); text-decoration: none; white-space: nowrap; }
  .shell-nav a:hover, .shell-nav a[aria-current] { color: var(--accent-text); }
  .shell-tools { gap: 10px; }
  .shell-search { margin-right: 0; }
  /* the account box spans the row's height, so the popover opens exactly at the bar's bottom edge */
  .shell-acct { display: flex; align-items: center; align-self: stretch; }
  /* flex, not inline-flex: an inline box rides the details' text baseline and sits 2.3 px above row 1's centre */
  .shell-acct-menu > summary { display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 0 0 4px; color: var(--muted-strong); cursor: pointer; }
  .shell-acct-menu > summary img { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--line-strong); border-radius: 50%; }
  .shell-acct-menu > summary .shell-ico { width: 18px; height: 18px; }
  .shell-acct-menu[open] > summary img { border-color: var(--accent-text); }
  .shell-pop { position: absolute; top: calc(100% + 1px); right: 0; z-index: 2; width: 264px; padding: 6px 0 8px;
    background: var(--panel-raised); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
  :root[data-theme="light"] .shell-pop { box-shadow: 0 12px 32px rgba(9, 11, 12, .14); }
  .shell-pop-h { margin: 0; padding: 10px 16px 6px; font: 400 13px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
  .shell-pop a, .shell-pop button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 16px; border: 0; background: transparent;
    text-align: left; text-decoration: none; cursor: pointer; font: 400 13px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--foreground); }

  .shell-sec { height: 48px; }
  .shell-sec-name { padding-right: 20px; }
  .shell-tabs { margin-right: 0; }
  .shell-tabs-sc { padding: 0 0 0 8px; }
  .shell-tabs a { padding: 0 16px; }

  .shell-foot { padding: 48px 0 36px; }
  .shell-ft-top { display: grid; grid-template-columns: minmax(200px, 1.1fr) 4fr; gap: 48px; align-items: start; }
  .shell-ft-brand { flex-direction: column; align-items: flex-start; }
  .shell-ft-brand img { width: 96px; height: 96px; margin-left: calc(96px * -137 / 1024); }
  .shell-ft-brand p { padding-bottom: 0; }
  .shell-ft-groups { margin-top: 0; gap: 32px; }
  .shell-foot .shell-ft-note { margin-top: 40px; }
}
