/* ============================================================
   Twitter Archive page — michaelreflects.com
   Scoped under .tweets-archive-page (plus body.tweets-page-body for bg).
   No global selectors. No theme overrides outside this page.
   ============================================================ */

/* Soft sky-tinted background. Center reading column stays light. */
body.tweets-page-body {
  position: relative;
  background:
    linear-gradient(90deg, rgba(188, 232, 255, 0.92) 0, rgba(224, 246, 255, 0.62) 16rem, rgba(255, 255, 255, 0.05) 33rem, rgba(255, 255, 255, 0.0) 47%),
    linear-gradient(270deg, rgba(197, 235, 255, 0.86) 0, rgba(228, 248, 255, 0.58) 16rem, rgba(255, 255, 255, 0.05) 33rem, rgba(255, 255, 255, 0.0) 47%),
    linear-gradient(180deg, #ffffff 0%, #f7fbfd 48%, #ffffff 100%);
  background-attachment: fixed;
}

body.tweets-page-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("/images/tweets-archive/decorations.svg");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: min(1600px, 100vw) auto;
  opacity: 1;
}
body.tweets-page-body > .post_container,
body.tweets-page-body > .site-footer {
  position: relative;
  z-index: 1;
}

/* Keep the archive controls/card stack above the page backdrop. */
.tweets-archive-page {
  position: relative;
}
.tweets-archive-page > * {
  position: relative;
  z-index: 1;
}
.tweets-archive-page::before {
  content: none;
}
.tweets-archive-page::after {
  content: none;
}

/* Intro line (the small subtitle under the frontmatter row) */
.tweets-intro p {
  font-size: 0.85rem;
  opacity: 0.55;
  margin-bottom: 1.25rem;
}

/* ============================================================
   Hero banner — bird + "Twitter Archive" gradient block
   ============================================================ */
.tweets-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 3rem 2rem;
  margin: 1rem 0 1.75rem;
  border-radius: 20px;
  background:
    radial-gradient(circle at 85% 25%, rgba(255, 255, 255, 0.32), transparent 11rem),
    linear-gradient(135deg, #1d9bf0 0%, #2cb6e6 60%, #35c7d8 100%);
  box-shadow: 0 22px 44px rgba(29, 155, 240, 0.22);
  color: #ffffff;
  overflow: hidden;
  isolation: isolate;
}
.tweets-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("/images/tweets-archive/hero-clouds.svg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  opacity: 1;
}
.tweets-hero > * { position: relative; z-index: 1; }
.tweets-hero-bird {
  width: 3rem;
  height: 3rem;
  fill: #ffffff;
  flex-shrink: 0;
}
.tweets-hero-title {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffffff;
}
.tweets-fail-whale {
  position: absolute;
  right: 1rem;
  bottom: 0.65rem;
  width: min(7.8rem, 24vw);
  height: auto;
  opacity: 0.24;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.25));
}
.tweets-fail-whale-body,
.tweets-fail-whale-tail {
  fill: #ffffff;
}
.tweets-fail-whale-belly {
  fill: rgba(255, 255, 255, 0.5);
}
.tweets-fail-whale-eye,
.tweets-fail-whale-bird {
  fill: #1d9bf0;
}

/* ============================================================
   Filter controls
   ============================================================ */
.tweets-controls {
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(29, 155, 240, 0.14);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 8px 24px rgba(7, 50, 71, 0.05);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.tweets-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.tweets-select-wrap {
  display: inline-block;
}
.tweets-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(29, 155, 240, 0.24);
  border-radius: 8px;
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  font-size: 0.9rem;
  color: #0f1a24;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%231d9bf0' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.7rem;
  min-width: 8rem;
}
.tweets-select:focus-visible {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
}
.tweets-btn-clear {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(29, 155, 240, 0.24);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  color: #1d9bf0;
  cursor: pointer;
  font-weight: 600;
}
.tweets-btn-clear:hover {
  background: rgba(29, 155, 240, 0.08);
}
.tweets-btn-clear:focus-visible {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
}

.tweets-search-wrap {
  position: relative;
  margin-bottom: 0.85rem;
}
.tweets-search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  fill: rgba(29, 155, 240, 0.65);
  pointer-events: none;
}
.tweets-search-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(29, 155, 240, 0.22);
  border-radius: 999px;
  padding: 0.75rem 2.75rem 0.75rem 1.2rem;
  font-size: 0.95rem;
  color: #0f1a24;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(7, 50, 71, 0.03);
}
.tweets-search-input:focus-visible {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
  border-color: rgba(29, 155, 240, 0.5);
}

.tweets-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tweets-pill {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(29, 155, 240, 0.24);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: #0f1a24;
  cursor: pointer;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.tweets-pill:hover {
  background: rgba(29, 155, 240, 0.08);
}
.tweets-pill.is-active {
  background: #1d9bf0;
  border-color: #1d9bf0;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(29, 155, 240, 0.28);
}
.tweets-pill:focus-visible {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
}

/* Results count */
.tweets-count {
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 1rem 0 0.5rem;
}
.tweets-count strong {
  font-weight: 700;
  color: #1d9bf0;
}

/* ============================================================
   Tweet cards
   ============================================================ */
.tweets-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.tweet-card {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(29, 155, 240, 0.14);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 28px rgba(7, 50, 71, 0.06);
}
.tweet-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: rgba(15, 26, 36, 0.65);
  margin-bottom: 0.45rem;
}
.tweet-card-type-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: currentColor;
}
.tweet-card-handle {
  font-weight: 600;
  color: #1d9bf0;
  text-decoration: none;
}
.tweet-card-handle:hover {
  text-decoration: underline;
}
.tweet-card-time {
  margin-left: auto;
  font-size: 0.78rem;
  white-space: nowrap;
}
.tweet-card-time a {
  color: inherit;
  text-decoration: none;
}
.tweet-card-time a:hover {
  text-decoration: underline;
}
.tweet-card-body {
  font-size: 0.95rem;
  line-height: 1.45;
  color: #0f1a24;
  word-wrap: break-word;
}
.tweet-card-body a.mention,
.tweet-card-body a.hashtag,
.tweet-card-body a.link {
  color: #1d9bf0;
  text-decoration: none;
}
.tweet-card-body a.mention:hover,
.tweet-card-body a.hashtag:hover,
.tweet-card-body a.link:hover {
  text-decoration: underline;
}
.tweet-card-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.tweet-card-media img,
.tweet-card-media video {
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  background: rgba(29, 155, 240, 0.06);
}
.tweet-card-stats {
  display: flex;
  gap: 1.1rem;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: rgba(15, 26, 36, 0.55);
}
.tweet-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.tweet-card-stat svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  opacity: 0.7;
}
.tweet-card-source {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-top: 0.35rem;
}

/* Empty / no-results state */
.tweets-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: rgba(15, 26, 36, 0.55);
  font-size: 0.95rem;
}

/* Load more */
.tweets-load-more-wrap {
  text-align: center;
  margin-top: 1.5rem;
}
.tweets-load-more {
  background: #1d9bf0;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.6rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(29, 155, 240, 0.28);
}
.tweets-load-more:hover {
  background: #1a8cd8;
}
.tweets-load-more:focus-visible {
  outline: 2px solid #0f1a24;
  outline-offset: 2px;
}

/* Screen-reader only utility */
.tweets-archive-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Mobile (≤900px)
   ============================================================ */
/* Below ~750px the side rail would compete with the content column. Hide it. */
@media (max-width: 750px) {
  body.tweets-page-body {
    background:
      radial-gradient(circle at 20% 8%, rgba(29, 155, 240, 0.09), transparent 16rem),
      #ffffff;
  }
  body.tweets-page-body::before {
    display: none;
  }
}
@media (max-width: 900px) {
  .tweets-hero {
    padding: 2rem 1.25rem;
    gap: 0.75rem;
    border-radius: 16px;
  }
  .tweets-hero-bird {
    width: 2rem;
    height: 2rem;
  }
  .tweets-hero-title {
    font-size: 1.6rem;
  }
  .tweets-controls {
    padding: 1rem;
    border-radius: 14px;
  }
  .tweets-filter-row {
    gap: 0.5rem;
  }
  .tweets-select {
    min-width: 7rem;
    font-size: 0.85rem;
  }
  .tweets-pill {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
  }
}

/* ============================================================
   Dark mode (html.theme-dark / html[data-theme="dark"])
   ============================================================ */
html.theme-dark body.tweets-page-body,
html[data-theme="dark"] body.tweets-page-body {
  background:
    linear-gradient(90deg, rgba(29, 155, 240, 0.18) 0, rgba(29, 155, 240, 0.10) 18rem, rgba(11, 22, 32, 0.0) 45%),
    linear-gradient(270deg, rgba(29, 155, 240, 0.14) 0, rgba(29, 155, 240, 0.08) 18rem, rgba(11, 22, 32, 0.0) 45%),
    #0b1620;
  background-attachment: fixed;
}
html.theme-dark .tweets-controls,
html[data-theme="dark"] .tweets-controls {
  background: rgba(20, 32, 44, 0.85);
  border-color: rgba(29, 155, 240, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
html.theme-dark body.tweets-page-body::before,
html[data-theme="dark"] body.tweets-page-body::before {
  opacity: 0.35;
}
html.theme-dark .tweets-select,
html[data-theme="dark"] .tweets-select,
html.theme-dark .tweets-btn-clear,
html[data-theme="dark"] .tweets-btn-clear,
html.theme-dark .tweets-search-input,
html[data-theme="dark"] .tweets-search-input,
html.theme-dark .tweets-pill,
html[data-theme="dark"] .tweets-pill {
  background: rgba(20, 32, 44, 0.84);
  border-color: rgba(29, 155, 240, 0.28);
  color: #e6eef5;
}
html.theme-dark .tweets-pill.is-active,
html[data-theme="dark"] .tweets-pill.is-active {
  background: #1d9bf0;
  border-color: #1d9bf0;
  color: #ffffff;
}
html.theme-dark .tweet-card,
html[data-theme="dark"] .tweet-card {
  background: rgba(20, 32, 44, 0.84);
  border-color: rgba(29, 155, 240, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
html.theme-dark .tweet-card-body,
html[data-theme="dark"] .tweet-card-body {
  color: #e6eef5;
}
html.theme-dark .tweet-card-header,
html[data-theme="dark"] .tweet-card-header,
html.theme-dark .tweet-card-stats,
html[data-theme="dark"] .tweet-card-stats,
html.theme-dark .tweets-empty,
html[data-theme="dark"] .tweets-empty {
  color: rgba(230, 238, 245, 0.7);
}
