:root {
  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #243047;
  --accent: #60a5fa;
  --accent-2: #34d399;
  --max: 1120px;
  --shadow: 0 20px 40px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #08101f 0%, #0b1120 100%);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: min(calc(100% - 2rem), var(--max)); margin: 0 auto; }
.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(11,17,32,.84);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.nav-shell { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { font-size: 1.15rem; font-weight: 700; letter-spacing: .02em; }
.brand span { color: var(--accent); }
.nav-tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-links { display: flex; gap: .4rem; flex-wrap: wrap; }
.nav-links a {
  padding: .6rem .85rem;
  border-radius: 999px;
  color: var(--muted);
  transition: .2s ease;
}
.nav-links a:hover, .nav-links a.active {
  color: white;
  background: rgba(96,165,250,.12);
}
.nav-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: nowrap;
}
.nav-search input {
  min-width: min(320px, 60vw);
  min-height: 42px;
  padding: .72rem .9rem;
  border-radius: .9rem;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color: var(--text);
}
.nav-search input::placeholder { color: var(--muted); }
.nav-search button {
  min-height: 42px;
  padding: .72rem 1rem;
  border-radius: .9rem;
  border: 0;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.hero { padding: 4.5rem 0 2.75rem; }
.eyebrow {
  display: inline-flex; gap: .5rem; align-items: center;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent-2); border: 1px solid rgba(52,211,153,.24);
  border-radius: 999px; padding: .35rem .7rem; background: rgba(52,211,153,.07);
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: 1.05; margin: 1rem 0 .8rem; }
.hero p { font-size: 1.05rem; color: var(--muted); max-width: 760px; margin: 0; }
.hero-actions { display: flex; gap: .9rem; flex-wrap: wrap; margin-top: 1.5rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .8rem 1rem; border-radius: .9rem;
  border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03);
  color: white; font-weight: 600;
}
.button.primary { background: linear-gradient(135deg, #2563eb, #38bdf8); border: 0; }
.section { padding: 1.2rem 0 3rem; }
.section-header { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.section-header h2 { margin: 0; font-size: 1.65rem; }
.section-header p { margin: .3rem 0 0; color: var(--muted); }
.featured-grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 1.2rem; overflow: hidden; box-shadow: var(--shadow);
}
.featured-card { grid-column: span 6; position: relative; min-height: 360px; }
.featured-card img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.featured-card .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.78));
}
.featured-card .content { position: absolute; inset: auto 1.2rem 1.2rem 1.2rem; }
.badges, .meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; padding: .22rem .55rem; border-radius: 999px;
  background: rgba(255,255,255,.08); color: #f3f4f6; border: 1px solid rgba(255,255,255,.08);
}
.badge[href] { transition: .18s ease; }
.badge[href]:hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.badge.type-blog { background: rgba(59,130,246,.16); }
.badge.type-engineering { background: rgba(16,185,129,.16); }
.meta { color: #d1d5db; font-size: .88rem; margin: .7rem 0; }
.featured-card h3 { margin: .75rem 0 .2rem; font-size: 1.7rem; line-height: 1.1; }
.featured-card p { margin: .4rem 0 0; color: #e5e7eb; }
.post-grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem;
}
.post-card { grid-column: span 4; display: flex; flex-direction: column; }
.post-card .thumb { aspect-ratio: 16/10; background: #0f172a; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .body, .search-result-card .body { padding: 1rem 1rem 1.1rem; }
.post-card h3, .search-result-card h3 { margin: .6rem 0 .35rem; font-size: 1.2rem; line-height: 1.2; }
.post-card p, .search-result-card p { margin: .45rem 0 0; color: var(--muted); }
.project-tag { color: #a7f3d0; border-color: rgba(167,243,208,.28); }
.inline-link { color: var(--accent); }
.page-intro { padding: 2.6rem 0 1rem; }
.page-intro h1 { margin: 0 0 .5rem; font-size: clamp(2rem, 4vw, 3rem); }
.page-intro p { color: var(--muted); margin: 0; max-width: 760px; }
.article-wrap { padding: 2.3rem 0 4rem; }
.article {
  background: rgba(17,24,39,.9);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 1.2rem; overflow: hidden; box-shadow: var(--shadow);
}
.article-cover { aspect-ratio: 16/7; background: #0f172a; }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-inner { padding: clamp(1.2rem, 3vw, 2.3rem); }
.article h1 { margin: 0 0 .5rem; font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.08; }
.article p, .article li { color: #d1d5db; }
.article h2, .article h3 { margin-top: 1.8rem; }
.article pre {
  padding: 1rem; overflow: auto; border-radius: .9rem; background: #0b1220;
  border: 1px solid rgba(255,255,255,.08);
}
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 2rem;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .footer-grid {
    flex-direction: column;
    align-items: flex-start;
  }
}

.footer-copy {
  color: var(--muted);
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

.note {
  padding: .95rem 1rem;
  border-left: 4px solid var(--accent);
  background: rgba(96, 165, 250, 0.12);
  border-radius: 0.5rem;
}

.template-box {
  background: rgba(17,24,39,.9); border: 1px solid rgba(255,255,255,.07);
  border-radius: 1rem; padding: 1rem 1.1rem; margin: 1rem 0;
}
.template-box h2 { margin-top: .2rem; }
.template-box pre { white-space: pre-wrap; }
.search-layout { display: grid; gap: 1rem; }
.search-summary { color: var(--muted); margin: 0 0 .3rem; }
.search-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.search-result-list { display: grid; gap: 1rem; }
.search-result-card { overflow: visible; }
@media (max-width: 980px) {
  .featured-card, .post-card { grid-column: span 12; }
  .nav-shell { align-items: flex-start; }
  .nav-tools { width: 100%; justify-content: space-between; }
}
@media (max-width: 720px) {
  .nav-shell { padding: .7rem 0; flex-direction: column; }
  .nav-tools { width: 100%; flex-direction: column; align-items: stretch; }
  .nav-search input { min-width: 0; width: 100%; }
  .hero { padding-top: 3rem; }
}


.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state h2 {
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Enhanced post content blocks */
.article figure { margin: 1.4rem 0; }
.article figcaption { margin-top: .6rem; margin-left: 0.8rem; margin-bottom: .6rem; color: var(--muted); font-size: .95rem; }
.article .content-image { border-radius: 1rem; overflow: hidden; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); }
.article .content-image img { width: 100%; height: auto; }
.article .image-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.article .image-grid.single { grid-template-columns: 1fr; }
.article .video-block, .article .download-card, .article .code-block { margin: 1.4rem 0; }
.article .video-embed { position: relative; width: 100%; padding-top: 56.25%; border-radius: 1rem; overflow: hidden; border: 1px solid rgba(255,255,255,.08); background: #000; }
.article .video-embed iframe, .article .video-embed video { position: absolute; inset: 0; width: 100%; height: 100%; }
.article .video-embed video { object-fit: cover; background: #000; }
.article .code-block { border: 1px solid rgba(255,255,255,.08); border-radius: 1rem; overflow: hidden; background: #0a1020; }
.article .code-block-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .72rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.03); color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.article .code-block pre { margin: 0; border: 0; border-radius: 0; background: transparent; }
.article :not(pre) > code { padding: .15rem .4rem; border-radius: .4rem; background: rgba(255,255,255,.08); font-size: .95em; }
.article .download-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; border-radius: 1rem; border: 1px solid rgba(255,255,255,.08); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); }
.article .download-meta { display: grid; gap: .15rem; }
.article .download-title { font-weight: 700; color: #fff; }
.article .download-note { color: var(--muted); font-size: .95rem; }
.article .download-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .75rem 1rem; border-radius: .85rem; background: linear-gradient(135deg, #2563eb, #38bdf8); color: white; font-weight: 700; white-space: nowrap; }
.article .content-callout { padding: 1rem 1.1rem; border-radius: 1rem; border: 1px solid rgba(52,211,153,.18); background: rgba(52,211,153,.08); color: #d1fae5; margin: 1.4rem 0; }
.template-box .insert-snippet { color: var(--muted); }
@media (max-width: 720px) { .article .image-grid { grid-template-columns: 1fr; } .article .download-card { flex-direction: column; align-items: flex-start; } }


/* Engineering project filters */
.section-tight { padding-top: .6rem; padding-bottom: 1.25rem; }
.section-header.compact { margin-bottom: .8rem; }
.section-title-inline { margin: 0; font-size: 1.05rem; }
.engineering-filter-shell { display: grid; gap: 1rem; }
.engineering-filter-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.filter-chip-row { display: flex; flex-wrap: wrap; gap: .65rem; }
.filter-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .72rem 1rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); color: var(--text); font-weight: 600; cursor: pointer; }
.filter-chip:hover { background: rgba(255,255,255,.08); }
.filter-chip.active { background: rgba(96,165,250,.18); border-color: rgba(96,165,250,.35); color: white; }
.filter-reset { min-width: 140px; }
.is-hidden { display: none !important; }
.single-featured { grid-template-columns: repeat(12, 1fr); }
.single-featured .featured-card { grid-column: span 12; min-height: 320px; }
.badge.tag-overview, .badge.overview-badge { background: rgba(250,204,21,.16); border-color: rgba(250,204,21,.24); color: #fef3c7; }
@media (max-width: 720px) { .engineering-filter-header { align-items: stretch; } .filter-reset { width: 100%; } }

.MathJax {
  overflow-x: auto;
  overflow-y: hidden;
}

mjx-container {
  margin: 1rem 0;
}

.equation-card {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.02);
  margin: 1.5rem 0;
  overflow: hidden;
}

.equation-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.03);
}

.equation-body {
  padding: 1rem;
  overflow-x: auto;
  text-align: center;
}

/* ensure MathJax behaves nicely inside */
.equation-body mjx-container {
  margin: 0 auto;
}

.equation-card.no-header .equation-header {
  display: none;
}

.article-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.action-button {
  display: inline-block;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.08);
}

.action-button.primary {
  background: var(--accent);
  color: #06121f;
}

.action-button.secondary {
  background: rgba(255,255,255,.03);
  color: var(--text);
}

.action-button.project {
  background: linear-gradient(135deg, #059669, #34d399);
  color: #03140f;
  border: 0;
}

.overview-tag {
  background: rgba(250,204,21,.16);
  color: #fef3c7; 

  border: 1px solid rgba(250,204,21,.24);
}