/* ============================================================
   MALLOCFAIL — Full Cyber Retheme (cohesive + readable)
   Paste/replace entire CSS file
   ============================================================ */

/* -------------------------
   DESIGN TOKENS
   ------------------------- */
:root{
  /* Base */
  --bg0:#05070B;
  --bg1:#070A10;
  --text:#E7EEF9;
  --muted:#A1AEC2;

  /* Cyber accents (used as lines, not glow) */
  --cy:#00E5FF;
  --cy2:#8B5CF6;

  /* Surfaces */
  --panel: rgba(12, 16, 26, .70);
  --panel2: rgba(10, 14, 22, .78);
  --glass: rgba(255,255,255,.04);

  /* Lines + shadow */
  --line: rgba(255,255,255,.10);
  --line2: rgba(0,229,255,.18);
  --shadow: 0 18px 60px rgba(0,0,0,.55);

  /* Radii / sizing */
  --r: 16px;
  --r2: 22px;
  --max: 1100px;
  --read: 72ch;

  /* Typography */
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

/* -------------------------
   BASE RESET
   ------------------------- */
*{ box-sizing:border-box; }
html, body{ margin:0; min-height:100%; }
body{
  background: radial-gradient(1200px 800px at 30% 0%, rgba(0,229,255,.06), transparent 55%),
              radial-gradient(1200px 900px at 80% 15%, rgba(139,92,246,.07), transparent 55%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  font-family: var(--sans);
  line-height:1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x:hidden;
}

img{ max-width:100%; height:auto; display:block; }
a{ color: rgba(231,238,249,.92); text-decoration:none; }
a:hover{ color: var(--cy); }

/* Subtle grid (what you liked) */
body::before{
  content:"";
  position: fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size:44px 44px;
  opacity:.35;
  z-index:0;
}
body > *{ position:relative; z-index:1; }

/* Kill “glow bloom” globally */
*{
  text-shadow: none !important;
  filter: none !important;
}

/* -------------------------
   GLOBAL LAYOUT
   ------------------------- */
main, footer{
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem;
}

/* Normalize common theme wrappers (no random widths) */
.container, .content, .wrap, .page, .single, .list, .posts, .post-list, section{
  width:100%;
  max-width: var(--max);
  margin-left:auto;
  margin-right:auto;
}

/* -------------------------
   HEADER / TOP BAR (NEW)
   Turns the “homebar pill” into a real navbar
   ------------------------- */
body > header{
  width:100%;
  padding: 1.15rem 1rem .25rem;
  display:flex;
  justify-content:center;
}

body > header > *{
  width: 100%;
  max-width: var(--max);
}

/* Title row */
header h1{
  margin:0;
  display:flex;
  justify-content:center;
}

/* Brand pill — crisp neon edge, NOT glow */
header h1 a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.6rem;

  width: min(520px, 100%);
  padding: .7rem 1.2rem;
  border-radius: 999px;

  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(0,0,0,.45) inset, 0 10px 35px rgba(0,0,0,.35);

  font-weight: 900;
  letter-spacing:.10em;
  text-transform: lowercase;
  color: rgba(231,238,249,.86);
}

/* Hover = edge highlight only */
header h1 a:hover{
  border-color: var(--line2);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.55) inset,
    0 0 0 1px rgba(0,229,255,.16),
    0 12px 42px rgba(0,0,0,.40);
  color: var(--text);
}

/* Navigation pills */
header nav, nav{
  margin-top: .75rem;
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  justify-content:center;
}

nav a{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  padding:.45rem .75rem;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  color: rgba(161,174,194,.95);
}
nav a:hover{
  border-color: rgba(0,229,255,.25);
  color: var(--text);
}

/* -------------------------
   CARD SYSTEM (USED EVERYWHERE)
   ------------------------- */
:where(article, .mf-hero, .mf-terminal, .mf-card, .card, .panel, main > section, main > article){
  border-radius: var(--r2);
}

/* Generic “panel” look */
:where(.mf-hero, .mf-terminal, .mf-card, main > section, main .posts article, main .post-list article){
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

/* Cyber “corner ticks” (subtle) */
:where(.mf-hero, .mf-terminal, .mf-card, main > article, main .posts article, main .post-list article){
  position: relative;
}
:where(.mf-hero, .mf-terminal, .mf-card, main > article, main .posts article, main .post-list article)::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius: inherit;
  pointer-events:none;
  background:
    linear-gradient(90deg, rgba(0,229,255,.14), transparent 30%) top left / 120px 2px no-repeat,
    linear-gradient(180deg, rgba(0,229,255,.14), transparent 35%) top left / 2px 120px no-repeat,
    linear-gradient(90deg, rgba(139,92,246,.14), transparent 30%) bottom right / 120px 2px no-repeat,
    linear-gradient(180deg, rgba(139,92,246,.14), transparent 35%) bottom right / 2px 120px no-repeat;
  opacity:.55;
}

/* -------------------------
   HOMEPAGE COMPONENTS (mf-*)
   ------------------------- */
.mf-wrap{
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem;
}

.mf-hero{
  padding: 1.25rem;
  background:
    radial-gradient(900px 280px at 20% 0%, rgba(0,229,255,.08), transparent 55%),
    radial-gradient(900px 320px at 80% 0%, rgba(139,92,246,.08), transparent 55%),
    var(--panel2);
}

.mf-hero__top{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 1rem;
}
@media (max-width: 920px){
  .mf-hero__top{ grid-template-columns:1fr; }
}

.mf-kicker{
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing:.14em;
  text-transform:uppercase;
  font-size:.75rem;
}

.mf-title{
  margin:.25rem 0 .35rem;
  font-size: clamp(2rem, 4.8vw, 3rem);
  letter-spacing:.02em;
}

.mf-subtitle{
  margin:0;
  max-width: 60ch;
  color: rgba(161,174,194,.95);
}

.mf-actions{ display:flex; flex-wrap:wrap; gap:.6rem; margin-top:1rem; }

.mf-btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  padding:.5rem .85rem;
  border-radius:999px;
  font-weight:800;
  color: rgba(231,238,249,.90);
}
.mf-btn:hover{
  border-color: rgba(0,229,255,.25);
  color: var(--text);
}

/* Terminal */
.mf-terminal{
  overflow:hidden;
  background: rgba(8,10,14,.72);
}
.mf-terminal__bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:.55rem .75rem;
  border-bottom:1px solid var(--line);
  color: rgba(161,174,194,.95);
  font-family: var(--mono);
  font-size:.82rem;
}
.mf-terminal__body{
  margin:0;
  padding:.85rem .9rem 1rem;
  font-family: var(--mono);
  font-size:.9rem;
  white-space: pre-wrap;
  color: rgba(231,238,249,.90);
}

/* Latest posts */
.mf-sectionhead{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  margin-top: 1.5rem;
  margin-bottom:.75rem;
}
.mf-link{ color: rgba(161,174,194,.95); }
.mf-link:hover{ color: var(--cy); }

.mf-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .9rem;
}
@media(max-width: 920px){ .mf-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media(max-width: 620px){ .mf-grid{ grid-template-columns: 1fr; } }

.mf-card{
  padding: 1rem;
  background: rgba(255,255,255,.02);
  box-shadow: 0 16px 50px rgba(0,0,0,.45);
  transition: transform .14s ease, border-color .14s ease;
}
.mf-card:hover{
  transform: translateY(-2px);
  border-color: rgba(0,229,255,.22);
}
.mf-card__meta{ display:flex; gap:.45rem; align-items:center; color: var(--muted); font-size:.86rem; }
.mf-card__title{ margin:.25rem 0 .4rem; font-size:1.05rem; }
.mf-card__summary{ margin:0; color: rgba(161,174,194,.95); }

/* -------------------------
   LIST PAGES (POSTS/TAGS/AUTHORS)
   The theme often outputs weird structures; we normalize
   ------------------------- */
main .posts,
main .post-list,
main ul{
  list-style:none;
  padding-left:0;
}

/* If the theme uses a UL for posts, grid it */
main ul{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1rem;
}
@media(max-width: 860px){
  main ul{ grid-template-columns: 1fr; }
}

/* Cards for list items */
main li,
main .posts article,
main .post-list article{
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 55px rgba(0,0,0,.45);
  border-radius: var(--r2);
}

/* Prevent “tiny centered card” on some themes */
main article, main section{
  width: 100% !important;
  max-width: none !important;
}

/* Titles/meta in lists */
main h2, main h3{ margin-top:0; }
time, .date, .meta, small{ color: rgba(161,174,194,.92); }

/* Tag/author pills */
a[href*="/tags/"], a[href*="/authors/"]{
  display:inline-block;
  margin:.25rem .35rem 0 0;
  padding:.18rem .55rem;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  color: rgba(161,174,194,.95);
  font-family: var(--mono);
  font-size:.82rem;
}
a[href*="/tags/"]:hover{
  border-color: rgba(139,92,246,.22);
  color: var(--text);
}
a[href*="/authors/"]:hover{
  border-color: rgba(0,229,255,.22);
  color: var(--text);
}

/* -------------------------
   SINGLE POST PAGE (MAJOR FIX)
   Make it actually readable and not “weird”
   ------------------------- */
main > article{
  max-width: var(--read) !important;
  margin: 1.75rem auto !important;
  padding: 1.5rem 1.5rem !important;

  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  box-shadow: 0 18px 70px rgba(0,0,0,.55);
  border-radius: var(--r2);
}

/* Single post typography */
main > article h1{
  margin: 0 0 .65rem 0;
  font-size: 1.85rem;
}
main > article h2{ margin-top: 1.4rem; }
main > article p{ color: rgba(231,238,249,.92); }
main > article a{ color: rgba(0,229,255,.90); }
main > article a:hover{ color: var(--cy); }

/* Blockquotes: terminal-ish */
blockquote{
  margin: 1.25rem 0;
  padding: .95rem 1rem;
  border-left: 3px solid rgba(0,229,255,.60);
  background: rgba(0,229,255,.06);
  border-radius: 12px;
  color: rgba(231,238,249,.92);
}

/* Code blocks: crisp, readable */
pre, code{ font-family: var(--mono); }
pre{
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: .9rem;
  overflow:auto;
}
p code, li code{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  padding: .12rem .4rem;
  border-radius: 10px;
}

/* -------------------------
   FOOTER
   ------------------------- */
footer{
  color: rgba(161,174,194,.92);
  padding-bottom: 2rem;
}
footer a{ color: rgba(231,238,249,.88); }
footer a:hover{ color: var(--cy); }

/* =========================================
   SPACING TIGHTEN — HERO → POSTS
   ========================================= */

/* Reduce bottom margin on hero panel */
.mf-hero{
  margin-bottom: .85rem !important;
}

/* Reduce top margin on section headers (Latest posts) */
.mf-sectionhead{
  margin-top: .85rem !important;
}

/* If theme wraps sections in <section>, normalize spacing */
main > section{
  margin-top: .85rem !important;
}

/* Safety: remove extra margin Hugo themes sometimes add */
main > section + section{
  margin-top: .85rem !important;
}
