/* ============================================================================
   base.css – Base Element Styles
   ============================================================================ */

html {
  font-size: 16px;
  background: var(--color-bg);
  color: var(--color-text);
  scroll-behavior: smooth;
  /* Accent color for native form controls (checkboxes, radios, range, etc.) */
  accent-color: var(--color-primary);
  /* Smooth color transitions for theme change.
     Opted out by prefers-reduced-motion (see media query below). */
  transition: background-color var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html, body { transition: none !important; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-base);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-5xl); font-weight: var(--weight-black); letter-spacing: var(--tracking-tighter); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  text-wrap: pretty;
}

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

strong, b {
  font-weight: var(--weight-semibold);
}

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

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 22px;
  padding: 0 6px;
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 0 var(--color-border);
}

code:not(pre code) {
  padding: 2px 6px;
  background: var(--color-bg-muted);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}

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

:focus {
  outline: none;
}

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

a {
  color: var(--color-primary);
  transition: color var(--duration-fast) var(--ease-out);
  text-decoration-color: color-mix(in srgb, var(--color-primary) 35%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

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

mark {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

::placeholder {
  color: var(--color-text-subtle);
  opacity: 1;
}

/* === Native scrollbar (subtle, themed) === */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border: 2px solid var(--color-bg);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-subtle);
}

/* === Selection === */
::selection {
  background: color-mix(in srgb, var(--color-primary) 25%, transparent);
  color: var(--color-text);
}

/* === Utility: screen-reader only === */
.sr-only {
  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 {
  position: fixed;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-skiplink);
  background: var(--gradient-primary);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transition: top var(--duration-base) var(--ease-out), color var(--duration-base) var(--ease-out);
  box-shadow: var(--shadow-xl);
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--color-text-inverse);
  outline: none;
}

