/* ============================================================
   GIUSLOCK CYBER — dark green / terminal aesthetic
   Layout: flexbox sidebar + main. No overflow tricks.
   Mobile breakpoint: 768px (hamburger + off-canvas sidebar)
   ============================================================ */

/* --- Variables --- */
:root {
  --bg:        #080d09;
  --surf:      #0c1410;
  --surf2:     #101b14;
  --border:    #1d2e22;
  --text:      #d4f0e0;
  --muted:     #628c76;
  --accent:    #2dff9a;
  --accent-lo: #0a4d2a;
  --link:      #2dff9a;
  --sidebar-w: 260px;
  --topbar-h:  52px;
  --radius:    8px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Ubuntu, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.75;
  min-height: 100vh;
}

/* --- Links --- */
a { color: var(--link); text-decoration: none; }
a:hover { color: #fff; }

/* ============================================================
   LAYOUT  (desktop: flexbox row)
   ============================================================ */
.layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR  (desktop: left column, sticky)
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surf);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-body {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text);
}
.brand:hover { color: var(--accent); }
.brand-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
  display: block;
}
.brand-sub {
  font-size: .78rem;
  color: var(--muted);
  display: block;
  margin-top: .1rem;
}

/* Nav */
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.nav-list a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .65rem;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  color: var(--text);
  font-size: .93rem;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-list a:hover {
  background: var(--surf2);
  border-left-color: var(--accent);
  color: var(--accent);
}
.nav-icon { font-style: normal; font-size: .9em; opacity: .8; }

/* Sidebar search */
.sidebar-search form {
  display: flex;
  gap: .35rem;
}
.sidebar-search input {
  flex: 1;
  min-width: 0;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .38rem .6rem;
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  transition: border-color .2s;
}
.sidebar-search input:focus { outline: none; border-color: var(--accent); }
.sidebar-search input::placeholder { color: var(--muted); }
.sidebar-search button {
  background: var(--accent-lo);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  padding: .38rem .65rem;
  font: inherit;
  font-size: .85rem;
  transition: background .15s, color .15s;
}
.sidebar-search button:hover { background: var(--accent); color: #000; }

/* Sidebar footer */
.sidebar-foot {
  padding: .85rem 1.25rem;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ============================================================
   TOPBAR  (mobile only — hidden on desktop)
   ============================================================ */
.topbar {
  display: none;
}

/* ============================================================
   OVERLAY  (mobile only)
   ============================================================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 99;
}
.overlay.is-open { display: block; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 860px;
  width: 100%;
}

/* Page footer */
.site-footer {
  padding: .75rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; color: var(--text); }
h1 { font-size: 1.85rem; margin-bottom: .4rem; }
h2 { font-size: 1.4rem;  margin: 2rem 0 .5rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 .4rem; }
p  { margin-bottom: 1rem; }
hr { border: none; border-top: 1px dashed var(--border); margin: 1.5rem 0; }

.page-title {
  font-size: 1.7rem;
  border-left: 3px solid var(--accent);
  padding-left: .75rem;
  margin-bottom: .3rem;
}
.page-sub {
  color: var(--muted);
  font-size: .92rem;
  padding-left: .75rem;
  margin-bottom: 1.75rem;
  display: block;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { opacity: .45; }

/* ============================================================
   META BADGES
   ============================================================ */
.meta-row {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .55rem;
  font-size: .8rem;
  color: var(--muted);
}
.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ============================================================
   ARTICLE CONTENT (prose)
   ============================================================ */
.prose { max-width: 70ch; }
.prose h2 { border-left: 3px solid var(--accent); padding-left: .6rem; }
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 1.25rem 0;
}
.prose blockquote {
  border-left: 3px solid var(--accent-lo);
  padding: .5rem 1rem;
  margin: 1.25rem 0;
  background: var(--surf2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  font-style: italic;
}
.prose pre {
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.6;
  font-family: var(--mono);
  font-size: .87rem;
  max-width: 100%;
}
.prose code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .38em;
  color: var(--accent);
  word-break: break-word;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  word-break: normal;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  font-size: .9rem;
  margin: 1rem 0;
}
.prose th, .prose td {
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose th { background: var(--surf2); color: var(--accent); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: .3rem; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-lo); }
.prose a:hover { color: #fff; text-decoration-color: rgba(255,255,255,.3); }

/* Anti-glow for Prism.js */
.prose pre *, .prose code *,
pre[class*="language-"] *, code[class*="language-"] * {
  text-shadow: none !important;
  filter: none !important;
  font-variant-ligatures: none;
}

/* ============================================================
   POST LIST  (archives, tags, home)
   ============================================================ */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.post-list-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px dashed var(--border);
}
.post-list-item:last-child { border-bottom: none; }
.post-date {
  flex-shrink: 0;
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.post-link {
  font-weight: 600;
  color: var(--text);
  font-size: .95rem;
}
.post-link:hover { color: var(--accent); }

/* ============================================================
   HOME — CARDS
   ============================================================ */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.card {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  transition: border-color .2s;
}
.card:hover { border-color: var(--accent); }
.card-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.card-title:hover { color: var(--accent); }
.card-excerpt {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.6;
}
.card-meta {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--muted);
}
.card-tag {
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .4rem;
  font-size: .77rem;
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.card-tag:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   POST NAV (prev / next)
   ============================================================ */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}
.post-nav-prev { font-size: .88rem; }
.post-nav-next { font-size: .88rem; text-align: right; margin-left: auto; }

/* ============================================================
   TAGS CLOUD
   ============================================================ */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 2rem;
}
.tag-pill {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .83rem;
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent); }

.tag-section { margin-bottom: 2rem; }
.tag-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: .5rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.search-form input {
  flex: 1;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem 1rem;
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  transition: border-color .2s;
}
.search-form input:focus { outline: none; border-color: var(--accent); }
.search-form input::placeholder { color: var(--muted); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-avatar {
  text-align: center;
  margin-bottom: 1.5rem;
}
.about-avatar img {
  max-width: 160px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.about-avatar p {
  margin-top: .5rem;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}
.social-links { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.social-links a { color: var(--accent); font-weight: 500; }
.social-links a:hover { color: #fff; }

/* ============================================================
   MOBILE  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Topbar: fixed strip at top */
  .topbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--surf);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    z-index: 200;
  }
  .topbar-brand {
    flex: 1;
    font-weight: 800;
    font-size: .95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-brand:hover { color: var(--accent); }
  .topbar-search {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
  }
  .topbar-search:hover { color: var(--accent); }

  /* Hamburger button */
  .hamburger {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 1.1rem;
    padding: .28rem .55rem;
    line-height: 1;
    transition: border-color .15s, color .15s;
    flex-shrink: 0;
  }
  .hamburger:hover { border-color: var(--accent); color: var(--accent); }

  /* Layout: single column */
  .layout { display: block; }

  /* Sidebar: off-canvas on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--sidebar-w) - 20px);
    height: 100vh;
    width: var(--sidebar-w);
    z-index: 100;
    transition: left .25s ease;
  }
  .sidebar.is-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .7);
  }

  /* Main: push content below topbar */
  .main { padding-top: var(--topbar-h); }

  /* Tighten page padding */
  .page { padding: 1.25rem 1rem; }
  .site-footer { padding: .75rem 1rem; }

  /* Hide sidebar search on mobile (use topbar link) */
  .sidebar-search { display: none; }

  /* Post list items stack if long title */
  .post-list-item { flex-direction: column; gap: .15rem; }
}
