/* The frame (sidebar, top bar, the page inside), type, and the elements every view uses. */

*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--chrome);
  color: var(--ink);
  font: 400 var(--fs)/1.5 var(--sans);
  font-optical-sizing: auto;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: color-mix(in oklab, var(--accent-solid) 26%, transparent); }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, currentColor 32%, transparent); transition: text-decoration-color var(--t-1) var(--ease), color var(--t-1) var(--ease); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
main:focus, h1:focus { outline: none; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); letter-spacing: -.03em; line-height: 1.18; }
h2 { font-size: var(--fs-lg); letter-spacing: -.018em; }
h3 { font-size: var(--fs); letter-spacing: -.01em; }
p { margin: 0 0 12px; text-wrap: pretty; }
strong { font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -9999px; top: 8px; padding: 8px 14px; background: var(--surface); box-shadow: var(--shadow-pop); border-radius: var(--r); z-index: 100; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- The frame: a sidebar, and the page as a panel beside it ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.stage {
  position: relative; display: flex; flex-direction: column;
  height: calc(100dvh - 16px); margin: 8px 8px 8px 0;
  overflow: hidden auto; scrollbar-gutter: stable; overscroll-behavior: contain; scroll-padding-top: calc(var(--top-h) + 12px);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1);
}
main { position: relative; flex: 1; padding: 20px 0 64px; }
.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
body.wide .wrap { max-width: none; }

/* ---------- Sidebar ---------- */
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 14px 10px 12px 12px; overflow: hidden auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 10px; color: var(--ink); font-weight: 650; font-size: var(--fs-md); letter-spacing: -.02em; text-decoration: none; }
.brand__mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--brand); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / .28), inset 0 0 0 1px rgb(255 255 255 / .08), 0 1px 3px rgb(40 40 120 / .35); }
.brand__mark svg { width: 16px; height: 16px; stroke-width: 2.4; }
.side__slot:empty { display: none; }
.side__slot { margin-bottom: 4px; }
.side__label { margin: 10px 0 4px; padding: 0 10px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.side__navs { position: relative; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; white-space: nowrap; transition: color var(--t-1) var(--ease), background-color var(--t-1) var(--ease); }
.nav a svg { flex: none; width: 16px; height: 16px; color: var(--ink-3); transition: color var(--t-1) var(--ease); }
.nav a:hover { color: var(--ink); background: light-dark(rgb(16 16 32 / .05), rgb(255 255 255 / .05)); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: none; }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav__count { display: inline-grid; place-items: center; min-width: 22px; height: 18px; margin-left: auto; padding: 0 7px; border-radius: 999px; background: light-dark(rgb(16 16 32 / .06), rgb(255 255 255 / .08)); color: var(--ink-3); font-size: var(--fs-2xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.nav a[aria-current="page"] .nav__count { background: var(--accent-soft); color: var(--accent); }
/* What these pages are, said once at the foot of the sidebar. */
.side__card { margin: 0 2px 10px; padding: 12px 12px 13px; border: 1px solid var(--line); border-radius: var(--r-lg); background: light-dark(rgb(255 255 255 / .55), rgb(255 255 255 / .03)); color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.45; }
.side__card svg { display: block; width: 16px; height: 16px; margin-bottom: 8px; color: var(--accent); }
.side__card strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.side__card p { margin: 0; }
/* The lit pill behind the current page; it slides to the next one. */
.nav__pill { position: absolute; left: 0; right: 0; top: 0; height: 32px; border-radius: var(--r-sm); background: light-dark(#fff, rgb(255 255 255 / .08)); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); transition: transform var(--t-3) var(--ease-spring), opacity var(--t-2) var(--ease); pointer-events: none; }
.nav__pill[hidden] { display: block !important; opacity: 0; }
.side__spacer { flex: 1; min-height: 12px; }
.side__foot { display: flex; align-items: center; gap: 8px; padding: 10px 4px 0; border-top: 1px solid var(--line); }
.side__note { padding: 0 8px 8px; font-size: var(--fs-xs); line-height: 1.45; color: var(--ink-3); }

/* A row of two or three choices, one of them pressed. */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r); background: light-dark(rgb(16 16 32 / .06), rgb(255 255 255 / .07)); }
.seg button { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; transition: color var(--t-1) var(--ease), background-color var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease); }
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: light-dark(#fff, rgb(255 255 255 / .12)); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.side__foot .seg:last-child { margin-left: auto; }

/* ---------- Top bar: stays in place, lets the page show through ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex: none; height: var(--top-h); padding: 0 calc(var(--gutter) - 8px) 0 var(--gutter); background: color-mix(in oklab, var(--bg) 76%, transparent); -webkit-backdrop-filter: saturate(1.7) blur(14px); backdrop-filter: saturate(1.7) blur(14px); border-bottom: 1px solid var(--line); }
@supports (animation-timeline: scroll()) {
  /* The edge under the bar appears once the page has moved under it. */
  .top { border-bottom-color: transparent; animation: top-edge linear both; animation-timeline: scroll(nearest); animation-range: 0 40px; }
  @keyframes top-edge { to { border-bottom-color: var(--line); } }
}
.top .top__menu { display: none; }
.top__where { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-sm); color: var(--ink-3); white-space: nowrap; }
.top__where strong { overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 550; }
.top__where span[aria-hidden] { color: var(--line-2); }
.top__spacer { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); transition: background-color var(--t-1) var(--ease), color var(--t-1) var(--ease), transform var(--t-1) var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; }
/* Opens the jump box. It looks like a search field because that is how it is used. */
.jump { display: flex; align-items: center; gap: 8px; width: min(320px, 34vw); height: 32px; padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink-3); font-size: var(--fs-sm); text-align: left; box-shadow: var(--shadow-1); transition: border-color var(--t-1) var(--ease), color var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease); }
.jump:hover { border-color: var(--line-2); color: var(--ink-2); }
.jump svg { flex: none; width: 15px; height: 15px; }
.jump span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--ink-3); font: 500 var(--fs-2xs)/1 var(--sans); letter-spacing: 0; white-space: nowrap; }

/* A thin line under the top bar while a page is being fetched. */
.progress { position: sticky; top: var(--top-h); z-index: 19; height: 2px; margin-bottom: -2px; flex: none; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity var(--t-2) var(--ease); }
.progress::before { content: ""; display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--brand); animation: progress 1.1s var(--ease) infinite; animation-play-state: paused; }
.progress[data-on] { opacity: 1; }
.progress[data-on]::before { animation-play-state: running; }
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Soft light behind the head of every page. Decoration only. */
.aurora { position: absolute; inset: 0 0 auto 0; height: 380px; z-index: 0; overflow: hidden; pointer-events: none; -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent); }
.aurora::before, .aurora::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); }
.aurora::before { left: -6%; top: -190px; width: 52%; height: 330px; background: light-dark(rgb(124 108 246 / .2), rgb(124 108 246 / .24)); }
.aurora::after { right: -4%; top: -220px; width: 46%; height: 330px; background: light-dark(rgb(56 168 240 / .16), rgb(56 168 240 / .16)); }

/* ---------- The head of a page ---------- */
.page-head { margin: 10px 0 24px; }
.page-head .eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; color: var(--ink-3); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.page-head .eyebrow .hash { letter-spacing: 0; text-transform: none; }
/* When what is shown was read, and when it will be read again. */
.fresh { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--ink-3); font-size: var(--fs-xs); }
.page-head .lede { max-width: 68ch; margin: 10px 0 0; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.6; }
.page-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.page-head__row > :first-child { flex: 1 1 420px; min-width: 0; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; font-size: var(--fs-sm); color: var(--ink-3); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs span[aria-hidden] { color: var(--line-2); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 352px); gap: 24px 28px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.stack > section + section, .stack > * + section { margin-top: 28px; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: var(--fs-md); }
.section-title .muted { font-weight: 500; font-size: var(--fs-sm); }
.section-title + .muted { margin-top: -4px; margin-bottom: 12px; font-size: var(--fs-sm); }
.wrap > section + section { margin-top: 28px; }

/* ---------- Footer ---------- */
.foot { position: relative; padding: 14px var(--gutter) 18px; color: var(--ink-3); font-size: var(--fs-xs); }
.foot:empty { display: none; }
.foot a { color: inherit; }

/* ---------- Narrow screens: the sidebar becomes a drawer ---------- */
@media (max-width: 900px) {
  :root { --gutter: 16px; --top-h: 50px; }
  .app { display: block; }
  .stage { height: auto; min-height: 100dvh; margin: 0; overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(300px, 86vw); height: 100dvh; background: var(--chrome); border-right: 1px solid var(--line); box-shadow: var(--shadow-pop); transform: translateX(-102%); visibility: hidden; transition: transform var(--t-3) var(--ease), visibility 0s linear var(--t-3); }
  .app[data-menu="open"] .side { transform: none; visibility: visible; transition-delay: 0s; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgb(8 8 16 / .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity var(--t-2) var(--ease); }
  .app[data-menu="open"] .scrim { opacity: 1; pointer-events: auto; }
  .top { padding: 0 10px 0 8px; gap: 6px; }
  .top .top__menu { display: inline-grid; }
  .jump { width: 32px; padding: 0; justify-content: center; border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
  .jump span, .jump kbd { display: none; }
  .jump svg { width: 17px; height: 17px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  main { padding-top: 12px; }
  h1 { font-size: 1.4rem; }
}
@media (min-width: 901px) { .scrim { display: none; } }

/* ---------- On paper: the page itself, without the frame around it or the controls on it ---------- */
@media print {
  /* Paper is light, whatever theme the screen is in. */
  :root, :root[data-theme] { color-scheme: light; }
  body { background: #fff; font-size: 10.5pt; }
  .app { display: block; }
  .stage { height: auto; margin: 0; overflow: visible; border: 0; border-radius: 0; box-shadow: none; background: #fff; }
  .side, .top, .foot, .skip, .scrim, .progress, .aurora, .no-print { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; }
}

/* Who is signed in, when the server signs people in. */
.side__account { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; color: var(--ink-3); font-size: var(--fs-xs); }
.side__account[hidden] { display: none; }
.side__who { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__who svg { flex: none; width: 14px; height: 14px; }
.side__account form { margin-left: auto; }
