/* ============================================
   CivilsWisdom — Static Site CSS
   Extracted from prototype/c/index.html
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
  --bg: #FFFFFF;
  --bg-alt: #FAFAF9;
  --bg-card: #FFFFFF;
  --bg-callout: #F0FDFA;
  --bg-connection: #FFF7ED;
  --text: #171717;
  --text-secondary: #3F3F46;
  --text-muted: #71717A;
  --accent: #0F766E;
  --accent-hover: #0D6560;
  --accent-light: #F0FDFA;
  --accent-text: #115E59;
  --accent-subtle: #CCFBF1;
  --highlight: #EA580C;
  --highlight-light: #FFF7ED;
  --border: #E4E4E7;
  --border-light: #F4F4F5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
}

html.dark {
  --bg: #09090B;
  --bg-alt: #18181B;
  --bg-card: #18181B;
  --bg-callout: #0F2825;
  --bg-connection: #1C1410;
  --text: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --accent: #14B8A6;
  --accent-hover: #0D9488;
  --accent-light: #0F2825;
  --accent-text: #5EEAD4;
  --accent-subtle: #134E4A;
  --highlight: #FB923C;
  --highlight-light: #1C1410;
  --border: #27272A;
  --border-light: #1E1E22;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.25);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.35);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.5px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.logo:hover { color: var(--text); }

.logo-dot {
  color: var(--accent);
  font-size: 26px;
  line-height: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent);
  background-color: var(--accent-light);
}

.nav-link.active {
  color: var(--accent);
  background-color: var(--accent-light);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dark-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.dark-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-light);
}

/* ---- Hamburger (mobile) ---- */
.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--text-secondary);
  border-radius: 1px;
  transition: all 0.2s ease;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.mobile-menu {
  display: none;
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg);
  z-index: 99;
  padding: 16px 24px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.mobile-menu.open { display: flex; }

.mobile-menu .nav-link {
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 8px;
  width: 100%;
  text-align: left;
}

/* ---- Topic Nav (pills) ---- */
.topic-nav {
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.topic-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.topic-nav-inner::-webkit-scrollbar { display: none; }

.topic-pill {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  display: inline-block;
}

.topic-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-light);
}

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

html.dark .topic-pill.active { color: #FFFFFF; }

.topic-pill-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 4px;
  background-color: var(--border-light);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 18px;
}

.topic-pill.active .topic-pill-count {
  background-color: rgba(255,255,255,0.2);
  color: #FFFFFF;
}

/* ---- Landing Hero ---- */
.landing-hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  text-align: center;
}

.landing-hero-title {
  font-weight: 800;
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 16px;
}

.landing-hero-title .accent { color: var(--accent); }

.landing-hero-sub {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  background-color: var(--accent);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  text-decoration: none;
}

.cta-primary:hover {
  background-color: var(--accent-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15,118,110,0.3);
}

.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-item {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-item strong {
  color: var(--accent);
  font-weight: 700;
}

.stat-divider {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--border);
}

/* ---- Topic Card Grid ---- */
.topic-browse-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  overflow: hidden;
}

.section-header {
  text-align: center;
  margin-bottom: 32px;
}

.section-title {
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

.topic-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  overflow: hidden;
}

.topic-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.topic-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.topic-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.topic-card-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.topic-card-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.topic-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  flex: 1;
}

.topic-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  border-top: 1px solid var(--border-light);
}

.topic-card-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ---- Week Preview / This Week ---- */
.week-preview-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.week-preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.week-date-group { margin-bottom: 28px; }

.week-date-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.week-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 99px;
  background-color: var(--accent-light);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 13px;
}

.week-date-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.week-article-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.week-article-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.week-article-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--card-accent, var(--accent));
}

.week-article-border {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.week-article-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-article-topic {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  align-self: flex-start;
}

.week-article-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.week-article-item:hover .week-article-title { color: var(--accent); }

.week-article-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.week-article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Article Grid ---- */
.grid-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.grid-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.grid-section-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.grid-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.article-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px 24px 28px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.article-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  background-color: var(--card-accent, var(--accent));
  border-radius: 2px;
  transition: opacity 0.15s ease;
  opacity: 0.4;
}

.article-card:hover {
  border-color: var(--card-accent, var(--accent));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.article-card:hover::before { opacity: 1; }

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.topic-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #FFFFFF;
}

.card-reading-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.1px;
}

.card-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-gs-papers {
  display: flex;
  gap: 4px;
}

.gs-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--highlight);
  background-color: var(--highlight-light);
  border: 1px solid var(--highlight);
}

.card-read-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.card-date-badge {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Date Group Headers ---- */
.date-group-header {
  grid-column: 1 / -1;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
  padding: 16px 0 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: -4px;
}

.date-group-header:first-child { padding-top: 0; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 0 0;
}

.page-btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  text-decoration: none;
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-light);
}

.page-indicator {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a, .breadcrumb span {
  font-size: 13px;
  font-weight: 500;
}

.breadcrumb a { color: var(--accent); }
.breadcrumb .sep { color: var(--text-muted); font-size: 11px; }

.breadcrumb .current {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* ---- Page Title Bar ---- */
.page-title-bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 0;
}

.page-title-bar h1 {
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 4px;
}

.page-title-bar .page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Hero Card ---- */
.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 24px;
}

.hero-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  color: inherit;
}

.hero-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--accent);
}

.hero-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.hero-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.hero-date {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-title {
  font-weight: 800;
  font-size: 32px;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  max-width: 800px;
}

.hero-description {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 720px;
  margin-bottom: 16px;
}

.hero-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.hero-reading-time {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Article Page ---- */
.back-link-bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.back-link:hover { opacity: 0.8; }

.article-header {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 0;
}

.article-header-inner {
  max-width: 720px;
  margin-left: 240px;
  padding-left: 40px;
}

.article-page-title {
  font-weight: 800;
  font-size: 34px;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.article-meta-date {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.article-meta-reading {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.article-meta-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-topic {
  background-color: var(--accent-light);
  color: var(--accent-text);
}

.badge-relevance {
  color: var(--highlight);
  background-color: var(--highlight-light);
  border: 1px solid var(--highlight);
}

.article-divider {
  width: 48px;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
  margin-bottom: 8px;
}

/* ---- Article Layout (sidebar + content) ---- */
.article-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  align-items: start;
}

.article-sidebar {
  position: sticky;
  top: 64px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-right: 8px;
  -ms-overflow-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.article-sidebar::-webkit-scrollbar { width: 4px; }
.article-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.toc-header {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toc-list li a {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
  font-weight: 500;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.toc-list li a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

.toc-list li a.toc-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.toc-list li a.toc-h3 {
  padding-left: 24px;
  font-size: 12px;
}

.article-main {
  max-width: 720px;
  min-width: 0;
}

.toc-mobile {
  display: none;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
}

.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.toc-toggle-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toc-toggle-icon {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.toc-toggle-icon.collapsed { transform: rotate(-90deg); }

.toc-list-mobile {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list-mobile.hidden { display: none; }

.toc-list-mobile li a {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  display: block;
  padding: 3px 0;
  text-decoration: none;
}

.toc-list-mobile li a:hover { text-decoration: underline; }

/* ---- Article Content (rendered markdown) ---- */
.article-content {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}

.article-content th, .article-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-content th {
  background-color: var(--bg-alt);
  font-weight: 600;
  color: var(--text);
}

.article-content code {
  background-color: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent-text);
}

.article-content pre {
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.article-content pre code { background: none; padding: 0; }

.article-content h1 { display: none; }

.article-content .meta-block { display: none; }

.article-content h2 {
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  line-height: 1.3;
}

.article-content h3 {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  margin-top: 28px;
  margin-bottom: 10px;
  line-height: 1.35;
}

.article-content h4 {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-top: 20px;
  margin-bottom: 6px;
}

.article-content p {
  margin-bottom: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 16px;
}

.article-content strong {
  color: var(--text);
  font-weight: 600;
}

.article-content ul, .article-content ol {
  margin-bottom: 14px;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 6px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 15px;
}

.article-content li strong { color: var(--text); }

.article-content blockquote {
  border-left: 3px solid var(--highlight);
  padding: 12px 20px;
  margin: 20px 0;
  background-color: var(--highlight-light);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.key-details-box {
  background-color: var(--bg-callout);
  border: 1px solid var(--accent-subtle);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0 16px;
}

.key-details-box p {
  margin-bottom: 6px;
  font-size: 14px;
}

.key-details-box p:last-child { margin-bottom: 0; }

.key-details-box ul {
  margin-bottom: 6px;
  padding-left: 20px;
}

.key-details-box li {
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.6;
}

.connection-box {
  background-color: var(--highlight-light);
  border-left: 3px solid var(--highlight);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 8px 0 20px;
}

.connection-box p {
  margin-bottom: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.connection-box strong { color: var(--highlight); }

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border);
  background-color: var(--bg-alt);
  transition: background-color 0.2s ease;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.footer-brand span { color: var(--accent); }

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Archive Page ---- */
.archive-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.archive-title {
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 24px;
}

.archive-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.archive-date-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.archive-date-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.archive-date-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Empty State ---- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
}

.empty-state-text {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 960px) {
  .article-header-inner {
    margin-left: 0;
    padding-left: 0;
    max-width: 100%;
  }

  .article-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .article-sidebar { display: none; }
  .toc-mobile { display: block; }

  .topic-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body { font-size: 15px; }

  .header-nav { display: none; }
  .hamburger { display: flex; }

  .header-inner { padding: 12px 16px; }
  .logo { font-size: 20px; }
  .logo-dot { font-size: 24px; }

  .topic-nav-inner { padding: 8px 16px; gap: 5px; }
  .topic-pill { padding: 4px 10px; font-size: 12px; }

  .landing-hero { padding: 40px 16px 32px; }
  .landing-hero-title { font-size: 30px; }
  .landing-hero-sub { font-size: 15px; }
  .stats-bar { gap: 12px; }
  .stat-item { font-size: 13px; }

  .hero { padding: 20px 16px 16px; }
  .hero-card { padding: 24px 24px 24px 28px; }
  .hero-title { font-size: 24px; margin-bottom: 8px; }
  .hero-description { font-size: 14px; margin-bottom: 12px; }

  .grid-section { padding: 0 16px 48px; }
  .article-grid { grid-template-columns: 1fr; gap: 12px; }
  .article-card { padding: 20px 20px 20px 24px; }
  .card-title { font-size: 16px; }
  .card-description { font-size: 13px; }
  .topic-badge { font-size: 10px; padding: 2px 6px; }
  .gs-tag { font-size: 10px; padding: 1px 5px; }

  .back-link-bar { padding: 12px 16px 0; }
  .article-header { padding: 24px 16px 0; }
  .article-page-title { font-size: 26px; }
  .article-meta-date { font-size: 13px; }
  .article-meta-reading { font-size: 12px; }
  .article-meta-badge { font-size: 11px; padding: 2px 8px; }
  .article-layout { padding: 20px 16px 60px; }
  .toc-mobile { padding: 12px 16px; margin-bottom: 24px; }

  .article-content h2 { font-size: 20px; margin-top: 32px; padding-bottom: 6px; }
  .article-content h3 { font-size: 17px; margin-top: 24px; }
  .article-content p { font-size: 15px; margin-bottom: 12px; }
  .article-content li { font-size: 14px; }

  .key-details-box { padding: 14px 16px; }
  .key-details-box li { font-size: 13px; }
  .connection-box { padding: 12px 14px; }
  .connection-box p { font-size: 14px; }

  .topic-card-grid { grid-template-columns: 1fr; }

  .week-preview-section, .topic-browse-section { padding-left: 16px; padding-right: 16px; }
  .page-title-bar { padding: 16px 16px 0; }
  .archive-section { padding: 16px 16px 48px; }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 24px 16px;
  }

  .footer-links { gap: 16px; }
}

@media (max-width: 480px) {
  .landing-hero-title { font-size: 26px; }
  .landing-hero-sub { font-size: 14px; }

  .cta-primary {
    padding: 10px 20px;
    font-size: 14px;
    width: 100%;
    justify-content: center;
  }

  .hero-title { font-size: 21px; }
  .hero-card { padding: 18px 16px 18px 20px; }
  .hero-card::before { width: 3px; }
  .hero-description { font-size: 13px; }

  .card-title { font-size: 15px; }
  .card-description { font-size: 12px; }
  .article-card { padding: 16px 16px 16px 20px; gap: 8px; }
  .article-card::before { top: 12px; bottom: 12px; }

  .article-page-title { font-size: 22px; }
  .article-content h2 { font-size: 18px; }
  .article-content h3 { font-size: 16px; }
  .article-content p { font-size: 14px; line-height: 1.7; }
  .article-content ul, .article-content ol { padding-left: 18px; }
  .article-content li { font-size: 13px; }

  .key-details-box { padding: 12px 14px; border-radius: 8px; }
  .key-details-box li { font-size: 12px; }
  .connection-box { padding: 10px 12px; }
  .connection-box p { font-size: 13px; }
}
