/* Above Full HD every page is the Full HD layout enlarged to the window's width, on the site and in both apps alike. Zoom also enlarges viewport units, so sizes taken from
   the window go through --vw, --svh and --dvh, which divide it back out. Scripts that turn a measured position into a CSS length divide it by the zoom (currentCSSZoom). Without typed
   division the page keeps its own layout. session.js sets --zoom from the window's width: 100vw leaves out the scrollbar gutter, whose width
   follows the zoom, so a zoom taken from it has no single value. This one is for a page without scripts. */
:root {
  --zoom: 1;
  --vw: 1vw;
  --svh: 1svh;
  --dvh: 1dvh;
}

@supports (width: calc(1px * (100vw / 1920px))) {
  @media (min-width: 1921px) {
    :root {
      --zoom: calc(100vw / 1920px);
      --vw: calc(1vw / var(--zoom));
      --svh: calc(1svh / var(--zoom));
      --dvh: calc(1dvh / var(--zoom));
      zoom: var(--zoom);
    }
  }
}

header.top {
  position: relative;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
header.top nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
header.top .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}
header.top .brand img {
  width: 34px;
  height: 34px;
  display: block;
}
header.top .brand span {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
header.top .links {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: 24px;
}
header.top .nav-main,
header.top .nav-account {
  display: flex;
  align-items: center;
  gap: 28px;
}
header.top .nav-account {
  margin-left: auto;
}
header.top .nav-link,
header.top .nav-menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform: none;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: normal;
  white-space: nowrap;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
header.top .nav-link::after,
header.top .nav-menu-btn::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-field);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
header.top .nav-link:hover,
header.top .nav-link:focus-visible,
header.top .nav-menu-btn:hover,
header.top .nav-menu-btn:focus-visible,
header.top .nav-menu.open .nav-menu-btn {
  color: var(--ink);
}
header.top .nav-link:hover::after,
header.top .nav-link:focus-visible::after,
header.top .nav-menu-btn:hover::after,
header.top .nav-menu-btn:focus-visible::after,
header.top .nav-menu.open .nav-menu-btn::after {
  transform: scaleX(1);
}
header.top .nav-link[aria-current]:not([aria-current='false']),
header.top .nav-menu-btn[aria-current]:not([aria-current='false']) {
  color: var(--ink);
}
header.top .nav-link[aria-current]:not([aria-current='false'])::after,
header.top .nav-menu-btn[aria-current]:not([aria-current='false'])::after {
  background: var(--accent);
  transform: scaleX(1);
}
header.top .nav-menu {
  position: relative;
}
header.top .nav-menu-btn svg {
  flex: none;
  transition: transform 0.15s;
}
header.top .nav-menu.open .nav-menu-btn svg {
  transform: rotate(180deg);
}
header.top .nav-menu-panel {
  display: none;
  position: absolute;
  left: -14px;
  top: 100%;
  z-index: 20;
  padding-top: 6px;
}
header.top .nav-menu.open .nav-menu-panel {
  display: block;
}
/* Without nav.js a menu opens while focus is inside it, so Sign out stays reachable; nav.js marks the menus it runs. */
header.top .nav-menu:not([data-started]):focus-within .nav-menu-panel {
  display: block;
}
header.top .nav-account .nav-menu-panel {
  left: auto;
  right: -14px;
}
header.top .nav-menu-list {
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
  padding: 6px;
}
header.top .nav-menu-heading {
  display: none;
}
header.top .nav-menu-list form {
  margin: 0;
}
header.top .nav-menu-list a,
header.top .nav-menu-list button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  box-shadow: none;
  transform: none;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  text-align: left;
  white-space: normal;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
header.top .nav-menu-list a:hover,
header.top .nav-menu-list a:focus-visible,
header.top .nav-menu-list button:hover,
header.top .nav-menu-list button:focus-visible {
  background: var(--bg);
  color: var(--ink);
}
header.top .nav-menu-list a[aria-current]:not([aria-current='false']) {
  background: var(--bg);
  box-shadow: inset 3px 0 0 var(--accent);
}
header.top .nav-menu-list strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
header.top .nav-menu-list a span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--muted);
}
header.top .nav-group + .nav-group,
header.top .nav-group + form {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
header.top .nav-group > span {
  display: block;
  padding: 6px 12px 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
header.top .cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 9.5em;
  min-height: 44px;
  padding: 10px 18px;
  margin-left: 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease;
}
header.top .cta:hover {
  background: var(--accent-hover);
  color: var(--ink);
}
header.top .cta:active {
  transform: translateY(1px);
}
header.top .cta-reserve {
  visibility: hidden;
}
header.top .cta.cta-trial {
  flex-direction: column;
  padding-block: 5px;
  line-height: 1.2;
}
header.top .cta-sub {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.8;
}
header.top .nav-toggle {
  display: none;
}
@media (max-width: 1000px) {
  header.top .links,
  header.top .nav-main,
  header.top .nav-account {
    gap: 20px;
  }
  header.top .links {
    margin-left: 8px;
  }
}
@media (max-width: 920px) {
  header.top nav {
    gap: 10px;
  }
  header.top .cta {
    margin-left: auto;
    font-size: 15px;
    padding: 10px 16px;
  }
  header.top .nav-toggle {
    order: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: -4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }
  header.top .nav-toggle:hover {
    background: var(--bg-sunken);
  }
  header.top .nav-toggle .icon-close,
  header.top .nav-toggle[aria-expanded='true'] .icon-open {
    display: none;
  }
  header.top .nav-toggle[aria-expanded='true'] .icon-close {
    display: block;
  }
  /* The phone menu: a sheet under the header that covers the page, with each section a row that opens in place. */
  header.top .links {
    display: none;
  }
  header.top nav.menu-open .links {
    position: fixed;
    top: var(--menu-top, 81px);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 49;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px var(--gutter) 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid var(--line);
    background: var(--bg);
    animation: menu-in 0.18s ease-out;
  }
  header.top .nav-main,
  header.top .nav-account {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
  }
  header.top .nav-main > *,
  header.top .nav-account > .nav-menu {
    border-bottom: 1px solid var(--line-soft);
  }
  header.top .nav-menu-btn,
  header.top .nav-main > .nav-link {
    justify-content: space-between;
    width: 100%;
    min-height: 58px;
    padding: 0 4px;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
  }
  header.top .nav-menu-btn::after,
  header.top .nav-link::after {
    display: none;
  }
  header.top .nav-menu-btn svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
  }
  /* A section shows nothing of its own when it holds the current page: it opens with the sheet, and the page itself is marked inside. */
  header.top .nav-menu-btn[aria-current]:not([aria-current='false']),
  header.top .nav-main > .nav-link[aria-current]:not([aria-current='false']) {
    box-shadow: none;
  }
  header.top .nav-main > .nav-link[aria-current]:not([aria-current='false'])::before {
    content: '';
    order: 2;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ink) inset;
  }
  header.top .nav-menu-panel,
  header.top .nav-account .nav-menu-panel {
    display: none;
    position: static;
    padding: 0 0 14px;
  }
  header.top .nav-menu.open .nav-menu-panel {
    display: block;
  }
  header.top .nav-menu-list {
    min-width: 0;
    padding: 6px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-xl);
    box-shadow: none;
    background: var(--surface);
  }
  header.top .nav-menu-list a,
  header.top .nav-menu-list button {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 48px;
    padding: 8px 36px 8px 14px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
  }
  header.top .nav-menu-list a span {
    font-size: 14px;
  }
  header.top .nav-menu-list a[aria-current]:not([aria-current='false']) {
    background: var(--bg);
    box-shadow: none;
    font-weight: 600;
  }
  header.top .nav-menu-list a[aria-current]:not([aria-current='false'])::after {
    content: '';
    position: absolute;
    top: calc(50% - 4px);
    right: 16px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ink) inset;
  }
  header.top .nav-group + .nav-group,
  header.top .nav-group + form {
    margin-top: 4px;
    padding-top: 4px;
  }
  header.top .nav-group > span {
    padding: 8px 14px 2px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  /* Sign in and the header's button sit together at the foot of the sheet, and the bar above keeps only the logo and Close. */
  header.top .nav-account {
    position: sticky;
    bottom: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: auto;
    padding: 20px 0 calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, var(--bg) 16px);
  }
  header.top .nav-account > .nav-menu {
    flex: 1 1 100%;
  }
  header.top .nav-account > .nav-link {
    flex: 0 0 calc(50% - 6px);
    justify-content: center;
    min-height: 52px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
  }
  header.top .nav-account > .nav-link {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
  }
  /* The header's own button moves into that bar while the sheet is open: beside Sign in, or across it when signed in. */
  header.top nav.menu-open > .cta {
    position: fixed;
    right: var(--gutter);
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: var(--gutter);
    z-index: 51;
    min-height: 52px;
    margin: 0;
    font-size: 17px;
    font-weight: 600;
  }
  header.top nav.menu-open > .cta .cta-sub {
    display: none;
  }
  header.top nav.menu-open .nav-toggle {
    margin-left: auto;
  }
  header.top nav.menu-open:has(.nav-account > .nav-link) > .cta {
    left: calc(50% + 6px);
  }
  header.top nav.menu-open:not(:has(.nav-account > .nav-link)) .nav-account {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  html.menu-locked {
    overflow: hidden;
  }
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
@media (max-width: 420px) {
  header.top .brand span {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  header.top *,
  header.top *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* The button nav.js puts over a side menu or a post's "On this page" on a narrow screen; the list folds under it. Shown here, not in
   site.css or content.css, because those rules sit in cascade layers this unlayered file always beats. */
.side-menu {
  display: none;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.side-menu:is(:hover, :active, [aria-expanded='true']) {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.side-menu span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-menu small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.side-menu::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--ease);
}
.side-menu[aria-expanded='true']::after {
  margin-top: 4px;
  transform: rotate(-135deg);
}
@media (max-width: 860px) {
  .side-menu[aria-controls='side-menu'] {
    display: flex;
  }
}
@media (max-width: 960px) {
  .side-menu[aria-controls='toc-menu'] {
    display: flex;
  }
}

/* A cached page carries both states; session.js marks <html> before paint, and the state must win over each item's own display. */
html[data-signed-in] header.top [data-when='signed-out'],
html:not([data-signed-in]) header.top [data-when='signed-in'] {
  display: none !important;
}

/* Signed in, the account menu is a round initial with a green ring where Sign in sits when signed out, so the button keeps its place. */
header.top .avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--accent);
  transition: background-color 0.15s ease;
}
header.top .avatar:empty::before {
  content: var(--initial, '');
}
header.top .nav-avatar .nav-menu-list {
  width: max-content;
  max-width: 320px;
}
@media (min-width: 921px) {
  /* Just the ringed initial, close to the button beside it; signed out it is not shown, so Sign in keeps its own spacing. */
  header.top .nav-avatar {
    margin-right: -12px;
  }
  header.top .nav-avatar .nav-menu-btn::after,
  header.top .nav-avatar .avatar-label,
  header.top .nav-avatar .nav-menu-btn > svg {
    display: none;
  }
  header.top .nav-avatar .nav-menu-btn:hover .avatar,
  header.top .nav-avatar.open .avatar {
    background: var(--line);
  }
}
@media (max-width: 920px) {
  header.top .nav-avatar .nav-menu-btn {
    justify-content: flex-start;
    gap: 12px;
  }
  header.top .nav-avatar .nav-menu-btn > svg {
    margin-left: auto;
  }
  header.top .nav-avatar .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

/* Turbo's bar over the top of the window while a slow page loads. The vendored Turbo inserts no style element of its own, which the
   Content-Security-Policy (style-src 'self') would refuse; Turbo sets only its width and opacity, inline. */
.turbo-progress-bar {
  position: fixed;
  display: block;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 2147483647;
  transition:
    width 300ms ease-out,
    opacity 150ms 150ms ease-in;
  transform: translate3d(0, 0, 0);
}
@media (prefers-reduced-motion: reduce) {
  .turbo-progress-bar {
    transition: none;
  }
}
/* Without scripts the phone sheet cannot open, so its sections stay under the bar, each open while focus is in it. */
@media (max-width: 920px) and (scripting: none) {
  header.top .nav-toggle {
    display: none;
  }
  header.top .links {
    display: flex;
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
  }
}
