/* ─── Reset & variables ──────────────────────────────────────────────────── */

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

:root {
  --bg:          #0f0f1a;
  --bg-card:     #1a1a2e;
  --bg-code:     #16213e;
  --border:      #2a2a4a;
  --text:        #e0e0e0;
  --text-muted:  #8888aa;
  --accent:      #e94560;
  --accent-dim:  #c23152;
  --link:        #5dade2;
  --link-hover:  #85c1e9;
  --tag-bg:      #1e1e3a;
  --tag-text:    #e94560;
  --font-sans:   "Georgia", "Times New Roman", serif;
  --font-mono:   "Inter", system-ui, -apple-system, sans-serif;
  --font-head:   "Inter", system-ui, -apple-system, sans-serif;
}

/* ─── Base ───────────────────────────────────────────────────────────────── */

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-main {
  flex: 1;
  padding: 2.5rem 0 4rem;
}

.site-layout {
  display: grid;
  grid-template-columns: 1fr minmax(0, 780px) 1fr;
  grid-template-areas: "left content right";
  gap: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.25rem;
  align-items: start;
}

.site-content {
  grid-area: content;
  min-width: 0;
}

.sidebar-left  { grid-area: left; }
.sidebar-right { grid-area: right; }

/* ─── Community bulletins ────────────────────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  scrollbar-width: thin;
}

.bulletin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px double var(--accent);
  padding: 0.85rem 0.9rem;
  font-family: "Georgia", "Times New Roman", serif;
}

.bulletin-label {
  font-family: var(--font-head);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.bulletin-headline {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.bulletin-body {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.bulletin-tagline {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  border: 1px dashed var(--accent-dim);
  padding: 0.25rem 0.4rem;
  margin-bottom: 0.35rem;
}

.bulletin-fine-print {
  font-size: 0.62rem;
  color: var(--text-muted);
  opacity: 0.6;
  line-height: 1.4;
  font-style: italic;
}

@media (max-width: 1200px) {
  .site-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
  }
  .sidebar { display: none; }
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 2px solid var(--accent);
  padding: 1rem 0;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-title:hover {
  color: #fff;
  text-decoration: none;
  opacity: 0.85;
}

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

.site-title .logo-nn {
  color: #fff;
}

.prompt {
  display: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ─── Top Articles ───────────────────────────────────────────────────────── */

.top-articles {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.section-heading {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.top-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.top-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.top-article-card .post-title {
  font-size: 0.95rem;
  margin: 0;
}

.top-article-card .post-meta {
  font-size: 0.75rem;
}

.top-article-card .post-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */

.home-hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 2.5rem;
}

.home-hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-head);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Breaking banner ────────────────────────────────────────────────────── */

.breaking-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ─── Post list ──────────────────────────────────────────────────────────── */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s;
}

.post-card:hover {
  border-left-color: #fff;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-head);
}

.read-time {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.4;
  font-family: var(--font-head);
}

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

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

.post-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  border: 1px solid var(--accent-dim);
  text-decoration: none;
}

.tag:hover {
  background: var(--accent-dim);
  color: #fff;
  text-decoration: none;
}

.no-posts {
  color: var(--text-muted);
  font-family: var(--font-head);
}

/* ─── Single post ────────────────────────────────────────────────────────── */

.post-header {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.post-header .post-title {
  font-size: 1.8rem;
  margin-top: 0.6rem;
  line-height: 1.3;
  color: #fff;
}

.post-content {
  font-size: 1.05rem;
  line-height: 1.85;
}

.post-content h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  color: var(--accent);
  font-family: var(--font-head);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.post-content h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--link);
  font-family: var(--font-head);
}

.post-content p {
  margin-bottom: 1.2rem;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.2rem 1.5rem;
}

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

.post-content a {
  color: var(--link);
  text-decoration: underline;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.5rem 0;
}

.post-content code {
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--accent);
}

.post-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.87rem;
  color: var(--text);
}

.post-content img {
  max-width: 100%;
  border-radius: 2px;
  border: 1px solid var(--border);
}

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

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.post-content th {
  background: var(--bg-card);
  color: var(--accent);
  font-family: var(--font-head);
}


/* ─── List pages (tags, categories) ─────────────────────────────────────── */

.list-header h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-head);
  color: var(--accent);
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  font-family: var(--font-head);
  font-size: 0.9rem;
}

.pagination a,
.pagination span {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

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

/* ─── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 2px solid var(--accent);
  padding: 1.25rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-head);
  background: var(--bg-card);
}

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

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

/* ─── Related posts ──────────────────────────────────────────────────────── */

.related-posts {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.related-title {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 1rem;
}

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

.related-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.related-link {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.related-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.related-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-head);
}

/* ─── Search page ────────────────────────────────────────────────────────── */

.search-page {
  padding-top: 1rem;
}

.search-title {
  font-family: var(--font-head);
  color: var(--accent);
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.search-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Pagefind dark theme overrides */
#search {
  --pagefind-ui-scale: 1;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg-card);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--tag-bg);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 4px;
  --pagefind-ui-image-border-radius: 2px;
  --pagefind-ui-image-box-ratio: 3 / 2;
  --pagefind-ui-font: var(--font-sans);
}

/* ─── About page ─────────────────────────────────────────────────────────── */

.post-full h2:first-child {
  margin-top: 1.5rem;
}

/* ─── Reading progress bar ───────────────────────────────────────────────── */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.08s linear;
  pointer-events: none;
  opacity: 0;
}

#reading-progress.active {
  opacity: 1;
}

/* ─── Share links ────────────────────────────────────────────────────────── */

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.share-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.share-label {
  font-family: var(--font-head);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.share-btn {
  font-family: var(--font-head);
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.back-link {
  font-family: var(--font-head);
  font-size: 0.9rem;
}

/* ─── Taxonomy terms grid (tags / categories index pages) ────────────────── */

.terms-header {
  padding: 1.5rem 0 1rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 2rem;
}

.terms-title {
  font-family: var(--font-head);
  color: var(--accent);
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.terms-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-head);
}

.terms-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.term-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 0.15s;
}

.term-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.term-name {
  font-family: var(--font-head);
  font-size: 0.88rem;
  color: var(--text);
}

.term-badge {
  font-family: var(--font-head);
  font-size: 0.72rem;
  background: var(--tag-bg);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  padding: 0.05rem 0.4rem;
  font-weight: 700;
}

/* ─── Writers grid ───────────────────────────────────────────────────────── */

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

.writer-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.writer-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.writer-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.writer-name {
  font-family: var(--font-head);
  font-size: 1.1rem;
  margin: 0;
  color: var(--text);
}

.writer-count {
  font-family: var(--font-head);
  font-size: 0.7rem;
  background: var(--tag-bg);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  padding: 0.05rem 0.4rem;
  font-weight: 700;
  white-space: nowrap;
}

.writer-beat {
  font-family: var(--font-head);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.writer-voice {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.writer-status {
  display: inline-block;
  margin: 0.4rem 0 0.2rem;
  padding: 0.1rem 0.5rem;
  font-family: var(--font-head);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 0.2rem;
}

.writer-status-current {
  background: rgba(0, 128, 0, 0.12);
  color: #2a7a2a;
}

.writer-status-former {
  background: rgba(128 , 0, 0, 0.12);
  color: var(--accent);
  text-decoration: line-through;
}

.writer-bio {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.writer-bio p {
  margin: 0;
}

/* ─── Nav toggle (hamburger) ─────────────────────────────────────────────── */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 0;
}

.nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header.nav-open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .bar:nth-child(2) { opacity: 0; }
.site-header.nav-open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  /* Header */
  .nav-toggle { display: block; }

  .site-header .container {
    flex-wrap: wrap;
    align-items: center;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    order: 3;
    padding-top: 0.5rem;
  }

  .site-header.nav-open .site-nav {
    display: flex;
  }

  .site-nav a {
    padding: 0.6rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
  }

  /* Layout */
  .site-layout {
    padding: 0 1rem;
  }

  .site-main {
    padding: 1.5rem 0 3rem;
  }

  /* Hero */
  .home-hero {
    padding: 1.5rem 0 1.25rem;
    margin-bottom: 1.5rem;
  }

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

  .hero-desc {
    font-size: 0.9rem;
  }

  /* Top articles — single column on mobile */
  .top-articles-grid {
    grid-template-columns: 1fr;
  }

  /* Post list */
  .post-card {
    padding: 1rem 1.1rem;
  }

  .post-title {
    font-size: 1rem;
  }

  /* Single post */
  .post-header .post-title {
    font-size: 1.35rem;
  }

  .post-content {
    font-size: 1rem;
  }

  /* Post footer share row */
  .post-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Writers grid — single column */
  .writers-grid {
    grid-template-columns: 1fr;
  }

  /* Related posts */
  .related-posts {
    padding: 1rem;
  }

  /* Section headings */
  .section-heading {
    font-size: 0.7rem;
  }
}
