/* ==========================================================================
   Base Styles - Reset, Typography, and Foundation
   ========================================================================== */

/* -------------------------------------------------------------------------
   Modern CSS Reset
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
}

/* Remove default margin and set core body defaults */
body {
  min-height: 100vh;
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  overflow-x: hidden;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Balance text wrapping on headings */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.1;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

/* Improve paragraph readability */
p {
  text-wrap: pretty;
  max-width: 70ch;
}

/* Remove list styles on ul, ol elements */
ul,
ol {
  list-style: none;
}

/* Set shorter line heights on headings and interactive elements */
button,
input,
label {
  line-height: var(--line-height-snug);
}

/* A elements inherit color */
a {
  color: inherit;
  text-decoration: none;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Remove button styling */
button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: calc(var(--header-height) + var(--space-8));
}

/* -------------------------------------------------------------------------
   Typography - Headings
   ------------------------------------------------------------------------- */
h1 {
  font-size: var(--font-size-4xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
}

/* Responsive heading sizes */
@media (min-width: 768px) {
  h1 {
    font-size: var(--font-size-5xl);
  }

  h2 {
    font-size: var(--font-size-4xl);
  }

  h3 {
    font-size: var(--font-size-3xl);
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: var(--font-size-6xl);
  }
}

/* -------------------------------------------------------------------------
   Typography - Body Text
   ------------------------------------------------------------------------- */
.text-sm {
  font-size: var(--font-size-sm);
}

.text-base {
  font-size: var(--font-size-base);
}

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

.text-xl {
  font-size: var(--font-size-xl);
}

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

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

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

/* -------------------------------------------------------------------------
   Typography - Font Weights
   ------------------------------------------------------------------------- */
.font-normal {
  font-weight: var(--font-weight-normal);
}

.font-medium {
  font-weight: var(--font-weight-medium);
}

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

.font-bold {
  font-weight: var(--font-weight-bold);
}

/* -------------------------------------------------------------------------
   Links
   ------------------------------------------------------------------------- */
a:not([class]) {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:not([class]):hover {
  color: var(--color-primary-dark);
}

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

/* -------------------------------------------------------------------------
   Focus Styles
   ------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------------------
   Screen Reader Only
   ------------------------------------------------------------------------- */
.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;
}
