/* ZigZag Junk — base styles. Modern reset, typography defaults, and a11y primitives. */

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

:root {
  color-scheme: light dark;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  /* Prevent horizontal overflow caused by translated off-canvas elements
     (the mobile nav sheet uses transform: translateX(100%) when closed).
     `clip` is preferred over `hidden` because it doesn't create a
     containing block for absolute descendants and doesn't affect
     ancestor `position: sticky` behavior. */
  overflow-x: clip;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-body);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--color-text);
}

h1 {
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h3,
h4,
h5,
h6 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Anchor targets shouldn't tuck under the sticky nav. */
:is(h1, h2, h3, h4, h5, h6)[id],
[id] {
  scroll-margin-top: 5rem;
}

p {
  line-height: 1.6;
}

.prose p {
  max-width: 65ch;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--color-accent);
}

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

button {
  background: none;
  border: 0;
  cursor: pointer;
}

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

svg {
  fill: currentColor;
}

/* Remove the default focus outline only when :focus-visible is supported,
   so keyboard users still get a clear ring while mouse users don't. */
:focus:not(:focus-visible) {
  outline: none;
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: var(--z-toast);
}

.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  width: auto;
  height: auto;
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  color: var(--color-accent-text);
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
  z-index: var(--z-toast);
}

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

@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;
  }
}
