/* =============================================================================
   CHIAROSCURO BASE STYLES
   Reset, defaults, scrollbar, selection, focus, smooth scrolling.
   Matched to Clockwork reference implementation.
   Zero hardcoded colors — all via tokens.
   ============================================================================= */

/* -- Reset ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* -- Document --------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.09) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(180deg, #0b0b11 0%, #0c0d14 100%);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Blue underglow — atmospheric depth */
body::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40vh;
  background: radial-gradient(ellipse 80% 60% at 50% 100%, rgba(59, 142, 255, 0.10) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* -- Global transitions ----------------------------------------------------- */

button,
a,
input,
textarea,
select {
  transition:
    color var(--duration-base) var(--ease),
    background-color var(--duration-base) var(--ease),
    border-color var(--duration-base) var(--ease),
    box-shadow var(--duration-base) var(--ease),
    opacity var(--duration-base) var(--ease),
    filter var(--duration-base) var(--ease);
}

/* -- Typography defaults ---------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: var(--line-height-tight);
}

h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.04em;
}

h2 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

p {
  max-width: 65ch;
}

a {
  color: var(--color-blue);
  text-decoration: none;
}

a:hover {
  color: var(--color-blue-hover);
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  overflow-x: auto;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* -- Selection -------------------------------------------------------------- */

::selection {
  background-color: var(--color-blue-glow);
  color: var(--color-text-white);
}

/* -- Focus (double-ring pattern) -------------------------------------------- */

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-blue-glow);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 2px var(--color-blue-ring);
}

/* -- Scrollbar -------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* -- Accessibility ---------------------------------------------------------- */

@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;
  }
}
