/* ============================================
   BENSHKIES BLOG — Digital Forensics Theme
   Color Palette: Deep blacks, forensic blues, clinical whites
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #0f1520;
  --bg-card: #111927;
  --bg-card-hover: #162032;
  --bg-surface: #1a2436;

  --blue-deep: #0d2847;
  --blue-primary: #1e6bb8;
  --blue-accent: #3b9eff;
  --blue-glow: #5ab0ff;
  --blue-pale: #a8d4ff;
  --blue-wash: rgba(59, 158, 255, 0.06);

  --text-primary: #e2e8f0;
  --text-secondary: #8a9bb5;
  --text-muted: #4a5a73;
  --text-heading: #f1f5f9;

  --white: #ffffff;
  --border-color: #1e2d45;
  --border-glow: rgba(59, 158, 255, 0.2);

  --font-body: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1100px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

/* Subtle scan-line overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* Grid background pattern */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(30, 107, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 107, 184, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* --- Links --- */
a {
  color: var(--blue-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--blue-glow);
}

/* --- Selection --- */
::selection {
  background: var(--blue-primary);
  color: var(--white);
}

/* ============================================
   HEADER / NAVIGATION
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--blue-accent);
  stroke-width: 1.5;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.logo-text .accent {
  color: var(--blue-accent);
}

/* Main Nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  position: relative;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--blue-accent);
  background: var(--blue-wash);
}

.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--blue-accent);
  border-radius: 1px;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  margin: 5px 0;
  transition: all var(--transition);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.site-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  min-height: calc(100vh - 64px - 200px);
}

/* ============================================
   HERO SECTION (Index)
   ============================================ */
.hero {
  padding: 4rem 0 3rem;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--blue-accent);
  background: var(--blue-wash);
  border: 1px solid var(--border-glow);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.6s ease-out;
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero h1 {
  font-family: var(--font-body);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--blue-accent), var(--blue-pale));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.7;
  margin-bottom: 2rem;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--blue-primary);
  color: var(--white);
  border-color: var(--blue-primary);
}

.btn-primary:hover {
  background: var(--blue-accent);
  border-color: var(--blue-accent);
  color: var(--white);
  box-shadow: 0 0 20px rgba(59, 158, 255, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: var(--blue-accent);
  border-color: var(--blue-accent);
  background: var(--blue-wash);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-header h2 .count {
  color: var(--text-muted);
  font-weight: 400;
}

.section-header a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.section-header a:hover {
  color: var(--blue-accent);
}

/* ============================================
   POST CARDS
   ============================================ */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 3rem;
}

.post-card {
  background: var(--bg-card);
  padding: 1.5rem 1.75rem;
  display: block;
  text-decoration: none;
  transition: background var(--transition);
  position: relative;
}

.post-card:hover {
  background: var(--bg-card-hover);
}

.post-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background var(--transition);
}

.post-card:hover::before {
  background: var(--blue-accent);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-card h3 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.4rem;
  transition: color var(--transition);
  line-height: 1.4;
}

.post-card:hover h3 {
  color: var(--blue-accent);
}

.post-excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  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.4rem;
  margin-top: 0.75rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--blue-accent);
  background: var(--blue-wash);
  border: 1px solid var(--border-glow);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  text-transform: lowercase;
  transition: all var(--transition);
}

.tag:hover {
  background: rgba(59, 158, 255, 0.15);
  border-color: var(--blue-accent);
}

/* ============================================
   BLOG LIST PAGE
   ============================================ */
.page-title {
  font-family: var(--font-body);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* ============================================
   POST / ARTICLE LAYOUT
   ============================================ */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.post-header .post-date {
  display: inline-block;
  margin-bottom: 0.75rem;
}

.post-header h1 {
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

/* Article prose */
.post-content {
  max-width: 760px;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-body);
  color: var(--text-heading);
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

.post-content p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.post-content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 1.5rem 0;
}

.post-content ul, .post-content ol {
  margin: 1rem 0 1.25rem 1.5rem;
  color: var(--text-primary);
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content blockquote {
  border-left: 3px solid var(--blue-accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--blue-wash);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content a {
  color: var(--blue-accent);
  text-decoration: underline;
  text-decoration-color: rgba(59, 158, 255, 0.3);
  text-underline-offset: 2px;
}

.post-content a:hover {
  text-decoration-color: var(--blue-accent);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.post-content th, .post-content td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.post-content th {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text-heading);
}

.post-content td {
  background: var(--bg-card);
}

/* Code blocks */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-surface);
  color: var(--blue-pale);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.post-content pre::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #28c840;
}

.post-content pre code {
  display: block;
  padding-top: 0.75rem;
}

/* Horizontal rule */
.post-content hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 2.5rem 0;
}

/* ============================================
   TAGS PAGE
   ============================================ */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
}

.tag-list li a,
.tag-item a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.tag-list li a:hover,
.tag-item a:hover {
  color: var(--blue-accent);
  border-color: var(--blue-accent);
  background: var(--blue-wash);
}

#tagList {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
}

/* Search input override */
.search-wrapper {
  margin-bottom: 1.5rem;
  max-width: 500px;
}

#tagSearch {
  background: var(--bg-card) !important;
  color: var(--blue-accent) !important;
  font-family: var(--font-mono) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.65rem 1rem !important;
  font-size: 0.85rem !important;
  width: 100% !important;
  box-shadow: none !important;
  transition: border-color var(--transition) !important;
}

#tagSearch:focus {
  outline: none !important;
  border-color: var(--blue-accent) !important;
  box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.1) !important;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--blue-accent);
}

/* ============================================
   404 PAGE
   ============================================ */
.error-page {
  text-align: center;
  padding: 5rem 2rem;
}

.error-code {
  font-family: var(--font-mono);
  font-size: 6rem;
  font-weight: 700;
  color: var(--border-color);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--text-secondary);
}

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1rem;
}

.about-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.about-section h2 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.about-section p,
.about-section li {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 1.25rem;
  }

  .nav-toggle {
    display: block;
  }

  .main-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 14, 23, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
  }

  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .main-nav a {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .site-content {
    padding: 1.5rem 1.25rem 3rem;
  }

  .hero {
    padding: 2rem 0;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

/* ============================================
   SYNTAX HIGHLIGHTING (Rouge)
   ============================================ */
.highlight .c,
.highlight .cm,
.highlight .c1,
.highlight .cs { color: #586e75; font-style: italic; }
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr { color: #6eb4ff; }
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .sh,
.highlight .sx { color: #8bc48a; }
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo { color: #d4a76a; }
.highlight .na { color: #93c5fd; }
.highlight .nb { color: #e2e8f0; }
.highlight .nc { color: #7dd3fc; }
.highlight .no { color: #fbbf24; }
.highlight .nf { color: #93c5fd; }
.highlight .o,
.highlight .ow { color: #e2e8f0; }
.highlight .p { color: #e2e8f0; }
