@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  * {
    margin: 0;
  }
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    min-height: 100dvh;
  }
  img,
  picture,
  svg,
  video,
  canvas {
    display: block;
    max-width: 100%;
  }
  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }
  button {
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
  }
  ul[role],
  ol[role] {
    list-style: none;
    padding: 0;
  }
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }
  table {
    border-collapse: collapse;
  }
  fieldset {
    border: 0;
    padding: 0;
    min-width: 0;
  }
  dialog {
    padding: 0;
    border: 0;
    color: inherit;
    background: none;
    max-width: none;
    max-height: none;
  }
  [hidden] {
    display: none !important;
  }
}

@layer base {
  html {
    font-family: var(--font-sans);
    font-size: 100%;
    line-height: var(--leading);
    font-feature-settings: "cv05", "cv08"; /* l with tail, I with serifs: easier to read codes */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text);
    background: var(--bg);
    scrollbar-gutter: stable;
  }
  body {
    font-size: var(--text-base);
    background: var(--bg);
  }
  h1,
  h2,
  h3,
  h4 {
    line-height: var(--leading-tight);
    font-weight: var(--weight-semibold);
    letter-spacing: -0.011em;
    text-wrap: balance;
  }
  h1 {
    font-size: var(--text-xl);
  }
  h2 {
    font-size: var(--text-lg);
  }
  h3 {
    font-size: var(--text-md);
  }
  h4 {
    font-size: var(--text-base);
  }
  p {
    text-wrap: pretty;
  }
  a {
    color: var(--accent-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }
  a:hover {
    color: var(--accent-hover);
  }
  code,
  kbd,
  samp,
  pre {
    font-family: var(--font-mono);
    font-size: 0.92em;
  }
  ::selection {
    background: var(--cobalt-100);
  }
  :focus {
    outline: none;
  }
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  /* Tabular figures wherever numbers are compared. */
  table,
  input,
  output,
  data,
  time {
    font-variant-numeric: tabular-nums;
  }
  hr {
    border: 0;
    border-top: 1px solid var(--border);
  }
  .htmx-indicator {
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
  }
  .htmx-request .htmx-indicator,
  .htmx-request.htmx-indicator {
    opacity: 1;
  }
  [x-cloak] {
    display: none !important;
  }
}

@layer utilities {
  .sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .tnum {
    font-variant-numeric: tabular-nums;
  }
  .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
  }
  .muted {
    color: var(--text-muted);
  }
  .subtle {
    color: var(--text-subtle);
  }
  .text-sm {
    font-size: var(--text-sm);
  }
  .text-xs {
    font-size: var(--text-xs);
  }
  .nowrap {
    white-space: nowrap;
  }
  .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .stack {
    display: flex;
    flex-direction: column;
    gap: var(--stack-gap);
  }
  .stack-sm {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .stack-lg {
    display: flex;
    flex-direction: column;
    gap: var(--section-gap);
  }
  .cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }
  .cluster-lg {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
  }
  .grid-2 {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  }
  .grid-3 {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  }
  .spacer {
    flex: 1;
  }
  .w-full {
    width: 100%;
  }
}
