/* ========================================
   Magazine Theme — Main Stylesheet
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Colors - Light */
  --color-bg: #f8f6fc;
  --color-bg-secondary: #f0edf7;
  --color-bg-card: rgba(255, 255, 255, 0.78);
  --color-bg-code: #eeebf6;
  --color-text: #211a33;
  --color-text-secondary: #645b75;
  --color-text-muted: #978da9;
  --color-border: rgba(67, 48, 94, 0.14);
  --color-border-light: rgba(67, 48, 94, 0.08);

  /* Accent */
  --color-primary: #7450e8;
  --color-primary-hover: #5f3dd0;
  --color-primary-light: #eee8ff;
  --color-primary-subtle: rgba(116, 80, 232, 0.10);
  --color-accent: #f0637c;
  --color-accent-light: #ffe7eb;
  --color-cyan: #1aa89c;
  --color-cyan-subtle: rgba(26, 168, 156, 0.12);
  --gradient-art: linear-gradient(120deg, #7450e8 0%, #b14fc5 48%, #f0637c 100%);

  /* Surface */
  --color-surface: rgba(255, 255, 255, 0.72);
  --color-surface-hover: rgba(255, 255, 255, 0.94);

  /* Shadows */
  --shadow-sm: 0 2px 10px rgba(49, 29, 75, 0.05);
  --shadow-md: 0 12px 30px rgba(49, 29, 75, 0.08);
  --shadow-lg: 0 22px 50px rgba(49, 29, 75, 0.12);
  --shadow-xl: 0 30px 70px rgba(49, 29, 75, 0.16);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* Layout */
  --max-width: 1120px;
  --content-width: 720px;
  --gap: 24px;
  --gap-lg: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-bg: #110d19;
  --color-bg-secondary: #1a1425;
  --color-bg-card: rgba(28, 21, 41, 0.82);
  --color-bg-code: #241b32;
  --color-text: #f5efff;
  --color-text-secondary: #b9acc9;
  --color-text-muted: #7e718f;
  --color-border: rgba(214, 188, 255, 0.14);
  --color-border-light: rgba(214, 188, 255, 0.08);

  --color-primary: #aa8cff;
  --color-primary-hover: #c2acff;
  --color-primary-light: #2e2145;
  --color-primary-subtle: rgba(170, 140, 255, 0.13);
  --color-accent: #ff7890;
  --color-accent-light: #40202c;
  --color-cyan: #55d6c9;
  --color-cyan-subtle: rgba(85, 214, 201, 0.13);
  --gradient-art: linear-gradient(120deg, #aa8cff 0%, #df6fc5 50%, #ff7890 100%);

  --color-surface: rgba(30, 23, 44, 0.8);
  --color-surface-hover: rgba(39, 29, 56, 0.95);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 9% 8%, rgba(177, 79, 197, 0.12), transparent 27rem),
    radial-gradient(circle at 88% 34%, rgba(26, 168, 156, 0.09), transparent 30rem),
    radial-gradient(circle at 52% 100%, rgba(240, 99, 124, 0.08), transparent 34rem);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

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

/* --- Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* --- Layout Wrapper (sidebar + main) --- */
.layout-wrapper {
  display: flex;
  gap: var(--gap-lg);
  max-width: calc(var(--max-width) + 240px + var(--gap-lg));
  margin: 0 auto;
  padding: 0 var(--gap);
}

.main {
  flex: 1;
  min-width: 0;
  max-width: var(--max-width);
}

/* --- Sidebar --- */
.sidebar {
  width: 300px;
  flex-shrink: 0;
  padding-top: 48px;
}

.sidebar__inner {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* Sidebar scrollbar */
.sidebar__inner::-webkit-scrollbar {
  width: 4px;
}

.sidebar__inner::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar__inner::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

@supports not selector(::-webkit-scrollbar) {
  .sidebar__inner {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
  }
}

.sidebar__section {
  padding-bottom: 24px;
}

.sidebar__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.sidebar__count {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.sidebar__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.sidebar__item:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .sidebar__item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar__item.is-active {
  color: var(--color-text);
  background: linear-gradient(100deg, var(--color-primary-subtle), var(--color-cyan-subtle));
  box-shadow: inset 3px 0 0 var(--color-primary);
  font-weight: 500;
}

.sidebar__date {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  font-family: var(--font-mono);
}

.sidebar__item.is-active .sidebar__date {
  color: var(--color-primary);
}

.sidebar__post-title {
  line-height: 1.4;
  word-break: break-word;
  min-width: 0;
}

.sidebar__year {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-primary);
  padding: 10px 10px 4px;
  letter-spacing: 0.03em;
}

.sidebar__empty {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 246, 252, 0.74);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--color-border);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

[data-theme="dark"] .header {
  background: rgba(17, 13, 25, 0.76);
}

.header__inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: var(--gap);
}

.header__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header__logo {
  background: var(--gradient-art);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header__logo:hover {
  color: var(--color-primary);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.header__link {
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.header__link:hover {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.header__social {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 20px;
}

.header__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.header__social-link:hover {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

html:not([data-theme="dark"]) .theme-toggle .icon-moon,
[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

html:not([data-theme="dark"]) .theme-toggle .icon-sun,
[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

.theme-toggle svg {
  position: absolute;
}

/* Menu Toggle (Mobile) */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}

/* --- Hero Section --- */
.hero {
  padding: 72px 28px 64px;
  margin-top: 36px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(116, 80, 232, 0.18);
  border-radius: 30px;
  background:
    radial-gradient(circle at 88% 20%, rgba(240, 99, 124, 0.24), transparent 13rem),
    radial-gradient(circle at 72% 96%, rgba(26, 168, 156, 0.18), transparent 16rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.90), rgba(240, 235, 253, 0.74));
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 120, 144, 0.24), transparent 13rem),
    radial-gradient(circle at 72% 96%, rgba(85, 214, 201, 0.15), transparent 16rem),
    linear-gradient(135deg, rgba(36, 27, 52, 0.96), rgba(23, 17, 34, 0.90));
}

.hero::after {
  content: '';
  position: absolute;
  width: 230px;
  height: 230px;
  right: -55px;
  top: -70px;
  border: 1px solid rgba(116, 80, 232, 0.18);
  border-radius: 42% 58% 63% 37% / 46% 34% 66% 54%;
  transform: rotate(18deg);
  background: rgba(255, 255, 255, 0.10);
}

.hero__article {
  max-width: var(--content-width);
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.hero__category {
  color: var(--color-primary);
  font-weight: 500;
}

.hero__title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero__title a {
  background: var(--gradient-art);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: color var(--transition-fast);
}

.hero__title a:hover {
  color: var(--color-primary);
}

.hero__excerpt {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.hero__readmore {
  display: inline-flex;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  gap: 4px;
  transition: gap var(--transition-fast);
}

.hero__readmore:hover {
  gap: 8px;
  color: var(--color-primary-hover);
}

/* --- Hero Sphere (3D 文章球体 · 深空科技风) --- */
.hero-sphere {
  position: relative;
  height: 540px;
  margin-top: 36px;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background:
    radial-gradient(circle at 50% 35%, rgba(56, 189, 248, 0.13), transparent 20rem),
    radial-gradient(circle at 82% 78%, rgba(232, 121, 249, 0.12), transparent 18rem),
    radial-gradient(circle at 15% 12%, rgba(45, 212, 191, 0.10), transparent 16rem),
    linear-gradient(160deg, #0b1020 0%, #0e0a1f 55%, #120b24 100%);
  box-shadow: var(--shadow-md);
}

.hero-sphere::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 30px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.22));
}

.hero-sphere__inner {
  position: absolute;
  inset: 0;
}

.hero-sphere__inner canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hero-sphere__overlay {
  position: absolute;
  left: 32px;
  top: 28px;
  z-index: 2;
  pointer-events: none;
}

.hero-sphere__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #eaf6ff;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.55), 0 0 60px rgba(56, 189, 248, 0.25);
}

.hero-sphere__count {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: #7dd3fc;
  opacity: 0.85;
}

.hero-sphere__loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  transition: opacity var(--transition-base);
}

.hero-sphere--ready .hero-sphere__loading {
  opacity: 0;
}

.hero-sphere--fallback .hero-sphere__inner {
  display: none;
}

.hero-sphere__tip {
  position: absolute;
  z-index: 3;
  max-width: 240px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(10, 16, 34, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #eaf6ff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Section Header --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-top: 48px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: 16px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--gradient-art);
}

/* --- Category Filter --- */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.category-filter__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-filter__tab:hover {
  border-color: rgba(116, 80, 232, 0.32);
  color: var(--color-text);
}

.category-filter__tab.is-active {
  color: #fff;
  background: linear-gradient(100deg, var(--color-primary), var(--color-accent));
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.category-filter__count {
  font-size: 0.75rem;
  opacity: 0.75;
}

/* Main-area filter: only shown on mobile (sidebar is hidden there) */
.category-filter--main {
  display: none;
}

/* Sidebar filter: compact pills */
.category-filter--sidebar {
  gap: 6px;
  margin-bottom: 0;
}

.category-filter--sidebar .category-filter__tab {
  padding: 4px 12px;
  font-size: 0.8125rem;
}

.category-filter--sidebar .category-filter__count {
  font-size: 0.6875rem;
}

/* --- Post Grid --- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  padding-bottom: 48px;
}

/* --- Post Card --- */
.post-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 22px;
  overflow: hidden;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.post-card::before {
  content: '';
  height: 4px;
  background: var(--gradient-art);
}

.post-card:nth-child(3n + 2)::before {
  background: linear-gradient(90deg, var(--color-cyan), var(--color-primary));
}

.post-card:nth-child(3n)::before {
  background: linear-gradient(90deg, var(--color-accent), #f2a65a);
}

.post-card:hover {
  border-color: rgba(116, 80, 232, 0.32);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.post-card__image {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-secondary);
}

.post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.post-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.post-card__category {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border-radius: 999px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.post-card__category:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-hover);
}

.post-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.post-card__title a {
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.post-card__title a:hover {
  color: var(--color-primary);
}

.post-card__excerpt {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-light);
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-card__more {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* --- Tags --- */
.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  background: linear-gradient(100deg, var(--color-primary-subtle), var(--color-cyan-subtle));
  border: 1px solid rgba(116, 80, 232, 0.10);
  padding: 2px 8px;
  border-radius: 100px;
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--color-primary);
  color: white;
}

/* --- Post Page --- */
.post {
  padding: 48px 0 64px;
}

.post__header {
  position: relative;
}

.post__header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 96px;
  height: 2px;
  background: var(--gradient-art);
}

.post__title {
  background: var(--gradient-art);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.post__layout {
  display: grid;
  grid-template-columns: minmax(0, var(--content-width)) 220px;
  grid-template-areas:
    "header toc"
    "content toc"
    "footer toc";
  justify-content: center;
  column-gap: 40px;
  align-items: start;
}

.post__header {
  grid-area: header;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}

.post__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.post__views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.post__views::before {
  content: '·';
  margin-right: 10px;
  color: var(--color-border);
}

.post__category a {
  color: var(--color-primary);
  font-weight: 500;
}

.post__title {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

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

/* --- Post Content (shared with page) --- */
.post__content {
  grid-area: content;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--color-text);
}

.post__content h1,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6 {
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2em;
  margin-bottom: 0.6em;
  letter-spacing: -0.02em;
  color: var(--color-text);
  scroll-margin-top: 88px;
}

/* --- Post Table of Contents --- */
.post-toc {
  grid-area: toc;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  margin-top: 4px;
  padding: 14px 0 14px 16px;
  border-left: 1px solid var(--color-border);
  scrollbar-color: var(--color-primary-subtle) transparent;
}

.post-toc[hidden] {
  display: none;
}

.post-toc__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 8px 10px 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.post-toc__chevron {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.post-toc.is-collapsed .post-toc__chevron {
  transform: rotate(-90deg);
}

.post-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-toc.is-collapsed .post-toc__nav {
  display: none;
}

.post-toc__link {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.45;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.post-toc__link--h3 {
  padding-left: 20px;
  color: var(--color-text-muted);
}

.post-toc__link:hover {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.post-toc__link.is-active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--color-primary);
}

.post__content h1 {
  font-size: 2rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.3em;
}

.post__content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 0.25em;
}

.post__content h3 { font-size: 1.25rem; }
.post__content h4 { font-size: 1.125rem; }
.post__content h5 { font-size: 1rem; }
.post__content h6 { font-size: 0.875rem; color: var(--color-text-secondary); }

.post__content p {
  margin-bottom: 1.2em;
}

.post__content a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--color-primary);
  text-decoration-thickness: 1px;
}

.post__content strong {
  font-weight: 600;
}

.post__content blockquote {
  margin: 1.5em 0;
  padding: 16px 20px;
  border-left: 4px solid var(--color-accent);
  background: linear-gradient(100deg, var(--color-primary-subtle), transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
}

.post__content blockquote p:last-child {
  margin-bottom: 0;
}

.post__content ul,
.post__content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.post__content li {
  margin-bottom: 0.4em;
}

.post__content hr {
  margin: 2em 0;
  border: none;
  height: 1px;
  background: var(--color-border);
}

.post__content img {
  border-radius: var(--radius-md);
  margin: 1.5em auto;
  box-shadow: var(--shadow-md);
}

/* --- Inline Code --- */
.post__content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  background: var(--color-bg-code);
  border-radius: 4px;
  color: var(--color-text);
}

.post__content pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-size: 0.875rem;
}

/* --- Fenced Code Blocks (standalone <pre>) --- */
.post__content pre {
  margin: 1.5em 0;
  padding: 16px 20px;
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: #24292f;
}

[data-theme="dark"] .post__content pre {
  background: #161b22;
  border-color: #30363d;
  color: #e6edf3;
}

/* --- Hexo highlight figure --- */
.post__content figure.highlight {
  margin: 1.5em 0;
  border-radius: var(--radius-md);
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  overflow-x: auto;
  position: relative;
}

[data-theme="dark"] .post__content figure.highlight {
  background: #161b22;
  border-color: #30363d;
}

/* Hide gutter (line numbers) */
.post__content figure.highlight .gutter {
  display: none;
}

.post__content figure.highlight table {
  width: 100%;
  margin: 0;
  border: none;
  border-collapse: collapse;
}

.post__content figure.highlight td {
  padding: 0;
  border: none;
}

.post__content figure.highlight .code pre {
  margin: 0;
  padding: 16px 20px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #24292f;
  font-size: 0.875rem;
  line-height: 1.6;
  overflow: visible;
  font-family: var(--font-mono);
  width: max-content;
  min-width: 100%;
}

[data-theme="dark"] .post__content figure.highlight .code pre {
  color: #e6edf3;
}

/* Code block scrollbar */
.post__content figure.highlight::-webkit-scrollbar {
  height: 5px;
}

.post__content figure.highlight::-webkit-scrollbar-track {
  background: transparent;
}

.post__content figure.highlight::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

[data-theme="dark"] .post__content figure.highlight::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

.post__content figure.highlight::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .post__content figure.highlight::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

@supports not selector(::-webkit-scrollbar) {
  .post__content figure.highlight {
    scrollbar-width: thin;
  }
}

/* -- Inline code in dark mode -- */
[data-theme="dark"] .post__content code {
  background: rgba(110, 118, 129, 0.4);
}

/* highlight.js - GitHub Dark Dimmed inspired syntax colors */
.post__content .hljs-keyword,
.post__content .hljs-selector-tag,
.post__content .hljs-type { color: #d73a49; }

.post__content .hljs-string,
.post__content .hljs-addition { color: #0a3069; }

.post__content .hljs-number,
.post__content .hljs-literal { color: #0550ae; }

.post__content .hljs-comment,
.post__content .hljs-quote { color: #6e7781; font-style: italic; }

.post__content .hljs-built_in,
.post__content .hljs-builtin-name { color: #8250df; }

.post__content .hljs-function,
.post__content .hljs-title,
.post__content .hljs-title.function_ { color: #8250df; }

.post__content .hljs-attr,
.post__content .hljs-attribute,
.post__content .hljs-variable { color: #953800; }

.post__content .hljs-params { color: #24292f; }

.post__content .hljs-regexp { color: #0a3069; }

.post__content .hljs-meta { color: #0550ae; }

.post__content .hljs-tag { color: #116329; }

.post__content .hljs-name { color: #116329; }

.post__content .hljs-selector-class { color: #0550ae; }

.post__content .hljs-punctuation { color: #24292f; }

.post__content .hljs-deletion { color: #bd2c00; }

/* Dark mode syntax colors - GitHub Dark Dimmed */
[data-theme="dark"] .post__content .hljs-keyword,
[data-theme="dark"] .post__content .hljs-selector-tag,
[data-theme="dark"] .post__content .hljs-type { color: #ff7b72; }

[data-theme="dark"] .post__content .hljs-string,
[data-theme="dark"] .post__content .hljs-addition { color: #a5d6ff; }

[data-theme="dark"] .post__content .hljs-number,
[data-theme="dark"] .post__content .hljs-literal { color: #79c0ff; }

[data-theme="dark"] .post__content .hljs-comment,
[data-theme="dark"] .post__content .hljs-quote { color: #8b949e; font-style: italic; }

[data-theme="dark"] .post__content .hljs-built_in,
[data-theme="dark"] .post__content .hljs-builtin-name { color: #d2a8ff; }

[data-theme="dark"] .post__content .hljs-function,
[data-theme="dark"] .post__content .hljs-title,
[data-theme="dark"] .post__content .hljs-title.function_ { color: #d2a8ff; }

[data-theme="dark"] .post__content .hljs-attr,
[data-theme="dark"] .post__content .hljs-attribute,
[data-theme="dark"] .post__content .hljs-variable { color: #ffa657; }

[data-theme="dark"] .post__content .hljs-params { color: #e6edf3; }

[data-theme="dark"] .post__content .hljs-regexp { color: #a5d6ff; }

[data-theme="dark"] .post__content .hljs-meta { color: #79c0ff; }

[data-theme="dark"] .post__content .hljs-tag { color: #7ee787; }

[data-theme="dark"] .post__content .hljs-name { color: #7ee787; }

[data-theme="dark"] .post__content .hljs-selector-class { color: #79c0ff; }

[data-theme="dark"] .post__content .hljs-punctuation { color: #e6edf3; }

[data-theme="dark"] .post__content .hljs-deletion { color: #ffa198; }

.post__content table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.post__content th,
.post__content td {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  text-align: left;
}

.post__content th {
  background: var(--color-bg-secondary);
  font-weight: 600;
}

/* Post Navigation */
.post__footer {
  grid-area: footer;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.comments {
  margin-bottom: 48px;
}

.comments__header {
  margin-bottom: 24px;
}

.comments__eyebrow {
  margin-bottom: 6px;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.comments__title {
  margin-bottom: 8px;
  color: var(--color-text);
  font-size: 1.375rem;
  line-height: 1.35;
}

.comments__description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.giscus,
.giscus-frame {
  width: 100%;
}

.post__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.post__nav-link {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
}

.post__nav-link:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.post__nav-next {
  text-align: right;
}

.post__nav-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.post__nav-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post__nav-link:hover .post__nav-title {
  color: var(--color-primary);
}

/* --- Page --- */
.page {
  padding: 48px 0 64px;
}

.page__container {
  max-width: var(--content-width);
}

.page__header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.page__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- Archive --- */
.archive {
  padding: 48px 0 64px;
}

.archive__header {
  margin-bottom: 40px;
}

.archive__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.archive__count {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.archive__year {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.archive__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-light);
  transition: padding var(--transition-fast);
}

.archive__item:hover {
  padding-left: 8px;
}

.archive__date {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  min-width: 60px;
  font-variant-numeric: tabular-nums;
}

.archive__link {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
}

.archive__link:hover {
  color: var(--color-primary);
}

.archive__tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* --- Tags Page (Cloud) --- */
.tags-page,
.categories-page,
.tag-page,
.category-page {
  padding: 48px 0 64px;
}

.tags-page__header,
.categories-page__header {
  margin-bottom: 40px;
}

.tags-page__title,
.categories-page__title,
.tag-page__title,
.category-page__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.tags-page__count,
.categories-page__count {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.tag-page__back,
.category-page__back {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.tags__cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.tag-cloud__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.tag-cloud__item:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-1px);
}

.tag-cloud__count {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* --- Categories Page (Grid) --- */
.categories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--gap);
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 24px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.category-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.category-card__name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.category-card__count {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.category-card__main {
  display: block;
  text-decoration: none;
  color: inherit;
}

.category-card__subs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--color-border-light);
}

.category-card__sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  background: var(--color-primary-subtle);
  border-radius: 999px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.category-card__sub:hover {
  background: var(--color-primary);
  color: #fff;
}

.category-card__sub span {
  font-size: 0.6875rem;
  opacity: 0.7;
}

.category-page__subs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.category-page__sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 0.8125rem;
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border-radius: 999px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.category-page__sub:hover {
  background: var(--color-primary);
  color: #fff;
}

.category-page__sub span {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* --- Search --- */
.search-page {
  padding: 48px 0 64px;
}

.search-page__header {
  margin-bottom: 32px;
}

.search-page__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.search__box {
  position: relative;
  margin-bottom: 32px;
}

.search__input {
  width: 100%;
  padding: 16px 20px;
  padding-left: 52px;
  font-size: 1.125rem;
  font-family: var(--font-sans);
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  outline: none;
  transition: all var(--transition-fast);
}

.search__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-subtle);
}

.search__input::placeholder {
  color: var(--color-text-muted);
}

.search__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.search__results {
  min-height: 200px;
}

.search__hint {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.search__result-item {
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}

.search__result-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.search__result-item a {
  color: var(--color-text);
}

.search__result-item:hover a {
  color: var(--color-primary);
}

.search__result-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.search__result-excerpt {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.search__result-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* --- Pagination --- */
.pagination {
  padding: 32px 0 64px;
}

.pagination__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.pagination__prev,
.pagination__next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.pagination__prev:hover,
.pagination__next:hover {
  background: var(--color-primary);
  color: white;
}

.pagination__info {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 40px 0;
  background: linear-gradient(180deg, transparent, var(--color-primary-subtle));
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.footer__social {
  display: flex;
  gap: 20px;
}

.footer__social-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.footer__social-link:hover {
  color: var(--color-primary);
}

.footer__copy {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.footer__copy a {
  color: var(--color-text-muted);
}

.footer__copy a:hover {
  color: var(--color-primary);
}

/* --- Empty Message --- */
.empty-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* --- Cat & Mouse Container --- */
.cat-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.cat-body {
  position: fixed;
  width: 42px;
  height: 36px;
  will-change: transform, left, top;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
  transition: none;
  z-index: 999;
}

.cat-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mouse-body {
  position: fixed;
  width: 22px;
  height: 18px;
  will-change: transform, left, top;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
  transition: none;
  z-index: 998;
}

.mouse-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Tunnel --- */
.tunnel {
  position: fixed;
  width: 100px;
  height: 28px;
  pointer-events: none;
  z-index: 997;
  opacity: 0.9;
}

.tunnel-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Cat Win Label --- */
.cat-win-label {
  position: fixed;
  font-size: 0.75rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(255,255,255,0.9);
  padding: 2px 8px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  line-height: 1.5;
}

[data-theme="dark"] .cat-win-label {
  background: rgba(15, 23, 42, 0.9);
  color: #34d399;
}

.cat-win-label.show {
  opacity: 1;
  transform: scale(1);
}

/* --- Entrance Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero__article {
  animation: fadeUp 0.6s ease-out both;
}

.post-card {
  animation: fadeUp 0.5s ease-out both;
}

.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
.post-card:nth-child(6) { animation-delay: 0.3s; }

/* Post page content fade-in */
.post__header {
  animation: fadeUp 0.5s ease-out both;
}

.post__content {
  animation: fadeUp 0.5s ease-out 0.15s both;
}

/* Post card extra hover */
.post-card {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* --- Copy Code Button --- */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
  line-height: 1.4;
}

.post__content pre:hover .copy-btn,
.post__content figure.highlight:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

[data-theme="dark"] .copy-btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
}

/* --- Utilities --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ========================================
   Link Card（链接磁贴）
   ======================================== */

.link-card {
  display: flex;
  align-items: stretch;
  margin: 1.5em 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--color-text);
}

.link-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.link-card__img {
  flex-shrink: 0;
  width: 200px;
  min-height: 130px;
  background: var(--color-bg-secondary);
  overflow: hidden;
  position: relative;
}

.link-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.link-card:hover .link-card__img img {
  transform: scale(1.06);
}

.link-card__img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card__favicon {
  font-size: 2rem;
  opacity: 0.6;
}

.link-card__body {
  flex: 1;
  min-width: 0;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.link-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card__desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
}

.link-card__host {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-card__arrow {
  flex-shrink: 0;
  margin-left: 8px;
  color: var(--color-primary);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: all 0.25s ease;
}

.link-card:hover .link-card__arrow {
  opacity: 1;
  transform: translate(0, 0);
}

/* Card inside figure / narrow containers — stack vertically */
.link-card--stacked {
  flex-direction: column;
}

.link-card--stacked .link-card__img {
  width: 100%;
  height: 160px;
  min-height: auto;
}

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

/* Compact desktop / tablet: place the TOC above the article body. */
@media (max-width: 1400px) {
  .post__layout {
    grid-template-columns: minmax(0, var(--content-width));
    grid-template-areas:
      "header"
      "toc"
      "content"
      "footer";
  }

  .post-toc {
    position: static;
    max-height: none;
    margin: -16px 0 32px;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
  }

  .post-toc__toggle {
    padding: 0;
  }

  .post-toc:not(.is-collapsed) .post-toc__toggle {
    padding-bottom: 10px;
  }

  .post-toc__nav {
    max-height: 50vh;
    overflow-y: auto;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .layout-wrapper {
    gap: var(--gap);
  }

  .sidebar {
    width: 260px;
  }

  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero__title {
    font-size: 2rem;
  }

  .post__title {
    font-size: 1.75rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .hero-sphere {
    height: 400px;
    margin-top: 20px;
    border-radius: 20px;
  }

  .hero-sphere::after {
    border-radius: 20px;
  }

  .hero-sphere__overlay {
    left: 20px;
    top: 18px;
  }

  .hero-sphere__title {
    font-size: 1.35rem;
  }

  .layout-wrapper {
    flex-direction: column;
    gap: 0;
  }

  .sidebar {
    display: none;
  }

  .category-filter--main {
    display: flex;
  }

  .header__inner {
    height: 56px;
  }

  .header__nav {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 8px;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow-lg);
  }

  .header__nav.is-open {
    display: flex;
  }

  .header__link {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
  }

  .menu-toggle {
    display: flex;
  }

  .header__social {
    display: none;
  }

  .hero {
    padding: 40px 0 32px;
  }

  .hero__title {
    font-size: 1.625rem;
  }

  .hero__excerpt {
    font-size: 1rem;
  }

  .post-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .post {
    padding: 32px 0 48px;
  }

  .post__title {
    font-size: 1.5rem;
  }

  .post__header {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }

  .post__nav {
    grid-template-columns: 1fr;
  }

  .section-header {
    padding-top: 32px;
    margin-bottom: 20px;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .archive__item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .archive__tags {
    width: 100%;
    padding-left: 76px;
  }

  .pagination__inner {
    gap: 12px;
  }

  .page__title,
  .archive__title,
  .tags-page__title,
  .search-page__title {
    font-size: 1.5rem;
  }

  /* Link Card — stack on mobile */
  .link-card {
    flex-direction: column;
  }

  .link-card__img {
    width: 100%;
    height: 160px;
    min-height: auto;
  }

  .link-card__body {
    padding: 14px 16px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero__title {
    font-size: 1.375rem;
  }
}

.editorial-hero--without-sphere {
  grid-template-columns: 1fr;
  min-height: 0;
}

.editorial-hero--without-sphere .editorial-hero__copy {
  border-right: 0;
}

html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__copy {
  border-right: 0;
}

/* ========================================
   Editorial Knowledge Atlas · 2026 refresh
   Direction generated with UI/UX Pro Max:
   content-first Swiss grid, scholarly navy,
   citation gold, restrained motion.
   ======================================== */

:root {
  --color-bg: #f4f1ea;
  --color-bg-secondary: #ebe6dc;
  --color-bg-card: rgba(255, 253, 248, 0.92);
  --color-bg-code: #ece7de;
  --color-text: #142235;
  --color-text-secondary: #4c5c6d;
  --color-text-muted: #6f7b86;
  --color-border: rgba(30, 58, 95, 0.22);
  --color-border-light: rgba(30, 58, 95, 0.11);
  --color-primary: #1e3a5f;
  --color-primary-hover: #112b4d;
  --color-primary-light: #dce5ee;
  --color-primary-subtle: rgba(30, 58, 95, 0.09);
  --color-accent: #a75d24;
  --color-accent-light: #f1dfcf;
  --color-cyan: #25756f;
  --color-cyan-subtle: rgba(37, 117, 111, 0.10);
  --gradient-art: linear-gradient(110deg, #1e3a5f 0%, #365c7d 62%, #a75d24 100%);
  --color-surface: rgba(255, 253, 248, 0.88);
  --color-surface-hover: #fffdf8;
  --shadow-sm: 0 1px 2px rgba(20, 34, 53, 0.05), 0 8px 24px rgba(20, 34, 53, 0.04);
  --shadow-md: 0 16px 44px rgba(20, 34, 53, 0.09);
  --shadow-lg: 0 24px 70px rgba(20, 34, 53, 0.13);
  --shadow-xl: 0 32px 90px rgba(20, 34, 53, 0.16);
  --font-sans: 'Public Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Cormorant Garamond', 'Noto Serif SC', Georgia, serif;
  --max-width: 1140px;
  --content-width: 760px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

[data-theme="dark"] {
  --color-bg: #0c1520;
  --color-bg-secondary: #111e2b;
  --color-bg-card: rgba(19, 32, 45, 0.94);
  --color-bg-code: #172738;
  --color-text: #f2eee5;
  --color-text-secondary: #bdc7ce;
  --color-text-muted: #91a0aa;
  --color-border: rgba(210, 224, 232, 0.20);
  --color-border-light: rgba(210, 224, 232, 0.10);
  --color-primary: #a9c6df;
  --color-primary-hover: #d5e6f3;
  --color-primary-light: #20384e;
  --color-primary-subtle: rgba(169, 198, 223, 0.12);
  --color-accent: #dda363;
  --color-accent-light: #4c3320;
  --color-cyan: #67b7ad;
  --color-cyan-subtle: rgba(103, 183, 173, 0.12);
  --gradient-art: linear-gradient(110deg, #dceaf4 0%, #9ec1d9 62%, #dda363 100%);
  --color-surface: rgba(19, 32, 45, 0.90);
  --color-surface-hover: #172838;
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.14);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 28px 76px rgba(0, 0, 0, 0.32);
}

body {
  background-color: var(--color-bg);
  background-image:
    linear-gradient(rgba(30, 58, 95, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 58, 95, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 92% 8%, rgba(167, 93, 36, 0.10), transparent 28rem);
  background-size: 32px 32px, 32px 32px, auto;
}

[data-theme="dark"] body {
  background-image:
    linear-gradient(rgba(210, 224, 232, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 224, 232, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 92% 8%, rgba(221, 163, 99, 0.09), transparent 30rem);
}

h1, h2, h3, h4,
.section-title,
.post__title,
.page__title,
.archive__title,
.tags-page__title,
.search-page__title {
  font-family: var(--font-display);
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: 12px;
  padding: 10px 16px;
  color: #fff;
  background: #1e3a5f;
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.layout-wrapper {
  max-width: 1510px;
  gap: 40px;
}

.sidebar {
  width: 270px;
  padding-top: 40px;
}

.sidebar__inner {
  top: 96px;
  padding: 20px 18px 24px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-bg-card) 82%, transparent);
  box-shadow: var(--shadow-sm);
}

.sidebar__title {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  letter-spacing: 0.14em;
}

.sidebar__item {
  padding: 8px 8px;
  border-radius: 2px;
  transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.sidebar__item:hover {
  background: var(--color-primary-subtle);
}

.sidebar__item.is-active {
  background: var(--color-primary-subtle);
  box-shadow: inset 2px 0 0 var(--color-accent);
}

.sidebar__year {
  color: var(--color-accent);
  letter-spacing: 0.12em;
}

.header {
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  border-bottom-color: var(--color-border-light);
}

[data-theme="dark"] .header {
  background: rgba(12, 21, 32, 0.90);
}

.header__inner {
  height: 72px;
}

.header__brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-shrink: 0;
  color: var(--color-text);
}

.header__logo {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  background: none;
  color: var(--color-text);
}

.header__edition {
  padding-left: 14px;
  border-left: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
}

.header__link {
  position: relative;
  padding: 10px 12px;
  border-radius: 0;
  letter-spacing: 0.02em;
}

.header__link::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.header__link:hover,
.header__link.is-active {
  color: var(--color-text);
  background: transparent;
}

.header__link:hover::after,
.header__link.is-active::after {
  transform: scaleX(1);
}

.theme-toggle,
.menu-toggle,
.header__social-link {
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
}

.editorial-hero {
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(440px, 1.05fr);
  min-height: 520px;
  margin-top: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-md);
}

.editorial-hero__copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 3.5vw, 48px);
  border-right: 1px solid var(--color-border);
}

.editorial-hero__copy::before {
  content: '01';
  position: absolute;
  top: 24px;
  right: 24px;
  color: var(--color-text-muted);
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.12em;
}

.editorial-hero__eyebrow,
.section-kicker,
.hero-sphere__kicker {
  color: var(--color-accent);
  font: 600 0.6875rem/1.4 var(--font-mono);
  letter-spacing: 0.15em;
}

.editorial-hero__title {
  max-width: 11em;
  margin: 22px 0 20px;
  color: var(--color-text);
  font-size: clamp(2.4rem, 3.9vw, 4rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.editorial-hero__title span {
  display: block;
}

.editorial-hero__intro {
  max-width: 36rem;
  color: var(--color-text-secondary);
  font-size: 1rem;
  line-height: 1.8;
}

.editorial-hero__facts {
  display: flex;
  gap: 30px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}

.editorial-hero__facts div {
  display: grid;
  gap: 2px;
}

.editorial-hero__facts strong {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.editorial-hero__facts span {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.editorial-hero__cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  min-height: 44px;
  margin-top: 30px;
  padding: 0 20px;
  color: #fff;
  background: #1e3a5f;
  border-radius: 2px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 180ms ease, gap 180ms ease;
}

.editorial-hero__cta svg {
  width: 18px;
  height: 18px;
}

.editorial-hero__cta:hover {
  gap: 18px;
  color: #fff;
  background: #a75d24;
}

.editorial-hero .hero-sphere {
  height: auto;
  min-height: 520px;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(89, 155, 179, 0.20), transparent 17rem),
    radial-gradient(circle at 82% 78%, rgba(221, 163, 99, 0.12), transparent 19rem),
    linear-gradient(155deg, #101e2e 0%, #08121e 100%);
}

.editorial-hero .hero-sphere::after {
  border-radius: 0;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(180deg, transparent 65%, rgba(0, 0, 0, 0.25));
  background-size: 32px 32px, 32px 32px, auto;
}

.hero-sphere__overlay {
  left: 28px;
  top: 26px;
}

.hero-sphere__kicker {
  display: block;
  color: #dda363;
}

.hero-sphere__title {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-shadow: none;
}

.hero-sphere__count {
  color: #b8c9d5;
  letter-spacing: 0.04em;
}

.section-header {
  align-items: end;
  gap: 24px;
  padding-top: 64px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 18px;
}

.section-title {
  margin-top: 5px;
  padding-left: 0;
  font-size: 2.35rem;
  font-weight: 600;
  line-height: 1;
}

.section-title::before {
  display: none;
}

.section-summary {
  max-width: 22rem;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  text-align: right;
}

.category-filter__tab {
  min-height: 36px;
  border-radius: 2px;
  background: transparent;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.category-filter__tab.is-active {
  color: #fff;
  background: #1e3a5f;
  border-color: #1e3a5f;
  box-shadow: none;
}

.post-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.post-card {
  border-radius: var(--radius-md);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: var(--shadow-sm);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.post-card::before,
.post-card:nth-child(3n + 2)::before,
.post-card:nth-child(3n)::before {
  height: 2px;
  background: var(--color-accent);
}

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

.post-card__image {
  aspect-ratio: 1.9 / 1;
}

.post-card__body {
  padding: 24px;
}

.post-card__meta,
.post-card__category,
.tag,
.post-card__more {
  font-family: var(--font-mono);
}

.post-card__category,
.tag {
  border-radius: 2px;
}

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 600;
  line-height: 1.35;
}

.post-card__excerpt {
  font-size: 0.9375rem;
  line-height: 1.75;
}

.post {
  padding-top: 56px;
}

.post__layout {
  padding: clamp(28px, 4vw, 54px);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-bg-card) 88%, transparent);
  box-shadow: var(--shadow-sm);
}

.post__header {
  margin-bottom: 44px;
  padding-bottom: 28px;
}

.post__header::after {
  width: 72px;
  height: 3px;
  background: var(--color-accent);
}

.post__title {
  max-width: 18em;
  color: var(--color-text);
  background: none;
  font-size: clamp(2.2rem, 4.2vw, 4.1rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.post__content {
  font-size: 1.0625rem;
  line-height: 1.9;
  min-width: 0;
  overflow-wrap: anywhere;
}

.post__content h1,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6 {
  font-family: var(--font-display);
  font-weight: 600;
}

.post__content h2 {
  font-size: 1.9rem;
  border-bottom-color: var(--color-border);
}

.post__content blockquote {
  border-left: 3px solid var(--color-accent);
  border-radius: 0;
  background: var(--color-primary-subtle);
}

.post__content img {
  border-radius: 4px;
}

.post-toc {
  border-left: 2px solid var(--color-border);
}

.post-toc__link.is-active {
  box-shadow: inset 2px 0 0 var(--color-accent);
}

.footer {
  border-top-color: var(--color-border);
}

@media (max-width: 1180px) {
  .editorial-hero {
    grid-template-columns: 1fr;
  }

  .editorial-hero__copy {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .editorial-hero .hero-sphere {
    min-height: 430px;
  }
}

@media (max-width: 1024px) {
  .header__edition {
    display: none;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header__inner {
    height: 60px;
  }

  .header__nav {
    top: 60px;
    background: var(--color-bg);
  }

  .theme-toggle,
  .menu-toggle {
    width: 44px;
    height: 44px;
  }

  .editorial-hero {
    min-height: 0;
    margin-top: 20px;
  }

  .editorial-hero__copy {
    padding: 34px 24px 38px;
  }

  .editorial-hero__copy::before {
    top: 18px;
    right: 18px;
  }

  .editorial-hero__title {
    margin-top: 18px;
    font-size: clamp(2.2rem, 10.4vw, 2.75rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
  }

  .editorial-hero__facts {
    gap: 22px;
  }

  .editorial-hero .hero-sphere {
    min-height: 380px;
    height: 380px;
    margin-top: 0;
    border-radius: 0;
  }

  .section-header {
    align-items: start;
    flex-direction: column;
    padding-top: 44px;
  }

  .section-summary {
    text-align: left;
  }

  .post__layout {
    padding: 24px 20px;
  }

  .post__content {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .header__logo {
    font-size: 1.25rem;
  }

  .editorial-hero__facts {
    justify-content: space-between;
    gap: 12px;
  }

  .editorial-hero__facts strong {
    font-size: 1.4rem;
  }

  .post-card__body {
    padding: 20px;
  }

  .post__layout {
    padding: 22px 16px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .post-card:hover {
    transform: none;
  }
}

/* ========================================
   Switchable visual systems
   Default: Bento / graphite + coral
   Alternatives: Clear Grid, Midnight Code
   ======================================== */

:root {
  --sidebar-width: 320px;
  --post-toc-width: 280px;
}

.style-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.style-picker::after {
  content: '';
  position: absolute;
  right: 11px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  pointer-events: none;
}

.style-picker select {
  min-width: 92px;
  min-height: 40px;
  padding: 0 30px 0 12px;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: 600 0.75rem/1 var(--font-sans);
  appearance: none;
  cursor: pointer;
}

.style-picker select:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

html[data-site-style="bento"] {
  --color-bg: #fff6df;
  --color-bg-secondary: #f4e9ca;
  --color-bg-card: #fffdf7;
  --color-bg-code: #f1e8d4;
  --color-text: #242424;
  --color-text-secondary: #514a3f;
  --color-text-muted: #655e52;
  --color-border: #242424;
  --color-border-light: rgba(36, 36, 36, 0.38);
  --color-primary: #242424;
  --color-primary-hover: #090909;
  --color-primary-light: #e8ddc4;
  --color-primary-subtle: rgba(36, 36, 36, 0.07);
  --color-accent: #b9382a;
  --color-accent-bright: #ff654d;
  --color-accent-light: #ffd5c9;
  --color-cyan: #536c3f;
  --color-cyan-subtle: rgba(83, 108, 63, 0.12);
  --gradient-art: linear-gradient(120deg, #242424 0%, #242424 62%, #ff654d 62%, #ff654d 100%);
  --color-surface: #fffdf7;
  --color-surface-hover: #ffffff;
  --shadow-sm: 3px 3px 0 #242424;
  --shadow-md: 7px 7px 0 #242424;
  --shadow-lg: 9px 9px 0 #242424;
  --shadow-xl: 12px 12px 0 #242424;
  --font-display: 'Public Sans', 'Noto Sans SC', sans-serif;
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
}

html[data-theme="dark"][data-site-style="bento"] {
  --color-bg: #181818;
  --color-bg-secondary: #202020;
  --color-bg-card: #242424;
  --color-bg-code: #303030;
  --color-text: #fff6df;
  --color-text-secondary: #e0d7c3;
  --color-text-muted: #b9af9c;
  --color-border: #fff6df;
  --color-border-light: rgba(255, 246, 223, 0.35);
  --color-primary: #fff6df;
  --color-primary-hover: #ffffff;
  --color-primary-light: #3b3933;
  --color-primary-subtle: rgba(255, 246, 223, 0.09);
  --color-accent: #ff826d;
  --color-accent-bright: #ff654d;
  --color-accent-light: #5d2d25;
  --color-cyan: #a8bd8e;
  --color-cyan-subtle: rgba(168, 189, 142, 0.12);
  --color-surface: #242424;
  --color-surface-hover: #2d2d2d;
  --shadow-sm: 3px 3px 0 #fff6df;
  --shadow-md: 7px 7px 0 #fff6df;
  --shadow-lg: 9px 9px 0 #fff6df;
  --shadow-xl: 12px 12px 0 #fff6df;
}

html[data-site-style="bento"] body {
  background-color: var(--color-bg);
  background-image:
    linear-gradient(rgba(36, 36, 36, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 36, 36, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

html[data-theme="dark"][data-site-style="bento"] body {
  background-image:
    linear-gradient(rgba(255, 246, 223, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 246, 223, 0.035) 1px, transparent 1px);
}

html[data-site-style="bento"] .header {
  border-bottom: 2px solid var(--color-border);
  background: var(--color-bg);
}

html[data-site-style="bento"] .header__logo {
  font-weight: 800;
  letter-spacing: -0.045em;
}

html[data-site-style="bento"] .header__edition {
  color: var(--color-text);
  border-left-width: 2px;
}

html[data-site-style="bento"] .header__link::after {
  height: 3px;
  bottom: 1px;
  background: var(--color-accent-bright);
}

html[data-site-style="bento"] .theme-toggle,
html[data-site-style="bento"] .menu-toggle,
html[data-site-style="bento"] .header__social-link,
html[data-site-style="bento"] .style-picker select {
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: 2px 2px 0 var(--color-border);
}

html[data-site-style="bento"] .editorial-hero {
  border: 2px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-md);
}

html[data-site-style="bento"] .editorial-hero--without-sphere {
  grid-template-columns: 1fr;
  min-height: 0;
  margin-top: 24px;
}

html[data-site-style="bento"] .editorial-hero__copy {
  border-right: 2px solid var(--color-border);
}

html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__copy {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: clamp(32px, 5vw, 72px);
  row-gap: 8px;
  padding: 24px 28px;
  border-right: 0;
}

html[data-site-style="bento"] .editorial-hero__copy::before {
  content: 'BENTO / 01';
  color: var(--color-text);
}

html[data-site-style="bento"] .editorial-hero__eyebrow,
html[data-site-style="bento"] .section-kicker,
html[data-site-style="bento"] .hero-sphere__kicker {
  color: var(--color-accent);
  font-weight: 700;
}

html[data-site-style="bento"] .editorial-hero__title {
  max-width: 9em;
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.06em;
}

html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__eyebrow,
html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__title {
  grid-column: 1;
}

html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__title {
  max-width: 11em;
  margin: 6px 0 0;
  font-size: clamp(2.15rem, 3.2vw, 3.25rem);
}

html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__intro {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: end;
  max-width: 34rem;
  line-height: 1.65;
}

html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__facts,
html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__cta {
  display: none;
}

html[data-site-style="bento"] .editorial-hero__facts {
  border-top: 2px solid var(--color-border);
}

html[data-site-style="bento"] .editorial-hero__facts strong {
  font-family: var(--font-sans);
  font-weight: 800;
}

html[data-site-style="bento"] .editorial-hero__cta {
  color: #fff6df;
  background: #242424;
  border: 2px solid #242424;
  box-shadow: 4px 4px 0 var(--color-accent-bright);
  font-weight: 700;
}

html[data-site-style="bento"] .editorial-hero__cta:hover {
  color: #242424;
  background: var(--color-accent-bright);
}

html[data-site-style="bento"] .editorial-hero .hero-sphere {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 101, 77, 0.34), transparent 17rem),
    linear-gradient(145deg, #242424 0%, #111111 100%);
}

html[data-site-style="bento"] .editorial-hero .hero-sphere::after {
  background:
    linear-gradient(rgba(255, 246, 223, 0.045) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 246, 223, 0.045) 2px, transparent 2px);
  background-size: 28px 28px;
}

html[data-site-style="bento"] .hero-sphere__kicker { color: #ff826d; }
html[data-site-style="bento"] .hero-sphere__title { font-family: var(--font-sans); font-weight: 800; }

html[data-site-style="bento"] .section-header {
  padding-top: 32px;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--color-border);
}

html[data-site-style="bento"] .section-title { font-weight: 800; letter-spacing: -0.045em; }

html[data-site-style="bento"] .category-filter__tab {
  border-width: 1.5px;
  font-weight: 700;
}

html[data-site-style="bento"] .category-filter__tab.is-active {
  color: #fff6df;
  background: #242424;
  border-color: #242424;
  box-shadow: 3px 3px 0 var(--color-accent-bright);
}

html[data-site-style="bento"] .post-grid { gap: 24px; }

html[data-site-style="bento"] .post-card {
  border: 2px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
}

html[data-site-style="bento"] .post-card:nth-child(3n + 2) {
  background: color-mix(in srgb, var(--color-accent-bright) 13%, var(--color-bg-card));
}

html[data-site-style="bento"] .post-card:nth-child(3n) {
  background: color-mix(in srgb, #f2c94c 18%, var(--color-bg-card));
}

html[data-site-style="bento"] .post-card::before,
html[data-site-style="bento"] .post-card:nth-child(3n + 2)::before,
html[data-site-style="bento"] .post-card:nth-child(3n)::before {
  height: 0;
}

html[data-site-style="bento"] .post-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-lg);
  transform: translate(-2px, -2px);
}

html[data-site-style="bento"] .post-card__title { font-weight: 800; letter-spacing: -0.025em; }

html[data-site-style="bento"] .post__layout {
  border: 2px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-md);
}

html[data-site-style="bento"] .post__title,
html[data-site-style="bento"] .post__content h1,
html[data-site-style="bento"] .post__content h2,
html[data-site-style="bento"] .post__content h3,
html[data-site-style="bento"] .post__content h4 {
  font-weight: 800;
}

html[data-site-style="bento"] .post__header { border-bottom-width: 2px; }
html[data-site-style="bento"] .post__header::after { height: 6px; width: 92px; background: var(--color-accent-bright); }
html[data-site-style="bento"] .post__content blockquote { border: 2px solid var(--color-border); box-shadow: 4px 4px 0 var(--color-accent-bright); }

@media (max-width: 1180px) {
  html[data-site-style="bento"] .editorial-hero__copy {
    border-right: 0;
    border-bottom: 2px solid var(--color-border);
  }

  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__copy {
    border-bottom: 0;
  }
}

@media (max-width: 900px) {
  .style-picker select { min-width: 82px; }
  .header__social { display: none; }

  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__copy {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    row-gap: 10px;
    padding: 24px;
  }

  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__eyebrow,
  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__title,
  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__intro {
    grid-column: 1;
    grid-row: auto;
  }

  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__intro {
    max-width: 42rem;
  }
}

@media (max-width: 768px) {
  .style-picker select {
    width: 78px;
    min-width: 78px;
    min-height: 44px;
    padding-left: 9px;
  }

  html[data-site-style="bento"] .header__nav {
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
  }

  html[data-site-style="bento"] .editorial-hero { box-shadow: 5px 5px 0 var(--color-border); }
}

@media (max-width: 480px) {
  .style-picker select { width: 72px; min-width: 72px; padding-right: 24px; }
  .style-picker::after { right: 9px; }
  html[data-site-style="bento"] .editorial-hero__title { font-size: clamp(1.8rem, 9vw, 2.2rem); }
  html[data-site-style="bento"] .editorial-hero--without-sphere { margin-top: 16px; }
  html[data-site-style="bento"] .editorial-hero--without-sphere .editorial-hero__copy { padding: 20px; }
  html[data-site-style="bento"] .section-header { padding-top: 24px; }
  html[data-site-style="bento"] .post__layout { border-left: 0; border-right: 0; box-shadow: none; }
}

/* Desktop resizers for the global index and article TOC. */
.sidebar-resizer,
.post-toc__resizer {
  display: none;
}

body.is-resizing-navigation {
  cursor: col-resize;
  user-select: none;
}

@media (min-width: 1025px) {
  .layout-wrapper {
    max-width: calc(var(--max-width) + var(--sidebar-width) + 88px);
  }

  .sidebar {
    position: relative;
    width: var(--sidebar-width);
  }

  .sidebar-resizer {
    position: absolute;
    z-index: 5;
    top: 40px;
    right: -20px;
    bottom: 0;
    display: block;
    width: 24px;
    min-height: 200px;
    cursor: col-resize;
    touch-action: none;
  }

  .sidebar-resizer::before,
  .post-toc__resizer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 11px;
    width: 2px;
    background: var(--color-border-light);
    transition: width 160ms ease, background-color 160ms ease, transform 160ms ease;
  }

  .sidebar-resizer:hover::before,
  .sidebar-resizer:focus-visible::before,
  .sidebar-resizer.is-active::before,
  .post-toc__resizer:hover::before,
  .post-toc__resizer:focus-visible::before,
  .post-toc__resizer.is-active::before {
    width: 4px;
    background: var(--color-accent);
    transform: translateX(-1px);
  }
}

@media (min-width: 1401px) {
  .layout-wrapper:has(.post) {
    max-width: calc(var(--sidebar-width) + var(--content-width) + var(--post-toc-width) + 176px);
  }

  .main:has(.post) {
    max-width: calc(var(--content-width) + var(--post-toc-width) + 88px);
  }

  .post__layout {
    width: 100%;
    max-width: calc(var(--content-width) + var(--post-toc-width) + 88px);
    grid-template-columns: minmax(0, var(--content-width)) var(--post-toc-width);
  }

  .post-toc {
    position: sticky;
  }

  .post-toc__resizer {
    position: absolute;
    z-index: 5;
    top: 0;
    left: -13px;
    bottom: 0;
    display: block;
    width: 24px;
    min-height: 160px;
    cursor: col-resize;
    touch-action: none;
  }
}

/* ========================================
   Knowledge OS
   A terminal-like knowledge workspace. This is intentionally structural:
   dense archive navigation, command-line hero, log rows and file-like posts.
   ======================================== */

@property --knowledge-beam-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.knowledge-status {
  display: none;
}

html[data-site-style="knowledge"],
html[data-theme="dark"][data-site-style="knowledge"] {
  color-scheme: dark;
  --color-bg: #090909;
  --color-bg-secondary: #111111;
  --color-bg-card: #0e0e0e;
  --color-bg-code: #171717;
  --color-text: #f2f2ee;
  --color-text-secondary: #c9c9c3;
  --color-text-muted: #898983;
  --color-border: rgba(242, 242, 238, 0.30);
  --color-border-light: rgba(242, 242, 238, 0.14);
  --color-primary: #f2f2ee;
  --color-primary-hover: #ffffff;
  --color-primary-light: #2a2a28;
  --color-primary-subtle: rgba(242, 242, 238, 0.08);
  --color-accent: #d0d0ca;
  --color-accent-bright: #ffffff;
  --color-accent-light: #282826;
  --color-cyan: #d0d0ca;
  --color-cyan-subtle: rgba(242, 242, 238, 0.07);
  --gradient-art: linear-gradient(90deg, #f2f2ee 0%, #a6a6a0 100%);
  --color-surface: #0e0e0e;
  --color-surface-hover: #181818;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-xl: none;
  --font-display: 'JetBrains Mono', 'Noto Sans SC', monospace;
  --font-sans: 'JetBrains Mono', 'Noto Sans SC', monospace;
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
}

html[data-site-style="knowledge"] body {
  background-color: var(--color-bg);
  background-image:
    linear-gradient(var(--color-border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border-light) 1px, transparent 1px);
  background-size: 28px 28px;
  font-family: var(--font-sans);
}

html[data-site-style="knowledge"] body::before {
  content: '';
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 72% 8%, var(--color-cyan-subtle), transparent 34rem);
}

html[data-site-style="knowledge"] .header {
  background: color-mix(in srgb, var(--color-bg) 96%, transparent);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html[data-site-style="knowledge"] .header__inner {
  height: 58px;
}

html[data-site-style="knowledge"] .header__brand {
  align-items: center;
  gap: 10px;
}

html[data-site-style="knowledge"] .header__logo {
  color: var(--color-primary);
  background: none;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

html[data-site-style="knowledge"] .header__logo::before {
  content: 'guoba://';
  color: var(--color-text-muted);
  font-weight: 400;
}

html[data-site-style="knowledge"] .header__edition {
  color: var(--color-text-muted);
  border-left-color: var(--color-border);
}

html[data-site-style="knowledge"] .knowledge-status {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  margin-left: 2px;
}

html[data-site-style="knowledge"] .knowledge-status i {
  position: absolute;
  display: block;
  border: 1px dotted var(--color-primary);
  border-radius: 50%;
  animation: knowledge-orbit 4.8s linear infinite;
}

html[data-site-style="knowledge"] .knowledge-status i:nth-child(1) {
  width: 20px;
  height: 20px;
}

html[data-site-style="knowledge"] .knowledge-status i:nth-child(2) {
  width: 14px;
  height: 14px;
  border-color: var(--color-accent);
  animation-direction: reverse;
  animation-duration: 3.4s;
}

html[data-site-style="knowledge"] .knowledge-status i:nth-child(3) {
  width: 4px;
  height: 4px;
  border: 0;
  background: var(--color-primary);
  animation: knowledge-pulse 1.8s ease-in-out infinite;
}

@keyframes knowledge-orbit {
  to { transform: rotate(360deg) scaleX(0.74); }
}

@keyframes knowledge-pulse {
  50% { opacity: 0.35; transform: scale(0.72); }
}

html[data-site-style="knowledge"] .header__link {
  padding: 9px 10px;
  border-left: 1px solid transparent;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

html[data-site-style="knowledge"] .header__link::before {
  content: '/';
  margin-right: 4px;
  color: var(--color-text-muted);
}

html[data-site-style="knowledge"] .header__link::after {
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 1px;
  background: var(--color-primary);
}

html[data-site-style="knowledge"] .header__link:hover,
html[data-site-style="knowledge"] .header__link.is-active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border-left-color: var(--color-primary);
}

html[data-site-style="knowledge"] .style-picker select {
  min-width: 132px;
}

html[data-site-style="knowledge"] .style-picker select,
html[data-site-style="knowledge"] .theme-toggle,
html[data-site-style="knowledge"] .menu-toggle,
html[data-site-style="knowledge"] .header__social-link {
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: none;
}

html[data-site-style="knowledge"] .layout-wrapper {
  gap: 24px;
}

html[data-site-style="knowledge"] .sidebar {
  padding-top: 24px;
}

html[data-site-style="knowledge"] .sidebar__inner {
  top: 82px;
  padding: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: none;
}

html[data-site-style="knowledge"] .sidebar__section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--color-border);
}

html[data-site-style="knowledge"] .sidebar__section:last-child {
  border-bottom: 0;
}

html[data-site-style="knowledge"] .sidebar__title {
  margin-bottom: 12px;
  padding-bottom: 9px;
  color: var(--color-primary);
  border-bottom: 1px dashed var(--color-border);
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
}

html[data-site-style="knowledge"] .sidebar__title::before {
  content: '> ';
  color: var(--color-accent);
}

html[data-site-style="knowledge"] .category-filter--sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

html[data-site-style="knowledge"] .category-filter--sidebar .category-filter__tab {
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  text-align: left;
}

html[data-site-style="knowledge"] .category-filter--sidebar .category-filter__tab::before {
  content: './';
  color: var(--color-text-muted);
}

html[data-site-style="knowledge"] .category-filter__tab.is-active,
html[data-site-style="knowledge"] .category-filter--sidebar .category-filter__tab.is-active {
  color: var(--color-bg);
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: none;
}

html[data-site-style="knowledge"] .sidebar__count,
html[data-site-style="knowledge"] .sidebar__date,
html[data-site-style="knowledge"] .sidebar__year,
html[data-site-style="knowledge"] .sidebar__item {
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .sidebar__count::before {
  content: 'STATUS / ';
  color: var(--color-accent);
}

html[data-site-style="knowledge"] .sidebar__year {
  margin-top: 8px;
  padding: 8px 8px 4px;
  color: var(--color-accent);
  border-bottom: 1px dashed var(--color-border-light);
}

html[data-site-style="knowledge"] .sidebar__year::before {
  content: '/ARCHIVE/';
  color: var(--color-text-muted);
}

html[data-site-style="knowledge"] .sidebar__item {
  gap: 12px;
  padding: 7px 8px;
  border-left: 1px solid transparent;
  border-radius: 0;
}

html[data-site-style="knowledge"] .sidebar__item:hover,
html[data-site-style="knowledge"] .sidebar__item.is-active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border-left-color: var(--color-primary);
  box-shadow: none;
}

html[data-site-style="knowledge"] .editorial-hero {
  position: relative;
  grid-template-columns: 1fr;
  min-height: 0;
  margin-top: 24px;
  padding-top: 34px;
  overflow: hidden;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: none;
}

html[data-site-style="knowledge"] .editorial-hero::before {
  content: 'guoba://knowledge/home    ·    SYSTEM ONLINE';
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.08em;
}

html[data-site-style="knowledge"] .editorial-hero::after {
  content: '';
  position: absolute;
  z-index: 5;
  inset: 0;
  padding: 1px;
  pointer-events: none;
  background: conic-gradient(from var(--knowledge-beam-angle), transparent 0 76%, var(--color-accent), var(--color-primary), transparent 94% 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: knowledge-border-beam 6s linear infinite;
}

@keyframes knowledge-border-beam {
  to { --knowledge-beam-angle: 360deg; }
}

html[data-site-style="knowledge"] .editorial-hero__copy {
  justify-content: flex-start;
  padding: clamp(28px, 4vw, 48px);
  background: var(--color-bg-card);
  border-right: 0;
}

html[data-site-style="knowledge"] .editorial-hero__copy::before {
  content: none;
}

.knowledge-only,
.editorial-hero__title .knowledge-only,
.editorial-hero__intro .knowledge-only {
  display: none;
}

html[data-site-style="knowledge"] .knowledge-only {
  display: inline;
}

html[data-site-style="knowledge"] .bento-only {
  display: none;
}

html[data-site-style="knowledge"] .knowledge-command {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: clamp(30px, 5vw, 54px);
  padding: 12px 14px;
  color: var(--color-text-muted);
  background: var(--color-primary-subtle);
  border: 1px solid var(--color-border);
  font: 500 0.78rem/1.4 var(--font-mono);
}

html[data-site-style="knowledge"] .knowledge-command.knowledge-only {
  display: grid;
}

html[data-site-style="knowledge"] .knowledge-command > span:first-child {
  color: var(--color-primary);
  font-size: 1.25rem;
}

html[data-site-style="knowledge"] .knowledge-command kbd {
  padding: 3px 6px;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  font: inherit;
}

html[data-site-style="knowledge"] .editorial-hero__eyebrow,
html[data-site-style="knowledge"] .section-kicker,
html[data-site-style="knowledge"] .hero-sphere__kicker {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.12em;
}

html[data-site-style="knowledge"] .editorial-hero__eyebrow::before,
html[data-site-style="knowledge"] .section-kicker::before {
  content: '> ';
  color: var(--color-accent);
}

html[data-site-style="knowledge"] .editorial-hero__title {
  max-width: 15em;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 3.6vw, 3.5rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

html[data-site-style="knowledge"] .editorial-hero__intro {
  max-width: 42rem;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  line-height: 1.8;
}

html[data-site-style="knowledge"] .editorial-hero__facts,
html[data-site-style="knowledge"] .editorial-hero__cta,
html[data-site-style="knowledge"] .hero-sphere {
  display: none;
}

html[data-site-style="knowledge"] .editorial-hero__facts {
  gap: 0;
  margin-top: 26px;
  padding-top: 0;
  border: 1px solid var(--color-border);
}

html[data-site-style="knowledge"] .editorial-hero__facts div {
  min-width: 0;
  flex: 1;
  padding: 12px;
  border-right: 1px solid var(--color-border);
}

html[data-site-style="knowledge"] .editorial-hero__facts div:last-child {
  border-right: 0;
}

html[data-site-style="knowledge"] .editorial-hero__facts strong {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 500;
}

html[data-site-style="knowledge"] .editorial-hero__facts span {
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .editorial-hero__cta {
  color: var(--color-bg);
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font-mono);
  font-weight: 500;
}

html[data-site-style="knowledge"] .editorial-hero__cta::before {
  content: '$';
}

html[data-site-style="knowledge"] .editorial-hero__cta:hover {
  gap: 12px;
  color: var(--color-bg);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

html[data-site-style="knowledge"] .editorial-hero .hero-sphere {
  min-height: 466px;
  background:
    radial-gradient(circle at 50% 48%, var(--color-primary-subtle), transparent 18rem),
    linear-gradient(var(--color-border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border-light) 1px, transparent 1px),
    #080808;
  background-size: auto, 28px 28px, 28px 28px, auto;
}

html[data-site-style="knowledge"] .editorial-hero .hero-sphere::after {
  background: linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.55));
}

html[data-site-style="knowledge"] .hero-sphere__overlay {
  top: 26px;
  left: 22px;
}

html[data-site-style="knowledge"] .hero-sphere__title {
  font-family: var(--font-mono);
  font-weight: 500;
}

html[data-site-style="knowledge"] .hero-sphere__count {
  color: #bcbcb6;
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .section-header {
  align-items: center;
  padding-top: 44px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

html[data-site-style="knowledge"] .section-title {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

html[data-site-style="knowledge"] .section-summary {
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .category-filter--main {
  gap: 6px;
}

html[data-site-style="knowledge"] .category-filter--main .category-filter__tab {
  min-height: 38px;
  color: var(--color-text-secondary);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 0;
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .category-filter--main .category-filter__tab.is-active {
  color: var(--color-bg);
  background: var(--color-primary);
}

html[data-site-style="knowledge"] .post-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

html[data-site-style="knowledge"] .post-card {
  display: block;
  min-height: 0;
  overflow: hidden;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-left-color: var(--color-border);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

html[data-site-style="knowledge"] .post-card:not(:has(.post-card__image)) {
  grid-template-columns: 1fr;
  min-height: 0;
}

html[data-site-style="knowledge"] .post-card::before,
html[data-site-style="knowledge"] .post-card:nth-child(3n + 2)::before,
html[data-site-style="knowledge"] .post-card:nth-child(3n)::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  height: auto;
  background: var(--color-primary);
}

html[data-site-style="knowledge"] .post-card:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  box-shadow: none;
  transform: translateX(4px);
}

html[data-site-style="knowledge"] .post-card__image {
  display: none;
}

html[data-site-style="knowledge"] .post-card__image img {
  transform: none;
}

html[data-site-style="knowledge"] .post-card:hover .post-card__image img {
  transform: scale(1.025);
}

html[data-site-style="knowledge"] .post-card__body {
  display: grid;
  grid-template-columns: 88px 112px minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  padding: 0;
}

html[data-site-style="knowledge"] .post-card__meta {
  display: contents;
  margin: 0;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

html[data-site-style="knowledge"] .post-card__meta::before {
  content: none;
}

html[data-site-style="knowledge"] .post-card__meta time,
html[data-site-style="knowledge"] .post-card__category,
html[data-site-style="knowledge"] .post-card__title {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 14px 12px;
  border-right: 1px solid var(--color-border-light);
}

html[data-site-style="knowledge"] .post-card__meta time {
  grid-column: 1;
  color: var(--color-text-muted);
}

html[data-site-style="knowledge"] .post-card__category {
  grid-column: 2;
  color: var(--color-primary);
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
}

html[data-site-style="knowledge"] .post-card__category,
html[data-site-style="knowledge"] .tag {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border: 1px solid var(--color-border-light);
  border-radius: 0;
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .post-card__title {
  grid-column: 3;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}

html[data-site-style="knowledge"] .post-card__title a::before {
  content: none;
}

html[data-site-style="knowledge"] .post-card__excerpt {
  display: none;
}

html[data-site-style="knowledge"] .post-card__footer {
  display: none;
}

html[data-site-style="knowledge"] .post-card__more {
  color: var(--color-accent);
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .post__layout {
  padding: clamp(24px, 3.5vw, 46px);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: none;
}

html[data-site-style="knowledge"] .post__header {
  position: relative;
  padding: 36px 0 26px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

html[data-site-style="knowledge"] .post__header::before {
  content: 'guoba://knowledge/article.md';
  position: absolute;
  top: 0;
  left: 0;
  color: var(--color-text-muted);
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.06em;
}

html[data-site-style="knowledge"] .post__header::after {
  width: 88px;
  height: 2px;
  background: var(--color-primary);
}

html[data-site-style="knowledge"] .post__meta,
html[data-site-style="knowledge"] .post__tags {
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .post__meta::before {
  content: 'META /';
  color: var(--color-accent);
}

html[data-site-style="knowledge"] .post__title {
  max-width: 20em;
  color: var(--color-text);
  background: none;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

html[data-site-style="knowledge"] .post__title::before {
  content: none;
}

html[data-site-style="knowledge"] .post__content {
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  counter-reset: knowledge-section;
}

html[data-site-style="knowledge"] .post__content h1,
html[data-site-style="knowledge"] .post__content h2,
html[data-site-style="knowledge"] .post__content h3,
html[data-site-style="knowledge"] .post__content h4,
html[data-site-style="knowledge"] .post__content h5,
html[data-site-style="knowledge"] .post__content h6 {
  color: var(--color-text);
  font-family: var(--font-mono);
  font-weight: 500;
}

html[data-site-style="knowledge"] .post__content h2 {
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--color-border);
  counter-increment: knowledge-section;
}

html[data-site-style="knowledge"] .post__content h2::before {
  content: counter(knowledge-section, decimal-leading-zero) ' / ';
  color: var(--color-primary);
}

html[data-site-style="knowledge"] .post__content h3::before {
  content: none;
}

html[data-site-style="knowledge"] .post__content blockquote {
  color: var(--color-text-secondary);
  background: var(--color-primary-subtle);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: 0;
  box-shadow: none;
}

html[data-site-style="knowledge"] .post__content pre,
html[data-site-style="knowledge"] .post__content figure.highlight {
  border-color: var(--color-border);
  border-radius: 0;
  box-shadow: none;
}

html[data-site-style="knowledge"] .post-toc {
  padding: 14px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 0;
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .post-toc__toggle::before {
  content: '> ';
  color: var(--color-accent);
}

html[data-site-style="knowledge"] .post-toc__link {
  border-left: 1px solid transparent;
  border-radius: 0;
}

html[data-site-style="knowledge"] .post-toc__link:hover,
html[data-site-style="knowledge"] .post-toc__link.is-active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  border-left-color: var(--color-primary);
  box-shadow: none;
}

html[data-site-style="knowledge"] .page,
html[data-site-style="knowledge"] .archive,
html[data-site-style="knowledge"] .tags-page,
html[data-site-style="knowledge"] .search-page {
  font-family: var(--font-mono);
}

html[data-site-style="knowledge"] .footer {
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
}

@media (max-width: 1180px) {
  html[data-site-style="knowledge"] .editorial-hero {
    grid-template-columns: 1fr;
  }

  html[data-site-style="knowledge"] .editorial-hero__copy {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
}

@media (min-width: 1401px) {
  html[data-site-style="knowledge"] .post__layout {
    grid-template-areas:
      "header header"
      "content toc"
      "footer toc";
  }
}

@media (max-width: 768px) {
  html[data-site-style="knowledge"] .header__nav {
    top: 58px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
  }

  html[data-site-style="knowledge"] .style-picker select {
    width: 112px;
    min-width: 112px;
  }

  html[data-site-style="knowledge"] .editorial-hero {
    margin-top: 16px;
    padding-top: 34px;
  }

  html[data-site-style="knowledge"] .editorial-hero::before {
    content: 'guoba://knowledge/home';
  }

  html[data-site-style="knowledge"] .editorial-hero__copy {
    padding: 38px 22px 32px;
  }

  html[data-site-style="knowledge"] .editorial-hero__facts {
    flex-wrap: wrap;
  }

  html[data-site-style="knowledge"] .editorial-hero__facts div {
    min-width: 33%;
  }

  html[data-site-style="knowledge"] .post-card {
    grid-template-columns: 1fr;
  }

  html[data-site-style="knowledge"] .post-card__image {
    height: auto;
    aspect-ratio: 16 / 9;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  html[data-site-style="knowledge"] .post-card__body {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  html[data-site-style="knowledge"] .post-card__category {
    display: none;
  }

  html[data-site-style="knowledge"] .post-card__title {
    grid-column: 2;
    border-right: 0;
  }
}

@media (max-width: 480px) {
  html[data-site-style="knowledge"] .header__edition,
  html[data-site-style="knowledge"] .knowledge-status {
    display: none;
  }

  html[data-site-style="knowledge"] .header__logo::before {
    display: none;
  }

  html[data-site-style="knowledge"] .header__logo {
    font-size: 0.82rem;
  }

  html[data-site-style="knowledge"] .header__actions {
    gap: 4px;
  }

  html[data-site-style="knowledge"] .style-picker select {
    width: 84px;
    min-width: 84px;
    padding-left: 7px;
  }

  html[data-site-style="knowledge"] .theme-toggle,
  html[data-site-style="knowledge"] .menu-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  html[data-site-style="knowledge"] .post__layout {
    padding: 20px 16px;
    border-left: 0;
    border-right: 0;
  }

  html[data-site-style="knowledge"] .knowledge-command {
    gap: 8px;
    padding: 10px;
  }

  html[data-site-style="knowledge"] .knowledge-command kbd {
    display: none;
  }
}

html[data-site-style="knowledge"] .post__content pre,
html[data-site-style="knowledge"] .post__content figure.highlight {
  max-width: 100%;
  overflow-x: auto;
}

html[data-site-style="knowledge"] .post__content figure.highlight {
  contain: inline-size;
}

@media (prefers-reduced-motion: reduce) {
  html[data-site-style="knowledge"] .knowledge-status i,
  html[data-site-style="knowledge"] .editorial-hero::after {
    animation: none !important;
  }
}
