/* ==========================================================================
   Florin Salasan — Editorial / Newspaper Design System
   Pure Modern Vanilla CSS (Zero build step, CSS Custom Properties)
   ========================================================================== */

:root {
  /* Light Theme — Warm Paper & Ink */
  --bg-primary: #faf7f2;
  --bg-secondary: #f2ede4;
  --bg-card: #ffffff;
  --bg-elevated: #fdfbf8;
  --text-primary: #1a1816;
  --text-secondary: #57524a;
  --text-muted: #857e73;
  --accent: #b83a24;
  --accent-hover: #962b18;
  --accent-subtle: rgba(184, 58, 36, 0.1);
  --border-light: #e4ddd1;
  --border-strong: #2c2825;
  --shadow-sm: 0 2px 6px rgba(26, 24, 22, 0.04);
  --shadow-md: 0 8px 24px rgba(26, 24, 22, 0.08);
  --shadow-lg: 0 16px 40px rgba(26, 24, 22, 0.14);

  /* Status Colors */
  --status-completed-bg: rgba(39, 103, 73, 0.12);
  --status-completed-text: #22543d;
  --status-reading-bg: rgba(184, 58, 36, 0.12);
  --status-reading-text: #9c2f1b;
  --status-planned-bg: rgba(116, 108, 96, 0.14);
  --status-planned-text: #4a453d;

  /* Typography */
  --font-serif: 'Newsreader', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout */
  --max-width: 1120px;
  --content-width: 740px;
  --page-width: 820px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --transition: 180ms cubic-bezier(0.2, 0, 0, 1);
}

[data-theme="dark"] {
  /* Dark Theme — Deep Espresso & Soft Parchment */
  --bg-primary: #151413;
  --bg-secondary: #1e1c1a;
  --bg-card: #1c1a18;
  --bg-elevated: #24211e;
  --text-primary: #ede9e2;
  --text-secondary: #a8a196;
  --text-muted: #756e64;
  --accent: #e05a40;
  --accent-hover: #f2745c;
  --accent-subtle: rgba(224, 90, 64, 0.15);
  --border-light: #2c2925;
  --border-strong: #cfc9be;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --status-completed-bg: rgba(72, 187, 120, 0.15);
  --status-completed-text: #68d391;
  --status-reading-bg: rgba(224, 90, 64, 0.18);
  --status-reading-text: #f68773;
  --status-planned-bg: rgba(168, 161, 150, 0.15);
  --status-planned-text: #b8b1a6;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  scrollbar-gutter: stable;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

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

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

/* ==========================================================================
   Layout Container & Newspaper Masthead
   ========================================================================== */

.site-wrapper {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.masthead {
  width: 100%;
  max-width: min(var(--page-width), calc(100% - (80vh * 282 / 956 + 4rem)));
  padding-top: 1.75rem;
  margin-bottom: 2.5rem;
}

.masthead-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-light);
}

.masthead-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 0;
  border-bottom: 3px double var(--border-strong);
  gap: 1rem;
  flex-wrap: wrap;
}

.site-brand {
  display: flex;
  flex-direction: column;
}

.site-brand-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
}

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

.nav-bar {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

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

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 0.25rem 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  transition: all var(--transition);
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: var(--bg-elevated);
}

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

.kbd-hint {
  font-size: 0.7rem;
  opacity: 0.75;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
}

/* ==========================================================================
   Main Content Grid & Interactive CN Tower
   ========================================================================== */

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  flex: 1;
  align-items: start;
  position: relative;
}

.main-content {
  width: 100%;
  max-width: var(--page-width);
  animation: fadeIn 0.35s ease-out;
}

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

/* CN Tower Scroll-to-Top Sidebar */
.cntower-aside {
  width: calc(80vh * 282 / 956 + 1rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  user-select: none;
  flex-shrink: 0;
}

.cntower-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
  padding: 0.5rem;
  transition: color var(--transition);
  z-index: 20;
}

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

.cntower-svg {
  height: 80vh;
  width: auto;
  fill: currentColor;
  transition: fill var(--transition);
}

.cntower-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  writing-mode: horizontal-tb;
  opacity: 0.8;
  transition: color var(--transition), opacity var(--transition);
}

.cntower-btn:hover .cntower-label {
  color: var(--accent);
  opacity: 1;
}

/* Mobile Back to Top Button */
.mobile-top-btn {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 40;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  border-radius: 999px;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition);
}

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

/* ==========================================================================
   Editorial Typography & Prose
   ========================================================================== */

.page-header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.page-kicker {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.4rem;
  display: block;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-subtitle {
  margin-top: 0.65rem;
  font-size: 1.08rem;
  color: var(--text-secondary);
  max-width: 65ch;
}

.prose {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
  max-width: var(--content-width);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.prose h2 {
  font-size: 1.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-light);
}

.prose h3 {
  font-size: 1.3rem;
}

.prose p {
  margin-bottom: 1.25rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.prose a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

.prose ul,
.prose ol {
  margin: 0 0 1.35rem 1.5rem;
}

.prose li {
  margin-bottom: 0.45rem;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.5rem 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.prose pre {
  background: #1c1b1a;
  color: #f4f0ea;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid var(--border-light);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-secondary);
  padding: 0.15rem 0.38rem;
  border-radius: 3px;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ==========================================================================
   Homepage Editorial Sections
   ========================================================================== */

.hero-intro {
  margin-bottom: 2.75rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.hero-greeting {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-lead {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 60ch;
  line-height: 1.6;
}

.home-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.editorial-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 2px solid var(--border-strong);
  border-bottom: 1px solid var(--border-light);
  padding: 0.55rem 0;
  margin-bottom: 1.5rem;
}

.editorial-section-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--text-primary);
}

.editorial-section-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

.editorial-section-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Controls Bar (Filter Pills & Sort Select)
   ========================================================================== */

.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 0.35rem;
}

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.3rem 0.68rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-pill:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.sort-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
}

.filter-pill-clear {
  border-style: dashed;
  color: var(--accent);
  border-color: var(--accent);
}

.filter-pill-clear:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.tag-dropdown-wrap {
  position: relative;
}

.tag-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
  transition: border-color var(--transition);
}

.tag-dropdown-toggle:hover,
.tag-dropdown-toggle.has-active {
  border-color: var(--accent);
}

.tag-dropdown-caret {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.tag-dropdown-wrap.open .tag-dropdown-caret {
  transform: rotate(180deg);
}

.tag-dropdown-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 60;
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.9rem 1rem;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.tag-dropdown-wrap.open .tag-dropdown-popover {
  display: flex;
}

.tag-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-light);
}

.tag-popover-clear-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  cursor: pointer;
}

.tag-popover-clear-btn:hover {
  text-decoration: underline;
}

.tag-popover-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-height: 240px;
  overflow-y: auto;
}

/* ==========================================================================
   Project Cards & Project Detail Page
   ========================================================================== */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--text-muted);
}

.project-card-media {
  position: relative;
  height: 185px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.project-card:hover .project-card-media img {
  transform: scale(1.03);
}

.project-status-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.status-completed {
  background: var(--status-completed-bg);
  color: var(--status-completed-text);
  border: 1px solid currentColor;
}

.status-in-progress,
.status-reading {
  background: var(--status-reading-bg);
  color: var(--status-reading-text);
  border: 1px solid currentColor;
}

.status-planned {
  background: var(--status-planned-bg);
  color: var(--status-planned-text);
  border: 1px solid currentColor;
}

.project-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.project-card-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

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

.project-card-desc {
  font-size: 0.94rem;
  color: var(--text-secondary);
  margin-bottom: 1.15rem;
  flex: 1;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.tag-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border-light);
}

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.project-link-primary {
  color: var(--accent);
  font-weight: 600;
}

.project-link-primary:hover {
  text-decoration: underline;
}

.project-link-ext {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.project-link-ext:hover {
  color: var(--text-primary);
}

/* Project Gallery on Detail Page */
.project-gallery {
  margin: 2rem 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.85rem;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}

.gallery-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.gallery-caption {
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   Blog List & Post Page
   ========================================================================== */

.blog-list {
  display: flex;
  flex-direction: column;
}

.blog-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.blog-item:first-child {
  padding-top: 0.25rem;
}

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

.blog-item-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

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

.blog-item-summary {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 65ch;
}

/* ==========================================================================
   Bookshelf Section
   ========================================================================== */

.bookshelf-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.book-card:hover {
  border-color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.book-card-top {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.book-cover {
  width: 82px;
  height: 122px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.55rem;
  background: linear-gradient(145deg, var(--bg-secondary), var(--bg-elevated));
  position: relative;
}

.book-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--accent);
  opacity: 0.85;
}

.book-cover-fallback-title {
  font-family: var(--font-serif);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  padding-left: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-cover-fallback-author {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
  padding-left: 4px;
}

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

.book-title {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.book-author {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.book-rating {
  font-size: 0.85rem;
  color: #d97706;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.book-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.book-summary {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.book-review-trigger-wrap {
  margin-top: auto;
  border-top: 1px dashed var(--border-light);
  padding-top: 0.75rem;
}

.book-review-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color var(--transition);
}

.book-review-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Book Review Modal Dialog
   ========================================================================== */

.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 13, 0.65);
  backdrop-filter: blur(3px);
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.review-modal-overlay.open {
  display: flex;
}

.review-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.16s ease-out;
}

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

.review-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.15rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.review-modal-header-main {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  min-width: 0;
}

.review-modal-cover {
  width: 72px;
  height: 108px;
}

.review-modal-meta {
  flex: 1;
  min-width: 0;
}

.review-modal-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.review-modal-close {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.review-modal-close:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.review-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.96rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.review-modal-body > :first-child {
  margin-top: 0;
}

.review-modal-body > :last-child {
  margin-bottom: 0;
}

.review-modal-footer {
  padding: 0.9rem 1.5rem;
  border-top: 1px dashed var(--border-light);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.review-modal-tag-btn {
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.review-modal-tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Search Modal Dialog
   ========================================================================== */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 13, 0.65);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}

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

.search-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border-light);
  gap: 0.75rem;
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
}

.search-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: block;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

.search-result-type {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.search-result-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.search-result-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  width: 100%;
  max-width: min(var(--page-width), calc(100% - (80vh * 282 / 956 + 4rem)));
  margin-top: 4.5rem;
  padding: 2rem 0 3rem;
  border-top: 3px double var(--border-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-contact h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.social-link {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

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

.social-link svg {
  width: 18px;
  height: 18px;
}

.footer-credits {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: right;
}

.footer-credits a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 860px) {
  .masthead,
  .site-footer {
    max-width: var(--page-width);
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .cntower-aside {
    display: none;
  }

  .mobile-top-btn {
    display: inline-flex;
  }
}

@media (max-width: 600px) {
  .masthead-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .masthead-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-bar {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links {
    gap: 1rem;
  }

  .kbd-hint {
    display: none;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-credits {
    text-align: left;
  }
}
