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

:root {
  --bg: #0d1117;
  --fg: #e6edf3;
  --muted: #8b949e;
  --dim: #6e7681;
  --accent: #58a6ff;
  --scanline: rgba(255, 255, 255, 0.03);
  --dot: rgba(255, 255, 255, 0.08);
  --code-bg: rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --fg: #0d0d0d;
    --muted: #555555;
    --dim: #888888;
    --accent: #0969da;
    --scanline: rgba(0, 0, 0, 0.02);
    --dot: rgba(0, 0, 0, 0.06);
    --code-bg: rgba(0, 0, 0, 0.05);
  }
}

[data-theme="light"] {
  --bg: #ffffff;
  --fg: #0d0d0d;
  --muted: #555555;
  --dim: #888888;
  --accent: #0969da;
  --scanline: rgba(0, 0, 0, 0.02);
  --dot: rgba(0, 0, 0, 0.06);
  --code-bg: rgba(0, 0, 0, 0.05);
}

body {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  position: relative;
}

body.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* CRT scanlines */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 4px
  );
  pointer-events: none;
  z-index: 10;
}

/* Constellation dots — positioned by JS */
.dot {
  position: fixed;
  width: 2px;
  height: 2px;
  background: var(--dot);
  border-radius: 50%;
  animation: drift linear infinite;
}

@keyframes drift {
  0%   { transform: translate(0, 0); opacity: 0.4; }
  25%  { opacity: 0.8; }
  50%  { transform: translate(var(--dx), var(--dy)); opacity: 0.4; }
  75%  { opacity: 0.7; }
  100% { transform: translate(0, 0); opacity: 0.4; }
}

.content {
  text-align: center;
  z-index: 5;
  padding: 2rem;
}

.name {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: inline-block;
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

/* Glitch effect */
.name::before,
.name::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.name::before {
  animation: glitch-1 4s infinite linear;
  clip-path: inset(0 0 80% 0);
  color: var(--accent);
  opacity: 0;
}

.name::after {
  animation: glitch-2 4s infinite linear;
  clip-path: inset(80% 0 0 0);
  color: var(--accent);
  opacity: 0;
}

@keyframes glitch-1 {
  0%, 89%, 91%, 100% { opacity: 0; transform: none; }
  90% { opacity: 0.8; transform: translateX(-3px); }
}

@keyframes glitch-2 {
  0%, 93%, 95%, 100% { opacity: 0; transform: none; }
  94% { opacity: 0.8; transform: translateX(3px); }
}

/* Blinking cursor */
.cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%, 40% { opacity: 1; }
  50%, 90% { opacity: 0; }
}

.links {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.links a {
  color: var(--muted);
  text-decoration: none;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.links a svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex-shrink: 0;
}

.links a:hover,
.links a:focus {
  color: var(--accent);
}

.now-playing {
  color: var(--muted);
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  transition: color 0.2s;
}

.now-playing .note {
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.scrobbles {
  color: var(--dim);
  font-size: clamp(0.65rem, 1.8vw, 0.75rem);
  opacity: 0.7;
}

.now-game {
  color: var(--muted);
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  transition: color 0.2s;
}

.game-stats {
  color: var(--dim);
  font-size: clamp(0.65rem, 1.8vw, 0.75rem);
  opacity: 0.7;
}

.fingerprint {
  margin-top: 2.5rem;
  padding: 0 1.5rem 2rem;
  font-size: 0.65rem;
  color: var(--dim);
  opacity: 0.5;
  letter-spacing: 0.05em;
  text-align: center;
}

/* Long-form prose layout */
.prose {
  max-width: 65ch;
  margin: 6rem auto 4rem;
  padding: 0 1.5rem;
  position: relative;
  z-index: 5;
}

.prose h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--fg);
  font-weight: 600;
}

.prose h2 {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  letter-spacing: -0.01em;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
  font-weight: 600;
}

.post-date,
.page-subtitle {
  color: var(--muted);
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  margin-bottom: 2rem;
}

.prose p {
  line-height: 1.65;
  margin-bottom: 1.25rem;
  color: var(--fg);
}

.prose a {
  color: var(--accent);
  text-decoration: none;
}

.prose a:hover {
  text-decoration: underline;
}

.prose code {
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.prose pre {
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.prose li {
  line-height: 1.65;
  margin-bottom: 0.4rem;
}

.prose blockquote {
  border-left: 3px solid var(--dim);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1.25rem;
  font-style: italic;
  color: var(--muted);
}

/* Back-home link on long-form pages */
.back-home {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 15;
  color: var(--muted);
  text-decoration: none;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  transition: color 0.2s;
}

.back-home:hover {
  color: var(--accent);
}
