/* ═══════════════════════════════════════
   SysNetHub Theme — style.css
   nixinfra.com · Net/Sys is Fun!
═══════════════════════════════════════ */

:root {
  --bg:           #f7f6f3;
  --bg2:          #eeecea;
  --surface:      #ffffff;
  --ink:          #0d0d0d;
  --ink2:         #4a4a4a;
  --ink3:         #888888;
  --border:       #dddbd8;

  /* SysNetHub brand green */
  --green:        #5abf1e;
  --green-dark:   #3d8c0e;
  --green-pale:   #eef8e6;

  /* Sidebar */
  --sb-bg:        #1e2125;
  --sb-hover:     #2a2f35;
  --sb-active:    #2a3522;
  --sb-text:      #c8cdd3;
  --sb-muted:     #5a6168;
  --sb-border:    rgba(255,255,255,.05);
  --sb-width:     220px;

  /* Typography */
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --font-sans:    'DM Sans', system-ui, sans-serif;
  --font-serif:   'Playfair Display', Georgia, serif;

  --radius:       4px;
  --radius-lg:    8px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar {
  width: var(--sb-width);
  background: var(--sb-bg);
  min-height: 100vh;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 300;
  border-right: 1px solid var(--sb-border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
}

/* Logo */
.sidebar-logo {
  padding: 1.1rem 1rem;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  transition: opacity .15s;
}
.sidebar-logo:hover { opacity: .85; }
.logo-icon { width: 40px; height: 40px; flex-shrink: 0; }
.logo-icon svg { width: 100%; height: 100%; }
.logo-text { display: flex; flex-direction: column; min-width: 0; }
.logo-name {
  font-family: var(--font-sans); font-weight: 500; font-size: .9rem;
  color: #fff; letter-spacing: -.01em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-tagline {
  font-family: var(--font-mono); font-size: .58rem;
  color: var(--green); letter-spacing: .05em;
  text-transform: uppercase; margin-top: 2px;
}

/* Search */
.sidebar-search {
  padding: .65rem .8rem;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  position: relative;
}
.sidebar-search-wrap {
  display: flex; align-items: center;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.sidebar-search-wrap:focus-within { border-color: var(--green); }
.search-prefix {
  font-family: var(--font-mono); font-size: .7rem;
  color: var(--sb-muted); padding: 0 .45rem; flex-shrink: 0;
}
#searchInput {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font-mono); font-size: .76rem;
  color: var(--sb-text); padding: .48rem .4rem .48rem 0;
  min-width: 0;
}
#searchInput::placeholder { color: var(--sb-muted); }
#clearSearch {
  background: none; border: none;
  color: var(--sb-muted); padding: 0 .45rem;
  font-size: 12px; line-height: 1;
  display: none; transition: color .15s;
}
#clearSearch.visible { display: block; }
#clearSearch:hover { color: var(--sb-text); }

/* Search results dropdown */
.search-results {
  display: none;
  position: absolute; top: 100%; left: .8rem; right: .8rem;
  background: var(--sb-bg);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  z-index: 400;
  max-height: 280px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.search-results.open { display: block; }
.search-result-item {
  display: block; padding: .6rem .9rem;
  font-size: .8rem; color: var(--sb-text);
  border-bottom: 1px solid var(--sb-border);
  transition: background .1s;
  line-height: 1.4;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--sb-hover); }
.search-result-item strong { color: var(--green); font-weight: 500; }

/* Nav */
.sidebar-nav { padding: .4rem 0; flex: 1; overflow-y: auto; }
.nav-section-label {
  font-family: var(--font-mono); font-size: .58rem;
  color: var(--sb-muted); letter-spacing: .1em;
  text-transform: uppercase; padding: .7rem 1rem .25rem;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: .44rem 1rem;
  font-family: var(--font-sans); font-size: .82rem;
  color: var(--sb-text);
  border-left: 2px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-link:hover { background: var(--sb-hover); color: #fff; }
.nav-link.active {
  background: var(--sb-active);
  color: var(--green);
  border-left-color: var(--green);
  font-weight: 500;
}
.nav-icon {
  width: 15px; height: 15px; flex-shrink: 0;
  opacity: .55; display: flex; align-items: center; justify-content: center;
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { opacity: 1; }
.nav-icon svg { width: 14px; height: 14px; }

/* Sidebar footer */
.sidebar-footer {
  padding: .65rem 1rem;
  border-top: 1px solid var(--sb-border);
  font-family: var(--font-mono); font-size: .6rem;
  color: var(--sb-muted); line-height: 1.65; flex-shrink: 0;
}
.sidebar-footer a { color: var(--green); }
.sidebar-footer a:hover { text-decoration: underline; }

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 250;
}

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
.main {
  margin-left: var(--sb-width);
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.page-content { flex: 1; }

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem;
  height: 46px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: .75rem; }
.hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; padding: 4px;
}
.hamburger span {
  display: block; width: 18px; height: 1.5px;
  background: var(--ink3); border-radius: 2px; transition: all .2s;
}
.topbar-breadcrumb {
  font-family: var(--font-mono); font-size: .72rem;
  color: var(--ink3); display: flex; align-items: center; gap: .35rem;
  overflow: hidden;
}
.topbar-breadcrumb a { color: var(--ink3); transition: color .15s; }
.topbar-breadcrumb a:hover { color: var(--ink); }
.topbar-breadcrumb span { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-sep { opacity: .4; }
.topbar-count {
  font-family: var(--font-mono); font-size: .7rem; color: var(--ink3);
}

/* ═══════════════════════════════════════
   HERO CARD
═══════════════════════════════════════ */
.hero {
  max-width: 1020px; margin: 2rem auto 0;
  padding: 0 1.75rem;
}
.hero-card {
  background: var(--ink); border-radius: var(--radius);
  overflow: hidden;
  display: grid; grid-template-columns: 1fr 360px;
  min-height: 300px;
  transition: opacity .18s;
}
.hero-card:hover { opacity: .92; }
.hero-content {
  padding: 2.25rem;
  display: flex; flex-direction: column; justify-content: space-between;
}
.hero-label {
  font-family: var(--font-mono); font-size: .66rem;
  color: var(--green); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: .5rem;
}
.hero-title {
  font-family: var(--font-serif); font-size: 1.85rem;
  line-height: 1.25; color: #fff; margin-bottom: .75rem;
}
.hero-excerpt {
  font-size: .87rem; color: rgba(255,255,255,.55); line-height: 1.65;
}
.hero-meta {
  display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem;
}
.hero-author { font-family: var(--font-mono); font-size: .7rem; color: rgba(255,255,255,.45); }
.hero-date   { font-family: var(--font-mono); font-size: .7rem; color: rgba(255,255,255,.3); }
.hero-img {
  background: #161a1e;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-code-art pre {
  font-family: var(--font-mono); font-size: .7rem;
  color: rgba(90,191,30,.28); line-height: 1.9;
  padding: 1.5rem; white-space: pre-wrap;
}

/* ═══════════════════════════════════════
   POSTS GRID
═══════════════════════════════════════ */
.section-header {
  max-width: 1020px; margin: 2.25rem auto 1.1rem;
  padding: 0 1.75rem;
  display: flex; align-items: center; gap: 1rem;
}
.section-title {
  font-family: var(--font-mono); font-size: .68rem;
  color: var(--ink3); letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap;
}
.section-line { flex: 1; height: 1px; background: var(--border); }

.posts-grid {
  max-width: 1020px; margin: 0 auto;
  padding: 0 1.75rem 4rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,.07);
}
.post-img {
  height: 155px; background: #191d21;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-img-code pre {
  font-family: var(--font-mono); font-size: .58rem;
  color: rgba(90,191,30,.3); line-height: 1.75;
  padding: .9rem; width: 100%; white-space: pre-wrap;
  overflow: hidden;
}
.img-tag {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-mono); font-size: .6rem;
  padding: 2px 7px; border-radius: 999px;
  background: var(--green); color: #fff;
  letter-spacing: .03em;
}
.post-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.post-tags  { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .55rem; }
.post-tag {
  font-family: var(--font-mono); font-size: .6rem;
  padding: 2px 7px; border-radius: 999px;
  background: var(--green-pale); color: var(--green-dark);
  letter-spacing: .03em;
}
.post-title {
  font-size: .9rem; font-weight: 500; line-height: 1.45;
  color: var(--ink); margin-bottom: .4rem; flex: 1;
}
.post-excerpt { font-size: .78rem; color: var(--ink3); line-height: 1.6; margin-bottom: .75rem; }
.post-footer {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding-top: .6rem; margin-top: auto;
}
.post-author { font-family: var(--font-mono); font-size: .64rem; color: var(--ink3); }
.post-date   { font-family: var(--font-mono); font-size: .62rem; color: var(--ink3); opacity: .6; }

/* Empty state */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink3);
  max-width: 1020px; margin: 0 auto;
}

/* ═══════════════════════════════════════
   ARTICLE (single.html)
═══════════════════════════════════════ */
.article-wrap {
  max-width: 720px; margin: 0 auto;
  padding: 2.25rem 1.75rem 5rem;
}
.back-btn {
  font-family: var(--font-mono); font-size: .73rem;
  color: var(--ink3); background: none; border: none; padding: 0;
  margin-bottom: 1.75rem; display: inline-flex; align-items: center; gap: .35rem;
  transition: color .15s;
}
.back-btn:hover { color: var(--green); }

.article-label {
  font-family: var(--font-mono); font-size: .66rem;
  color: var(--green); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: .5rem;
}
.article-title {
  font-family: var(--font-serif); font-size: 2.2rem;
  line-height: 1.2; margin: .5rem 0 .8rem;
}
.article-meta {
  display: flex; gap: 1.25rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: .7rem;
  color: var(--ink3); margin-bottom: 1.75rem;
}
.article-cover {
  width: 100%; height: 270px; border-radius: var(--radius);
  background: #1a1e22; margin-bottom: 2.25rem;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.article-cover-code pre {
  font-family: var(--font-mono); font-size: .68rem;
  color: rgba(90,191,30,.25); line-height: 1.9; white-space: pre-wrap;
  padding: 1.5rem;
}

/* Article body typography */
.article-body { font-size: .98rem; line-height: 1.85; color: var(--ink2); }
.article-body h1,
.article-body h2 {
  font-family: var(--font-serif); font-size: 1.5rem; font-style: italic;
  color: var(--ink); margin: 2.1rem 0 .6rem; line-height: 1.3;
}
.article-body h3 {
  font-family: var(--font-sans); font-size: .95rem; font-weight: 500;
  color: var(--ink); margin: 1.65rem 0 .4rem;
}
.article-body h4 {
  font-family: var(--font-mono); font-size: .82rem;
  color: var(--green); margin: 1.4rem 0 .3rem; letter-spacing: .04em;
}
.article-body p  { margin-bottom: 1.1rem; }
.article-body ul,
.article-body ol { margin: 0 0 1.1rem 1.5rem; }
.article-body li { margin-bottom: .35rem; }
.article-body a  { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { color: var(--green-dark); }
.article-body strong { font-weight: 500; color: var(--ink); }
.article-body em { font-style: italic; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.article-body img { border-radius: var(--radius); margin: 1.5rem 0; }
.article-body table {
  width: 100%; border-collapse: collapse; margin: 1.5rem 0;
  font-size: .88rem;
}
.article-body th {
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .04em; text-transform: uppercase;
  background: var(--bg2); padding: .6rem .85rem;
  border-bottom: 2px solid var(--border); text-align: left;
}
.article-body td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
}

/* Inline code */
.article-body code {
  font-family: var(--font-mono); font-size: .83em;
  background: var(--bg2); padding: 2px 5px;
  border-radius: 3px; color: var(--ink);
}
/* Code blocks */
.article-body pre {
  background: #1a1e22; border-radius: var(--radius);
  padding: 1.25rem; margin: 1.35rem 0; overflow-x: auto;
  border-left: 3px solid var(--green);
}
.article-body pre code {
  font-family: var(--font-mono); font-size: .79rem;
  color: rgba(90,191,30,.85); background: none;
  padding: 0; line-height: 1.8;
}
/* Blockquote */
.article-body blockquote {
  border-left: 2px solid var(--green);
  padding: .2rem 1.1rem; margin: 1.5rem 0;
  font-style: italic; color: var(--ink3);
}
.article-body blockquote p { margin-bottom: 0; }

/* Article tags */
.article-tags {
  display: flex; gap: .4rem; flex-wrap: wrap;
  margin: 2rem 0;
}
.article-tag {
  font-family: var(--font-mono); font-size: .65rem;
  padding: 3px 9px; border-radius: 999px;
  background: var(--green-pale); color: var(--green-dark);
}
.article-tag:hover { background: var(--green); color: #fff; }

/* Prev / Next */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-top: 2.5rem;
  border-top: 1px solid var(--border); padding-top: 1.5rem;
}
.post-nav-link {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.post-nav-link:hover { border-color: var(--green); background: var(--green-pale); }
.post-nav-link.next { text-align: right; }
.post-nav-label { font-family: var(--font-mono); font-size: .65rem; color: var(--ink3); }
.post-nav-title { font-size: .85rem; font-weight: 500; color: var(--ink); line-height: 1.35; }

/* ═══════════════════════════════════════
   COMMENTS
═══════════════════════════════════════ */
.comments-section {
  max-width: 720px; margin: 0 auto;
  padding: 0 1.75rem 4rem;
  border-top: 1px solid var(--border); padding-top: 2rem;
}
.comments-title {
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 1.5rem;
}
.comment-form input,
.comment-form textarea {
  width: 100%; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: .88rem;
  padding: .65rem .9rem; border-radius: var(--radius);
  outline: none; transition: border-color .15s;
  display: block; margin-bottom: .6rem;
}
.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--green); }
.comment-form textarea { resize: vertical; min-height: 88px; }
.submit-btn {
  font-family: var(--font-mono); font-size: .76rem;
  padding: .58rem 1.25rem; background: var(--green);
  color: #fff; border: none; border-radius: var(--radius);
  transition: background .15s; letter-spacing: .03em; margin-bottom: 1.75rem;
}
.submit-btn:hover { background: var(--green-dark); }
.comment-item {
  padding: 1rem 0; border-bottom: 1px solid var(--border);
  animation: fadeUp .3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.comment-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .3rem;
}
.comment-name { font-weight: 500; font-size: .88rem; }
.comment-date { font-family: var(--font-mono); font-size: .65rem; color: var(--ink3); }
.comment-text { font-size: .88rem; color: var(--ink2); line-height: 1.6; }
.no-comments  { font-family: var(--font-mono); font-size: .76rem; color: var(--ink3); padding: .5rem 0 1rem; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 900px) {
  .posts-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .hero-card { grid-template-columns: 1fr; min-height: auto; }
  .hero-img { display: none; }
  .hero { margin-top: 1.25rem; }
}

@media (max-width: 560px) {
  .posts-grid { grid-template-columns: 1fr; }
  .article-title { font-size: 1.65rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.next { text-align: left; }
}
