/* =============================================
   signal/noise — Main Stylesheet
   Dark-first, warm, minimal, smooth
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300;1,9..40,400&family=DM+Mono:wght@300;400&display=swap');

/* ── CSS Variables ─────────────────────────── */
:root {
  --bg:           #0f0e0d;
  --bg-secondary: #161513;
  --bg-card:      #1a1916;
  --bg-hover:     #201f1c;
  --border:       #2a2825;
  --border-subtle: #1f1e1b;

  --text-primary:   #e8e0d4;
  --text-secondary: #9e9589;
  --text-muted:     #5c574f;
  --text-accent:    #c8a97e;

  --accent:        #c8a97e;
  --accent-dim:    #8a7055;
  --accent-glow:   rgba(200, 169, 126, 0.08);
  --accent-tag:    rgba(200, 169, 126, 0.12);

  --tag-text:      #c8a97e;
  --tag-bg:        rgba(200, 169, 126, 0.1);
  --tag-border:    rgba(200, 169, 126, 0.2);

  --code-bg:       #1c1b18;
  --code-text:     #b5a899;
  --selection:     rgba(200, 169, 126, 0.2);

  /* Section accent colors */
  --books-color:    #7eb8c8;
  --books-glow:     rgba(126, 184, 200, 0.08);
  --personal-color: #b8a0d4;
  --personal-glow:  rgba(184, 160, 212, 0.08);
  --tech-color:     #c8a97e;
  --tech-glow:      rgba(200, 169, 126, 0.08);

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;

  --transition: 0.18s ease;
  --transition-slow: 0.35s ease;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-hover: 0 4px 24px rgba(0,0,0,0.5);

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Fira Code', monospace;

  --max-width: 1100px;
  --content-width: 720px;
  --nav-height: 62px;
}

[data-theme="light"] {
  --bg:           #faf8f4;
  --bg-secondary: #f3f0eb;
  --bg-card:      #ffffff;
  --bg-hover:     #f5f2ed;
  --border:       #e5dfd6;
  --border-subtle: #ede8e1;

  --text-primary:   #1a1714;
  --text-secondary: #6b635a;
  --text-muted:     #a89e94;
  --text-accent:    #9a6f3a;

  --accent:        #a0713c;
  --accent-dim:    #c89660;
  --accent-glow:   rgba(160, 113, 60, 0.06);
  --accent-tag:    rgba(160, 113, 60, 0.09);

  --tag-text:      #8c5f2a;
  --tag-bg:        rgba(160, 113, 60, 0.08);
  --tag-border:    rgba(160, 113, 60, 0.18);

  --code-bg:       #f0ece5;
  --code-text:     #6b5b4e;
  --selection:     rgba(160, 113, 60, 0.18);

  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 24px rgba(0,0,0,0.1);

  --books-color:    #3a8aa0;
  --personal-color: #7a5aa8;
  --tech-color:     #a0713c;
}

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

::selection { background: var(--selection); color: var(--text-primary); }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background var(--transition-slow), color var(--transition-slow);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; display: block; }

/* ── Navigation ────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 clamp(1.25rem, 5vw, 2.5rem);
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1;
  flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }

/* Desktop nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  letter-spacing: 0.01em;
}

.nav-links a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-links a.active { color: var(--accent); }

/* Mobile-only items — hidden by default (desktop) */
.nav-social-mobile { display: none !important; }

/* Right side */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Desktop social icons */
.nav-social-desktop {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-right: 0.75rem;
  margin-right: 0.25rem;
  border-right: 1px solid var(--border);
}

.nav-social-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.nav-social-icon:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.theme-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.theme-toggle svg { width: 15px; height: 15px; }
.icon-moon { display: block; }
.icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: block; }

/* Mobile button */
.nav-mobile-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.nav-mobile-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Hamburger animation */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 18px;
  height: 14px;
  position: relative;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  position: absolute;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1),
              opacity   0.2s ease,
              top       0.3s cubic-bezier(0.4,0,0.2,1);
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger span:nth-child(3) { bottom: 0; top: auto; }

.nav-mobile-btn.open .hamburger span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.nav-mobile-btn.open .hamburger span:nth-child(2) { opacity: 0; transform: translateY(-50%) scaleX(0); }
.nav-mobile-btn.open .hamburger span:nth-child(3) { top: 50%; transform: translateY(-50%) rotate(-45deg); }

/* Backdrop */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.nav-backdrop.visible { opacity: 1; pointer-events: auto; }

/* ── Page Wrapper ───────────────────────────── */
.page-wrap { padding-top: var(--nav-height); min-height: 100vh; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2.5rem);
}
.container--narrow { max-width: var(--content-width); }

/* ── Section Labels ────────────────────────── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.section-label::before {
  content: '';
  display: block;
  width: 18px; height: 1px;
  background: var(--accent);
}

/* ── Hero ────────────────────────────────────── */
.hero {
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--border-subtle);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 1.25rem;
  text-transform: lowercase;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  max-width: 720px;
  margin-bottom: 1.25rem;
}
.hero-title em { color: var(--accent); font-style: italic; }

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.cta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
.cta-pill:hover { border-color: var(--accent-dim); color: var(--text-primary); background: var(--bg-hover); }

.cta-pill--books:hover  { border-color: var(--books-color); color: var(--books-color); background: var(--books-glow); }
.cta-pill--personal:hover { border-color: var(--personal-color); color: var(--personal-color); background: var(--personal-glow); }
.cta-pill--tech:hover   { border-color: var(--tech-color); color: var(--tech-color); background: var(--tech-glow); }

/* ── Tags ────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.tag:hover { background: var(--accent-tag); border-color: var(--accent); }

/* ── Post Cards ─────────────────────────────── */
.post-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-glow);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.post-card:hover { border-color: var(--accent-dim); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.post-card:hover::before { opacity: 1; }

.post-card--personal::before { background: var(--personal-glow); }
.post-card--personal:hover   { border-color: color-mix(in srgb, var(--personal-color) 60%, transparent); }

.post-card--tech::before { background: var(--tech-glow); }
.post-card--tech:hover   { border-color: var(--accent-dim); }

.post-card__thumb {
  width: calc(100% + 3.5rem);
  margin: -1.5rem -1.75rem 1.25rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 7;
}
.post-card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.post-card:hover .post-card__thumb img { transform: scale(1.04); }

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.post-card__date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
  transition: color var(--transition);
}
.post-card:hover .post-card__title { color: var(--accent); }
.post-card--personal:hover .post-card__title { color: var(--personal-color); }

.post-card__excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
}

.post-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.post-card__tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.post-card__read {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Grid Layouts ───────────────────────────── */
.posts-grid { display: grid; gap: 1rem; }
.posts-grid--2 { grid-template-columns: repeat(2, 1fr); }
.posts-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* ── Home Sections ──────────────────────────── */
.home-section {
  padding: clamp(3rem, 6vw, 5rem) 0;
  border-top: 1px solid var(--border-subtle);
}

.home-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.home-section__label-group { flex: 1; }

.home-section__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.books-accent    { color: var(--books-color); }
.personal-accent { color: var(--personal-color); }
.tech-accent     { color: var(--tech-color); }

.home-section__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  line-height: 1.1;
}

.home-section__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.6;
}

.view-all {
  font-size: 0.8rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.35rem;
}
.view-all:hover { border-bottom-color: var(--accent); }

/* ── Book Home Cards ─────────────────────────── */
.books-home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.book-home-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
}

.book-home-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--books-glow);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.book-home-card:hover {
  border-color: color-mix(in srgb, var(--books-color) 50%, transparent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.book-home-card:hover::before { opacity: 1; }

.book-home-card__spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--books-color);
  opacity: 0.5;
  transition: opacity var(--transition);
}
.book-home-card:hover .book-home-card__spine { opacity: 1; }

.book-home-card__cover {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--bg-secondary);
}

.book-home-card__cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.book-home-card:hover .book-home-card__cover img { transform: scale(1.05); }

.book-home-card__cover-fallback {
  width: 100%; height: 100%;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  background: linear-gradient(160deg, #141c28 0%, #1e2d42 100%);
}
.book-home-card__cover-fallback span {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: rgba(200,210,230,0.75);
  line-height: 1.3;
}

.book-home-card__info { padding: 1rem 1.25rem 1.25rem; flex: 1; }

.book-home-card__author {
  font-size: 0.7rem;
  color: var(--books-color);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
  opacity: 0.8;
}

.book-home-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
  transition: color var(--transition);
}
.book-home-card:hover .book-home-card__title { color: var(--books-color); }

.book-home-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── Books Index (full shelf) ─────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 0;
}

.book-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
}
.book-card:hover { border-color: color-mix(in srgb, var(--books-color) 50%, transparent); box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.book-card--placeholder { cursor: default; }

.book-card__cover {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--bg-secondary);
}
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.book-card:hover .book-card__cover img { transform: scale(1.04); }

.book-card__cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  background: linear-gradient(160deg, #141c28 0%, #1e2d42 100%);
}
.book-card__cover-placeholder span {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: rgba(200,210,230,0.75);
  line-height: 1.3;
}

.book-card__body { padding: 1rem 1.1rem 1.25rem; flex: 1; display: flex; flex-direction: column; }

.book-card__author {
  font-size: 0.68rem;
  color: var(--books-color);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.book-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
  flex: 1;
  transition: color var(--transition);
}
.book-card:hover .book-card__title { color: var(--books-color); }

.book-card__desc {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card__footer { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: auto; }

.book-rating { color: var(--books-color); font-size: 0.85rem; letter-spacing: 0.05em; }
.book-rating--sm { font-size: 0.72rem; }

/* ── Book Header (single book page) ─────────── */
.book-header {
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: color var(--transition);
}
.back-link:hover { color: var(--books-color); }

.book-header__inner {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.book-cover-hero {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  aspect-ratio: 2 / 3;
}
.book-cover-hero img { width: 100%; height: 100%; object-fit: cover; }

.book-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  line-height: 1.1;
}

.book-header__by {
  font-size: 0.9rem;
  color: var(--books-color);
  margin-bottom: 1rem;
}

.book-header__desc {
  font-size: 0.975rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 1.25rem;
}

.book-header__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Section Header ──────────────────────────── */
.section-header {
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.5rem;
}

.section-header__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  line-height: 1.1;
}

.section-header__sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.7;
}

/* ── Category Tabs ───────────────────────────── */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.category-tab {
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.category-tab:hover, .category-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tag-bg);
}

/* ── Posts Page ─────────────────────────────── */
.posts-page-header {
  padding: clamp(2.5rem, 5vw, 4rem) 0 2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.5rem;
}

.posts-page-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.posts-page-sub { color: var(--text-secondary); font-size: 0.9rem; }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--accent-dim); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; width: 15px; height: 15px; }
.search-bar input {
  background: transparent; border: none; outline: none;
  font-family: var(--font-body); font-size: 0.875rem; color: var(--text-primary); width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Posts list */
.posts-list { display: flex; flex-direction: column; gap: 0.75rem; }

.post-list-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 1rem 1.5rem;
  align-items: start;
  padding: 1.125rem 1.375rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.post-list-item:hover { border-color: var(--accent-dim); transform: translateX(3px); box-shadow: var(--shadow-card); }

.post-list-item__date { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.04em; padding-top: 0.2rem; }
.post-list-item__body { min-width: 0; }
.post-list-item__title { font-size: 0.95rem; font-weight: 500; color: var(--text-primary); margin-bottom: 0.25rem; transition: color var(--transition); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-list-item:hover .post-list-item__title { color: var(--accent); }
.post-list-item__excerpt { font-size: 0.8rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.post-list-item__tags { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; padding-top: 0.15rem; }

/* Category group */
.category-group { margin-bottom: 2.5rem; }
.category-group__label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.category-group__label span { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

/* ── Post Page ──────────────────────────────── */
.post-header {
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}

.post-thumbnail {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  aspect-ratio: 16 / 6;
  border: 1px solid var(--border);
}
.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-header__meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

.post-header__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  max-width: 800px;
}

.post-header__excerpt { font-size: 1.1rem; color: var(--text-secondary); line-height: 1.7; max-width: 600px; margin-bottom: 1.5rem; }

.post-header__byline { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.post-header__byline strong { color: var(--text-secondary); }

/* Post content */
.post-content { font-size: 1.025rem; line-height: 1.8; color: var(--text-primary); max-width: var(--content-width); }
.post-content p { margin-bottom: 1.5rem; }
.post-content p:last-child { margin-bottom: 0; }
.post-content h2 { font-family: var(--font-display); font-size: 1.65rem; letter-spacing: -0.02em; color: var(--text-primary); margin: 2.5rem 0 1rem; line-height: 1.2; }
.post-content h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--text-primary); margin: 2rem 0 0.75rem; }
.post-content a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); transition: border-color var(--transition); }
.post-content a:hover { border-bottom-color: var(--accent); }
.post-content blockquote { border-left: 2px solid var(--accent); padding: 0.25rem 0 0.25rem 1.25rem; margin: 1.5rem 0; color: var(--text-secondary); font-style: italic; }
.post-content code { font-family: var(--font-mono); font-size: 0.85em; background: var(--code-bg); color: var(--code-text); padding: 0.15em 0.4em; border-radius: 3px; }
.post-content pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; overflow-x: auto; margin: 1.5rem 0; }
.post-content pre code { background: none; padding: 0; font-size: 0.85rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin-bottom: 1.5rem; }
.post-content li { margin-bottom: 0.35rem; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.post-content img { border-radius: var(--radius); margin: 1.5rem 0; }

/* Post nav */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border-subtle); }
.post-nav__item { display: block; padding: 1.125rem 1.25rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color var(--transition); }
.post-nav__item:hover { border-color: var(--accent-dim); }
.post-nav__item--next { text-align: right; }
.post-nav__label { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; font-family: var(--font-mono); margin-bottom: 0.35rem; }
.post-nav__title { font-family: var(--font-display); font-size: 1rem; color: var(--text-primary); transition: color var(--transition); }
.post-nav__item:hover .post-nav__title { color: var(--accent); }

/* ── Likes & Comments ────────────────────────── */
.post-interactions { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-subtle); }

.likes-bar { display: flex; align-items: center; gap: 1rem; margin-bottom: 2.5rem; }

.like-btn {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.like-btn:hover { border-color: #e05a7a; color: #e05a7a; background: rgba(224,90,122,0.07); }
.like-btn.liked { border-color: #e05a7a; color: #e05a7a; background: rgba(224,90,122,0.1); }
.like-btn.liked .like-icon { fill: #e05a7a; }
.like-icon { width: 18px; height: 18px; flex-shrink: 0; transition: fill 0.2s ease; }
.like-label { color: var(--text-muted); font-size: 0.8rem; }
.like-hint { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 0.03em; }

@keyframes likeBounce { 0% { transform: scale(1); } 35% { transform: scale(1.2); } 65% { transform: scale(0.92); } 100% { transform: scale(1); } }
.like-bounce { animation: likeBounce 0.4s cubic-bezier(0.4,0,0.2,1); }

.comments-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--text-primary); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; letter-spacing: -0.01em; }
.comments-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.comments-empty { font-size: 0.85rem; color: var(--text-muted); font-style: italic; padding: 1.25rem 0; }
.comments-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2rem; }

.comment-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; animation: fadeUp 0.3s ease both; }
.comment-item__header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.comment-item__name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.comment-item__date { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 0.03em; }
.comment-item__delete { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.2rem; border-radius: 3px; transition: color var(--transition), background var(--transition); }
.comment-item__delete:hover { color: #e05a7a; background: rgba(224,90,122,0.08); }
.comment-item__body { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

.comment-form { display: flex; flex-direction: column; gap: 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; transition: border-color var(--transition); }
.comment-form:focus-within { border-color: var(--accent-dim); }
.comment-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.comment-form input, .comment-form textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.9rem; font-family: var(--font-body); font-size: 0.875rem; color: var(--text-primary); outline: none; transition: border-color var(--transition); resize: vertical; }
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent-dim); }
.comment-form input::placeholder, .comment-form textarea::placeholder { color: var(--text-muted); }
.comment-form__footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.comment-chars { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }
.comment-submit { padding: 0.55rem 1.25rem; background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: opacity var(--transition), transform 0.15s ease; }
.comment-submit:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── About Page ─────────────────────────────── */
.about-page { padding: clamp(2.5rem, 5vw, 5rem) 0; }
.about-intro { margin-bottom: 3.5rem; padding-bottom: 3rem; border-bottom: 1px solid var(--border-subtle); }
.about-intro .section-label { margin-bottom: 2rem; }
.about-name { font-family: var(--font-display); font-size: clamp(2.5rem, 5vw, 4rem); letter-spacing: -0.025em; color: var(--text-primary); margin-bottom: 0.5rem; line-height: 1.05; }
.about-name em { color: var(--accent); font-style: italic; }
.about-tagline { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 1.75rem; }
.about-bio { font-size: 1rem; color: var(--text-secondary); line-height: 1.8; max-width: 580px; }
.about-bio p { margin-bottom: 1rem; }
.about-bio p:last-child { margin-bottom: 0; }
.about-section { margin-bottom: 3rem; }
.about-section__title { font-family: var(--font-display); font-size: 1.35rem; color: var(--text-primary); letter-spacing: -0.02em; margin-bottom: 1.25rem; }
.interest-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.interest-chip { font-size: 0.82rem; padding: 0.45rem 0.9rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); transition: border-color var(--transition), color var(--transition); }
.interest-chip:hover { border-color: var(--accent-dim); color: var(--text-primary); }
.timeline { display: flex; flex-direction: column; gap: 0.1rem; }
.timeline-item { display: grid; grid-template-columns: 100px 1fr; gap: 1.5rem; padding: 1.125rem 0; border-bottom: 1px solid var(--border-subtle); }
.timeline-item:last-child { border-bottom: none; }
.timeline-item__period { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.04em; padding-top: 0.2rem; }
.timeline-item__role { font-size: 0.925rem; font-weight: 500; color: var(--text-primary); margin-bottom: 0.2rem; }
.timeline-item__org { font-size: 0.8rem; color: var(--accent); margin-bottom: 0.4rem; }
.timeline-item__desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }

/* ── Footer ─────────────────────────────────── */
.footer { margin-top: auto; padding: 2rem 0; border-top: 1px solid var(--border-subtle); }

.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.footer-copy { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); }

.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { font-size: 0.78rem; color: var(--text-muted); transition: color var(--transition); }
.footer-links a:hover { color: var(--accent); }

.footer-social { display: flex; gap: 0.75rem; align-items: center; }
.footer-social a { display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: color var(--transition); }
.footer-social a:hover { color: var(--accent); }

/* ── Reading progress ───────────────────────── */
.reading-progress { position: fixed; top: var(--nav-height); left: 0; height: 2px; background: var(--accent); z-index: 99; width: 0%; transition: width 0.1s linear; }

/* ── Scroll to top ──────────────────────────── */
.scroll-top {
  position: fixed; bottom: 2rem; right: 2rem;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer;
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition), border-color var(--transition), color var(--transition);
  pointer-events: none; z-index: 90;
}
.scroll-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.scroll-top:hover { border-color: var(--accent-dim); color: var(--accent); }

/* ── Animations ─────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.fade-up { animation: fadeUp 0.5s ease both; }
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.1s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.2s; }
.fade-up-5 { animation-delay: 0.25s; }

/* ── Pagination ─────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 2.5rem 0; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--text-secondary); transition: all var(--transition); }
.pagination a:hover { border-color: var(--accent-dim); color: var(--accent); background: var(--tag-bg); }
.pagination .current { border-color: var(--accent); color: var(--accent); background: var(--tag-bg); }

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */

@media (max-width: 900px) {
  .posts-grid--2,
  .posts-grid--3,
  .books-home-grid { grid-template-columns: 1fr 1fr; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .book-header__inner { grid-template-columns: 140px 1fr; }
}

@media (max-width: 680px) {
  /* ── Mobile nav ── */
  .nav-links {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
    gap: 0.25rem;
    z-index: 99;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 0.65rem 0.75rem; border-radius: var(--radius-sm); font-size: 0.9rem; }

  /* Show mobile social, hide desktop social */
  .nav-social-desktop { display: none !important; }
  .nav-social-mobile  { display: block !important; }
  .nav-mobile-btn     { display: flex; }
  .nav-backdrop       { display: block; }

  /* Mobile social items */
  .nav-social-mobile {
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
  }
  .nav-social-row { display: flex; gap: 0.75rem; padding: 0.25rem 0.5rem; }
  .nav-social-row a {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
  }
  .nav-social-row a:hover { color: var(--accent); border-color: var(--accent-dim); background: var(--tag-bg); }

  /* Layouts */
  .posts-grid--2,
  .posts-grid--3,
  .books-home-grid { grid-template-columns: 1fr; }
  .books-grid { grid-template-columns: repeat(2, 1fr); }
  .book-header__inner { grid-template-columns: 1fr; }
  .book-cover-hero { max-width: 180px; }

  .home-section__header { flex-direction: column; gap: 0.5rem; }
  .home-section__desc { max-width: none; }

  .post-list-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .post-list-item__tags { justify-content: flex-start; }
  .timeline-item { grid-template-columns: 1fr; gap: 0.4rem; }
  .post-nav { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .comment-form__row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: flex-start; }
  .books-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
