/* ===== CSS Variables & Theme ===== */
:root {
  --font-sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --font-serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Iowan Old Style', serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --bg: #f6f0e7;
  --bg-alt: #efe6da;
  --bg-card: #ffffff;
  --text: #181411;
  --text-secondary: #6b625a;
  --text-muted: #9a8f84;
  --border: #e2d7cb;
  --border-light: #efe6dc;
  --accent: #9f5d1f;
  --accent-hover: #7c4512;
  --accent-light: #f5dfbf;
  --accent-subtle: rgba(159, 93, 31, 0.08);
  --heart: #ef4444;
  --heart-light: #fef2f2;
  --shadow: 0 1px 3px rgba(26, 20, 17, 0.08), 0 1px 2px rgba(26, 20, 17, 0.05);
  --shadow-md: 0 8px 20px rgba(26, 20, 17, 0.08), 0 3px 8px rgba(26, 20, 17, 0.05);
  --shadow-lg: 0 18px 36px rgba(26, 20, 17, 0.1), 0 8px 16px rgba(26, 20, 17, 0.06);
  --shadow-xl: 0 28px 50px rgba(26, 20, 17, 0.14), 0 14px 24px rgba(26, 20, 17, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --max-width: 1100px;
  --nav-height: 72px;
  --toc-width: 240px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
}

[data-theme="dark"] {
  --bg: #1c1917;
  --bg-alt: #292524;
  --bg-card: #292524;
  --text: #fafaf9;
  --text-secondary: #a8a29e;
  --text-muted: #78716c;
  --border: #44403c;
  --border-light: #3a3632;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-light: #451a03;
  --accent-subtle: rgba(245, 158, 11, 0.1);
  --heart: #f87171;
  --heart-light: #451a1a;
  --shadow: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.35);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.4);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent-light);
  color: var(--accent-hover);
}

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

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

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 750px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== Reading Progress Bar ===== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  z-index: 1000;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

.reading-progress::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
  opacity: 0.6;
}

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  transition: color var(--transition-fast);
}
.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
  transition: color var(--transition-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  right: 50%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: left var(--transition-base), right var(--transition-base);
}

.nav-links a:hover::after {
  left: 0;
  right: 0;
}

.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  left: 0;
  right: 0;
}

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  transition: 0.3s;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast), transform var(--transition-base);
}
.theme-toggle:hover { color: var(--text); transform: rotate(15deg); }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ===== Hero ===== */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-family: var(--font-serif);
}

/* ===== Sections ===== */
.section { padding: 3rem 0; }
.section-alt { background: var(--bg-alt); }

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

.section-header h1, .section-header h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
}

.link-more {
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap var(--transition-base);
}
.link-more:hover {
  gap: 0.5rem;
}

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-family: var(--font-serif); font-size: 2rem; margin-bottom: 0.5rem; }

.filter-hint { color: var(--text-secondary); font-size: 0.9rem; }
.filter-hint a { margin-left: 0.5rem; }

.empty-hint {
  color: var(--text-muted);
  font-style: italic;
  padding: 3rem 0;
  text-align: center;
}

.empty-hint::before {
  content: '';
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px dashed var(--border);
}

/* ===== Article Cards (Home) ===== */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.article-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.article-card-cover { display: block; aspect-ratio: 16/9; overflow: hidden; }
.article-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.article-card:hover .article-card-cover img { transform: scale(1.05); }

.article-card-body { padding: 1.25rem; }
.article-card-body time { font-size: 0.8rem; color: var(--text-muted); }
.article-card-body h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0.3rem 0 0.5rem;
  line-height: 1.4;
}
.article-card-body h3 a {
  color: var(--text);
  transition: color var(--transition-fast);
}
.article-card-body h3 a:hover { color: var(--accent); }
.article-card-body p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* ===== Article List (Articles page) ===== */
.article-list { display: flex; flex-direction: column; gap: 1.5rem; }

.article-row {
  display: flex;
  gap: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.article-row:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.article-row-cover { flex-shrink: 0; width: 240px; overflow: hidden; }
.article-row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.article-row:hover .article-row-cover img { transform: scale(1.05); }

.article-row-body { padding: 1.25rem; flex: 1; }
.article-row-body time { font-size: 0.8rem; color: var(--text-muted); }
.article-row-body h2 { font-family: var(--font-serif); font-size: 1.25rem; margin: 0.3rem 0 0.5rem; }
.article-row-body h2 a { color: var(--text); }
.article-row-body h2 a:hover { color: var(--accent); }
.article-row-body p { font-size: 0.9rem; color: var(--text-secondary); }

/* ===== Tags ===== */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.tag {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 99px;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.tag:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}
.tag.active { background: var(--accent); color: #fff; }

.album-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* ===== Article Detail ===== */
.article-header { text-align: center; padding: 3rem 0 2rem; }
.article-header time { font-size: 0.85rem; color: var(--text-muted); }
.article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0.5rem 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.article-header .tags { justify-content: center; }

/* Article meta row */
.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.article-meta span svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.article-cover {
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.article-cover img { width: 100%; }

/* Article layout with TOC */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  position: relative;
}

@media (min-width: 1200px) {
  .article-layout {
    grid-template-columns: 1fr var(--toc-width);
  }
}

/* ===== Table of Contents ===== */
.toc {
  display: none;
}

@media (min-width: 1200px) {
  .toc {
    display: block;
    position: relative;
  }
}

.toc-inner {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
  max-height: calc(100vh - var(--nav-height) - 4rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border-light);
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  text-decoration: none;
}

.toc-list a:hover {
  color: var(--text-secondary);
  background: var(--accent-subtle);
}

.toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* Indentation for h3 links */
.toc-list .toc-h3 a {
  padding-left: 1.5rem;
  font-size: 0.78rem;
}

.toc-list .toc-h4 a {
  padding-left: 2.25rem;
  font-size: 0.75rem;
}

/* ===== Prose (article content) ===== */
.prose {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.9;
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  margin: 2.5rem 0 1rem;
  line-height: 1.3;
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose p { margin-bottom: 1.25rem; }

.prose img {
  border-radius: var(--radius-lg);
  margin: 2rem 0;
  cursor: zoom-in;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.prose img:hover {
  box-shadow: var(--shadow-lg);
}
.prose img.zoomed {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  max-width: 90vw;
  max-height: 90vh;
  z-index: 999;
  cursor: zoom-out;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
}
.image-zoom-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 998;
  cursor: zoom-out;
}
.image-zoom-overlay.active { display: block; }

/* Blockquote */
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--accent-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* Code blocks */
.prose pre {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.prose pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
  font-family: var(--font-sans);
}
.code-copy-btn:hover {
  color: var(--text);
  background: var(--bg);
}
.code-copy-btn.copied {
  color: #16a34a;
  opacity: 1;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.prose :not(pre) > code {
  background: var(--bg-alt);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-light);
}
.prose ul, .prose ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.3rem; }
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color var(--transition-fast), color var(--transition-fast);
}
.prose a:hover {
  text-decoration-color: var(--accent);
}

/* ===== Like Button ===== */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
  user-select: none;
}

.like-btn:hover {
  border-color: var(--heart);
  background: var(--heart-light);
}

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

.like-btn .like-icon {
  display: inline-flex;
  font-size: 1.1rem;
  transition: transform var(--transition-base);
}

.like-btn .like-icon svg,
.like-btn .like-icon::before {
  transition: transform var(--transition-base);
}

.like-btn.liked {
  border-color: var(--heart);
  color: var(--heart);
  background: var(--heart-light);
}

.like-btn.liked .like-icon {
  animation: likeHeart 0.4s ease;
}

@keyframes likeHeart {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.like-btn .like-count {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 1rem;
  text-align: center;
}

/* ===== Share Buttons ===== */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-size: 1rem;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.share-btn.share-twitter:hover { border-color: #1da1f2; color: #1da1f2; background: rgba(29, 161, 242, 0.08); }
.share-btn.share-facebook:hover { border-color: #1877f2; color: #1877f2; background: rgba(24, 119, 242, 0.08); }
.share-btn.share-linkedin:hover { border-color: #0a66c2; color: #0a66c2; background: rgba(10, 102, 194, 0.08); }
.share-btn.share-copy:hover { border-color: var(--accent); color: var(--accent); }
.share-btn.share-copy.copied {
  border-color: #16a34a;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

.share-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.25rem;
}

/* Article actions bar (like + share) */
.article-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  margin: 2rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ===== Comments Section ===== */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

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

.comments-header h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
}

.comments-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-weight: 500;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.comment-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  transition: border-color var(--transition-fast);
}
.comment-item:hover {
  border-color: var(--border);
}

.comment-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-content { flex: 1; min-width: 0; }

.comment-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.comment-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comment-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.comment-body p { margin: 0; }
.comment-body p + p { margin-top: 0.5rem; }

.comment-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
}

.comment-action-btn {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  transition: color var(--transition-fast);
}
.comment-action-btn:hover {
  color: var(--accent);
}

/* Comment replies (indented) */
.comment-reply {
  margin-left: 2.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-light);
}

.comment-reply .comment-item {
  background: var(--bg);
}

/* Comment form */
.comment-form {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.comment-form-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.comment-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.comment-form textarea::placeholder {
  color: var(--text-muted);
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Google login button */
.google-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
}

.google-login-btn:hover {
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
}

.google-login-btn svg,
.google-login-btn img {
  width: 18px;
  height: 18px;
}

.comment-login-prompt {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  margin-top: 1.5rem;
}

.comment-login-prompt p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

/* ===== Article navigation ===== */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.article-nav a {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.article-nav a:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}
.article-nav a small { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.article-nav a span { color: var(--text); font-weight: 500; }
.article-nav-next { text-align: right; }

/* ===== Photo Grid ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.photo-grid-large {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Masonry-like layout option */
.photo-grid-masonry {
  columns: 3;
  column-gap: 0.75rem;
}

.photo-grid-masonry .photo-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  aspect-ratio: auto;
}

.photo-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-alt);
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.photo-item:hover img { transform: scale(1.05); }

.photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.75rem 0.75rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.photo-item:hover .photo-overlay { opacity: 1; }

/* ===== Lightbox ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  animation: lightboxFadeIn var(--transition-base) ease;
}
.lightbox.active { display: flex; }

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

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
  opacity: 0.7;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.lightbox-close:hover { opacity: 1; transform: scale(1.1); }

.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.75rem;
  z-index: 10;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}
.lightbox-prev:hover, .lightbox-next:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-content {
  text-align: center;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  transition: transform var(--transition-base);
  border-radius: 4px;
}

.lightbox-caption {
  color: #ccc;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Lightbox info panel */
.lightbox-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 2rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.lightbox-info-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.lightbox-info-meta {
  font-size: 0.8rem;
  opacity: 0.7;
}

.lightbox-info-actions {
  display: flex;
  gap: 0.5rem;
  pointer-events: all;
}

.lightbox-counter {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  z-index: 10;
}

/* ===== Toast / Snackbar Notifications ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  pointer-events: all;
  animation: toastSlideIn var(--transition-base) ease;
  max-width: 360px;
}

.toast.toast-success {
  border-left: 3px solid #16a34a;
}
.toast.toast-error {
  border-left: 3px solid #dc2626;
}
.toast.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

.toast.toast-exit {
  animation: toastSlideOut var(--transition-fast) ease forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(1rem);
  }
}

/* ===== About ===== */
.about-page { padding: 3rem 0; }
.about-page h1 { font-family: var(--font-serif); font-size: 2rem; margin-bottom: 1.5rem; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.page-info { font-size: 0.9rem; color: var(--text-muted); }

/* ===== Footer ===== */
.main { flex: 1; }

.footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.5;
  font-family: var(--font-sans);
}
.btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-danger { color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; color: var(--text-secondary); }

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-group textarea { resize: vertical; font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.6; }

.form-row { display: flex; gap: 1rem; align-items: flex-end; }
.flex-1 { flex: 1; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.form-actions > div { display: flex; gap: 0.5rem; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }

[data-theme="dark"] .alert-error { background: #451a1a; color: #f87171; border-color: #7f1d1d; }
[data-theme="dark"] .alert-success { background: #14532d33; color: #4ade80; border-color: #14532d; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-gray { background: var(--bg-alt); color: var(--text-muted); }

/* ===== Editor ===== */
.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.editor-toolbar button {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.editor-toolbar button:hover { background: var(--border); }

.editor-toolbar + textarea { border-radius: 0 0 var(--radius) var(--radius); }

.cover-preview { margin-bottom: 0.5rem; }

/* ===== Admin Layout ===== */
.admin-body { background: var(--bg); }

.login-box {
  max-width: 380px;
  margin: 10vh auto;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.login-box h1 { font-family: var(--font-serif); text-align: center; margin-bottom: 1.5rem; }

.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  flex-shrink: 0;
}

.admin-brand {
  padding: 0 1.25rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
}
.admin-brand a { color: var(--text); }

.admin-nav { display: flex; flex-direction: column; }
.admin-nav a {
  display: block;
  padding: 0.6rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.admin-nav a:hover { background: var(--bg-alt); color: var(--text); }
.admin-nav a.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.admin-nav hr { border: none; border-top: 1px solid var(--border); margin: 0.5rem 1.25rem; }

.admin-main { flex: 1; overflow-x: auto; }
.admin-content { padding: 2rem; max-width: 1000px; }

/* Admin stats */
.admin-stats { display: flex; gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  flex: 1;
  text-align: center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.stat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.25rem; }

.admin-section { margin-bottom: 2rem; }

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.admin-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}
.admin-table tr:hover td {
  background: var(--bg-alt);
}
.admin-table td a { font-weight: 500; }

/* Admin photo grid */
.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.admin-photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.admin-photo-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.admin-photo-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }

.photo-edit-form { padding: 0.75rem; }
.photo-edit-form input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
  background: var(--bg);
  color: var(--text);
}
.photo-card-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.admin-photo-card > form:last-child { padding: 0 0.75rem 0.75rem; }

/* Upload area */
.upload-zone { margin-bottom: 2rem; }
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.upload-area:hover { border-color: var(--accent); background: var(--accent-light); }
.upload-area.dragging { border-color: var(--accent); background: var(--accent-light); }
.upload-area p { margin-bottom: 0.25rem; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.upload-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ===== Article TOC (sidebar) ===== */
.article-toc {
  display: none;
}

@media (min-width: 1200px) {
  .article-toc {
    display: block;
    position: relative;
  }
}

.article-toc .toc-inner {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
  max-height: calc(100vh - var(--nav-height) - 4rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.article-toc .toc-inner h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

/* ===== Article Card Footer & Stats ===== */
.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

.article-card-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-card-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ===== Article Actions: Like & Share sections ===== */
.like-section {
  display: flex;
  align-items: center;
}

.share-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Heart icon in like button */
.heart-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill var(--transition-fast), stroke var(--transition-fast);
}

.like-btn.liked .heart-icon {
  fill: var(--heart);
  stroke: var(--heart);
}

.like-bounce {
  animation: likeHeart 0.4s ease !important;
}

/* ===== Comments Section Enhancements ===== */
.comments-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.comment-form-wrapper {
  margin-bottom: 2rem;
}

.comment-login-area {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.comment-login-area > p:first-child {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.comment-login-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1rem 0 0.75rem;
}

.guest-comment-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  max-width: 360px;
  margin: 0 auto;
}

.guest-comment-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.guest-comment-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.comment-user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.comment-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-reply-btn {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0;
  margin-top: 0.35rem;
  font-family: var(--font-sans);
  transition: color var(--transition-fast);
}

.comment-reply-btn:hover {
  color: var(--accent);
}

.comment-replies {
  margin-top: 0.75rem;
  margin-left: 2.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-replies .comment-item {
  background: var(--bg);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#reply-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#reply-hint a {
  margin-left: 0.5rem;
  font-size: 0.8rem;
}

body {
  background-image:
    radial-gradient(circle at top left, rgba(159, 93, 31, 0.08), transparent 34%),
    radial-gradient(circle at top right, rgba(24, 20, 17, 0.05), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
  background-attachment: fixed;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.04), transparent 24%),
    linear-gradient(180deg, rgba(17, 14, 12, 0.46), rgba(17, 14, 12, 0));
}

.nav {
  background: color-mix(in srgb, var(--bg) 82%, rgba(255, 255, 255, 0.68));
  border-bottom-color: rgba(24, 20, 17, 0.08);
}

.nav-inner {
  gap: 1.25rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  letter-spacing: 0.02em;
}

.nav-brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.9rem;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid rgba(24, 20, 17, 0.08);
}

.nav-links {
  gap: 1.1rem;
  flex: 1;
  justify-content: flex-end;
}

.nav-search {
  display: flex;
  align-items: center;
  min-width: 240px;
}

.nav-search input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(24, 20, 17, 0.08);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-size: 0.88rem;
}

.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.hero-upgraded {
  position: relative;
  overflow: hidden;
  padding: 5.75rem 0 3.75rem;
}

.hero-upgraded::before,
.hero-upgraded::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  z-index: -1;
}

.hero-upgraded::before {
  width: 26rem;
  height: 26rem;
  right: -6rem;
  top: -10rem;
  background: radial-gradient(circle, rgba(159, 93, 31, 0.15), transparent 70%);
}

.hero-upgraded::after {
  width: 22rem;
  height: 22rem;
  left: -8rem;
  bottom: -12rem;
  background: radial-gradient(circle, rgba(24, 20, 17, 0.08), transparent 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.9fr);
  gap: 2rem;
  align-items: stretch;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.hero-kicker::before {
  content: '';
  width: 2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.hero-copy,
.page-summary {
  max-width: 46rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.hero-copy {
  margin-top: 1.1rem;
}

.hero-search,
.search-panel,
.insight-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.hero-search input,
.search-panel input,
.insight-search input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-size: 0.95rem;
}

.hero-search input:focus,
.search-panel input:focus,
.insight-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.hero-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.hero-quick-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(10px);
}

.hero-quick-links a:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.88);
}

.hero-portrait-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 22rem;
  padding: 1.6rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  border-radius: 2rem;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.9), rgba(245, 228, 204, 0.7)),
    radial-gradient(circle at top right, rgba(24, 20, 17, 0.12), transparent 45%);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.hero-portrait-card::after {
  content: '';
  position: absolute;
  inset: 1rem;
  border-radius: 1.35rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  pointer-events: none;
}

.hero-portrait-mark {
  position: absolute;
  inset: 1rem 1rem auto auto;
  width: min(18rem, 72%);
  opacity: 0.9;
  filter: saturate(0.9) contrast(1.05);
  border-radius: 1.8rem;
  object-fit: cover;
  box-shadow: 0 18px 35px rgba(24, 20, 17, 0.18);
}

.hero-portrait-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.35rem;
  max-width: 18rem;
}

.hero-portrait-copy strong {
  font-family: var(--font-serif);
  font-size: 1.4rem;
}

.hero-portrait-copy span {
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.stats-strip {
  margin-top: -1rem;
  padding-bottom: 1rem;
}

.stats-strip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.stats-pill {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.stats-pill strong {
  font-size: 1.3rem;
  color: var(--text);
}

.stats-pill span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.discover-layout,
.taxonomy-layout,
.insight-columns {
  display: grid;
  gap: 1.5rem;
}

.discover-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.taxonomy-layout,
.insight-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.discover-main {
  min-width: 0;
}

.insight-panel {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  display: grid;
  gap: 1rem;
}

.insight-search {
  padding: 1.2rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.insight-search label {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.insight-card {
  padding: 1.25rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.insight-head h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

.insight-head span,
.insight-head a {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.insight-stats,
.footer-stats,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
}

.insight-stats span,
.footer-stats span {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.insight-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 1rem;
  background: var(--bg);
  border: 1px solid transparent;
  color: var(--text);
}

.chip:hover {
  border-color: rgba(24, 20, 17, 0.08);
  color: var(--text);
}

.chip em {
  font-style: normal;
  color: var(--text-muted);
}

.chip-tag {
  width: auto;
  background: rgba(159, 93, 31, 0.08);
}

.insight-list {
  display: grid;
  gap: 0.65rem;
}

.insight-list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
  background: var(--bg);
  color: var(--text);
}

.insight-list-item strong {
  font-weight: 600;
}

.insight-list-item time {
  color: var(--text-muted);
  white-space: nowrap;
}

.article-card,
.article-row,
.taxonomy-card,
.stat-card {
  border-color: rgba(24, 20, 17, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.article-card-topline,
.article-row-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.article-card-topline-center {
  justify-content: center;
}

.category-badge,
.article-badge {
  display: inline-flex;
  align-items: center;
  height: 1.85rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.category-badge {
  background: rgba(24, 20, 17, 0.08);
  color: var(--text);
}

.category-badge:hover {
  background: rgba(159, 93, 31, 0.12);
  color: var(--accent-hover);
}

.article-badge {
  background: var(--accent);
  color: #fff;
}

.article-row-upgraded {
  border-radius: 1.5rem;
}

.article-row-upgraded .article-row-body,
.weekly-card .article-card-body {
  display: grid;
  gap: 0.75rem;
}

.article-row-upgraded p,
.weekly-card p {
  margin: 0;
}

.related-section {
  margin-top: 3rem;
}

.search-summary {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  align-content: start;
}

.taxonomy-grid-tags {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.taxonomy-card {
  display: grid;
  gap: 0.35rem;
  padding: 1.15rem;
  border-radius: 1.3rem;
  box-shadow: var(--shadow);
}

.taxonomy-card strong {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
}

.taxonomy-card span {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.taxonomy-card.active,
.taxonomy-card:hover {
  transform: translateY(-2px);
  border-color: rgba(159, 93, 31, 0.18);
  box-shadow: var(--shadow-lg);
}

.taxonomy-preview {
  padding: 1.35rem;
  border-radius: 1.6rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.compact-list .article-row {
  box-shadow: none;
}

.stats-grid,
.admin-stats-wide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 8.4rem;
  padding: 1.4rem;
}

.stat-card::after {
  content: '';
  position: absolute;
  width: 5rem;
  height: 5rem;
  right: -1.4rem;
  bottom: -1.4rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(159, 93, 31, 0.12), transparent 68%);
}

.stat-number {
  position: relative;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.footer {
  margin-top: 3rem;
  padding: 2.4rem 0;
  text-align: left;
  background: rgba(255, 255, 255, 0.6);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  gap: 1.25rem;
  align-items: start;
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text);
}

.footer-meta {
  margin-top: 0.55rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

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

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

.comments-section {
  margin-top: 3.5rem;
}

.comment-form-advanced {
  margin-bottom: 1.4rem;
  padding: 1.4rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
  border-radius: 1.6rem;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.comment-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.comment-form-advanced .form-group small,
.markdown-tip,
.captcha-note {
  display: block;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.captcha-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.captcha-refresh {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.captcha-refresh:hover {
  color: var(--accent-hover);
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.comment-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.comment-preview-item {
  width: 92px;
  display: grid;
  gap: 0.35rem;
}

.comment-preview-item img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 0.9rem;
  border: 1px solid rgba(24, 20, 17, 0.08);
}

.comment-preview-item span {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comment-item {
  display: block;
  padding: 1.15rem;
  border-radius: 1.3rem;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(24, 20, 17, 0.08);
  box-shadow: var(--shadow);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.comment-avatar {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(24, 20, 17, 0.08);
  background: var(--accent-light);
}

.comment-info {
  display: grid;
  gap: 0.15rem;
}

.comment-info time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.comment-body {
  color: var(--text-secondary);
}

.prose-comment {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.8;
}

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

.prose-comment pre {
  margin: 1rem 0;
}

.prose-comment img {
  margin: 0.9rem 0;
  max-width: min(100%, 20rem);
}

.comment-reply {
  margin-left: 0;
}

.comment-replies {
  margin-top: 1rem;
  margin-left: 2rem;
  padding-left: 1rem;
  border-left: 2px solid rgba(24, 20, 17, 0.08);
}

.comment-reply-btn {
  margin-top: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

.comment-form-actions {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.admin-brand a {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.admin-brand-mark,
.login-brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
  object-fit: cover;
  border: 1px solid rgba(24, 20, 17, 0.08);
}

.login-brand-mark-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-subtitle {
  margin: -0.75rem 0 1.3rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

.login-box {
  border: 1px solid rgba(24, 20, 17, 0.08);
}

.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

.editor-toggles {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

[data-theme="dark"] .nav-search input,
[data-theme="dark"] .hero-search input,
[data-theme="dark"] .search-panel input,
[data-theme="dark"] .insight-search input {
  background: rgba(28, 25, 23, 0.82);
}

[data-theme="dark"] .hero-portrait-card,
[data-theme="dark"] .comment-form-advanced,
[data-theme="dark"] .comment-item,
[data-theme="dark"] .insight-card,
[data-theme="dark"] .insight-search,
[data-theme="dark"] .taxonomy-preview,
[data-theme="dark"] .footer,
[data-theme="dark"] .stats-pill,
[data-theme="dark"] .article-card,
[data-theme="dark"] .article-row,
[data-theme="dark"] .taxonomy-card,
[data-theme="dark"] .stat-card {
  background: rgba(41, 37, 36, 0.82);
}

[data-theme="dark"] .hero-quick-links a,
[data-theme="dark"] .nav-search input {
  background: rgba(41, 37, 36, 0.72);
}

/* ===== Page Transition ===== */
.main {
  animation: pageEnter var(--transition-base) ease;
}

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

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border-light) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

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

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .hero-grid,
  .discover-layout,
  .taxonomy-layout,
  .insight-columns {
    grid-template-columns: 1fr;
  }

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

  .stats-grid,
  .admin-stats-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-panel {
    position: static;
  }

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

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    align-items: stretch;
  }
  .nav-links.open { display: flex; }
  .nav-links a::after { display: none; }
  .nav-search {
    width: 100%;
    min-width: 0;
  }
  .nav-search input {
    min-width: 0;
  }

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

  .article-row { flex-direction: column; }
  .article-row-cover { width: 100%; aspect-ratio: 16/9; }

  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .photo-grid-large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

  .photo-grid-masonry { columns: 2; }

  .article-nav { grid-template-columns: 1fr; }

  .hero { padding: 3rem 0 2rem; }
  .hero-upgraded { padding-top: 3.75rem; }
  .hero-search,
  .search-panel,
  .insight-search,
  .comment-form-grid {
    grid-template-columns: 1fr;
  }
  .hero-portrait-card {
    min-height: 16rem;
  }
  .stats-strip {
    margin-top: 0;
  }
  .stats-strip-grid,
  .stats-grid,
  .admin-stats-wide {
    grid-template-columns: 1fr;
  }

  .form-row { flex-direction: column; }
  .form-row > * { width: 100% !important; }

  /* Article actions stack */
  .article-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Comments */
  .comment-replies {
    margin-left: 1rem;
  }
  .comment-form-actions {
    align-items: flex-start;
  }

  /* TOC hidden on mobile by default */
  .toc, .article-toc { display: none !important; }

  /* Toast */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
  .toast { max-width: 100%; }

  /* Lightbox */
  .lightbox-prev, .lightbox-next {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  /* Admin responsive */
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 1rem 0; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; padding: 0 0.5rem; }
  .admin-nav a { padding: 0.4rem 0.75rem; }
  .admin-nav hr { display: none; }
  .admin-content { padding: 1.5rem; }
  .admin-stats { flex-direction: column; }
}

@media (max-width: 480px) {
  .photo-grid-masonry { columns: 1; }

  .share-btn {
    width: 36px;
    height: 36px;
  }
  .share-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* ===== Print ===== */
@media print {
  .nav, .footer, .reading-progress, .toc, .article-actions,
  .share-buttons, .like-btn, .comments-section, .toast-container { display: none !important; }

  .prose { font-size: 12pt; }

  body { background: #fff; color: #000; }
}

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

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