/* The docs (DESIGN.md): the public site's header, type and tokens (site.css), with a left nav, the
   page's text, and "On this page" as the portal's track (track.css). The site's token names. */

/* ---- the header: the site's, with the docs' label, a search pill, and two buttons on a phone */
.logo .sub { font-weight: 600; color: var(--muted); }
.nav ul { margin-left: 8px; }
.nav ul a, .nav > .btn { white-space: nowrap; }
.search-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 38px; flex: 0 1 240px; min-width: 132px; white-space: nowrap; padding: 0 10px 0 12px; border-radius: 999px; background: var(--raised); border: 1px solid var(--outline); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.search-pill:hover { border-color: var(--control); }
.search-pill svg, .big-search svg, .find-box svg, .ib svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
kbd { margin-left: auto; font: 600 11px/1 var(--mono); border: 1px solid var(--control); border-radius: 6px; padding: 3px 5px; color: var(--muted); }
.phone { display: none; margin-left: auto; gap: 4px; }
.ib { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; }
.ib:hover { background: var(--rail); }

/* signed in: who, as the portal's initial and the workspace's name */
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; }
.who [data-ws] { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }  /* a long name; its title has it whole */
@media (max-width: 999px) { .who [data-ws] { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); } }  /* the initial alone; the name is still read out */
.who[hidden], .yourws[hidden] { display: none; }
.av { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 700; font-size: 12px; }

/* ---- a doc page: the left nav, the text, and its rail */
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr) 200px; gap: 40px; padding-top: 32px; padding-bottom: 96px; }
.doc.no-rail { grid-template-columns: 220px minmax(0, 1fr); }
.lnav { position: sticky; top: 96px; align-self: start; font-size: 14px; max-height: calc(100vh - 120px); overflow: auto; }
.lnav p { font-weight: 700; font-size: 13px; margin: 18px 0 6px; }
.lnav p:first-child { margin-top: 0; }
.lnav ul { list-style: none; margin: 0; padding: 0; }
.lnav a { display: block; padding: 4px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; }
.lnav a:hover { color: var(--ink); background: var(--rail); }
.lnav a[aria-current="page"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.lnav .verb { font: 600 11px var(--mono); margin-right: 6px; opacity: .8; }

.prose { min-width: 0; max-width: 720px; font-size: 16px; line-height: 1.6; }
.prose .crumb { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.prose h1 { font-size: 40px; line-height: 1.12; letter-spacing: -.03em; margin: 0 0 12px; }
.prose h2 { font-size: 24px; letter-spacing: -.02em; line-height: 1.25; margin: 44px 0 10px; }
.prose h3 { font-size: 17px; margin: 24px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose a { text-decoration: underline; }
.prose a.btn { text-decoration: none; }  /* filled and quiet buttons never underline */
.prose code { font: .875em var(--mono); background: var(--rail); border-radius: 6px; padding: 1px 5px; }
.prose :is(h2, h3)[id] { scroll-margin-top: 96px; }

/* a guide: its meta, its steps numbered on the track (filled as you read, as the rail is), its
   code with a tab per place it runs, and a callout. Neutral boxes; ink marks where you are */
.prose .lede { margin-bottom: 16px; }
.ref .prose .lede { font-size: 17px; }  /* one step down beside the examples: its column is narrower */
.prose .meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.prose .meta > span { padding: 3px 10px; border: 1px solid var(--outline); border-radius: 999px; font-size: 13px; color: var(--muted); }
.prose .meta code { font-size: 12px; background: none; padding: 0; }
.prose .yours { font-size: 14px; color: var(--muted); }
.yours[hidden] { display: none; }
.steps { --line-x: 13px; --dot-x: 0px; --dot-y: 2px; list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 28px; counter-reset: step; }
.steps > .track-station { min-width: 0; padding-left: 46px; counter-increment: step; }  /* long code scrolls in its box, not the page */
.steps > .track-station::before { content: counter(step); width: 22px; height: 22px; font: 600 12px/22px var(--mono); text-align: center; color: var(--muted); }
.steps > .track-station.passed::before { color: var(--on-ink); }
.prose .steps h2 { margin: 0 0 8px; font-size: 21px; }
.prose .rec { margin: -2px 0 10px; }
.callout { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--outline); border-radius: 14px; background: var(--raised); font-size: 15px; }
.callout svg { width: 20px; height: 20px; flex: none; margin-top: 2px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.callout p { margin: 0; }
.prose pre { margin: 0 0 14px; padding: 14px 16px; overflow: auto; border: 1px solid var(--outline); border-radius: 14px; background: var(--raised); font: 13.5px/1.6 var(--mono); }
.prose pre code { padding: 0; background: none; font: inherit; }
.prose pre:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.code { margin: 0 0 14px; border: 1px solid var(--outline); border-radius: 14px; background: var(--raised); }
.code-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--outline); }
.code-h [role="tab"], .code .copy { min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.code-h [role="tab"]:hover, .code .copy:hover { color: var(--ink); background: var(--rail); }
.code-h [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.code .copy { margin-left: auto; }
.code pre { margin: 0; border: 0; border-radius: 0 0 14px 14px; background: none; }

/* a reference page: the text, and its examples beside it where the rail would be (the call in a
   tab per language, then its answer); under 1100px the examples follow the text */
.doc.ref { grid-template-columns: 220px minmax(0, 1fr) minmax(0, 440px); grid-template-rows: auto auto auto 1fr; row-gap: 0; }  /* the last row takes the slack, so none opens under "The answer" (t-0138) */
/* the reference's parts are the grid's own items (refParts): the text in the middle column, the
   call beside its title and parameters, the answer beside "The answer" */
.doc.ref .ref-body { display: contents; }
.doc.ref .lnav { grid-row: 1 / span 6; }
.doc.ref .seg { grid-column: 2; min-width: 0; max-width: 720px; }
.seg-a { grid-row: 1; } .seg-b { grid-row: 2; } .seg-c { grid-row: 3; } .seg-d { grid-row: 4; }
.ex-call { grid-column: 3; grid-row: 1 / span 2; }
.ex-answer { grid-column: 3; grid-row: 3 / span 2; }
.examples { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; overscroll-behavior: contain; min-width: 0; }
.examples .ans { margin: 18px 0 6px; font: 600 13px var(--mono); color: var(--muted); }
.examples pre { margin: 0 0 14px; padding: 14px 16px; overflow: auto; border: 1px solid var(--outline); border-radius: 14px; background: var(--raised); font: 13px/1.6 var(--mono); }
.examples pre:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.examples .code pre { margin: 0; border: 0; border-radius: 0 0 14px 14px; background: none; }
.verbline { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.verbline .verb { padding: 2px 8px; border-radius: 6px; background: var(--ink); color: var(--on-ink); font: 600 12px var(--mono); }
.verbline code { font-size: 15px; }
.params { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 0; }
.params li { padding: 12px 0; border-top: 1px solid var(--outline); }
.params li:last-child { border-bottom: 1px solid var(--outline); }
.params p { margin: 0; }
.params .pn { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.params .pt { font-size: 13px; color: var(--muted); }
.params .req { font-size: 12px; font-weight: 600; }
.prose .table { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--outline); border-radius: 14px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--outline); }
.prose th { font-size: 13px; color: var(--muted); }
.prose tr:last-child td { border-bottom: 0; }

/* "On this page": the track's stations with their names beside them, filled to where you are */
.rail { position: sticky; top: 96px; align-self: start; font-size: 13px; }
.rail > p { font-weight: 700; margin: 0 0 10px; }
.rail .track { --line-x: 8px; --dot-x: 0px; --dot-y: 1px; list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rail .track-station { padding-left: 28px; line-height: 1.35; }
.rail .track-station a { color: var(--muted); text-decoration: none; }
.rail .track-station a:hover { color: var(--ink); }
.rail .track-station.current a { color: var(--ink); font-weight: 600; }

/* ---- the home page */
.hero { padding: 64px 0 36px; max-width: 760px; }
.hero h1 { font-size: clamp(2.5rem, 1.6rem + 3vw, 3.5rem); margin-bottom: 14px; }
.big-search { display: flex; align-items: center; gap: 10px; width: 100%; height: 52px; padding: 0 16px; border-radius: 999px; background: var(--raised); border: 1px solid var(--control); color: var(--muted); font: inherit; font-size: 16px; cursor: pointer; text-align: left; }
.big-search:hover { border-color: var(--ink); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 56px; padding-bottom: 96px; }
.home-grid h2 { font-size: 22px; margin: 0 0 4px; }
.home-grid .muted { margin: 0 0 16px; }
.start { --line-x: 8px; --dot-x: 0px; --dot-y: 3px; list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 18px; }
.start .track-station { padding-left: 32px; }
.start b { display: block; }
.start span { color: var(--muted); font-size: 15px; }
.chip { display: inline-flex; align-items: center; height: 26px; margin-left: 6px; padding: 0 10px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 600; vertical-align: middle; }
.start small { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--muted); }
.start .track-station.current::before { border-color: var(--ink); }
.yourws { display: flex; gap: 12px; align-items: center; margin: 0 0 20px; padding: 12px 16px; max-width: 560px; border: 1px solid var(--outline); border-radius: 14px; background: var(--raised); font-size: 15px; }
.lists { display: grid; gap: 28px; align-content: start; }
.lists h3 { font-size: 15px; margin: 0 0 6px; }
.lists a { display: block; padding: 3px 0; font-size: 15px; text-decoration: none; }
.lists a:hover { text-decoration: underline; }
.lists a span { color: var(--muted); font-size: 14px; }
.missing { padding-top: 96px; padding-bottom: 96px; min-height: 50vh; }

/* ---- search: a dialog over the page, its results as you type */
dialog { color: var(--ink); }
dialog::backdrop { background: var(--scrim); }
/* The search opens as the portal's dialogs do, and the phone's menu as its drawer, from the side it
   sits on (apps/web/design/foundations.md, Motion): in over --motion-panel, out over --motion-hover. */
.find { opacity: 0; transform: translateY(var(--shift)) scale(var(--scale-in)); transition: opacity var(--motion-hover) var(--ease-in), transform var(--motion-hover) var(--ease-in), display var(--motion-hover) allow-discrete, overlay var(--motion-hover) allow-discrete; }
.find[open] { opacity: 1; transform: none; transition-duration: var(--motion-panel); transition-timing-function: var(--ease-out); }
dialog::backdrop { opacity: 0; transition: opacity var(--motion-hover) var(--ease-in), display var(--motion-hover) allow-discrete, overlay var(--motion-hover) allow-discrete; }
dialog[open]::backdrop { opacity: 1; transition-duration: var(--motion-swap); }
.menu { --from-x: 100%; translate: var(--from-x) 0; transition: translate var(--motion-swap) var(--ease-in), display var(--motion-swap) allow-discrete, overlay var(--motion-swap) allow-discrete; }
.menu[open] { translate: 0; transition-duration: var(--motion-panel); transition-timing-function: var(--ease-out); }
@starting-style {
  .find[open] { opacity: 0; transform: translateY(var(--shift)) scale(var(--scale-in)); }
  dialog[open]::backdrop { opacity: 0; }
  .menu[open] { translate: var(--from-x) 0; }
}
@media (prefers-reduced-motion: reduce) { .menu { --from-x: 0px; } }
.find { width: min(640px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--outline); border-radius: 18px; background: var(--raised); box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.find-box { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--outline); }
.find-box input { flex: 1; min-width: 0; height: 56px; border: 0; background: none; font: inherit; font-size: 17px; color: var(--ink); }
.find-box input:focus { outline: none; }
.find-box:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 18px 18px 0 0; }
.find-results { list-style: none; margin: 0; padding: 8px; max-height: min(60vh, 520px); overflow: auto; overscroll-behavior: contain; }
.find-results:empty { display: none; }
.find-results a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.find-results a b { display: block; font-weight: 600; }
.find-results a span { display: block; font-size: 14px; color: var(--muted); }
.find-results a:hover, .find-results a:focus { background: var(--selected); outline: none; }
.find-results a:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.find-results .none { padding: 14px 12px; color: var(--muted); }

/* ---- the phone's menu: the left nav in a sheet */
.menu { width: min(360px, 100vw); height: 100dvh; max-height: none; margin: 0 0 0 auto; padding: 56px 20px 24px; border: 0; background: var(--raised); box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.menu .close { position: absolute; top: 8px; right: 8px; }
.menu .lnav { position: static; max-height: none; }
.menu > .btn { margin-top: 24px; }

/* ---- narrower: the rail rides a strip along the header's bottom, the current section named in
   the ink pill (track.css); on a phone, the nav goes in the menu */
.edge-strip { display: none; }
@media (max-width: 1099px) {
  .doc, .doc.ref { grid-template-columns: 220px minmax(0, 1fr); }
  .doc.ref { grid-template-rows: none; }
  .rail { display: none; }
  .examples, .doc.ref .seg { position: static; grid-column: 2; grid-row: auto; max-height: none; overflow: visible; }  /* the source order: the call after the lede, the answer under "The answer" */
  .ex-call { margin-top: 8px; } .ex-answer { margin-bottom: 8px; }
  .edge-strip { display: flex; align-items: center; gap: 12px; max-width: 1200px; height: 34px; margin: 0 auto; padding: 0 24px; border-top: 1px solid var(--outline); }
  .edge-strip .edge-track { flex: 1; }
  .edge-strip .track-pill { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .edge-strip .track-pill:empty { display: none; }
  .lnav { top: 116px; }
  .prose :is(h2, h3)[id] { scroll-margin-top: 116px; }
}
@media (max-width: 640px) { .edge-strip { padding: 0 16px; } }
@media (max-width: 760px) {
  .nav ul, .search-pill, .nav > .btn, .who { display: none; }
  .nav .themes { margin-left: auto; }
  .phone { display: inline-flex; margin-left: 0; }
  .doc, .doc.no-rail, .doc.ref { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
  .examples, .doc.ref .seg { grid-column: 1; }
  .lnav:not(.menu .lnav) { display: none; }
  .prose h1 { font-size: 32px; }
  .hero { padding: 32px 0 24px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
}
