/* === COMPENDIUM === */

.compendium-page .tweet,
.compendium-tweet {
  position: relative;
  padding: 0.9rem 0;
}

/* Date stamp: top-left, bold small */
.tweet-date {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: #8a7e72;
  text-align: left;
  margin-bottom: 0.15rem;
}

/* Content-first layout */
.tweet-content {
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Tag styling: bottom-right */
.compendium-tweet .tweet-tags {
  margin-top: 0.35rem;
  text-align: right;
}

/* Per-tag pastel colors */
.tag-badge.tag-reflection { background: #e8f0fe; border-color: #c5d7f2; color: #2a4a7f; }
.tag-badge.tag-joke       { background: #fef3e0; border-color: #f2ddb5; color: #7a5a1f; }
.tag-badge.tag-take       { background: #fde8e8; border-color: #f2c5c5; color: #8b2525; }
.tag-badge.tag-aphorism   { background: #e8f5e9; border-color: #b9debb; color: #2e6b32; }
.tag-badge.tag-advice     { background: #f3e8fd; border-color: #d5bff2; color: #5b2e8b; }
.tag-badge.tag-idea       { background: #e0f7fa; border-color: #b2ebf2; color: #00695c; }
.tag-badge.tag-ascii      { background: #f0ebe1; border-color: #d9d0c4; color: #4a4035; }
.tag-badge.tag-prehistory { background: #fce4ec; border-color: #f0b8c8; color: #7a2e4a; }

/* Featured = magazine callout */
.tweet.featured {
  border: 1px solid #d9d0c4;
  background: #f5f0e8;
  padding: 0.9rem 1rem;
  border-radius: 6px;
}

.tweet.featured .tweet-content {
  font-weight: 600;
}

/* Featured tweets colored by primary tag */
.tweet.featured.tag-reflection { background: #e8f0fe; border-color: #c5d7f2; }
.tweet.featured.tag-joke       { background: #fef3e0; border-color: #f2ddb5; }
.tweet.featured.tag-take       { background: #fde8e8; border-color: #f2c5c5; }
.tweet.featured.tag-aphorism   { background: #e8f5e9; border-color: #b9debb; }
.tweet.featured.tag-advice     { background: #f3e8fd; border-color: #d5bff2; }
.tweet.featured.tag-idea       { background: #e0f7fa; border-color: #b2ebf2; }
.tweet.featured.tag-ascii      { background: #f0ebe1; border-color: #d9d0c4; }

/* Star indicator (unused, kept for reference) */
.tweet-star {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font-size: 0.85rem;
  color: #c8a000;
  opacity: 0.8;
}

/* Permalink anchor */
.tweet-permalink {
  position: absolute;
  top: 0.5rem;
  right: 0.4rem;
  font-size: 0.75rem;
  text-decoration: none;
  opacity: 0.25;
  transition: opacity 0.15s;
}
.compendium-tweet:hover .tweet-permalink {
  opacity: 0.6;
}
.tweet-permalink:hover {
  opacity: 1 !important;
  cursor: pointer;
}

/* "Link copied!" tooltip */
.copy-tooltip {
  position: absolute;
  top: -1.6rem;
  right: 0;
  background: #4a4035;
  color: #faf6f0;
  font-size: 0.65rem;
  font-family: system-ui, -apple-system, sans-serif;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  animation: tooltip-fade 1.8s ease-out forwards;
}
@keyframes tooltip-fade {
  0%, 60% { opacity: 1; }
  100%    { opacity: 0; }
}

/* Permalink highlight (persistent until another tweet is selected) */
.compendium-tweet.permalink-highlight,
.tweet.permalink-highlight {
  outline: 2px solid #c5a96a;
  outline-offset: 2px;
  border-radius: 4px;
  background: #f5edd8;
}

/* ASCII tweets */
.tweet-text-ascii pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #f5f0e8;
  padding: 0.5rem;
  border-radius: 4px;
}

/* Stats box at end of chapter */
.compendium-stats {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #f5f0e8, #ede7dc);
  border: 1px solid #d9d0c4;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #4a4035;
  line-height: 1.6;
}
.stats-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #2c2420;
}
.stats-row {
  margin-bottom: 0.4rem;
}
.stats-label {
  display: inline-block;
  width: 4.5rem;
  font-weight: 600;
  color: #6b5e50;
}
.compendium-stats .tag-badge {
  font-size: 0.7rem;
  margin-bottom: 0.2rem;
}

/* === ASCII FIX PATCH (manual) START === */
.compendium-page [data-tweet-id="1018724483509542912"] pre,
.compendium-page [data-tweet-id="1018734664352059392"] pre {
  white-space: pre;        /* critical: do NOT wrap */
  overflow-x: auto;        /* allow horizontal scroll */
  font-size: 0.90rem;      /* optional: slightly smaller */
  line-height: 1.15;       /* optional: tighter */
}
/* === ASCII FIX PATCH (manual) END === */
