/* Reset, typography and accessibility primitives. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Background photo, blurred and washed with the theme color so text keeps
   its contrast in both light and dark mode. */
body::before {
  content: '';
  position: fixed;
  inset: -32px;
  z-index: -2;
  background-image: url('/img/background.jpg');
  background-size: cover;
  background-position: center;
  filter: blur(12px) saturate(1.05);
  transform: scale(1.04);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg) 58%, transparent),
    color-mix(in srgb, var(--bg) 76%, transparent)
  );
  pointer-events: none;
}

body.nav-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-3);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
}

a {
  color: var(--brand-primary-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

a:hover {
  color: var(--brand-primary);
}

ul,
ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
  color: var(--text-muted);
}

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

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

button {
  font: inherit;
  color: inherit;
}

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

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

::selection {
  background: color-mix(in srgb, var(--brand-primary) 30%, transparent);
  color: var(--text);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transition: top var(--transition);
}

.skip-link:focus {
  top: var(--space-4);
}

[hidden] {
  display: none !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;
  }
}

@media print {
  .site-header,
  .site-footer,
  .theme-toggle,
  .nav-toggle {
    display: none !important;
  }

  body::before,
  body::after {
    display: none !important;
  }
}
