/* ==========================================================================
   Base — reset, typography, links, focus
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  transition: background-color var(--dur) ease, color var(--dur) ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
svg,
video,
canvas,
picture {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

h3,
h4 {
  letter-spacing: -0.01em;
  font-weight: 600;
  line-height: var(--lh-snug);
}

p {
  color: var(--text-muted);
  text-wrap: pretty;
}

strong {
  color: var(--text);
  font-weight: 600;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--text);
}

/* Focus: always visible for keyboard users */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(102, 126, 234, 0.45);
  color: #fff;
}

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: calc(var(--z-loader) + 1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: #fff;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Solid surfaces when the visitor asks for less transparency or more contrast */
@media (prefers-reduced-transparency: reduce) {
  :root,
  :root[data-theme] {
    --surface: var(--bg-raised);
    --surface-overlay: var(--bg-raised);
    --blur: none;
  }
}

@media (prefers-contrast: more) {
  :root,
  :root[data-theme] {
    --surface: var(--bg-raised);
    --surface-overlay: var(--bg-raised);
    --border: var(--text-muted);
    --border-strong: var(--text);
    --text-muted: var(--text);
    --blur: none;
  }
}

@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;
  }
}
