/* zhiwei.plus visual polish — Chirpy overlay (2026-11-04) */
:root {
  --zw-accent: #6366f1;
  --zw-accent-2: #22d3ee;
  --zw-accent-3: #a78bfa;
  --zw-glow: rgba(99, 102, 241, 0.35);
  --zw-card-radius: 16px;
  --zw-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-mode="dark"],
[data-mode="dark"] {
  --zw-hero-fg: #f8fafc;
  --zw-hero-muted: rgba(248, 250, 252, 0.72);
  --zw-surface: rgba(30, 32, 40, 0.72);
  --zw-border: rgba(255, 255, 255, 0.08);
  --zw-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

html:not([data-mode="dark"]),
[data-mode="light"],
:root:not([data-mode="dark"]) {
  --zw-hero-fg: #0f172a;
  --zw-hero-muted: rgba(15, 23, 42, 0.68);
  --zw-surface: rgba(255, 255, 255, 0.78);
  --zw-border: rgba(15, 23, 42, 0.08);
  --zw-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

/* ---------- Hero (homepage) ---------- */
.zw-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 2.4rem 1.8rem 2rem;
  margin: 0.25rem 0 1.75rem;
  color: var(--zw-hero-fg);
  background:
    radial-gradient(1200px 400px at 10% -20%, rgba(99, 102, 241, 0.45), transparent 55%),
    radial-gradient(900px 380px at 95% 0%, rgba(34, 211, 238, 0.28), transparent 50%),
    radial-gradient(700px 320px at 60% 120%, rgba(167, 139, 250, 0.28), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.04), rgba(99, 102, 241, 0.06));
  border: 1px solid var(--zw-border);
  box-shadow: var(--zw-shadow);
  isolation: isolate;
}

[data-mode="dark"] .zw-hero {
  background:
    radial-gradient(1100px 420px at 8% -30%, rgba(99, 102, 241, 0.55), transparent 55%),
    radial-gradient(900px 380px at 100% 10%, rgba(34, 211, 238, 0.22), transparent 50%),
    radial-gradient(700px 300px at 50% 130%, rgba(167, 139, 250, 0.25), transparent 55%),
    linear-gradient(160deg, #12141c 0%, #171a24 55%, #12131a 100%);
}

.zw-hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  z-index: -1;
  animation: zw-float 9s var(--zw-ease) infinite alternate;
}
.zw-hero__orb--1 {
  width: 180px; height: 180px; left: -40px; top: -30px;
  background: radial-gradient(circle, rgba(99,102,241,.7), transparent 70%);
}
.zw-hero__orb--2 {
  width: 140px; height: 140px; right: 8%; bottom: -40px;
  background: radial-gradient(circle, rgba(34,211,238,.55), transparent 70%);
  animation-delay: -3s;
}
.zw-hero__orb--3 {
  width: 100px; height: 100px; right: 22%; top: 12%;
  background: radial-gradient(circle, rgba(167,139,250,.55), transparent 70%);
  animation-delay: -5.5s;
}

@keyframes zw-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(12px, -16px, 0) scale(1.08); }
}

.zw-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: var(--zw-accent);
  margin-bottom: 0.9rem;
}
[data-mode="dark"] .zw-hero__badge { color: #c7d2fe; }

.zw-hero h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--zw-hero-fg) 20%, var(--zw-accent) 55%, var(--zw-accent-2) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.zw-hero p {
  margin: 0 0 1.25rem;
  max-width: 42rem;
  color: var(--zw-hero-muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.zw-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.zw-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.05rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none !important;
  border: 1px solid transparent;
  transition: transform 0.25s var(--zw-ease), box-shadow 0.25s var(--zw-ease), background 0.25s;
}
.zw-btn:hover { transform: translateY(-2px); }
.zw-btn--primary {
  color: #fff !important;
  background: linear-gradient(135deg, #6366f1, #4f46e5 50%, #0ea5e9);
  box-shadow: 0 10px 24px var(--zw-glow);
}
.zw-btn--ghost {
  color: var(--zw-hero-fg) !important;
  background: var(--zw-surface);
  border-color: var(--zw-border);
  backdrop-filter: blur(10px);
}

.zw-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--zw-border);
}
.zw-hero__stat strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 750;
}
.zw-hero__stat span {
  font-size: 0.8rem;
  color: var(--zw-hero-muted);
}

@media (prefers-reduced-motion: reduce) {
  .zw-hero__orb { animation: none; }
}

/* ---------- Post cards (home + shared) ---------- */
#post-list .card-wrapper {
  margin-bottom: 1rem;
}
#post-list .card.post-preview {
  border-radius: var(--zw-card-radius) !important;
  border: 1px solid var(--zw-border) !important;
  background: var(--zw-surface) !important;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: transform 0.28s var(--zw-ease), box-shadow 0.28s var(--zw-ease), border-color 0.28s;
}
#post-list .card.post-preview:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35) !important;
}
#post-list .card-title {
  font-size: 1.15rem !important;
  font-weight: 700;
  letter-spacing: -0.01em;
}
#post-list .card-text.content p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.82;
}
#post-list .post-meta .categories {
  color: var(--zw-accent);
  font-weight: 600;
}

/* ---------- Categories index ---------- */
.zw-cat-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 1.6rem 1.4rem 1.4rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--zw-border);
  background:
    radial-gradient(700px 240px at 0% 0%, rgba(99,102,241,.28), transparent 60%),
    radial-gradient(500px 200px at 100% 0%, rgba(34,211,238,.18), transparent 55%),
    var(--zw-surface);
}
.zw-cat-hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.zw-cat-hero p {
  margin: 0;
  color: var(--zw-hero-muted);
}

.zw-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.zw-cat-grid .card.categories {
  margin: 0 !important;
  border-radius: 16px !important;
  border: 1px solid var(--zw-border) !important;
  background: var(--zw-surface) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: transform 0.25s var(--zw-ease), box-shadow 0.25s, border-color 0.25s;
}
.zw-cat-grid .card.categories:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.4) !important;
  box-shadow: 0 14px 32px rgba(99, 102, 241, 0.12);
}
.zw-cat-grid .card-header {
  background: transparent !important;
  padding: 1.05rem 1rem !important;
  border: 0 !important;
}
.zw-cat-grid .card-header a {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none !important;
}
.zw-cat-grid .card-header .fa-folder,
.zw-cat-grid .card-header .fa-folder-open {
  color: var(--zw-accent);
}
.zw-cat-grid .category-trigger {
  opacity: 0.45;
}

/* ---------- Category post list ---------- */
#page-category > h1 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}
#page-category > h1 .lead {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--zw-accent) !important;
  font-size: 0.9rem;
  font-weight: 700;
}

.zw-cat-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0 !important;
  display: grid;
  gap: 0.7rem;
}
.zw-cat-list > li {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem !important;
  margin: 0 !important;
  border-radius: 14px;
  border: 1px solid var(--zw-border);
  background: var(--zw-surface);
  backdrop-filter: blur(10px);
  transition: transform 0.22s var(--zw-ease), border-color 0.22s, box-shadow 0.22s;
}
.zw-cat-list > li:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.1);
}
.zw-cat-list > li a {
  font-weight: 650;
  text-decoration: none !important;
  flex: 1 1 auto;
  min-width: 0;
}
.zw-cat-list .dash {
  display: none !important;
}
.zw-cat-list .text-muted.small {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* Sidebar polish */
#sidebar {
  border-right: 1px solid var(--zw-border);
}
#sidebar .nav-link {
  border-radius: 10px;
  margin: 0.15rem 0;
  transition: background 0.2s, color 0.2s;
}
#sidebar .nav-link:hover {
  background: rgba(99, 102, 241, 0.1);
}
#avatar img {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 8px 20px rgba(0,0,0,.15);
}

/* Topbar subtle glass */
#topbar-wrapper,
#topbar {
  backdrop-filter: blur(10px);
}


/* ---------- Mermaid diagrams ---------- */
.zw-mermaid,
div.mermaid.zw-mermaid {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 0.75rem;
  overflow-x: auto;
  text-align: center;
  border-radius: 14px;
  border: 1px solid var(--zw-border);
  background: var(--zw-surface);
  box-shadow: var(--zw-shadow);
}
.zw-mermaid svg {
  max-width: 100%;
  height: auto;
}
