/* Modern reset + element defaults. */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-125);
  line-height: var(--lh-prose);
  font-feature-settings: "kern", "liga", "onum"; /* old-style numerals */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Display family for headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-150); }
h5 { font-size: var(--fs-125); }
h6 { font-size: var(--fs-100); text-transform: uppercase; letter-spacing: var(--ls-wide); color: var(--muted); }

p {
  text-wrap: pretty;
}

/* Prose rhythm: vertical spacing inside long-form bodies */
.prose > * + * {
  margin-top: var(--space-4);
}

.prose h2 { margin-top: var(--space-7); }
.prose h3 { margin-top: var(--space-6); }
.prose h4 { margin-top: var(--space-5); }

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
  max-width: var(--measure-prose);
}

/* Links */
a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--transition-fast),
              text-decoration-color var(--transition-fast);
}

a:hover {
  color: var(--accent-ink);
  text-decoration-color: currentColor;
}

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

/* Focus */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Block elements */
blockquote {
  border-left: 2px solid var(--accent);
  padding-left: var(--space-4);
  font-style: italic;
  color: var(--ink);
  max-width: var(--measure-prose);
}

blockquote cite {
  display: block;
  margin-top: var(--space-2);
  font-style: normal;
  font-size: var(--fs-75);
  color: var(--muted);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

hr {
  border: 0;
  border-top: var(--hairline);
  margin: var(--space-7) 0;
}

ul, ol {
  padding-left: var(--space-5);
}

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

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

pre {
  padding: var(--space-4);
  background: color-mix(in srgb, var(--ink) 4%, var(--bg));
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--lh-snug);
}

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

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

/* :where() keeps base specificity at 0 so component classes win without effort */
:where(input[type="text"], input[type="email"], input[type="search"], textarea) {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border: var(--hairline);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

:where(input[type="text"], input[type="email"], input[type="search"], textarea):focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Selection */
::selection {
  background: var(--accent-bg);
  color: var(--ink);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--ink);
  color: var(--bg);
  padding: var(--space-3) var(--space-4);
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Visually-hidden helper for accessible labels */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
