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

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(47, 91, 255, 0.15);
  color-scheme: dark;
}

a,
button,
input,
select,
textarea,
summary,
[role="button"] {
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  color: var(--brand-body-text);
  background-color: var(--background);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

/* Ensure the hidden attribute always wins over component display rules */
[hidden] {
  display: none !important;
}

/* Reduced Motion Override */
@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;
  }
}

/* Typography — heavy geometric sans for display headings, crisp white */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-height-tight);
  color: var(--foreground);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

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

p {
  margin-bottom: var(--space-4);
  color: var(--brand-body-text);
}

a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition:
    color var(--transition-normal),
    text-decoration-color var(--transition-normal);
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--color-primary-light, #5c80ff);
    text-decoration-color: var(--primary);
  }
}

a:active {
  color: var(--primary-alt, #4d73ff);
}

ul,
ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-8);
}

blockquote {
  border-left: 4px solid var(--primary);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-style: italic;
  color: var(--brand-labels);
  background-color: var(--primary-surface, rgba(47, 91, 255, 0.1));
}

/* Accessibility & Selection — Electric cobalt */
::selection {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.25);
}

/* Utilities */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
}

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

.text-center {
  text-align: center;
}

.text-gradient {
  background: linear-gradient(135deg, var(--brand-white) 25%, var(--brand-electric-cobalt) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: var(--font-weight-black);
}

.text-gradient--cobalt {
  background: linear-gradient(135deg, var(--brand-electric-cobalt), var(--brand-ultraviolet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Brand slash accent */
.brand-slash {
  display: inline-block;
  width: 6px;
  height: 1em;
  background-color: var(--primary);
  transform: skewX(-15deg);
  vertical-align: -0.1em;
  margin: 0 0.2em;
  box-shadow: 0 0 8px rgba(47, 91, 255, 0.4);
}

/* Typography Helpers — Wordmark & Board Labels */
.wordmark {
  font-family: var(--font-wordmark);
  letter-spacing: -0.02em;
}

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

.wordmark-labs {
  font-weight: var(--font-weight-light);
}

.board-label,
.meta-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-labels);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-overlay);
  padding: 12px 18px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 12px;
}

/* Responsive Container */
@media (min-width: 768px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}
