/* colours, fonts and radius come from tokens.css (shared with the dashboard) */
body { margin: 0; font: 17px/1.6 var(--sans); color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
a:hover { color: var(--accent-2); }

header { border-top: 3px solid var(--accent); display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: var(--card); }
header a { color: var(--muted); text-decoration: none; }
header a:hover { color: var(--fg); }
header .gh { display: inline-flex; align-items: center; gap: .65rem; }
header .gh svg { fill: currentColor; }
header button { font: inherit; color: var(--muted); background: none; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .1rem .5rem; cursor: pointer; }
header button:hover { color: var(--accent); border-color: var(--accent); }
header .brand { color: var(--accent); font-weight: 700; }
header .brand:hover { color: var(--accent-2); }
.search { position: relative; flex: 1 1 100%; order: 3; }
.search input { box-sizing: border-box; width: 100%; font: inherit; padding: var(--input-pad); color: var(--fg); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); }
:is(button, input, a, summary):focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
#results { position: absolute; z-index: 2; left: 0; right: 0; top: calc(100% + .25rem); max-height: 70vh; overflow-y: auto; margin: 0; padding: 0; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#results li { position: relative; padding: .5rem .75rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#results li:last-child { border-bottom: 0; }
#results a { color: var(--fg); font-weight: 600; }
#results a::after { content: ''; position: absolute; inset: 0; }
#results li:hover, #results li.active { background: var(--tint-sel); }
#results small { display: block; color: var(--muted); }
header .brand { margin-right: auto; }

.wrap { max-width: 66rem; margin: 0 auto; padding: 0 1rem; }
nav ul { margin: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--accent); }
nav a[aria-current] { color: var(--accent); font-weight: 600; }
#TableOfContents { display: none; } /* the sidebar shows it from 48rem up */
main { min-width: 0; padding: 1rem 0 4rem; }
h1, h2, h3 { line-height: 1.25; scroll-margin-top: 4rem; }
h1 { padding-bottom: .3rem; border-bottom: 2px solid var(--accent); }
h2 { padding-bottom: .2rem; border-bottom: 1px solid var(--line); }
h3 { color: var(--accent-2); }
.anchor { margin-left: .3em; color: var(--accent-3); text-decoration: none; opacity: .4; }
.page-head { display: flex; align-items: flex-start; gap: 1rem; padding-bottom: .3rem; border-bottom: 2px solid var(--accent); }
.page-head h1 { flex: 1 1 auto; min-width: 0; margin: .67em 0 0; padding: 0; border: 0; }
.page-actions { position: relative; display: inline-flex; margin-top: .9rem; font-size: .875rem; }
/* same look as the dashboard's buttons (web/src/app.css) */
.page-actions > button, .page-actions summary { display: flex; align-items: center; font: inherit; color: var(--fg); background: var(--btn-bg); border: 1px solid transparent; padding: var(--btn-pad); cursor: pointer; }
.page-actions > button:hover, .page-actions summary:hover, .page-actions details[open] summary { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }
.page-actions > button { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.page-actions details { display: flex; }
.page-actions summary { box-sizing: border-box; padding: 0 8px; border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; list-style: none; }
.page-actions summary::-webkit-details-marker { display: none; }
.page-actions summary svg { width: 10px; height: 10px; fill: currentColor; }
.page-actions .menu { position: absolute; top: calc(100% + .25rem); right: 0; z-index: 5; width: 17.5rem; padding: .25rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.page-actions .menu > * { display: block; width: 100%; box-sizing: border-box; padding: .5rem .75rem; font: inherit; color: var(--fg); text-align: left; text-decoration: none; background: none; border: 0; border-radius: var(--radius); cursor: pointer; }
.page-actions .menu > :hover { background: var(--btn-bg-hover); }
.page-actions .menu strong { display: block; font-weight: 500; }
.page-actions .menu span { display: block; font-size: .8125rem; color: var(--muted); }
.page-actions [hidden] { display: none; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.pager [rel=next] { margin-left: auto; text-align: right; }

code, pre { font: .9em var(--mono); background: var(--raised); border-radius: var(--radius); }
code { padding: .1em .3em; color: var(--accent-2); white-space: nowrap; } /* never split a flag or path; wide tables scroll */
pre { padding: .75rem 1rem; overflow-x: auto; }
pre code { padding: 0; color: inherit; background: none; white-space: pre; }
.codebox { position: relative; margin: 1em 0; }
.codebox pre { margin: 0; }
.copy { position: absolute; top: .4rem; right: .4rem; font: .75rem var(--sans); padding: .15rem .5rem; color: var(--muted); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; opacity: 0; transition: opacity .15s; }
.codebox:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--fg); }
@media (hover: none) { .copy { opacity: 1; } }
td code { white-space: normal; } /* a narrow table cell wraps instead of hiding its column */
@media (max-width: 40em) { code { white-space: normal; overflow-wrap: anywhere; } } /* a long inline command must not widen the page on a phone; pre code keeps its own rule */
table { border-collapse: collapse; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: .35rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--tint-sel); border-bottom: 2px solid var(--accent); }
blockquote { margin: 1rem 0; padding: .1rem 1rem; border-left: 3px solid var(--accent-3); background: var(--tint-group); color: var(--muted); }

/* GitHub-style alerts (layouts/_markup/render-blockquote.html): > [!WARNING] */
.alert { --c: var(--info); margin: 1rem 0; padding: .1rem 1rem; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); border-radius: 0 var(--radius) var(--radius) 0; }
.alert-title { margin: .6rem 0 0; font-weight: 700; color: var(--c); }
.alert-warning { --c: var(--accent-3); }
.alert-caution { --c: var(--bad); }
.alert-important { --c: var(--accent); }
.alert-tip { --c: var(--ok); }

@media (min-width: 48rem) {
  header { position: sticky; top: 0; z-index: 1; padding: .6rem 1.5rem; }
  .search { flex: 0 1 22rem; order: 0; }
  header .search { margin-right: auto; }
  header .brand { margin-right: 1.5rem; }
  .wrap { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2.5rem; }
  nav { position: sticky; top: 3.5rem; align-self: start; max-height: calc(100vh - 4rem); overflow-y: auto; padding: 1.25rem 0; }
  nav ul { display: block; border: 0; padding: 0; }
  nav li { padding: .15rem 0; }
  #TableOfContents { display: block; font-size: .9em; }
  #TableOfContents ul { padding: .15rem 0 .15rem .9rem; }
  #TableOfContents > ul { border-left: 2px solid var(--accent-2); margin-left: .25rem; } /* one rule for the whole tree; nested lists only indent */
  #TableOfContents a.active { color: var(--accent); font-weight: 600; }
  .anchor { opacity: 0; }
  h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
  main { padding-top: 1.25rem; }
}

main img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }

/* themed screenshots (layouts/_markup/render-image.html): both are in the page, one is shown; data-theme (theme.js) beats the OS preference */
.dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .light-only { display: none; }
  :root:not([data-theme="light"]) .dark-only { display: revert; }
}
:root[data-theme="dark"] .light-only { display: none; }
:root[data-theme="dark"] .dark-only { display: revert; }
