/* ==========================================================================
   Folio Theme for Halo 2 — Minimal Cards + Editorial Reading
   Zero external font dependencies, optimized for fast loading on low bandwidth
   ========================================================================== */

:root {
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --bg: #f7f8fa;
  --bg-editorial: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --header-bg: rgba(255, 255, 255, 0.82);
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 28px -10px rgba(15, 23, 42, 0.1);
  --code-bg: #f4f5f7;
  --pre-bg: #161822;
  --pre-text: #e4e7ef;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, monospace;
  --container-width: 860px;
  --reading-width: 720px;
}

[data-theme="dark"] {
  --accent-soft: rgba(96, 165, 250, 0.14);
  --bg: #0d1016;
  --bg-editorial: #10131a;
  --surface: #151923;
  --surface-subtle: #1d2230;
  --header-bg: rgba(13, 16, 22, 0.82);
  --text: #f4f4f5;
  --text-secondary: #b4b8c2;
  --text-muted: #808695;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 14px 32px -12px rgba(0, 0, 0, 0.55);
  --code-bg: #1e2330;
  --pre-bg: #0b0d13;
  --pre-text: #e4e7ef;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.page-editorial {
  background: var(--bg-editorial);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ==========================================================================
   Header & Navigation (3 Floating Rounded Boxes + Auto Hide on Scroll Down)
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 14px 0 6px;
  background: transparent;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

.site-header.header-hidden {
  transform: translateY(-120%);
  opacity: 0;
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.site-brand,
.nav-box,
.header-actions {
  pointer-events: auto;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 18px -6px rgba(15, 23, 42, 0.08);
  height: 46px;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.2s ease;
}

[data-theme="dark"] .site-brand,
[data-theme="dark"] .nav-box,
[data-theme="dark"] .header-actions {
  box-shadow: 0 6px 22px -6px rgba(0, 0, 0, 0.45);
}

.site-brand {
  padding: 0 16px;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text);
  flex-shrink: 0;
}

.site-brand:hover {
  border-color: var(--border-strong);
}

.site-brand img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-box {
  padding: 0 6px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--surface-subtle);
}

.header-actions {
  padding: 0 6px;
  gap: 4px;
  position: relative;
}

/* ==========================================================================
   Contact Postcard Hover Popover
   ========================================================================== */

.contact-popover-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.contact-postcard {
  position: absolute;
  top: calc(100% + 14px);
  right: -6px;
  width: 320px;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
  z-index: 60;
  pointer-events: none;
}

[data-theme="dark"] .contact-postcard {
  background: #171b26;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 44px -12px rgba(0, 0, 0, 0.65);
}

/* Hover bridge so moving cursor from button to postcard won't close it */
.contact-popover-wrap::after {
  content: "";
  position: absolute;
  top: 100%;
  right: -10px;
  width: 140px;
  height: 18px;
  display: none;
}

.contact-popover-wrap:hover::after,
.contact-popover-wrap.open::after {
  display: block;
}

.contact-popover-wrap:hover .contact-postcard,
.contact-popover-wrap:focus-within .contact-postcard,
.contact-popover-wrap.open .contact-postcard {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.postcard-stripe {
  height: 5px;
  background: repeating-linear-gradient(
    -45deg,
    #dc2626 0 10px,
    transparent 10px 16px,
    #2563eb 16px 26px,
    transparent 26px 32px
  );
  opacity: 0.78;
}

.postcard-inner {
  padding: 16px 18px 18px;
  position: relative;
}

.postcard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.postcard-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3px;
}

.postcard-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--text);
}

.postcard-note {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.postcard-stamp {
  width: 54px;
  height: 54px;
  padding: 3px;
  flex-shrink: 0;
  border: 2px dashed rgba(37, 99, 235, 0.35);
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.postcard-stamp img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.postcard-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.postcard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.035);
  border-bottom: 1px dashed var(--border-strong);
}

[data-theme="dark"] .postcard-row {
  background: rgba(255, 255, 255, 0.04);
}

.postcard-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.postcard-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-bottom: 2px;
}

.postcard-value {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.postcard-copy-btn {
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 500;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.postcard-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.mobile-menu-btn {
  display: none;
}

.mobile-nav-drawer {
  display: none;
  pointer-events: auto;
  margin: 10px 24px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 10px;
}

.mobile-nav-drawer.open {
  display: block;
}

.mobile-nav-drawer a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.96rem;
  color: var(--text-secondary);
}

.mobile-nav-drawer a:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

/* ==========================================================================
   Main Container & Homepage Hero
   ========================================================================== */

.site-main {
  flex: 1;
  width: 100%;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 36px 20px 64px;
}

.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.header-inner {
  max-width: 1440px;
}

.footer-inner {
  max-width: 1440px;
}

.hero-section {
  margin-bottom: 28px;
  padding: 4px 2px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 2.8vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.hero-bio {
  margin: 0;
  max-width: 620px;
  font-size: 0.96rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ==========================================================================
   Vertical Post Cards Grid (5 per row on wide desktop)
   ========================================================================== */

.post-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.post-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface-subtle), var(--border));
  flex-shrink: 0;
}

.post-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-cover img {
  transform: scale(1.05);
}

.post-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-muted);
  opacity: 0.35;
  background: radial-gradient(circle at 25% 25%, var(--accent-soft), transparent 65%),
    var(--surface-subtle);
}

.post-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-pin-badge,
.post-rec-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.post-pin-badge {
  background: rgba(15, 23, 42, 0.74);
}

.post-rec-badge {
  background: rgba(234, 88, 12, 0.86);
}

.post-card-body {
  flex: 1;
  min-width: 0;
  padding: 15px 16px 14px;
  display: flex;
  flex-direction: column;
}

.post-card-title {
  margin: 0 0 8px;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card:hover .post-card-title {
  color: var(--accent);
}

.post-card-excerpt {
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.post-card-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  white-space: nowrap;
}

.meta-item svg {
  width: 13px;
  height: 13px;
  opacity: 0.75;
  flex-shrink: 0;
}

.post-card-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
  position: relative;
  z-index: 2;
}

.post-card-cat::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.post-card-cat:hover {
  color: var(--accent);
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
  z-index: 2;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  transition: background-color 0.16s ease, color 0.16s ease;
}

.pill:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Pagination */
.pagination {
  margin-top: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.disabled {
  opacity: 0.38;
  pointer-events: none;
}

.page-info {
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Editorial Reading Layout (Post & Single Page)
   ========================================================================== */

.article-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 44px 20px 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--reading-width)) 220px;
  gap: 0 36px;
}

.article-main {
  grid-column: 2;
  min-width: 0;
}

.article-header {
  margin-bottom: 34px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.article-title {
  margin: 0 0 16px;
  font-size: clamp(1.85rem, 3.6vw, 2.45rem);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.025em;
  color: var(--text);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.article-cover {
  margin: 26px 0 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.article-cover img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

/* Editorial Typography (Prose) */
.prose {
  font-size: 16.5px;
  line-height: 1.88;
  color: var(--text);
  word-wrap: break-word;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  font-weight: 750;
  line-height: 1.38;
  letter-spacing: -0.015em;
  scroll-margin-top: 84px;
}

.prose h2 {
  font-size: 1.48rem;
  margin: 2.3em 0 0.85em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.2rem;
  margin: 1.8em 0 0.7em;
}

.prose h4 {
  font-size: 1.05rem;
  margin: 1.4em 0 0.5em;
}

.prose p {
  margin: 1.2em 0;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.35);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.16s ease;
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

.prose ul,
.prose ol {
  margin: 1.15em 0;
  padding-left: 1.55em;
}

.prose li {
  margin: 0.45em 0;
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 0.75em 1.2em;
  border-left: 3px solid var(--accent);
  background: var(--surface-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.prose blockquote p {
  margin: 0.35em 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}

.prose img {
  margin: 1.8em auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--code-bg);
}

.prose pre {
  position: relative;
  margin: 1.6em 0;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--pre-bg);
  color: var(--pre-text);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.65;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
  font-size: 0.75rem;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

/* Clean Responsive Tables inside Articles */
.prose table {
  width: 100% !important;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.prose th,
.prose td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.prose th {
  background: var(--surface-subtle);
  font-weight: 600;
  color: var(--text);
}

.prose tr:last-child td {
  border-bottom: none;
}

/* Floating Right TOC */
.toc-aside {
  grid-column: 3;
  position: relative;
}

.toc-sticky {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.toc-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 4px 0;
}

.toc-list a {
  display: block;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
  padding: 3px 0;
  transition: color 0.15s ease;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--accent);
  font-weight: 600;
}

.toc-level-3 {
  padding-left: 12px;
}

/* License & Prev/Next & Comments */
.article-license {
  margin-top: 40px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.post-nav-cards {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.post-nav-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.post-nav-card.next {
  text-align: right;
}

.post-nav-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.post-nav-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.comment-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.comment-heading {
  margin: 0 0 18px;
  font-size: 1.15rem;
  font-weight: 700;
}

/* ==========================================================================
   Custom Navigation / Bookmarks Card Page (page-nav.html)
   ========================================================================== */

.nav-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
  transition: all 0.18s ease;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.nav-search {
  width: 220px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.18s ease;
}

.nav-search:focus {
  border-color: var(--accent);
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.nav-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.nav-card.hidden {
  display: none;
}

.nav-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  margin-top: 2px;
}

.nav-card-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-card-body {
  flex: 1;
  min-width: 0;
}

.nav-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.nav-card-name {
  font-weight: 650;
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-card-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.nav-card-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Archives, Categories, Tags Pages
   ========================================================================== */

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.archive-year {
  margin: 28px 0 12px;
  font-size: 1.25rem;
  font-weight: 750;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.archive-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item:hover {
  background: var(--surface-subtle);
}

.archive-item-title {
  font-weight: 550;
  color: var(--text);
}

.archive-item-date {
  font-size: 0.84rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.taxonomy-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.taxonomy-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
}

.taxonomy-count {
  font-size: 0.8rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-cloud .pill {
  padding: 7px 14px;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Footer & Back-to-top
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 20px 36px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

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

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 24px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.2s ease;
  z-index: 30;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1280px) {
  .post-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .article-shell {
    display: block;
    max-width: calc(var(--reading-width) + 40px);
  }
  .toc-aside {
    display: none;
  }
}

@media (max-width: 1000px) {
  .post-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .nav-box {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .post-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .post-nav-cards {
    grid-template-columns: 1fr;
  }
  .nav-search {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .post-list {
    grid-template-columns: 1fr;
  }
}
