/* ========================================
   Custom Properties
   ======================================== */

:root {
  --bg: #FFFFFF;
  --text: #000000;
  --text-muted: #555555;
  --border: #000000;
}

/* ========================================
   Base
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

body { overflow-x: hidden; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  scrollbar-gutter: stable;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(0, 0, 0, 0.25);
  transition: none;
}

a:hover {
  text-decoration-color: var(--text);
  opacity: 1;
}

/* ========================================
   Layout Scale
   ======================================== */

.container { max-width: 660px; }

/* ========================================
   Bootstrap overrides
   ======================================== */

.navbar-toggler {
  border: 1px solid var(--border) !important;
  padding: 0.2rem 0.4rem;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23000' stroke-linecap='square' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ========================================
   Navbar
   ======================================== */

.blog-navbar {
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.blog-navbar .navbar-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.blog-navbar .navbar-brand:hover { opacity: 0.55; }

.blog-navbar .nav-link {
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  text-decoration: none;
}

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

/* ========================================
   Hero
   ======================================== */

.hero-section {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-section h1 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.hero-section .tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========================================
   Post Index List (home page)
   ======================================== */

.post-index-list {
  display: flex;
  flex-direction: column;
}

.post-index-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0 1.25rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  align-items: baseline;
}

.post-index-row:last-child { border-bottom: none; }

.post-index-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ========================================
   Post Items
   ======================================== */

.post-item { display: flex; flex-direction: column; }

.post-item-featured { max-width: 820px; }

.post-item-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  display: block;
  text-decoration: none;
}

.post-item-title:hover { text-decoration: underline; text-underline-offset: 2px; }

.post-item-excerpt {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
  margin-bottom: 0.4rem;
  white-space: normal;
}

/* ========================================
   Image Placeholder — hidden in e-ink mode
   ======================================== */

.image-placeholder,
.post-image-placeholder {
  display: none;
}

.post-image-link { display: none; }

/* ========================================
   Post Meta
   ======================================== */

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.post-meta .separator { opacity: 0.5; }

/* ========================================
   Prose
   ======================================== */

.prose {
  max-width: 100%;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text);
}

.prose h2 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.prose h3 {
  font-size: 0.875rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

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

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin-left: 0;
  color: var(--text-muted);
  font-style: italic;
}

.prose pre {
  background-color: #f5f5f5;
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
}

.prose code {
  background-color: #f5f5f5;
  padding: 0.1em 0.35em;
  font-size: 0.875em;
}

.prose pre code { background: none; padding: 0; }

.prose .katex-display { overflow-x: auto; overflow-y: hidden; }
.prose .katex { white-space: normal; }

.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }

.prose img {
  width: 100%;
  margin: 1.5rem 0;
  display: block;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(0, 0, 0, 0.3);
}

.prose a:hover { text-decoration-color: var(--text); }

/* ========================================
   Post Header
   ======================================== */

.post-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  text-align: left !important;
}

.post-header h1 {
  font-size: 1rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

/* ========================================
   Section Labels
   ======================================== */

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

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

.blog-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ========================================
   Writing Page
   ======================================== */

.year-group { margin-bottom: 2rem; }

.year-heading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin-bottom: 0.75rem;
}

.post-list-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0 1.25rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  align-items: baseline;
}

.post-list-item:last-child { border-bottom: none; }

.post-list-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.post-list-title {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  font-size: 0.82rem;
  text-decoration: none;
}

.post-list-title:hover { text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 576px) {
  .post-list-item { grid-template-columns: 1fr; gap: 0.1rem; }
  .post-index-row { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* ========================================
   About Page
   ======================================== */

.about-portrait {
  width: 140px;
  height: 140px;
  overflow: hidden;
  flex-shrink: 0;
}

/* ========================================
   Giscus
   ======================================== */

.giscus, .giscus-frame {
  width: 100% !important;
  max-width: 100%;
}

/* ========================================
   Utilities
   ======================================== */

.text-muted-warm { color: var(--text-muted); }

/* ========================================
   Dark Mode
   ======================================== */

[data-theme="dark"] {
  --bg: #000000;
  --text: #FFFFFF;
  --text-muted: #888888;
  --border: #FFFFFF;
}

[data-theme="dark"] body {
  background-color: #000000;
}

[data-theme="dark"] .prose pre,
[data-theme="dark"] .prose code {
  background-color: #111111;
}


[data-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23fff' stroke-linecap='square' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ========================================
   Theme Toggle Button
   ======================================== */

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.theme-toggle:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ========================================
   Category Filter Buttons
   ======================================== */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
}

.filter-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 0.1rem 0.55rem;
  cursor: pointer;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
