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

/* Default size for icons from Icon() that no other rule sizes. :where() keeps this at zero
   specificity so every component rule (.btn svg, .empty svg…) still wins. */
:where(svg.icon:not([width]), img.icon:not([width])) {
  width: 16px;
  height: 16px;
  flex: none;
}
/* Uploaded category icons keep their proportions inside the icon box. */
img.icon-img {
  object-fit: contain;
  border-radius: 3px;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

/* Full-height column so the footer sits at the bottom on short pages. */
#root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
#root > * {
  flex-shrink: 0;
}
/* Centred max-width containers that are direct children of #root: auto
   margins would otherwise shrink them to their content inside the flex column. */
#root > .narrow-page,
#root > .docs-shell {
  width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

/* Scrollbars: thin, rounded, themed; no arrow buttons. */
:root {
  --scrollbar-thumb: color-mix(in srgb, var(--text) 18%, transparent);
  --scrollbar-thumb-hover: color-mix(in srgb, var(--text) 32%, transparent);
}
/* Standard properties for Firefox only: in Chromium they would disable the
   ::-webkit-scrollbar styling below. */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
  }
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

::selection {
  background: color-mix(in srgb, var(--brand) 22%, transparent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--brand);
  color: var(--brand-contrast);
  border-radius: var(--radius);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus {
  top: 12px;
}

.muted {
  color: var(--text-muted);
}
.subtle {
  color: var(--text-subtle);
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.nowrap {
  white-space: nowrap;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row.wrap {
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grow {
  flex: 1;
  min-width: 0;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ---------------------------------------------------------------------------
   Server-rendered pages (EJS): elements toggled with the `hidden` attribute
   must stay hidden even when a component rule sets `display`.
   --------------------------------------------------------------------------- */
[hidden] {
  display: none !important;
}
.inline-form {
  display: inline;
  margin: 0;
}
