@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600&family=Share+Tech+Mono&family=Syne:wght@400;700;800&display=swap');

:root {
  --bg:          #020408;
  --bg2:         #040810;
  --bg3:         #060d18;
  --surface:     #0a1220;
  --surface2:    #0d1829;
  --border:      rgba(0, 180, 255, 0.08);
  --border2:     rgba(0, 180, 255, 0.18);
  --border3:     rgba(0, 180, 255, 0.35);
  --cyan:        #00b4ff;
  --cyan-dim:    rgba(0, 180, 255, 0.15);
  --cyan-glow:   rgba(0, 180, 255, 0.05);
  --cyan-pulse:  rgba(0, 180, 255, 0.6);
  --teal:        #00ffd0;
  --teal-dim:    rgba(0, 255, 208, 0.1);
  --violet:      #7b5ea7;
  --violet-dim:  rgba(123, 94, 167, 0.15);
  --red:         #ff4466;
  --amber:       #ffaa00;
  --text:        #c8dff0;
  --text-muted:  #5a7a96;
  --text-dim:    #2a4560;
  --text-bright: #e8f4ff;
  --mono:        'Share Tech Mono', 'Courier New', monospace;
  --display:     'Syne', sans-serif;
  --sans:        'Space Grotesk', system-ui, sans-serif;
  --max:          760px;
  --wide:         1100px;
  --scan-speed:   8s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Neural canvas ── */
#neural-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Scan lines ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0, 180, 255, 0.012) 2px, rgba(0, 180, 255, 0.012) 4px
  );
}

/* ── Moving scan beam ── */
body::after {
  content: '';
  position: fixed;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent, rgba(0,180,255,0.5), rgba(0,255,208,0.7),
    rgba(0,180,255,0.5), transparent
  );
  z-index: 2;
  animation: scan 2.5s linear 1 forwards;
  pointer-events: none;
  box-shadow: 0 0 18px 3px rgba(0, 180, 255, 0.25);
}

@keyframes scan {
  0%   { top: -2px; opacity: 0; }
  4%   { opacity: 1; }
  96%  { opacity: 1; }
  100% { top: 100vh; opacity: 0; }
}

/* ── Site wrapper ── */
.site-wrapper { position: relative; z-index: 3; }

/* ════════════════════════════════════════════
   HEADER
════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border2);
  background: rgba(2, 4, 8, 0.88);
  backdrop-filter: blur(20px);
}

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

.logo {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--cyan);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: 0.05em;
}

.logo-icon {
  width: 28px; height: 28px;
  border: 1px solid var(--border3);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--cyan);
  background: var(--surface);
  position: relative; overflow: hidden;
}
.logo-icon::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(0,180,255,0.15) 100%);
}

.logo-blink { animation: blink 1.4s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.header-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim);
}

.status-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100%{ box-shadow: 0 0 6px var(--teal); opacity: 1; }
  50%    { box-shadow: 0 0 2px var(--teal); opacity: 0.4; }
}

.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  font-family: var(--mono); font-size: 0.65rem; color: var(--text-muted);
  text-decoration: none; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.3rem 0.7rem; border: 1px solid transparent; border-radius: 3px;
  transition: all 0.2s;
}
.nav a:hover { color: var(--cyan); border-color: var(--border2); background: var(--cyan-glow); }

/* ════════════════════════════════════════════
   HERO
════════════════════════════════════════════ */
.hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  position: relative;
}

.hero-tag {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.62rem; color: var(--cyan);
  letter-spacing: 0.2em; text-transform: uppercase;
  border: 1px solid var(--border2); padding: 0.3rem 0.75rem;
  border-radius: 2px; background: var(--cyan-glow);
  margin-bottom: 2rem;
}
.hero-tag::before { content: '◈'; font-size: 0.6rem; }

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700; line-height: 1.12;
  color: var(--text-bright); margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.hero h1 .accent {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--cyan);
  position: relative; display: inline-block;
}
.hero h1 .accent::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  color: var(--cyan);
  filter: blur(14px); opacity: 0.25;
}

.hero-bio {
  font-size: 0.88rem; color: var(--text-muted);
  max-width: 520px; line-height: 1.85;
  font-family: var(--mono);
}

.hero-metrics {
  display: flex; gap: 2.5rem;
  margin-top: 2.5rem; padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.metric { display: flex; flex-direction: column; gap: 0.2rem; }
.metric-val {
  font-family: var(--display); font-size: 1.5rem; font-weight: 700;
  color: var(--cyan); line-height: 1;
  text-shadow: 0 0 20px rgba(0,180,255,0.3);
}
.metric-label {
  font-family: var(--mono); font-size: 0.58rem;
  color: var(--text-dim); letter-spacing: 0.15em; text-transform: uppercase;
}

/* ════════════════════════════════════════════
   MAIN GRID
════════════════════════════════════════════ */
.main-content {
  max-width: var(--wide); margin: 0 auto;
  padding: 3rem 2rem;
  display: grid; grid-template-columns: 1fr 220px;
  gap: 3rem; align-items: start;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════ */
.sidebar { position: sticky; top: 80px; }

.sidebar-label {
  font-family: var(--mono); font-size: 0.58rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.sidebar-label::before { content: '//'; color: var(--cyan); opacity: 0.5; }

.tag-cloud { display: flex; flex-direction: column; gap: 2px; }

.tag-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.38rem 0.65rem;
  background: none; border: 1px solid transparent; border-radius: 2px;
  color: var(--text-muted); font-family: var(--mono); font-size: 0.68rem;
  cursor: pointer; transition: all 0.15s; text-align: left; letter-spacing: 0.03em;
}
.tag-btn:hover { background: var(--cyan-glow); border-color: var(--border2); color: var(--cyan); }
.tag-btn.active {
  background: var(--cyan-dim); border-color: var(--border3); color: var(--cyan);
}

.tag-count {
  font-size: 0.58rem; color: var(--text-dim);
  background: var(--surface); padding: 0.1rem 0.35rem; border-radius: 2px;
}
.tag-btn.active .tag-count { background: rgba(0,180,255,0.15); color: var(--cyan); }

/* ════════════════════════════════════════════
   POSTS
════════════════════════════════════════════ */
.posts-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.posts-label {
  font-family: var(--mono); font-size: 0.58rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim);
  display: flex; align-items: center; gap: 0.5rem;
}
.posts-label::before { content: '//'; color: var(--cyan); opacity: 0.5; }
.posts-count { font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim); }

/* ── Post card ── */
.post-card {
  display: block; padding: 1.25rem 1.25rem 1.25rem 1.4rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 3px; text-decoration: none; color: inherit;
  transition: all 0.2s; position: relative; overflow: hidden;
  margin-bottom: 6px; cursor: pointer;
}
.post-card::before {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--cyan); opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 0 12px rgba(0,180,255,0.6);
}
.post-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,180,255,0.04) 0%, transparent 55%);
  opacity: 0; transition: opacity 0.3s;
}
.post-card:hover { border-color: var(--border3); background: var(--surface2); transform: translateX(3px); }
.post-card:hover::before { opacity: 1; }
.post-card:hover::after  { opacity: 1; }

.card-inner {
  display: grid; grid-template-columns: 68px 1fr;
  gap: 1.2rem; position: relative; z-index: 1;
}

.post-date-col {
  display: flex; flex-direction: column; align-items: center;
  padding-top: 0.1rem; border-right: 1px solid var(--border);
}

.post-date { font-family: var(--mono); text-align: center; line-height: 1.2; }
.post-date .day {
  font-family: var(--display); font-size: 1.7rem; font-weight: 700;
  color: var(--cyan); line-height: 1; display: block;
  text-shadow: 0 0 20px rgba(0,180,255,0.35);
}

.post-date .mon {
  font-size: 0.75rem; font-family: var(--display); font-weight: 700;
  letter-spacing: -0.01em; text-transform: uppercase;
  color: var(--cyan); display: block; margin-top: 0.1rem;
  text-shadow: 0 0 20px rgba(0,180,255,0.35);
}
.post-date .yr { 
  font-size: 0.75rem; font-family: var(--display); font-weight: 700;
  color: var(--cyan); display: block; opacity: 0.6;
  text-shadow: 0 0 20px rgba(0,180,255,0.35);
}

.post-body { display: flex; flex-direction: column; gap: 0.45rem; }
.post-title {
  font-family: var(--display); font-size: 1rem; font-weight: 600;
  line-height: 1.35; color: var(--text-bright); transition: color 0.2s;
  letter-spacing: -0.005em;
}
.post-card:hover .post-title { color: var(--cyan); }
.post-excerpt {
  font-size: 0.78rem; color: var(--text-muted);
  font-family: var(--mono); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }
.post-tag {
  font-family: var(--mono); font-size: 0.58rem; color: var(--text-dim);
  background: rgba(0,180,255,0.04); border: 1px solid var(--border);
  padding: 0.1rem 0.4rem; border-radius: 2px; letter-spacing: 0.04em;
}
.post-type-badge {
  font-family: var(--mono); font-size: 0.56rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.1rem 0.4rem; border-radius: 2px;
}
.badge-essay { color: #7bb8e8; background: rgba(123,184,232,0.08); border: 1px solid rgba(123,184,232,0.2); }
.badge-code  { color: var(--teal); background: var(--teal-dim); border: 1px solid rgba(0,255,208,0.2); }
.badge-paper { color: var(--amber); background: rgba(255,170,0,0.08); border: 1px solid rgba(255,170,0,0.2); }
.badge-note  { color: var(--red); background: rgba(255,68,102,0.08); border: 1px solid rgba(255,68,102,0.2); }

.no-posts {
  text-align: center; padding: 4rem 0;
  color: var(--text-dim); font-family: var(--mono); font-size: 0.75rem;
}

/* ════════════════════════════════════════════
   POST PAGE
════════════════════════════════════════════ */
.post-page { max-width: var(--max); margin: 0 auto; padding: 3rem 2rem 6rem; }

.back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.65rem; color: var(--text-dim);
  text-decoration: none; letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 2.5rem; border: 1px solid var(--border);
  padding: 0.3rem 0.7rem; border-radius: 2px; transition: all 0.2s;
}
.back-link::before { content: '←'; }
.back-link:hover { color: var(--cyan); border-color: var(--border2); background: var(--cyan-glow); }

.post-page-header { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.post-meta-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.post-meta-date { font-family: var(--mono); font-size: 0.65rem; color: var(--text-dim); }
.post-page-title {
  font-family: var(--display); font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700; line-height: 1.15; color: var(--text-bright);
  margin-bottom: 1rem; letter-spacing: -0.01em;
}
.post-page-subtitle { font-size: 0.95rem; color: var(--text-muted); font-family: var(--mono); margin-bottom: 1.5rem; line-height: 1.7; }
.post-page-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ── Article body ── */
.post-content { font-size: 1.02rem; line-height: 1.9; color: var(--text); font-weight: 300; }
.post-content h2 {
  font-family: var(--display); font-size: 1.3rem; font-weight: 700;
  color: var(--text-bright); margin: 3rem 0 1rem; letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 0.75rem;
}
.post-content h2::before {
  content: '//'; font-family: var(--mono); font-size: 0.75rem;
  color: var(--cyan); opacity: 0.7; font-weight: 400;
}
.post-content h3 {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 400;
  color: var(--cyan); letter-spacing: 0.15em; text-transform: uppercase;
  margin: 2.5rem 0 0.75rem;
}
.post-content p { margin-bottom: 1.5rem; }
.post-content a { color: var(--cyan); text-decoration: underline; text-decoration-color: rgba(0,180,255,0.3); text-underline-offset: 3px; }
.post-content a:hover { text-decoration-color: var(--cyan); }
.post-content blockquote {
  border-left: 2px solid var(--cyan); margin: 2rem 0;
  padding: 1rem 1.5rem; background: var(--cyan-glow);
  font-family: var(--mono); font-size: 0.88rem; color: var(--text-muted);
  border-radius: 0 2px 2px 0; position: relative;
}
.post-content blockquote::before {
  content: '"'; font-family: var(--display); font-size: 3rem;
  color: var(--cyan); opacity: 0.2;
  position: absolute; top: -0.5rem; left: 1rem; line-height: 1;
}
.post-content ul, .post-content ol { margin: 0 0 1.5rem 1rem; font-family: var(--mono); font-size: 0.88rem; }
.post-content li { margin-bottom: 0.5rem; padding-left: 0.5rem; color: var(--text-muted); }
.post-content li::marker { color: var(--cyan); }
.post-content hr { border: none; border-top: 1px solid var(--border2); margin: 3rem 0; position: relative; }
.post-content hr::before {
  content: '◆'; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); background: var(--bg);
  color: var(--text-dim); font-size: 0.5rem; padding: 0 0.5rem;
}
.post-content pre {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 3px; padding: 1.5rem; overflow-x: auto;
  margin: 1.5rem 0 2rem; position: relative;
}
.post-content pre::before {
  content: attr(data-lang); position: absolute; top: 0.5rem; right: 0.75rem;
  font-family: var(--mono); font-size: 0.56rem; color: var(--cyan);
  text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.5;
}
.post-content pre::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px; background: linear-gradient(90deg, var(--cyan), transparent); opacity: 0.25;
}
.post-content code {
  font-family: var(--mono); font-size: 0.85em; color: var(--teal);
  background: rgba(0,255,208,0.06); padding: 0.1em 0.3em; border-radius: 2px;
}
.post-content pre code { color: #a8c8e0; font-size: 0.875rem; background: none; padding: 0; line-height: 1.7; }
.tok-keyword  { color: #c792ea; }
.tok-string   { color: #c3e88d; }
.tok-comment  { color: #4a6a8a; font-style: italic; }
.tok-number   { color: #f78c6c; }
.tok-function { color: var(--teal); }
.tok-type     { color: #82aaff; }
.tok-operator { color: #89ddff; }

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
.site-footer { border-top: 1px solid var(--border); padding: 2rem; margin-top: 4rem; position: relative; }
.site-footer::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--teal), var(--cyan), transparent);
  opacity: 0.3;
}
.footer-inner { max-width: var(--wide); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-copy { font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--cyan); }

/* ── Animations ── */
@keyframes fadeIn { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
.hero         { animation: fadeIn 0.6s ease both; }
.main-content { animation: fadeIn 0.6s 0.15s ease both; }

/* ── Responsive ── */
@media(max-width:820px){
  .main-content { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .tag-cloud { flex-direction: row; flex-wrap: wrap; gap: 0.35rem; }
}
@media(max-width:560px){
  .nav { display: none; }
  .hero { padding: 3rem 1.5rem 2.5rem; }
  .main-content { padding: 2rem 1.5rem; }
  .post-page { padding: 2rem 1.5rem 4rem; }
  .card-inner { grid-template-columns: 54px 1fr; }
  .post-date .day { font-size: 1.3rem; }
}
