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

:root {
  --line: #e0e0e0;
  --accent: #059669;
  --accent2: #34d399;
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-2: #333333;
  --text-3: #666666;
  --muted: #999999;
  --muted-2: #bbbbbb;
  --muted-3: #cccccc;
  --muted-4: #888888;
  --line-2: #e8e8e8;
  --line-3: #eeeeee;
  --code-bg: #f0f0f0;
  --blockquote-bg: #f8f8f6;
  --pre-bg: #1c1c1e;
  --pre-fg: #e0e0e0;
}

:root[data-theme="dark"] {
  --line: #2a2b2e;
  --accent: #10b981;
  --accent2: #34d399;
  --bg: #111214;
  --card: #1c1d21;
  --text: #e6e6e9;
  --text-2: #d0d0d4;
  --text-3: #a0a0a8;
  --muted: #8a8a92;
  --muted-2: #6a6a72;
  --muted-3: #52525a;
  --muted-4: #707078;
  --line-2: #26272b;
  --line-3: #232428;
  --code-bg: #2a2b2e;
  --blockquote-bg: #1a1b1e;
  --pre-bg: #0d0e10;
  --pre-fg: #d0d0d4;
}

body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Particle canvas ---- */
canvas#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---- Progress bar ---- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  z-index: 100;
  transition: width 0.1s linear;
}

/* ---- Top navigation ---- */
.top-nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 99;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s, box-shadow 0.3s;
}

.top-nav.scrolled {
  background: rgba(250,250,250,0.85);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.top-nav .nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.top-nav .nav-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.top-nav .nav-github {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-4);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--line);
}

.top-nav .nav-github:hover {
  color: var(--text);
  border-color: var(--muted-2);
}

.top-nav .nav-github svg {
  opacity: 0.7;
}

.top-nav .nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.top-nav .nav-links a {
  color: var(--muted-4);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
  transition: color 0.3s;
}

.top-nav .nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width 0.3s;
}

.top-nav .nav-links a:hover { color: var(--text); }
.top-nav .nav-links a:hover::after { width: 100%; }

/* ---- Container ---- */
.container {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 100px 32px 80px;
}

/* ---- Hero ---- */
.hero {
  display: flex;
  gap: 80px;
  align-items: flex-start;
  margin-bottom: 80px;
  padding-bottom: 60px;
  border-bottom: 1px solid var(--line-2);
}

.hero-left h1 {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
  position: relative;
  color: var(--text);
}

/* Glitch effect */
.glitch { position: relative; }

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 var(--accent2);
  animation: glitch1 2s infinite linear alternate-reverse;
  clip: rect(44px, 450px, 56px, 0);
}

.glitch::after {
  left: -2px;
  text-shadow: -2px 0 var(--accent);
  animation: glitch2 3s infinite linear alternate-reverse;
  clip: rect(20px, 450px, 36px, 0);
}

@keyframes glitch1 {
  0% { clip: rect(20px, 999px, 76px, 0); }
  20% { clip: rect(12px, 999px, 45px, 0); }
  40% { clip: rect(70px, 999px, 25px, 0); }
  60% { clip: rect(40px, 999px, 90px, 0); }
  80% { clip: rect(8px, 999px, 55px, 0); }
  100% { clip: rect(65px, 999px, 30px, 0); }
}

@keyframes glitch2 {
  0% { clip: rect(65px, 999px, 30px, 0); }
  20% { clip: rect(40px, 999px, 90px, 0); }
  40% { clip: rect(8px, 999px, 55px, 0); }
  60% { clip: rect(20px, 999px, 76px, 0); }
  80% { clip: rect(70px, 999px, 25px, 0); }
  100% { clip: rect(12px, 999px, 45px, 0); }
}

.hero-left .handle {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

.hero-right {
  padding-top: 8px;
  flex: 1;
}

.hero-right p {
  font-size: 15px;
  color: var(--muted-4);
  line-height: 1.8;
}

.hero-right .location {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-right .location .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.8); }
}

/* ---- Timeline ---- */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 1px;
  height: 100%;
  background: var(--line);
  transform-origin: top;
  animation: lineGrow 1.5s ease-out forwards;
}

@keyframes lineGrow {
  0% { transform: scaleY(0); }
  100% { transform: scaleY(1); }
}

.year-marker {
  position: relative;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-3);
  letter-spacing: 0.15em;
  padding: 32px 0 16px;
  text-transform: uppercase;
}

.year-marker::before {
  content: '';
  position: absolute;
  left: -44px;
  top: 38px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--accent);
  transition: all 0.4s;
}

.year-marker.active::before {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(5,150,105,0.4);
}

.tl-item {
  position: relative;
  padding: 20px 0 20px 24px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.3s;
  border-radius: 8px;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: -40px;
  top: 50%;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}

.tl-item:hover {
  background: var(--card);
  box-shadow: 0 2px 16px rgba(0,0,0,0.04);
}

.tl-item:hover::before { width: 16px; }

.tl-item .tl-date {
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 500;
  margin-bottom: 6px;
  transition: color 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tl-item:hover .tl-date { color: var(--accent); }

.tl-category {
  font-size: 11px;
  color: var(--accent);
  background: rgba(5,150,105,0.06);
  padding: 2px 10px;
  border-radius: 100px;
  font-weight: 500;
}

.tl-item .tl-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.tl-item.pinned {
  background: var(--card-bg);
  border-left: 2px solid var(--accent);
}

.tl-item.pinned:hover {
  border-left-color: var(--accent);
}

.tl-item .tl-excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---- Floating year indicator ---- */
.year-indicator {
  position: fixed;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 120px;
  font-weight: 800;
  color: rgba(0,0,0,0.06);
  pointer-events: none;
  z-index: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', sans-serif;
}

/* ======== POST PAGE ======== */
.post-full {
  max-width: 940px;
  margin: 0 auto;
}

.post-header {
  margin-bottom: 48px;
}

.back-link {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 24px;
  transition: color 0.3s;
}

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

.post-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--muted-2);
}

.post-tags {
  display: flex;
  gap: 8px;
}

.tag {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 10px;
  background: rgba(5,150,105,0.06);
  border-radius: 100px;
  transition: background 0.3s;
}

.tag:hover { background: rgba(5,150,105,0.15); }

/* ---- Post content ---- */
.post-content {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-2);
  border: 1px solid var(--code-bg);
  border-radius: 14px;
  padding: 28px 34px;
  transition: box-shadow 0.35s ease;
}

.post-content:hover {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.02),
    0 0 16px rgba(0, 0, 0, 0.055),
    0 0 34px rgba(0, 0, 0, 0.04);
}

.post-content h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 48px 0 16px;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 12px;
}

.post-content p {
  margin-bottom: 20px;
}

.post-content ul, .post-content ol {
  margin: 0 0 20px 24px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.post-content pre {
  background: var(--pre-bg);
  color: var(--pre-fg);
  padding: 20px 24px;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 0 0 20px;
  padding: 12px 20px;
  color: var(--text-3);
  background: var(--blockquote-bg);
  border-radius: 0 8px 8px 0;
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(5,150,105,0.2);
  transition: border-color 0.3s;
}

.post-content a:hover {
  border-bottom-color: var(--accent);
}

/* ---- Post navigation ---- */
.post-nav {
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.post-nav a {
  color: var(--text-3);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.3s;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ======== CATEGORIES PAGE ======== */
.category-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 28px 8px;
}

.cat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border-radius: 100px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.48));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  text-decoration: none;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  transform: rotate(calc(var(--r, 0) * 1deg)) translateY(var(--y, 0px));
}

.cat-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(5, 150, 105, 0.05);
  transform: rotate(0deg) translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.12);
}

.cat-pill .pill-name {
  font-weight: 600;
}

.cat-pill .pill-count {
  font-size: 0.72em;
  opacity: 0.55;
  font-weight: 600;
}

.cat-pill.xl { font-size: 22px; padding: 16px 30px; }
.cat-pill.lg { font-size: 18px; padding: 13px 26px; }
.cat-pill.md { font-size: 15px; padding: 11px 22px; }
.cat-pill.sm { font-size: 13px; padding: 9px 18px; }

/* ======== TAGS PAGE ======== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-item {
  padding: 8px 18px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid var(--line-3);
  color: var(--text-3);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
}

.tag-item:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(5,150,105,0.03);
}

/* ======== CATEGORY SIDEBAR ======== */
.category-sidebar {
  position: fixed;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 180px;
  display: none;
}

.cat-sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted-3);
  margin-bottom: 20px;
  text-align: right;
  font-weight: 600;
}

.cat-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.cat-cloud-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--line-2);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  text-decoration: none;
  color: var(--muted-4);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s;
  transform: rotate(calc(var(--i) * 1deg - 2deg));
  white-space: nowrap;
}

.cat-cloud-item:nth-child(odd) {
  transform: rotate(calc(var(--i) * -0.8deg + 1deg));
}

.cat-cloud-item:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(5,150,105,0.04);
  transform: rotate(0deg) scale(1.05);
}

.cat-cloud-count {
  font-size: 11px;
  color: var(--muted-3);
}

.cat-cloud-item:hover .cat-cloud-count {
  color: var(--accent);
}

/* Show sidebar only on larger screens */
@media (min-width: 1200px) {
  .category-sidebar {
    display: block;
  }
}

@media (min-width: 1400px) {
  .category-sidebar {
    right: 80px;
  }
}

/* ======== PAGINATION ======== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--line-2);
}

.page-btn {
  color: var(--text-3);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  transition: all 0.3s;
}

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

.page-btn.disabled {
  color: var(--muted-3);
  pointer-events: none;
  border-color: var(--line-3);
}

.page-info {
  font-size: 13px;
  color: var(--muted-2);
  font-weight: 500;
}

/* ======== FRIENDS PAGE ======== */
.friends-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
}

.friend-card {
  display: block;
  padding: 22px 28px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line-3);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
}

.friend-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 16px rgba(0,0,0,0.04);
  transform: translateX(6px);
}

.friend-card .friend-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.friend-card .friend-url {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 6px;
  word-break: break-all;
}

.friend-card .friend-desc {
  font-size: 14px;
  color: var(--muted);
}

.friends-footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted-3);
  padding: 24px 0;
  font-weight: 500;
}

.friends-footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted-3);
  padding: 24px 0;
  font-weight: 500;
}

/* ======== RESPONSIVE ======== */
@media (min-width: 1400px) {
  .container {
    max-width: 1080px;
  }

  .post-full {
    max-width: 980px;
  }

  .year-indicator {
    font-size: 160px;
    right: 60px;
  }
}

@media (max-width: 768px) {
  .hero { flex-direction: column; gap: 24px; }
  .year-indicator { display: none; }

  .top-nav {
    padding: 14px 20px;
  }

  .top-nav .nav-links {
    gap: 16px;
  }

  .top-nav .nav-github span {
    display: none;
  }

  .container {
    padding: 90px 20px 60px;
  }

  .post-title {
    font-size: 28px;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav a {
    max-width: 100%;
  }
}

/* ======== DARK MODE OVERRIDES ======== */
:root[data-theme="dark"] .top-nav.scrolled {
  background: rgba(17, 18, 20, 0.85);
}
:root[data-theme="dark"] .cat-pill {
  background: linear-gradient(135deg, rgba(28, 29, 33, 0.78), rgba(28, 29, 33, 0.48));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
:root[data-theme="dark"] .cat-cloud-item {
  background: rgba(28, 29, 33, 0.7);
}

/* ======== SETTINGS GEAR & PANEL ======== */
.settings-gear {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, color 0.25s ease, border-color 0.25s ease;
}
.settings-gear:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(60deg);
}
.settings-panel {
  position: fixed;
  right: 22px;
  bottom: 76px;
  z-index: 1000;
  width: 220px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--card);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.settings-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.settings-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.settings-item:last-child { margin-bottom: 0; }
.settings-item > span {
  font-size: 14px;
  color: var(--text-3);
}
.font-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}
.font-btn,
.theme-btn {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 10px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.font-btn:hover,
.theme-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.font-val {
  font-size: 12px;
  color: var(--muted);
  min-width: 40px;
  text-align: center;
}

/* ======== POST META ICONS ======== */
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meta-icon {
  opacity: 0.75;
  flex-shrink: 0;
}
