/* Base reset, typography, scrollbars, and utility primitives */

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-base);
  color: var(--text-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-base);
  color: var(--text-body);
  font-family: var(--font-sans);
  line-height: 1.62;
  overflow-x: hidden;
}

main {
  flex: 1 0 auto;
}

::selection {
  background: var(--blue);
  color: #ffffff;
}

/* Custom dark scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-void);
}

::-webkit-scrollbar-thumb {
  background: rgba(136, 146, 160, 0.28);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--blue);
}

/* Headings */
h1, h2, h3, h4 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.015em;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--blue-hi);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}

a:hover {
  color: #ffffff;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

code, pre, kbd {
  font-family: var(--font-mono);
}

code {
  padding: 0.12em 0.42em;
  border-radius: var(--radius-xs);
  background: rgba(47, 128, 255, 0.11);
  border: 1px solid rgba(47, 128, 255, 0.2);
  color: #dbe8ff;
  font-size: 0.86em;
  word-break: break-word;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55em;
  padding: 0.1em 0.42em;
  border-radius: 3px;
  background: var(--bg-panel-hi);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  color: var(--text-strong);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.25;
}

pre {
  margin: 0;
  overflow-x: auto;
}

pre code {
  padding: 0;
  border: none;
  background: transparent;
  color: #dce5f2;
  font-size: 0.85rem;
  line-height: 1.55;
  word-break: normal;
}

ul, ol {
  margin: 0;
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.4rem;
}

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

/* Utilities */
.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;
}

.mono {
  font-family: var(--font-mono);
}

.wordmark {
  font-family: var(--font-wordmark);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.wordmark .accent-1 {
  color: var(--blue);
}

/* Signature Demonware / CoDOL sweeping hairline rule */
.sweep-rule {
  position: relative;
  height: 1px;
  width: 100%;
  background: var(--border);
  overflow: hidden;
}

.sweep-rule::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 240px;
  left: -240px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--blue-hi), transparent);
  animation: ruleSweep 9s ease-in-out 1.5s infinite;
}

@keyframes ruleSweep {
  0% { left: -240px; }
  30%, 100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sweep-rule::after { animation: none; display: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
