/* Minimal reset + base typography. */

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

* {
  margin: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  background:
    radial-gradient(60rem 32rem at 85% -10%, var(--glow), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}

/* Fixed grain layer: breaks the flat digital look, never repaints on scroll. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  flex: 1;
  width: 100%;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); letter-spacing: -0.035em; line-height: 1.08; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); letter-spacing: -0.015em; }

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

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

code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.08em 0.35em;
  border-radius: 5px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  line-height: 1.55;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: var(--space-2) var(--space-3);
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

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

blockquote {
  border-left: 2px solid var(--accent);
  padding-left: var(--space-4);
  color: var(--text-muted);
}

.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 {
  position: absolute;
  top: -100%;
  left: var(--space-3);
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-2) var(--space-3);
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: var(--z-skip);
}

.skip-link:focus {
  top: 0;
}

/* Prism token colors (build-time syntax highlighting). */
.token.comment, .token.prolog, .token.cdata { color: var(--tok-comment); font-style: italic; }
.token.keyword, .token.tag, .token.important { color: var(--tok-keyword); }
.token.string, .token.char, .token.attr-value, .token.regex { color: var(--tok-string); }
.token.function, .token.class-name, .token.selector, .token.attr-name { color: var(--tok-function); }
.token.number, .token.boolean, .token.constant, .token.symbol { color: var(--tok-number); }
.token.operator, .token.punctuation { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
