/* ============================================================
   FOSS Engineer — Custom Dark Theme
   ============================================================ */

/* --- Design tokens --- */
:root {
  --bg:           #0a0b0f;
  --surface:      #111218;
  --surface-2:    #191a24;
  --surface-3:    #21222e;
  --border:       rgba(255,255,255,0.07);
  --border-2:     rgba(255,255,255,0.12);
  --border-active:rgba(99,102,241,0.5);
  --accent:       #6366f1;
  --accent-2:     #a855f7;
  --gradient:     linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --text:         #dde0f2;
  --text-muted:   #7b7e9e;
  --text-faint:   #3f4260;
  --green:        #22c55e;
  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    4px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 10px 40px rgba(0,0,0,0.5);
  --header-h:     64px;
  --content-w:    1100px;
  --prose-w:      740px;

  /* compat aliases used by existing project layouts */
  --glass-bg:         rgba(255,255,255,0.04);
  --glass-border:     rgba(255,255,255,0.08);
  --accent-gradient:  var(--gradient);
  --modern-radius:    var(--radius);
  --modern-shadow:    var(--shadow);
  --modern-shadow-hover: var(--shadow-lg);
}

/* --- Light mode (system pref, when not forced dark) --- */
@media (prefers-color-scheme: light) {
  :root:not(.dark) {
    --bg:        #f6f7ff;
    --surface:   #ffffff;
    --surface-2: #eef0fa;
    --surface-3: #e4e7f5;
    --border:    rgba(0,0,0,0.08);
    --border-2:  rgba(0,0,0,0.14);
    --text:      #1a1c2e;
    --text-muted:#5a5e7e;
    --text-faint:#9ca0c0;
    --glass-bg:  rgba(0,0,0,0.03);
    --glass-border: rgba(0,0,0,0.09);
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-2); }

/* --- Layout --- */
.container {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.main {
  flex: 1;
  padding-top: var(--header-h);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10,11,15,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
@media (prefers-color-scheme: light) {
  :root:not(.dark) .site-header { background: rgba(246,247,255,0.88); }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 2rem;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text) !important;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none !important;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.3rem; }
.logo-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: nowrap;
}
.nav-link {
  color: var(--text-muted) !important;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none !important;
}
.nav-link:hover {
  color: var(--text) !important;
  background: var(--surface-2);
}
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
  margin-top: auto;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
  margin-bottom: 3rem;
}
.footer-brand p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  max-width: 400px;
  line-height: 1.6;
}
.footer-links { display: flex; gap: 4rem; }
.footer-col h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.footer-col a {
  display: block;
  color: var(--text-muted) !important;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  text-decoration: none !important;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--text) !important; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-faint);
}
.footer-bottom a { color: var(--text-faint) !important; text-decoration: none !important; }
.footer-bottom a:hover { color: var(--accent) !important; }

/* ============================================================
   TAGS / BADGES
   ============================================================ */
.tag {
  display: inline-block;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.2);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none !important;
}
.tag:hover { background: var(--accent); color: white !important; border-color: var(--accent); }
.tag-sm { font-size: 0.72rem; padding: 1px 8px; }
.tag-xs { font-size: 0.68rem; padding: 1px 6px; }

/* ============================================================
   SITE HERO (new full-page hero)
   ============================================================ */
.site-hero {
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.site-hero::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 600px;
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner { max-width: 780px; }
.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.hero-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 600px;
  margin-bottom: 2.5rem;
}
.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.hero-stat { display: flex; align-items: baseline; gap: 0.4rem; }
.stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.hero-stat-sep {
  width: 1px; height: 30px;
  background: var(--border-2);
}
.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-cta-primary {
  display: inline-flex;
  align-items: center;
  background: var(--gradient);
  color: white !important;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: opacity 0.2s, transform 0.2s;
}
.hero-cta-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.hero-cta-secondary {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text) !important;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: border-color 0.2s, background 0.2s;
}
.hero-cta-secondary:hover { border-color: var(--accent); background: var(--surface-3); }

/* ============================================================
   CATEGORY STRIP
   ============================================================ */
.category-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.5rem 0 1.5rem;
  scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted) !important;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.2s;
  text-decoration: none !important;
}
.cat-chip:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text) !important;
}
.cat-chip-accent {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.3);
  color: var(--accent) !important;
}
.cat-chip-accent:hover {
  background: var(--accent);
  color: white !important;
  border-color: var(--accent);
}

/* ============================================================
   HOME SECTIONS
   ============================================================ */
.home-section { padding: 3rem 0; }
.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
}
.section-header h2 { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.view-all {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent) !important;
  text-decoration: none !important;
  white-space: nowrap;
  padding-bottom: 0.25rem;
}
.view-all:hover { text-decoration: underline !important; }

/* App card footer row */
.app-card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.app-meta-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  background: var(--surface-3);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

/* Split grid (news + AI) */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
}
.split-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}
.split-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}
.news-item {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
  transition: padding-left 0.15s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { padding-left: 0.4rem; }
.news-item a { color: inherit !important; text-decoration: none !important; display: block; }
.news-item h3 {
  font-size: 0.93rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 0.2rem;
  transition: color 0.15s;
  font-weight: 500;
}
.news-item:hover h3 { color: var(--accent); }
.item-date { font-size: 0.75rem; color: var(--text-faint); }

/* Legacy compat — kept for any remaining refs */
.hero-section { margin-bottom: 3rem; }
.quick-nav {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0 0.75rem;
  margin: 2rem 0;
  scrollbar-width: none;
}
.quick-nav::-webkit-scrollbar { display: none; }
.nav-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text) !important;
  padding: 0.45rem 1.2rem;
  border-radius: 50px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s;
  text-decoration: none !important;
}
.nav-item:hover { background: var(--surface-2); border-color: var(--accent); }
.featured-apps { margin-bottom: 4rem; }
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 2rem;
  margin-bottom: 3rem;
}
.grid-column h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}
.app-tag {
  display: inline-block;
  background: var(--gradient);
  color: white;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   APP DIRECTORY CARDS
   (used by existing layouts/apps/list.html)
   ============================================================ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.app-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(99,102,241,0.4);
}
.app-card h3 { font-size: 1.15rem; margin: 0.5rem 0 0.25rem; color: var(--text); }
.app-card p  { font-size: 0.875rem; color: var(--text-muted); flex-grow: 1; margin-bottom: 0.75rem; }
.app-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.25rem;
}
.app-links {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.app-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.2s;
  text-decoration: none !important;
}
.app-btn-primary { background: var(--gradient); color: white !important; }
.app-btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-muted) !important;
}
.app-btn:hover { opacity: 0.85; }

/* ============================================================
   POST CARDS (list pages)
   ============================================================ */
.list-page { padding: 3rem 0; }
.list-header { margin-bottom: 3rem; }
.list-header h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.02em; }
.list-header p { color: var(--text-muted); font-size: 1.05rem; margin-top: 0.5rem; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
  box-shadow: var(--shadow);
}
.post-card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface-2);
}
.post-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.post-card:hover .post-card-img img { transform: scale(1.04); }
.post-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.post-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}
.post-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
}
.post-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  flex-grow: 1;
  margin: 0;
  line-height: 1.5;
}
.post-card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }

/* ============================================================
   SINGLE POST
   ============================================================ */
.post-article { padding: 3rem 0 5rem; }
.post-cover {
  width: 100%;
  max-height: 480px;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 2.5rem;
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-header { margin-bottom: 2.5rem; }
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.meta-sep { opacity: 0.35; }
.post-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.post-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.55;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Post layout — content + sticky TOC */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 4rem;
  align-items: start;
}
.toc-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  max-height: calc(100vh - var(--header-h) - 4rem);
  overflow-y: auto;
  order: 2;
}
.toc-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}
.toc-inner h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}
.toc-inner nav ul { list-style: none; }
.toc-inner nav li { margin: 0.3rem 0; }
.toc-inner nav a {
  color: var(--text-muted) !important;
  font-size: 0.82rem;
  text-decoration: none !important;
  transition: color 0.15s;
  display: block;
  padding: 1px 0;
}
.toc-inner nav a:hover { color: var(--accent) !important; }
.toc-inner nav ul ul { padding-left: 0.9rem; }

/* Prose */
.post-content { max-width: var(--prose-w); min-width: 0; }
.post-content-full { max-width: var(--prose-w); }

.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.post-content h2 {
  font-size: 1.55rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1rem; }
.post-content p { margin: 0.9rem 0; }
.post-content ul, .post-content ol { margin: 0.9rem 0; padding-left: 1.75rem; }
.post-content li { margin: 0.35rem 0; }
.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(99,102,241,0.35);
}
.post-content a:hover { text-decoration-color: var(--accent); }
.post-content strong { font-weight: 700; color: var(--text); }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}
.post-content blockquote p { margin: 0; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.post-content th, .post-content td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}
.post-content th { background: var(--surface-2); font-weight: 600; }
.post-content tr:hover td { background: var(--surface); }
.post-content img { border-radius: var(--radius-sm); margin: 1.5rem 0; }

/* Inline code */
.post-content :not(pre) > code {
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-xs);
  color: #e879f9;
}
/* Code blocks */
.post-content pre {
  background: var(--surface-2) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.post-content pre code {
  background: none !important;
  padding: 0;
  color: var(--text);
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.875rem;
  line-height: 1.65;
}
/* Chroma — Dracula palette */
.post-content .highlight { position: relative; }
.post-content .chroma .k,
.post-content .chroma .kd,
.post-content .chroma .kn,
.post-content .chroma .kp,
.post-content .chroma .kr,
.post-content .chroma .kt  { color: #ff79c6; }
.post-content .chroma .s,
.post-content .chroma .s1,
.post-content .chroma .s2,
.post-content .chroma .sb,
.post-content .chroma .sc,
.post-content .chroma .sd,
.post-content .chroma .se,
.post-content .chroma .sh,
.post-content .chroma .si,
.post-content .chroma .sx   { color: #f1fa8c; }
.post-content .chroma .c,
.post-content .chroma .c1,
.post-content .chroma .cm,
.post-content .chroma .cs   { color: #6272a4; font-style: italic; }
.post-content .chroma .nf,
.post-content .chroma .fm   { color: #50fa7b; }
.post-content .chroma .nb,
.post-content .chroma .bp   { color: #8be9fd; }
.post-content .chroma .nc   { color: #50fa7b; }
.post-content .chroma .o,
.post-content .chroma .ow   { color: #ff79c6; }
.post-content .chroma .m,
.post-content .chroma .mb,
.post-content .chroma .mf,
.post-content .chroma .mh,
.post-content .chroma .mi,
.post-content .chroma .mo   { color: #bd93f9; }
.post-content .chroma .nt   { color: #ff79c6; }
.post-content .chroma .na   { color: #50fa7b; }
.post-content .chroma .err  { color: #ff5555; }

/* Post nav */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  color: inherit !important;
  transition: border-color 0.2s, background 0.2s;
}
.post-nav-link:hover { border-color: var(--border-active); background: var(--surface-2); }
.post-nav-link.next { text-align: right; }
.nav-label { font-size: 0.75rem; color: var(--text-faint); }
.nav-title  { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* ============================================================
   ARCHIVES
   ============================================================ */
.archives-page { padding: 3rem 0; }
.archive-year  { margin-bottom: 3rem; }
.year-label    { font-size: 1.8rem; font-weight: 800; color: var(--text-faint); margin-bottom: 0.75rem; }
.archive-list  { display: flex; flex-direction: column; }
.archive-item {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none !important;
  color: inherit !important;
  transition: padding-left 0.15s;
}
.archive-item:hover { padding-left: 0.5rem; }
.archive-date  { font-size: 0.78rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.archive-title { font-size: 0.95rem; color: var(--text); transition: color 0.15s; }
.archive-item:hover .archive-title { color: var(--accent); }
.archive-tags  { display: flex; gap: 0.3rem; }

/* ============================================================
   SEARCH
   ============================================================ */
.search-page { padding: 3rem 0; }
.search-box { margin: 2rem 0 3rem; }
.search-box input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 0.875rem 1.25rem;
  font-size: 1.05rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus { border-color: var(--accent); }
.no-results { color: var(--text-muted); text-align: center; padding: 3rem 0; grid-column: 1/-1; }

/* ============================================================
   DOC CARDS
   (used by layouts/partials/doc_card.html)
   ============================================================ */
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none !important;
  color: inherit !important;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.doc-card:hover {
  border-color: var(--border-active);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.doc-card-header { display: flex; align-items: flex-start; gap: 0.75rem; }
.doc-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.doc-title-group { display: flex; flex-direction: column; }
.doc-title-group h3 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.doc-meta-top { font-size: 0.7rem; opacity: 0.4; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.doc-card p { font-size: 0.86rem; color: var(--text-muted); flex: 1; margin: 0; }
.doc-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; }
.doc-read-time { color: var(--text-faint); }
.doc-action { color: var(--accent); font-weight: 600; }

/* ============================================================
   DROPDOWN SHORTCODE
   ============================================================ */
.dropdown {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 1.25rem 0;
  overflow: hidden;
}
.dropdown-title {
  padding: 0.75rem 1.25rem;
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}
.dropdown-title:hover { background: var(--surface-3); }
.dropdown-title::marker, .dropdown-title::-webkit-details-marker { display: none; }
.dropdown-title::before { content: '▶ '; font-size: 0.7em; margin-right: 0.5rem; }
details[open] .dropdown-title::before { content: '▼ '; }
.dropdown-body { padding: 1rem 1.25rem; }

/* ============================================================
   404
   ============================================================ */
.error-page { padding: 6rem 0; text-align: center; }
.error-code {
  font-size: 8rem;
  font-weight: 900;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 1rem;
}
.error-page h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.error-page p  { color: var(--text-muted); margin-bottom: 2rem; }
.btn-primary {
  display: inline-block;
  background: var(--gradient);
  color: white !important;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none !important;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }

/* ============================================================
   SHARE BUTTONS
   ============================================================ */
.share-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.share-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  white-space: nowrap;
}
.share-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted) !important;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s;
  white-space: nowrap;
}
.share-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  color: var(--text) !important;
}

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.comments-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* ============================================================
   COPY CODE BUTTON
   ============================================================ */
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text-faint);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.copy-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.copy-btn.copied { background: rgba(34,197,94,0.15); color: var(--green); border-color: rgba(34,197,94,0.4); }

/* ============================================================
   SCROLL TO TOP
   ============================================================ */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, background 0.15s, color 0.15s;
  z-index: 50;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; }
.scroll-top:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted) !important;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.15s;
}
.page-link:hover, .page-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white !important;
}
.page-item.disabled .page-link {
  opacity: 0.35;
  pointer-events: none;
}

/* ============================================================
   APP SINGLE PAGE
   ============================================================ */
.app-single { padding: 2rem 0 5rem; }

.app-single-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  text-decoration: none !important;
  margin-bottom: 2rem;
  transition: color 0.15s;
}
.app-single-back:hover { color: var(--accent); }

.app-single-header {
  max-width: 720px;
  margin-bottom: 3rem;
}
.app-single-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.app-single-title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}
.app-single-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 1.5rem;
}
.app-single-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.app-single-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Docker compose block */
.app-compose-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2.5rem;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.06), var(--shadow);
}
.app-compose-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.app-compose-header h2 {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.app-compose-path {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-left: auto;
  font-family: 'Cascadia Code', 'Fira Code', ui-monospace, monospace;
}
.app-compose-body { padding: 0; }
.app-compose-body .highlight { margin: 0; border-radius: 0; }
.app-compose-body pre {
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 1.25rem !important;
  max-height: 480px;
  overflow-y: auto;
}

.app-single-content { max-width: 720px; }

/* ============================================================
   APPS GALLERY
   ============================================================ */

/* Hero */
.apps-hero {
  padding: 4rem 0 2.5rem;
  text-align: center;
}
.apps-hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0.4rem 0 0.75rem;
}
.apps-hero-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Controls bar */
.apps-controls-wrap {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.apps-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.apps-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 1;
}
.filter-chip {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Search */
.apps-search-wrap {
  position: relative;
  flex-shrink: 0;
}
.apps-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
#apps-search {
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem 0.45rem 2.25rem;
  font-size: 0.875rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  width: 220px;
  transition: border-color 0.2s, width 0.2s;
}
#apps-search::placeholder { color: var(--text-faint); }
#apps-search:focus {
  border-color: var(--accent);
  width: 260px;
}

/* Gallery grid */
.apps-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 2rem 0 4rem;
}

/* Card */
.gal-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.06), var(--shadow);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.gal-card:hover {
  border-color: rgba(99,102,241,0.4);
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.2), var(--shadow-lg);
}

/* Card top row */
.gal-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.gal-card-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Category badges */
.gal-cat-badge {
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.gal-cat-ai          { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.3); }
.gal-cat-security    { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.gal-cat-media       { background: rgba(251,146,60,0.12); color: #fb923c; border: 1px solid rgba(251,146,60,0.25); }
.gal-cat-productivity{ background: rgba(34,197,94,0.12);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.gal-cat-notes       { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.gal-cat-self-hosting{ background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); }
.gal-cat-config      { background: rgba(148,163,184,0.08); color: var(--text-faint); border: 1px solid var(--border); }
.gal-desc-faint      { opacity: 0.5; font-style: italic; }
/* fallback for unknown categories */
.gal-cat-badge:not([class*="gal-cat-"]) {
  background: rgba(148,163,184,0.1);
  color: var(--text-faint);
  border: 1px solid var(--border);
}

/* Difficulty badge */
.gal-diff {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.diff-beginner     { background: rgba(34,197,94,0.1);  color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.diff-intermediate { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.2); }
.diff-advanced     { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* Type label */
.gal-type {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Card body */
.gal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  line-height: 1.3;
}
.gal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.gal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Action buttons */
.gal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.5rem;
}
.gal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
}
.gal-btn-primary {
  background: var(--accent);
  color: white !important;
}
.gal-btn-primary:hover {
  opacity: 0.88;
}
.gal-btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted) !important;
}
.gal-btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text) !important;
  background: var(--surface-3);
}

/* Empty state */
.apps-empty {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-faint);
  font-size: 0.95rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .post-layout { grid-template-columns: 1fr; }
  .toc-sidebar { display: none; }
  .home-grid { grid-template-columns: 1fr; gap: 2rem; }
  .split-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
  .footer-links { flex-wrap: wrap; gap: 2rem; }
}
@media (max-width: 768px) {
  .apps-controls { flex-direction: column; align-items: stretch; }
  .apps-filters  { order: 2; }
  .apps-search-wrap { order: 1; }
  #apps-search   { width: 100%; }
  #apps-search:focus { width: 100%; }
  .apps-gallery  { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
  .menu-toggle { display: flex; }
  .site-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    z-index: 99;
  }
  .site-nav.open { display: flex; }
  .site-hero { padding: 3.5rem 0 3rem; }
  .hero-title { font-size: 2.5rem; }
  .hero-stats { gap: 1rem; }
  .stat-num { font-size: 1.3rem; }
  .post-nav { grid-template-columns: 1fr; }
  .archive-item { grid-template-columns: 54px 1fr; }
  .archive-tags { display: none; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .post-grid { grid-template-columns: 1fr; }
  .app-grid  { grid-template-columns: 1fr; }
  .apps-gallery { grid-template-columns: 1fr; }
  .post-article { padding: 2rem 0 3rem; }
  .hero-ctas { flex-direction: column; }
  .hero-cta-primary, .hero-cta-secondary { text-align: center; justify-content: center; }
  .gal-actions { gap: 0.4rem; }
}
