
:root{
  --bg-deep: #040712;
  --bg-base: #0a0f1c;
  --bg-surface: #0e1524;
  --bg-elevated: #141c2e;
  --bg-glass: rgba(255,255,255,0.02);

  --border-subtle: rgba(255,255,255,0.06);
  --border-mid: rgba(255,255,255,0.12);
  --border-hot: rgba(0, 217, 255, 0.18);

  --text-bright: #f2f6fc;
  --text-primary: #e0e8f5;
  --text-secondary: #8c9bb4;
  --text-muted: #56657d;

  --accent: #00d9ff;
  --accent-dim: rgba(0, 217, 255, 0.5);
  --accent-glow: rgba(0, 217, 255, 0.35);
  --warm: #ffa040;
  --magenta: #ff4d8c;
  --good: #4adfb2;

  --max-w: 1240px;
  --pad-h: clamp(20px, 4vw, 56px);
}

*{ box-sizing: border-box; margin: 0; padding: 0; }
html{ scroll-behavior: smooth; }
body{
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Atmospheric backgrounds ── */
.bg-grid{
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at top, black 0%, transparent 70%);
}
.bg-glow-1{
  position: fixed; top: -200px; left: 50%;
  width: 800px; height: 600px;
  background: radial-gradient(ellipse, rgba(0,217,255,0.12), transparent 70%);
  transform: translateX(-50%); z-index: 0; pointer-events: none; filter: blur(40px);
}
.bg-glow-2{
  position: fixed; bottom: -300px; right: -100px;
  width: 600px; height: 500px;
  background: radial-gradient(ellipse, rgba(255,74,140,0.07), transparent 70%);
  z-index: 0; pointer-events: none; filter: blur(60px);
}
canvas#dust{
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

/* ── Layout ── */
.container{ max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad-h); }
section{ position: relative; z-index: 2; }
.hidden{ display: none !important; }

/* ── Nav ── */
#nav{
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 20px 0;
  transition: background .4s, backdrop-filter .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
#nav.scrolled{
  background: rgba(4,7,18,0.85);
  backdrop-filter: blur(20px);
  border-color: var(--border-subtle);
}
.nav-inner{ display: flex; align-items: center; justify-content: space-between; }
.brand{ display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark svg{ width: 28px; height: 28px; }
.brand-name{
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 16px;
  color: var(--text-bright); letter-spacing: 0.08em;
}
.brand-suffix{
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: var(--accent); letter-spacing: 0.2em;
}
.nav-links{ display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); }
.nav-links a{
  color: var(--text-secondary); text-decoration: none; font-size: 13px;
  font-weight: 500; letter-spacing: 0.04em;
  transition: color .2s;
}
.nav-links a:hover{ color: var(--text-bright); }
.nav-cta{
  color: var(--accent) !important;
  border: 1px solid var(--border-hot);
  padding: 7px 16px; border-radius: 6px;
  transition: background .2s, box-shadow .2s !important;
}
.nav-cta:hover{
  background: rgba(0,217,255,0.07) !important;
  box-shadow: 0 0 20px rgba(0,217,255,0.15) !important;
}
.nav-toggle{ display:none; background:none; border:none; cursor:pointer; padding:4px; }
.nav-toggle span{
  display:block; width:22px; height:2px;
  background:var(--text-secondary); margin:5px 0;
  transition: transform .3s, opacity .3s;
}
#nav.open .nav-toggle span:nth-child(1){ transform:translateY(7px) rotate(45deg); }
#nav.open .nav-toggle span:nth-child(2){ opacity:0; }
#nav.open .nav-toggle span:nth-child(3){ transform:translateY(-7px) rotate(-45deg); }
@media(max-width:640px){
  .nav-toggle{ display:block; }
  .nav-links{
    display:none; flex-direction:column; align-items:flex-start; gap:12px;
    position:absolute; top:100%; left:0; right:0;
    background:rgba(4,7,18,0.97); backdrop-filter:blur(20px);
    padding:20px var(--pad-h);
    border-bottom: 1px solid var(--border-subtle);
  }
  #nav.open .nav-links{ display:flex; }
}

/* ── Section commons ── */
.section-label{
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--accent); letter-spacing: 0.22em; text-transform: uppercase;
  margin-bottom: 14px;
}

/* ── Blog page ── */
.blog-page{ padding: clamp(120px, 18vw, 180px) 0 80px; }
.blog-intro{ margin-bottom: 48px; max-width: 720px; }
.blog-intro h1{
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 700; color: var(--text-bright);
  letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 16px;
}
.blog-intro h1 em{ font-style: italic; color: var(--accent); }
.blog-intro p{ color: var(--text-secondary); font-size: 1.05rem; font-weight: 300; }

.blog-layout{
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 860px){ .blog-layout{ grid-template-columns: 1fr; gap: 36px; } }

/* ── Sidebar ── */
.blog-sidebar{ position: sticky; top: 100px; }
@media (max-width: 860px){ .blog-sidebar{ position: static; } }
.sidebar-block + .sidebar-block{ margin-top: 32px; }
.sidebar-title{
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.22em; color: var(--accent);
  text-transform: uppercase; margin-bottom: 14px;
}
.sidebar-list{ list-style: none; }
.sidebar-list li + li{ border-top: 1px solid var(--border-subtle); }
.sidebar-list a{
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.92rem; transition: color .2s;
  cursor: pointer;
}
.sidebar-list a:hover{ color: var(--text-bright); }
.sidebar-list .count{
  color: var(--text-muted); font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}
.sidebar-list a.active{ color: var(--accent); font-weight: 600; }
.sidebar-list a.active .count{ color: var(--accent); }

.sidebar-tags{ display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-tag{
  font-size: 0.78rem; padding: 5px 11px; border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-secondary);
  cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.sidebar-tag:hover{ border-color: var(--border-mid); color: var(--text-bright); }
.sidebar-tag.active{
  border-color: var(--accent); color: var(--accent);
  background: rgba(0,217,255,0.08);
}
.sidebar-tag .count{
  color: var(--text-muted); font-size: 0.7rem;
  margin-left: 5px; font-family: 'JetBrains Mono', monospace;
}
.sidebar-tag.active .count{ color: var(--accent); }

.clear-filters{
  margin-top: 18px;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 0.82rem;
  font-family: inherit;
  transition: all .2s;
}
.clear-filters:hover{ border-color: var(--accent); color: var(--accent); }

/* ── Articles feed ── */
.articles-feed{ display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.article-card{
  background: linear-gradient(135deg, rgba(20,28,46,0.4) 0%, rgba(14,21,36,0.4) 100%);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  padding: 28px;
  overflow: hidden;
  transition: border-color .3s, box-shadow .3s;
}
.article-card:hover{
  border-color: var(--border-hot);
  box-shadow: 0 0 40px rgba(0,217,255,0.08);
}
.article-chips{ display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip{
  display: inline-block;
  padding: 4px 12px; border-radius: 12px;
  font-size: 0.78rem;
  transition: all .2s; user-select: none;
  font-family: inherit;
}
.chip-category{
  background: rgba(0,217,255,0.08);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.chip-tag{
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
}
/* On the index page, chips are clickable filters */
.articles-feed .chip{ cursor: pointer; }
.articles-feed .chip-category:hover{ background: rgba(0,217,255,0.16); }
.articles-feed .chip-tag:hover{ border-color: var(--border-hot); color: var(--text-bright); }

.article-card h2{
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  font-weight: 600; font-style: italic;
  color: var(--text-bright);
  line-height: 1.3;
  margin-bottom: 14px;
}
.article-meta{
  display: flex; gap: 16px;
  font-size: 0.88rem; color: var(--text-muted);
  flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.article-body p{ margin: 0 0 14px 0; }
.article-body p:last-child{ margin-bottom: 0; }
.article-body h2{
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem; font-style: normal;
  color: var(--text-bright);
  font-weight: 600;
  margin: 36px 0 16px;
}
.article-body h3{
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  color: var(--text-bright);
  font-weight: 600;
  margin: 28px 0 12px;
}
.article-body code{
  background: rgba(10,15,28,0.9);
  padding: 2px 6px; border-radius: 4px;
  color: var(--good);
  font-size: 0.9em; font-family: monospace;
}
.article-body pre{
  background: rgba(10,15,28,0.95);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 20px;
}
.article-body pre code{
  background: none; padding: 0;
  color: #d0d8e5;
}
.article-body ol, .article-body ul{ margin: 0 0 20px 30px; }
.article-body li{ margin-bottom: 8px; }
.article-body strong{ color: var(--text-bright); }
.article-body blockquote{
  margin: 18px 0 18px 4px;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  background: rgba(0, 217, 255, 0.04);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-primary);
}
.article-body blockquote p{ margin: 0; }
.article-body hr{ border: none; border-top: 1px solid var(--border-mid); margin: 40px 0; }
.article-body .callout{
  background: linear-gradient(135deg, rgba(0,217,255,0.08) 0%, rgba(74,223,178,0.08) 100%);
  border: 1px solid rgba(0,217,255,0.15);
  border-radius: 8px;
  padding: 28px;
  margin: 36px 0;
  text-align: center;
}
.article-body .callout h3{ margin: 0 0 12px; }
.article-body .callout a{
  display: inline-block;
  background: var(--accent); color: var(--bg-deep);
  padding: 12px 28px; border-radius: 6px;
  text-decoration: none; font-weight: 600;
  margin-top: 8px;
}
.article-body .author-bio{
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.article-foot{
  display: flex; align-items: center; gap: 8px;
  margin-top: 18px;
  color: var(--accent);
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.article-foot a{
  display: flex; align-items: center; gap: 8px;
  color: inherit; text-decoration: none;
  transition: gap .2s;
}
.article-foot a:hover{ gap: 12px; }
.article-foot .chev{ display: inline-block; }

/* ── Article cards (index/listing page) ── */
.article-title-link{ text-decoration: none; display: block; }
.article-title-link h2{ transition: color .2s; }
.article-title-link:hover h2{ color: var(--accent); }
.article-excerpt{ color: var(--text-secondary); }
.article-excerpt p{ margin: 0; }

/* ── Post page (single article) ── */
.post-header{ margin-bottom: 32px; max-width: 760px; }
.post-header h1{
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 600; font-style: italic;
  color: var(--text-bright);
  line-height: 1.25; margin-bottom: 18px;
}
.back-link{
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); text-decoration: none;
  font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  transition: gap .2s;
}
.back-link:hover{ gap: 12px; }
.post-body{ max-width: 760px; }

.empty-state{
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border-mid);
  border-radius: 16px;
}
.empty-state h3{
  font-family: 'Syne', sans-serif;
  color: var(--text-bright);
  margin-bottom: 10px;
}

/* ── Footer ── */
footer{
  border-top: 1px solid var(--border-subtle);
  padding: 40px 0; position: relative; z-index: 2;
}
.footer-inner{
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted);
}
.footer-inner span{ display: inline-flex; align-items: center; gap: 8px; }
.footer-inner a{
  color: inherit; text-decoration: underline;
  text-decoration-color: var(--border-mid); text-underline-offset: 3px;
  transition: color .2s;
}
.footer-inner a:hover{ color: var(--accent); }
.footer-inner .dot{
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 8px var(--good);
  animation: pulse 2s infinite;
}
@keyframes pulse{
  0%, 100%{ opacity: 1; transform: scale(1); }
  50%{ opacity: 0.5; transform: scale(0.7); }
}

::-webkit-scrollbar{ width: 6px; }
::-webkit-scrollbar-track{ background: var(--bg-deep); }
::-webkit-scrollbar-thumb{ background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: var(--accent); }
::selection{ background: var(--accent); color: var(--bg-deep); }

/* ── Mobile / tablet refinements ── */
@media (max-width: 860px){
  .blog-sidebar{ margin-bottom: 8px; }
  .sidebar-block + .sidebar-block{ margin-top: 22px; }
  .article-card{ padding: 22px 20px; }
}
@media (max-width: 640px){
  .blog-page{ padding-top: clamp(96px, 22vw, 140px); }
  .blog-intro h1{ font-size: clamp(1.7rem, 7vw, 2.2rem); }
  .article-card{ padding: 20px 18px; }
  .article-card h2{ font-size: clamp(1.15rem, 5vw, 1.4rem); }
  .article-meta{ gap: 12px; font-size: 0.82rem; }
  .article-chips{ gap: 6px; margin-bottom: 12px; }
  .chip{ font-size: 0.72rem; padding: 3px 10px; }
  .article-body h2{ font-size: 1.25rem; margin: 28px 0 14px; }
  .article-body h3{ font-size: 1.05rem; margin: 22px 0 10px; }
  .article-body pre{ padding: 14px; font-size: 0.82rem; }
  .article-body ol, .article-body ul{ margin-left: 22px; }
  .article-body .callout{ padding: 22px; margin: 28px 0; }
  .footer-inner{ font-size: 10px; gap: 10px; }
  .brand-suffix{ display: none; }
}
/* Long unbreakable tokens (URLs, identifiers) should wrap rather than overflow */
.article-body p, .article-body li{ overflow-wrap: anywhere; }
