/* =============================================================================
   Base — reset, typography, and the handful of utilities the whole site shares.
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Anchored sections land below the sticky header rather than under it. */
  scroll-padding-top: var(--space-9);
}

body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--weight-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The `hidden` attribute is how this codebase shows and hides things: the result
   body, the view switcher, the action bar, the notices, the disclosure panels. A
   class that sets `display` beats the user-agent rule for `[hidden]`, so without
   this a "hidden" element with `display: grid` on it stays on screen. */
[hidden] {
  display: none !important;
}

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

svg {
  flex: none;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--brand-600);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--brand-700);
}

dl,
dd,
dt {
  margin: 0;
}

/* -----------------------------------------------------------------------------
   Focus.

   One visible ring everywhere, on keyboard focus only, so a mouse user is not
   followed around by outlines and a keyboard user is never lost.
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Result cards take programmatic focus after Calculate. The ring would be noise
   there — the heading being read out is the feedback that matters. */
[tabindex='-1']:focus {
  outline: none;
}

/* -----------------------------------------------------------------------------
   Motion.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -----------------------------------------------------------------------------
   Utilities.
   -------------------------------------------------------------------------- */

/* Visible to screen readers, invisible to everyone else. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The skip link: the same rules, until it is focused. */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  z-index: 50;
  padding: var(--space-3) var(--space-4);
  background: var(--brand-600);
  color: var(--brand-contrast);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--brand-contrast);
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: 52rem;
}

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

.prose p + p,
.prose p + ul,
.prose ul + p {
  margin-top: var(--space-4);
}

.prose h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.prose h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: var(--space-2);
}

.prose strong {
  font-weight: var(--weight-semibold);
}

/* Numbers line up in columns only if the figures are the same width. */
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-500);
}

/* -----------------------------------------------------------------------------
   Print.
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }

  .skip-link,
  .site-header,
  .site-footer,
  .no-print {
    display: none !important;
  }

  a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
    color: #444;
  }
}
