/* ================================================
   BLOG — Hacker Theme
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&family=Cairo:wght@300;400;600;700&display=swap');

:root {
  --bg:         #080808;
  --bg2:        #0e0e0e;
  --bg3:        #131313;
  --border:     rgba(0,255,65,0.1);
  --border-hi:  rgba(0,255,65,0.28);
  --green:      #00ff41;
  --green-dim:  #00b32c;
  --green-dark: rgba(0,255,65,0.06);
  --text:       #e8e8e8;
  --text-dim:   rgba(232,232,232,0.6);
  --text-muted: rgba(232,232,232,0.28);
  --amber:      #f5a623;
  --red:        #ff4040;
  --cyan:       #00e5ff;
  --mono:       'JetBrains Mono', 'Courier New', monospace;
  --arabic:     'Cairo', 'Segoe UI', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanlines */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 3px
  );
  pointer-events: none;
  z-index: 900;
}

/* Grid */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,255,65,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,65,0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  z-index: 0;
  pointer-events: none;
}

/* Vignette */
.bg-vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout ───────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 10;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Header ───────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  background: rgba(8,8,8,0.96);
  backdrop-filter: blur(8px);
  z-index: 200;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Logo / Name — terminal style */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.logo-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  object-fit: cover;
  display: block;
}
.logo-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.01em;
}
.logo-text .prompt { color: var(--green-dim); }
.logo-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--green);
  animation: blink 1.1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 1px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-link {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: all 0.12s;
  letter-spacing: 0.03em;
}
.nav-link:hover, .nav-link.active {
  color: var(--green);
  border-color: var(--border);
  background: var(--green-dark);
}

/* ─── Page hero ────────────────────────────────── */
.page-hero {
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}
.hero-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.hero-name-block {}
.hero-prompt {
  font-size: 11px;
  color: var(--green-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.hero-name {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.hero-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
}
.hero-sub .sep { color: var(--border-hi); margin: 0 8px; }

/* ─── Section label ────────────────────────────── */
.sec-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 9px;
  margin-bottom: 20px;
  font-family: var(--mono);
}
.sec-label::before { content: '// '; color: var(--green-dim); }

/* ─── Post cards ───────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 60px; }

.post-card {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 15px 18px;
  background: var(--bg2);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.12s, background 0.12s;
  position: relative;
}
.post-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: transparent;
  border-radius: 3px 0 0 3px;
  transition: background 0.12s;
}
.post-card:hover { border-color: var(--border-hi); background: rgba(0,255,65,0.025); }
.post-card:hover::before { background: var(--green); }

.card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.card-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.card-date  { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.card-desc  { font-size: 12.5px; color: var(--text-dim); margin-bottom: 9px; line-height: 1.55; }
.tags       { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 2px;
  border: 1px solid;
  font-family: var(--mono);
}
.tag-red    { color: var(--red);       border-color: rgba(255,64,64,0.3);    background: rgba(255,64,64,0.05); }
.tag-green  { color: var(--green);     border-color: rgba(0,255,65,0.25);   background: rgba(0,255,65,0.04); }
.tag-amber  { color: var(--amber);     border-color: rgba(245,166,35,0.3);  background: rgba(245,166,35,0.05); }
.tag-cyan   { color: var(--cyan);      border-color: rgba(0,229,255,0.25);  background: rgba(0,229,255,0.04); }
.tag-gray   { color: var(--text-muted); border-color: var(--border); background: var(--bg3); }

/* ─── About / Contact page ─────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 32px;
}
@media (max-width: 500px) { .about-grid { grid-template-columns: 1fr; } }

.about-card {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 16px;
  background: var(--bg2);
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.12s, background 0.12s;
}
.about-card:hover { border-color: var(--border-hi); background: rgba(0,255,65,0.025); }
.about-card .ac-icon {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
  font-family: var(--mono);
  letter-spacing: -0.03em;
}
.about-card .ac-info {}
.about-card .ac-platform { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 2px; }
.about-card .ac-handle   { font-size: 12.5px; color: var(--text); }
.about-card .ac-note     { font-size: 10px; color: var(--amber); margin-top: 1px; }

/* ─── Prose / Article ──────────────────────────── */
.page-header { margin: 46px 0 28px; }
.page-title  { font-size: clamp(17px, 3vw, 24px); font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: 12px; }
.page-meta   { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; align-items: center; }
.page-meta .sep { color: var(--border-hi); }

.prose { margin-bottom: 56px; }
.prose p { margin-bottom: 16px; font-size: 13.5px; color: var(--text-dim); line-height: 1.8; font-family: var(--mono); }
.prose a { color: var(--green); text-decoration: none; border-bottom: 1px solid rgba(0,255,65,0.25); }
.prose a:hover { border-bottom-color: var(--green); }
.prose h2 { font-size: 15px; font-weight: 700; color: var(--text); margin: 40px 0 14px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.prose h2::before { content: '## '; color: var(--green-dim); font-weight: 400; font-size: 12px; }
.prose h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 26px 0 10px; }
.prose h3::before { content: '### '; color: var(--text-muted); font-weight: 400; font-size: 11px; }
.prose ul, .prose ol { padding-left: 2ch; margin-bottom: 16px; }
.prose li { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; list-style: none; }
.prose ul li::before { content: '> '; color: var(--green-dim); }
.prose pre { background: var(--bg3); border: 1px solid var(--border); border-left: 2px solid var(--green-dim); border-radius: 3px; padding: 14px 16px; overflow-x: auto; margin: 18px 0; }
.prose pre code { font-family: var(--mono); color: var(--green); background: none; border: none; padding: 0; font-size: 12.5px; }
.prose code { font-family: var(--mono); font-size: 12px; color: var(--green); background: rgba(0,255,65,0.07); border: 1px solid rgba(0,255,65,0.15); padding: 1px 5px; border-radius: 2px; }
.prose img { max-width: 100%; border: 1px solid var(--border); border-radius: 3px; display: block; margin: 20px 0; }
.prose blockquote { border-left: 2px solid var(--border-hi); padding-left: 14px; margin: 16px 0; color: var(--text-muted); font-style: italic; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text-dim); }
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 12.5px; }
.prose th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 7px 11px; border-bottom: 1px solid var(--border); text-align: left; }
.prose td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,0.03); color: var(--text-dim); }

/* Callouts */
.callout { border: 1px solid; border-radius: 3px; padding: 11px 15px; margin: 18px 0; font-size: 12.5px; line-height: 1.6; font-family: var(--mono); }
.callout-warn { border-color: rgba(245,166,35,0.3); background: rgba(245,166,35,0.05); color: var(--amber); }
.callout-danger { border-color: rgba(255,64,64,0.3); background: rgba(255,64,64,0.05); color: var(--red); }
.callout-info { border-color: var(--border); background: var(--bg3); color: var(--text-dim); }

/* ─── Markdown rendered output ─────────────────── */
.md-out p { margin-bottom: 16px; font-size: 13.5px; color: var(--text-dim); line-height: 1.8; }
.md-out a { color: var(--green); text-decoration: none; border-bottom: 1px solid rgba(0,255,65,0.25); }
.md-out a:hover { border-bottom-color: var(--green); }
.md-out h1 { font-size: 19px; font-weight: 700; color: var(--text); margin: 32px 0 14px; }
.md-out h2 { font-size: 15px; font-weight: 700; color: var(--text); margin: 36px 0 13px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.md-out h2::before { content: '## '; color: var(--green-dim); font-weight: 400; font-size: 12px; }
.md-out h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 24px 0 10px; }
.md-out h3::before { content: '### '; color: var(--text-muted); font-weight: 400; font-size: 11px; }
.md-out ul, .md-out ol { padding-left: 2ch; margin-bottom: 15px; }
.md-out li { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; list-style: none; }
.md-out ul li::before { content: '> '; color: var(--green-dim); }
.md-out ol { counter-reset: olc; }
.md-out ol li { counter-increment: olc; }
.md-out ol li::before { content: counter(olc) '. '; color: var(--text-muted); font-size: 11px; }
.md-out pre { background: var(--bg3); border: 1px solid var(--border); border-left: 2px solid var(--green-dim); border-radius: 3px; padding: 14px 16px; overflow-x: auto; margin: 16px 0; }
.md-out pre code { color: var(--green); background: none; border: none; padding: 0; font-family: var(--mono); font-size: 12.5px; }
.md-out code { font-family: var(--mono); font-size: 12px; color: var(--green); background: rgba(0,255,65,0.07); border: 1px solid rgba(0,255,65,0.15); padding: 1px 5px; border-radius: 2px; }
.md-out img { max-width: 100%; border: 1px solid var(--border); border-radius: 3px; display: block; margin: 20px 0; }
.md-out figure { margin: 20px 0; }
.md-out figcaption { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 6px; font-style: italic; }
.md-out blockquote { border-left: 2px solid var(--border-hi); padding-left: 14px; margin: 14px 0; color: var(--text-muted); font-style: italic; }
.md-out hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.md-out strong { color: var(--text); font-weight: 600; }
.md-out em { color: var(--text-dim); }
.md-out table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 12.5px; }
.md-out th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 7px 11px; border-bottom: 1px solid var(--border); text-align: left; }
.md-out td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,0.03); color: var(--text-dim); }

/* ─── Arabic inside md-out ─────────────────────── */
.md-out.ar-text {
  font-family: var(--arabic);
  direction: rtl;
  text-align: right;
}
.md-out.ar-text p,
.md-out.ar-text li { font-family: var(--arabic); font-size: 15px; line-height: 1.95; }
.md-out.ar-text h2::before,
.md-out.ar-text h3::before { content: none; }
.md-out.ar-text code,
.md-out.ar-text pre { font-family: var(--mono); direction: ltr; unicode-bidi: embed; }
.md-out.ar-text ul li::before { content: none; }

/* Language toggle on write-up pages */
.lang-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.lang-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.lang-btn.active {
  color: var(--green);
  border-color: var(--green-dim);
  background: var(--green-dark);
}
.lang-btn:hover:not(.active) {
  color: var(--text);
  border-color: var(--border-hi);
}
.lang-divider { color: var(--border-hi); font-size: 11px; }

/* ─── Footer ───────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 36px;
  margin-top: 40px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  gap: 8px;
  flex-wrap: wrap;
}
.footer-inner a { color: var(--text-muted); text-decoration: none; }
.footer-inner a:hover { color: var(--green); }

/* ─── Back link ────────────────────────────────── */
.back-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 56px;
  transition: color 0.12s;
}
.back-link:hover { color: var(--green); }
.back-link::before { content: '<- '; color: var(--green-dim); }

/* ─── 404 page ─────────────────────────────────── */
.not-found {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 0;
}
.nf-code {
  font-size: clamp(64px, 14vw, 110px);
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  text-shadow: 0 0 40px rgba(0,255,65,0.35);
}
.nf-glitch {
  font-size: 13px;
  color: var(--red);
  font-family: var(--mono);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}
.nf-msg { font-size: 13.5px; color: var(--text-dim); margin-bottom: 32px; max-width: 420px; line-height: 1.7; }
.nf-terminal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--green-dim);
  border-radius: 3px;
  padding: 14px 18px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 32px;
  min-width: 300px;
}
.nf-terminal .t-line { margin-bottom: 4px; }
.nf-terminal .t-prompt { color: var(--green-dim); }
.nf-terminal .t-cmd    { color: var(--text); }
.nf-terminal .t-out    { color: var(--red); padding-left: 2ch; }
.nf-home {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--green);
  text-decoration: none;
  border: 1px solid var(--green-dim);
  padding: 7px 16px;
  border-radius: 2px;
  background: var(--green-dark);
  transition: all 0.12s;
}
.nf-home:hover { background: rgba(0,255,65,0.1); border-color: var(--green); }

/* ─── Responsive ───────────────────────────────── */
@media (max-width: 600px) {
  .page-hero { padding: 36px 0 28px; }
  .hero-top { gap: 12px; }
  .hero-avatar { width: 46px; height: 46px; }
}
