/* CSS custom properties */
:root {
  --bg: #040608;
  --fg: #e8eaf0;
  --fg-muted: #8890a4;
  --accent: #1af0c4;
  --accent-dim: rgba(26, 240, 196, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --fg: #0d1117;
  --fg-muted: #556070;
  --accent: #0a8a6e;
  --accent-dim: rgba(10, 138, 110, 0.1);
  --border: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6f9;
    --fg: #0d1117;
    --fg-muted: #556070;
    --accent: #0a8a6e;
    --accent-dim: rgba(10, 138, 110, 0.1);
    --border: rgba(0, 0, 0, 0.1);
  }
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  overflow-x: hidden;
}

/* Home page */
#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.home-overlay {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.home-logo {
  font-size: clamp(0.65rem, 1.5vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.home-tagline {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.home-sub {
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  color: var(--fg-muted);
  margin-bottom: 2.5rem;
  max-width: 420px;
  line-height: 1.6;
}

/* Email signup */
.signup-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 380px;
  margin-bottom: 2rem;
}

.signup-form input[type="email"] {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.signup-form input[type="email"]::placeholder {
  color: var(--fg-muted);
}

.signup-form input[type="email"]:focus {
  border-color: var(--accent);
}

.signup-form button {
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #040608;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.1s;
}

.signup-form button:hover { opacity: 0.85; }
.signup-form button:active { transform: scale(0.97); }
.signup-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.signup-status {
  font-size: 0.85rem;
  min-height: 1.2em;
  color: var(--accent);
  margin-top: -1.5rem;
  margin-bottom: 1.5rem;
}
.signup-status.error { color: #f07070; }

/* Home nav */
.home-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.home-nav a {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
}

.home-nav a:hover { color: var(--accent); }
.home-nav .sep { color: var(--border); }

/* Inner pages */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3rem;
}

.page-header a.back {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.page-header a.back:hover { color: var(--accent); }

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg);
  transition: background 0.2s;
  z-index: 100;
}
.theme-toggle:hover { opacity: 0.8; }

.page-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: var(--fg);
}

.prose {
  line-height: 1.75;
  color: var(--fg);
}
.prose p { margin-bottom: 1.25rem; }
.prose h2 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 0.75rem; color: var(--fg); }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--accent-dim);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

/* Blog index */
.post-list { list-style: none; }
.post-list li { border-bottom: 1px solid var(--border); }
.post-list li:first-child { border-top: 1px solid var(--border); }
.post-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1rem 0;
  text-decoration: none;
  color: var(--fg);
  transition: color 0.2s;
}
.post-list a:hover { color: var(--accent); }
.post-list .post-date {
  font-size: 0.8rem;
  color: var(--fg-muted);
  flex-shrink: 0;
  margin-left: 1rem;
}

/* Transition overlay */
#transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(26,240,196,0.08) 0%, var(--bg) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#transition-overlay.active { opacity: 1; }
