/* ═══════════════════════════════════════════════════════
   HILMYBOX ENGINEERING JOURNAL — Ghost Theme
   iPadOS Glass UI · Day/Night Mode
   ═══════════════════════════════════════════════════════ */

/* ─── DARK MODE (default) ─── */
:root, [data-theme="dark"] {
  --bg-primary: #0a0c10;
  --bg-secondary: #0f1218;
  --glass: rgba(255,255,255,0.04);
  --glass-hover: rgba(255,255,255,0.07);
  --glass-strong: rgba(255,255,255,0.10);
  --glass-border: rgba(255,255,255,0.08);
  --glass-border-hover: rgba(255,255,255,0.15);
  --glass-highlight: rgba(255,255,255,0.12);
  --glass-blur: 40px;
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04);
  --glass-shadow-hover: 0 16px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.08);
  --text-primary: #ffffff;
  --text-secondary: #a0a8c0;
  --text-muted: #6a7394;
  --text-faint: #464e68;
  --accent: #00d4ff;
  --accent-dim: rgba(0,212,255,0.10);
  --accent-glow: rgba(0,212,255,0.25);
  --accent-warm: #ff6b4a;
  --accent-green: #34d399;
  --accent-purple: #a78bfa;
  --nav-bg: rgba(15,18,24,0.65);
  --nav-bg-scroll: rgba(10,12,16,0.88);
  --nav-link: #b0b8cc;
  --nav-mobile-bg: rgba(15,18,24,0.88);
  --card-number-bg: rgba(10,12,16,0.5);
  --code-bg: rgba(255,255,255,0.06);
  --pre-bg: rgba(255,255,255,0.03);
  --pre-text: #e0e4ec;
  --grid-line: rgba(255,255,255,0.015);
  --grid-glow1: rgba(0,212,255,0.04);
  --grid-glow2: rgba(167,139,250,0.03);
  --grid-glow3: rgba(52,211,153,0.02);
  --divider: rgba(255,255,255,0.06);
  --scroll-thumb: rgba(255,255,255,0.1);
  --badge-text: #0a0c10;
  --selection-text: #0a0c10;
  --btn-text: #0a0c10;
  --hero-desc: #b0b8cc;
  --stat-label: #8892a8;
  --body-text: #b8c0d4;
  --content-em: #d0d6e4;
  --content-quote: #d0d6e4;
  --sub-border-color: rgba(0,212,255,0.4);
  --sub-btn-bg: rgba(0,212,255,0.06);
  --top-highlight: rgba(255,255,255,0.06);
  --top-highlight-strong: rgba(255,255,255,0.15);
  --chevron-color: rgba(255,255,255,0.2);
  --error-code-color: rgba(255,255,255,0.06);
}

/* ─── LIGHT MODE ─── */
[data-theme="light"] {
  --bg-primary: #f2f2f7;
  --bg-secondary: #e5e5ea;
  --glass: rgba(255,255,255,0.55);
  --glass-hover: rgba(255,255,255,0.72);
  --glass-strong: rgba(255,255,255,0.80);
  --glass-border: rgba(0,0,0,0.06);
  --glass-border-hover: rgba(0,0,0,0.12);
  --glass-highlight: rgba(255,255,255,0.90);
  --glass-blur: 40px;
  --glass-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --glass-shadow-hover: 0 12px 40px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.06);
  --text-primary: #1c1c1e;
  --text-secondary: #48484a;
  --text-muted: #8e8e93;
  --text-faint: #aeaeb2;
  --accent: #007aff;
  --accent-dim: rgba(0,122,255,0.08);
  --accent-glow: rgba(0,122,255,0.18);
  --accent-warm: #ff3b30;
  --accent-green: #30d158;
  --accent-purple: #af52de;
  --nav-bg: rgba(255,255,255,0.60);
  --nav-bg-scroll: rgba(255,255,255,0.82);
  --nav-link: #48484a;
  --nav-mobile-bg: rgba(255,255,255,0.85);
  --card-number-bg: rgba(255,255,255,0.6);
  --code-bg: rgba(0,0,0,0.04);
  --pre-bg: rgba(0,0,0,0.03);
  --pre-text: #1c1c1e;
  --grid-line: rgba(0,0,0,0.02);
  --grid-glow1: rgba(0,122,255,0.04);
  --grid-glow2: rgba(175,82,222,0.03);
  --grid-glow3: rgba(48,209,88,0.02);
  --divider: rgba(0,0,0,0.06);
  --scroll-thumb: rgba(0,0,0,0.12);
  --badge-text: #ffffff;
  --selection-text: #ffffff;
  --btn-text: #ffffff;
  --hero-desc: #636366;
  --stat-label: #8e8e93;
  --body-text: #48484a;
  --content-em: #3a3a3c;
  --content-quote: #3a3a3c;
  --sub-border-color: rgba(0,122,255,0.3);
  --sub-btn-bg: rgba(0,122,255,0.06);
  --top-highlight: rgba(255,255,255,0.70);
  --top-highlight-strong: rgba(255,255,255,0.90);
  --chevron-color: rgba(0,0,0,0.2);
  --error-code-color: rgba(0,0,0,0.06);
}

/* ─── SHARED TOKENS ─── */
:root {
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --max-width: 1400px;
  --content-width: 760px;
  --wide-width: 1080px;
}


/* ─── RESET & BASE ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--bg-primary) !important;
}

body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-family: var(--sans);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.5s, color 0.5s;
}

/* Ghost overrides */
.gh-viewport, .gh-main, .site-content, .gh-outer, .gh-inner,
main, .gh-head, .gh-foot, [class*="gh-"] {
  background: transparent !important;
  color: inherit !important;
}
body::before, body::after { background: transparent !important; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

::selection {
  background: var(--accent);
  color: var(--selection-text);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }


/* ═══════════════════════════════════════════════════════
   BACKGROUND
   ═══════════════════════════════════════════════════════ */
.hb-grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, var(--grid-glow1), transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 30%, var(--grid-glow2), transparent 50%),
    radial-gradient(ellipse 70% 40% at 50% 90%, var(--grid-glow3), transparent 50%);
  transition: background 0.5s;
}

.hb-grid-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 80px 80px;
}

.hb-scanline { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; }

.hb-content {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


/* ═══════════════════════════════════════════════════════
   GLASS NAV
   ═══════════════════════════════════════════════════════ */
.hb-nav {
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  z-index: 100;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg) !important;
  backdrop-filter: blur(50px) saturate(1.6);
  -webkit-backdrop-filter: blur(50px) saturate(1.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--top-highlight);
  transition: all 0.4s;
}

.hb-nav.scrolled {
  background: var(--nav-bg-scroll) !important;
  box-shadow: var(--glass-shadow-hover), inset 0 1px 0 var(--top-highlight);
  border-color: var(--glass-border);
}

.hb-nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hb-nav-logo-icon {
  width: 30px; height: 30px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  position: relative;
  overflow: hidden;
}

.hb-nav-logo-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0.1;
}

.hb-nav-logo-text {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.hb-nav-logo-text span {
  color: var(--text-muted);
  font-weight: 400;
}

.hb-nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hb-nav-right ul.nav, ul.nav {
  display: flex !important;
  align-items: center;
  gap: 2px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.hb-nav-right ul.nav li, ul.nav li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.hb-nav-right ul.nav li a, ul.nav li a {
  display: block;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--nav-link) !important;
  border-radius: var(--radius-sm);
  transition: all 0.25s;
  text-decoration: none;
}

.hb-nav-right ul.nav li a:hover, ul.nav li a:hover {
  color: var(--text-primary) !important;
  background: var(--glass);
}

.hb-nav-right ul.nav li.nav-current a, ul.nav li.nav-current a {
  color: var(--accent) !important;
  background: var(--accent-dim);
}

.hb-nav-subscribe {
  display: block;
  padding: 7px 18px !important;
  border: 1px solid var(--sub-border-color) !important;
  color: var(--accent) !important;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500 !important;
  border-radius: var(--radius-sm);
  transition: all 0.25s !important;
  background: var(--sub-btn-bg) !important;
}

.hb-nav-subscribe:hover {
  background: var(--accent) !important;
  color: var(--btn-text) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ─── THEME TOGGLE ─── */
.hb-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all 0.3s;
  margin-left: 4px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.hb-theme-toggle:hover {
  background: var(--glass-hover);
  border-color: var(--glass-border-hover);
  color: var(--accent);
  transform: scale(1.05);
}

.hb-theme-toggle .icon-sun,
.hb-theme-toggle .icon-moon {
  position: absolute;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark mode: show sun icon */
[data-theme="dark"] .hb-theme-toggle .icon-sun,
:root:not([data-theme="light"]) .hb-theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
[data-theme="dark"] .hb-theme-toggle .icon-moon,
:root:not([data-theme="light"]) .hb-theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

/* Light mode: show moon icon */
[data-theme="light"] .hb-theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
[data-theme="light"] .hb-theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.hb-nav-toggle {
  display: none;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
}

.hb-nav-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ═══════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════ */
.hb-hero {
  padding: 160px 48px 80px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.hb-hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: hbFadeUp 0.8s 0.2s both;
}

.hb-hero-eyebrow::before {
  content: '';
  width: 32px; height: 1px;
  background: var(--accent);
}

.hb-hero-title {
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 400;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 28px;
  max-width: 900px;
  animation: hbFadeUp 0.8s 0.35s both;
}

.hb-hero-title em {
  color: var(--accent);
  font-style: italic;
}

.hb-hero-desc {
  font-size: 17px;
  color: var(--hero-desc);
  max-width: 560px;
  line-height: 1.8;
  margin-bottom: 48px;
  animation: hbFadeUp 0.8s 0.5s both;
}

.hb-hero-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  animation: hbFadeUp 0.8s 0.65s both;
}

.hb-hero-stat {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--top-highlight);
  transition: all 0.4s;
}

.hb-hero-stat-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.hb-hero-stat-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--stat-label);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: block;
  margin-top: 4px;
}

.hb-cursor-blink {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: hbBlink 1s step-end infinite;
}


/* ═══════════════════════════════════════════════════════
   SECTION UTILITIES
   ═══════════════════════════════════════════════════════ */
.hb-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 48px;
  width: 100%;
}

.hb-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.hb-section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hb-section-label::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 3px;
}

.hb-section-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.hb-divider {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 48px;
}

.hb-divider-inner {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--divider) 30%, var(--divider) 70%, transparent);
}


/* ═══════════════════════════════════════════════════════
   FEATURED — Glass Card
   ═══════════════════════════════════════════════════════ */
.hb-featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow);
  transition: all 0.5s var(--transition);
}

.hb-featured:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow-hover), 0 0 60px var(--accent-dim);
  transform: translateY(-3px);
}

.hb-featured-img {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
}

.hb-featured-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--transition);
}

.hb-featured:hover .hb-featured-img img { transform: scale(1.04); }

.hb-featured-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(10,12,16,0.3));
}

.hb-featured-badge {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--badge-text);
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.hb-featured-body {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hb-featured-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hb-featured-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.hb-featured-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 28px;
}

.hb-featured-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.hb-meta-dot {
  width: 3px; height: 3px;
  background: var(--text-muted);
  border-radius: 50%;
}


/* ═══════════════════════════════════════════════════════
   POST CARDS — Glass Grid
   ═══════════════════════════════════════════════════════ */
.hb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.hb-card {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition);
}

.hb-card:hover {
  border-color: var(--glass-border-hover);
  background: var(--glass-hover) !important;
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--glass-shadow-hover);
}

.hb-card:hover .hb-card-img img { transform: scale(1.06); }

.hb-card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
  position: relative;
}

.hb-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--transition);
}

.hb-card-number {
  position: absolute;
  bottom: 10px; right: 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card-number-bg);
  backdrop-filter: blur(16px);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
}

.hb-card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hb-card-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--accent);
}

.hb-card-tag.tag-simulation { color: var(--accent); }
.hb-card-tag.tag-engineering { color: var(--accent-warm); }
.hb-card-tag.tag-development { color: var(--accent-green); }
.hb-card-tag.tag-robotics { color: var(--accent-purple); }

.hb-card-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.hb-card-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 18px;
  flex: 1;
}

.hb-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.hb-card-readmore {
  color: var(--accent);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.25s;
}

.hb-card:hover .hb-card-readmore { gap: 8px; }


/* ═══════════════════════════════════════════════════════
   ARTICLE
   ═══════════════════════════════════════════════════════ */
.hb-article { padding-top: 100px; }

.hb-article-header {
  max-width: var(--content-width);
  margin: 0 auto 48px;
  padding: 0 24px;
}

.hb-article-tag-link {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hb-article-tag-link::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--accent);
}

.hb-article-title {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.hb-article-excerpt {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.hb-article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 20px;
  border-top: 1px solid var(--divider);
}

.hb-article-feature-image {
  max-width: var(--content-width);
  margin: 0 auto 56px;
  padding: 0 24px;
}

.hb-article-feature-image img {
  width: 100%;
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}


/* ─── CONTENT ─── */
.hb-article-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px 80px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--body-text);
}

.hb-page-content { max-width: var(--wide-width) !important; }
.hb-page-header { max-width: var(--wide-width) !important; }

.hb-article-content h1,
.hb-article-content h2,
.hb-article-content h3,
.hb-article-content h4 {
  font-family: var(--sans);
  color: var(--text-primary);
  margin: 2.2em 0 0.7em;
  line-height: 1.3;
  font-weight: 600;
}

.hb-article-content h2 { font-size: 28px; }
.hb-article-content h3 { font-size: 22px; }
.hb-article-content h4 { font-size: 18px; }
.hb-article-content p { margin-bottom: 1.5em; }

.hb-article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-dim);
  transition: text-decoration-color 0.2s;
}

.hb-article-content a:hover { text-decoration-color: var(--accent); }
.hb-article-content strong { color: var(--text-primary); font-weight: 600; }
.hb-article-content em { color: var(--content-em); }

.hb-article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 24px;
  margin: 2em 0;
  font-style: italic;
  color: var(--content-quote);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
}

.hb-article-content ul,
.hb-article-content ol {
  padding-left: 1.6em;
  margin-bottom: 1.5em;
}
.hb-article-content ul { list-style: disc; }
.hb-article-content ol { list-style: decimal; }
.hb-article-content li { margin-bottom: 0.5em; }
.hb-article-content li::marker { color: var(--accent); }

.hb-article-content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg) !important;
  border: 1px solid var(--glass-border);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--accent);
}

.hb-article-content pre {
  background: var(--pre-bg) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 2em 0;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--top-highlight);
}

.hb-article-content pre code {
  background: none !important;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--pre-text);
}

.hb-article-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--divider), transparent);
  margin: 3em 0;
}

.hb-article-content img {
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  margin: 2em 0;
}

.hb-article-content figure { margin: 2em 0; }

.hb-article-content figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
}

.hb-article-content .kg-width-wide {
  max-width: var(--wide-width);
  margin-left: calc(50% - min(var(--wide-width)/2, 50vw - 24px));
  margin-right: calc(50% - min(var(--wide-width)/2, 50vw - 24px));
}

.hb-article-content .kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.hb-article-content .kg-image-card img,
.hb-article-content .kg-gallery-image img {
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

/* Ghost cards — glass */
.hb-article-content .kg-bookmark-card {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: border-color 0.2s;
}

.hb-article-content .kg-bookmark-card:hover { border-color: var(--glass-border-hover); }
.hb-article-content .kg-bookmark-container { display: flex; text-decoration: none; color: inherit; }
.hb-article-content .kg-bookmark-content { padding: 20px; flex: 1; }
.hb-article-content .kg-bookmark-title { font-weight: 600; font-size: 15px; color: var(--text-primary); margin-bottom: 6px; }
.hb-article-content .kg-bookmark-description { font-size: 13px; color: var(--text-secondary); }
.hb-article-content .kg-bookmark-metadata { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 10px; }
.hb-article-content .kg-bookmark-thumbnail { width: 200px; flex-shrink: 0; }
.hb-article-content .kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; border: none; margin: 0; }

.hb-article-content .kg-callout-card {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 2em 0;
  backdrop-filter: blur(20px);
}

.hb-article-content .kg-toggle-card {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin: 1.5em 0;
}

.hb-article-content .kg-toggle-card .kg-toggle-heading,
.hb-article-content .kg-toggle-card summary { color: var(--text-primary) !important; }
.hb-article-content .kg-toggle-card .kg-toggle-content { color: var(--body-text) !important; }

.hb-article-content iframe {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.hb-article-content .kg-embed-card { margin: 2em 0; }


/* ═══════════════════════════════════════════════════════
   PAGE CARD GRID (simulation etc.)
   ═══════════════════════════════════════════════════════ */
.hb-article-content h3 {
  font-family: var(--mono) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-secondary) !important;
  margin: 3em 0 1.2em !important;
  padding: 10px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  display: inline-block;
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--top-highlight);
}

.hb-page-content ul {
  list-style: none !important;
  padding-left: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 2em;
}

.hb-page-content ul li {
  margin-bottom: 0 !important;
  list-style: none !important;
}

.hb-page-content ul li::marker {
  content: '' !important;
  display: none !important;
}

.hb-page-content ul li a {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 18px 20px !important;
  background: var(--glass) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--sans) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  backdrop-filter: blur(24px) !important;
  box-shadow: var(--glass-shadow) !important;
  position: relative;
  overflow: hidden;
}

.hb-page-content ul li a::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--top-highlight), transparent);
  transition: all 0.3s;
}

.hb-page-content ul li a::after {
  content: '›';
  margin-left: auto;
  font-size: 18px;
  font-weight: 300;
  color: var(--chevron-color);
  transition: all 0.3s;
  flex-shrink: 0;
}

.hb-page-content ul li a:hover {
  background: var(--glass-hover) !important;
  border-color: var(--glass-border-hover) !important;
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--glass-shadow-hover), 0 0 30px var(--accent-dim) !important;
  text-decoration: none !important;
}

.hb-page-content ul li a:hover::before {
  left: 5%; right: 5%;
  background: linear-gradient(90deg, transparent, var(--top-highlight-strong), transparent);
}

.hb-page-content ul li a:hover::after {
  color: var(--accent);
  transform: translateX(3px);
}

.gh-content .kg-card, .hb-article-content .kg-card {
  background-color: transparent !important;
  color: inherit !important;
}

.hb-article-content div,
.hb-article-content section,
.hb-article-content aside {
  background-color: transparent !important;
}


/* ═══════════════════════════════════════════════════════
   ARCHIVE HEADER
   ═══════════════════════════════════════════════════════ */
.hb-archive-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 140px 48px 40px;
}

.hb-archive-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hb-archive-eyebrow::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--accent);
}

.hb-archive-title {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hb-archive-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
}


/* ═══════════════════════════════════════════════════════
   PAGINATION — Glass pills
   ═══════════════════════════════════════════════════════ */
.hb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 0 80px;
  font-family: var(--mono);
  font-size: 12px;
}

.hb-pagination a {
  padding: 10px 24px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--top-highlight);
  transition: all 0.25s;
}

.hb-pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.hb-pagination .hb-page-number { color: var(--text-muted); }


/* ═══════════════════════════════════════════════════════
   SUBSCRIBE — Glass
   ═══════════════════════════════════════════════════════ */
.hb-subscribe {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 60px 24px;
  text-align: center;
}

.hb-subscribe-box {
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 56px 48px;
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

.hb-subscribe-box::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--top-highlight-strong), transparent);
}

.hb-subscribe-title {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hb-subscribe-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

.hb-subscribe-form {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

.hb-subscribe-form input[type="email"] {
  flex: 1;
  padding: 12px 16px;
  background: var(--glass) !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary) !important;
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hb-subscribe-form input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.hb-subscribe-form input[type="email"]::placeholder { color: var(--text-muted); }

.hb-subscribe-form button {
  padding: 12px 24px;
  background: var(--accent);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.hb-subscribe-form button:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 24px var(--accent-glow);
}


/* ═══════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════ */
.hb-footer {
  border-top: 1px solid var(--divider);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.hb-footer-left {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

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

.hb-footer-links { display: flex; gap: 20px; }

.hb-footer-links a {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.hb-footer-links a:hover { color: var(--text-primary); }


/* ═══════════════════════════════════════════════════════
   ERROR
   ═══════════════════════════════════════════════════════ */
.hb-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 48px;
}

.hb-error-code {
  font-family: var(--mono);
  font-size: 120px;
  font-weight: 700;
  color: var(--error-code-color);
  line-height: 1;
  margin-bottom: 16px;
}

.hb-error-msg {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hb-error-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.hb-error-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  padding: 12px 28px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  transition: all 0.25s;
}

.hb-error-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}


/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */
@keyframes hbFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hbBlink { 50% { opacity: 0; } }

.hb-fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--transition), transform 0.6s var(--transition);
}

.hb-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .hb-grid { grid-template-columns: repeat(2, 1fr); }
  .hb-featured { grid-template-columns: 1fr; }
  .hb-featured-body { padding: 32px 28px; }
}

@media (max-width: 768px) {
  .hb-nav { top: 8px; left: 8px; right: 8px; padding: 0 16px; border-radius: var(--radius-md); }
  .hb-nav-right { display: none; }
  .hb-nav-right.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--nav-mobile-bg) !important;
    backdrop-filter: blur(50px) saturate(1.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    gap: 8px;
    box-shadow: var(--glass-shadow);
  }
  .hb-nav-right.open ul.nav { flex-direction: column; width: 100%; gap: 2px; }
  .hb-nav-right.open ul.nav li a { padding: 10px 14px; }
  .hb-nav-right.open .hb-nav-subscribe { margin-top: 8px; text-align: center; }
  .hb-nav-toggle { display: block; }
  .hb-hero { padding: 120px 20px 60px; }
  .hb-section { padding: 40px 20px; }
  .hb-divider { padding: 0 20px; }
  .hb-grid { grid-template-columns: 1fr; }
  .hb-archive-header { padding: 120px 20px 40px; }
  .hb-footer { padding: 32px 20px; flex-direction: column; gap: 16px; text-align: center; }
  .hb-subscribe-form { flex-direction: column; }
  .hb-article-header { padding: 0 16px; }
  .hb-article-content { padding: 0 16px 60px; }
  .hb-article-feature-image { padding: 0 16px; }
  .hb-page-content ul { grid-template-columns: 1fr !important; }
  .hb-hero-meta { gap: 8px; }
  .hb-hero-stat { padding: 12px 16px; }
}


/* ═══════════════════════════════════════════════════════
   GHOST NUCLEAR OVERRIDES (last)
   ═══════════════════════════════════════════════════════ */
html, body,
body.home-template, body.post-template,
body.page-template, body.tag-template,
body.author-template, body.paged,
.gh-viewport, .gh-main, .site-content {
  background-color: var(--bg-primary) !important;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  transition: background 0.5s, color 0.5s;
}

.gh-head, .gh-foot, .gh-outer, .gh-inner,
.gh-head-inner, .gh-head-brand,
.gh-card, .gh-card-link {
  background: transparent !important;
  color: inherit !important;
}

.hb-content { color-scheme: dark; }
[data-theme="light"] .hb-content { color-scheme: light; }
