/*
 * SoundHive manual theme. Shared by every product manual (soundhive-buildkit/manual).
 *
 * Rules: soundhive-brand/07-Technical-Documentation.md. Dark values are the website's
 * tokens (soundhive-website/tailwind.config.js `sh-*`); tests/test_theme_tokens.py fails if
 * they drift. Light values are the warm paper reading surface brand 07 asks for. Amber marks
 * the current page, focus, links and screenshot callouts; it is never a background wash.
 */

@font-face {
  font-family: "Funnel Sans";
  src: url("fonts/FunnelSans.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Funnel Display";
  src: url("fonts/FunnelDisplay.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --font-sans: "Funnel Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Funnel Display", "Funnel Sans", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --amber: #FFB300;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --topbar-h: 64px;
  --nav-w: 272px;
  --onpage-w: 232px;
  --measure: 44rem;
  --article-max: 64rem;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Light: warm paper. */
  --bg: #F6F3EE;
  --surface: #FFFDFA;
  --elevated: #ECE7DF;
  --text: #1B1916;
  --text-strong: #0A0908;
  --text-secondary: #5A544B;
  --border: #DCD5CA;
  --border-subtle: #E8E2D8;
  --border-strong: #BDB3A4;
  --accent-ink: #8A5A00;
  --shot-bg: #0A0908;
  --shot-border: #BDB3A4;
  --link-underline: var(--amber);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0A0908;
  --surface: #181715;
  --elevated: #25231F;
  --text: #ECE7DF;
  --text-strong: #FFFFFF;
  --text-secondary: #9A9389;
  --border: #3A3835;
  --border-subtle: #252320;
  --border-strong: #4A4842;
  --accent-ink: #FFB300;
  --shot-bg: #0A0908;
  --shot-border: #3A3835;
  --link-underline: rgba(255, 179, 0, 0.7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0908;
    --surface: #181715;
    --elevated: #25231F;
    --text: #ECE7DF;
    --text-strong: #FFFFFF;
    --text-secondary: #9A9389;
    --border: #3A3835;
    --border-subtle: #252320;
    --border-strong: #4A4842;
    --accent-ink: #FFB300;
    --shot-bg: #0A0908;
    --shot-border: #3A3835;
    --link-underline: rgba(255, 179, 0, 0.7);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.1875rem;
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 150ms var(--ease-out);
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--topbar-h);
  padding: 0 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-strong);
}

.brand__mark {
  width: 28px;
  height: 28px;
}

.brand__mark polygon {
  fill: none;
  stroke: var(--amber);
  stroke-width: 3;
  stroke-linejoin: round;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.topbar__switcher {
  max-width: 14rem;
  padding: 0.375rem 2rem 0.375rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23857f76' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 150ms var(--ease-out), color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}

.topbar__switcher:hover {
  border-color: var(--border-strong);
  background-color: var(--elevated);
  color: var(--text);
}

.topbar__switcher:focus-visible {
  outline-color: #ffffff;
  border-color: var(--border-strong);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.topbar__menu,
.search-button,
.icon-link,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.875rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}

.topbar__menu:hover,
.search-button:hover,
.icon-link:hover,
.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--elevated);
}

.topbar svg,
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar__menu {
  display: none;
}

.search-button {
  min-width: 11rem;
  color: var(--text-secondary);
}

.search-button kbd {
  margin-left: auto;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.theme-toggle {
  width: 44px;
  justify-content: center;
  padding: 0;
}

.theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle__moon {
    display: block;
  }
}

/* ---------- Frame ---------- */

.frame {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--onpage-w);
  max-width: 1600px;
  margin: 0 auto;
}

.sidenav {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 2rem 1.25rem 2rem 1.25rem;
  font-size: 0.9375rem;
}

/* The divider belongs to the content column, so it runs the full page height
   instead of stopping where the sticky sidebar ends. */
@media (min-width: 1024px) {
  .main {
    border-left: 1px solid var(--border-subtle);
  }
}

.sidenav__section + .sidenav__section {
  margin-top: 1.75rem;
}

.sidenav__title {
  margin: 0 0 0.5rem;
  padding: 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.sidenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidenav li a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  line-height: 1.4;
  text-decoration: none;
}

.sidenav li a:hover {
  background: var(--elevated);
}

.sidenav li a[aria-current="page"] {
  background: var(--elevated);
  color: var(--text-strong);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--amber);
}

.sidenav__meta {
  margin: 2rem 0 0;
  padding: 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.main {
  min-width: 0;
  padding: 3rem clamp(1.25rem, 4vw, 4rem) 4rem;
}

.main:focus {
  outline: none;
}

.onpage {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 3rem 1.25rem 2rem 0;
  font-size: 0.875rem;
}

.onpage__title {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.onpage ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.onpage ul ul {
  padding-left: 0.875rem;
}

.onpage a {
  display: block;
  padding: 0.25rem 0;
  color: var(--text-secondary);
  line-height: 1.4;
  text-decoration: none;
}

.onpage a:hover,
.onpage a[aria-current="true"] {
  color: var(--text);
}

.onpage a[aria-current="true"] {
  font-weight: 600;
}

.scrim {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  z-index: 30;
  background: rgba(10, 9, 8, 0.5);
}

/* ---------- Article ---------- */

.article {
  max-width: var(--article-max);
}

.article :where(p, ul, ol, dl, blockquote, h1, h2, h3, h4, .admonition, .steps, div[class^="highlight"]) {
  max-width: var(--measure);
}

.article li > p {
  margin: 0;
}

.article__section {
  margin: 0 0 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
}

.article h1,
.article h2,
.article h3,
.article h4 {
  color: var(--text-strong);
  font-family: var(--font-display);
  line-height: 1.15;
  text-wrap: balance;
}

.article h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.25rem, 1.6rem + 2vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.article h2 {
  margin: 3.5rem 0 1rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.article h3 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.3125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.article h4 {
  margin: 2rem 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.article h1 + p {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.55;
}

.article p,
.article ul,
.article ol,
.article dl {
  margin: 0 0 1.25rem;
}

.article ul,
.article ol {
  padding-left: 1.4rem;
}

.article li + li {
  margin-top: 0.375rem;
}

.article li::marker {
  color: var(--text-secondary);
}

.article strong {
  color: var(--text-strong);
  font-weight: 650;
}

.article .guilabel,
.article .menuselection {
  color: var(--text-strong);
  font-weight: 650;
}

.article kbd,
.article .kbd {
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.article code,
.article tt {
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: var(--elevated);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.article hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Heading anchors: quiet until hovered or focused. */
.article a.headerlink {
  margin-left: 0.4em;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
  transition: opacity 150ms var(--ease-out);
}

.article :is(h1, h2, h3, h4):hover a.headerlink,
.article a.headerlink:focus-visible {
  opacity: 1;
}

/* ---------- Steps ---------- */

.article .steps ol {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.article .steps ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.75rem;
  min-height: 2rem;
}

.article .steps ol > li + li {
  margin-top: 1rem;
}

.article .steps ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-strong);
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Admonitions ---------- */

.article .admonition {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.article .admonition > :last-child {
  margin-bottom: 0;
}

.article .admonition-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.375rem;
  color: var(--text-strong);
  font-size: 0.9375rem;
  font-weight: 700;
}

.article .admonition-title::before {
  content: "";
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999px;
  background: var(--text-secondary);
}

.article .admonition.tip .admonition-title::before,
.article .admonition.hint .admonition-title::before {
  background: var(--amber);
}

.article .admonition.important .admonition-title::before,
.article .admonition.caution .admonition-title::before,
.article .admonition.warning .admonition-title::before {
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--text-strong);
}

/* ---------- Tables ---------- */

.article table.docutils,
.article table.controls {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.5;
}

.article table.docutils > :is(thead, tbody),
.article table.controls > :is(thead, tbody) {
  display: table;
  width: 100%;
  border-collapse: collapse;
}

.article table.docutils > thead,
.article table.controls > thead {
  display: table-header-group;
}

.article table.docutils > tbody,
.article table.controls > tbody {
  display: table-row-group;
}

.article table :is(th, td) {
  padding: 0.75rem 1rem 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.article table th {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom-color: var(--border);
}

.article table td:first-child {
  color: var(--text-strong);
  font-weight: 650;
  white-space: nowrap;
}

/* Every control table on a page lines up: the same four column widths. */
.article table.controls > :is(thead, tbody) {
  table-layout: fixed;
}

.article table.controls :is(th, td):nth-child(1) {
  width: 24%;
  white-space: normal;
}

.article table.controls :is(th, td):nth-child(2) {
  width: 20%;
}

.article table.controls :is(th, td):nth-child(3) {
  width: 14%;
}

.article table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.article table caption {
  margin-bottom: 0.5rem;
  color: var(--text-strong);
  font-weight: 700;
  text-align: left;
}

/* ---------- Screenshots ---------- */

.shot {
  margin: 2.25rem 0 2.5rem;
}

.shot--wide {
  max-width: var(--article-max);
}

.shot--focus {
  max-width: 52rem;
}

.shot--column,
.shot--meter {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  column-gap: 2rem;
  align-items: start;
  max-width: var(--article-max);
}

.shot__frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--shot-border);
  border-radius: var(--radius-lg);
  background: var(--shot-bg);
}

.shot__frame img {
  width: 100%;
  height: auto;
}

/* Tall, narrow captures (a meter stack, a control column) are capped by height so
   they never fill a screen; the frame shrinks to the image so callouts stay put,
   and the caption and keys sit beside it instead of stacking underneath. */
.shot--column .shot__frame,
.shot--meter .shot__frame {
  grid-row: 1 / span 2;
  width: fit-content;
  max-width: 100%;
}

.shot--column figcaption,
.shot--meter figcaption {
  grid-column: 2;
  margin-top: 0;
}

.shot--column .shot__keys,
.shot--meter .shot__keys {
  grid-column: 2;
  grid-template-columns: 1fr;
  margin-top: 1rem;
}

.shot--column .shot__frame img,
.shot--meter .shot__frame img {
  width: auto;
  max-width: 100%;
  max-height: min(70vh, 40rem);
}

.shot__marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 2px #0A0908;
  color: #0A0908;
  font-size: 0.8125rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-decoration: none;
  transition: transform 150ms var(--ease-out);
}

.shot__marker:hover,
.shot__marker:focus-visible,
.shot__marker.is-active {
  transform: scale(1.15);
}

.shot__marker:focus-visible {
  outline-color: #FFFFFF;
}

.shot figcaption {
  max-width: var(--measure);
  margin-top: 0.875rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.shot figcaption strong {
  color: var(--text);
}

.shot__keys {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.75rem 2rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.shot__keys li {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: 0.5rem;
  margin: 0;
  padding: 0.375rem 0.5rem 0.375rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: background-color 150ms var(--ease-out);
}

.shot__keys li.is-active,
.shot__keys li:target {
  background: var(--elevated);
}

.shot__key-number {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.05rem;
  border-radius: 999px;
  background: var(--amber);
  color: #0A0908;
  font-size: 0.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.shot__keys strong {
  display: block;
  color: var(--text-strong);
}

/* ---------- Page cards (index only) ---------- */

.article .start-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0;
  max-width: var(--article-max);
  margin: 2rem 0 2.5rem;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.article .start-links li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.article .start-links a {
  display: block;
  height: 100%;
  padding: 1.125rem 1.5rem 1.25rem 0;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
  text-decoration: none;
}

.article .start-links a strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.article .start-links a:hover strong {
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* ---------- Pager and footer ---------- */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: var(--measure);
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager__link {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  text-decoration: none;
}

.pager__link--next {
  grid-column: 2;
  text-align: right;
}

.pager__hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pager__title {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.pager__link:hover .pager__title {
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.footer {
  max-width: var(--measure);
  margin-top: 3rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer p {
  margin: 0.25rem 0;
}

/* ---------- Search ---------- */

.search-dialog {
  width: min(44rem, calc(100vw - 2rem));
  max-height: min(40rem, calc(100vh - 6rem));
  margin: 5rem auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
}

.search-dialog::backdrop {
  background: rgba(10, 9, 8, 0.6);
}

.search-dialog__panel {
  padding: 1.25rem;
}

.search-dialog__close {
  min-height: 44px;
  margin-top: 1rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

#manual-search {
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: var(--accent-ink);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--surface);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--elevated);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 10px;
  --pagefind-ui-font: var(--font-sans);
}

#manual-search mark {
  background: rgba(255, 179, 0, 0.3);
  color: inherit;
}

/* ---------- Responsive ---------- */

@media (max-width: 1279px) {
  .frame {
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
  }
  .onpage {
    display: none;
  }
}

@media (max-width: 1023px) {
  :root {
    --topbar-h: 60px;
  }
  .frame {
    grid-template-columns: minmax(0, 1fr);
  }
  .topbar {
    gap: 0.5rem;
    padding: 0 1rem;
  }
  .topbar__menu {
    display: inline-flex;
  }
  .topbar__switcher {
    max-width: 9rem;
    padding-left: 0.75rem;
    padding-right: 1.5rem;
    background-position: right 0.5rem center;
  }
  .sidenav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 35;
    width: min(20rem, 85vw);
    height: auto;
    background: var(--bg);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 200ms var(--ease-out), visibility 0s linear 200ms;
  }
  .nav-open .sidenav {
    transform: none;
    visibility: visible;
    transition: transform 200ms var(--ease-out);
  }
  .main {
    padding: 2rem 1rem 3rem;
  }
}

@media (max-width: 639px) {
  body {
    font-size: 1.0625rem;
  }
  .brand__name {
    display: none;
  }
  .search-button {
    min-width: 0;
  }
  .search-button span,
  .search-button kbd,
  .icon-link span {
    display: none;
  }
  .article h2 {
    margin-top: 2.75rem;
    font-size: 1.5rem;
  }
  .shot__frame {
    border-radius: var(--radius-md);
  }
  .shot--column,
  .shot--meter {
    display: block;
  }
  .shot--column .shot__frame,
  .shot--meter .shot__frame {
    width: fit-content;
    max-width: 100%;
  }
  .shot--column figcaption,
  .shot--meter figcaption {
    margin-top: 0.875rem;
  }
  .shot--column .shot__keys,
  .shot--meter .shot__keys {
    grid-template-columns: 1fr;
    margin-top: 1.25rem;
  }
  .shot__marker {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    font-size: 0.6875rem;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager__link--next {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* Tall placeholders take their height from the cap and their width from the aspect. */
.shot--column .shot__frame--pending,
.shot--meter .shot__frame--pending {
  width: auto;
  height: min(60vh, 32rem);
  max-width: 100%;
}

.shot__frame--pending {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  color: #9A9389;
  font-size: 0.9375rem;
}

/* Thin strips: markers ride a rail above the image, with a tick down to the control. */
.shot__rail {
  position: relative;
  height: 2.25rem;
  margin-bottom: 0.375rem;
}

.shot__rail .shot__marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 0.75rem;
  margin-left: -1px;
  background: var(--amber);
}

.shot__keys li + li {
  margin-top: 0;
}
