/* ============================================================
   Base — reset + global element styles
   Depends on tokens.css being loaded first.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--font-leading-loose);
  color: var(--color-fg-2);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Media ── */
img,
video,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headline);
  font-weight: 700;
  line-height: var(--font-leading-tight);
  letter-spacing: var(--font-tracking-tight);
  color: var(--color-fg-1);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); font-weight: 600; }
h4 { font-size: var(--font-size-h4); font-weight: 600; }
h5 { font-size: var(--font-size-lead); font-weight: 600; }
h6 { font-size: var(--font-size-base); font-weight: 600; }

p {
  max-width: 68ch;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color var(--ease-duration-fast) var(--ease-out);
}

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

strong, b {
  font-weight: 700;
  color: var(--color-fg-1);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--font-size-sm);
}

/* ── Lists ── */
ul, ol {
  list-style: none;
}

/* ── Forms ── */
button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

/* ── Tables ── */
table {
  border-collapse: collapse;
}

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Shared section utilities ── */
.section-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-headline);
  font-size: var(--font-size-eyebrow);
  font-weight: 700;
  letter-spacing: var(--font-tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-purple);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-fg-1);
  line-height: var(--font-leading-tight);
  letter-spacing: var(--font-tracking-tight);
  margin-bottom: var(--space-4);
}

.section-lead {
  font-size: var(--font-size-lg);
  color: var(--color-text);
  line-height: var(--font-leading-normal);
  margin-bottom: var(--space-6);
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

/* Accessible visually-hidden helper (for form labels, sr-only text, etc.) */
.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;
}

/* Skip link — visible on focus for keyboard users (WCAG 2.4.1 Bypass Blocks) */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-3);
  z-index: 9999;
  padding: var(--space-3) var(--space-5);
  background: var(--color-purple-deep);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-headline);
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: var(--space-3);
  outline: 2px solid var(--color-yellow);
  outline-offset: 2px;
}

/* Back-to-top floating button */
.back-to-top {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--color-purple-deep);
  color: #fff;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), background 150ms;
  z-index: 100;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--color-purple);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 80ms;
    transform: none;
  }
}
