/* Two content widths only: pages that carry a sidebar use the wide box, everything
   else uses one reading column. The theme derives its own boxes from these. */
:root {
  --width-wide: 1320px;
  --width-read: 880px;
  --main-width: var(--width-wide);
  --nav-width: var(--width-wide);
  --radius: 16px;
  --radius-media: 10px;
  --radius-sm: 4px;
  --radius-pill: 999px;
  /* The bar keeps the theme's own 60px line box, so its height is exactly what it
     was: the 24px wordmark is centred in that box and leaves 16px of air above and
     below itself. The content gets the same 16px below the bar, so the three gaps
     read as one measure. Padding the bar instead would have made it taller. */
  --header-gap: 16px;
  /* How many rows the bar occupies. Flipped to 2 by the breakpoint that lets the
     links wrap, so the two can never disagree. */
  --header-rows: 1;
  /* How far the page wash reaches before it is the plain page colour. A viewer on a
     16:9 screen is looking at the page colour itself by the bottom of the first
     screen; the fade never competes with content further down. */
  --wash-height: 88vh;
  /* The bar sticks, so an in-page jump — a TOC entry, a heading anchor — has to
     stop clear of it instead of landing behind it. One bar's height plus the gap
     the content already keeps under it. */
  scroll-padding-top: calc(var(--header-height) * var(--header-rows) + var(--header-gap));
}

/* The theme assumes the chrome is exactly --header-height + --footer-height tall,
   which ignores the row the bar gains when it wraps and both hairlines. Left
   uncorrected, every short page grew a scrollbar for the sake of those pixels. */
.main {
  max-width: calc(var(--width-read) + var(--gap) * 2);
  padding-top: var(--header-gap);
  min-height: calc(100vh - var(--header-height) * var(--header-rows) - var(--footer-height) - 2px);
}

/* Page headers and the home entry carry their own top margin, which would widen the
   gap under the bar on just those pages. The gap is the bar's own measure, so the
   first block starts at it on every page. */
.main > :first-child {
  margin-top: 0;
}

.main:has(.doc-layout) {
  max-width: calc(var(--width-wide) + var(--gap) * 2);
}

.main > .post-single,
.doc-layout > .post-single,
.page-map-main > .post-single,
.doc-sidebar {
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap);
}

.menu a span,
.doc-sidebar a,
.post-tags a,
.logo a {
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}

.post-tags a,
.md-content .post-tags a {
  border: 1px solid transparent;
}

.post-tags a:hover,
.post-tags a:focus-visible,
.md-content .post-tags a:hover,
.md-content .post-tags a:focus-visible {
  border-color: var(--acc);
}

.doc-sidebar a:hover,
.doc-sidebar a:focus-visible {
  color: var(--acc);
}

.menu {
  align-items: center;
}

/* The bar is four groups, left to right: wordmark + search, page links, socials,
   theme. The rules sit between the last three, and the free space sits before the
   page links. The gap matches the cluster gap so a rule is spaced the same
   whichever side of a cluster it falls.

   No block padding: the theme's 60px line box already centres the row and gives
   it its 16px of air. The bar's height is meant to stay as it was. */
.header-nav {
  align-items: center;
  column-gap: 0.4rem;
}

.header-cluster {
  display: flex;
  align-items: center;
  flex: none;
  gap: 0.4rem;
}

/* The field sits a little further from the wordmark than the icons sit from each
   other; the pill needs the extra air to read as a separate thing. */
.header-brand {
  gap: 0.75rem;
}

/* The links cluster takes the free space, which pins it and the theme switch to
   the right edge. */
.header-links {
  margin-left: auto;
}

.header-nav-divider {
  flex: none;
  width: 1px;
  height: 1.15rem;
  margin: 0 0.45rem;
  background: var(--border);
}

/* Specificity beats the theme's `.header-nav a { display: block }`, which
   otherwise strips the centring and leaves the icon sitting on the baseline. */
.header-nav .header-util {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  /* The nav inherits a full header-height line box, which would push the icons
     off centre. */
  line-height: 1;
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}

.header-nav .header-util svg {
  display: block;
}

.header-nav .header-util:hover,
.header-nav .header-util:focus-visible {
  color: var(--acc);
  background: color-mix(in srgb, var(--acc) 10%, transparent);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--ctl-line);
  border-radius: var(--radius-pill);
  background: var(--card);
}

.header-nav .theme-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}

/* Both icons stay visible: this is a choice, not a toggle. The theme hides one
   per mode, so these selectors have to outrank `[data-theme="dark"] .moon`. */
.header-nav .theme-switch-btn svg {
  display: block;
}

.header-nav .theme-switch-btn:hover,
.header-nav .theme-switch-btn:focus-visible {
  color: var(--acc);
}

.header-nav .theme-switch-btn[aria-pressed="true"] {
  background: var(--tint);
  color: var(--tx);
}

.entry-footer .post-tags {
  position: relative;
  z-index: 2;
  gap: 6px;
  margin-top: 0.45rem;
}

/* One pill size everywhere: the theme renders 34px pills on post pages, which are
   far taller than the same pills inside a list card. */
.post-tags {
  gap: 6px;
}

.post-tags a {
  padding: 0 0.6rem;
  font-size: 12px;
  line-height: 1.7;
}

.post-entry,
.first-entry {
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}

.post-entry:hover,
.post-entry:focus-within,
.first-entry:hover,
.first-entry:focus-within {
  transform: translateY(-2px);
  border-color: var(--border);
}

.center-image,
img.center-image,
video.center-image {
  display: block;
  margin-inline: auto;
  max-width: 100%;
}

video {
  width: 100%;
  max-width: 100%;
  height: auto;
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.doc-layout .first-entry,
.page-map-main > .post-single {
  margin-top: 0;
}

.doc-layout .post-header,
.doc-layout .entry-header {
  margin-top: 0;
}

.doc-sidebar-label {
  margin: 0.85rem 0 0.25rem;
  font-family: inherit;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}

.doc-sidebar-label:first-child {
  margin-top: 0;
}

/* The sidebar sticks below the bar rather than at the top of the viewport: the bar
   is sticky now, so a 1.25rem offset would park the sidebar's first rows behind it. */
.doc-sidebar {
  position: sticky;
  top: calc(var(--header-height) * var(--header-rows) + 1.25rem);
  max-height: calc(100vh - var(--header-height) * var(--header-rows) - 2.5rem);
  overflow: auto;
}

.doc-sidebar #TableOfContents,
.doc-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  padding-inline-start: 1.15rem;
}

.doc-sidebar ul ul {
  margin-inline-start: 0;
  padding-inline-start: 1.85rem;
}

.doc-sidebar a {
  display: block;
  position: relative;
  padding: 0.16rem 0;
  color: color-mix(in srgb, var(--mute) 48%, var(--ink));
  font-family: inherit;
  font-size: 1em;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
}

.doc-sidebar .page-map-l1 > a,
.doc-sidebar .page-map-l2 > a {
  color: var(--ink);
  font-weight: 700;
}

.doc-sidebar ul ul a,
.doc-sidebar .page-map-l3 > a {
  color: color-mix(in srgb, var(--mute) 55%, var(--ink));
  font-weight: 400;
  font-size: 0.92em;
}

.doc-sidebar a:hover,
.doc-sidebar a:focus-visible,
.doc-sidebar .page-map-l2 > a:hover,
.doc-sidebar .page-map-l2 > a:focus-visible,
.doc-sidebar ul ul a:hover,
.doc-sidebar ul ul a:focus-visible {
  color: var(--acc);
}

.doc-sidebar a.is-active,
.doc-sidebar .page-map-l2 > a.is-active,
.doc-sidebar .page-map-l3 > a.is-active {
  font-weight: 600;
  color: var(--acc);
}

.doc-sidebar a.is-active::before {
  content: "";
  position: absolute;
  left: -0.85rem;
  top: 50%;
  width: 3px;
  height: 1.15em;
  transform: translateY(-50%);
  border-radius: var(--radius-sm);
  background: var(--acc);
}

.post-content img,
.post-content video,
.post-content .twentytwenty-container,
.post-content .splide {
  width: 100%;
}

/* Slides have no sizing of their own until Splide mounts, so a slow or failed
   script used to render them at full natural width. */
.post-content .splide__slide img {
  max-width: 100%;
  height: auto;
}

/* The comparison slider ships prefixed-only user-select, and a drag that leaves the
   image still selects the text around it. Keep the slider area non-selectable and
   suppress selection for the whole page while a drag is in progress. */
.post-content .twentytwenty-container,
.post-content .twentytwenty-container *,
.md-content .twentytwenty-container,
.md-content .twentytwenty-container * {
  -webkit-user-select: none;
  user-select: none;
}

body:has(.twentytwenty-container.active) {
  -webkit-user-select: none;
  user-select: none;
}

/* PaperMod's reset sets `table { display: block }`, which turns the rows into an
   anonymous shrink-to-fit box, so `width: 100%` never reaches the columns: tables
   render narrow and left-aligned. Restore real table layout so columns fill the
   article width and cells may wrap. Chroma's line-number table is excluded. */
.post-content table:not(.lntable),
.md-content table:not(.lntable) {
  display: table;
  width: 100%;
  table-layout: auto;
  word-break: normal;
}

/* The theme only sets a bottom margin, so a table butting up against the slider or
   paragraph above it had no gap at all. */
.post-content table:not(.lntable):not(:first-child),
.md-content table:not(.lntable):not(:first-child) {
  margin-top: var(--content-gap);
}

/* The theme tints list pages with the code colour; the page colour is the single
   fill, with the wash below laid over it. */
.list {
  background: var(--theme);
}

/* Page wash ---------------------------------------------------------------- */

/* A shallow gradient across the first screen: the wash at the very top easing back
   to the plain page colour before the fold, so the top of every page reads a shade
   deeper without the whole document becoming a gradient.

   Body's background becomes the canvas, which is what paints behind the transparent
   header and the gaps between cards. `:root body` is not decoration: the theme's
   `[data-theme="dark"] .list` sets the same element's background at a higher
   specificity and would otherwise reset the image in dark mode. A fixed length —
   not a percentage — keeps the fade the same depth on a long article as on a
   one-line page. */
:root body,
:root body.list {
  background-color: var(--bg);
  background-image: linear-gradient(to bottom, var(--bg-wash), var(--bg) var(--wash-height));
  background-repeat: no-repeat;
}

/* The bar is sticky, so the site's only navigation stays in reach, but it carries
   no band of its own at rest: the page background runs straight through it and the
   header reads as part of the content until you interact with it.

   It colours in on hover, on focus so the controls never sit on bare page content
   for a keyboard user, and once the page has scrolled up to it (header-scroll.js
   sets is-scrolled). That last state is a full fill rather than a tint: it is what
   stops an article sliding through the links, so it must be opaque.

   The hairline fades with the fill and is derived from it, so it keeps its edge in
   both themes — a permanent border would give the transparent bar a visible edge,
   and --border is too close to the fill to read.

   Sticky also gives the bar a stacking context, so the search results panel and the
   controls paint above the article without rules of their own. */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-2) var(--ease),
    border-bottom-color var(--dur-2) var(--ease);
}

/* Gated on a real pointer: on touch, `:hover` sticks after a tap and would leave
   the bar coloured until the next tap elsewhere. */
@media (hover: hover) {
  .header:hover {
    background: var(--bar);
    border-bottom-color: var(--bar-line);
  }
}

.header:focus-within,
.header.is-scrolled {
  background: var(--bar);
  border-bottom-color: var(--bar-line);
}

/* No fill of its own: the footer sits on the page and the wash, so the bottom of a
   short page runs out seamlessly instead of ending in a band. */
.footer {
  width: 100%;
  max-width: none;
  border: 0;
}

/* Only a column header deserves the tinted band. The key/value tables used by the
template pages put their labels in `<th>` row cells, which were picking up the
header background and reading as a title column. */
.post-content table thead th {
  background: color-mix(in srgb, var(--primary) 7%, var(--entry));
}

.post-content table tbody th {
  background: transparent;
  font-weight: 700;
}

.first-entry {
  min-height: 0;
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.post-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.post-content :not(pre) > code {
  background: var(--code-bg);
  color: var(--primary);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem;
}

/* Video covers have no intrinsic ratio, so give them the same behaviour as images. */
.entry-cover video {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

/* Thumbnail cards are links, but they carry an image and a title, so they should
   read as cards rather than as underlined inline links. */
.post-content a.thumb-card,
.md-content a.thumb-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem;
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}

.post-content a.thumb-card:hover,
.post-content a.thumb-card:focus-visible,
.md-content a.thumb-card:hover,
.md-content a.thumb-card:focus-visible {
  color: var(--ink);
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--border);
}

.thumb-card img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-media);
  display: block;
}

.thumb-card strong {
  font-size: 0.95em;
  line-height: 1.3;
}

.thumb-card p {
  margin: 0;
  font-size: 0.85em;
  line-height: 1.4;
  color: var(--mute);
}

.entry-row:has(.entry-cover) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: calc(var(--gap) / 2);
  row-gap: 0.2rem;
  align-items: stretch;
  align-content: center;
  padding: calc(var(--gap) / 2);
  min-height: 10.5rem;
}

.entry-row .entry-cover {
  grid-column: 1;
  grid-row: 1 / span 3;
  margin: 0;
  min-height: 0;
  overflow: hidden;
}

.entry-row .entry-header,
.entry-row .entry-content,
.entry-row .entry-footer {
  grid-column: 2;
}

.entry-row .entry-header {
  grid-row: 1;
}

.entry-row .entry-content {
  grid-row: 2;
  margin: 0;
  /* Safety net only: the template already truncates. Keep it a real clamp so any
     overflow ends in an ellipsis instead of being sliced mid-line. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.entry-row .entry-footer {
  grid-row: 3;
}

.entry-row .entry-cover img,
.entry-row .entry-cover video {
  pointer-events: none;
}

.entry-row .entry-link {
  position: absolute;
  z-index: 1;
  inset: 0;
}

.entry-row .entry-cover img,
.entry-row .entry-cover video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-media);
  display: block;
}

.entry-row.first-entry .entry-header h2 {
  font-size: 24px;
}

.entry-row.first-entry .entry-content {
  margin: 0;
  font-size: 14px;
}

/* Archived posts: reduced emphasis in lists, plus an unmistakable callout on the post itself. */
.is-archived .entry-cover img,
.is-archived .entry-cover video {
  filter: saturate(0.45);
  opacity: 0.75;
}

/* Badge sits on the thumbnail, so the marker travels with the image rather than the tags row. */
.entry-cover {
  position: relative;
}

.archived-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--border);
}

/* Centre the icon against the title's line box rather than the text baseline. */
.page-header h1:has(.page-title-icon) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3em;
}

.page-title-icon {
  display: inline-flex;
  align-items: center;
}

.page-title-icon .archived-icon {
  width: 0.6em;
  height: 0.6em;
}

.archived-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  vertical-align: middle;
  border-radius: var(--radius-pill);
  padding: 0 0.6rem;
  font-size: 12px;
  line-height: 1.7;
  color: color-mix(in srgb, var(--mute) 70%, var(--ink));
  background: color-mix(in srgb, var(--mute) 12%, transparent);
  border: 1px solid var(--border);
}

/* The accent icon is the one colour anchor left once the cover is desaturated. */
.archived-icon {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--acc);
}

.archive-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
  padding: 0.6rem 0.85rem;
  border-left: 3px solid var(--acc);
  border-radius: var(--radius-sm);
  background: var(--tint);
  color: var(--tx);
  font-size: 0.94em;
}

.archive-banner .archived-icon {
  width: 15px;
  height: 15px;
}

/* Wide pages (archive, docs) carry an inline subtitle next to the H1. */
.page-subtitle {
  display: inline;
  font-size: 0.55em;
  font-weight: 400;
  color: var(--mute);
}

.archive-year-label {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.archive-year-label:first-child {
  margin-top: 0;
}

.doc-sidebar .sidebar-archive-link {
  display: flex;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

.doc-sidebar .sidebar-archive-link .archived-icon {
  width: 14px;
  height: 14px;
  margin-right: 0.4em;
}

.doc-sidebar .sidebar-count {
  font-weight: 400;
  color: var(--mute);
}

@media (max-width: 800px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }

  .page-map-main {
    order: -1;
  }

  .doc-sidebar {
    position: static;
    max-height: none;
  }
}

/* Cards keep the thumbnail beside the text until there is no longer room for it. */
@media (max-width: 560px) {
  .entry-row:has(.entry-cover) {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.5rem;
  }

  .entry-row .entry-cover,
  .entry-row .entry-header,
  .entry-row .entry-content,
  .entry-row .entry-footer {
    grid-column: 1;
    grid-row: auto;
  }

  .entry-row .entry-cover img,
  .entry-row .entry-cover video {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }
}

/* The theme only disables a handful of transforms when motion is reduced, so the
   card lift, the wordmark blink and the header fade are switched off here. */
@media (prefers-reduced-motion: reduce) {
  .post-entry,
  .first-entry,
  .post-content a.thumb-card,
  .md-content a.thumb-card,
  .logo a::before {
    transition: none;
    animation: none;
  }

  .header {
    transition: none;
  }

  .post-entry:hover,
  .post-entry:focus-within,
  .first-entry:hover,
  .first-entry:focus-within,
  .post-content a.thumb-card:hover,
  .post-content a.thumb-card:focus-visible,
  .md-content a.thumb-card:hover,
  .md-content a.thumb-card:focus-visible {
    transform: none;
  }
}

/* Header search ----------------------------------------------------------- */

/* The box sits beside the wordmark, still outside `.menu`, because the menu is a
   horizontal scroll container that would clip the results dropdown. The panel is
   anchored to the field's left edge: the field is on the left of the bar, so a
   right-anchored panel would run off the page. */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

/* Sized here rather than by the input, because the field's width is what has to
   line up: its right edge should meet the sidebar column that starts directly
   below it. That column is 20rem wide at the widest layout, and the wordmark plus
   the cluster gap take 7.875rem of it, leaving 12.125rem. Sizing the input instead
   left the field 9px past the column, which is the overhang this fixes. */
.search-box-field {
  display: flex;
  align-items: center;
  flex: none;
  inline-size: 12.125rem;
  height: 2.15rem;
  gap: 0.45rem;
  padding: 0 0.7rem;
  background: var(--card);
  border: 1px solid var(--ctl-line);
  border-radius: var(--radius-pill);
  cursor: text;
  transition: border-color var(--dur-1) var(--ease),
    box-shadow var(--dur-1) var(--ease),
    inline-size var(--dur-2) var(--ease);
}

.search-box-field:hover {
  border-color: color-mix(in srgb, var(--acc) 45%, var(--ctl-line));
}

.search-box-field:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 16%, transparent);
}

.search-box-icon {
  flex: none;
  color: var(--mute);
}

/* Fills whatever the field leaves, so the field can hold the width on its own. */
.search-box-input {
  flex: 1 1 auto;
  min-inline-size: 0;
  inline-size: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
}

/* The field widens only where the bar can absorb it: below this the extra width
   would push the theme switch onto a line of its own. */
@media (min-width: 900px) {
  .search-box-field:focus-within {
    inline-size: 15.625rem;
  }
}

.search-box-input:focus {
  outline: none;
}

.search-box-input::placeholder {
  color: var(--mute);
}

/* Hides the search affordance once a search is in progress. */
.search-box-hint {
  flex: none;
  padding: 0 0.32em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--mute);
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.6;
}

.search-box-field:focus-within .search-box-hint,
.search-box-field:has(.search-box-input:not(:placeholder-shown)) .search-box-hint {
  display: none;
}

.search-box-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 90;
  width: min(26rem, calc(100vw - 2rem));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 32px color-mix(in srgb, var(--ink) 16%, transparent);
  overflow: hidden;
}

.search-box-panel[hidden] {
  display: none;
}

.search-status {
  margin: 0;
  padding: 0.6rem 0.9rem 0;
  color: var(--mute);
  font-size: 0.8rem;
}

.search-status:empty {
  display: none;
}

.search-results {
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: min(22rem, 60vh);
  overflow-y: auto;
}

.search-results a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
}

.search-results [role="option"].is-active a,
.search-results a:hover {
  background: var(--tint);
  color: var(--tx);
}

.search-result-title {
  flex: 1 1 auto;
  font-weight: 600;
}

.search-result-kind {
  flex: none;
  color: var(--mute);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-align: right;
}

.search-results [role="option"].is-active .search-result-kind {
  color: inherit;
}

.search-hint {
  margin: 0;
  padding: 0.5rem 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--mute);
  font-size: 0.72rem;
}

.search-hint kbd {
  padding: 0 0.3em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--theme);
  font-family: inherit;
  font-size: 0.95em;
}

/* Mobile keeps the /search/ page; the inline field needs room the bar has not
   got at that width, and the bar would wrap its right-hand cluster. */
@media (max-width: 800px) {
  .search-box {
    display: none;
  }
}

/* The four groups need roughly 570px. Below that the links take a line of their
   own, so the socials are never stranded beside the wordmark, and the rules go:
   the line break separates the groups already. */
@media (max-width: 560px) {
  :root {
    --header-rows: 2;
  }

  .header-brand {
    order: 1;
  }

  .header-theme {
    order: 2;
    margin-left: auto;
  }

  .header-links {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
  }

  .header-nav-divider {
    display: none;
  }
}
