/* ==========================================================================
   StartKK Lab — Dual-Mode Cyber Glacier HUD Theme (2026-10-23 v40)
   - Light Mode (html:not(.dark)): Glacier Daylight Tech (#EEF4FB + Electric Blue #2563EB)
   - Dark Mode (html.dark): Deep Cyber Space (#060B16 + Electric Cyan #00F2FE)
   ========================================================================== */

/* 1. Light Mode Tokens (html:not(.dark)) */
html:root {
  --bg-canvas: #eef4fb;
  --bg-surface: rgba(255, 255, 255, 0.86);
  --bg-surface-solid: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.90);
  --bg-subtle: rgba(14, 165, 233, 0.08);
  --bg-pill: rgba(15, 23, 42, 0.04);
  --bg-muted: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-on-accent: #ffffff;

  --tech-cyan: #0284c7;
  --tech-blue: #2563eb;
  --tech-royal: #1d4ed8;
  --tech-indigo: #4f46e5;
  --tech-emerald: #059669;
  --tech-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 55%, #06b6d4 100%);
  --tech-glow: rgba(14, 165, 233, 0.18);
  --tech-glow-strong: rgba(37, 99, 235, 0.28);

  --border-line: rgba(14, 165, 233, 0.20);
  --border-line-hover: rgba(37, 99, 235, 0.55);
  --card-shadow: 0 8px 24px -6px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03), inset 0 1px 0 #ffffff;
  --card-shadow-hover: 0 14px 32px -6px rgba(14, 165, 233, 0.16), 0 4px 12px -2px rgba(37, 99, 235, 0.08), inset 0 1px 0 #ffffff;

  /* Map to Kaze Native Variables */
  --bg: var(--bg-canvas) !important;
  --bg-card: var(--bg-surface) !important;
  --bg-hover: var(--bg-subtle) !important;
  --text: var(--text-primary) !important;
  --text-sub: var(--text-secondary) !important;
  --border: var(--border-line) !important;
  --primary: var(--tech-cyan) !important;
  --primary-hover: var(--tech-blue) !important;
  --accent: var(--tech-cyan) !important;
  --color-primary: var(--tech-cyan) !important;
  --color-primary-light: var(--tech-blue) !important;
  --color-primary-soft: var(--bg-subtle) !important;
  --startkk-accent: var(--tech-cyan) !important;
  --startkk-status: var(--tech-cyan) !important;

  --font-sans: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --header-height: 62px;
}

/* 2. Dark Mode Tokens (html.dark) */
html.dark {
  --bg-canvas: #060b16;
  --bg-surface: rgba(11, 19, 35, 0.78);
  --bg-surface-solid: #0d1629;
  --bg-elevated: rgba(8, 14, 28, 0.86);
  --bg-subtle: rgba(14, 165, 233, 0.10);
  --bg-pill: rgba(15, 23, 42, 0.55);
  --bg-muted: rgba(30, 41, 59, 0.65);

  --text-primary: #f0f6fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #475569;
  --text-on-accent: #040914;

  --tech-cyan: #00f2fe;
  --tech-blue: #38bdf8;
  --tech-royal: #3b82f6;
  --tech-indigo: #6366f1;
  --tech-emerald: #10b981;
  --tech-gradient: linear-gradient(135deg, #00f2fe 0%, #0ea5e9 50%, #3b82f6 100%);
  --tech-glow: rgba(0, 242, 254, 0.22);
  --tech-glow-strong: rgba(14, 165, 233, 0.38);

  --border-line: rgba(56, 189, 248, 0.16);
  --border-line-hover: rgba(0, 242, 254, 0.55);
  --card-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --card-shadow-hover: 0 16px 38px -8px rgba(0, 242, 254, 0.18), 0 0 20px -4px rgba(14, 165, 233, 0.15), inset 0 1px 0 rgba(0, 242, 254, 0.25);
}

/* Explicit Sun/Moon Icon Visibility on #themeToggle */
html:not(.dark) #themeToggle .icon-sun {
  display: none !important;
}
html:not(.dark) #themeToggle .icon-moon {
  display: block !important;
}
html.dark #themeToggle .icon-sun {
  display: block !important;
}
html.dark #themeToggle .icon-moon {
  display: none !important;
}

/* ==========================================================================
   Global Reset & Interactive 3D/2D Cyber Canvas Backdrop
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-canvas) !important;
  color: var(--text-primary) !important;
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body {
  background-color: var(--bg-canvas) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans) !important;
  font-size: 15px;
  line-height: 1.72;
  margin: 0;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.25s ease, color 0.25s ease;
}

#lab-cyber-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Light Mode Grid & Aurora */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(14, 165, 233, 0.16), rgba(37, 99, 235, 0.06) 45%, transparent 75%),
    radial-gradient(circle 480px at 85% 20%, rgba(6, 182, 212, 0.09), transparent 70%),
    linear-gradient(to right, rgba(14, 165, 233, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(14, 165, 233, 0.055) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
}

/* Dark Mode Grid & Aurora */
html.dark body::before {
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(0, 242, 254, 0.14), rgba(59, 130, 246, 0.08) 45%, transparent 75%),
    radial-gradient(circle 500px at 85% 20%, rgba(14, 165, 233, 0.08), transparent 70%),
    radial-gradient(circle 450px at 15% 75%, rgba(99, 102, 241, 0.07), transparent 70%),
    linear-gradient(to right, rgba(56, 189, 248, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.045) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 44px 44px, 44px 44px;
}

.site-header,
.site-main,
.site-footer {
  position: relative;
  z-index: 1;
}

::selection {
  background: rgba(14, 165, 233, 0.25);
  color: var(--text-primary);
}

/* ==========================================================================
   Header & Cyber HUD Navigation
   ========================================================================== */
html body .site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-elevated) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-line) !important;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06) !important;
}

html.dark body .site-header {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28) !important;
}

html body .site-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tech-cyan), transparent);
  opacity: 0.55;
  pointer-events: none;
}

html body .site-header > .container,
html body .site-nav {
  max-width: 1220px;
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

html body .site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary) !important;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

html body .site-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--tech-gradient) !important;
  color: var(--text-on-accent) !important;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 16px var(--tech-glow-strong) !important;
}

html body .site-logo-icon svg {
  display: none !important;
}

html body .site-nav nav ul {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg-pill);
  border: 1px solid var(--border-line);
  border-radius: 999px;
}

html body .site-nav nav a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-secondary) !important;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

html body .site-nav nav a:hover,
html body .site-nav nav a.active {
  color: var(--tech-cyan) !important;
  font-weight: 600;
}

.lab-nav-indicator {
  position: absolute;
  left: 0;
  top: 4px;
  height: 30px;
  border-radius: 999px;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-line-hover);
  box-shadow: 0 0 12px var(--tech-glow);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), width 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
}

html body .header-actions,
html body .nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

html body .header-actions button,
html body .header-actions .header-auth-btn,
html body .nav-actions button,
html body .nav-actions .header-login-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-line) !important;
  background: var(--bg-surface) !important;
  color: var(--text-secondary) !important;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

html body .header-actions button:hover,
html body .header-actions .header-auth-btn:hover,
html body .nav-actions button:hover,
html body .nav-actions .header-login-btn:hover {
  color: var(--tech-cyan) !important;
  border-color: var(--border-line-hover) !important;
  box-shadow: 0 0 14px var(--tech-glow) !important;
}

/* ==========================================================================
   Main Container & Slim 48px Cyber HUD Status Ribbon (Articles First!)
   ========================================================================== */
html body .home-content {
  max-width: 1220px;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

.lab-hud-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 18px;
  margin-bottom: 20px;
  background: var(--bg-surface) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-line) !important;
  border-left: 3px solid var(--tech-cyan) !important;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.hud-ribbon-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hud-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line-hover);
  color: var(--tech-cyan);
  font: 700 10.5px/1.2 var(--font-mono);
  letter-spacing: 0.06em;
}

.lab-live-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tech-cyan) !important;
  box-shadow: 0 0 8px var(--tech-cyan);
  display: inline-block;
}

.lab-live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--tech-cyan);
  animation: lab-breathe 2.2s ease-out infinite;
}

html body .hud-inline-title {
  margin: 0 !important;
  font: 700 14px/1.3 var(--font-mono) !important;
  color: var(--text-primary) !important;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-sep {
  color: var(--tech-cyan);
  font-weight: 400;
}

.hud-motto {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hud-ribbon-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-pill);
  border: 1px solid var(--border-line);
  font: 600 11px/1.2 var(--font-mono);
  text-decoration: none;
  transition: all 0.18s ease;
}

a.hud-metric-pill:hover {
  border-color: var(--border-line-hover);
  box-shadow: 0 0 12px var(--tech-glow);
  transform: translateY(-1px);
}

.hud-m-key {
  color: var(--text-muted);
  font-size: 10px;
}

.hud-m-val {
  color: var(--tech-cyan);
  font-weight: 700;
}

/* ==========================================================================
   First-Screen Workspace: Left Articles Stream + Right Tech Console
   ========================================================================== */
html body .home-content .recent-posts {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

html body .home-content .home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
  align-items: start;
}

html body .lab-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-line);
}

.lab-head-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-bracket {
  font: 700 18px/1 var(--font-mono);
  color: var(--tech-cyan);
}

html body .lab-section-head h2 {
  color: var(--text-primary) !important;
  font-family: var(--font-display) !important;
  margin: 0;
  font-size: 18.5px;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lab-heading-dot {
  color: var(--tech-cyan) !important;
}

.hud-stream-tag {
  font: 700 10px/1 var(--font-mono);
  color: var(--tech-blue);
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
  padding: 3px 7px;
  border-radius: 4px;
  margin-left: 4px;
}

.lab-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.lab-track-filters {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-pill);
  border: 1px solid var(--border-line);
}

.lab-filter-pill {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: 600 11.5px/1.2 var(--font-mono);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.lab-filter-pill:hover {
  color: var(--tech-cyan);
  background: var(--bg-subtle);
}

.lab-filter-pill.is-active {
  color: var(--text-on-accent) !important;
  background: var(--tech-gradient) !important;
  border-color: transparent !important;
  box-shadow: 0 0 10px var(--tech-glow);
}

html body .lab-section-head > a,
html body .lab-section-head .lab-archive-more {
  color: var(--tech-cyan) !important;
  font: 600 11.5px/1 var(--font-mono) !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-line) !important;
  background: var(--bg-surface) !important;
  transition: all 0.18s ease;
}

html body .lab-section-head > a:hover,
html body .lab-section-head .lab-archive-more:hover {
  border-color: var(--border-line-hover) !important;
  box-shadow: 0 0 14px var(--tech-glow) !important;
}

.lab-filter-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-line-hover);
  color: var(--text-secondary);
  font-size: 13.5px;
}

.lab-filter-reset {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-line-hover);
  background: var(--bg-subtle);
  color: var(--tech-cyan);
  font: 700 11.5px/1.2 var(--font-mono);
  cursor: pointer;
}

/* ==========================================================================
   Cyber HUD Article Cards (Immediate Visual Focus + Domain Accent Hues)
   ========================================================================== */
html body .home-content .post-grid {
  display: grid;
  gap: 12px;
  border-top: 0 !important;
}

html body .site-main .post-card.lab-entry {
  --entry-accent: var(--tech-cyan);
  --entry-accent-soft: var(--bg-subtle);
  --entry-accent-border: var(--border-line);
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  gap: 16px;
  padding: 20px 22px;
  margin: 0;
  border: 1px solid var(--border-line) !important;
  border-radius: 12px;
  background:
    radial-gradient(420px circle at var(--mouse-x, -500px) var(--mouse-y, -500px), var(--tech-glow), transparent 40%),
    var(--bg-surface) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--card-shadow) !important;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease, box-shadow 0.22s ease;
  overflow: hidden;
  isolation: isolate;
}

/* Domain-Specific Accent Hues for 4 Lab Tracks */
html body .site-main .post-card.lab-entry[data-category="硬件实验"] {
  --entry-accent: var(--tech-emerald);
  --entry-accent-soft: rgba(16, 185, 129, 0.12);
  --entry-accent-border: rgba(16, 185, 129, 0.35);
}

html body .site-main .post-card.lab-entry[data-category="AI 实践"] {
  --entry-accent: var(--tech-cyan);
  --entry-accent-soft: var(--bg-subtle);
  --entry-accent-border: var(--border-line-hover);
}

html body .site-main .post-card.lab-entry[data-category="云端运维"] {
  --entry-accent: var(--tech-indigo);
  --entry-accent-soft: rgba(99, 102, 241, 0.12);
  --entry-accent-border: rgba(99, 102, 241, 0.35);
}

html body .site-main .post-card.lab-entry[data-category="开发手记"] {
  --entry-accent: var(--tech-blue);
  --entry-accent-soft: rgba(56, 189, 248, 0.12);
  --entry-accent-border: rgba(56, 189, 248, 0.35);
}

html body .site-main .post-card.lab-entry::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0;
  background: var(--entry-accent, var(--tech-cyan)) !important;
  box-shadow: 0 0 12px var(--entry-accent, var(--tech-cyan));
  transition: height 0.22s ease;
}

html body .site-main .post-card.lab-entry::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-top: 2px solid var(--entry-accent, var(--border-line-hover));
  border-right: 2px solid var(--entry-accent, var(--border-line-hover));
  border-top-right-radius: 12px;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

html body .site-main .post-card.lab-entry:hover {
  border-color: var(--entry-accent-border, var(--border-line-hover)) !important;
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover) !important;
}

html body .site-main .post-card.lab-entry:hover::after {
  height: 100%;
}

html body .site-main .post-card.lab-entry:hover::before {
  opacity: 1;
}

.lab-entry-number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--entry-accent-soft, var(--bg-subtle));
  border: 1px solid var(--entry-accent-border, var(--border-line));
  color: var(--entry-accent, var(--tech-cyan)) !important;
  font: 700 12px/1 var(--font-mono) !important;
  margin-top: 2px;
  transition: all 0.2s ease;
}

html body .site-main .post-card.lab-entry:hover .lab-entry-number {
  background: var(--entry-accent, var(--tech-cyan));
  color: var(--text-on-accent) !important;
  border-color: transparent;
  box-shadow: 0 0 14px var(--tech-glow-strong);
}

html body .site-main .lab-entry .post-card-body {
  display: block;
  min-height: 0;
  padding: 0;
  min-width: 0;
}

.lab-entry-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted) !important;
  font-size: 11px;
}

.lab-entry-top time {
  font: 500 11px/1.4 var(--font-mono) !important;
  color: var(--text-secondary);
}

.lab-entry-category,
.post-card-category {
  color: var(--entry-accent, var(--tech-cyan)) !important;
  background: var(--entry-accent-soft, var(--bg-subtle)) !important;
  border: 1px solid var(--entry-accent-border, var(--border-line)) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
}

.lab-pinned {
  color: var(--text-on-accent) !important;
  background: var(--tech-gradient) !important;
  font: 800 9.5px/1.4 var(--font-mono) !important;
  border-radius: 4px;
  padding: 2px 7px;
  box-shadow: 0 0 10px var(--tech-glow);
}

html body .site-main .lab-entry .post-card-title {
  display: block;
  margin: 7px 0 0;
  font-size: 18px;
  line-height: 1.44;
  letter-spacing: -0.015em;
  font-weight: 700;
}

html body .site-main .lab-entry .post-card-title a {
  color: var(--text-primary) !important;
  text-decoration: none;
  transition: color 0.15s ease;
}

html body .site-main .lab-entry:hover .post-card-title a {
  color: var(--entry-accent, var(--tech-cyan)) !important;
}

html body .site-main .lab-entry .post-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text-secondary) !important;
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.75;
  overflow: hidden;
}

.lab-entry-arrow {
  color: var(--text-faint) !important;
  font: 700 15px/1 var(--font-mono) !important;
  align-self: center;
  justify-self: end;
  transition: transform 0.2s ease, color 0.2s ease;
}

.lab-entry:hover .lab-entry-arrow {
  color: var(--entry-accent, var(--tech-cyan)) !important;
  transform: translateX(4px);
}

/* ==========================================================================
   Sidebar Tech Console (Author + Live Direction Ticker + Categories/Tags)
   ========================================================================== */
html body .home-content .sidebar {
  width: 100%;
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

html body .home-content .sidebar-card,
.bento-cell {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border-line) !important;
  border-radius: 12px !important;
  background: var(--bg-surface) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--card-shadow) !important;
  overflow: hidden;
}

html body .home-content .sidebar-card::before,
.bento-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tech-cyan), transparent);
  opacity: 0.45;
  pointer-events: none;
}

html body .home-content .sidebar-author {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Fix Homepage Avatar Wrapper (.startkk-about-avatar-link) & Image (.sidebar-author-avatar) */
html body .home-content .startkk-about-avatar-link,
html body .startkk-about-avatar-link {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 78px !important;
  height: 78px !important;
  margin: 4px auto 14px !important;
  padding: 3px !important;
  border-radius: 50% !important;
  background: var(--tech-gradient) !important;
  border: 0 !important;
  box-shadow: 0 0 22px var(--tech-glow-strong) !important;
  overflow: visible !important;
  line-height: 0 !important;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease !important;
}

html body .home-content .startkk-about-avatar-link::after,
html body .startkk-about-avatar-link::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px dashed var(--tech-cyan);
  opacity: 0.55;
  pointer-events: none;
  animation: avatar-orbit-spin 20s linear infinite;
}

html body .home-content .startkk-about-avatar-link:hover,
html body .startkk-about-avatar-link:hover {
  transform: scale(1.05) !important;
  box-shadow: 0 0 28px var(--tech-glow-strong) !important;
}

/* Direct Avatar (before or after JS link wrapper) */
html body .home-content .sidebar-author > .sidebar-author-avatar {
  width: 76px !important;
  height: 76px !important;
  margin: 4px auto 14px !important;
  padding: 3px !important;
  border-radius: 50% !important;
  background: var(--tech-gradient) !important;
  object-fit: cover !important;
  object-position: center !important;
  aspect-ratio: 1 / 1 !important;
  box-shadow: 0 0 22px var(--tech-glow-strong) !important;
  display: block !important;
}

/* Avatar inside .startkk-about-avatar-link: MUST have margin: 0 so link stays a 1:1 circle! */
html body .startkk-about-avatar-link img,
html body .home-content .startkk-about-avatar-link .sidebar-author-avatar {
  width: 72px !important;
  height: 72px !important;
  min-width: 72px !important;
  min-height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  border: 2.5px solid var(--bg-surface-solid) !important;
  object-fit: cover !important;
  object-position: center !important;
  aspect-ratio: 1 / 1 !important;
  display: block !important;
  box-shadow: none !important;
  filter: none !important;
}

@keyframes avatar-orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

html body .home-content .sidebar-author-name {
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary) !important;
}

html body .home-content .sidebar-author-bio {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-secondary) !important;
  margin: 0;
}

html body .home-content .sidebar-author-social {
  justify-content: center;
  margin-top: 14px;
  gap: 8px;
  display: flex;
  width: 100%;
}

html body .home-content .sidebar-author-social a {
  border: 1px solid var(--border-line) !important;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--text-secondary) !important;
  background: var(--bg-pill);
  transition: all 0.18s ease;
}

html body .home-content .sidebar-author-social a:hover {
  color: var(--tech-cyan) !important;
  border-color: var(--border-line-hover) !important;
  box-shadow: 0 0 12px var(--tech-glow) !important;
  transform: translateY(-2px);
}

/* Style the 3-column profile stats injected at the bottom of .sidebar-author */
html body .home-content .startkk-profile-stats {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 16px !important;
  padding-top: 14px !important;
  border: 0 !important;
  border-top: 1px solid var(--border-line) !important;
  background: transparent !important;
}

html body .home-content .startkk-profile-stat {
  display: block !important;
  padding: 8px 4px !important;
  border-radius: 8px !important;
  background: var(--bg-pill) !important;
  border: 1px solid var(--border-line) !important;
  text-align: center !important;
  text-decoration: none !important;
  transition: all 0.18s ease !important;
}

html body .home-content .startkk-profile-stat:hover {
  border-color: var(--border-line-hover) !important;
  box-shadow: 0 0 12px var(--tech-glow) !important;
  transform: translateY(-2px);
}

html body .home-content .startkk-profile-stat strong {
  color: var(--tech-cyan) !important;
  font: 700 15px/1.2 var(--font-mono) !important;
  display: block;
}

html body .home-content .startkk-profile-stat span {
  margin-top: 4px !important;
  color: var(--text-muted) !important;
  font: 600 10px/1.2 var(--font-sans) !important;
  display: block;
}


/* Explore Direction Vertical Ticker in Sidebar */
html body .sidebar .lab-index {
  padding: 0 !important;
}

.lab-index-head,
.lab-index-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: var(--text-secondary) !important;
  font: 600 11px/1.3 var(--font-mono) !important;
  background: var(--bg-subtle) !important;
}

.lab-index-head {
  border-bottom: 1px solid var(--border-line);
}

.lab-index-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lab-index-label {
  color: var(--tech-cyan) !important;
  font-weight: 700;
}

.lab-index-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border-line) !important;
  background: var(--bg-surface-solid) !important;
  color: var(--text-secondary) !important;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.lab-index-toggle:hover {
  color: var(--tech-cyan) !important;
  border-color: var(--border-line-hover) !important;
}

.lab-index-toggle span {
  position: relative;
  width: 8px;
  height: 8px;
  display: block;
}

.lab-index-toggle span::before,
.lab-index-toggle span::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: currentColor;
}

.lab-index-toggle span::before { left: 1px; }
.lab-index-toggle span::after { right: 1px; }

.lab-index[data-paused="true"] .lab-index-toggle span::before {
  left: 2px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent currentColor;
  background: transparent;
}

.lab-index[data-paused="true"] .lab-index-toggle span::after {
  display: none;
}

.lab-index-window {
  position: relative;
  overflow: hidden;
  touch-action: pan-x;
}

.lab-index.is-scrolling .lab-index-window {
  height: 184px;
}

.lab-index-track {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.lab-index.is-scrolling .lab-index-track {
  animation: none !important;
  will-change: transform;
}

.lab-index-group {
  display: flex;
  flex-direction: column;
}

.lab-index a {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-line);
  color: var(--text-primary) !important;
  text-decoration: none;
  font-size: 13px;
  transition: background-color 0.15s ease, padding-left 0.18s ease;
}

.lab-index a:hover {
  background: var(--bg-subtle) !important;
  padding-left: 20px;
}

.lab-index-number {
  color: var(--tech-cyan) !important;
  font: 700 11px/1 var(--font-mono) !important;
}

.lab-index-name {
  font-weight: 600;
  color: var(--text-primary) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab-index-count {
  color: var(--tech-blue) !important;
  font: 500 10.5px/1 var(--font-mono) !important;
  background: var(--bg-subtle);
  padding: 3px 7px;
  border-radius: 5px;
}

.lab-index-arrow {
  color: var(--text-faint) !important;
  font: 11px/1 var(--font-mono) !important;
  justify-self: end;
}

.lab-index a:hover .lab-index-arrow {
  color: var(--tech-cyan) !important;
}

.lab-index-foot {
  margin: 0;
  justify-content: flex-start;
  gap: 8px;
  border-top: 1px solid var(--border-line);
}

/* ==========================================================================
   GitHub-Style Contribution Heatmap (Below Articles & on /about)
   ========================================================================== */
.home-bottom-heatmap {
  margin-top: 24px;
  padding: 20px 22px !important;
}

.bento-eyebrow-tag {
  display: block;
  font: 700 10px/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--tech-cyan);
  margin-bottom: 3px;
}

.bento-card-title {
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 750 !important;
  color: var(--text-primary) !important;
  display: inline-block;
}

.gh-heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px !important;
}

.gh-heatmap-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  margin-left: 8px;
  border-radius: 999px;
  font: 600 11px/1.3 var(--font-mono);
  color: #16a34a;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

html.dark .gh-heatmap-badge {
  color: #4ade80;
}

.gh-heatmap-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.gh-heatmap-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 11px/1 var(--font-mono);
  color: var(--text-secondary);
  background: rgba(241, 245, 249, 0.92);
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-line);
}

html.dark .gh-heatmap-legend {
  color: #8b949e;
  background: #0d121d;
  border-color: rgba(255, 255, 255, 0.08);
}

.gh-heatmap-legend .gh-legend-label {
  color: var(--text-muted);
  margin: 0 3px;
  font-size: 10px;
}

html.dark .gh-heatmap-legend .gh-legend-label {
  color: #8b949e;
}

.gh-heatmap-legend .gh-cell {
  width: 9.5px;
  height: 9.5px;
  border-radius: 2.5px;
  display: inline-block;
}

/* Light Mode Glacier Slate Heatmap Panel */
.gh-heatmap-panel {
  background: rgba(241, 245, 249, 0.88) !important;
  border: 1px solid var(--border-line) !important;
  border-radius: 10px !important;
  padding: 16px 16px 12px !important;
  overflow-x: auto;
}

/* Dark Mode Cyber Space Heatmap Panel */
html.dark .gh-heatmap-panel {
  background: #0d121d !important;
  border: 1px solid rgba(56, 189, 248, 0.16) !important;
}

.gh-heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: minmax(8.5px, 1fr);
  gap: 3.2px;
  min-width: 520px;
  width: 100%;
  user-select: none;
}

.gh-heatmap-grid .gh-cell {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 2.5px;
  transition: transform 0.12s ease, filter 0.12s ease;
  cursor: pointer;
}

/* Light Mode Heatmap Cells */
html:not(.dark) .gh-cell.gh-level-0 {
  background-color: #cbd5e1;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
html:not(.dark) .gh-cell.gh-level-1 {
  background-color: #86efac;
  border: 1px solid rgba(22, 163, 74, 0.22);
}
html:not(.dark) .gh-cell.gh-level-2 {
  background-color: #4ade80;
  border: 1px solid rgba(22, 163, 74, 0.32);
}
html:not(.dark) .gh-cell.gh-level-3 {
  background-color: #16a34a;
  border: 1px solid rgba(21, 128, 61, 0.45);
}
html:not(.dark) .gh-cell.gh-level-4 {
  background-color: #059669;
  border: 1px solid rgba(4, 120, 87, 0.6);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.25);
}

/* Dark Mode Heatmap Cells */
html.dark .gh-cell.gh-level-0 {
  background-color: #1e2636;
  border: 1px solid rgba(255, 255, 255, 0.03);
}
html.dark .gh-cell.gh-level-1 {
  background-color: #0e4429;
  border: 1px solid rgba(46, 160, 67, 0.2);
}
html.dark .gh-cell.gh-level-2 {
  background-color: #006d32;
  border: 1px solid rgba(46, 160, 67, 0.3);
}
html.dark .gh-cell.gh-level-3 {
  background-color: #26a641;
  border: 1px solid rgba(63, 185, 80, 0.4);
}
html.dark .gh-cell.gh-level-4 {
  background-color: #56d364;
  border: 1px solid rgba(110, 231, 183, 0.55);
  box-shadow: 0 0 8px rgba(86, 211, 100, 0.3);
}

.gh-heatmap-grid .gh-cell:hover {
  transform: scale(1.28);
  z-index: 5;
  filter: brightness(1.15);
  box-shadow: 0 0 0 1.5px var(--tech-cyan);
}

.gh-heatmap-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-line);
  font: 11px/1.3 var(--font-mono);
  color: var(--text-muted);
}

html.dark .gh-heatmap-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
  color: #8b949e;
}

.gh-heatmap-status strong {
  color: var(--tech-emerald);
}

.gh-heatmap-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(8, 13, 26, 0.96);
  color: #f0f6fc;
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 6px;
  padding: 6px 10px;
  font: 11.5px/1.4 var(--font-mono);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-8px);
  transition: opacity 0.12s ease;
}

.gh-heatmap-tooltip.is-visible {
  opacity: 1;
}

.gh-heatmap-tooltip .gh-tip-count {
  color: #56d364;
  font-weight: 700;
}

/* ==========================================================================
   Subpages & Details (About Engineer Dossier, Archives, Categories, Tags)
   ========================================================================== */
.about-card,
.about-sidebar-panel,
.archive-group,
.category-card {
  background: var(--bg-surface) !important;
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-line) !important;
  border-radius: 12px !important;
  box-shadow: var(--card-shadow) !important;
}

/* Cohesive Subpage HUD Header (/archives, /categories, /tags) */
.subpage-hud-header {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 16px !important;
  padding: 20px 24px !important;
  margin-bottom: 28px !important;
  background: var(--bg-surface) !important;
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-line) !important;
  border-left: 3px solid var(--tech-cyan) !important;
  border-radius: 12px !important;
  box-shadow: var(--card-shadow) !important;
}

.subpage-hud-header .section-title {
  margin: 4px 0 6px !important;
  font: 800 clamp(22px, 2.6vw, 28px)/1.25 var(--font-display) !important;
  color: var(--text-primary) !important;
  letter-spacing: -0.02em;
}

.subpage-hud-header .section-subtitle {
  margin: 0 !important;
  font-size: 13.5px !important;
  color: var(--text-secondary) !important;
}

.subpage-hud-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-pill);
  border: 1px solid var(--border-line);
}

.subpage-hud-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font: 600 12px/1 var(--font-mono);
  color: var(--text-secondary) !important;
  text-decoration: none !important;
  transition: all 0.16s ease;
}

.subpage-hud-tab:hover {
  color: var(--tech-cyan) !important;
}

.subpage-hud-tab.is-active {
  background: var(--tech-gradient) !important;
  color: var(--text-on-accent) !important;
  box-shadow: 0 0 12px var(--tech-glow);
}

/* About Page: Clickable Engineering Lab Metrics & Workbench Matrix */
.about-lab-metrics {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
}

.about-stat-link {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 6px !important;
  border-radius: 10px !important;
  background: var(--bg-pill) !important;
  border: 1px solid var(--border-line) !important;
  text-decoration: none !important;
  transition: all 0.18s ease !important;
}

.about-stat-link:hover {
  border-color: var(--border-line-hover) !important;
  box-shadow: 0 0 12px var(--tech-glow) !important;
  transform: translateY(-2px);
}

.about-stat-link .about-stat-value {
  color: var(--tech-cyan) !important;
  font: 800 18px/1.2 var(--font-mono) !important;
}

.about-stat-link .about-stat-label {
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  margin-top: 3px !important;
}

.about-workbench-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.about-workbench-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line-hover);
  color: var(--tech-cyan) !important;
  font: 700 11.5px/1 var(--font-mono);
  text-decoration: none !important;
  transition: all 0.18s ease;
}

.about-workbench-link:hover {
  background: var(--tech-gradient);
  color: var(--text-on-accent) !important;
  border-color: transparent;
  box-shadow: 0 0 14px var(--tech-glow);
}

.about-workbench-intro {
  margin: 0 0 16px;
  font-size: 13.8px;
  line-height: 1.68;
  color: var(--text-secondary);
}

.about-workbench-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 680px) {
  .about-workbench-grid {
    grid-template-columns: 1fr;
  }
}

.workbench-domain-box {
  padding: 16px;
  border-radius: 10px;
  background: var(--bg-pill);
  border: 1px solid var(--border-line);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.workbench-domain-box:hover {
  border-color: var(--border-line-hover);
  transform: translateY(-2px);
}

.workbench-domain-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.workbench-domain-code {
  font: 700 10.5px/1.2 var(--font-mono);
  color: var(--tech-cyan);
}

.workbench-domain-box.domain-hw .workbench-domain-code {
  color: var(--tech-emerald);
}

.workbench-domain-box.domain-ops .workbench-domain-code {
  color: var(--tech-indigo);
}

.workbench-domain-status {
  font: 700 9.5px/1 var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--tech-cyan);
  border: 1px solid var(--border-line);
}

.workbench-domain-box h4 {
  margin: 0 0 6px;
  font: 750 15px/1.35 var(--font-display);
  color: var(--text-primary);
}

.workbench-domain-box p {
  margin: 0 0 12px;
  font-size: 12.8px;
  line-height: 1.62;
  color: var(--text-secondary);
}

.workbench-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.workbench-pills span {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
  font: 600 10.5px/1.3 var(--font-mono);
}

.about-interest-blue {
  color: var(--tech-cyan) !important;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-line) !important;
  border-radius: 6px;
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  padding: 4px 12px !important;
}

.about-interest-blue:hover {
  background: var(--tech-gradient) !important;
  color: var(--text-on-accent) !important;
  border-color: transparent !important;
  box-shadow: 0 0 14px var(--tech-glow) !important;
}

.about-timeline-item:before {
  background: var(--tech-cyan) !important;
  box-shadow: 0 0 8px var(--tech-cyan) !important;
}

.radar-data {
  stroke: var(--tech-cyan) !important;
  fill: var(--tech-glow) !important;
}

.archive-group-year,
.archive-post-day {
  color: var(--tech-cyan) !important;
  font-family: var(--font-mono) !important;
  font-weight: 700;
}

.category-card:hover,
.tag-pill:hover,
.sidebar-tag-pill:hover {
  border-color: var(--border-line-hover) !important;
  color: var(--tech-cyan) !important;
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover) !important;
}

.pagination a.active,
.photo-pagination .page-btn.active {
  background: var(--tech-gradient) !important;
  border-color: transparent !important;
  color: var(--text-on-accent) !important;
  font-weight: 800;
  box-shadow: 0 0 14px var(--tech-glow) !important;
}

.reading-progress-bar {
  background: var(--tech-gradient) !important;
  height: 2.5px;
  box-shadow: 0 0 10px var(--tech-cyan);
}

/* Override legacy inline head injections */
html body .site-nav a::before,
html body .site-nav a::after {
  content: none !important;
  display: none !important;
}

html body .site-main .lab-entry .post-card-title a::after {
  content: "" !important;
  position: absolute;
  inset: 0;
  opacity: 1 !important;
  transform: none !important;
}

html body .about-avatar-large {
  width: 116px !important;
  height: 116px !important;
  border-radius: 50% !important;
  padding: 3px !important;
  background: var(--tech-gradient) !important;
  border: 0 !important;
  object-fit: cover !important;
  aspect-ratio: 1 / 1 !important;
  box-shadow: 0 0 24px var(--tech-glow-strong) !important;
  margin: 0 auto 14px !important;
  display: block !important;
}

/* ==========================================================================
   UPGRADE 1: Immersive Article Reading Cockpit (post.html), Code Blocks & TOC
   ========================================================================== */
html body .post-detail {
  background: transparent !important;
}

html body .post-shell {
  max-width: 1220px !important;
  gap: 28px !important;
  padding-top: 28px !important;
}

html body .post-body {
  background: var(--bg-surface) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-line) !important;
  border-radius: 16px !important;
  padding: 38px 44px !important;
  box-shadow: var(--card-shadow) !important;
  position: relative;
  overflow: hidden;
}

html body .post-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 36px;
  right: 36px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--tech-cyan), transparent);
  opacity: 0.65;
  pointer-events: none;
}

html body .article-title {
  color: var(--text-primary) !important;
  font-family: var(--font-display) !important;
  font-size: clamp(24px, 2.8vw, 34px) !important;
  font-weight: 800 !important;
  line-height: 1.38 !important;
  letter-spacing: -0.025em !important;
  margin-bottom: 16px !important;
}

html body .post-meta-row {
  border-bottom: 1px solid var(--border-line) !important;
  padding-bottom: 18px !important;
  margin-bottom: 24px !important;
  color: var(--text-muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
}

/* Bidirectional Project Context HUD Banner in post.html */
.post-project-context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 20px;
  margin: 0 0 28px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line-hover);
  border-left: 4px solid var(--tech-cyan);
  box-shadow: 0 8px 24px -8px var(--tech-glow);
}

.ppcb-left {
  flex: 1;
  min-width: 240px;
}

.ppcb-eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.ppcb-badge {
  font: 700 10.5px/1.2 var(--font-mono);
  color: var(--text-on-accent);
  background: var(--tech-gradient);
  padding: 3px 8px;
  border-radius: 4px;
}

.ppcb-code {
  font: 600 11px/1.2 var(--font-mono);
  color: var(--tech-cyan);
}

.ppcb-title {
  margin: 0 0 6px !important;
  font: 800 16.5px/1.35 var(--font-display) !important;
}

.ppcb-title a {
  color: var(--text-primary) !important;
  text-decoration: none !important;
  transition: color 0.16s ease;
}

.ppcb-title a:hover {
  color: var(--tech-cyan) !important;
}

.ppcb-summary {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  color: var(--text-secondary) !important;
}

.ppcb-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
}

.ppcb-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--tech-gradient);
  color: var(--text-on-accent) !important;
  font: 700 12.5px/1.2 var(--font-sans);
  text-decoration: none !important;
  box-shadow: 0 4px 12px var(--tech-glow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ppcb-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--tech-glow-strong);
}

.ppcb-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  color: var(--text-secondary) !important;
  font: 600 11.5px/1.2 var(--font-mono);
  text-decoration: none !important;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.ppcb-btn-secondary:hover {
  border-color: var(--tech-cyan);
  color: var(--tech-cyan) !important;
}

html body .article-content {
  color: var(--text-primary) !important;
  font-size: 15.5px !important;
  line-height: 1.9 !important;
}

html body .article-content h2,
html body .article-content h3 {
  color: var(--text-primary) !important;
  font-family: var(--font-display) !important;
  font-weight: 750 !important;
  letter-spacing: -0.02em;
  margin-top: 2em;
}

html body .article-content h2 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-line);
}

html body .article-content blockquote {
  border-left: 3px solid var(--tech-cyan) !important;
  background: var(--bg-subtle) !important;
  border-radius: 0 10px 10px 0;
  padding: 14px 20px !important;
  color: var(--text-secondary) !important;
}

/* Fix <shiki-code> blur override and style Kaze native .code-block-wrapper with macOS terminal header */
html body pre:has(code),
html body .article-content pre,
html body shiki-code {
  filter: none !important;
  -webkit-filter: none !important;
  opacity: 1 !important;
}

html body .code-block-wrapper {
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  border-radius: 10px !important;
  background: #090f1d !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
  overflow: hidden;
  margin: 18px 0 !important;
}

html body .article-content > pre {
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  border-radius: 10px !important;
  background: #090f1d !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

html body .code-block-header {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 9px 14px 9px 62px !important;
  background: #0d1629 !important;
  border-bottom: 1px solid rgba(56, 189, 248, 0.16) !important;
  color: #94a3b8 !important;
  font-family: var(--font-mono) !important;
}

html body .code-block-header::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #27c93f;
}

html body .code-block-lang,
html body .code-block-header > span {
  font: 700 11px/1 var(--font-mono) !important;
  color: #38bdf8 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
}

html body .code-copy-btn,
html body .code-block-header > button {
  font: 600 11px/1 var(--font-mono) !important;
  color: #e2e8f0 !important;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(56, 189, 248, 0.28) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  cursor: pointer;
  transition: all 0.16s ease;
}

html body .code-copy-btn:hover,
html body .code-block-header > button:hover {
  border-color: #00f2fe !important;
  color: #00f2fe !important;
}

/* Left TOC & Live Progress Readout */
html body .post-toc {
  background: var(--bg-surface) !important;
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-line) !important;
  border-radius: 12px !important;
  padding: 18px !important;
  box-shadow: var(--card-shadow) !important;
}

html body .post-toc-heading {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  color: var(--tech-cyan) !important;
  font: 700 12px/1.3 var(--font-mono) !important;
  letter-spacing: 0.05em;
  margin-bottom: 12px !important;
}

.toc-progress-readout {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
  color: var(--tech-cyan);
  font: 700 10px/1.2 var(--font-mono);
}

html body #post-toc-list a {
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  border-left: 2px solid transparent !important;
  padding-left: 10px !important;
  transition: all 0.18s ease !important;
}

html body #post-toc-list a:hover,
html body #post-toc-list a.active,
html body #post-toc-list a[aria-current="location"] {
  color: var(--tech-cyan) !important;
  border-left-color: var(--tech-cyan) !important;
  background: var(--bg-subtle) !important;
  border-radius: 0 6px 6px 0;
  font-weight: 600 !important;
}

html body .post-actions-rail {
  background: transparent !important;
}

html body .post-action-btn,
html body .post-back-btn {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-line) !important;
  color: var(--text-secondary) !important;
  border-radius: 10px !important;
  box-shadow: var(--card-shadow) !important;
}

html body .post-action-btn:hover,
html body .post-back-btn:hover {
  color: var(--tech-cyan) !important;
  border-color: var(--border-line-hover) !important;
  box-shadow: 0 0 14px var(--tech-glow) !important;
}

/* ==========================================================================
   UPGRADE 2: Unified Cyber Glacier Ctrl+K Command Palette Modal
   ========================================================================== */
html body #searchToggle.has-kbd-hint {
  width: auto !important;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.search-kbd-badge {
  font: 600 10px/1 var(--font-mono);
  color: var(--tech-cyan);
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
  padding: 2px 5px;
  border-radius: 4px;
}

.startkk-command-shell {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 24px;
}

.startkk-command-shell[hidden] {
  display: none !important;
}

.startkk-command-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 20, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html body .startkk-command {
  position: relative;
  z-index: 1;
  width: min(660px, 100%);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid var(--border-line-hover) !important;
  border-radius: 14px !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 28px var(--tech-glow) !important;
  color: var(--text-primary) !important;
  overflow: hidden;
}

html body .startkk-command-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-line) !important;
  background: var(--bg-subtle);
}

html body .startkk-command-mark {
  display: block;
  color: var(--tech-cyan) !important;
  font: 800 10.5px/1.2 var(--font-mono) !important;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.startkk-command-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmd-search-icon {
  color: var(--tech-cyan);
  flex-shrink: 0;
}

html body .startkk-command-input {
  flex: 1;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  font: 500 15px/1.4 var(--font-sans) !important;
}

html body .startkk-command-input::placeholder {
  color: var(--text-muted);
}

.startkk-command-key {
  font: 700 10px/1 var(--font-mono);
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
  cursor: pointer;
}

.startkk-command-results {
  padding: 10px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.startkk-command-group-title {
  padding: 8px 8px 4px;
  font: 700 11px/1.2 var(--font-mono);
  color: var(--tech-cyan);
  letter-spacing: 0.04em;
}

html body .startkk-command-item {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-secondary) !important;
  border-radius: 8px !important;
  border: 1px solid transparent;
  text-decoration: none !important;
  transition: all 0.14s ease;
}

html body .startkk-command-item:hover,
html body .startkk-command-item.is-active {
  background: var(--bg-subtle) !important;
  border-color: var(--border-line-hover) !important;
  color: var(--text-primary) !important;
}

html body .startkk-command-type {
  font: 700 10px/1.2 var(--font-mono) !important;
  color: var(--tech-cyan) !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-line) !important;
  border-radius: 5px !important;
  padding: 4px 7px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.startkk-command-main {
  min-width: 0;
}

.startkk-command-title {
  font-size: 13.8px;
  font-weight: 650;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.startkk-command-desc {
  font-size: 11.8px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.startkk-command-arrow {
  font: 700 13px/1 var(--font-mono);
  color: var(--tech-cyan);
  justify-self: end;
}

.startkk-command-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.startkk-command-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 16px;
  border-top: 1px solid var(--border-line);
  background: var(--bg-pill);
  font: 500 11px/1.2 var(--font-mono);
  color: var(--text-muted);
}

.startkk-command-foot kbd {
  display: inline-block;
  padding: 2px 5px;
  margin-right: 3px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
  font-size: 10px;
}

@media (max-width: 640px) {
  .startkk-command-shell {
    padding: 5vh 10px 14px;
  }

  html body .startkk-command {
    max-height: 86vh;
  }

  html body .startkk-command-head {
    padding: 12px 14px;
  }

  html body .startkk-command-item {
    grid-template-columns: 78px minmax(0, 1fr) 16px;
    gap: 8px;
    padding: 9px 10px;
  }

  html body .startkk-command-type {
    font-size: 9.5px !important;
    padding: 3px 5px;
  }

  .startkk-command-foot {
    padding: 8px 12px;
    font-size: 10px;
  }
}

/* ==========================================================================
   UPGRADE 3: Homepage Sidebar Streamlining (Hide Duplicate Category Card)
   ========================================================================== */
html body .home-content .sidebar-categories {
  display: none !important;
}

html body .home-content .sidebar-card-title {
  color: var(--tech-cyan) !important;
  font: 700 12px/1.3 var(--font-mono) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px !important;
  display: flex;
  align-items: center;
  gap: 6px;
}

html body .home-content .sidebar-card-title::before {
  content: "//";
  color: var(--tech-blue);
}

html body .home-content .sidebar-recent-list li {
  padding: 10px 0 !important;
  border-bottom: 1px solid var(--border-line) !important;
}

html body .home-content .sidebar-recent-list li:last-child {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
}

html body .home-content .sidebar-recent-title {
  color: var(--text-primary) !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  font-weight: 500;
  transition: color 0.15s ease;
}

html body .home-content .sidebar-recent-title:hover {
  color: var(--tech-cyan) !important;
}

html body .home-content .sidebar-recent-date {
  color: var(--text-muted) !important;
  font: 500 10.5px/1.3 var(--font-mono) !important;
  margin-top: 4px !important;
}

/* ==========================================================================
   UPGRADE 4: Circular View Transition Animation for Theme Toggle
   ========================================================================== */
@keyframes lab-theme-reveal {
  from {
    clip-path: circle(0 at var(--lab-theme-x, 88%) var(--lab-theme-y, 32px));
  }
  to {
    clip-path: circle(150vmax at var(--lab-theme-x, 88%) var(--lab-theme-y, 32px));
  }
}

::view-transition-old(root) {
  animation: none;
}

::view-transition-new(root) {
  animation: lab-theme-reveal 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  mix-blend-mode: normal;
}

@keyframes lab-index-scroll {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

@keyframes lab-breathe {
  0% { opacity: 0.8; transform: scale(0.6); }
  80%, 100% { opacity: 0; transform: scale(2); }
}

@media (max-width: 980px) {
  html body .site-nav nav { display: none; }
  html body .menu-toggle { display: flex; }
  html body .home-content .home-layout { grid-template-columns: 1fr; }
  html body .home-content .sidebar { position: static; }
}

@media (max-width: 700px) {
  html body .home-content { padding: 12px 14px 40px; }
  .hud-motto { display: none; }
  html body .site-main .post-card.lab-entry {
    grid-template-columns: 32px minmax(0, 1fr) 16px;
    gap: 10px;
    padding: 16px 14px;
  }
}

/* ==========================================================================
   STARTKK PROJECT LAB (/projects & /projects/{slug})
   Follows StartKK-项目展示设计方案.md:
   - Lower background decoration intensity on project pages so project diagrams lead
   - 1 Flagship horizontal card + 2 Secondary grid cards on /projects
   - 5-Section "先看成果，再读技术" structure on Project Detail Views
   - Mobile single-column layout + Click-to-zoom Lightbox + Reduced Motion support
   ========================================================================== */
html body.projects-lab-body #lab-cyber-canvas {
  opacity: 0.22 !important;
}

html body .projects-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

.projects-lab-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-line);
}

.projects-lab-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 11px/1.2 var(--font-mono);
  color: var(--tech-cyan);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.projects-lab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tech-emerald);
  box-shadow: 0 0 8px var(--tech-emerald);
}

.projects-lab-title {
  margin: 0 0 10px;
  font: 800 clamp(26px, 3.2vw, 36px)/1.2 var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.projects-lab-subtitle {
  margin: 0;
  max-width: 780px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* Flagship Card (1件代表作) */
.project-flagship-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  margin-bottom: 40px;
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.project-flagship-card:hover {
  border-color: var(--border-line-hover);
  box-shadow: var(--card-shadow-hover);
}

.project-flagship-visual,
.project-secondary-visual,
.project-detail-hero-visual,
.project-arch-box {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #070d19;
  border: 1px solid rgba(56, 189, 248, 0.22);
  cursor: zoom-in;
}

.project-flagship-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.project-diagram-svg {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-flagship-visual:hover .project-diagram-svg,
.project-secondary-visual:hover .project-diagram-svg,
.project-detail-hero-visual:hover .project-diagram-svg {
  transform: scale(1.018);
}

.project-visual-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(7, 13, 25, 0.86);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font: 700 11px/1.2 var(--font-mono);
}

.project-zoom-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
  font: 600 11px/1.2 var(--font-mono);
  cursor: zoom-in;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.project-zoom-hint:hover {
  border-color: #38bdf8;
  color: #38bdf8;
}

.project-flagship-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-card-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.project-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font: 700 11px/1.3 var(--font-mono);
}

.project-status-pill.status-active {
  background: rgba(16, 185, 129, 0.14);
  color: var(--tech-emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.project-status-pill.status-stable {
  background: rgba(56, 189, 248, 0.14);
  color: var(--tech-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.project-domain-tag {
  font: 600 11.5px/1.3 var(--font-mono);
  color: var(--text-muted);
}

.project-flagship-title {
  margin: 0 0 12px;
  font: 800 clamp(20px, 2.2vw, 25px)/1.32 var(--font-display);
  letter-spacing: -0.02em;
}

.project-flagship-title a,
.project-secondary-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.18s ease;
}

.project-flagship-title a:hover,
.project-secondary-title a:hover {
  color: var(--tech-cyan);
}

.project-flagship-purpose {
  margin: 0 0 16px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.project-flagship-purpose strong {
  color: var(--text-primary);
}

.project-capability-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-capability-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.project-capability-list li strong {
  color: var(--text-primary);
}

.cap-index {
  font: 800 11px/1.8 var(--font-mono);
  color: var(--tech-cyan);
}

.project-flagship-footer,
.project-secondary-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-line);
}

.project-tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-tech-pills span {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
  font: 600 11px/1.3 var(--font-mono);
}

.project-primary-btn,
.project-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font: 700 13px/1.2 var(--font-sans);
  text-decoration: none !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-primary-btn {
  background: var(--tech-gradient);
  color: var(--text-on-accent) !important;
  border: 0;
  box-shadow: 0 4px 14px var(--tech-glow);
}

.project-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--tech-glow);
}

.project-primary-btn .btn-arrow {
  transition: transform 0.2s ease;
}

.project-primary-btn:hover .btn-arrow {
  transform: translateX(4px);
}

.project-secondary-btn {
  background: var(--bg-subtle);
  color: var(--text-primary) !important;
  border: 1px solid var(--border-line);
}

.project-secondary-btn:hover {
  border-color: var(--tech-cyan);
  color: var(--tech-cyan) !important;
}

/* Secondary 2-Column Grid (其他作品) */
.projects-grid-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.projects-grid-section-title {
  margin: 0;
  font: 800 18px/1.3 var(--font-display);
  color: var(--text-primary);
}

.projects-grid-section-note {
  font: 500 12px/1.3 var(--font-mono);
  color: var(--text-muted);
}

.projects-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.project-secondary-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.project-secondary-card:hover {
  border-color: var(--border-line-hover);
  box-shadow: var(--card-shadow-hover);
}

.project-secondary-visual {
  margin-bottom: 16px;
}

.project-secondary-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-secondary-title {
  margin: 0 0 10px;
  font: 750 18.5px/1.36 var(--font-display);
}

.project-secondary-purpose {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-secondary);
  flex: 1;
}

/* ==========================================================================
   Project Detail Views (/projects/pi-mqtt-monitor, etc.)
   ========================================================================== */
.project-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font: 600 12.5px/1.4 var(--font-mono);
  color: var(--text-muted);
}

.project-breadcrumb a {
  color: var(--tech-cyan);
  text-decoration: none;
}

.project-breadcrumb a:hover {
  text-decoration: underline;
}

.project-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: 14px;
  padding: 26px;
  box-shadow: var(--card-shadow);
  margin-bottom: 32px;
}

.project-detail-title {
  margin: 0 0 12px;
  font: 800 clamp(22px, 2.6vw, 30px)/1.28 var(--font-display);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.project-detail-subtitle {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.78;
  color: var(--text-secondary);
}

.project-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.project-detail-section {
  margin-bottom: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.project-section-heading {
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-line);
  font: 800 19px/1.35 var(--font-display);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-section-heading span {
  font: 800 13px/1 var(--font-mono);
  color: var(--tech-cyan);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
}

.project-scenarios-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.project-scenario-card {
  padding: 18px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
}

.scenario-num {
  font: 700 11px/1.3 var(--font-mono);
  color: var(--tech-cyan);
  margin-bottom: 8px;
}

.project-scenario-card h3 {
  margin: 0 0 8px;
  font: 750 15.5px/1.4 var(--font-display);
  color: var(--text-primary);
}

.project-scenario-card p {
  margin: 0;
  font-size: 13.8px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.project-arch-box {
  margin-bottom: 22px;
  padding: 14px;
}

.arch-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #94a3b8;
  font: 600 12px/1.3 var(--font-mono);
}

.arch-box-header .project-zoom-hint {
  position: static;
}

.project-two-col-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.project-detail-panel {
  padding: 18px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
}

.project-detail-panel h3 {
  margin: 0 0 12px;
  font: 750 16px/1.4 var(--font-display);
  color: var(--text-primary);
}

.panel-intro {
  margin: 0 0 12px;
  font-size: 13.8px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.project-bullet-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.8px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.project-bullet-list strong {
  color: var(--text-primary);
}

.project-code-block pre {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #070c17 !important;
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #e2e8f0;
  font: 500 12px/1.65 var(--font-mono);
  overflow-x: auto;
}

.project-honest-note {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--tech-cyan);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.project-related-posts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.related-post-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  text-decoration: none !important;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.related-post-card:hover {
  border-color: var(--tech-cyan);
  transform: translateX(3px);
}

.related-post-tag {
  align-self: flex-start;
  font: 700 10.5px/1.2 var(--font-mono);
  color: var(--tech-cyan);
}

.related-post-card strong {
  font-size: 14.5px;
  color: var(--text-primary);
}

.related-post-card span:last-child {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.project-version-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-version-timeline li {
  padding-left: 12px;
  border-left: 2px solid var(--border-line-hover);
}

.ver-badge {
  display: inline-block;
  font: 700 11px/1.2 var(--font-mono);
  color: var(--tech-cyan);
  margin-bottom: 4px;
}

.ver-badge.ver-next {
  color: var(--tech-emerald);
}

.project-version-timeline p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Lightbox Modal for Mobile & Desktop Diagram Zoom */
.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.project-lightbox.is-open {
  display: flex;
}

.project-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.86);
  backdrop-filter: blur(8px);
}

.project-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1080px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #070d19;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}

.project-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: #0d1628;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.project-lightbox-caption {
  font: 600 13px/1.4 var(--font-mono);
  color: #e2e8f0;
}

.project-lightbox-close {
  padding: 5px 12px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font: 700 12px/1.2 var(--font-mono);
  cursor: pointer;
}

.project-lightbox-stage {
  padding: 18px;
  overflow: auto;
}

.project-lightbox-stage svg {
  width: 100%;
  min-width: 640px;
  height: auto;
  display: block;
}

/* Responsive Single-Column on Tablet & Mobile (Section 6.1) */
@media (max-width: 960px) {
  html body .projects-page {
    padding: 18px 16px 52px;
  }
  .project-flagship-card,
  .projects-secondary-grid,
  .project-detail-hero,
  .project-scenarios-grid,
  .project-two-col-details {
    grid-template-columns: 1fr;
  }
  /* Mobile: visual first, text second on project detail hero */
  .project-detail-hero-visual {
    order: -1;
  }
  .project-flagship-visual {
    min-height: 220px;
  }
}

/* Reduced Motion Accessibility (Section 6.2) */
@media (prefers-reduced-motion: reduce) {
  .project-diagram-svg,
  .project-primary-btn,
  .project-primary-btn .btn-arrow,
  .related-post-card {
    transition: none !important;
    transform: none !important;
  }
}

/* STARTKK REFINEMENTS 20261102: touch, readable content and keyboard navigation. */
html { scroll-padding-top: 90px; }
body { overflow-x: clip; }
body :is(a,button,input,textarea,select):focus-visible {
  outline: 2px solid var(--tech-cyan, #e8a23a) !important;
  outline-offset: 4px;
}
.article-content { overflow-wrap: anywhere; }
.article-content pre { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.article-content table { display: block; max-width: 100%; overflow-x: auto; }
.article-content img { max-width: 100%; height: auto; }
.post-card-excerpt:empty { display: none; }
@media (pointer: coarse) {
  #lab-cyber-canvas { display: none !important; }
  .header-actions button, .page-btn, .page-next, .page-prev { min-height: 44px; min-width: 44px; }
  .lab-entry-arrow { opacity: .65; }
}
@media (max-width: 600px) {
  .site-header .site-logo-text { font-size: 14px; }
  .lab-track-filters { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
  .lab-filter-pill { flex-shrink: 0; min-height: 40px; }
  .article-content { font-size: 16px; line-height: 1.85; }
  .article-content pre { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  #lab-cyber-canvas { display: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* MOBILE WIDTH FIX 1102R2 */
@media (max-width: 700px) {
  #lab-cyber-canvas { display: none !important; }
  html body .home-content .home-main { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  html body .lab-head-actions { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  html body .lab-track-filters { width: 100% !important; min-width: 0 !important; max-width: 100% !important; flex-wrap: nowrap !important; overflow-x: auto !important; }
  html body .post-grid, html body .post-card { max-width: 100% !important; min-width: 0 !important; }
}

/* MOBILE GRID FIX 1102R3: an auto grid track was retaining its min-content size. */
@media (max-width: 700px) {
  html body .home-content .home-layout { grid-template-columns: minmax(0, 1fr) !important; }
}
