:root {
  color-scheme: light;
  --htmlpress-font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans",
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji";
  --htmlpress-mono:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --htmlpress-background: oklch(1 0 0);
  --htmlpress-muted: oklch(0.985 0 0);
  --htmlpress-foreground: oklch(0.145 0 0);
  --htmlpress-prose: oklch(0.373 0.034 259.733);
  --htmlpress-prose-strong: oklch(0.21 0.034 264.665);
  --htmlpress-prose-marker: oklch(0.872 0.01 258.338);
  --htmlpress-muted-foreground: oklch(0.5 0 0);
  --htmlpress-border: oklch(0.922 0 0);
  --htmlpress-primary: oklch(0.511 0.262 276.966);
  --htmlpress-primary-foreground: oklch(0.985 0 0);
  --htmlpress-banner: oklch(0.879 0.169 91.605);
  --htmlpress-banner-foreground: oklch(0.205 0 0);
  --htmlpress-highlight: oklch(0.905 0.182 98.111);
  --htmlpress-highlight-foreground: oklch(0.205 0 0);
  --htmlpress-info: oklch(0.623 0.214 259.815);
  --htmlpress-positive: oklch(0.648 0.2 131.684);
  --htmlpress-warning: oklch(0.795 0.184 86.047);
  --htmlpress-destructive: oklch(0.55 0.2 25);
  --htmlpress-shadow: 0 1px 3px 0 oklch(0 0 0 / 0.08), 0 1px 2px -1px oklch(0 0 0 / 0.08);
  --htmlpress-radius: 1rem;
  --htmlpress-width: 56.5rem;
  --htmlpress-nav-width: 16rem;
}

/* The dark set twice: once for the system preference, once for the theme toggle's
   choice, which wins over the preference either way. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --htmlpress-background: oklch(0.145 0 0);
    --htmlpress-muted: oklch(0.205 0 0);
    --htmlpress-foreground: oklch(0.985 0 0);
    --htmlpress-prose: oklch(0.872 0.01 258.338);
    --htmlpress-prose-strong: oklch(1 0 0);
    --htmlpress-prose-marker: oklch(0.446 0.03 256.802);
    --htmlpress-muted-foreground: oklch(0.708 0 0);
    --htmlpress-border: oklch(0.269 0 0);
    --htmlpress-primary: oklch(0.585 0.233 277.117);
    --htmlpress-primary-foreground: oklch(0.985 0 0);
    --htmlpress-banner: oklch(0.414 0.112 45.904);
    --htmlpress-banner-foreground: oklch(0.985 0 0);
    --htmlpress-highlight: oklch(0.554 0.135 66.442);
    --htmlpress-highlight-foreground: oklch(0.985 0 0);
    --htmlpress-info: oklch(0.623 0.214 259.815);
    --htmlpress-positive: oklch(0.841 0.238 128.85);
    --htmlpress-warning: oklch(0.852 0.199 91.936);
    --htmlpress-destructive: oklch(0.7 0.17 25);
    --htmlpress-shadow: 0 1px 3px 0 oklch(0 0 0 / 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --htmlpress-background: oklch(0.145 0 0);
  --htmlpress-muted: oklch(0.205 0 0);
  --htmlpress-foreground: oklch(0.985 0 0);
  --htmlpress-prose: oklch(0.872 0.01 258.338);
  --htmlpress-prose-strong: oklch(1 0 0);
  --htmlpress-prose-marker: oklch(0.446 0.03 256.802);
  --htmlpress-muted-foreground: oklch(0.708 0 0);
  --htmlpress-border: oklch(0.269 0 0);
  --htmlpress-primary: oklch(0.585 0.233 277.117);
  --htmlpress-primary-foreground: oklch(0.985 0 0);
  --htmlpress-banner: oklch(0.414 0.112 45.904);
  --htmlpress-banner-foreground: oklch(0.985 0 0);
  --htmlpress-highlight: oklch(0.554 0.135 66.442);
  --htmlpress-highlight-foreground: oklch(0.985 0 0);
  --htmlpress-info: oklch(0.623 0.214 259.815);
  --htmlpress-positive: oklch(0.841 0.238 128.85);
  --htmlpress-warning: oklch(0.852 0.199 91.936);
  --htmlpress-destructive: oklch(0.7 0.17 25);
  --htmlpress-shadow: 0 1px 3px 0 oklch(0 0 0 / 0.4);
}

/* The page's globals; each htmlpress-* element styles itself and places what it holds
   in its own file. */

@view-transition {
  navigation: auto;
}

/* The header and the sidebar outlast the page, as in Livemark's single-page app: only the
   content crossfades, and they take the new page's state at once */
::view-transition-group(htmlpress-header),
::view-transition-group(htmlpress-sidebar),
::view-transition-new(htmlpress-header),
::view-transition-new(htmlpress-sidebar) {
  animation: none;
}
::view-transition-old(htmlpress-header),
::view-transition-old(htmlpress-sidebar) {
  display: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Android paints a cyan box over every tapped link or button; Tailwind clears it in Livemark */
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  scrollbar-color: #ddd transparent;
  scrollbar-gutter: stable;
}

/* A heading jumped to clears the phone's contents bar too, not just the header */
@media (max-width: 80rem) {
  html:has(htmlpress-toc-bar > button) {
    scroll-padding-top: 7.5rem;
  }
}

button:not([disabled]),
[role="button"]:not([disabled]) {
  cursor: pointer;
}

body {
  margin: 0;
  background: var(--htmlpress-background);
  color: var(--htmlpress-foreground);
  font: 1rem/1.5 var(--htmlpress-font);
}

/* The drawer's backdrop; it lives on body, outside every element's scope */
@media (max-width: 56rem) {
  :root[data-nav-open] body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 30;
    background: oklch(0 0 0 / 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* Medium, not the sizes' usual bold: Livemark's headings are links, which prose sets at 500 */
h1,
h2,
h3,
h4 {
  color: var(--htmlpress-prose-strong);
  font-weight: 500;
}
h1 {
  margin: 0 0 2rem;
  font-size: 2.25rem;
  line-height: 1.1111;
}
h2 {
  margin: 3rem 0 1.5rem;
  font-size: 1.5rem;
  line-height: 1.3333;
}
h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.6;
}
h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
  line-height: 1.5;
}
/* Livemark's steps: a heading marked `data-step`, led by its number in a badge */
main {
  counter-reset: step;
}
[data-step] {
  counter-increment: step;
}
[data-step]::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.5rem;
  border-radius: 999px;
  background: var(--htmlpress-primary);
  color: var(--htmlpress-primary-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}
.htmlpress-anchor {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.4em;
  overflow: hidden;
  background: currentColor;
  color: inherit;
  text-indent: 1em;
  vertical-align: middle;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.15s;
}
:hover > .htmlpress-anchor,
.htmlpress-anchor:focus {
  opacity: 0.5;
}

p,
ul,
ol,
dl,
table,
figure,
pre,
blockquote {
  margin: 0 0 1.25em;
}
/* Under :where(main), so a component's own scoped lists and links still win */
:where(main) :is(ul, ol) {
  padding-left: 1.625em;
}
:where(main) li {
  margin: 0.5em 0;
  padding-left: 0.375em;
}
:where(main li) > :is(ul, ol) {
  margin: 0.75em 0;
}
:where(main ul) > li::marker {
  color: var(--htmlpress-prose-marker);
}
:where(main ol) > li::marker {
  color: var(--htmlpress-muted-foreground);
}

a {
  color: var(--htmlpress-primary);
}
:where(main) a {
  color: var(--htmlpress-prose-strong);
  font-weight: 500;
}

strong {
  color: var(--htmlpress-prose-strong);
  font-weight: 600;
}

code,
kbd,
pre {
  font-family: var(--htmlpress-mono);
}
:not(pre) > code {
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--htmlpress-border);
  border-radius: 0.5rem;
  background: color-mix(in oklab, var(--htmlpress-muted) 70%, transparent);
  color: var(--htmlpress-prose-strong);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
}
a > code {
  color: inherit;
}
/* Livemark's code block: 13px on a 14px line rhythm, in a lightly shadowed card */
pre {
  margin: 1rem 0;
  overflow-x: auto;
  padding: 0.875rem 1rem;
  border: 1px solid var(--htmlpress-border);
  border-radius: var(--htmlpress-radius);
  background: var(--htmlpress-muted);
  box-shadow:
    0 1px 3px 0 oklch(0 0 0 / 0.1),
    0 1px 2px -1px oklch(0 0 0 / 0.1);
  color: var(--htmlpress-foreground);
  font-size: 0.8125rem;
  line-height: 1.4286;
}
kbd {
  padding: 0.1875em 0.375em;
  border-radius: 0.3125rem;
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--htmlpress-prose-strong) 10%, transparent),
    0 3px 0 color-mix(in oklab, var(--htmlpress-prose-strong) 10%, transparent);
  color: var(--htmlpress-prose-strong);
  font-family: inherit;
  font-size: 0.875em;
  font-weight: 500;
}

.htmlpress-code {
  position: relative;
  margin: 1rem 0;
}
.htmlpress-code > pre {
  margin: 0;
}
.htmlpress-code-actions {
  position: absolute;
  top: calc(0.5rem + 1px);
  right: calc(0.5rem + 1px);
  z-index: 1;
  display: flex;
  border-radius: 0.5rem;
  backdrop-filter: blur(16px);
}
.htmlpress-code-actions > button {
  display: grid;
  place-items: center;
  padding: 0.375rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--htmlpress-muted-foreground);
  cursor: pointer;
  transition: color 0.15s;
}
.htmlpress-code-actions > button:hover,
.htmlpress-code-actions > button[aria-pressed="true"] {
  color: var(--htmlpress-foreground);
}
.htmlpress-code-actions svg {
  width: 0.875rem;
  height: 0.875rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
pre[data-wrap],
pre[data-wrap] code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

blockquote {
  margin: 1.6em 0;
  padding-left: 1em;
  border-left: 0.25rem solid var(--htmlpress-border);
  color: var(--htmlpress-prose-strong);
  font-style: italic;
  font-weight: 500;
  quotes: "\201C" "\201D" "\2018" "\2019";
}
blockquote > p:first-of-type::before {
  content: open-quote;
}
blockquote > p:last-of-type::after {
  content: close-quote;
}

sub,
sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}
sup {
  top: -0.5em;
}
sub {
  bottom: -0.25em;
}

/* Livemark's table: full width, rows ruled, nothing wrapped; too wide, it scrolls sideways */
table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.25rem;
}
tr {
  border-bottom: 1px solid var(--htmlpress-border);
  transition: background 0.15s;
}
tbody tr:last-child {
  border-bottom: 0;
}
tr:hover {
  background: color-mix(in oklab, var(--htmlpress-muted) 50%, transparent);
}
th,
td {
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}
th {
  height: 2.5rem;
  padding: 0 0.5rem;
  color: var(--htmlpress-foreground);
  font-weight: 500;
}
td {
  padding: 0.5rem;
}
/* A block table's rows shrink to their content; a 100% column stretches them to fill it */
:is(th, td):last-child {
  width: 100%;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}
figure {
  margin-inline: 0;
}
figcaption {
  margin-top: 0.8571em;
  color: var(--htmlpress-muted-foreground);
  font-size: 0.875em;
  line-height: 1.4286;
}

/* A blog's index, as Livemark lists it: posts one under another, ruled apart */
.htmlpress-posts > article + article {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--htmlpress-border);
}
.htmlpress-posts h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 2rem;
}
.htmlpress-posts h2 > a {
  color: var(--htmlpress-foreground);
  text-decoration: none;
  transition: color 0.15s;
}
.htmlpress-posts h2 > a:hover {
  color: var(--htmlpress-primary);
}
.htmlpress-posts p {
  margin: 0.5rem 0 0;
  color: var(--htmlpress-muted-foreground);
  line-height: 1.5rem;
}
.htmlpress-posts h2 + p:has(> span) {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Livemark's expandable: a white card whose summary leads with a turning chevron */
:where(main) details {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--htmlpress-border);
  border-radius: var(--htmlpress-radius);
  background: var(--htmlpress-background);
  font-size: 0.875rem;
  line-height: 1.25rem;
}
:where(main) summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
:where(main) summary::-webkit-details-marker {
  display: none;
}
:where(main) summary::before {
  content: "";
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: rotate 0.15s;
}
:where(main) details[open] > summary::before {
  rotate: 90deg;
}
:where(main) details[open] > summary {
  margin-bottom: 0.75rem;
}
:where(main) details > p {
  margin: 0.25rem 0;
}
:where(main) details > :last-child {
  margin-bottom: 0;
}

hr {
  margin: 3em 0;
  border: 0;
  border-top: 1px solid var(--htmlpress-border);
}

dt {
  margin-top: 1rem;
  color: var(--htmlpress-foreground);
  font-weight: 600;
}
dt:first-child {
  margin-top: 0;
}
dd {
  margin: 0.25rem 0 0 1.5rem;
  color: var(--htmlpress-muted-foreground);
}

abbr[title],
abbr[data-title] {
  text-decoration: underline dotted;
  text-decoration-color: var(--htmlpress-muted-foreground);
  text-underline-offset: 0.2em;
  cursor: help;
}

.htmlpress-hint {
  position: absolute;
  z-index: 50;
  max-width: min(24rem, calc(100vw - 1rem));
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--htmlpress-border);
  border-radius: 0.75rem;
  background: var(--htmlpress-background);
  box-shadow: 0 4px 16px oklch(0 0 0 / 0.12);
  color: var(--htmlpress-foreground);
  font-size: 0.8125rem;
  line-height: 1.5;
  pointer-events: none;
}
.htmlpress-hint > :first-child {
  margin-top: 0;
}
.htmlpress-hint > :last-child {
  margin-bottom: 0;
}

/* Shiki writes the light theme inline and the dark one as variables; the frame stays ours */
pre.shiki {
  background-color: var(--htmlpress-muted) !important;
}
.shiki:not(pre) {
  background-color: transparent !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shiki,
  :root:not([data-theme="light"]) .shiki span {
    color: var(--shiki-dark) !important;
    font-style: var(--shiki-dark-font-style) !important;
    font-weight: var(--shiki-dark-font-weight) !important;
    text-decoration: var(--shiki-dark-text-decoration) !important;
  }
}
:root[data-theme="dark"] .shiki,
:root[data-theme="dark"] .shiki span {
  color: var(--shiki-dark) !important;
  font-style: var(--shiki-dark-font-style) !important;
  font-weight: var(--shiki-dark-font-weight) !important;
  text-decoration: var(--shiki-dark-text-decoration) !important;
}

/* Lines of a highlighted code block, so a highlighted line's background spans the block */
pre code .line {
  display: inline-block;
  width: 100%;
  min-height: 1lh;
}
pre code .line-number {
  display: inline-block;
  min-width: 2ch;
  margin-right: 1.25rem;
  color: var(--htmlpress-muted-foreground);
  text-align: right;
  user-select: none;
}

/* Line marks on a highlighted block, tinted from the theme's tones */
pre code .line.highlighted,
pre code .line.diff,
pre code .line.severity {
  margin-inline: -1.25rem;
  padding-inline: 1.25rem;
  width: calc(100% + 2.5rem);
}
pre code .line.highlighted {
  background: color-mix(in oklab, var(--htmlpress-primary) 12%, transparent);
}
pre code .line.diff.add {
  background: color-mix(in oklab, var(--htmlpress-positive) 14%, transparent);
}
pre code .line.diff.remove {
  background: color-mix(in oklab, var(--htmlpress-destructive) 14%, transparent);
}
pre code .line.severity.error {
  background: color-mix(in oklab, var(--htmlpress-destructive) 18%, transparent);
}
pre code .line.severity.warning {
  background: color-mix(in oklab, var(--htmlpress-warning) 20%, transparent);
}
/* A sign, not text, so a copied block carries no +/- */
pre code .line.diff::before {
  display: inline-block;
  width: 1.25rem;
  margin-left: -1.25rem;
  text-align: center;
  user-select: none;
}
pre code .line.diff.add::before {
  content: "+";
  color: var(--htmlpress-positive);
}
pre code .line.diff.remove::before {
  content: "−";
  color: var(--htmlpress-destructive);
}
pre.has-focused code .line:not(.focused) {
  opacity: 0.4;
  transition: opacity 0.2s;
}
pre.has-focused:hover code .line:not(.focused) {
  opacity: 1;
}
pre code mark,
pre code .highlighted-word {
  border-radius: 0.25rem;
  background: color-mix(in oklab, var(--htmlpress-primary) 18%, transparent);
  color: inherit;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--htmlpress-primary) 40%, transparent);
}

/* A titled block: the caption is its title bar, joined to the block's frame */
/* The caption is Livemark's 38px title bar, and a titled block's actions sit in it */
.htmlpress-code-figure {
  position: relative;
  margin: 1rem 0;
}
.htmlpress-code-figure .htmlpress-code {
  position: static;
}
.htmlpress-code-figure .htmlpress-code-actions {
  top: calc(0.375rem + 1px);
  backdrop-filter: none;
}
.htmlpress-code-figure > figcaption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.4375rem;
  margin: 0;
  padding: 0 4.5rem 0 1rem;
  border: 1px solid var(--htmlpress-border);
  border-radius: var(--htmlpress-radius) var(--htmlpress-radius) 0 0;
  background: var(--htmlpress-muted);
  color: var(--htmlpress-muted-foreground);
  font: 500 0.75rem/1rem var(--htmlpress-font);
  text-align: left;
}
.htmlpress-code-figure pre,
.htmlpress-code-figure .htmlpress-code {
  margin: 0;
}
.htmlpress-code-figure pre {
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.htmlpress-code-figure > figcaption svg {
  flex-shrink: 0;
  width: 0.875rem;
  height: 0.875rem;
}

/* A block of N lines shows that many; without the script it scrolls, with it the rest
   waits behind an Expand bar */
pre[data-collapse] {
  max-height: calc(var(--htmlpress-code-lines) * 1lh + 1.75rem);
  overflow-y: auto;
}
pre[data-collapse][data-collapsible] {
  overflow-y: hidden;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
pre[data-collapse][data-expanded] {
  max-height: none;
  border-radius: var(--htmlpress-radius);
}
.htmlpress-code > .htmlpress-expand {
  position: static;
  display: block;
  width: 100%;
  padding: 0.375rem;
  border: 1px solid var(--htmlpress-border);
  border-top: 0;
  border-radius: 0 0 var(--htmlpress-radius) var(--htmlpress-radius);
  background: var(--htmlpress-muted);
  color: var(--htmlpress-muted-foreground);
  opacity: 1;
}
.htmlpress-code > .htmlpress-expand:hover {
  color: var(--htmlpress-foreground);
}

/* A heading for the table of contents only: collapsed where it stands, not hidden, so
   its link still scrolls here */
:is(h2, h3, h4)[data-toc="only"] {
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip-path: inset(50%);
}

/* An image for one theme only: the light one shows until the reader's or the toggle's
   theme is dark */
img[data-theme="dark"] {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img[data-theme="dark"] {
    display: revert;
  }
  :root:not([data-theme="light"]) img[data-theme="light"] {
    display: none;
  }
}
:root[data-theme="dark"] img[data-theme="dark"] {
  display: revert;
}
:root[data-theme="dark"] img[data-theme="light"] {
  display: none;
}

/* The search query's matches on the page a result opened, set by htmlpress-search */
::highlight(htmlpress-search) {
  background-color: var(--htmlpress-highlight);
  color: var(--htmlpress-highlight-foreground);
}
.htmlpress-zoomable {
  cursor: zoom-in;
}
.htmlpress-zoom {
  max-width: 95vw;
  max-height: 95vh;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-out;
}
.htmlpress-zoom::backdrop {
  background: oklch(0 0 0 / 0.7);
}
.htmlpress-zoom img {
  display: block;
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}
.htmlpress-sortable th {
  cursor: pointer;
  user-select: none;
}
/* As in Livemark, a column shows its arrow only once it sorts the table */
.htmlpress-sortable th[aria-sort]::after {
  margin-left: 0.25rem;
  color: var(--htmlpress-muted-foreground);
}
.htmlpress-sortable th[aria-sort="ascending"]::after {
  content: "↑";
}
.htmlpress-sortable th[aria-sort="descending"]::after {
  content: "↓";
}

@scope (htmlpress-aside) {
  :scope {
    display: block;
    position: sticky;
    top: 5rem;
    align-self: start;
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.25rem;
    scrollbar-width: none;
  }
  :scope:not(:has(> *)) {
    display: none;
  }

  @media (max-width: 80rem) {
    :scope {
      display: none;
    }
  }
}

@scope (htmlpress-back-to-top) {
  :scope {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 30;
    transition:
      opacity 0.2s,
      translate 0.2s;
  }
  :scope:not([data-visible]) {
    opacity: 0;
    translate: 0 0.5rem;
    pointer-events: none;
  }
  a {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 999px;
    background: var(--htmlpress-background);
    box-shadow:
      0 4px 6px -1px oklch(0 0 0 / 0.1),
      0 2px 4px -2px oklch(0 0 0 / 0.1);
    color: var(--htmlpress-foreground);
  }
  svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

@scope (htmlpress-banner) {
  :scope {
    display: block;
    background: var(--htmlpress-banner);
    color: var(--htmlpress-banner-foreground);
  }
  p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 1rem;
    font: 0.75rem/1rem var(--htmlpress-mono);
    letter-spacing: 0.02em;
  }
  p > span:first-child::after {
    content: "·";
    margin-left: 0.5rem;
    opacity: 0.6;
  }
  a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: inherit;
    text-underline-offset: 0.25em;
  }
  a:hover {
    text-decoration: none;
  }
  svg[aria-hidden] {
    width: 0.75rem;
    height: 0.75rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: translate 0.2s;
  }
  a:hover svg {
    translate: 0.125rem 0;
  }
  @media (max-width: 40rem) {
    p > span:first-child::after,
    a > span {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }
  }
}

@scope (htmlpress-brand) {
  :scope {
    display: block;
    min-width: 0;
  }
  a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
  }
  a:has(small) {
    align-items: end;
  }
  img,
  svg {
    flex-shrink: 0;
    width: auto;
    height: 1.625rem;
    margin-left: -1px;
  }
  svg {
    width: 1.625rem;
    color: var(--htmlpress-primary);
  }
  a:has(small) :is(img, svg) {
    margin-bottom: 0.25rem;
  }
  span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-bottom: 1px;
  }
  small {
    overflow: hidden;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1rem;
    opacity: 0.8;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@scope (htmlpress-breadcrumbs) {
  :scope {
    display: block;
    margin-bottom: 1rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.875rem;
  }
  ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li {
    margin: 0;
    padding: 0;
  }
  li + li::before {
    content: "/";
    margin-right: 0.375rem;
    opacity: 0.6;
  }
  a {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
  }
  a:hover {
    color: var(--htmlpress-foreground);
  }
  [aria-current="page"] {
    color: var(--htmlpress-foreground);
    font-weight: 500;
  }
}

@scope (htmlpress-byline) {
  :scope {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    margin: -1rem 0 1.5rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
  span {
    display: inline-flex;
    align-items: center;
    white-space: pre;
  }
  svg {
    flex-shrink: 0;
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.375rem;
  }
}

@scope (htmlpress-footer) {
  :scope {
    display: block;
    margin-top: 3rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.875rem;
    line-height: 1.25rem;
    text-align: center;
  }
  p {
    margin: 0;
  }
  [aria-label="love"] {
    color: oklch(0.637 0.237 25.331);
  }
  a {
    color: inherit;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
  }
  a:hover {
    color: var(--htmlpress-foreground);
  }
}

@scope (htmlpress-header) {
  :scope {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    height: 4rem;
    padding: 0 0.25rem 0 1rem;
    border-bottom: 1px solid var(--htmlpress-border);
    background: var(--htmlpress-background);
    view-transition-name: htmlpress-header;
  }
  :scope htmlpress-brand,
  :scope htmlpress-nav-toggle {
    display: none;
  }
  :root[data-scripted] :scope htmlpress-nav-toggle {
    display: block;
    margin-right: 1rem;
  }
  :root:not(:has(#htmlpress-sidebar)) :scope htmlpress-nav-toggle {
    display: none;
  }
  :scope htmlpress-links {
    flex: 1;
    align-self: stretch;
  }
  :scope htmlpress-search,
  :scope htmlpress-theme-toggle {
    margin-left: auto;
  }
  /* Search, when the layout has it, takes the push to the right edge */
  :scope htmlpress-search ~ htmlpress-theme-toggle {
    margin-left: 0.25rem;
  }
  :scope :is(htmlpress-search, htmlpress-theme-toggle) ~ htmlpress-language,
  :scope
    :is(htmlpress-search, htmlpress-theme-toggle, htmlpress-language)
    ~ htmlpress-shortcuts {
    margin-left: 0.25rem;
  }

  /* Once the aside shows, the search icon meets its left edge: the aside's 14rem, the
     page's 2.5rem padding and the search's own padding and border, less this padding
     and the 2.25rem each control after the search takes */
  @media (width > 80rem) {
    :scope {
      --header-language: 0rem;
      --header-shortcuts: 0rem;
    }
    :scope:has(> htmlpress-language) {
      --header-language: 2.25rem;
    }
    :scope:has(> htmlpress-shortcuts) {
      --header-shortcuts: 2.25rem;
    }
    :scope htmlpress-search {
      width: calc(
        16.875rem + 1px - 2.25rem - var(--header-language) - var(--header-shortcuts)
      );
    }
    :scope htmlpress-search > button {
      width: 100%;
    }
  }

  /* Livemark's phone header: the brand, then search, theme, language and the menu at
     the far end; the links move into the drawer's sections */
  @media (max-width: 56rem) {
    :scope {
      gap: 0.25rem;
      padding: 0 0.5rem 0 1rem;
    }
    :scope htmlpress-brand {
      display: block;
      flex: 0 1 auto;
      min-width: 0;
      margin-right: auto;
    }
    :scope htmlpress-links {
      display: none;
    }
    :root[data-scripted] :scope htmlpress-nav-toggle {
      order: 1;
      margin-right: 0;
    }
    :scope htmlpress-search ~ htmlpress-theme-toggle,
    :scope :is(htmlpress-search, htmlpress-theme-toggle) ~ htmlpress-language,
    :scope
      :is(htmlpress-search, htmlpress-theme-toggle, htmlpress-language)
      ~ htmlpress-shortcuts {
      margin-left: 0;
    }
  }
}

@scope (htmlpress-language) {
  :scope {
    position: relative;
    display: block;
  }
  details {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  summary {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    color: var(--htmlpress-muted-foreground);
    cursor: pointer;
    list-style: none;
  }
  summary::-webkit-details-marker {
    display: none;
  }
  summary:hover,
  details[open] > summary {
    margin: 0;
    background: var(--htmlpress-muted);
  }
  summary > svg {
    width: 1rem;
    height: 1rem;
  }
  summary + div {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 30;
    min-width: 11rem;
    padding: 0.25rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.75rem;
    background: var(--htmlpress-background);
    box-shadow: 0 8px 24px
      color-mix(in oklab, var(--htmlpress-foreground) 12%, transparent);
  }
  p {
    margin: 0;
    padding: 0.375rem 0.625rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
  }
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li + li {
    margin-top: 0;
  }
  a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    color: var(--htmlpress-foreground);
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
  }
  a:hover {
    background: var(--htmlpress-muted);
  }
  a[aria-current] {
    color: var(--htmlpress-primary);
    font-weight: 500;
  }
  a > svg {
    flex: none;
    width: 1.125rem;
    height: 0.75rem;
    border-radius: 2px;
    box-shadow: 0 0 0 1px var(--htmlpress-border);
  }
}

@scope (htmlpress-links) {
  :scope {
    display: block;
    min-width: 0;
  }
  nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
    padding: 0 1.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.25rem;
    scrollbar-width: none;
  }
  a {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.375rem;
    color: color-mix(
      in srgb,
      var(--htmlpress-foreground) 80%,
      var(--htmlpress-background)
    );
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.15s;
  }
  a:hover {
    color: var(--htmlpress-foreground);
  }
  a[aria-current="page"] {
    margin-bottom: -0.125rem;
    padding-bottom: 0.125rem;
    border-bottom: 2px solid currentColor;
    color: var(--htmlpress-foreground);
    font-weight: 500;
  }
  small {
    color: var(--htmlpress-muted-foreground);
    font-size: inherit;
  }
  small::before {
    content: "(";
  }
  small::after {
    content: ")";
  }
  a > svg {
    width: 0.875rem;
    height: 0.875rem;
  }
  a[hidden] {
    display: none;
  }
  /* The script folds what does not fit into it, so nothing needs to scroll */
  :scope:defined nav {
    overflow: visible;
  }
  details {
    position: relative;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  summary {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: color-mix(
      in srgb,
      var(--htmlpress-foreground) 80%,
      var(--htmlpress-background)
    );
    cursor: pointer;
    list-style: none;
  }
  summary::-webkit-details-marker {
    display: none;
  }
  summary:hover {
    color: var(--htmlpress-foreground);
  }
  summary svg {
    width: 0.875rem;
    height: 0.875rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.15s;
  }
  details[open] > summary {
    margin: 0;
  }
  details[open] [data-icon="chevron"] {
    transform: rotate(180deg);
  }
  [data-icon="dots"] {
    display: none;
  }
  details > div {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 11rem;
    padding: 0.375rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: var(--htmlpress-radius);
    background: var(--htmlpress-background);
    box-shadow: var(--htmlpress-shadow);
  }
  details > div > a {
    padding: 0.375rem 0.625rem;
    border-radius: calc(var(--htmlpress-radius) - 0.25rem);
  }
  details > div > a:hover {
    background: var(--htmlpress-muted);
  }
  details > div > a[aria-current="page"] {
    margin: 0;
    padding-bottom: 0.375rem;
    border-bottom: 0;
  }
  @media (min-width: 80rem) {
    nav {
      gap: 2rem;
    }
  }
  /* On a phone the sidebar drawer lists the sections instead */
  @media (max-width: 56rem) {
    nav {
      padding: 0;
    }
    /* A phone has room for the menu's icon only */
    summary :is(span, [data-icon="chevron"]) {
      display: none;
    }
    summary [data-icon="dots"] {
      display: block;
      width: 1.25rem;
      height: 1.25rem;
    }
    a[data-section] {
      display: none;
    }
  }
}

@scope (htmlpress-main) {
  :scope {
    display: block;
    min-width: 0;
  }
}

@scope (htmlpress-nav) {
  :scope {
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    display: block;
    min-width: 0;
  }
  nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  ul {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li + li {
    margin-top: 0;
  }
  [data-label] {
    display: flex;
    align-items: center;
    height: 2rem;
    margin: 0.5rem 0 -0.25rem;
    padding: 0 0.5rem;
    color: color-mix(in oklab, var(--htmlpress-foreground) 70%, transparent);
    font: 500 0.75rem/1rem var(--htmlpress-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  ul[data-links] + [data-label],
  [data-label]:has(+ ul[data-links]) {
    margin-top: 1.5rem;
  }
  a > svg,
  summary > svg {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
  }
  /* The section picker: shown on a phone, and wider only when a section sits in the
     sidebar; a header section is listed only where the header has no room for it */
  [data-sections]:not(:has([data-position="sidebar"])) {
    display: none;
  }
  [data-sections] [data-position="header"] {
    display: none;
  }
  [data-sections]:has([data-position="sidebar"]) + [data-label] {
    margin-top: 1.25rem;
  }
  [data-sections] details {
    position: relative;
    margin-top: 0.25rem;
  }
  [data-sections] details > summary {
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 999px;
    color: var(--htmlpress-foreground);
    font-weight: 400;
  }
  [data-sections] details > summary > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  [data-sections] details > summary::after {
    position: static;
    width: 1rem;
    height: 1rem;
    color: var(--htmlpress-muted-foreground);
    mask-size: 1rem;
    rotate: 0deg;
  }
  [data-sections] details[open] > summary::after {
    rotate: 180deg;
  }
  [data-sections] details > ul {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    left: 0;
    z-index: 10;
    margin: 0;
    padding: 0.25rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.75rem;
    background: var(--htmlpress-background);
    box-shadow:
      0 4px 6px -1px oklch(0 0 0 / 0.1),
      0 2px 4px -2px oklch(0 0 0 / 0.1);
    translate: none;
  }
  @media (max-width: 56rem) {
    [data-sections] + [data-label] {
      margin-top: 1.25rem;
    }
    [data-sections]:not(:has([data-position="sidebar"])),
    [data-sections] [data-position="header"] {
      display: block;
    }
  }
  /* A block, not a flex row: only a block's own text can end in Livemark's ellipsis */
  a {
    display: block;
    height: 2rem;
    overflow: hidden;
    padding: 0 0.75rem;
    border: 0 solid transparent;
    border-radius: 1rem;
    color: var(--htmlpress-foreground);
    line-height: 2rem;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  a > svg {
    margin-right: 0.5rem;
    vertical-align: -0.1875rem;
  }
  /* A color, not opacity: text under opacity loses subpixel antialiasing and reads blurred */
  a:not([aria-current="page"]) {
    color: color-mix(in srgb, var(--htmlpress-foreground) 75%, var(--htmlpress-muted));
  }
  a:hover,
  summary:not(:has(> a)):hover {
    background: color-mix(in oklab, var(--htmlpress-foreground) 4%, transparent);
  }
  a[data-untranslated] small {
    margin-left: 0.375rem;
    padding: 0 0.25rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.25rem;
    color: var(--htmlpress-muted-foreground);
    font-family: var(--htmlpress-mono);
    font-size: 0.625rem;
    text-transform: uppercase;
    vertical-align: 0.0625rem;
  }
  a[aria-current="page"] {
    border-width: 1px;
    line-height: calc(2rem - 2px);
    border-color: color-mix(in oklab, var(--htmlpress-primary) 20%, transparent);
    background: color-mix(in oklab, var(--htmlpress-primary) 2%, transparent);
    color: var(--htmlpress-primary);
    font-weight: 500;
  }
  :root[data-theme="dark"] :scope a[aria-current="page"] {
    background: color-mix(in oklab, var(--htmlpress-primary) 5%, transparent);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) :scope a[aria-current="page"] {
      background: color-mix(in oklab, var(--htmlpress-primary) 5%, transparent);
    }
  }
  a[aria-current="page"] > svg {
    stroke-width: 2.5;
  }
  details {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  summary {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 2rem;
    margin: 0;
    padding: 0 0.75rem;
    border-radius: 1rem;
    color: inherit;
    font-size: inherit;
    font-weight: 400;
    list-style: none;
    cursor: pointer;
  }
  summary:has(> a) {
    padding: 0;
  }
  summary > a {
    flex: 1;
    min-width: 0;
    padding-right: 2rem;
  }
  /* A blog's recent posts and a changelog's releases: in Livemark a fixed heading, faded
     like the rows around it, with no chevron to fold it */
  li > details > summary {
    color: color-mix(in srgb, var(--htmlpress-foreground) 75%, var(--htmlpress-muted));
    pointer-events: none;
  }
  li > details > summary::after {
    display: none;
  }
  summary::-webkit-details-marker {
    display: none;
  }
  summary::after {
    content: "";
    position: absolute;
    top: 0.375rem;
    right: 0.25rem;
    width: 1.375rem;
    height: 1.25rem;
    border-radius: 0.5rem;
    background: currentColor;
    mask: var(--chevron) center / 0.875rem no-repeat;
    rotate: -90deg;
    transition: rotate 0.15s;
  }
  li > details {
    margin: 0;
  }
  details[open] > summary {
    margin-bottom: 0;
  }
  details[open] > summary::after {
    rotate: 0deg;
  }
  details ul {
    margin: 0 0.875rem;
    padding: 0.125rem 0.625rem;
    border-left: 1px solid var(--htmlpress-border);
    translate: 1px;
  }
  details ul a {
    height: 1.75rem;
    line-height: 1.75rem;
    translate: -1px;
  }
  details ul a[aria-current="page"] {
    line-height: calc(1.75rem - 2px);
  }
}

@scope (htmlpress-nav-toggle) {
  button {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--htmlpress-foreground);
    cursor: pointer;
  }
  button:hover {
    background: var(--htmlpress-muted);
  }
  svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

@scope (htmlpress-page) {
  :scope {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14rem;
    gap: 2.5rem;
    padding: 2.5rem;
  }
  :scope > main {
    justify-self: center;
    width: 100%;
    min-width: 0;
    max-width: var(--htmlpress-width);
    color: var(--htmlpress-prose);
    line-height: 1.75;
    overflow-wrap: break-word;
  }
  :scope > main > :first-child {
    margin-top: 0;
  }

  /* The content meets the header's first link: its 1rem padding, then, while the nav
     toggle shows, the 2rem toggle and its 1rem margin, then the links' 1.5rem padding.
     The default width is what that leaves on a 100rem viewport, gapped as much from the toc */
  @media (width > 56rem) {
    :scope > main {
      justify-self: start;
    }
    :root[data-scripted]:has(#htmlpress-sidebar) :scope {
      padding-left: 5.5rem;
      column-gap: 5.5rem;
    }
    :root[data-nav-collapsed] :scope > main {
      max-width: calc(var(--htmlpress-width) + var(--htmlpress-nav-width));
    }
  }

  @media (max-width: 80rem) {
    :scope {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @media (max-width: 48rem) {
    :scope {
      padding: 2rem 1rem 1rem;
    }
  }
}

@scope (htmlpress-page-toc) {
  :scope {
    display: block;
  }
  p {
    margin: 0 0 0.75rem;
    color: var(--htmlpress-foreground);
    font-weight: 500;
  }
  ul {
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--htmlpress-border);
    list-style: none;
  }
  li {
    margin: 0;
    padding: 0;
  }
  a {
    display: block;
    margin-left: -1px;
    padding: 0.375rem 0 0.375rem 0.75rem;
    border-left: 1px solid transparent;
    color: var(--htmlpress-muted-foreground);
    font-weight: inherit;
    text-decoration: none;
  }
  a:hover {
    color: var(--htmlpress-foreground);
  }
  a[data-level="3"] {
    padding-left: 1.5rem;
  }
  a[data-level="4"] {
    padding-left: 2.5rem;
  }
  a[aria-current="true"] {
    border-left-color: var(--htmlpress-primary);
    color: var(--htmlpress-primary);
    font-weight: 500;
  }
}

/* Livemark's pager: cards sharing the row, one alone filling it, each label led by its
   chevron (Lucide, ISC, as a mask so it takes the label's colour) */
@scope (htmlpress-pager) {
  :scope {
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E");
    display: block;
    margin-top: 2.5rem;
  }
  nav {
    display: flex;
    gap: 1rem;
  }
  a {
    flex: 1;
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: var(--htmlpress-radius);
    box-shadow:
      0 1px 3px 0 oklch(0 0 0 / 0.1),
      0 1px 2px -1px oklch(0 0 0 / 0.1);
    color: var(--htmlpress-foreground);
    font-weight: 500;
    line-height: 1.5rem;
    text-decoration: none;
    transition: background 0.15s;
  }
  a:hover {
    background: color-mix(in oklab, var(--htmlpress-muted) 50%, transparent);
  }
  small {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
  }
  small::before,
  small::after {
    width: 1rem;
    height: 1rem;
    background: currentColor;
    mask: var(--chevron) center / contain no-repeat;
  }
  [rel="prev"] small::before {
    content: "";
  }
  [rel="next"] {
    text-align: right;
  }
  [rel="next"] small {
    justify-content: flex-end;
  }
  [rel="next"] small::after {
    content: "";
    rotate: 180deg;
  }
}

@scope (htmlpress-search) {
  :scope {
    display: block;
  }
  /* The build renders the button, but only the script makes it do anything */
  :root:not([data-scripted]) :scope {
    display: none;
  }
  :scope > button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 10rem;
    height: 2.25rem;
    padding: 0 0.625rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 999px;
    background: color-mix(in oklab, var(--htmlpress-muted) 50%, transparent);
    box-shadow: 0 1px 2px 0 oklch(0 0 0 / 0.05);
    color: var(--htmlpress-muted-foreground);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.25rem;
    cursor: pointer;
    transition: background 0.15s;
  }
  :scope > button:hover {
    background: var(--htmlpress-muted);
  }
  :scope > button span {
    flex: 1;
    text-align: left;
  }
  :scope > button kbd {
    padding: 0.125rem 0.375rem;
    box-shadow: none;
    color: inherit;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.25rem;
    background: var(--htmlpress-background);
    font: 0.625rem/1.4 var(--htmlpress-mono);
  }
  svg {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  dialog {
    position: fixed;
    inset: 33.333vh auto auto 50%;
    width: 28rem;
    max-width: calc(100% - 2rem);
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 1.5rem;
    background: var(--htmlpress-background);
    box-shadow: 0 0 0 1px
      color-mix(in oklab, var(--htmlpress-foreground) 10%, transparent);
    color: var(--htmlpress-foreground);
    font-size: 0.875rem;
    line-height: 1.25rem;
    transform: translateX(-50%);
    transition:
      opacity 0.1s,
      scale 0.1s,
      overlay 0.1s allow-discrete,
      display 0.1s allow-discrete;
  }
  dialog:not([open]) {
    opacity: 0;
    scale: 0.95;
  }
  dialog::backdrop {
    background: oklch(0 0 0 / 0.1);
    backdrop-filter: blur(4px);
    transition:
      opacity 0.1s,
      overlay 0.1s allow-discrete,
      display 0.1s allow-discrete;
  }
  dialog:not([open])::backdrop {
    opacity: 0;
  }
  @starting-style {
    dialog[open] {
      opacity: 0;
      scale: 0.95;
    }
    dialog[open]::backdrop {
      opacity: 0;
    }
  }
  .command {
    display: flex;
    flex-direction: column;
    padding: 0.25rem;
    border-radius: 1rem;
  }

  .field {
    display: flex;
    align-items: center;
    height: 3rem;
    border: 1px solid color-mix(in oklab, var(--htmlpress-border) 30%, transparent);
    border-radius: 999px;
    background: color-mix(in oklab, var(--htmlpress-border) 30%, transparent);
    color: var(--htmlpress-muted-foreground);
  }
  dialog .field {
    margin: 0.25rem 0.25rem 0.5rem;
  }
  .field > svg {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0 0.375rem 0 0.75rem;
    opacity: 0.5;
  }
  input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: none;
    background: none;
    color: var(--htmlpress-foreground);
    font: inherit;
    font-size: 1.125rem;
    line-height: 1.75rem;
  }
  input::placeholder {
    color: var(--htmlpress-muted-foreground);
  }
  .clear {
    display: flex;
    padding: 0 0.75rem 0 0.375rem;
    border: 0;
    background: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s;
  }
  .clear:hover {
    opacity: 1;
  }
  .clear[hidden] {
    display: none;
  }

  .list {
    max-height: 20rem;
    overflow: hidden auto;
    outline: none;
    scroll-padding-block: 0.25rem;
  }
  .empty {
    margin: 0;
    padding: 1.5rem 0;
    font-size: 0.875rem;
    text-align: center;
  }
  [role="group"] {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.25rem;
  }
  .heading {
    padding: 0.375rem 0.5rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1rem;
  }
  .heading + [role="option"] {
    margin-top: -0.5rem;
  }
  [role="option"] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.5rem;
    border-radius: calc(1rem - 4px);
    background: color-mix(in oklab, var(--htmlpress-muted) 50%, transparent);
    color: var(--htmlpress-foreground);
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
  }
  [role="option"][aria-selected="true"] {
    background: color-mix(in oklab, var(--htmlpress-primary) 10%, transparent);
  }
  [role="option"] > svg {
    align-self: flex-start;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    opacity: 0.6;
  }
  [role="option"] > span {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
  }
  strong {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5rem;
  }
  strong + span {
    display: -webkit-box;
    overflow: hidden;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.875rem;
    line-height: 1.25rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
  mark {
    background: none;
    color: var(--htmlpress-foreground);
    font-weight: 500;
  }

  .footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--htmlpress-border);
    color: var(--htmlpress-muted-foreground);
    font-size: 0.875rem;
  }
  .footer span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
  }
  .footer kbd {
    padding: 0.125rem 0.375rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.25rem;
    box-shadow: none;
    background: var(--htmlpress-muted);
    color: inherit;
    font: 0.75rem/1rem var(--htmlpress-mono);
  }

  /* The header takeover below 56rem: htmlpress-search stays unpositioned, so the bar
     covers the sticky header it sits in */
  .bar {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--htmlpress-background);
  }
  .bar[hidden] {
    display: none;
  }
  .row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
    padding: 0 0.5rem 0 0.25rem;
  }
  .row .field {
    flex: 1;
    border-color: transparent;
    background: transparent;
  }
  .close {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--htmlpress-muted-foreground);
    cursor: pointer;
    transition:
      background 0.15s,
      color 0.15s;
  }
  .close:hover {
    background: var(--htmlpress-muted);
    color: var(--htmlpress-foreground);
  }
  .close svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  .panel {
    position: fixed;
    inset: 4rem 0 0;
    display: flex;
    flex-direction: column;
    padding: 0.25rem;
    border-top: 1px solid var(--htmlpress-border);
    background: var(--htmlpress-background);
  }
  .panel .list {
    flex: 1;
    max-height: none;
    overscroll-behavior: contain;
  }

  /* Set by the header's links when they run out of room */
  htmlpress-header[data-compact] :scope > button {
    width: 2.25rem;
    padding: 0;
    box-shadow: none;
    justify-content: center;
    border: 0;
    background: none;
  }
  htmlpress-header[data-compact] :scope > button :is(span, kbd) {
    display: none;
  }
  @media (max-width: 56rem) {
    /* Livemark's compact search: the same bordered pill, cut down to its icon */
    :scope > button {
      width: auto;
      padding: 0 0.625rem;
      justify-content: center;
    }
    :scope > button span,
    :scope > button kbd {
      display: none;
    }
  }
}

/* Livemark's phone sheet: a dialog from below holding rows to pick from */
@scope (htmlpress-sheet) {
  :scope {
    display: contents;
  }
  dialog {
    inset: auto 0 0;
    display: none;
    flex-direction: column;
    width: 100%;
    max-width: none;
    max-height: 85dvh;
    margin: 0;
    padding: 0;
    border: 1px solid var(--htmlpress-border);
    border-bottom: 0;
    border-radius: 1.5rem 1.5rem 0 0;
    background: var(--htmlpress-background);
    color: var(--htmlpress-foreground);
    font: 400 0.875rem/1.25rem var(--htmlpress-font);
    transition: translate 0.25s ease-out;
  }
  dialog[open] {
    display: flex;
    animation: htmlpress-sheet-up 0.25s ease-out;
  }
  dialog[data-closing] {
    translate: 0 100%;
    transition-timing-function: ease-in;
    transition-duration: 0.2s;
  }
  dialog[data-dragging] {
    transition: none;
  }
  dialog::backdrop {
    background: oklch(0 0 0 / 0.1);
    backdrop-filter: blur(4px);
    animation: htmlpress-sheet-fade 0.25s ease-out;
    transition: opacity 0.2s ease-in;
  }
  dialog[data-closing]::backdrop {
    opacity: 0;
  }
  dialog > hr {
    flex-shrink: 0;
    width: 2.25rem;
    height: 0.25rem;
    margin: 0.5rem auto 0;
    border: 0;
    border-radius: 999px;
    background: var(--htmlpress-border);
  }
  /* The grips the finger drags; the body keeps its own scrolling */
  dialog > :is(hr, header) {
    touch-action: none;
  }
  header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1rem 0.5rem;
  }
  h2 {
    margin: 0;
    overflow: hidden;
    color: var(--htmlpress-foreground);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  header > button {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin: 0 -0.5rem 0 auto;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--htmlpress-foreground);
    cursor: pointer;
  }
  header > button svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  dialog > div {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.5rem 1rem max(1.5rem, env(safe-area-inset-bottom));
    outline: none;
  }
  svg {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  svg[data-flag] {
    height: 0.75rem;
    border-radius: 2px;
    box-shadow: 0 0 0 1px var(--htmlpress-border);
  }
  [role="tablist"] {
    display: flex;
    height: 2.25rem;
    margin-bottom: 0.5rem;
    padding: 3px;
    border-radius: 999px;
    background: var(--htmlpress-muted);
  }
  [role="tab"] {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: none;
    color: color-mix(
      in oklab,
      var(--htmlpress-foreground) 60%,
      var(--htmlpress-background)
    );
    font: 500 0.875rem/1.25rem var(--htmlpress-font);
    cursor: pointer;
  }
  [role="tab"][aria-selected="true"] {
    background: var(--htmlpress-background);
    color: var(--htmlpress-foreground);
  }
  ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 -0.5rem;
    padding: 0;
    list-style: none;
  }
  ul[hidden] {
    display: none;
  }
  li,
  li + li {
    margin: 0;
    padding: 0;
  }
  ul :is(a, button) {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    height: 2.5rem;
    padding: 0 0.5rem;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--htmlpress-foreground);
    font: 400 1rem/1.5rem var(--htmlpress-font);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }
  ul :is(a, button):hover,
  ul :is(a, button):is([aria-current="true"], [aria-current="page"]) {
    background: var(--htmlpress-muted);
  }
  ul :is(a, button):is([aria-current="true"], [aria-current="page"]) {
    font-weight: 500;
  }
  /* The chosen row's tick, drawn here so a host only marks it with aria-current */
  ul :is(a, button):is([aria-current="true"], [aria-current="page"])::after {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-left: auto;
    background: var(--htmlpress-primary);
    content: "";
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
      center / contain no-repeat;
  }
  ul :is(a, button) > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  ul [data-level="3"] > span {
    padding-left: 1rem;
  }
}

@keyframes htmlpress-sheet-up {
  from {
    translate: 0 100%;
  }
}

@keyframes htmlpress-sheet-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  htmlpress-sheet dialog,
  htmlpress-sheet dialog::backdrop {
    animation: none;
    transition: none;
  }
}

@scope (htmlpress-shell) {
  :scope {
    display: grid;
    grid-template-columns: var(--htmlpress-nav-width) minmax(0, 1fr);
    min-height: 100dvh;
    transition: grid-template-columns 0.2s;
  }
  :root[data-nav-collapsed] :scope {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  @media (max-width: 56rem) {
    :scope {
      display: block;
    }
  }
}

@scope (htmlpress-shortcuts) {
  /* Only the script runs a row's key, and a phone has no keyboard to press them on */
  :root:not([data-scripted]) :scope {
    display: none;
  }
  :scope {
    position: relative;
    display: block;
  }
  details {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  summary {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    color: var(--htmlpress-muted-foreground);
    cursor: pointer;
    list-style: none;
  }
  summary::-webkit-details-marker {
    display: none;
  }
  summary:hover,
  details[open] > summary {
    margin: 0;
    background: var(--htmlpress-muted);
  }
  svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  summary + div {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 30;
    min-width: 13rem;
    padding: 0.25rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.75rem;
    background: var(--htmlpress-background);
    box-shadow: 0 8px 24px
      color-mix(in oklab, var(--htmlpress-foreground) 12%, transparent);
  }
  p {
    margin: 0;
    padding: 0.375rem 0.625rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
  }
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li,
  li + li {
    margin: 0;
    padding: 0;
  }
  button {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.375rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: var(--htmlpress-foreground);
    font: 400 0.875rem/1.25rem var(--htmlpress-font);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
  }
  button:hover:enabled {
    background: var(--htmlpress-muted);
  }
  button:disabled {
    opacity: 0.5;
    cursor: default;
  }
  span {
    flex: 1;
  }
  kbd {
    min-width: 1.25rem;
    padding: 0.125rem 0.25rem;
    border: 0;
    border-radius: 0.25rem;
    box-shadow: none;
    background: var(--htmlpress-muted);
    color: var(--htmlpress-muted-foreground);
    font: 500 0.75rem/1rem var(--htmlpress-font);
    text-align: center;
  }

  @media (max-width: 56rem) {
    :scope {
      display: none;
    }
  }
}

@scope (htmlpress-sidebar) {
  :scope {
    display: block;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    padding: 0.5rem 0.5rem 2rem;
    border-right: 1px solid var(--htmlpress-border);
    background: var(--htmlpress-muted);
    font-size: 0.875rem;
    line-height: 1.43;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.2s;
    view-transition-name: htmlpress-sidebar;
  }
  :scope:hover,
  :scope:focus-within {
    scrollbar-color: color-mix(in oklch, var(--htmlpress-foreground) 20%, transparent)
      transparent;
  }
  /* Safari ignores scrollbar-color; Chromium ignores these once it is set */
  :scope::-webkit-scrollbar {
    width: 8px;
  }
  :scope::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 9999px;
  }
  :scope:hover::-webkit-scrollbar-thumb,
  :scope:focus-within::-webkit-scrollbar-thumb {
    background: color-mix(in oklch, var(--htmlpress-foreground) 20%, transparent);
  }
  :scope htmlpress-brand {
    display: flex;
    align-items: center;
    height: 3rem;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
  }

  @media (width > 56rem) {
    :scope {
      width: var(--htmlpress-nav-width);
      transition:
        translate 0.2s,
        visibility 0.2s,
        scrollbar-color 0.2s;
    }
    :root[data-nav-collapsed] :scope {
      visibility: hidden;
      translate: -100%;
    }
  }

  @media (max-width: 56rem) {
    :scope {
      position: static;
      height: auto;
      border-right: 0;
      border-bottom: 1px solid var(--htmlpress-border);
    }
    :root:not([data-scripted]:has(htmlpress-nav-toggle)) :scope htmlpress-brand {
      display: none;
    }

    /* With the script the sidebar becomes a drawer; without it, it stays above the page */
    :root[data-scripted]:has(htmlpress-nav-toggle) :scope {
      position: fixed;
      inset: 0 auto 0 0;
      z-index: 40;
      width: min(17.5rem, 85vw);
      height: 100dvh;
      border-right: 1px solid var(--htmlpress-border);
      translate: -100%;
      transition:
        translate 0.2s,
        scrollbar-color 0.2s;
    }
    :root[data-scripted]:has(htmlpress-nav-toggle)[data-nav-open] :scope {
      translate: 0;
      box-shadow: 0 0 2rem oklch(0 0 0 / 0.2);
    }
  }
}

@scope (htmlpress-skip) {
  a {
    position: absolute;
    left: -100vw;
  }
  a:focus {
    left: 1rem;
    top: 1rem;
    z-index: 50;
  }
}

@scope (htmlpress-theme-toggle) {
  /* The build renders the menu, but only the script makes its choices do anything */
  :root:not([data-scripted]) :scope {
    display: none;
  }
  :scope {
    position: relative;
    display: block;
  }
  details {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  summary {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    color: var(--htmlpress-muted-foreground);
    cursor: pointer;
    list-style: none;
  }
  summary::-webkit-details-marker {
    display: none;
  }
  summary:hover,
  details[open] > summary {
    margin: 0;
    background: var(--htmlpress-muted);
  }
  svg {
    flex: none;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  summary > svg {
    display: none;
  }
  /* Read from the root, which the head script sets before the first frame */
  :root[data-theme="light"] :scope summary > [data-icon="light"],
  :root[data-theme="dark"] :scope summary > [data-icon="dark"],
  :root:not([data-theme]) :scope summary > [data-icon="system"] {
    display: block;
  }
  summary + div {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 30;
    min-width: 9rem;
    padding: 0.25rem;
    border: 1px solid var(--htmlpress-border);
    border-radius: 0.75rem;
    background: var(--htmlpress-background);
    box-shadow: 0 8px 24px
      color-mix(in oklab, var(--htmlpress-foreground) 12%, transparent);
  }
  p {
    margin: 0;
    padding: 0.375rem 0.625rem;
    color: var(--htmlpress-muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
  }
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  li,
  li + li {
    margin: 0;
    padding: 0;
  }
  button {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.375rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: var(--htmlpress-foreground);
    font: 400 0.875rem/1.25rem var(--htmlpress-font);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
  }
  button:hover {
    background: var(--htmlpress-muted);
  }
  button[aria-current="true"] {
    color: var(--htmlpress-primary);
    font-weight: 500;
  }
}

/* Livemark's phone contents: a sticky bar under the header; its sheet is htmlpress-sheet */
@scope (htmlpress-toc-bar) {
  :scope {
    display: none;
  }
  @media (max-width: 80rem) {
    :scope:has(> button) {
      position: sticky;
      top: 4rem;
      z-index: 15;
      display: block;
      border-bottom: 1px solid var(--htmlpress-border);
      background: var(--htmlpress-background);
    }
  }
  :scope > button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 0;
    background: none;
    color: var(--htmlpress-muted-foreground);
    font: 0.875rem/1.25rem var(--htmlpress-font);
    text-align: left;
    cursor: pointer;
  }
  :scope > button > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  svg {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  [data-ring] {
    rotate: -90deg;
  }
  [data-ring] circle {
    stroke: color-mix(in oklab, var(--htmlpress-muted-foreground) 30%, transparent);
    transition: stroke-dashoffset 0.15s;
  }
  [data-ring] circle + circle {
    stroke: var(--htmlpress-primary);
  }
}

@scope (htmlpress-toolbar) {
  :scope {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }
  p {
    margin: 0 0 0.25rem;
    color: var(--htmlpress-foreground);
    font-weight: 500;
  }
  a,
  button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--htmlpress-muted-foreground);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
  }
  [hidden] {
    display: none;
  }
  a:hover,
  button:hover {
    color: var(--htmlpress-foreground);
  }
  svg {
    flex-shrink: 0;
    width: 0.875rem;
    height: 0.875rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

