/* ============================================================
   Cleartext Theme v3.0 — Enterprise-Grade Stylesheet
   Design System: CSS Grid | 8px Scale | #1e293b / #0ea5e9
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS — CSS Custom Properties
   ============================================================ */
:root {
  /* Color System */
  --color-primary: #1e293b;
  --color-primary-light: #334155;
  --color-primary-dark: #0f172a;
  --color-accent: #0ea5e9;
  --color-accent-hover: #0284c7;
  --color-accent-light: #e0f2fe;
  --color-accent-dark: #0369a1;

  --color-bg: #f8fafc;
  --color-bg-alt: #f1f5f9;
  --color-bg-elevated: #ffffff;
  --color-bg-hover: #e2e8f0;

  --color-text: #1e293b;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;

  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-border-focus: #0ea5e9;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;

  /* Semantic */
  --color-code-bg: #1e293b;
  --color-code-text: #e2e8f0;
  --color-inline-code-bg: #f1f5f9;
  --color-inline-code-text: #0f172a;
  --color-table-stripe: #f8fafc;
  --color-table-header: #f1f5f9;
  --color-table-hover: #e0f2fe;
  --color-tag-bg: #e0f2fe;
  --color-tag-text: #0ea5e9;
  --color-tag-bg-hover: #bae6fd;
  --color-tag-text-hover: #0284c7;
  --color-search-mark-bg: #fef08a;
  --color-search-mark-text: #1e293b;

  /* Callout */
  --color-callout-info-bg: #eff6ff;
  --color-callout-info-border: #3b82f6;
  --color-callout-warning-bg: #fffbeb;
  --color-callout-warning-border: #f59e0b;
  --color-callout-tip-bg: #f0fdf4;
  --color-callout-tip-border: #10b981;
  --color-callout-danger-bg: #fef2f2;
  --color-callout-danger-border: #ef4444;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;

  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;

  /* 8px Spacing Scale */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows — multi-layer for depth */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.25);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout — viewport-relative for wider content */
  --header-height: 64px;
  --header-height-shrunk: 52px;
  --content-max-width: 80ch;
  --sidebar-width: minmax(200px, 16vw);
  --toc-width: minmax(180px, 14vw);
  --container-max: 1500px;
  --grid-gap: var(--space-8);

  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--text-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

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

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.4s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Selection */
::selection {
  background-color: rgba(14, 165, 233, 0.2);
  color: var(--color-text);
}

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   3. CSS GRID LAYOUT SYSTEM
   ============================================================ */
.page-shell {
  padding-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.grid-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
  align-items: start;
}

/* Has sidebar + TOC: 3-column grid */
.grid-container.grid-post.grid-has-sidebar.grid-has-toc {
  grid-template-columns: 1fr;
  grid-template-areas:
    "main"
    "sidebar"
    "toc";
}

@media (min-width: 1201px) {
  .grid-container.grid-post.grid-has-sidebar.grid-has-toc {
    grid-template-columns: 16vw minmax(0, 1fr) 14vw;
    grid-template-areas: "sidebar main toc";
  }
}

/* Has sidebar only: 2-column grid */
.grid-container.grid-post.grid-has-sidebar:not(.grid-has-toc) {
  grid-template-columns: 1fr;
  grid-template-areas:
    "main"
    "sidebar";
}

@media (min-width: 768px) {
  .grid-container.grid-post.grid-has-sidebar:not(.grid-has-toc) {
    grid-template-columns: minmax(0, 1fr) 18vw;
    grid-template-areas: "main sidebar";
  }
}

/* Has TOC only: main + TOC (TOC on right) */
.grid-container.grid-post.grid-has-toc:not(.grid-has-sidebar) {
  grid-template-columns: 1fr;
  grid-template-areas:
    "main"
    "toc";
}

@media (min-width: 1201px) {
  .grid-container.grid-post.grid-has-toc:not(.grid-has-sidebar) {
    grid-template-columns: minmax(0, 1fr) 200px;
    grid-template-areas: "main toc";
  }
}

/* Main content area — wider for better readability */
.grid-main {
  grid-area: main;
  min-width: 0;
  max-width: 100%;
}

/* Post content width — max-width removed, text elements constrained individually */
.post-content {
  width: 100%;
}

/* Constrain text elements for readability, let media/code fill full width */
.post-content > p,
.post-content > h1,
.post-content > h2,
.post-content > h3,
.post-content > h4,
.post-content > h5,
.post-content > h6,
.post-content > ul,
.post-content > ol,
.post-content > blockquote,
.post-content > .callout,
.post-content > .table-wrapper {
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Allow figures (especially figure.highlight code blocks) to span full width */
.post-content figure {
  width: 100%;
  max-width: none;
  margin: var(--space-6) 0;
}

/* Post card width */
.post-card {
  max-width: 100%;
}

/* Sidebar & TOC area assignments */
.grid-sidebar { grid-area: sidebar; }
.grid-toc { grid-area: toc; }

/* Sidebar sticky */
.grid-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  align-self: start;
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
}

/* TOC sticky */
.grid-toc {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  align-self: start;
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
}

.toc-sticky {
  max-height: inherit;
  overflow-y: auto;
}

/* Single column (no sidebar/TOC): let grid-main stretch naturally;
   centering is done by .page-archive / .post-card etc. via margin:auto */
/* No special .grid-main constraint needed here — it defaults to full width */

/* ============================================================
   4. HEADER — Glass Morphism Navigation
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  z-index: var(--z-sticky);
  transition: height var(--transition-slow), box-shadow var(--transition-slow), background var(--transition-slow);
}

.site-header.scrolled {
  height: var(--header-height-shrunk);
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: var(--color-border);
}

.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  letter-spacing: var(--letter-spacing-tight);
  flex-shrink: 0;
  transition: color var(--transition-fast), font-size var(--transition-slow);
}

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

.site-header.scrolled .site-title {
  font-size: var(--text-lg);
}

/* Nav links */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.nav-link:hover {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.nav-link.active,
[aria-current="page"].nav-link {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.header-btn:hover {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.header-btn:active {
  transform: scale(0.95);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  z-index: calc(var(--z-sticky) + 1);
}

.mobile-menu-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.mobile-menu-toggle.active .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-toggle.active .bar:nth-child(2) {
  opacity: 0;
}
.mobile-menu-toggle.active .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Skip to content */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
  z-index: calc(var(--z-modal) + 1);
  transition: top var(--transition-fast);
  text-decoration: none;
}

.skip-to-content:focus {
  top: var(--space-2);
}


/* ============================================================
   5. CARD COMPONENT
   ============================================================ */
.post-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}

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

.post-card:last-child {
  margin-bottom: 0;
}

.post-card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-2);
}

.post-card-title a {
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

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

.post-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

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

.post-card-updated {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

.post-card-categories {
  display: inline-flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.post-card-tags {
  display: inline-flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* ============================================================
   6. POST CONTENT & TYPOGRAPHY
   ============================================================ */
.post-full {

  background: var(--color-bg-elevated);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-lg);

  padding: var(--space-6) var(--space-8);
  box-shadow: var(--shadow-sm);
}

.post-header {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.post-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-4);
  color: var(--color-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.meta-item svg {
  flex-shrink: 0;
}

.meta-stats {
  font-size: var(--text-xs);
}

.meta-stats .word-count::after {
  content: "\00B7";
  margin: 0 var(--space-1);
}

.meta-updated {
  font-style: italic;
  font-size: var(--text-xs);
}

/* Post content typography */
.post-content {
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content h1 { font-size: var(--text-4xl); font-weight: var(--font-weight-extrabold); margin: var(--space-8) 0 var(--space-4); letter-spacing: var(--letter-spacing-tight); color: var(--color-primary); }
.post-content h2 { font-size: var(--text-3xl); font-weight: var(--font-weight-bold); margin: var(--space-6) 0 var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--color-border); color: var(--color-primary); }
.post-content h3 { font-size: var(--text-2xl); font-weight: var(--font-weight-semibold); margin: var(--space-6) 0 var(--space-3); color: var(--color-primary); }
.post-content h4 { font-size: var(--text-xl); font-weight: var(--font-weight-semibold); margin: var(--space-4) 0 var(--space-2); color: var(--color-primary-light); }
.post-content h5 { font-size: var(--text-lg); font-weight: var(--font-weight-semibold); margin: var(--space-4) 0 var(--space-2); color: var(--color-text-secondary); }
.post-content h6 { font-size: var(--text-base); font-weight: var(--font-weight-semibold); margin: var(--space-4) 0 var(--space-2); color: var(--color-text-muted); }

.post-content p {
  margin-bottom: var(--space-4);
}

.post-content strong { font-weight: var(--font-weight-bold); }
.post-content em { font-style: italic; }
.post-content del { color: var(--color-text-muted); text-decoration: line-through; }

.post-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--color-accent-light);
  transition: text-decoration-color var(--transition-fast);
}

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

/* Lists */
.post-content ul,
.post-content ol {
  margin: var(--space-4) 0;
  padding-left: 1.5em;
}

.post-content li {
  margin-bottom: var(--space-1);
}

.post-content li > ul,
.post-content li > ol {
  margin: var(--space-1) 0;
}

.post-content hr {
  margin: var(--space-8) 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

/* Inline code */
.post-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-inline-code-bg);
  color: var(--color-inline-code-text);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

/* Hexo figure.highlight — override Hexo's built-in table layout for full-width */
.post-content figure.highlight {
  width: 100%;
  max-width: none;
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-code-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: block;
}

.post-content figure.highlight table {
  width: 100%;
  margin: 0;
  border: none;
  border-collapse: collapse;
  table-layout: auto;
}

.post-content figure.highlight .gutter {
  display: none;
}

.post-content figure.highlight .code,
.post-content figure.highlight td.code {
  width: 100%;
  padding: 0;
}

.post-content figure.highlight pre {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.post-content figure.highlight pre code {
  padding: var(--space-5) var(--space-6);
  background: transparent;
  color: var(--color-code-text);
}

/* Hexo built-in highlight syntax colors (fallback when hljs.highlightAll() doesn't apply) */
.post-content figure.highlight .comment,
.post-content figure.highlight .quote,
.post-content figure.highlight .meta {
  color: #5c6370;
  font-style: italic;
}
.post-content figure.highlight .keyword,
.post-content figure.highlight .selector-tag,
.post-content figure.highlight .type,
.post-content figure.highlight .section,
.post-content figure.highlight .name,
.post-content figure.highlight .tag,
.post-content figure.highlight .doctag,
.post-content figure.highlight .formula {
  color: #c678dd;
}
.post-content figure.highlight .string,
.post-content figure.highlight .title,
.post-content figure.highlight .selector-id,
.post-content figure.highlight .selector-class,
.post-content figure.highlight .template-tag,
.post-content figure.highlight .deletion {
  color: #98c379;
}
.post-content figure.highlight .number,
.post-content figure.highlight .literal,
.post-content figure.highlight .symbol,
.post-content figure.highlight .bullet,
.post-content figure.highlight .addition {
  color: #d19a66;
}
.post-content figure.highlight .function,
.post-content figure.highlight .built_in,
.post-content figure.highlight .title.function_ {
  color: #61afef;
}
.post-content figure.highlight .params,
.post-content figure.highlight .variable,
.post-content figure.highlight .template-variable,
.post-content figure.highlight .attr {
  color: #e06c75;
}
.post-content figure.highlight .regexp,
.post-content figure.highlight .link {
  color: #56b6c2;
}
.post-content figure.highlight .selector-attr,
.post-content figure.highlight .selector-pseudo {
  color: #d19a66;
}
.post-content figure.highlight .attribute {
  color: #e5c07b;
}
.post-content figure.highlight .emphasis {
  font-style: italic;
}
.post-content figure.highlight .strong {
  font-weight: bold;
}

/* ============================================================
   7. CODE BLOCKS
   ============================================================ */
.post-content pre {
  display: block;
  width: 100%;
  max-width: none;
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  background: var(--color-code-bg);
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.post-content pre code {
  display: block;
  width: 100%;
  padding: var(--space-5) var(--space-6);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--color-code-text);
  background: transparent;
  tab-size: 4;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
}

/* Code block wrapper */
.code-block-wrapper {
  position: relative;
  width: 100%;
  max-width: none;
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: #334155;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  user-select: none;
}

.code-lang-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.code-copy-btn.copied {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.code-block-wrapper pre {
  margin: 0 !important;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
  border: none !important;
}

.code-block-wrapper .code-block-header + pre {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

/* Scrollbar for code blocks */
pre::-webkit-scrollbar { height: 6px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
pre::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* ============================================================
   8. TABLES
   ============================================================ */
.post-content .table-wrapper {
  overflow-x: auto;
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  -webkit-overflow-scrolling: touch;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.post-content thead {
  background: var(--color-table-header);
}

.post-content th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.post-content td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.post-content tbody tr:nth-child(even) {
  background: var(--color-table-stripe);
}

.post-content tbody tr:hover {
  background: var(--color-table-hover);
  transition: background var(--transition-fast);
}

/* ============================================================
   9. BLOCKQUOTES & CALLOUTS
   ============================================================ */
.post-content blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 4px solid var(--color-accent);
  background: var(--color-accent-light);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  color: var(--color-text-secondary);
}

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

.post-content blockquote.blockquote-info {
  border-left-color: var(--color-info);
  background: var(--color-callout-info-bg);
}

.post-content blockquote.blockquote-warning {
  border-left-color: var(--color-warning);
  background: var(--color-callout-warning-bg);
}

.post-content blockquote.blockquote-success {
  border-left-color: var(--color-success);
  background: var(--color-callout-tip-bg);
}

.post-content blockquote.blockquote-danger {
  border-left-color: var(--color-danger);
  background: var(--color-callout-danger-bg);
}

/* Callout component */
.callout {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 5px solid;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-xs);
}

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

.callout .callout-title {
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
}

.callout-info {
  background: var(--color-callout-info-bg);
  border-color: var(--color-callout-info-border);
}
.callout-info .callout-title { color: var(--color-callout-info-border); }

.callout-warning {
  background: var(--color-callout-warning-bg);
  border-color: var(--color-callout-warning-border);
}
.callout-warning .callout-title { color: var(--color-callout-warning-border); }

.callout-tip {
  background: var(--color-callout-tip-bg);
  border-color: var(--color-callout-tip-border);
}
.callout-tip .callout-title { color: var(--color-callout-tip-border); }

.callout-danger {
  background: var(--color-callout-danger-bg);
  border-color: var(--color-callout-danger-border);
}
.callout-danger .callout-title { color: var(--color-callout-danger-border); }

/* ============================================================
   10. IMAGES
   ============================================================ */
.post-content img {
  max-width: 100%;
  height: auto;
  margin: var(--space-6) auto;
  border-radius: var(--radius-lg);
}

.post-content figure {
  margin: var(--space-6) 0;
}

.post-content figcaption,
.post-content .image-caption {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}


/* ============================================================
   11. SIDEBAR WIDGETS
   ============================================================ */
.grid-sidebar {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.sidebar-widget {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-widget:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.widget-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.03em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
}

.widget-list {
  list-style: none;
  padding: 0;
  font-size: var(--text-sm);
}

.widget-list li {
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-light);
}

.widget-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.widget-list a {
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.widget-list a:hover {
  color: var(--color-accent);
}

.widget-categories li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.widget-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  padding: 0.125em 0.625em;
  border-radius: var(--radius-full);
  min-width: 1.5em;
  text-align: center;
}

.widget-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.widget-archive-link {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: var(--font-weight-medium);
}

.widget-archive-link:hover {
  color: var(--color-accent-hover);
}

/* ============================================================
   12. TABLE OF CONTENTS (TOC)
   ============================================================ */
.toc-sticky {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.toc {
  font-size: var(--text-sm);
  line-height: var(--line-height-snug);
}

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

.toc-sublist {
  padding-left: var(--space-4);
}

.toc-item {
  margin-bottom: var(--space-1);
}

.toc-item a {
  display: block;
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
  transition: color var(--transition-fast);
  text-decoration: none;
  border-radius: var(--radius-sm);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.toc-item a:hover,
.toc-item a.active {
  color: var(--color-accent);
}

.toc-item a.active {
  font-weight: var(--font-weight-semibold);
  background: var(--color-accent-light);
  padding-left: var(--space-2);
  margin-left: calc(-1 * var(--space-2));
}

.toc-level-3 a {
  font-size: 0.9em;
}

.toc-level-4 a {
  font-size: 0.85em;
  opacity: 0.85;
}

/* Mobile TOC (collapsible) */
.toc-mobile {
  display: none;
  margin-bottom: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.toc-mobile-toggle {
  display: flex;
  align-items: center;
  padding: var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  background: var(--color-bg-alt);
  cursor: pointer;
  user-select: none;
  list-style: none;
  min-height: 48px;
}

.toc-mobile-toggle::-webkit-details-marker {
  display: none;
}

.toc-mobile-toggle::before {
  content: "▶";
  margin-right: var(--space-2);
  font-size: 0.7em;
  transition: transform var(--transition-base);
  display: inline-block;
  flex-shrink: 0;
}

.toc-mobile[open] .toc-mobile-toggle::before {
  transform: rotate(90deg);
}

.toc-mobile .toc {
  padding: 0 var(--space-4);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base), padding var(--transition-base);
}

.toc-mobile[open] .toc {
  max-height: 2000px;
  padding: var(--space-4);
}

/* ============================================================
   13. PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.pagination-item:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.pagination-current {
  color: var(--color-text-inverse) !important;
  background: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  font-weight: var(--font-weight-semibold);
}

/* ============================================================
   14. FOOTER
   ============================================================ */
.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.footer-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.social-link {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.social-link:hover {
  color: var(--color-accent);
}

.footer-copyright {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.footer-powered {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.footer-powered a {
  color: var(--color-text-secondary);
}

.footer-powered a:hover {
  color: var(--color-accent);
}

/* ============================================================
   15. SEARCH OVERLAY
   ============================================================ */
.search-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  justify-content: center;
  padding-top: 15vh;
}

.search-overlay.active {
  display: flex;
}

body.search-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

.search-modal {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 90vw;
  max-width: 600px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.search-input {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  border: none;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-lg);
  font-family: var(--font-sans);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  outline: none;
}

.search-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  z-index: var(--z-base);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.search-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.search-results {
  overflow-y: auto;
  padding: var(--space-4) var(--space-6);
  flex: 1;
}

.search-hint,
.search-no-results {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-8) 0;
  font-size: var(--text-sm);
}

.search-results-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.search-results-list {
  list-style: none;
  padding: 0;
}

.search-results-list li {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
}

.search-results-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.search-result-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: var(--space-2);
  transition: background var(--transition-fast);
}

.search-result-link:hover {
  background: var(--color-bg-alt);
}

.search-result-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.search-result-title mark {
  background: var(--color-search-mark-bg);
  color: var(--color-search-mark-text);
  padding: 0 2px;
  border-radius: var(--radius-sm);
}

.search-result-snippet {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  margin-bottom: var(--space-1);
}

.search-result-snippet mark {
  background: var(--color-search-mark-bg);
  color: var(--color-search-mark-text);
  padding: 0 2px;
  border-radius: var(--radius-sm);
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.search-result-categories,
.search-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.search-history {
  padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.search-history-title {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  letter-spacing: 0.03em;
}

.search-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
}

.search-history-item {
  font-size: var(--text-xs);
}

.search-history-item button {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.search-history-item button:hover {
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.search-history-clear {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  text-decoration: underline;
  font-family: var(--font-sans);
}

.search-history-clear:hover { color: var(--color-accent); }

/* ============================================================
   16. BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 48px;
  height: 48px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-slow);
  z-index: var(--z-overlay);
}

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

.back-to-top:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

/* ============================================================
   17. TAGS & CATEGORIES
   ============================================================ */
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--color-tag-text);
  background: var(--color-tag-bg);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast), color var(--transition-fast);
  border: 1px solid transparent;
}

.tag:hover {
  background: var(--color-tag-bg-hover);
  color: var(--color-tag-text-hover);
  border-color: var(--color-accent-light);
}

.cat-link {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  transition: background var(--transition-fast);
}

.cat-link:hover {
  background: var(--color-tag-bg-hover);
}

/* ============================================================
   18. DARK MODE
   ============================================================ */
html.dark {
  --color-primary: #e2e8f0;
  --color-primary-light: #cbd5e1;
  --color-primary-dark: #0f172a;
  --color-accent: #38bdf8;
  --color-accent-hover: #0ea5e9;
  --color-accent-light: #0c4a6e;
  --color-accent-dark: #0369a1;

  --color-bg: #0f172a;
  --color-bg-alt: #1e293b;
  --color-bg-elevated: #1e293b;
  --color-bg-hover: #334155;

  --color-text: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-text-inverse: #0f172a;

  --color-border: #334155;
  --color-border-light: #1e293b;
  --color-border-focus: #38bdf8;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;

  --color-code-bg: #0f172a;
  --color-code-text: #e2e8f0;
  --color-inline-code-bg: #334155;
  --color-inline-code-text: #f1f5f9;
  --color-table-stripe: #1e293b;
  --color-table-header: #1e293b;
  --color-table-hover: #0c4a6e;
  --color-tag-bg: #0c4a6e;
  --color-tag-text: #38bdf8;
  --color-tag-bg-hover: #075985;
  --color-tag-text-hover: #38bdf8;
  --color-search-mark-bg: #fbbf24;
  --color-search-mark-text: #0f172a;

  --color-callout-info-bg: #1e3a8a;
  --color-callout-info-border: #3b82f6;
  --color-callout-warning-bg: #78350f;
  --color-callout-warning-border: #f59e0b;
  --color-callout-tip-bg: #064e3b;
  --color-callout-tip-border: #10b981;
  --color-callout-danger-bg: #7f1d1d;
  --color-callout-danger-border: #ef4444;
}

html.dark .site-header {
  background: rgba(15, 23, 42, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.04);
}

html.dark .site-header.scrolled {
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  border-bottom-color: var(--color-border);
}

html.dark .post-card,
html.dark .post-full,
html.dark .grid-sidebar,
html.dark .toc-sticky {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

html.dark .post-card:hover,
html.dark .post-full:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent-light);
}

html.dark .code-block-header {
  background: #334155;
}

html.dark figure.highlight {
  background: var(--color-code-bg);
}

html.dark .code-copy-btn {
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

html.dark .code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}

html.dark .search-modal {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

html.dark .search-input {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}

html.dark .back-to-top {
  background: var(--color-bg-alt);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

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

html.dark .widget-count {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

html.dark .pagination-current {
  background: var(--color-accent) !important;
  color: var(--color-text-inverse) !important;
}

html.dark .archive-item::before {
  background: var(--color-accent);
}

html.dark .footer-social .social-link:hover {
  color: var(--color-accent);
}

html.dark .link-card {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

html.dark .link-card:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-accent);
}

html.dark .link-avatar-placeholder {
  background: var(--color-bg-alt);
  color: var(--color-text-secondary);
}

html.dark ::selection {
  background: rgba(56, 189, 248, 0.3);
  color: var(--color-text);
}

html.dark .sidebar-widget {
  border-color: var(--color-border);
}

html.dark .giscus-placeholder button {
  background: var(--color-accent);
}

html.dark .giscus-placeholder button:hover {
  background: var(--color-accent-hover);
}

html.dark .nav-link:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

html.dark .site-title:hover {
  color: var(--color-accent);
}


/* ============================================================
   19. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Desktop: >1200px (3-column) */
@media (min-width: 1201px) {
  .grid-container.grid-post.grid-has-sidebar.grid-has-toc {
    grid-template-columns: 16vw minmax(0, 1fr) 14vw;
    grid-template-areas: "sidebar main toc";
  }
}

/* Tablet: 768px-1200px (2-column) */
@media (max-width: 1200px) {
  .grid-container.grid-post.grid-has-sidebar.grid-has-toc {
    grid-template-columns: minmax(0, 1fr) 18vw;
    grid-template-areas:
      "main  sidebar"
      "main  toc";
  }
  
  .grid-toc {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

/* Tablet: 1024px-1200px */
@media (max-width: 1200px) and (min-width: 769px) {
  .grid-container.grid-post.grid-has-sidebar:not(.grid-has-toc) {
    grid-template-columns: minmax(0, 1fr) 20vw;
    grid-template-areas: "main sidebar";
  }
}

/* Mobile: <768px (single column) */
@media (max-width: 768px) {
  .page-shell {
    padding-top: calc(var(--header-height) - 8px);
  }
  
  .grid-container {
    padding: var(--space-4) var(--space-4);
    gap: var(--space-6);
  }
  
  .grid-container.grid-post.grid-has-sidebar.grid-has-toc,
  .grid-container.grid-post.grid-has-sidebar:not(.grid-has-toc),
  .grid-container.grid-post.grid-has-toc:not(.grid-has-sidebar) {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "sidebar"
      "toc";
  }
  
  .grid-sidebar,
  .grid-toc {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  
  .post-full {
    padding: var(--space-6) var(--space-4);
  }
  
  .post-title {
    font-size: var(--text-3xl);
  }
  
  .post-content h1 { font-size: var(--text-3xl); }
  .post-content h2 { font-size: var(--text-2xl); }
  .post-content h3 { font-size: var(--text-xl); }
  .post-content h4 { font-size: var(--text-lg); }
  .post-content h5 { font-size: var(--text-base); }
  .post-content h6 { font-size: var(--text-sm); }
  
  .post-card {
    padding: var(--space-4);
  }
  
  .post-card-title {
    font-size: var(--text-lg);
  }
  
  .post-meta {
    gap: var(--space-2);
    font-size: var(--text-xs);
  }
  
  .header-inner {
    padding: 0 var(--space-4);
  }
  
  .site-nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .site-nav.open {
    display: flex;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4);
    flex-direction: column;
    gap: var(--space-2);
    z-index: var(--z-sticky);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
  }
  
  .nav-link {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    width: 100%;
    text-align: left;
  }
  
  .toc-desktop {
    display: none;
  }
  
  .toc-mobile {
    display: block;
  }
  
  .back-to-top {
    bottom: var(--space-4);
    right: var(--space-4);
    width: 44px;
    height: 44px;
  }
  
  .search-modal {
    width: 95vw;
    max-height: 80vh;
  }
  
  .search-input {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
  }
  
  .search-results {
    padding: var(--space-3) var(--space-4);
  }
  
  .search-history {
    padding: var(--space-2) var(--space-4);
  }
}

/* Small mobile: <480px */
@media (max-width: 480px) {
  .grid-container {
    padding: var(--space-3) var(--space-3);
  }
  
  .post-full {
    padding: var(--space-4) var(--space-3);
  }
  
  .post-title {
    font-size: var(--text-2xl);
  }
  
  .post-content h1 { font-size: var(--text-2xl); }
  .post-content h2 { font-size: var(--text-xl); }
  .post-content h3 { font-size: var(--text-lg); }
  .post-content h4 { font-size: var(--text-base); }
  .post-content h5 { font-size: var(--text-sm); }
  .post-content h6 { font-size: var(--text-xs); }
  
  .post-card {
    padding: var(--space-3);
  }
  
  .post-card-title {
    font-size: var(--text-base);
  }
  
  .post-card-excerpt {
    -webkit-line-clamp: 2;
  }
  
  .header-inner {
    padding: 0 var(--space-3);
  }
  
  .site-title {
    font-size: var(--text-lg);
  }
  
  .site-header.scrolled .site-title {
    font-size: var(--text-base);
  }
  
  .header-btn {
    width: 36px;
    height: 36px;
  }
  
  .footer-social {
    gap: var(--space-3);
  }
  
  .footer-copyright {
    font-size: var(--text-xs);
  }
  
  .footer-powered {
    font-size: 0.7rem;
  }
  
  .pagination-item {
    min-width: 36px;
    height: 36px;
    font-size: var(--text-xs);
  }
  
  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: var(--space-3);
    right: var(--space-3);
  }
}

/* Extra small: <360px */
@media (max-width: 360px) {
  .grid-container {
    padding: var(--space-2) var(--space-2);
  }
  
  .post-full {
    padding: var(--space-3) var(--space-2);
  }
  
  .post-title {
    font-size: var(--text-xl);
  }
  
  .post-content h1 { font-size: var(--text-xl); }
  .post-content h2 { font-size: var(--text-lg); }
  .post-content h3 { font-size: var(--text-base); }
  .post-content h4 { font-size: var(--text-sm); }
  .post-content h5 { font-size: var(--text-xs); }
  .post-content h6 { font-size: 0.7rem; }
  
  .post-card {
    padding: var(--space-2);
  }
  
  .post-card-title {
    font-size: var(--text-sm);
  }
  
  .post-card-meta {
    font-size: 0.7rem;
  }
  
  .post-card-excerpt {
    font-size: 0.875rem;
    -webkit-line-clamp: 1;
  }
  
  .header-inner {
    padding: 0 var(--space-2);
  }
  
  .site-title {
    font-size: var(--text-base);
  }
  
  .site-header.scrolled .site-title {
    font-size: var(--text-sm);
  }
  
  .header-btn {
    width: 32px;
    height: 32px;
  }
  
  .mobile-menu-toggle {
    padding: var(--space-1);
  }
  
  .mobile-menu-toggle .bar {
    width: 18px;
  }
  
  .footer-inner {
    padding: 0 var(--space-2);
  }
  
  .footer-social {
    gap: var(--space-2);
  }
  
  .footer-copyright {
    font-size: 0.7rem;
  }
  
  .footer-powered {
    font-size: 0.6rem;
  }
  
  .pagination-item {
    min-width: 32px;
    height: 32px;
    font-size: var(--text-xs);
  }
  
  .back-to-top {
    width: 36px;
    height: 36px;
    bottom: var(--space-2);
    right: var(--space-2);
  }
}

/* ============================================================
   20. PRINT STYLES
   ============================================================ */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .site-header,
  .site-footer,
  .grid-sidebar,
  .grid-toc,
  .back-to-top,
  .mobile-menu-toggle,
  .header-actions,
  .giscus,
  .giscus-placeholder {
    display: none !important;
  }
  
  .page-shell {
    padding-top: 0;
  }
  
  .grid-container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }
  
  .grid-main {
    grid-area: main;
    width: 100%;
    max-width: 100%;
  }
  
  .post-full {
    border: none;
    padding: 0;
    box-shadow: none;
  }
  
  .post-header {
    border-bottom: 1px solid #ccc;
  }
  
  .post-title {
    font-size: 18pt;
    margin-bottom: 0.5em;
  }
  
  .post-meta {
    font-size: 10pt;
    color: #666;
  }
  
  .post-content {
    font-size: 11pt;
    line-height: 1.6;
  }
  
  .post-content h1 { font-size: 16pt; }
  .post-content h2 { font-size: 14pt; }
  .post-content h3 { font-size: 12pt; }
  .post-content h4 { font-size: 11pt; }
  .post-content h5 { font-size: 10pt; }
  .post-content h6 { font-size: 9pt; }
  
  .post-content a {
    color: #000;
    text-decoration: underline;
  }
  
  .post-content a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
    color: #666;
  }
  
  .post-content a[href^="#"]::after {
    content: "";
  }
  
  .post-content img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  
  .post-content pre {
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }
  
  .post-content table {
    page-break-inside: avoid;
    border-collapse: collapse;
  }
  
  .post-content th,
  .post-content td {
    border: 1px solid #ccc;
  }
  
  .post-content blockquote {
    border-left: 3px solid #ccc;
    padding-left: 1em;
    margin-left: 0;
    background: #f9f9f9;
  }
  
  .pagination {
    display: none;
  }
  
  .skip-to-content {
    display: none;
  }
  
  .code-block-header {
    background: #eee !important;
    color: #333 !important;
    border-bottom: 1px solid #ccc;
  }
  
  .code-copy-btn {
    display: none;
  }
  
  .callout {
    border: 1px solid #ccc;
    background: #f9f9f9;
  }
  
  .tag,
  .cat-link {
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #333;
  }
  
  .post-card {
    border: 1px solid #ccc;
    background: #fff;
    page-break-inside: avoid;
  }
  
  .post-card-title a::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
    color: #666;
  }
}

/* ============================================================
   21. SPECIAL PAGES (Archive, Categories, Tags, About, Links)
   ============================================================ */
.page-archive,
.page-categories,
.page-tags,
.page-about,
.page-links {
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* Archive year container spacing */
.archive-year {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.archive-year:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Tags */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding: var(--space-4) 0;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  text-decoration: none;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.tag-cloud-item:hover {
  background: var(--color-tag-bg-hover);
  color: var(--color-tag-text-hover);
  border-color: var(--color-accent-light);
  transform: translateY(-1px);
}

.tag-count {
  font-size: 0.75em;
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.1em 0.5em;
  border-radius: var(--radius-full);
}

.tag-cloud-size-xs { font-size: 0.8rem; }
.tag-cloud-size-sm { font-size: 0.9rem; }
.tag-cloud-size-md { font-size: 1rem; }
.tag-cloud-size-lg { font-size: 1.1rem; }
.tag-cloud-size-xl { font-size: 1.2rem; }

.tag-posts-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.tag-post-list {
  list-style: none;
  padding: 0;
  margin-left: var(--space-4);
}

.tag-post-list li {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.tag-post-list li:last-child {
  border-bottom: none;
}

.tag-post-list time {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-width: 4.5em;
  flex-shrink: 0;
}

.tag-post-list a {
  color: var(--color-text);
  font-size: var(--text-base);
  transition: color var(--transition-fast);
}

.tag-post-list a:hover {
  color: var(--color-accent);
}

/* About & Links — content area inside card (no duplicate card styling) */
.page-about .post-content,
.page-links .post-content {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.link-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.link-item {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition-base);
}

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

.link-item-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.link-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.link-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-name {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-name a {
  color: inherit;
  text-decoration: none;
}

.link-name a:hover {
  color: var(--color-accent);
}

.link-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   22. COLUMNS LAYOUT
   ============================================================ */
.columns-2,
.columns-3 {
  display: grid;
  gap: var(--space-6);
  margin: var(--space-6) 0;
}

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

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

@media (max-width: 768px) {
  .columns-2,
  .columns-3 {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* ============================================================
   23. MATHJAX & MATH FORMULAS
   ============================================================ */
.MathJax,
.MJX-TEX {
  font-size: 1.1em !important;
  line-height: 1.4;
}

.mjx-chtml {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.mjx-chtml[display="true"] {
  margin: 1em 0;
  text-align: center;
}

.mjx-chtml[display="true"] .mjx-mrow {
  display: inline-block;
  text-align: center;
}

.mjx-chtml[display="false"] {
  margin: 0 0.2em;
}

/* ============================================================
   24. GISCUS COMMENTS
   ============================================================ */
.giscus,
.giscus-frame {
  width: 100%;
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-8);
}

.giscus-placeholder {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  margin-top: var(--space-8);
}

.giscus-placeholder p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.giscus-placeholder button {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}

.giscus-placeholder button:hover {
  background: var(--color-accent-hover);
}

/* ============================================================
   25. PERFORMANCE & OPTIMIZATION
   ============================================================ */
/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .post-card:hover,
  .link-item:hover,
  .back-to-top:hover,
  .tag-cloud-item:hover {
    transform: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #000000;
    --color-accent: #0000ff;
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-border: #000000;
  }
  
  .site-header {
    background: #ffffff;
    border-bottom: 2px solid #000000;
  }
  
  .site-header.scrolled {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  }
  
  .post-card,
  .post-full,
  .grid-sidebar,
  .toc-sticky {
    border: 2px solid #000000;
    background: #ffffff;
  }
  
  .post-card:hover,
  .post-full:hover {
    border: 2px solid #0000ff;
  }
  
  a {
    text-decoration: underline;
  }
  
  .post-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  
  .nav-link:hover,
  .header-btn:hover {
    outline: 2px solid #000000;
  }
  
  .tag,
  .cat-link {
    border: 1px solid #000000;
  }
  
  .code-block-header {
    background: #000000 !important;
    color: #ffffff !important;
  }
  
  .code-copy-btn {
    border: 1px solid #ffffff;
    color: #ffffff;
  }
  
  .code-copy-btn:hover {
    background: #ffffff;
    color: #000000;
  }
  
  .search-modal {
    border: 2px solid #000000;
  }
  
  .search-input {
    border: 1px solid #000000;
  }
  
  .back-to-top {
    border: 2px solid #000000;
  }
  
  .pagination-current {
    background: #000000 !important;
    color: #ffffff !important;
  }
}

/* ============================================================
   26. UTILITIES
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }
.mr-0 { margin-right: 0; }

.mt-1 { margin-top: var(--space-1); }
.mb-1 { margin-bottom: var(--space-1); }
.ml-1 { margin-left: var(--space-1); }
.mr-1 { margin-right: var(--space-1); }

.mt-2 { margin-top: var(--space-2); }
.mb-2 { margin-bottom: var(--space-2); }
.ml-2 { margin-left: var(--space-2); }
.mr-2 { margin-right: var(--space-2); }

.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.ml-4 { margin-left: var(--space-4); }
.mr-4 { margin-right: var(--space-4); }

.mt-6 { margin-top: var(--space-6); }
.mb-6 { margin-bottom: var(--space-6); }
.ml-6 { margin-left: var(--space-6); }
.mr-6 { margin-right: var(--space-6); }

.mt-8 { margin-top: var(--space-8); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-8 { margin-left: var(--space-8); }
.mr-8 { margin-right: var(--space-8); }

.pt-0 { padding-top: 0; }
.pb-0 { padding-bottom: 0; }
.pl-0 { padding-left: 0; }
.pr-0 { padding-right: 0; }

.pt-1 { padding-top: var(--space-1); }
.pb-1 { padding-bottom: var(--space-1); }
.pl-1 { padding-left: var(--space-1); }
.pr-1 { padding-right: var(--space-1); }

.pt-2 { padding-top: var(--space-2); }
.pb-2 { padding-bottom: var(--space-2); }
.pl-2 { padding-left: var(--space-2); }
.pr-2 { padding-right: var(--space-2); }

.pt-4 { padding-top: var(--space-4); }
.pb-4 { padding-bottom: var(--space-4); }
.pl-4 { padding-left: var(--space-4); }
.pr-4 { padding-right: var(--space-4); }

.pt-6 { padding-top: var(--space-6); }
.pb-6 { padding-bottom: var(--space-6); }
.pl-6 { padding-left: var(--space-6); }
.pr-6 { padding-right: var(--space-6); }

.pt-8 { padding-top: var(--space-8); }
.pb-8 { padding-bottom: var(--space-8); }
.pl-8 { padding-left: var(--space-8); }
.pr-8 { padding-right: var(--space-8); }

/* Post navigation enhanced */
.post-nav {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-top: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.post-nav-link {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-nav-link:hover {
  color: var(--color-accent);
}

/* Archive page */
.page-archive {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.archive-year-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin: var(--space-6) 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-accent);
}

.archive-year-count {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}

.archive-list {
  list-style: none;
  padding: 0;
}

.archive-item {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
}

.archive-item time {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-width: 60px;
  flex-shrink: 0;
}

.archive-item a {
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.archive-item a:hover {
  color: var(--color-accent);
}

/* Categories page */
.page-categories {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.category-section {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.category-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.category-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

.category-title a {
  color: var(--color-primary);
}

.category-title a:hover {
  color: var(--color-accent);
}

.category-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  padding: 0.125em 0.625em;
  border-radius: var(--radius-full);
  margin-left: var(--space-2);
  vertical-align: middle;
}

.category-post-list {
  list-style: none;
  padding: 0;
}

.category-post-list li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
}

.category-post-list li:last-child {
  border-bottom: none;
}

.category-post-list time {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-width: 90px;
  flex-shrink: 0;
}

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

.category-post-list a:hover {
  color: var(--color-accent);
}

/* Tags cloud page */
.page-tags {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* Page category & tag (individual) */
.page-category,
.page-tag {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* Page about */
.page-about {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* Page links */
.page-links {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

/* Page title unified */
.page-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-accent);
}

/* ============================================================
   27. LIGHTBOX
   ============================================================ */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  justify-content: center;
  align-items: center;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-image {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  z-index: 1;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-6);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  line-height: 1;
  user-select: none;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
  left: var(--space-4);
}

.lightbox-next {
  right: var(--space-4);
}

.lightbox-counter {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  pointer-events: none;
}

/* ============================================================
   28. RIPPLE EFFECT
   ============================================================ */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.3);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================================
   END OF STYLESHEET
   ============================================================ */
