/* =============================================================
   Tag Cloud — Custom styles for the /tags page
   Jekyll Chirpy theme override
   ============================================================= */
/* ── Container ─────────────────────────────────────────────── */
.tag-cloud-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  margin: 0;
}

/* ── Base tag style ─────────────────────────────────────────── */
.tag.tag-cloud {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  border: none !important;
  border-radius: 22px;
  padding: 0.28em 0.85em 0.32em;
  margin: 0;
  line-height: 1.5;
  letter-spacing: 0.01em;
  font-weight: 400;
  color: #fff !important;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease,
    opacity 0.2s ease;
  will-change: transform;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#tags a.tag.tag-cloud:hover,
.tag.tag-cloud:hover {
  transform: scale(1.12) translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  text-decoration: none !important;
  color: #fff !important;
}

/* Tag count badge */
.tag.tag-cloud .tag-count {
  font-size: 0.72em;
  font-family: Oswald, sans-serif;
  opacity: 0.85;
  margin-left: 0.15em;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0 0.45em;
  line-height: 1.4;
}

/* ── LIGHT MODE tiers ───────────────────────────────────────── */

.tag.tag-cloud[data-count='1'] {
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.72;
  background: linear-gradient(135deg, #bdbdbd, #9e9e9e);
}
.tag.tag-cloud[data-count='1']:hover {
  opacity: 1;
}

.tag.tag-cloud[data-count='2'] {
  font-size: 0.95rem;
  opacity: 0.82;
  background: linear-gradient(135deg, #90caf9, #64b5f6);
}
.tag.tag-cloud[data-count='2']:hover {
  opacity: 1;
}

.tag.tag-cloud[data-count='3'] {
  font-size: 1.05rem;
  opacity: 0.87;
  background: linear-gradient(135deg, #64b5f6, #42a5f5);
}
.tag.tag-cloud[data-count='3']:hover {
  opacity: 1;
}

.tag.tag-cloud[data-count='4'] {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.92;
  background: linear-gradient(135deg, #4fc3f7, #29b6f6);
}
.tag.tag-cloud[data-count='4']:hover {
  opacity: 1;
}

.tag.tag-cloud[data-count='5'] {
  font-size: 1.2rem;
  font-weight: 500;
  opacity: 0.93;
  background: linear-gradient(135deg, #29b6f6, #039be5);
}
.tag.tag-cloud[data-count='5']:hover {
  opacity: 1;
}

.tag.tag-cloud[data-count='6'] {
  font-size: 1.28rem;
  font-weight: 600;
  background: linear-gradient(135deg, #26c6da, #00acc1);
}

.tag.tag-cloud[data-count='7'] {
  font-size: 1.28rem;
  font-weight: 600;
  background: linear-gradient(135deg, #26c6da, #00acc1);
}

.tag.tag-cloud[data-count='8'] {
  font-size: 1.3rem;
  font-weight: 600;
  background: linear-gradient(135deg, #26a69a, #00897b);
}

.tag.tag-cloud[data-count='9'] {
  font-size: 1.3rem;
  font-weight: 600;
  background: linear-gradient(135deg, #43a047, #2e7d32);
}

.tag.tag-cloud.tag-xl {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #66bb6a, #43a047);
  box-shadow: 0 4px 12px rgba(67, 160, 71, 0.35);
}
.tag.tag-cloud.tag-xl:hover {
  box-shadow: 0 10px 24px rgba(67, 160, 71, 0.45);
}

/* ── DARK MODE tiers (html[data-mode="dark"] for higher specificity) ── */

html[data-mode='dark'] .tag.tag-cloud {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}
html[data-mode='dark'] #tags a.tag.tag-cloud:hover,
html[data-mode='dark'] .tag.tag-cloud:hover {
  background-color: var(--tag-hover-new);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  color: #fff !important;
}

html[data-mode='dark'] .tag.tag-cloud[data-count='1'] {
  background: linear-gradient(135deg, #555, #3a3a3a) !important;
  opacity: 0.75;
}
html[data-mode='dark'] .tag.tag-cloud[data-count='1']:hover {
  opacity: 1;
}

html[data-mode='dark'] .tag.tag-cloud[data-count='2'] {
  background: linear-gradient(135deg, #1a5276, #154360) !important;
  opacity: 0.85;
}
html[data-mode='dark'] .tag.tag-cloud[data-count='2']:hover {
  opacity: 1;
}

html[data-mode='dark'] .tag.tag-cloud[data-count='3'] {
  background: linear-gradient(135deg, #1f618d, #1a5276) !important;
  opacity: 0.9;
}
html[data-mode='dark'] .tag.tag-cloud[data-count='3']:hover {
  opacity: 1;
}

html[data-mode='dark'] .tag.tag-cloud[data-count='4'] {
  background: linear-gradient(135deg, #0277bd, #01579b) !important;
}
html[data-mode='dark'] .tag.tag-cloud[data-count='5'] {
  background: linear-gradient(135deg, #0288d1, #01579b) !important;
}

html[data-mode='dark'] .tag.tag-cloud[data-count='6'],
html[data-mode='dark'] .tag.tag-cloud[data-count='7'] {
  background: linear-gradient(135deg, #00838f, #006064) !important;
}

html[data-mode='dark'] .tag.tag-cloud[data-count='8'],
html[data-mode='dark'] .tag.tag-cloud[data-count='9'] {
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
}

html[data-mode='dark'] .tag.tag-cloud.tag-xl {
  background: linear-gradient(135deg, #388e3c, #1b5e20) !important;
  box-shadow: 0 4px 14px rgba(56, 142, 60, 0.45) !important;
}

/* ── system dark (no manual toggle) ────────────────────────── */
@media (prefers-color-scheme: dark) {
  html:not([data-mode='light']) .tag.tag-cloud {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='1'] {
    background: linear-gradient(135deg, #555, #3a3a3a) !important;
    opacity: 0.75;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='2'] {
    background: linear-gradient(135deg, #1a5276, #154360) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='3'] {
    background: linear-gradient(135deg, #1f618d, #1a5276) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='4'] {
    background: linear-gradient(135deg, #0277bd, #01579b) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='5'] {
    background: linear-gradient(135deg, #0288d1, #01579b) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='6'],
  html:not([data-mode='light']) .tag.tag-cloud[data-count='7'] {
    background: linear-gradient(135deg, #00838f, #006064) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud[data-count='8'],
  html:not([data-mode='light']) .tag.tag-cloud[data-count='9'] {
    background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  }
  html:not([data-mode='light']) .tag.tag-cloud.tag-xl {
    background: linear-gradient(135deg, #388e3c, #1b5e20) !important;
    box-shadow: 0 4px 14px rgba(56, 142, 60, 0.45) !important;
  }
}

/* ── Mobile responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .tag-cloud-container {
    justify-content: center;
    gap: 0.5rem 0.6rem;
    padding: 0.25rem 0;
  }
  .tag.tag-cloud[data-count='1'] {
    font-size: 0.8rem;
  }
  .tag.tag-cloud[data-count='2'] {
    font-size: 0.88rem;
  }
  .tag.tag-cloud[data-count='3'] {
    font-size: 0.95rem;
  }
  .tag.tag-cloud[data-count='4'] {
    font-size: 1rem;
  }
  .tag.tag-cloud[data-count='5'] {
    font-size: 1.05rem;
  }
  .tag.tag-cloud[data-count='6'],
  .tag.tag-cloud[data-count='7'],
  .tag.tag-cloud[data-count='8'],
  .tag.tag-cloud[data-count='9'] {
    font-size: 1.15rem;
  }
  .tag.tag-cloud.tag-xl {
    font-size: 1.3rem;
  }
}

/* =============================================================
   Tag Detail Page — /tags/:name/
   ============================================================= */

#page-tag {
  padding-top: 0.5rem;
}

/* ── Header banner ─────────────────────────────────────────── */
.tag-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.4rem 1.8rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #4fc3f7 0%, #00897b 100%);
  box-shadow: 0 4px 20px rgba(79, 195, 247, 0.25);
  position: relative;
  overflow: hidden;
}

.tag-detail-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.tag-detail-header::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 40%;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.tag-detail-icon {
  font-size: 1.6rem;
  color: rgba(255, 255, 255, 0.85);
  z-index: 1;
}

.tag-detail-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  z-index: 1;
}

.tag-detail-count {
  margin-left: auto;
  z-index: 1;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 0.25em 0.9em;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

/* ── Post list ──────────────────────────────────────────────── */
.tag-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-posts-list li {
  padding: 0 !important;
  line-height: unset !important;
}
.tag-posts-list li::before {
  display: none !important;
}

.tag-post-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.2rem;
  border-radius: 12px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--main-border-color, #e8e8e8);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  gap: 1rem;
}

.tag-post-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: #4fc3f7;
}

.tag-post-link {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--link-color, #0969da) !important;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: none !important;
}

.tag-post-link:hover {
  color: #4fc3f7 !important;
  text-decoration: none;
}

.tag-post-date {
  font-size: 0.82rem;
  color: var(--text-muted-color, #888);
  white-space: nowrap;
  font-family: Oswald, sans-serif;
  letter-spacing: 0.02em;
}

/* ── Dark mode for tag detail page ─────────────────────────── */
html[data-mode='dark'] .tag-detail-header {
  background: linear-gradient(135deg, #0277bd 0%, #006064 100%);
  box-shadow: 0 4px 20px rgba(2, 119, 189, 0.3);
}

html[data-mode='dark'] .tag-post-item {
  background: var(--card-bg, #1e1e1e);
  border-color: var(--main-border-color, #2c2d2d);
}

html[data-mode='dark'] .tag-post-item:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border-color: #0277bd;
}

html[data-mode='dark'] .tag-post-link {
  color: var(--link-color, #8ab4f8) !important;
}

html[data-mode='dark'] .tag-post-link:hover {
  color: #4fc3f7 !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-mode='light']) .tag-detail-header {
    background: linear-gradient(135deg, #0277bd 0%, #006064 100%);
    box-shadow: 0 4px 20px rgba(2, 119, 189, 0.3);
  }
  html:not([data-mode='light']) .tag-post-item {
    background: var(--card-bg, #1e1e1e);
    border-color: var(--main-border-color, #2c2d2d);
  }
  html:not([data-mode='light']) .tag-post-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-color: #0277bd;
  }
  html:not([data-mode='light']) .tag-post-link {
    color: var(--link-color, #8ab4f8) !important;
  }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .tag-detail-header {
    padding: 1rem 1.2rem;
    gap: 0.75rem;
  }
  .tag-detail-title {
    font-size: 1.4rem;
  }
  .tag-post-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .tag-post-link {
    white-space: normal;
  }
}

/* =============================================================
   Archives Page — Full Vertical Timeline
   ============================================================= */

/* ── Reset Chirpy's default archive pseudo-elements ─────────── */
#archives.archives-timeline .year::before,
#archives.archives-timeline .year::after,
#archives.archives-timeline ul li::before,
#archives.archives-timeline a::before {
  display: none !important;
  content: none !important;
}

/* ── Timeline container ──────────────────────────────────────── */
/* The continuous vertical line is drawn as a left border on this container */
.archives-timeline {
  position: relative;
  /* padding-left: 40px;         room for the line + circles */
  margin-left: 3rem;
}

/* The continuous vertical line */
.archives-timeline::before {
  content: '';
  position: absolute;
  left: 31px; /* centre of the 40px circle area (padding 56px, circle at left=11px, 11+20=31) */
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    #4fc3f7 0%,
    #29b6f6 30%,
    #0288d1 65%,
    #4fc3f7 100%
  );
  opacity: 0.4;
  border-radius: 2px;
}

/* ── Shared node styles ──────────────────────────────────────── */
.tl-node-circle {
  position: absolute;
  left: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* ── Year milestone node ─────────────────────────────────────── */
.tl-year-node {
  position: relative;
  height: 40px;
  margin-bottom: 0.4rem;
  margin-top: 1.8rem;
  display: flex;
  align-items: center;
}

.tl-year-node:first-child {
  margin-top: 0.5rem;
}

.tl-year-circle {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #4fc3f7, #0288d1);
  box-shadow:
    0 0 0 4px rgba(79, 195, 247, 0.18),
    0 4px 12px rgba(79, 195, 247, 0.35);
  left: 11px; /* centre on the line at left:31px → 31-20 = 11 */
}

.tl-year-circle span {
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* ── Post node ───────────────────────────────────────────────── */
.tl-post-node {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 0.35rem;
}

.tl-post-circle {
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #4fc3f7;
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.18);
  left: 26px; /* line at 31px minus 6px (half of 12px) = 25px */
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.tl-post-node:hover .tl-post-circle {
  background: #4fc3f7;
  transform: scale(1.4);
}

/* Horizontal arm from the line to the card */
.tl-post-node::after {
  content: '';
  position: absolute;
  left: 32px;
  width: 28px;
  height: 2px;
  background: rgba(79, 195, 247, 0.4);
  top: 50%;
  transform: translateY(-50%);
}

/* ── Post card ───────────────────────────────────────────────── */
.tl-post-card {
  z-index: 100;
  display: flex;
  align-items: center;
  left: 15px;
  gap: 0.75rem;
  margin-left: 50px; /* after the arm */
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: var(--card-bg, #ffffff);
  border: none;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.04),
    0 4px 10px rgba(0, 0, 0, 0.02);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 0.2s ease;
  min-width: 0;
}

.tl-post-card:hover {
  transform: translateX(4px) scale(1.01);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04);
  background: var(--card-bg-hover, #ffffff);
  text-decoration: none;
}

/* Alternating background colors for readability */
.tl-post-node:nth-of-type(even) .tl-post-card {
  background: var(--card-bg-alt, #fafafa);
}

/* Date (now positioned to the left of the line, horizontal) */
.tl-post-meta {
  position: absolute;
  left: -65px; /* Move it to the left side of the line */
  width: 80px; /* Fixed width so dates align neatly */
  display: flex;
  flex-direction: row; /* Horizontal layout */
  align-items: baseline; /* Align text to baseline */
  justify-content: flex-end; /* Right-align against the line */
  gap: 0.2rem;
  flex-shrink: 0;
  top: 50%;
  transform: translateY(-50%);
}

.tl-day {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: Oswald, sans-serif;
  color: #29b6f6;
  line-height: 1;
}

.tl-month {
  font-size: 0.72rem;
  color: var(--text-muted-color, #999);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Title */
.tl-post-title {
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--text-color, #333);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.tl-post-card:hover .tl-post-title {
  color: var(--link-color, #0288d1);
}

/* End cap dot at the very bottom */
.tl-end-cap {
  position: relative;
  height: 20px;
  margin-top: 0.5rem;
}

.tl-end-cap::before {
  content: '';
  position: absolute;
  left: 27px; /* desktop line is 2px at left:31px => center is 32. dot is 10px so 32-5 = 27px */
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(79, 195, 247, 0.35);
  border: 2px solid rgba(79, 195, 247, 0.5);
}

/* ── Dark mode ───────────────────────────────────────────────── */
html[data-mode='dark'] .archives-timeline::before {
  background: linear-gradient(to bottom, #0288d1 0%, #01579b 50%, #0288d1 100%);
  opacity: 0.5;
}

html[data-mode='dark'] .tl-year-circle {
  background: linear-gradient(135deg, #0288d1, #01579b);
  box-shadow:
    0 0 0 3px rgba(2, 136, 209, 0.25),
    0 3px 10px rgba(1, 87, 155, 0.5);
}

html[data-mode='dark'] .tl-post-circle {
  background: var(--main-bg, #1b1b1e);
  border-color: #0288d1;
  box-shadow: 0 0 0 2px rgba(2, 136, 209, 0.2);
}

html[data-mode='dark'] .tl-post-node:hover .tl-post-circle {
  background: #0288d1;
}

html[data-mode='dark'] .tl-post-node::after {
  background: rgba(2, 136, 209, 0.4);
}

html[data-mode='dark'] .tl-post-card {
  background: var(--card-bg, #1a1a1c);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.3);
}

html[data-mode='dark'] .tl-post-node:nth-of-type(even) .tl-post-card {
  background: var(--card-bg-alt, #222224);
}

html[data-mode='dark'] .tl-post-card:hover {
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(2, 136, 209, 0.3);
  background: var(--card-bg-hover, #242426);
}

html[data-mode='dark'] .tl-day {
  color: #29b6f6;
}

html[data-mode='dark'] .tl-post-card:hover .tl-post-title {
  color: #29b6f6;
}

html[data-mode='dark'] .tl-end-cap::before {
  background: rgba(2, 136, 209, 0.3);
  border-color: rgba(2, 136, 209, 0.5);
}

/* system-level dark */
@media (prefers-color-scheme: dark) {
  html:not([data-mode='light']) .archives-timeline::before {
    background: linear-gradient(
      to bottom,
      #0288d1 0%,
      #01579b 50%,
      #0288d1 100%
    );
    opacity: 0.5;
  }
  html:not([data-mode='light']) .tl-year-circle {
    background: linear-gradient(135deg, #0288d1, #01579b);
    box-shadow:
      0 0 0 3px rgba(2, 136, 209, 0.25),
      0 3px 10px rgba(1, 87, 155, 0.5);
  }
  html:not([data-mode='light']) .tl-post-circle {
    background: var(--main-bg, #1b1b1e);
    border-color: #0288d1;
  }
  html:not([data-mode='light']) .tl-post-node:hover .tl-post-circle {
    background: #0288d1;
  }
  html:not([data-mode='light']) .tl-post-node::after {
    background: rgba(2, 136, 209, 0.4);
  }
  html:not([data-mode='light']) .tl-post-card {
    background: var(--card-bg, #1a1a1c);
    box-shadow:
      0 1px 4px rgba(0, 0, 0, 0.5),
      0 4px 10px rgba(0, 0, 0, 0.3);
  }
  html:not([data-mode='light']) .tl-post-node:nth-of-type(even) .tl-post-card {
    background: var(--card-bg-alt, #222224);
  }
  html:not([data-mode='light']) .tl-post-card:hover {
    box-shadow:
      0 8px 25px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(2, 136, 209, 0.3);
    background: var(--card-bg-hover, #242426);
  }
  html:not([data-mode='light']) .tl-day {
    color: #29b6f6;
  }
  html:not([data-mode='light']) .tl-post-card:hover .tl-post-title {
    color: #29b6f6;
  }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .archives-timeline {
    padding-left: 0px;
    margin-left: rem;
  }
  .archives-timeline::before {
    left: 18px;
  }

  .tl-year-circle {
    width: 32px;
    height: 32px;
    left: 3px; /* 18 - (32/2) = 2. But we want center to fall on 18, so 3+16=19 ok line is 2px at 18/19 -> center is 19.  19 - 16 = 3! left: 3px is perfect. */
  }
  .tl-year-circle span {
    font-size: 0.65rem;
  }

  .tl-post-circle {
    left: 13px;
  } /* center falls on 13+6 = 19. perfect. */
  .tl-post-node::after {
    left: 20px;
    width: 20px;
  }

  .tl-post-card {
    margin-left: 30px;
    padding: 0.5rem 0.75rem;
    left: 0px;
    gap: 0.5rem;
  }
  .tl-post-title {
    font-size: 0.88rem;
    white-space: normal;
  }
  .tl-end-cap::before {
    left: 14px;
  } /* 14+5 = 19. perfect. */
}
/* =============================================================
   Categories Page — 1-Column Modern Stack Layout
   ============================================================= */

.ctg-container-single {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── 1. Overview / Stats Header ─────────────────────────────── */
.ctg-overview {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  padding: 1.25rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--main-border-color, #eaeaea);
  display: flex;
  justify-content: center;
}

.ctg-stats-row {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color, #333);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted-color, #777);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--main-border-color, #eaeaea);
}

/* ── 2. Controls (Search & Sort) ────────────────────────────── */
.ctg-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.ctg-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.ctg-search-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

.ctg-search {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--main-border-color, #eaeaea);
  border-radius: 30px;
  background: var(--main-bg, #fafafa);
  color: var(--text-color, #333);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}

.ctg-search:focus {
  background: var(--card-bg, #ffffff);
  border-color: #4fc3f7;
  box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
}

.ctg-sort-wrapper {
  display: flex;
  gap: 0.5rem;
}

.ctg-sort-btn {
  background: var(--main-bg, #fafafa);
  border: 1px solid var(--main-border-color, #eaeaea);
  color: var(--text-muted-color, #666);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ctg-sort-btn:hover {
  background: var(--card-bg, #ffffff);
  color: var(--text-color, #333);
}

.ctg-sort-btn.active {
  background: #0288d1;
  color: #fff;
  border-color: #0288d1;
}

/* ── 3. Category List & Cards ───────────────────────────────── */
.ctg-list-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ctg-card-single {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition:
    transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.3s ease;
  border: 1px solid var(--main-border-color, #eaeaea);
  border-left: 4px solid var(--category-color); /* Left accent bar */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ctg-card-single:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.ctg-card-main {
  padding: 1.25rem 1.5rem 0.5rem 1.5rem;
}

/* If no progress bar or subcategories, pad the bottom */
.ctg-card-single:not(:has(.ctg-progress-wrapper)):not(
    :has(.ctg-sub-toggle-wrapper)
  )
  .ctg-card-main {
  padding-bottom: 1.25rem;
}

.ctg-main-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none !important;
  color: inherit !important;
  gap: 1rem;
  border-bottom: none !important;
}
.ctg-main-link:hover {
  text-decoration: none !important;
  color: inherit !important;
  border-bottom: none !important;
}

.ctg-card-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.ctg-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  color: #fff;
  font-size: 1.4rem;
  margin-right: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(var(--category-color-rgb, 0, 0, 0), 0.2);
  transition: transform 0.3s ease;
}

.ctg-card-single:hover .ctg-icon-wrapper {
  transform: scale(1.05) rotate(4deg);
}

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

.ctg-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color, #333);
  margin: 0 0 0.25rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.ctg-card-single:hover .ctg-name {
  color: var(--category-color);
}

.ctg-desc {
  font-size: 0.9rem;
  color: var(--text-muted-color, #777);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctg-card-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ctg-stats-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.03);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  min-width: 60px;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.ctg-card-single:hover .ctg-stats-badge {
  background: var(--category-gradient);
  color: #fff;
}

.ctg-stats-badge .count {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.ctg-stats-badge .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-top: 0.2rem;
}
.ctg-card-single:hover .ctg-stats-badge .label {
  color: rgba(255, 255, 255, 0.9);
}

/* ── 4. Series Progress Bar ─────────────────────────────────── */
.ctg-progress-wrapper {
  margin: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ctg-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--main-border-color, #f0f0f0);
  border-radius: 3px;
  overflow: hidden;
}

.ctg-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ctg-progress-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted-color, #666);
  white-space: nowrap;
}

/* ── 5. Subcategories Section ───────────────────────────────── */
.ctg-sub-toggle-wrapper {
  padding: 0.5rem 1.5rem;
}

.ctg-collapse-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted-color, #888);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

.ctg-collapse-btn:hover {
  color: var(--category-color);
}

.ctg-chevron {
  transition: transform 0.3s ease;
  font-size: 0.75rem;
}
.ctg-collapse-btn.open .ctg-chevron {
  transform: rotate(90deg);
}

/* Wrap around sub list with border */
.ctg-sub-collapse {
  margin: 0 1.5rem 1.25rem 1.5rem;
}

.ctg-sub-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--theme-border-color, rgba(0, 0, 0, 0.1));
}

.ctg-sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
  text-decoration: none !important;
  color: var(--text-color, #444) !important;
  transition: all 0.2s ease;
}

/* Dynamic hover background via pseudo element */
.ctg-sub-item {
  position: relative;
  z-index: 1;
}
.ctg-sub-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--category-color);
  opacity: 0.05;
  z-index: -1;
  border-radius: 6px;
  transition: opacity 0.2s;
}

.ctg-sub-item:hover {
  padding-left: 1rem;
  color: var(--category-color) !important;
  text-decoration: none !important;
}

.ctg-sub-item:hover::before {
  opacity: 0.12;
}

.ctg-sub-left {
  display: flex;
  align-items: center;
}

/* =============================================================
   Home 6age Modern Redesign
6  ============================================================= */

.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-container h2 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-color, #333);
}
html[data-mode='dark'] .home-container h2 {
  color: #eaeaea;
}

.section-header {
  margin-bottom: 1.5rem;
}
.section-header h2 {
  margin-bottom: 0;
}
.view-all {
  font-weight: 600;
  color: #0288d1;
  text-decoration: none !important;
  transition: transform 0.2s;
}
.view-all:hover {
  transform: translateX(4px);
}

/* ── Hero Section ── */
.hero {
  text-align: center;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 1rem.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
html[data-mode='dark'] .hero {
  background: linear-gradient(135deg, #2b5876 0%, #4e4376 100%);
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 1rem;
  margin-bottom: 0.8rem;
  color: #fff !important;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.05rem;
  opacity: 0.85;
  margin-bottom: 2rem;
  font-weight: 500;
  color: #fff !important;
  letter-spacing: 0.02em;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.hero .btn {
  padding: 0.7rem 1.4rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none !important;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    background 0.2s;
}
.hero .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  color: inherit !important;
}
.hero .btn.primary {
  background: #fff;
  color: #111827 !important;
}
.hero .btn.primary:hover {
  background: #f3f4f6;
}
.hero .btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.hero .btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}
html[data-mode='dark'] .hero .btn.primary {
  color: #111827 !important;
}

/* ── Featured Post ── */
.featured-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card-bg, #fff);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--main-border-color, #eaeaea);
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}
.featured-post:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
html[data-mode='dark'] .featured-post {
  background: var(--card-bg, #1e1e1e);
  border-color: var(--main-border-color, #2a2a2c);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.featured-post .thumb-wrapper {
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 200px;
}
.featured-post img,
.featured-post .placeholder-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.featured-post .placeholder-thumb {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
html[data-mode='dark'] .featured-post .placeholder-thumb {
  background: linear-gradient(135deg, #2a2a2c 0%, #1e1e1e 100%);
}
.featured-post:hover img {
  transform: scale(1.05);
}
.featured-post .content {
  padding: 1.5rem 2rem;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.featured-post .featured-title-link {
  text-decoration: none !important;
  color: inherit !important;
  border-bottom: none !important;
}
.featured-post .featured-title-link:hover {
  border-bottom: none !important;
}
.featured-post h3 {
  margin-top: 0.7rem;
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
  color: var(--text-color, #333);
  transition: color 0.2s;
}
html[data-mode='dark'] .featured-post h3 {
  color: #eaeaea;
}
.featured-title-link:hover h3 {
  color: #0288d1;
}

.featured-desc p {
  color: var(--text-muted-color, #666);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html[data-mode='dark'] .featured-desc p {
  color: #aaa;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted-color, #888);
  flex-wrap: wrap;
  gap: 1rem;
}
.meta-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.category-badge {
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.pin-badge {
  color: #e53935;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .featured-post {
    grid-template-columns: 1fr;
  }
  .featured-post .thumb-wrapper {
    height: 200px;
    min-height: auto;
  }
  .featured-post .content {
    padding: 1.5rem;
  }
}

/* ── Series Progress ── */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
}
.series-card {
  background: var(--card-bg, #fff);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--main-border-color, #eaeaea);
  transition:
    transform 0.3s,
    box-shadow 0.3s;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
}
html[data-mode='dark'] .series-card {
  background: var(--card-bg, #1e1e1e);
  border-color: var(--main-border-color, #2a2a2c);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.series-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
.series-card h3 {
  font-size: 1.2rem;
  margin-top: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}
.series-card .progress-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
html[data-mode='dark'] .series-card .progress-bar {
  background: rgba(255, 255, 255, 0.1);
}
.series-card .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.series-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted-color, #777);
  font-weight: 500;
  text-align: right;
}

/* ── Recent Posts Grid ── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}
.post-card {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--main-border-color, #eaeaea);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}
html[data-mode='dark'] .post-card {
  background: var(--card-bg, #1e1e1e);
  border-color: var(--main-border-color, #2a2a2c);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}
html[data-mode='dark'] .post-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}

.post-card-link {
  text-decoration: none !important;
  color: inherit !important;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.post-card-link:hover {
  text-decoration: none !important;
  color: inherit !important;
}

.post-card .thumb-wrapper {
  overflow: hidden;
}
.post-card .thumbnail {
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: transform 0.5s;
}
.post-card .placeholder-thumb {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
html[data-mode='dark'] .post-card .placeholder-thumb {
  background: linear-gradient(135deg, #2a2a2c 0%, #1e1e1e 100%);
}
.post-card:hover .thumbnail {
  transform: scale(1.05);
}

.post-card .content {
  padding: 0.5rem 1.5rem 1.5rem 1.5rem;
  background: var(--card-bg, #fff);
  margin-top: 0.5rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
html[data-mode='dark'] .post-card .content {
  background: var(--card-bg, #1e1e1e);
}

.post-card .title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--text-color, #333);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}
html[data-mode='dark'] .post-card .title {
  color: #eaeaea;
}
.post-card-link:hover .title {
  color: #0288d1;
}

.post-card .description p {
  font-size: 0.95rem;
  color: var(--text-muted-color, #666);
  line-height: 1.5;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html[data-mode='dark'] .post-card .description p {
  color: #aaa;
}

.post-card .meta {
  margin-top: auto;
}

@media (max-width: 576px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
}

.sub-ctg-icon {
  margin-right: 0.5rem;
  font-size: 0.9rem;
}

.ctg-sub-name {
  font-size: 0.95rem;
  font-weight: 500;
}

.ctg-sub-count {
  font-size: 0.75rem;
  color: var(--text-muted-color, #888);
}
.ctg-sub-item:hover .ctg-sub-count {
  color: var(--category-color);
}

/* ── 6. Dark Mode ────────────────────────────────────────────── */
html[data-mode='dark'] .ctg-overview,
html[data-mode='dark'] .ctg-card-single {
  background: var(--card-bg, #1e1e1e);
  border-color: var(--main-border-color, #2a2a2c);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html[data-mode='dark'] .ctg-card-single:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-color: var(--category-color); /* Note: top/right/bottom border */
}

html[data-mode='dark'] .stat-val,
html[data-mode='dark'] .ctg-name {
  color: #eaeaea;
}

html[data-mode='dark'] .stat-label,
html[data-mode='dark'] .ctg-desc,
html[data-mode='dark'] .progress-text {
  color: #aaa;
}

html[data-mode='dark'] .stat-divider {
  background: var(--main-border-color, #2a2a2c);
}

html[data-mode='dark'] .ctg-search {
  background: var(--main-bg, #141415);
  border-color: var(--main-border-color, #2a2a2c);
  color: #eaeaea;
}
html[data-mode='dark'] .ctg-search:focus {
  background: var(--card-bg, #1e1e1e);
}

html[data-mode='dark'] .ctg-sort-btn {
  background: var(--main-bg, #141415);
  border-color: var(--main-border-color, #2a2a2c);
  color: #aaa;
}
html[data-mode='dark'] .ctg-sort-btn:hover {
  background: var(--card-bg, #1e1e1e);
  color: #eaeaea;
}
html[data-mode='dark'] .ctg-sort-btn.active {
  background: #0288d1;
  color: #fff;
  border-color: #0288d1;
}

html[data-mode='dark'] .ctg-stats-badge {
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
}
html[data-mode='dark'] .ctg-card-single:hover .ctg-stats-badge {
  color: #fff;
}

html[data-mode='dark'] .ctg-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

html[data-mode='dark'] .ctg-sub-list {
  border-left-color: rgba(255, 255, 255, 0.1);
}

html[data-mode='dark'] .ctg-sub-item {
  color: #ccc;
  background: transparent;
}
html[data-mode='dark'] .ctg-sub-item::before {
  opacity: 0.1;
}
html[data-mode='dark'] .ctg-sub-item:hover::before {
  opacity: 0.2;
}

@media (prefers-color-scheme: dark) {
  html:not([data-mode='light']) .ctg-overview,
  html:not([data-mode='light']) .ctg-card-single {
    background: var(--card-bg, #1e1e1e);
    border-color: var(--main-border-color, #2a2a2c);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  html:not([data-mode='light']) .ctg-card-single:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: var(--category-color);
  }
  html:not([data-mode='light']) .stat-val,
  html:not([data-mode='light']) .ctg-name {
    color: #eaeaea;
  }
  html:not([data-mode='light']) .stat-label,
  html:not([data-mode='light']) .ctg-desc,
  html:not([data-mode='light']) .progress-text {
    color: #aaa;
  }
  html:not([data-mode='light']) .stat-divider {
    background: var(--main-border-color, #2a2a2c);
  }
  html:not([data-mode='light']) .ctg-search {
    background: var(--main-bg, #141415);
    border-color: var(--main-border-color, #2a2a2c);
    color: #eaeaea;
  }
  html:not([data-mode='light']) .ctg-search:focus {
    background: var(--card-bg, #1e1e1e);
  }
  html:not([data-mode='light']) .ctg-sort-btn {
    background: var(--main-bg, #141415);
    border-color: var(--main-border-color, #2a2a2c);
    color: #aaa;
  }
  html:not([data-mode='light']) .ctg-sort-btn:hover {
    background: var(--card-bg, #1e1e1e);
    color: #eaeaea;
  }
  html:not([data-mode='light']) .ctg-sort-btn.active {
    background: #0288d1;
    color: #fff;
    border-color: #0288d1;
  }
  html:not([data-mode='light']) .ctg-stats-badge {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
  }
  html:not([data-mode='light']) .ctg-card-single:hover .ctg-stats-badge {
    color: #fff;
  }
  html:not([data-mode='light']) .ctg-progress-bar {
    background: rgba(255, 255, 255, 0.1);
  }
  html:not([data-mode='light']) .ctg-sub-list {
    border-left-color: rgba(255, 255, 255, 0.1);
  }
  html:not([data-mode='light']) .ctg-sub-item {
    color: #ccc;
    background: transparent;
  }
  html:not([data-mode='light']) .ctg-sub-item::before {
    opacity: 0.1;
  }
  html:not([data-mode='light']) .ctg-sub-item:hover::before {
    opacity: 0.2;
  }
}

/* ── 7. Mobile Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .ctg-stats-row {
    gap: 1rem;
    justify-content: space-between;
    width: 100%;
  }
  .stat-val {
    font-size: 1.25rem;
  }
  .stat-label {
    font-size: 0.7rem;
  }

  .ctg-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .ctg-search-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .ctg-main-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .ctg-icon-wrapper {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    margin-right: 1rem;
  }
  .ctg-name {
    font-size: 1.15rem;
  }

  .ctg-card-right {
    width: 100%;
  }
  .ctg-stats-badge {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
  }
  .ctg-stats-badge .label {
    margin-top: 0;
    margin-left: 0.5rem;
  }
}
