/* Reset, document defaults, typography and utilities. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

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

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

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: var(--text-md);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

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

button {
  margin: 0;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

th {
  text-align: left;
  font-weight: 600;
}

strong,
b {
  font-weight: 600;
}

code,
kbd,
samp,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
}

hr {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--divider);
}

::selection {
  background: rgba(59, 130, 246, 0.38);
}

[hidden] {
  display: none !important;
}

/* Focus: one visible ring everywhere, only for keyboard users. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1:focus,
h1:focus-visible,
main:focus,
main:focus-visible {
  outline: none;
}

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--text-muted);
}

.subtle {
  color: var(--text-subtle);
}

.nowrap {
  white-space: nowrap;
}

.break-all {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.stack--sm {
  gap: var(--space-3);
}

.stack--md {
  gap: var(--space-4);
}

.stack > .badge,
.stack > .btn:not(.btn--block) {
  align-self: flex-start;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.row--end {
  justify-content: flex-end;
}

.row--tight {
  gap: var(--space-2);
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 0.9375rem;
  height: 0.9375rem;
}

.icon--lg {
  width: 1.375rem;
  height: 1.375rem;
}

.icon--xl {
  width: 1.75rem;
  height: 1.75rem;
  stroke-width: 1.6;
}

.icon .fill {
  fill: currentColor;
  stroke: none;
}

.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: none;
  color: var(--on-primary);
  outline: 2px solid var(--on-primary);
  outline-offset: -4px;
}

.noscript {
  margin: var(--space-8) auto;
  max-width: 32rem;
  padding: var(--space-6);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

/* Boot splash (static markup of index.html, replaced once the app starts). */
.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.boot__logo {
  width: 64px;
  height: 64px;
  animation: boot-pulse 1.6s var(--ease) infinite alternate;
}

@keyframes boot-pulse {
  from {
    opacity: 0.55;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@media (forced-colors: active) {
  .icon {
    stroke: CanvasText;
  }
}
