/* ============================================================
   COBRA — Shared stylesheet for all pages
   Plain CSS (no Tailwind), mobile-first, semantic tokens.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --background: hsl(120 5% 4%);
  --foreground: hsl(120 10% 85%);
  --card: hsl(120 5% 7%);
  --primary: hsl(120 100% 40%);
  --primary-foreground: hsl(120 5% 4%);
  --secondary: hsl(120 8% 12%);
  --muted: hsl(120 5% 15%);
  --muted-foreground: hsl(120 5% 50%);
  --destructive: hsl(0 84% 60%);
  --border: hsl(120 15% 18%);
  --input: hsl(120 10% 14%);

  --font-display: 'Orbitron', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; background: none; border: none; color: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ---------- Utility ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 1.5rem; }
.divider { height: 1px; background: var(--border); width: 100%; }
.divider-sm { height: 1px; background: hsl(120 100% 40% / 0.4); width: 8rem; margin-top: 0.5rem; }
.text-glow { text-shadow: 0 0 10px hsl(120 100% 40% / 0.6), 0 0 30px hsl(120 100% 40% / 0.3); }
.text-glow-subtle { text-shadow: 0 0 8px hsl(120 100% 40% / 0.3); }
.box-glow { box-shadow: 0 0 15px hsl(120 100% 40% / 0.15), inset 0 0 15px hsl(120 100% 40% / 0.05); }
.scanline {
  background: repeating-linear-gradient(0deg, transparent, transparent 2px,
    hsl(120 100% 40% / 0.03) 2px, hsl(120 100% 40% / 0.03) 4px);
}
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--muted-foreground); }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }

/* ---------- Fade-in animation ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: hsl(120 5% 4% / 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  color: var(--primary);
  text-shadow: 0 0 10px hsl(120 100% 40% / 0.6), 0 0 30px hsl(120 100% 40% / 0.3);
}
.nav-links { display: none; gap: 2rem; }
.nav-links a {
  font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-foreground); transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); text-shadow: 0 0 8px hsl(120 100% 40% / 0.3); }
.nav-toggle { color: var(--foreground); display: block; }
.nav-toggle svg { width: 24px; height: 24px; }
.nav-mobile { display: none; flex-direction: column; padding: 0 1.5rem 1rem; border-top: 1px solid var(--border); background: var(--background); }
.nav-mobile.open { display: flex; }
.nav-mobile a { padding: 0.75rem 0; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-foreground); }
.nav-mobile a:hover { color: var(--primary); }

@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
  .nav-mobile { display: none !important; }
}

.back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-foreground); transition: color 0.2s;
}
.back-link:hover { color: var(--primary); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; font-family: var(--font-mono);
  font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.1em;
  border: 1px solid var(--border); color: var(--foreground);
  transition: all 0.2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  border-color: var(--primary); color: var(--primary);
  background: hsl(120 100% 40% / 0.1);
  box-shadow: 0 0 15px hsl(120 100% 40% / 0.15), inset 0 0 15px hsl(120 100% 40% / 0.05);
}
.btn-primary:hover { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 0 25px hsl(120 100% 40% / 0.3); }

/* ============================================================
   HERO (home)
   ============================================================ */
.hero {
  position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center;
  overflow: hidden; text-align: center;
}
.hero-bg { position: absolute; inset: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: hsl(120 5% 4% / 0.6); }
.hero-scanline { position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px,
    hsl(120 100% 40% / 0.03) 2px, hsl(120 100% 40% / 0.03) 4px); }
.hero-content { position: relative; z-index: 10; padding: 0 1.5rem; }
.hero h1 {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(3rem, 10vw, 6rem); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--primary);
  text-shadow: 0 0 10px hsl(120 100% 40% / 0.6), 0 0 30px hsl(120 100% 40% / 0.3);
}
.hero-subtitle { margin-top: 1rem; font-family: var(--font-mono); font-size: clamp(1rem, 2vw, 1.25rem); color: var(--muted-foreground); }
.hero-rule { width: 12rem; height: 1px; background: hsl(120 100% 40% / 0.4); margin: 1rem auto 0; }
.hero-blurb { margin-top: 1.5rem; max-width: 38rem; margin-left: auto; margin-right: auto; font-size: 0.875rem; color: hsl(120 10% 85% / 0.7); }
.hero-buttons { margin-top: 2.5rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   GENERIC SECTIONS
   ============================================================ */
.section { border-top: 1px solid var(--border); padding: 6rem 0; }
.section h2 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary);
  text-shadow: 0 0 8px hsl(120 100% 40% / 0.3);
}

/* ---------- Projects grid ---------- */
.grid { display: grid; gap: 1.5rem; margin-top: 3rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  border: 1px solid var(--border); background: var(--card); padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: hsl(120 100% 40% / 0.5); box-shadow: 0 0 15px hsl(120 100% 40% / 0.15); }
.card-thumb {
  height: 8rem; border: 1px solid var(--border); background: hsl(120 8% 12% / 0.5);
  display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
  font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: hsl(120 100% 40% / 0.3);
}
.card h3 { font-family: var(--font-display); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.1em; }
.card p { margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted-foreground); }
.tags { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag { border: 1px solid var(--border); padding: 0.125rem 0.5rem; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-foreground); }
.badge { display: inline-block; border: 1px solid; padding: 0.125rem 0.5rem; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.1em; }
.badge.easy { border-color: hsl(120 5% 50% / 0.5); color: var(--muted-foreground); }
.badge.medium { border-color: hsl(120 100% 40% / 0.5); color: var(--primary); }
.badge.hard { border-color: hsl(0 84% 60% / 0.5); color: var(--destructive); }

/* ---------- Pagination ---------- */
.pager { margin-top: 2rem; display: flex; justify-content: center; align-items: center; gap: 1rem; }
.pager button { border: 1px solid var(--border); padding: 0.5rem; color: var(--muted-foreground); transition: all 0.2s; }
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---------- Research featured ---------- */
.research-wrap { margin-top: 3rem; display: flex; flex-direction: column; gap: 2rem; }
@media (min-width: 768px) { .research-wrap { flex-direction: row; } }
.research-featured { flex: 2; border: 1px solid var(--border); background: var(--card); }
.research-featured-img {
  height: 16rem; background: hsl(120 8% 12% / 0.3); display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px,
    hsl(120 100% 40% / 0.03) 2px, hsl(120 100% 40% / 0.03) 4px);
}
.research-featured-img h3 { font-family: var(--font-display); font-size: 1.125rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.5rem; }
.research-featured-img p { margin-top: 0.75rem; max-width: 28rem; font-size: 0.75rem; color: var(--muted-foreground); }
.research-featured-footer { padding: 1rem; border-top: 1px solid var(--border); }
.research-side { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.research-side a { display: block; padding: 1rem; border: 1px solid var(--border); background: var(--card); transition: all 0.2s; }
.research-side a:hover { border-color: hsl(120 100% 40% / 0.5); box-shadow: 0 0 15px hsl(120 100% 40% / 0.15); }
.research-side h4 { font-family: var(--font-display); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.25rem; }
.research-side .code { font-family: var(--font-mono); font-size: 0.625rem; color: var(--muted-foreground); }

/* ---------- About ---------- */
.about-wrap { margin-top: 3rem; display: flex; flex-direction: column; gap: 3rem; }
@media (min-width: 768px) { .about-wrap { flex-direction: row; align-items: flex-start; } }
.about-text { flex: 2; display: flex; flex-direction: column; gap: 1rem; font-size: 0.875rem; color: hsl(120 10% 85% / 0.8); }
.about-icon { flex: 1; display: flex; justify-content: center; }
.about-icon-box {
  width: 10rem; height: 10rem; border: 1px solid hsl(120 100% 40% / 0.3);
  background: hsl(120 100% 40% / 0.05); display: flex; align-items: center; justify-content: center;
  animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px hsl(120 100% 40% / 0.2); }
  50%      { box-shadow: 0 0 25px hsl(120 100% 40% / 0.4); }
}

/* ---------- Contact ---------- */
.contact-wrap { margin-top: 3rem; display: flex; flex-direction: column; gap: 3rem; }
@media (min-width: 768px) { .contact-wrap { flex-direction: row; } .contact-wrap > * { flex: 1; } }
.contact-image {
  height: 18rem; border: 1px solid var(--border); background: hsl(120 8% 12% / 0.3);
  display: flex; align-items: center; justify-content: center; text-align: center;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px,
    hsl(120 100% 40% / 0.03) 2px, hsl(120 100% 40% / 0.03) 4px);
}
.contact-image .brand-lg { font-family: var(--font-display); font-size: 2.25rem; font-weight: 900; color: var(--primary); text-shadow: 0 0 10px hsl(120 100% 40% / 0.6); }
form .field { margin-bottom: 1rem; }
form label { display: block; font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-foreground); margin-bottom: 0.25rem; }
form input, form textarea {
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); background: var(--input);
  color: var(--foreground); font-family: var(--font-mono); font-size: 0.875rem; outline: none;
  transition: border-color 0.2s;
}
form input:focus, form textarea:focus { border-color: var(--primary); }
form textarea { resize: none; }
.socials { margin-top: 1.5rem; display: flex; gap: 1rem; }
.socials a { display: inline-flex; padding: 0.5rem; border: 1px solid var(--border); color: var(--muted-foreground); transition: all 0.2s; }
.socials a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--card); padding: 4rem 0; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 3rem; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer-grid h4 { font-family: var(--font-display); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; }
.footer-grid ul { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-grid a { font-size: 0.75rem; color: var(--muted-foreground); }
.footer-grid a:hover { color: var(--primary); }

/* ============================================================
   ARTICLE PAGES (writeup / report)
   ============================================================ */
.page-main { padding: 7rem 0 6rem; }
.page-header { margin-bottom: 2rem; }
.page-eyebrow { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary); text-shadow: 0 0 8px hsl(120 100% 40% / 0.3); }
.page-title { margin-top: 1rem; font-family: var(--font-display); font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.meta { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.75rem; color: var(--muted-foreground); }
.meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

.toc { margin-top: 2rem; border: 1px solid var(--border); background: var(--card); padding: 1.5rem; }
.toc h2 { font-family: var(--font-display); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary); text-shadow: 0 0 8px hsl(120 100% 40% / 0.3); }
.toc ol { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }
.toc li { cursor: pointer; transition: color 0.2s; }
.toc li:hover { color: var(--primary); }
.toc .num { font-family: var(--font-mono); color: hsl(120 100% 40% / 0.6); margin-right: 0.25rem; }

.sections { margin-top: 3rem; display: flex; flex-direction: column; gap: 4rem; }
.article-section h2 { display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-display); font-size: 1.125rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--foreground); }
.article-section h2 .num { color: hsl(120 100% 40% / 0.5); margin-right: 0.5rem; }
.article-section .rule { margin-top: 0.25rem; height: 1px; width: 6rem; background: hsl(120 100% 40% / 0.3); }
.article-section .body { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.article-section p { color: var(--muted-foreground); line-height: 1.7; }

.codeblock { border: 1px solid var(--border); background: hsl(120 8% 12% / 0.3); overflow-x: auto; }
.codeblock .head { border-bottom: 1px solid var(--border); padding: 0.5rem 1rem; font-family: var(--font-mono); font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted-foreground); }
.codeblock pre { padding: 1rem; font-size: 0.75rem; line-height: 1.6; color: hsl(120 10% 85% / 0.8); white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); }

.note { border-left: 2px solid hsl(120 100% 40% / 0.5); background: hsl(120 100% 40% / 0.05); padding: 1rem; font-size: 0.75rem; color: var(--muted-foreground); }
.note.warn { border-color: hsl(0 84% 60% / 0.5); background: hsl(0 84% 60% / 0.05); color: var(--destructive); }

.checklist { display: flex; flex-direction: column; gap: 0.5rem; }
.checklist li { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }
.checklist li::before { content: "☐"; color: hsl(120 100% 40% / 0.6); margin-top: 2px; }

.infobox { border: 1px solid hsl(120 100% 40% / 0.3); background: hsl(120 100% 40% / 0.05); padding: 1rem; }
.infobox .lbl { font-family: var(--font-display); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary); }
.infobox p { margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted-foreground); }

.kv-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .kv-grid { grid-template-columns: repeat(2, 1fr); } }
.kv { border: 1px solid var(--border); background: hsl(120 8% 12% / 0.3); padding: 0.75rem; }
.kv .lbl { font-family: var(--font-display); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary); }
.kv p { margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted-foreground); }

.priority-list { display: flex; flex-direction: column; gap: 0.75rem; }
.priority-list .row { display: flex; align-items: flex-start; gap: 0.75rem; border: 1px solid var(--border); padding: 0.75rem; background: hsl(120 8% 12% / 0.3); }
.priority-list .row.critical { border-color: hsl(0 84% 60% / 0.5); background: hsl(0 84% 60% / 0.05); }
.priority-list .row.critical .lbl { color: var(--destructive); }
.priority-list .row.high { border-color: hsl(120 100% 40% / 0.5); background: hsl(120 100% 40% / 0.05); }
.priority-list .lbl { font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary); }
.priority-list p { font-size: 0.75rem; color: var(--muted-foreground); }

.ref-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ref-list li { display: flex; gap: 0.5rem; font-size: 0.875rem; color: var(--muted-foreground); }
.ref-list li::before { content: "→"; color: hsl(120 100% 40% / 0.6); margin-top: 2px; }

.page-footer { margin-top: 4rem; border-top: 1px solid var(--border); padding-top: 2rem; text-align: center; }
.page-footer p { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted-foreground); }

/* ============================================================
   WRITEUPS INDEX
   ============================================================ */
.cve-grid { margin-top: 3rem; display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .cve-grid { grid-template-columns: repeat(2, 1fr); } }
.cve-card { display: block; height: 100%; border: 1px solid var(--border); background: var(--card); padding: 1.25rem; transition: all 0.2s; }
.cve-card:hover { border-color: hsl(120 100% 40% / 0.5); box-shadow: 0 0 15px hsl(120 100% 40% / 0.15); }
.cve-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.cve-card .id { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--primary); }
.cve-card h2 { margin-top: 0.75rem; font-family: var(--font-display); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.1em; }
.cve-card:hover h2 { color: var(--primary); }
.cve-card p { margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted-foreground); line-height: 1.6; }
.cve-card .bottom { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.625rem; color: var(--muted-foreground); }
.cve-card .bottom .read { color: hsl(120 100% 40% / 0.8); text-transform: uppercase; letter-spacing: 0.15em; }
.contrib-box { margin-top: 4rem; border: 1px solid var(--border); background: var(--card); padding: 1.5rem; }
.contrib-box a { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }
