/* ==========================================
   Zenn-style Design for Hugo Blog
   ========================================== */

/* --- CSS Custom Properties (Light/Dark) --- */
:root {
  --bg-primary: #f1f5f9;
  --bg-card: #fff;
  --bg-code-inline: #f1f5f9;
  --bg-emoji: #f1f5f9;
  --bg-blockquote: #eff6ff;
  --bg-tag: #eff6ff;
  --bg-tag-hover: #dbeafe;
  --bg-table-header: #f8fafc;
  --bg-related: #f8fafc;
  --bg-related-hover: #eff6ff;
  --text-primary: #333;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-code-inline: #d63384;
  --border-color: #e5e7eb;
  --accent: #3ea8ff;
  --accent-hover: #0f83fd;
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-primary: #1a1b26;
  --bg-card: #24283b;
  --bg-code-inline: #343a52;
  --bg-emoji: #343a52;
  --bg-blockquote: #1e2235;
  --bg-tag: #1e2a3a;
  --bg-tag-hover: #253347;
  --bg-table-header: #2a2f42;
  --bg-related: #2a2f42;
  --bg-related-hover: #1e2a3a;
  --text-primary: #c0caf5;
  --text-secondary: #9aa5ce;
  --text-muted: #565f89;
  --text-code-inline: #ff7eb6;
  --border-color: #3b4261;
  --accent: #7aa2f7;
  --accent-hover: #89b4fa;
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "BIZ UDPGothic", "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.7;
  letter-spacing: 0.02em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

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

/* --- Site Layout --- */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
  padding: 2rem 1rem;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  height: 64px;
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: auto;
}

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

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

.header-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

/* --- Header Actions (Search, Dark Mode, Hamburger) --- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  font-size: 1.1rem;
  line-height: 1;
}

.header-icon-btn:hover {
  background: var(--bg-emoji);
  color: var(--accent);
}

.header-icon-btn svg {
  display: block;
}

/* --- Hamburger Button --- */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
}

.hamburger-btn:hover {
  background: var(--bg-emoji);
}

.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Nav Overlay (mobile) --- */
.nav-overlay {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  width: 100%;
  height: calc(100% - 64px);
  background: rgba(0, 0, 0, 0.4);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s;
}

.nav-overlay.active {
  opacity: 1;
}

/* --- Search Overlay --- */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

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

.search-modal {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-input {
  padding: 1rem 1.25rem;
  border: none;
  border-bottom: 1px solid var(--border-color);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  background: var(--bg-card);
  color: var(--text-primary);
}

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

.search-results {
  overflow-y: auto;
  flex: 1;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: background 0.2s;
}

.search-result-item:hover {
  background: var(--bg-emoji);
  color: var(--accent);
}

.search-result-title {
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
}

.search-result-date {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.search-hint {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Hero Section --- */
.hero-section {
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

.hero-section h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.hero-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Content Containers --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.container--narrow {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

/* --- Article Cards Grid --- */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-left: 0.25rem;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  list-style: none;
}

.card-item {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
}

.card-item:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.card-link {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  color: inherit;
  text-decoration: none;
  gap: 1rem;
}

.card-link:hover {
  color: inherit;
}

.card-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-emoji);
  border-radius: 8px;
}

.card-emoji img.tag-icon {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
}

[data-theme="dark"] .card-emoji img.tag-icon {
  filter: brightness(1.3);
}

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

.card-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  display: block;
}

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

.card-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.card-reading-time {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
}

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

.card-tag-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  background: var(--bg-emoji);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
}

.view-all-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
}

.view-all-link:hover {
  background: var(--bg-tag);
  border-color: var(--accent);
}

/* --- Reading Time --- */
.reading-time {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* --- Breadcrumb --- */
.breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.breadcrumb a {
  color: var(--text-secondary);
  transition: color 0.2s;
}

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

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pagination-pages {
  display: flex;
  gap: 0.25rem;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

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

.pagination-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

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

/* --- Single Article Layout --- */
.article-layout {
  display: flex;
  gap: 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  align-items: flex-start;
}

.article-main {
  flex: 1;
  min-width: 0;
  max-width: 820px;
}

.article-card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* --- Article Header with Emoji --- */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.article-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  width: 4rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-emoji);
  border-radius: 12px;
}

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

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

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

/* --- Tag Badges (Pill style) --- */
.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  background: var(--bg-tag);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.2s;
  gap: 0.3rem;
}

.tag-badge::before {
  content: "#";
  opacity: 0.6;
}

.tag-badge:hover {
  background: var(--bg-tag-hover);
  color: var(--accent-hover);
}

/* --- Tags Cloud (terms page) --- */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

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

.tag-cloud-name {
  color: var(--accent);
}

.tag-cloud-count {
  background: var(--bg-emoji);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
}

/* --- Article Content --- */
.article-content {
  line-height: 1.75;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

/* --- Heading Styles (Zenn-like) --- */
.article-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  padding-bottom: 0;
  border-bottom: none;
  border-left: 4px solid var(--accent);
  color: var(--text-primary);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.article-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  padding-left: 0.75rem;
  color: var(--text-primary);
  line-height: 1.4;
  position: relative;
}

.article-content h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.article-content h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.article-content p {
  margin-bottom: 1.5em;
}

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

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

/* --- Blockquote (Zenn message box style) --- */
.article-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem 1rem 3rem;
  border-left: 4px solid var(--accent);
  background: var(--bg-blockquote);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  position: relative;
}

.article-content blockquote::before {
  content: "!";
  position: absolute;
  left: 0.75rem;
  top: 0.85rem;
  width: 1.4rem;
  height: 1.4rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

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

.article-content hr {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

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

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

.article-content th {
  background: var(--bg-table-header);
  font-weight: 600;
}

.article-content img {
  border-radius: 8px;
  margin: 1rem 0;
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.article-content img:hover {
  opacity: 0.85;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(62, 168, 255, 0.3);
  text-underline-offset: 2px;
}

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

/* --- Code Blocks --- */
.article-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
}

.article-content p code,
.article-content li code,
.article-content td code {
  padding: 0.15rem 0.4rem;
  background: var(--bg-code-inline);
  border-radius: 4px;
  color: var(--text-code-inline);
  font-size: 0.85em;
}

.article-content pre {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: #1e1e1e;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}

.article-content pre code {
  color: #d4d4d4;
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.85rem;
}

/* Hugo highlight shortcode */
.article-content .highlight {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.article-content .highlight pre {
  margin: 0;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.85rem;
}

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

/* --- Code Copy Button --- */
.code-block-wrapper {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.15);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  z-index: 10;
  font-family: inherit;
}

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

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

/* --- Sidebar TOC --- */
.article-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-container {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
}

.toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.toc-container nav#TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-container nav#TableOfContents ul ul {
  padding-left: 0.75rem;
}

.toc-container nav#TableOfContents li {
  margin-bottom: 0.25rem;
}

.toc-container nav#TableOfContents a {
  display: block;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-radius: 4px;
  line-height: 1.4;
  transition: color 0.2s, background 0.2s;
  border-left: 2px solid transparent;
}

.toc-container nav#TableOfContents a:hover {
  color: var(--accent);
  background: var(--bg-tag);
}

/* TOC active highlight */
.toc-container nav#TableOfContents a.toc-active {
  color: var(--accent);
  background: var(--bg-tag);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* --- Prev/Next Navigation --- */
.prev-next-nav {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.prev-next-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  transition: box-shadow 0.2s, color 0.2s;
  text-decoration: none;
}

.prev-next-link:hover {
  box-shadow: var(--shadow-card-hover);
  color: var(--accent);
}

.prev-next-link.empty {
  visibility: hidden;
}

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

.prev-next-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.prev-next-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

/* --- Share Buttons --- */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.share-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: opacity 0.2s, transform 0.2s;
  text-decoration: none;
}

.share-btn:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.share-twitter {
  background: #000;
  color: #fff;
}

.share-twitter:hover {
  color: #fff;
}

.share-hatena {
  background: #00a4de;
  color: #fff;
}

.share-hatena:hover {
  color: #fff;
}

/* --- Related Articles --- */
.related-articles {
  margin-top: 2rem;
}

.related-articles-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.related-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.related-list li {
  padding: 0;
}

.related-list a {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--bg-related);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.related-list a:hover {
  background: var(--bg-related-hover);
  color: var(--accent);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

.footer-copyright {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

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

/* --- Responsive --- */
@media (max-width: 900px) {
  .article-layout {
    flex-direction: column;
  }

  .article-sidebar {
    display: none;
  }

  .article-main {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .site-main {
    padding: 1rem 0.75rem;
  }

  .article-card {
    padding: 1.5rem;
    border-radius: 8px;
  }

  .article-header h1 {
    font-size: 1.35rem;
  }

  .article-emoji {
    font-size: 2rem;
    width: 3rem;
    height: 3rem;
  }

  .card-link {
    padding: 1rem 1.25rem;
    gap: 0.75rem;
  }

  .card-date {
    font-size: 0.75rem;
  }

  .hero-section h1 {
    font-size: 1.1rem;
  }

  /* Mobile hamburger */
  .hamburger-btn {
    display: flex;
  }

  .header-nav {
    position: fixed;
    top: 64px;
    right: -280px;
    width: 280px;
    height: calc(100% - 64px);
    background: var(--bg-card);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    gap: 0;
    z-index: 99;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  .header-nav.open {
    right: 0;
  }

  .header-nav a {
    font-size: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-overlay {
    display: block;
  }

  /* Prev/Next stacked on mobile */
  .prev-next-nav {
    flex-direction: column;
  }

  /* Pagination on mobile */
  .pagination {
    gap: 0.25rem;
  }

  .pagination-link {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.8rem;
  }
}

/* --- Image Lightbox --- */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

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

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform 0.3s;
}

.lightbox-overlay.active img {
  transform: scale(1);
}
