/* ==========================================================================
   Base — reset, typography, accessibility primitives
   ========================================================================== */

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

/* ---- Scrollbar ----
   Firefox gets the standard two-value syntax; WebKit/Blink get the pseudo-
   elements below, which allow the gradient thumb. Scoped to the page scroller
   so the carousels that hide their own bars stay untouched. */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-deep) transparent;
}

body::-webkit-scrollbar,
html::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body::-webkit-scrollbar-track,
html::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  /* Hairline separating the track from the page content. */
  border-left: 1px solid var(--border);
}

body::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  /* Inset border keeps the thumb visually narrower than its hit area. */
  border: 2px solid var(--bg-elevated);
  background-clip: padding-box;
  transition: background var(--dur-fast) var(--ease-out);
}

body::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  background-clip: padding-box;
}

body::-webkit-scrollbar-thumb:active,
html::-webkit-scrollbar-thumb:active {
  background: var(--accent-hover);
  background-clip: padding-box;
}

/* The corner where vertical and horizontal bars meet. */
body::-webkit-scrollbar-corner,
html::-webkit-scrollbar-corner {
  background: var(--bg-elevated);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* The reset above (author-origin) silently overrides the UA stylesheet's
   [hidden] rule for these elements regardless of specificity, since
   author styles always win over UA styles in the cascade. Restore native
   hidden semantics explicitly — several components (play/pause and
   muted/unmuted icon toggles) rely on the plain `hidden` attribute. */
[hidden] {
  display: none !important;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--fs-h1);
}
h2 {
  font-size: var(--fs-h2);
}
h3 {
  font-size: var(--fs-h3);
}

p {
  color: var(--text-secondary);
}

/* ---- Focus visibility (keyboard nav) ---- */
:focus {
  outline: none;
}

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

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

/* ---- Skip link ---- */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--space-sm);
  z-index: var(--z-skip);
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  transition: top var(--dur-fast) var(--ease-out);
}

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

/* ---- Visually hidden (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;
}

/* ---- Typographic utility classes ---- */
.font-display {
  font-family: var(--font-display);
}

/* Canonical space below every eyebrow/kicker, everywhere it's used —
   sections that group it with a heading via .section-head's flex gap
   zero this out (see layout.css) so the two mechanisms never stack. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-bottom: var(--space-sm);
  font-family: var(--font-display);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* +16% on desktop specifically, for readability at typical monitor
   viewing distance — mobile keeps the base size. */
@media (min-width: 861px) {
  .eyebrow {
    font-size: 0.87rem;
  }
}

.eyebrow::before {
  content: "";
  width: 1.5em;
  height: 1px;
  background: var(--accent);
}

.lead {
  font-size: var(--fs-lead);
  color: var(--text-secondary);
  max-width: 44ch;
}

/* ---- Reduced motion: neutralize scroll-driven transforms globally ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
