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

:root {
  --bg: #000;
  --text: #e8e8e8;
  --text-secondary: #999;
  --text-dim: #555;
  --accent: #c9a84c;
  --font: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace;
  --green: #43b581;
  --yellow: #faa61a;
  --red: #f04747;
  --gray: #555;
  --border: rgba(255,255,255,0.03);
  --border-light: rgba(255,255,255,0.06);

  --content-width: 680px;
  --content-wide: 880px;
  --nav-height: 56px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-dim);
}

.bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  background: #000;
}

#life-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.12;
  filter: blur(3px);
}

a {
  color: var(--text);
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
}

a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

a:hover {
  color: var(--accent);
}

a:hover::after {
  transform: scaleX(1);
}

img {
  max-width: 100%;
  height: auto;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 2rem;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-logo::after {
  display: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.nav-links a::after {
  display: none;
}

.nav-links a:hover {
  color: var(--text);
}

.main-content {
  position: relative;
  z-index: 1;
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
  min-height: calc(100vh - var(--nav-height) - 120px);
}

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 2rem 2rem;
}

.footer-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-dim);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer-links a::after {
  display: none;
}

.footer-links a:hover {
  color: var(--text-secondary);
}

.btn {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  cursor: default;
}

.btn::after {
  display: none;
}

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

.hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero-desc {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 40ch;
  line-height: 1.55;
}

.post-list h2 {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
}

.post-preview {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.post-preview:last-child {
  border-bottom: none;
}

.post-date {
  display: block;
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 0.2rem;
  font-family: var(--font-mono);
}

.post-preview .post-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.post-preview .post-title a {
  color: var(--text);
}

.post-preview .post-title a::after {
  bottom: -1px;
  height: 1px;
}

.post-preview .post-title a:hover {
  color: var(--accent);
}

.post-desc {
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.reading-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 300;
}

.post-tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

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

.tag::after {
  display: none;
}

.tag-lg {
  font-size: 0.78rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1rem 0;
}

.view-all {
  text-align: center;
  padding: 2rem 0;
}

.post-full {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-full .post-title {
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.toc {
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

.toc-title {
  font-size: 0.65rem;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 0.25rem;
}

.toc-level-2 {
  padding-left: 0;
}

.toc-level-3 {
  padding-left: 1rem;
}

.toc-list a {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-secondary);
}

.toc-list a::after {
  display: none;
}

.toc-list a:hover {
  color: var(--accent);
}

.post-nav {
  max-width: var(--content-width);
  margin: 3rem auto 0;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.post-nav-inner {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.post-nav-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 400;
}

.post-nav-title {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.post-nav-link:hover .post-nav-title {
  color: var(--accent);
}

.post-nav-link::after {
  display: none;
}

.post-nav-prev, .post-nav-next {
  flex: 1;
}

.post-nav-next {
  text-align: right;
}

.related-posts {
  max-width: var(--content-width);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.related-post {
  padding: 1rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
}

.related-post h3 {
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.related-post h3 a::after {
  display: none;
}

.related-post h3 a:hover {
  color: var(--accent);
}

.related-post p {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
}

.series-notice {
  max-width: var(--content-width);
  margin: 2rem auto 0;
  padding: 1rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-secondary);
}

.page-archive h1,
.page-tag h1,
.page-tags h1,
.page-about h1,
.page-404 h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.result-count {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.archive-entry {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.archive-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 7rem;
}

.archive-title {
  font-size: 0.95rem;
  font-weight: 400;
  flex: 1;
}

.archive-title a::after {
  display: none;
}

.archive-title a:hover {
  color: var(--accent);
}

.archive-tags {
  display: flex;
  gap: 0.25rem;
}

.page-404 {
  text-align: center;
  padding: 4rem 0;
}

.page-404 h1 {
  font-size: 5rem;
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  letter-spacing: -0.04em;
}

.error-message {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.about-content {
  max-width: var(--content-width);
  line-height: 1.8;
}

.about-content p {
  margin-bottom: 1rem;
  font-size: 0.92rem;
  font-weight: 300;
  color: var(--text-secondary);
}

.about-content h3 {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.about-content strong {
  font-weight: 500;
  color: var(--text);
}

.search-container {
  position: relative;
}

.search-input {
  width: 120px;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 300;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  width: 180px;
  color: var(--text);
  border-color: var(--text-dim);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  margin-top: 0.5rem;
  background: #0a0a0a;
  border: 1px solid var(--border);
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(255,255,255,0.02);
}

.search-result-item::after {
  display: none;
}

.search-result-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.search-result-desc {
  display: block;
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
  line-height: 1.4;
}

.search-result-meta {
  display: block;
  font-size: 0.62rem;
  font-weight: 300;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 300;
}
