:root {
  --bg: #eff1f5;
  --surface: #e6e9ef;
  --text: #4c4f69;
  --text-heading: #4c4f69;
  --text-muted: #9ca0b0;
  --accent: #ea76cb;
  --accent-hover: #dd7878;
  --accent-blue: #1793d1;
  --accent-blue-dim: #1e66f5;
  --border: #ccd0da;
  --shadow: rgba(0,0,0,0.06);
  --header-bg: #0a0a0f;
  --header-text: #e2e8f0;
  --radius: 12px;
  --radius-sm: 8px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --max-width: 1120px;
  --focus-ring: 2px solid var(--accent-blue);
}

[data-theme="dark"] {
  --bg: #1e1e2e;
  --surface: #181825;
  --text: #cdd6f4;
  --text-heading: #cdd6f4;
  --text-muted: #6c7086;
  --accent: #f5c2e7;
  --accent-hover: #eba0ac;
  --accent-blue: #89b4fa;
  --accent-blue-dim: #74c7ec;
  --border: #313244;
  --shadow: rgba(0,0,0,0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Header ── */
.header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
}

.header-title {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-title a {
  color: #fff;
}

.header-prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 0.4rem;
  opacity: 0.85;
}

.header-prompt::before {
  content: 'josiah@blog:~$ ';
}

.header-sub {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: #94a3b8;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Terminal cursor blink ── */
.header-prompt::after {
  content: '▊';
  animation: blink 1s step-end infinite;
  margin-left: 0.15rem;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Nav ── */
.nav {
  background: var(--header-bg);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0 1.5rem;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 0;
  overflow-x: auto;
  align-items: stretch;
}

.nav-inner a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.75rem 1.25rem;
  color: #94a3b8;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-inner a:hover,
.nav-inner a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-search-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  transition: color 0.2s;
  font-family: var(--font-mono);
}
.nav-search-btn:hover {
  color: var(--accent);
}

/* ── Search overlay ── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  width: min(600px, 90vw);
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  transition: transform 0.25s ease;
}
.search-overlay.open .search-panel {
  transform: translateY(0);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap .search-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}
.search-input-wrap input::placeholder {
  color: var(--text-muted);
}
.search-input-wrap .search-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0.25rem;
  transition: color 0.2s;
}
.search-input-wrap .search-close:hover {
  color: var(--text);
}

.search-results {
  overflow-y: auto;
  padding: 0.5rem 0;
}

.search-result-item {
  display: block;
  padding: 0.6rem 1rem;
  text-decoration: none;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.search-result-item:hover,
.search-result-item.highlighted {
  background: var(--bg);
  border-left-color: var(--accent);
}
.search-result-item .result-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.search-result-item .result-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-item .result-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.search-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

/* ── Layout ── */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
}

.page-full {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-full.has-toc {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}
.page-full.has-toc > .post-article {
  flex: 1;
  min-width: 0;
}
.page-full.has-toc > .post-comments {
  width: 300px;
  flex-shrink: 0;
}

/* ── Card entrance animation ── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Posts ── */
.day-group {
  margin-bottom: 2.5rem;
}

.day-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s, color 0.3s;
}

.post {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  padding: 2.75rem 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s, border-left-color 0.2s, background 0.3s;
  animation: card-in 0.35s ease-out both;
}

.post:nth-child(2) { animation-delay: 0.06s; }
.post:nth-child(3) { animation-delay: 0.12s; }
.post:nth-child(4) { animation-delay: 0.18s; }

.post:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 6px 28px var(--shadow);
}

/* ── Terminal window titlebar ── */
.post::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 34px;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  z-index: 0;
}

.post::after {
  content: '● ● ●';
  position: absolute;
  top: -1px; left: -1px;
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text-muted);
  line-height: 1;
  z-index: 1;
}

.post-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}

.post-thumb {
  width: 120px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.post-thumb:hover {
  border-color: var(--accent);
}
.post-thumb-missing {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--subtext);
}

.post-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.post-title a {
  color: inherit;
}

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

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

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 2;
}

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

/* ── Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: background 0.3s, border-color 0.3s;
}

.sidebar-card h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding: 0 0 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sidebar-card h3::before {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 3px;
  height: 1.2em;
  background: var(--accent);
  border-radius: 2px;
}

.profile {
  text-align: center;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.75rem;
  border: 3px solid var(--accent);
}

.profile-name {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.profile-bio {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.5;
}

.profile-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.profile-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: all 0.2s;
}

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

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: all 0.2s, background 0.3s, border-color 0.3s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--surface);
}

.post-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.3rem;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  transition: border-color 0.3s, color 0.3s;
}

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

.footer a:hover {
  text-decoration: underline;
}

/* ── Page heading ── */
.page-heading {
  margin-bottom: 2rem;
}

.page-heading h1 {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
}

.page-heading p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ── Archive ── */
.archive-year {
  margin-bottom: 2rem;
}

.archive-year-header {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.archive-year-header .fold-icon {
  margin-left: auto;
}

.archive-year-header.collapsed .fold-icon {
  transform: rotate(-90deg);
}

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

.archive-item {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  padding-left: 0;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: border-color 0.3s, padding-left 0.2s, border-left-color 0.2s;
}

.archive-item:hover {
  padding-left: 0.6rem;
  border-left-color: var(--accent);
  border-bottom-color: var(--accent);
}

.archive-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 5.5em;
}

.archive-link {
  font-size: 0.95rem;
  color: var(--text-heading);
  transition: color 0.2s;
}

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

/* ── Categories ── */
.category-section {
  margin-bottom: 2rem;
}

.category-header {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.fold-icon {
  transition: transform .2s;
  font-size: .7rem;
  margin-left: auto;
}

.category-header.collapsed .fold-icon {
  transform: rotate(-90deg);
}

.hidden { display: none; }

.category-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.category-list {
  list-style: none;
}

.category-item {
  padding: 0.5rem 0;
  padding-left: 0;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: border-color 0.3s, padding-left 0.2s, border-left-color 0.2s;
}

.category-item:hover {
  padding-left: 0.6rem;
  border-left-color: var(--accent);
  border-bottom-color: var(--accent);
}

.category-item a {
  font-size: 0.95rem;
  color: var(--text-heading);
  transition: color 0.2s;
}

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

/* ── About ── */
.about-content {
  max-width: 680px;
}

.about-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  margin-bottom: 1rem;
}

.about-name {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
}

.about-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

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

.about-section h2 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
  padding: 0 0 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: border-color 0.3s;
}

.about-section h2::before {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 3px;
  height: 1.2em;
  background: var(--accent);
  border-radius: 2px;
}

.about-section p {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 0.6rem;
}

.about-section ul {
  list-style: none;
  padding: 0;
}

.about-section li {
  font-size: 0.95rem;
  color: var(--text);
  padding: 0.4rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.about-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.about-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-heading);
  transition: all 0.2s;
}

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

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

.pagination button {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0.6rem;
  transition: all 0.2s, background 0.3s, border-color 0.3s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ── Floating group ── */
.float-group {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 100;
}

.float-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s, border-color 0.2s, background 0.3s;
}

.float-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.back-to-top {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, transform 0.2s;
  box-shadow: 0 2px 8px var(--shadow);
}

.back-to-top.visible {
  opacity: 0.9;
  visibility: visible;
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-2px);
}

/* ── Post Article ── */
.post-article {
  max-width: 820px;
}
.post-article-body {
  overflow-wrap: break-word;
  word-break: break-word;
}
.post-main {
  min-width: 0;
}

.post-article-heading {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-article-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.post-article-title {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.post-article-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.post-article-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
}

.post-article-body h2 {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 2.2rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.post-article-body h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 1.8rem 0 0.8rem;
}

.post-article-body h4 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 1.5rem 0 0.6rem;
}

.post-article-body p {
  margin-bottom: 1rem;
}

.post-article-body a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

.post-article-body a:hover {
  color: var(--accent-blue-dim);
}

.post-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 1.25rem 0;
  display: block;
}

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

.post-article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.25rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-style: italic;
}

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

.post-article-body ul,
.post-article-body ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.post-article-body li {
  margin-bottom: 0.35rem;
}

.post-article-body li > ul,
.post-article-body li > ol {
  margin-bottom: 0;
}

.post-article-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent-hover);
}

.post-article-body pre {
  margin: 1.25rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  position: relative;
}

.post-article-body pre code {
  display: block;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 0;
}

.code-block-wrap {
  margin: 1.25rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}

.code-block-wrap .code-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 34px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.code-block-wrap .code-dots {
  display: flex;
  gap: 6px;
}

.code-block-wrap .code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-block-wrap .code-dot.red { background: #ff5f57; }
.code-block-wrap .code-dot.yellow { background: #febc2e; }
.code-block-wrap .code-dot.green { background: #28c840; }

.code-block-wrap .code-lang {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.code-block-wrap .code-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.code-block-wrap .code-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.code-block-wrap .code-btn:hover {
  color: var(--accent);
  background: var(--surface);
}

.code-block-wrap .code-btn:active {
  transform: scale(0.94);
}

.code-block-wrap.collapsed pre {
  display: none;
}

.code-block-wrap pre {
  margin: 0;
  border: none;
  border-radius: 0;
}

.post-toc-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 1rem 0;
  border-right: 1px solid var(--border);
  margin-right: 0;
}
.post-toc-sidebar::-webkit-scrollbar {
  width: 4px;
}
.post-toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.post-toc-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.toc-list {
  list-style: none;
}

.toc-item {
  margin-bottom: 0.25rem;
}

.toc-link {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-link:hover, .toc-link.active {
  color: var(--accent);
  background: var(--bg);
}

.toc-link.h3 {
  padding-left: 1.25rem;
}

.img-wrap {
  position: relative;
  margin: 1.25rem 0;
  max-width: 100%;
}

.img-wrap .img-fold-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: var(--text-muted);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--bg);
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.2s;
  line-height: 1;
  min-width: 30px;
  text-align: center;
}

.img-wrap:hover .img-fold-btn,
.img-wrap.collapsed .img-fold-btn {
  opacity: 0.95;
}

.img-wrap.collapsed .img-fold-btn {
  background: var(--accent);
  color: #fff;
}

.img-wrap .img-fold-btn:hover {
  opacity: 1;
  background: var(--accent);
  color: #fff;
}

.img-wrap.collapsed > img,
.img-wrap.collapsed > a > img {
  display: none;
}

.img-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  cursor: zoom-out;
  padding: 2rem;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
}

.post-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

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

.post-article-body th {
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--surface);
  color: var(--text-heading);
}

.post-article-body td {
  color: var(--text);
}

.post-article-body tr:nth-child(even) td {
  background: var(--surface);
}

/* ── Post Comments ── */
.post-comments {
  max-width: 820px;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-comments-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 1.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ── Tux Mascot ── */
.tux-mascot {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 99;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .tux-mascot { animation: none !important; }
  .tux-eyes { animation: none !important; }
  .tux-wing-l,
  .tux-wing-r { animation: none !important; }
}

.tux-mascot:hover .tux-wing-l {
  animation: tux-wave-l 0.35s ease-in-out 3;
}
.tux-mascot:hover .tux-wing-r {
  animation: tux-wave-r 0.35s ease-in-out 3;
}

.tux-mascot:active {
  transform: scale(0.94);
}

.tux-mascot svg,
.tux-mascot img {
  display: block;
  width: 64px;
  height: auto;
  filter: drop-shadow(0 3px 10px var(--shadow));
  transition: transform 0.25s ease;
}

.tux-jump {
  animation: tux-jump 0.5s ease-out;
}
.tux-talking {
  animation: tux-sway 0.8s ease-in-out infinite;
}

@keyframes tux-jump {
  0%   { transform: translateY(0) scaleY(1); }
  25%  { transform: translateY(-18px) scaleY(0.94); }
  45%  { transform: translateY(-22px) scaleY(0.92); }
  65%  { transform: translateY(-8px) scaleY(1.05); }
  80%  { transform: translateY(-2px) scaleY(1); }
  100% { transform: translateY(0) scaleY(1); }
}
@keyframes tux-sway {
  0%, 100% { transform: rotate(0deg); }
  30%  { transform: rotate(-4deg); }
  70%  { transform: rotate(4deg); }
}
@keyframes tux-wave-l {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(14deg); }
}
@keyframes tux-wave-r {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-14deg); }
}

.tux-wing-l,
.tux-wing-r {
  transform-origin: center;
  transform-box: fill-box;
}

/* Eye blink */
@keyframes tux-blink {
  0%, 96%, 100% { opacity: 1; }
  97%, 99% { opacity: 0; }
}
.tux-eyes {
  animation: tux-blink 4.5s ease-in-out infinite;
}

.tux-speech {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  left: 0;
  min-width: 160px;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
  box-shadow: 0 4px 20px var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: pre-wrap;
}

.tux-speech.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.tux-speech::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--surface);
}

@media (max-width: 560px) {
  .tux-mascot {
    bottom: 0.75rem;
    left: 0.75rem;
  }
  .tux-mascot svg { width: 48px; }
  .tux-speech {
    min-width: 130px;
    max-width: 200px;
    font-size: 0.75rem;
    bottom: calc(100% + 0.5rem);
  }
}

/* ── Bookshelf ── */
.bookshelf-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: card-in 0.35s ease-out both;
}

.book-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--shadow);
}

.book-cover-placeholder {
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  font-size: 2.5rem;
}

.book-status {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.status-reading {
  background: var(--accent);
  color: #fff;
}

.status-done {
  background: var(--accent-blue);
  color: #fff;
}

.book-info {
  padding: 0.75rem 1rem;
}

.book-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.25rem;
}

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

.book-cover-link {
  display: block;
  position: relative;
  line-height: 0;
  flex-shrink: 0;
  width: 120px;
  border-right: 1px solid var(--border);
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-rating {
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0.25rem 0;
}

.book-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Gallery ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.gallery-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: card-in 0.35s ease-out both;
}

.gallery-item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--shadow);
}

.gallery-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: contain;
  padding: 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.gallery-caption {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono);
}

/* ── Friends ── */
.friends-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.friend-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: card-in 0.35s ease-out both;
}

.friend-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--shadow);
}

.friend-avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 2px solid var(--border);
  flex-shrink: 0;
  font-size: 1.5rem;
  transition: border-color 0.2s;
}

.friend-card:hover .friend-avatar-placeholder {
  border-color: var(--accent);
}

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

.friend-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.2rem;
}

.friend-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── View toggle ── */
.view-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 1rem;
}

.view-toggle button {
  background: none;
  border: none;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  border-radius: calc(var(--radius) - 3px);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: background 0.2s, color 0.2s;
}

.view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

/* ── Bookshelf grid mode ── */
.bookshelf-grid.grid-mode {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.bookshelf-grid.grid-mode .book-card {
  flex-direction: column;
}

.bookshelf-grid.grid-mode .book-cover-link {
  width: 100%;
  border-right: none;
  border-bottom: 1px solid var(--border);
}

.bookshelf-grid.grid-mode .book-info .book-author,
.bookshelf-grid.grid-mode .book-info .book-rating,
.bookshelf-grid.grid-mode .book-info .book-desc {
  display: none;
}

.bookshelf-grid.grid-mode .book-info {
  padding: 0.5rem;
}

.bookshelf-grid.grid-mode .book-title {
  font-size: 0.8rem;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Post grid mode ── */
.post-grid.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.post-grid.grid-mode .day-group {
  display: contents;
}

.post-grid.grid-mode .day-title {
  display: none;
}

.post-grid.grid-mode .post {
  margin-bottom: 0;
}

.post-grid.grid-mode .post-header {
  flex-direction: column;
  gap: 0;
}

.post-grid.grid-mode .post-thumb {
  width: 100%;
  height: 150px;
  margin-right: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

.post-grid.grid-mode .post-excerpt,
.post-grid.grid-mode .post-meta {
  display: none;
}

.post-grid.grid-mode .post-title {
  font-size: 0.95rem;
  padding: 0.75rem;
  margin-bottom: 0;
}

.post-grid.grid-mode .post::before,
.post-grid.grid-mode .post::after {
  display: none;
}

.post-grid.grid-mode .post {
  padding: 0;
  overflow: hidden;
}

/* ── Responsive ── */
@media (max-width: 820px) {
  .page {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: -1;
  }
  .post-header {
    flex-direction: column;
  }
  .post-thumb {
    width: 100%;
    height: 160px;
  }
  .archive-item {
    flex-direction: column;
    gap: 0.2rem;
  }
  .page-full.has-toc {
    flex-direction: column;
  }
  .page-full.has-toc > .post-article {
    flex: none;
    width: 100%;
  }
  .page-full.has-toc > .post-comments {
    width: 100%;
  }
  .post-toc-sidebar {
    display: none;
  }
  .post-article {
    max-width: 100%;
  }
  .nav-inner {
    justify-content: flex-start;
    padding-right: 1.5rem;
    -webkit-overflow-scrolling: touch;
  }
}
