/* ============================================
   #B4mad Industries — Command Center Theme
   Hugo Edition · 2026
   ============================================ */

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

:root {
  --accent: #458B74;
  --accent-light: #5aad92;
  --accent-dark: #346b59;
  --accent-glow: rgba(69, 139, 116, 0.4);
  --bg-primary: #0a0e14;
  --bg-secondary: #111820;
  --bg-card: #151c25;
  --bg-card-hover: #1a2330;
  --text-primary: #e0e6ed;
  --text-secondary: #8899aa;
  --text-muted: #556677;
  --border: #1e2a36;
  --border-accent: rgba(69, 139, 116, 0.3);
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --radius: 8px;
  --radius-lg: 16px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(69, 139, 116, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 139, 116, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Glow orb */
body::after {
  content: '';
  position: fixed;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(69, 139, 116, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 20s ease-in-out infinite alternate;
}

@keyframes orb-drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-100px, 200px); }
}

/* Scanline effect */
.scanline {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(69, 139, 116, 0.015) 2px,
    rgba(69, 139, 116, 0.015) 4px
  );
  pointer-events: none;
  z-index: 1000;
}

/* Links */
a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}
a:hover {
  color: #7ccdb3;
  text-shadow: 0 0 8px var(--accent-glow);
}

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

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-logo .hash {
  color: var(--accent);
  font-size: 1.5rem;
  text-shadow: 0 0 12px var(--accent-glow);
}

.site-logo .status-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
  margin-left: 0.25rem;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--accent-glow); }
  50% { opacity: 0.4; box-shadow: 0 0 12px var(--accent-glow); }
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent-light);
  background: rgba(69, 139, 116, 0.1);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.2rem;
}

/* ---- MAIN CONTENT ---- */
.content-wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ---- HERO (homepage) ---- */
.hero {
  position: relative;
  padding: 5rem 2rem 3rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(69, 139, 116, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  position: relative;
}

.hero h1 .hash {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.hero .tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  position: relative;
}

.hero .tagline em {
  color: var(--accent-light);
  font-style: normal;
}

/* ---- TYPOGRAPHY ---- */
h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--text-primary);
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--accent-light);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

p { margin: 0 0 1rem; }

ul, ol {
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

li { margin: 0.25rem 0; }

strong { color: var(--text-primary); font-weight: 700; }

em { color: var(--accent-light); }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

blockquote p:last-child { margin: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ---- CODE ---- */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent-light);
}

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

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* ---- TABLES ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

thead th {
  background: var(--bg-secondary);
  color: var(--accent-light);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--accent-dark);
}

tbody td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ---- ARTICLE META ---- */
.article-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.article-meta .date {
  color: var(--accent);
}

.article-meta .section-tag {
  background: rgba(69, 139, 116, 0.15);
  color: var(--accent-light);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- PAGE LIST (sections) ---- */
.page-list {
  list-style: none;
  padding: 0;
}

.page-list li {
  padding: 0.75rem 1rem;
  margin: 0.25rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.page-list li:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 12px var(--accent-glow);
}

.page-list .date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent);
  white-space: nowrap;
  min-width: 6rem;
}

.page-list a {
  font-weight: 500;
}

/* ---- SECTION CARDS (homepage) ---- */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
}

.section-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.section-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-2px);
}

.section-card .card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.section-card .card-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-card .card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.section-card .card-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.75rem;
}

/* ---- FOOTER ---- */
.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer a {
  color: var(--accent);
}

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

  .nav-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: rgba(10, 14, 20, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .site-nav.open { display: flex; }

  .hero h1 { font-size: 2rem; }

  .content-wrap { padding: 1.5rem 1rem; }

  .section-grid { grid-template-columns: 1fr; }

  .page-list li { flex-direction: column; gap: 0.25rem; }
}

/* Fixes — v2 */
.hero {
  padding: 3rem 2rem 1rem;
}

.hero h1 {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.section-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

@media (min-width: 769px) {
  .section-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card icons — ensure emoji render properly */
.section-card .card-icon {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

.section-card .card-desc {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Footer */
.site-footer .hash {
  color: var(--accent);
}

/* Mobile fixes */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .hero .tagline {
    font-size: 0.9rem;
    padding: 0 0.5rem;
  }

  .content-wrap {
    padding: 1.5rem 1rem 3rem;
  }

  .section-card {
    padding: 1rem;
  }

  .section-card .card-desc {
    font-size: 0.8rem;
  }

  .page-list li {
    flex-direction: column;
    gap: 0.2rem;
  }
}
