/* ============================================
   hugo-theme-drift
   Original theme by Konen Tung
   ============================================ */

/* ---- CSS Variables: Dark & Light ---- */
:root {
  --carbon: #1C2321;
  --steel: #7D98A1;
  --slate: #5E6572;
  --powder: #A9B4C2;
  --platinum: #EEF1EF;

  --sidebar-w: 72px;
  --sidebar-w-expanded: 220px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode (default) */
[data-theme="dark"] {
  --bg: #0f1514;
  --bg-raised: #182220;
  --bg-card: rgba(28, 35, 33, 0.6);
  --bg-card-hover: rgba(28, 35, 33, 0.85);
  --bg-sidebar: rgba(20, 28, 26, 0.7);
  --text: var(--platinum);
  --text-secondary: var(--powder);
  --text-muted: var(--slate);
  --border: rgba(125, 152, 161, 0.12);
  --border-hover: rgba(125, 152, 161, 0.3);
  --glow: rgba(125, 152, 161, 0.15);
  --glow-strong: rgba(125, 152, 161, 0.35);
  --code-bg: #0a0f0e;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* Light mode */
[data-theme="light"] {
  --bg: #f4f6f5;
  --bg-raised: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-sidebar: rgba(238, 241, 239, 0.85);
  --text: var(--carbon);
  --text-secondary: var(--slate);
  --text-muted: var(--powder);
  --border: rgba(94, 101, 114, 0.12);
  --border-hover: rgba(94, 101, 114, 0.3);
  --glow: rgba(125, 152, 161, 0.1);
  --glow-strong: rgba(125, 152, 161, 0.25);
  --code-bg: var(--carbon);
  --shadow-card: 0 2px 12px rgba(28, 35, 33, 0.06);
  --shadow-card-hover: 0 8px 30px rgba(28, 35, 33, 0.12);
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

::selection { background: var(--steel); color: var(--platinum); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate); border-radius: 3px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ============================================
   GLOBAL 3D DEPTH SYSTEM
   多層次立體深度，讓整個頁面有空間感
   ============================================ */

/* 底層背景紋理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, var(--glow) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(94, 101, 114, 0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(169, 180, 194, 0.04) 0%, transparent 45%);
  pointer-events: none;
  z-index: -2;
}

/* 內凹容器效果 (sections) */
.home-section {
  position: relative;
  padding: 2rem;
  margin-bottom: 3rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.1),
    var(--shadow-card);
  transition: box-shadow 0.4s var(--ease);
}

.home-section:hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.1),
    var(--shadow-card-hover),
    0 0 40px var(--glow);
}

[data-theme="light"] .home-section {
  background: rgba(255,255,255,0.5);
}

/* Page hero 立體感 */
.page-hero {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem 2rem;
  margin-bottom: 2rem;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    var(--shadow-card);
}

[data-theme="light"] .page-hero {
  background: rgba(255,255,255,0.5);
}

/* Post single 立體容器 */
.post-header {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    var(--shadow-card);
}

[data-theme="light"] .post-header {
  background: rgba(255,255,255,0.5);
}

/* ============================================
   KEYFRAMES
   ============================================ */
@keyframes float {
  0%, 100% { transform: translateY(0) rotateY(0); }
  50% { transform: translateY(-6px) rotateY(2deg); }
}

@keyframes revealUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--glow-strong); }
  50% { opacity: 0.8; box-shadow: 0 0 0 8px transparent; }
}

@keyframes glitch {
  0%, 100% { text-shadow: 2px 0 var(--steel), -2px 0 var(--slate); }
  25% { text-shadow: -2px -1px var(--steel), 2px 1px var(--slate); }
  50% { text-shadow: 1px 2px var(--steel), -1px -2px var(--slate); }
  75% { text-shadow: -1px 1px var(--steel), 1px -1px var(--slate); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, -40px) scale(1.1); }
  50% { transform: translate(-30px, -70px) scale(0.95); }
  75% { transform: translate(40px, 20px) scale(1.05); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-50px, 30px) scale(1.08); }
  50% { transform: translate(40px, 50px) scale(0.92); }
  75% { transform: translate(-20px, -40px) scale(1.03); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, 50px) scale(0.95); }
  50% { transform: translate(-60px, -20px) scale(1.1); }
  75% { transform: translate(20px, -50px) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- Reveal Animation ---- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
}

.reveal.visible {
  animation: revealUp 0.7s var(--ease) forwards;
  animation-delay: var(--delay, 0s);
}

/* ============================================
   3D FLOATING SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--sidebar-w);
  z-index: 1000;
  perspective: 800px;
  transition: width 0.35s var(--ease);
}

.sidebar-inner {
  background: var(--bg-sidebar);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 0 0 1px var(--border),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-style: preserve-3d;
  animation: float 6s var(--ease) infinite;
  transition: all 0.35s var(--ease);
}

.sidebar:hover .sidebar-inner {
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--border-hover),
    0 0 40px var(--glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateZ(10px);
}

/* Brand */
.sidebar-brand {
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: center;
}

.brand-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.brand-icon,
.brand-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  transition: transform 0.3s var(--spring), box-shadow 0.3s var(--ease);
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--steel), var(--slate));
  color: var(--platinum);
  font-weight: 900;
  font-size: 1.1rem;
}

.brand-avatar {
  object-fit: cover;
  border-radius: 50%;
}

.brand-link:hover .brand-icon,
.brand-link:hover .brand-avatar {
  transform: scale(1.1) rotateZ(-5deg);
  box-shadow: 0 4px 16px var(--glow-strong);
}

.brand-name {
  display: none;
}

.sidebar:hover .brand-name {
  display: block;
  font-size: 0.7rem;
  opacity: 0.6;
  animation: fadeIn 0.2s var(--ease);
}

/* Nav items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  width: 100%;
  flex: 1;
  justify-content: center;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
  width: 100%;
  color: var(--text-muted);
  position: relative;
  transition: color 0.25s var(--ease), transform 0.25s var(--spring);
  cursor: pointer;
}

/* 確保 icon 在收合時精確置中 */
.nav-item .nav-icon {
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 24px;
  background: var(--steel);
  border-radius: 0 3px 3px 0;
  transition: transform 0.3s var(--spring);
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-item:hover::before {
  transform: translateY(-50%) scaleY(0.6);
}

.nav-icon {
  flex-shrink: 0;
  transition: transform 0.3s var(--spring);
}

.nav-item:hover .nav-icon {
  transform: scale(1.15);
}

.nav-label {
  display: none;
  white-space: nowrap;
  font-weight: 500;
}

.sidebar:hover .nav-label {
  display: inline;
  font-size: 0.85rem;
  opacity: 1;
  animation: fadeIn 0.2s var(--ease);
}

.sidebar:hover {
  width: var(--sidebar-w-expanded);
}

.sidebar:hover .nav-item {
  justify-content: flex-start;
  padding-left: 20px;
}

/* Tooltip on collapsed state */
.nav-item[data-tooltip] {
  position: relative;
}

.nav-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  background: var(--carbon);
  color: var(--platinum);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--ease);
  z-index: 100;
}

.sidebar:not(:hover) .nav-item:hover[data-tooltip]::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-page {
  text-align: center;
}

.about-header {
  padding: 3rem 0 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.about-avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--steel), var(--slate));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 20px var(--glow),
    0 0 0 3px var(--border),
    0 0 0 6px var(--glow);
  transition: transform 0.4s var(--spring), box-shadow 0.4s var(--ease);
}

.about-avatar:hover {
  transform: scale(1.08) rotateZ(-3deg);
  box-shadow:
    0 8px 32px var(--glow-strong),
    0 0 0 3px var(--border-hover),
    0 0 0 6px var(--glow);
}

.about-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.avatar-letter {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--platinum);
}

.about-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
}

.about-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.about-page .post-content {
  text-align: left;
  margin-bottom: 2.5rem;
}

/* Social Cards Grid (About page) */
.social-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  transition: all 0.3s var(--ease);
  text-align: left;
}

.social-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateX(6px) translateZ(8px);
  box-shadow: var(--shadow-card), 0 0 20px var(--glow);
}

.social-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glow);
  border-radius: 12px;
  color: var(--steel);
  flex-shrink: 0;
  transition: all 0.3s var(--ease);
}

.social-card:hover .social-card-icon {
  background: var(--steel);
  color: var(--platinum);
  transform: scale(1.08);
}

.social-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.social-card-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.social-card-handle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.social-card-arrow {
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(-6px);
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
}

.social-card:hover .social-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   MAIN CONTENT WRAPPER - Centered with sidebar offset
   使用 CSS Grid 精確置中於側邊欄右側的可用空間
   ============================================ */
.main-wrapper {
  /* 佔據側邊欄右側的全部空間 */
  position: relative;
  margin-left: calc(var(--sidebar-w) + 32px);
  margin-right: 32px;
  min-height: 100vh;

  /* 用 grid 置中內容 */
  display: grid;
  grid-template-columns: 1fr min(860px, 100%) 1fr;
  grid-template-rows: 1fr auto;
  transition: margin-left 0.35s var(--ease);
}

/* 所有直接子元素都放在中間欄 */
.main-wrapper > * {
  grid-column: 2;
}

.content {
  padding: 2rem 0 4rem;
}

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

/* ---- Floating content sections ---- */
.home-section,
.page-hero,
.post-single,
.terms-cloud,
.error-page {
  animation: contentFloat 8s var(--ease) infinite;
}

@keyframes contentFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Parallax-like depth for cards on hover */
a.card {
  transform-style: preserve-3d;
  perspective: 600px;
}

/* Floating background ambient particles */
.main-wrapper::before {
  content: "";
  position: fixed;
  top: 20%;
  right: 10%;
  width: 200px;
  height: 200px;
  background: var(--steel);
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.06;
  pointer-events: none;
  animation: orbFloat2 25s ease-in-out infinite;
  z-index: -1;
}

.main-wrapper::after {
  content: "";
  position: fixed;
  bottom: 15%;
  left: calc(var(--sidebar-w) + 5%);
  width: 160px;
  height: 160px;
  background: var(--powder);
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.05;
  pointer-events: none;
  animation: orbFloat3 20s ease-in-out infinite;
  z-index: -1;
}

[data-theme="light"] .main-wrapper::before,
[data-theme="light"] .main-wrapper::after {
  opacity: 0.04;
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
  transform: rotate(30deg) scale(1.1);
  box-shadow: 0 4px 20px var(--glow);
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  position: relative;
  padding: 6rem 0 4rem;
  margin-bottom: 3rem;
  overflow: hidden;
  text-align: center;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -2px 0 rgba(0,0,0,0.08),
    0 8px 40px rgba(0,0,0,0.15),
    0 0 60px var(--glow);
}

[data-theme="light"] .hero {
  background: rgba(255,255,255,0.55);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.8),
    inset 0 -2px 0 rgba(0,0,0,0.03),
    0 4px 24px rgba(28,35,33,0.06),
    0 0 40px var(--glow);
}

/* Floating background orbs */
.hero-bg-orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
}

.orb-1 {
  width: 300px;
  height: 300px;
  background: var(--steel);
  top: -50px;
  right: -80px;
  animation: orbFloat1 18s ease-in-out infinite;
}

.orb-2 {
  width: 200px;
  height: 200px;
  background: var(--slate);
  bottom: -30px;
  left: -40px;
  animation: orbFloat2 22s ease-in-out infinite;
}

.orb-3 {
  width: 150px;
  height: 150px;
  background: var(--powder);
  top: 40%;
  left: 50%;
  animation: orbFloat3 15s ease-in-out infinite;
}

[data-theme="light"] .orb { opacity: 0.2; }

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--text), var(--steel), var(--text));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  min-height: 1.8em;
}

/* Typewriter with proper cursor */
.typewriter {
  position: relative;
}

.typewriter::after {
  content: "|";
  color: var(--steel);
  animation: blink 0.8s step-end infinite;
  font-weight: 300;
  margin-left: 1px;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

.btn-glow {
  background: linear-gradient(135deg, var(--steel), var(--slate));
  color: var(--platinum);
  border-color: transparent;
  box-shadow: 0 2px 16px var(--glow);
}

.btn-glow:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 30px var(--glow-strong);
}

.btn-glow:active {
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--steel);
  color: var(--text);
  background: var(--glow);
  transform: translateY(-3px);
}

/* ============================================
   SECTIONS
   ============================================ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.3px;
}

.title-accent {
  display: inline-block;
  width: 4px;
  height: 24px;
  background: var(--steel);
  border-radius: 4px;
  flex-shrink: 0;
}

.accent-project { background: var(--slate); }
.accent-note { background: var(--powder); }

.section-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s, gap 0.2s;
}

.section-link:hover {
  color: var(--steel);
}

/* ============================================
   PAGE HERO (list pages) - base styles merged with 3D section above
   ============================================ */

.page-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -1px;
}

.page-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0.5rem auto 0;
}

/* ============================================
   CARD GRID
   ============================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

/* ============================================
   CARDS - Fully clickable, glass morphism
   ============================================ */
a.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.35s var(--ease);
  position: relative;
  color: inherit;
  box-shadow: var(--shadow-card);
}

a.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-8px) scale(1.01);
  box-shadow: var(--shadow-card-hover), 0 0 30px var(--glow);
}

a.card:active {
  transform: translateY(-4px) scale(1.005);
}

/* Card cover image */
.card-cover {
  overflow: hidden;
  max-height: 180px;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  transition: transform 0.5s var(--ease);
}

a.card:hover .card-cover img {
  transform: scale(1.06);
}

/* Card body */
.card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-dot {
  width: 3px;
  height: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  flex-shrink: 0;
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

.mini-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--steel);
  background: var(--glow);
  padding: 0.15rem 0.55rem;
  border-radius: 50px;
  letter-spacing: 0.3px;
}

.card-arrow {
  position: absolute;
  bottom: 16px;
  right: 16px;
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(-8px);
  transition: all 0.3s var(--ease);
}

a.card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Card badge */
.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--platinum);
  background: linear-gradient(135deg, var(--steel), var(--slate));
  padding: 0.2rem 0.65rem;
  border-radius: 50px;
  z-index: 2;
}

.card-badge.pulse {
  animation: pulse 2.5s ease-in-out infinite;
}

/* Card variants */
.card-project {
  border-left: 3px solid var(--slate);
}

.card-project:hover {
  border-left-color: var(--steel);
}

/* ============================================
   NOTES LIST (compact list style)
   ============================================ */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.note-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease);
  color: inherit;
  gap: 0.75rem;
}

.note-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  transform: translateX(6px);
  box-shadow: var(--shadow-card);
}

.note-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.note-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.note-arrow {
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.note-item:hover .note-arrow {
  opacity: 1;
}

/* ============================================
   SINGLE POST
   ============================================ */
.post-single {
  max-width: 100%;
}

/* .post-header styles merged into 3D depth system above */

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.post-section {
  font-weight: 600;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 0.75rem;
}

.post-title {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -1px;
  margin-bottom: 1rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--steel);
  background: var(--glow);
  border: 1px solid var(--border);
  padding: 0.2rem 0.7rem;
  border-radius: 50px;
  transition: all 0.25s var(--ease);
}

.tag-pill:hover {
  background: var(--steel);
  color: var(--platinum);
  border-color: var(--steel);
  transform: translateY(-2px);
}

.post-cover {
  margin-bottom: 2.5rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  border-radius: 0;
  transition: transform 0.6s var(--ease);
}

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

/* ============================================
   POST CONTENT (Markdown)
   ============================================ */
.post-content {
  font-size: 1.05rem;
  line-height: 1.85;
}

.post-content h2 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.3px;
}

.post-content h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}

.post-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.post-content p { margin-bottom: 1.35rem; }

.post-content ul,
.post-content ol {
  margin-bottom: 1.35rem;
  padding-left: 1.5rem;
}

.post-content li { margin-bottom: 0.4rem; }

.post-content blockquote {
  border-left: 3px solid var(--steel);
  background: var(--glow);
  padding: 1.15rem 1.5rem;
  margin: 1.75rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

.post-content code {
  font-family: var(--font-mono);
  background: var(--glow);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.87em;
  color: var(--steel);
  border: 1px solid var(--border);
}

.post-content pre,
.note-content pre {
  position: relative;
  background: var(--code-bg);
  color: var(--platinum);
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.75rem 0;
  font-size: 0.9rem;
  line-height: 1.7;
  border: 1px solid var(--border);
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(125, 152, 161, 0.15);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  z-index: 2;
}
pre:hover .code-copy-btn {
  opacity: 1;
}
.code-copy-btn:hover {
  background: var(--steel);
  color: var(--platinum);
  border-color: var(--steel);
}
.code-copy-btn.copied {
  opacity: 1;
  background: #3fb950;
  border-color: #3fb950;
  color: #fff;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  border: none;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.post-content thead { background: var(--carbon); color: var(--platinum); }

.post-content th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.post-content th,
.post-content td {
  padding: 0.85rem 1.15rem;
  text-align: left;
  border: 1px solid var(--border);
}

.post-content tbody tr:nth-child(even) { background: var(--glow); }
.post-content tbody tr { transition: background 0.2s; }
.post-content tbody tr:hover { background: var(--glow); }

.post-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 2.5rem 0;
}

.post-content a {
  color: var(--steel);
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}

.post-content a:hover {
  color: var(--text);
  border-bottom-color: var(--steel);
}

.post-content figure {
  margin: 2rem 0;
  text-align: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.post-content figure img { transition: transform 0.5s var(--ease); border-radius: 0; }
.post-content figure:hover img { transform: scale(1.03); }

.post-content figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
  font-style: italic;
}

/* Highlight overrides */
.highlight pre {
  background: var(--code-bg) !important;
  color: var(--platinum) !important;
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--border);
}

/* ============================================
   POST FOOTER / NAV
   ============================================ */
.post-footer {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.post-tags-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.3s var(--ease);
  color: inherit;
}

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

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

.nav-dir {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--steel);
}

.nav-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

/* ============================================
   TERMS CLOUD
   ============================================ */
.terms-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

a.term-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.6rem 1.15rem;
  border-radius: 50px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.3s var(--ease);
  backdrop-filter: blur(8px);
}

a.term-pill:hover {
  background: var(--steel);
  color: var(--platinum);
  border-color: var(--steel);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 4px 20px var(--glow-strong);
}

.term-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--glow);
  padding: 0.1rem 0.45rem;
  border-radius: 50px;
  color: var(--text-muted);
  transition: all 0.3s;
}

a.term-pill:hover .term-count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--platinum);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  list-style: none;
}

.page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-xs);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.25s var(--ease);
}

.page-item .page-link:hover {
  background: var(--steel);
  color: var(--platinum);
  border-color: var(--steel);
  transform: translateY(-2px);
}

.page-item.active .page-link {
  background: var(--steel);
  color: var(--platinum);
  border-color: var(--steel);
}

.page-item.disabled .page-link {
  opacity: 0.3;
  pointer-events: none;
}

/* ============================================
   ERROR PAGE (404)
   ============================================ */
.error-page {
  text-align: center;
  padding: 8rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.error-glitch {
  font-size: 8rem;
  font-weight: 900;
  letter-spacing: -4px;
  line-height: 1;
  margin-bottom: 1rem;
  animation: glitch 2s ease-in-out infinite;
  color: var(--text);
}

.error-msg {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ============================================
   SIDEBAR EXTRAS
   ============================================ */
.sidebar-divider {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 6px 0;
  flex-shrink: 0;
}

/* 底部小圓點標記 */
.sidebar-bottom {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  width: 100%;
  display: flex;
  justify-content: center;
}

.sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--steel);
  opacity: 0.4;
}

button.search-trigger {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
  color: var(--text-muted);
  transition: color 0.25s var(--ease), transform 0.25s var(--spring);
}

button.search-trigger:hover {
  color: var(--text);
}

.sidebar:hover button.search-trigger {
  justify-content: flex-start;
  padding-left: 20px;
}

/* ============================================
   SEARCH MODAL
   ============================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-modal {
  width: 90%;
  max-width: 620px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.4),
    0 0 60px var(--glow);
  overflow: hidden;
  transform: translateY(-20px) scale(0.96);
  transition: transform 0.3s var(--spring);
}

.search-overlay.active .search-modal {
  transform: translateY(0) scale(1);
}

[data-theme="light"] .search-modal {
  box-shadow:
    0 16px 60px rgba(28, 35, 33, 0.12),
    0 0 40px var(--glow);
}

/* Search Header */
.search-header {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.search-input-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  color: var(--text);
  caret-color: var(--steel);
}

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

.search-kbd {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--glow);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  flex-shrink: 0;
}

/* Search Body */
.search-body {
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.search-empty-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.search-shortcut {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.search-shortcut kbd {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--glow);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

/* Search Results */
.search-result {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  color: inherit;
  transition: background 0.2s var(--ease);
  cursor: pointer;
}

.search-result:hover,
.search-result.active {
  background: var(--glow);
}

.search-result-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glow);
  border-radius: 8px;
  color: var(--steel);
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search-result:hover .search-result-icon,
.search-result.active .search-result-icon {
  background: var(--steel);
  color: var(--platinum);
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  margin-bottom: 0.15rem;
  color: var(--text);
}

.search-result-title mark {
  background: rgba(125, 152, 161, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-snippet mark {
  background: rgba(125, 152, 161, 0.25);
  color: var(--text-secondary);
  border-radius: 2px;
  padding: 0 1px;
}

.search-result-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-no-results {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.search-footer {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.search-footer kbd {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  background: var(--glow);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  margin: 0 2px;
}

/* ============================================
   NOTES - Timeline List
   ============================================ */
.page-hero-compact {
  padding: 2rem 2rem 1.5rem;
}

.notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.notes-month {
  position: relative;
}

.notes-month-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--steel);
  padding: 1rem 0 0.5rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
}

.notes-month-list {
  display: flex;
  flex-direction: column;
}

.note-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-xs);
  color: inherit;
  transition: all 0.2s var(--ease);
  border-left: 2px solid transparent;
}

.note-row:hover {
  background: var(--bg-card);
  border-left-color: var(--steel);
  padding-left: 1.25rem;
}

.note-row-date {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 38px;
  flex-shrink: 0;
}

.note-row-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-row-tags {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.note-row-tag {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--glow);
  padding: 0.1rem 0.45rem;
  border-radius: 50px;
}

.note-row-arrow {
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.note-row:hover .note-row-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   NOTES - Single Page (compact style)
   ============================================ */
.note-single {
  max-width: 680px;
}

.note-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.note-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.note-back:hover {
  color: var(--steel);
}

.note-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.note-category {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Note content: tighter spacing than posts */
.note-content {
  font-size: 1rem;
  line-height: 1.75;
}

.note-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.note-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.note-content p { margin-bottom: 1rem; }

.note-content ul,
.note-content ol {
  margin-bottom: 1rem;
  padding-left: 1.25rem;
}

.note-content li { margin-bottom: 0.3rem; }

.note-content blockquote {
  border-left: 3px solid var(--steel);
  background: var(--glow);
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.95rem;
}

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

.note-content code {
  font-family: var(--font-mono);
  background: var(--glow);
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--steel);
  border: 1px solid var(--border);
}

.note-content pre {
  background: var(--code-bg);
  color: var(--platinum);
  padding: 1.15rem 1.5rem;
  border-radius: var(--radius-xs);
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.note-content pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
  font-size: inherit;
}

.note-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

.note-content thead { background: var(--carbon); color: var(--platinum); }

.note-content th,
.note-content td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border: 1px solid var(--border);
}

.note-content tbody tr:nth-child(even) { background: var(--glow); }

.note-content a {
  color: var(--steel);
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}

.note-content a:hover {
  color: var(--text);
  border-bottom-color: var(--steel);
}

.note-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 2rem 0;
}

.note-content .highlight pre {
  background: var(--code-bg) !important;
  color: var(--platinum) !important;
}

/* Note footer / navigation */
.note-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.note-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.note-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-nav-link:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--glow);
}

.note-nav-link .nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .note-row-tags { display: none; }
  .note-title { font-size: 1.3rem; }
  .note-nav { flex-direction: column; }
  .note-nav-link { max-width: 100%; }
}

/* ============================================
   GITHUB STATS PANEL (project single page)
   ============================================ */
.gh-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card);
}

.gh-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.gh-repo-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  font-family: var(--font-mono);
}

.gh-link {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--steel);
  transition: color 0.2s;
}

.gh-link:hover {
  color: var(--text);
}

/* Stats grid */
.gh-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.gh-stat {
  text-align: center;
  padding: 1rem 0.5rem;
  background: var(--glow);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
}

.gh-stat:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--glow);
}

.gh-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-family: var(--font-mono);
}

.gh-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 0.25rem;
}

/* Language bar */
.gh-languages {
  margin-bottom: 1rem;
}

.gh-lang-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.6rem;
}

.gh-lang-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--glow);
  margin-bottom: 0.6rem;
}

.gh-lang-segment {
  height: 100%;
  transition: width 0.6s var(--ease);
  min-width: 2px;
}

.gh-lang-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.gh-lang-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.gh-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gh-lang-pct {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Meta row */
.gh-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.gh-meta-row span:empty {
  display: none;
}

/* Card mini stats */
.gh-card-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.gh-card-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.gh-card-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--steel);
}

@media (max-width: 480px) {
  .gh-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   FOOTER
   ============================================ */
.footer-content {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================
   MOBILE
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all 0.3s var(--ease);
}

.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 5px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -5px); }

@media (max-width: 900px) {
  .sidebar {
    left: -280px;
    top: 0;
    transform: none;
    height: 100vh;
    width: 260px;
    transition: left 0.35s var(--ease);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-inner {
    height: 100%;
    border-radius: 0 20px 20px 0;
    padding: 20px 16px;
    animation: none;
  }

  .sidebar.open .nav-label {
    display: inline;
    font-size: 0.9rem;
    opacity: 1;
  }

  .sidebar.open .nav-item,
  .sidebar.open button.search-trigger {
    justify-content: flex-start;
    padding-left: 12px;
    gap: 14px;
  }

  .sidebar.open .brand-name {
    display: block;
    font-size: 0.75rem;
    opacity: 0.6;
  }

  .sidebar.open .sidebar-nav {
    justify-content: flex-start;
    padding-top: 1rem;
  }

  .main-wrapper {
    margin-left: 0;
    margin-right: 0;
    padding: 0 1.25rem;
    grid-template-columns: 1fr;
  }

  .main-wrapper::before,
  .main-wrapper::after {
    display: none;
  }

  .content {
    padding-top: 5rem;
  }

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

  .card-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }

  .hero-title { font-size: 2.2rem; }
  .hero-subtitle { font-size: 1rem; }
  .page-title { font-size: 1.8rem; }
  .post-title { font-size: 1.6rem; }
  .post-nav { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero { padding: 4rem 0 2.5rem; }
  .hero-title { font-size: 1.8rem; }
  .post-title { font-size: 1.4rem; }
  .card-body { padding: 1.15rem; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

/* Large screens */
@media (min-width: 1200px) {
  .main-wrapper {
    grid-template-columns: 1fr min(920px, 100%) 1fr;
  }
}

/* ============================================
   GitHub-style Alerts
   ============================================ */
.alert {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
}
.alert-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.alert-content p { margin: 0; }
.alert-content p + p { margin-top: 0.5rem; }

.alert-note {
  border-color: var(--steel);
  background: rgba(125, 152, 161, 0.08);
}
.alert-note .alert-title { color: var(--steel); }

.alert-tip {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.08);
}
.alert-tip .alert-title { color: #3fb950; }

.alert-important {
  border-color: #a371f7;
  background: rgba(163, 113, 247, 0.08);
}
.alert-important .alert-title { color: #a371f7; }

.alert-warning {
  border-color: #d29922;
  background: rgba(210, 153, 34, 0.08);
}
.alert-warning .alert-title { color: #d29922; }

.alert-caution {
  border-color: #f85149;
  background: rgba(248, 81, 73, 0.08);
}
.alert-caution .alert-title { color: #f85149; }

/* ============================================
   Table of Contents
   ============================================ */
.post-layout {
  position: relative;
}
.toc-sidebar {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  z-index: 1000;
  perspective: 800px;
}
.toc-container {
  background: var(--bg-sidebar);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  padding: 20px 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 0 0 1px var(--border),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-style: preserve-3d;
  animation: float 6s var(--ease) infinite;
  transition: all 0.35s var(--ease);
}
.toc-sidebar:hover .toc-container {
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--border-hover),
    0 0 40px var(--glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateZ(10px);
}
.toc-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
}
.toc-nav {
  max-height: calc(70vh - 60px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.toc-nav #TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-nav #TableOfContents ul ul {
  padding-left: 0.85rem;
}
.toc-nav #TableOfContents li {
  margin: 0;
}
.toc-nav #TableOfContents a {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}
.toc-nav #TableOfContents a:hover,
.toc-nav #TableOfContents a.active {
  color: var(--steel);
  border-left-color: var(--steel);
}

@media (max-width: 1400px) {
  .toc-sidebar { display: none; }
}

/* ============================================
   Share Buttons
   ============================================ */
.post-share {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.share-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.share-buttons {
  display: flex;
  gap: 0.5rem;
}
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glow);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.25s var(--ease);
  text-decoration: none;
}
.share-btn:hover {
  transform: translateY(-2px);
  color: var(--platinum);
  box-shadow: 0 4px 12px var(--glow);
}
.share-twitter:hover { background: #1da1f2; border-color: #1da1f2; }
.share-facebook:hover { background: #4267b2; border-color: #4267b2; }
.share-whatsapp:hover { background: #25d366; border-color: #25d366; }

/* ============================================
   Comments
   ============================================ */
.post-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.comments-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.utterances {
  max-width: 100% !important;
}

/* ============================================
   Post Figure (render hook)
   ============================================ */
.post-figure {
  margin: 1.5rem 0;
}
.post-figure img {
  width: 100%;
  border-radius: var(--radius-sm);
}
.post-figure figcaption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
