/* base.css: reset, document typography, focus, scrollbars (README §12.3, §12.5), plus the small utility layer.
   Every value comes from tokens.css. */
@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  /* Scrollbars: native and visible, square, a quiet track and a slim thumb (README §12.5, as written). */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-control) var(--color-surface-1);
  }
  @supports not (scrollbar-color: auto) {
    /* Safari: WebKit pseudo-elements */
    ::-webkit-scrollbar {
      width: var(--scrollbar-size);
      height: var(--scrollbar-size);
    }
    ::-webkit-scrollbar-track {
      background: var(--color-surface-1);
    }
    ::-webkit-scrollbar-thumb {
      background: var(--color-border-control);
      border: var(--scrollbar-inset) solid var(--color-surface-1);
      border-radius: var(--radius-none);
    }
    ::-webkit-scrollbar-thumb:hover {
      border-width: var(--scrollbar-inset-hover);
    }
    ::-webkit-scrollbar-thumb:active {
      background: var(--color-accent);
    }
  }
  @media (forced-colors: active) {
    * {
      scrollbar-color: auto;
    }
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    /* A control that gets focus (or a scrolled-to anchor) stays clear of the sticky bars and 16 px more: the top bar
       and an open offline banner above, the page action bar and the bottom nav below (WCAG 2.4.11). shell.js
       measures them; the token values apply before that and on pages without the shell. */
    scroll-padding-block: calc(var(--shell-top-inset, var(--topbar-height)) + var(--spacing-4))
      calc(var(--shell-bottom-inset, var(--spacing-12)) + var(--spacing-4));
  }

  body {
    min-height: var(--viewport-height);
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-regular);
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
  }

  h1,
  h2,
  h3,
  h4,
  p,
  figure,
  blockquote,
  dl,
  dd,
  ul,
  ol,
  pre {
    margin: 0;
  }

  /* Hierarchy comes from size, weight and contrast (README §12.3). */
  h1 {
    font-size: var(--text-xl);
    line-height: var(--leading-xl);
    font-weight: var(--weight-semibold);
  }
  h2 {
    font-size: var(--text-lg);
    line-height: var(--leading-lg);
    font-weight: var(--weight-semibold);
  }
  h3,
  h4 {
    font-size: var(--text-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-semibold);
  }
  @media (min-width: 768px) {
    h1 {
      font-size: var(--text-2xl);
      line-height: var(--leading-2xl);
    }
  }

  a {
    color: var(--color-accent-text);
    text-decoration-line: underline;
    text-decoration-thickness: var(--border-hairline);
    text-underline-offset: var(--spacing-0-5);
  }
  a:is(:hover, [data-force~='hover']) {
    color: var(--color-accent-pressed);
  }

  strong,
  b {
    font-weight: var(--weight-semibold);
  }
  small {
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
  }
  code,
  kbd,
  samp,
  pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
  }
  hr {
    height: 0;
    margin: 0;
    border: 0;
    border-top: var(--border-hairline) solid var(--color-border);
  }

  ul[class],
  ol[class] {
    padding: 0;
    list-style: none;
  }

  img,
  svg,
  video,
  canvas,
  iframe {
    display: block;
    max-width: 100%;
  }
  img,
  video {
    height: auto;
  }
  iframe {
    border: 0;
  }

  /* Brand artwork keeps its blue in forced-colours mode and is never restyled (README §12.8). */
  img[src^='/assets/brand/'] {
    forced-color-adjust: none;
    flex: none;
  }

  button,
  input,
  select,
  textarea {
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    border-radius: var(--radius-none);
  }
  button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: inherit;
  }
  button:disabled,
  [aria-disabled='true'] {
    cursor: not-allowed;
  }
  textarea {
    resize: vertical;
  }
  fieldset {
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  legend {
    padding: 0;
  }
  table {
    border-collapse: collapse;
    border-spacing: 0;
  }
  th {
    text-align: start;
    font-weight: inherit;
  }
  dialog {
    padding: 0;
    border: 0;
    color: inherit;
    background: none;
  }
  summary {
    cursor: pointer;
  }

  /* One visible focus ring everywhere: 2 px accent-text, 2 px offset (README §12.5). */
  :focus-visible,
  [data-force~='focus'] {
    outline: var(--focus-ring) solid var(--color-accent-text);
    outline-offset: var(--focus-offset);
  }
  :focus:not(:focus-visible) {
    outline: none;
  }
  /* Route changes move focus to the H1, and the skip link moves it to <main>: the page itself shows where you are. */
  h1[tabindex='-1']:focus,
  main[tabindex='-1']:focus,
  section[tabindex='-1']:focus {
    outline: none;
  }

  ::selection {
    background: var(--color-accent-wash);
    color: var(--color-text);
  }

  [hidden] {
    display: none !important;
  }

  /* Icons from the sprite (icons.js). The size comes from the width and height attributes. */
  .icon {
    display: inline-block;
    flex: none;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
  }

  /* Skip link: off screen until it is focused (index.html). */
  .skip-link {
    position: fixed;
    inset-block-start: var(--spacing-2);
    inset-inline-start: var(--spacing-2);
    z-index: var(--z-skip-link);
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    padding-inline: var(--spacing-4);
    border: var(--border-hairline) solid var(--color-border-control);
    background: var(--color-surface-1);
    color: var(--color-accent-text);
    font-weight: var(--weight-semibold);
    translate: 0 calc(-100% - var(--spacing-4));
  }
  .skip-link:focus {
    translate: 0 0;
  }

  noscript {
    display: block;
    padding: var(--spacing-6);
    text-align: center;
  }

  @media print {
    body {
      background: var(--color-surface-1);
    }
  }
}

/* Utilities win over every other layer (the order is declared in tokens.css). Keep this list short. */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: var(--border-hairline) !important;
    height: var(--border-hairline) !important;
    margin: calc(-1 * var(--border-hairline)) !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }

  /* Geist Mono for claim numbers, amounts, dates, times, references and sizes (README §12.1). */
  .mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }
  .num {
    font-variant-numeric: tabular-nums;
    text-align: end;
  }
  .muted {
    color: var(--color-text-muted);
  }
  .subtle {
    color: var(--color-text-subtle);
  }
  .danger-text {
    color: var(--color-danger-text);
  }
  .meta {
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    color: var(--color-text-subtle);
  }
  .truncate {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nowrap {
    white-space: nowrap;
  }
  .text-end {
    text-align: end;
  }
  .text-center {
    text-align: center;
  }
  .prose {
    max-width: var(--measure);
  }

  /* Breakpoint visibility: compact < 768, medium 768–1023, wide ≥ 1024 (README §12.4). */
  @media (min-width: 768px) {
    .only-compact {
      display: none !important;
    }
  }
  @media (max-width: 767.98px) {
    .from-medium {
      display: none !important;
    }
  }
  @media (min-width: 1024px) {
    .until-wide {
      display: none !important;
    }
  }
  @media (max-width: 1023.98px) {
    .only-wide {
      display: none !important;
    }
  }
}
