/* Main stylesheet -- native CSS nesting and grid, no preprocessor */

/* ---- Page foundation ---- */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* ---- Skip link (accessibility) ---- */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-surface);
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
  z-index: 100;
  transform: translateY(-200%);
  transition: transform var(--transition-fast);

  &:focus {
    transform: translateY(0);
  }
}

/* ---- Headings ---- */
h1 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  line-height: 1.1;
  margin-block-end: var(--space-6);
}

h2 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  line-height: 1.2;
  margin-block-end: var(--space-4);
}

h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  line-height: 1.3;
  margin-block-end: var(--space-3);
}

/* ---- Prose content ---- */
p {
  margin-block-end: var(--space-4);

  &:last-child {
    margin-block-end: 0;
  }
}

/* ---- Links ---- */
a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition-fast);

  &:hover {
    color: var(--color-text);
  }
}

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

/* ---- Screen-reader-only utility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Images within content ---- */
main img,
main picture {
  margin-block: var(--space-6);
  border-radius: 4px;
}

/* ---- 404 page ---- */
.not-found {
  text-align: center;
  padding: var(--space-16) var(--space-4);
  max-width: var(--content-width);
  margin-inline: auto;
}

.not-found__message {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-block-end: var(--space-8);
}

.not-found__cta {
  margin-block-end: var(--space-12);

  & a {
    font-size: var(--text-lg);
    font-weight: 600;
  }
}

.not-found__suggestions {
  text-align: left;
  max-width: 20rem;
  margin-inline: auto;

  & h2 {
    font-size: var(--text-lg);
    margin-block-end: var(--space-4);
  }

  & ul {
    list-style: none;
    padding: 0;
  }

  & li {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
  }

  & li:last-child {
    border-bottom: none;
  }
}

/* ---- Reduced 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;
  }
}
