@font-face {
  font-family: "Geist Sans";
  src: url("https://cdn.jsdelivr.net/npm/geist@1.7.0/dist/fonts/geist-sans/Geist-Variable.woff2")
    format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("https://cdn.jsdelivr.net/npm/geist@1.7.0/dist/fonts/geist-mono/GeistMono-Variable.woff2")
    format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Theme tokens (space-separated RGB for tailwind <alpha-value>) ──────── */
:root {
  --appBg: 9 9 11;
  --surface: 24 24 27;
  --surfaceHover: 39 39 42;
  --borderSubtle: 39 39 42;
  --borderHover: 63 63 70;
  --textMain: 228 228 231;
  --textMuted: 161 161 170;
  --scrollbarThumb: 63 63 70;
  --scrollbarThumbHover: 82 82 91;
  --proseBody: 161 161 170;
  --proseStrong: 228 228 231;
  --bgGlowViolet: rgba(139, 92, 246, 0.08);
  --bgGlowCyan: rgba(34, 211, 238, 0.05);
  --shimmer: rgba(228, 228, 231, 0.07);
  --skeletonBg: rgba(39, 39, 42, 0.9);
  --tooltipBg: #18181b;
  --tooltipBorder: #3f3f46;
  --dropdownBg: #18181b;
  --dropdownBorder: #27272a;
  --dropdownItemHoverBg: #27272a;
  /* README (Shadow DOM) tokens */
  --readmeBg: #0c0c0e;
  --readmeText: #d4d4d8;
  --readmeHeading: #ffffff;
  --readmeCodeBg: #27272a;
  --readmeCodeColor: #fbbf24;
  --readmePreBg: #18181b;
  --readmePreBorder: #27272a;
  --readmeLink: #60a5fa;
  --readmeLinkHover: #93c5fd;
  --readmeBlockquoteBg: #18181b;
  --readmeBlockquoteBorder: #3f3f46;
  --readmeBlockquoteText: #a1a1aa;
  --readmeTableBorder: #27272a;
  --readmeTableHeaderBg: #27272a;
  --readmeMuted: #71717a;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --appBg: 255 255 255;
  --surface: 250 250 250;
  --surfaceHover: 244 244 245;
  --borderSubtle: 228 228 231;
  --borderHover: 212 212 216;
  --textMain: 24 24 27;
  --textMuted: 82 82 91;
  --scrollbarThumb: 212 212 216;
  --scrollbarThumbHover: 161 161 170;
  --proseBody: 82 82 91;
  --proseStrong: 24 24 27;
  --bgGlowViolet: rgba(139, 92, 246, 0.1);
  --bgGlowCyan: rgba(34, 211, 238, 0.08);
  --shimmer: rgba(0, 0, 0, 0.05);
  --skeletonBg: rgba(244, 244, 245, 0.9);
  --tooltipBg: #ffffff;
  --tooltipBorder: #d4d4d8;
  --dropdownBg: #ffffff;
  --dropdownBorder: #e4e4e7;
  --dropdownItemHoverBg: #f4f4f5;
  /* README (Shadow DOM) tokens — light */
  --readmeBg: #ffffff;
  --readmeText: #3f3f46;
  --readmeHeading: #18181b;
  --readmeCodeBg: #f4f4f5;
  --readmeCodeColor: #b45309;
  --readmePreBg: #f4f4f5;
  --readmePreBorder: #e4e4e7;
  --readmeLink: #7c3aed;
  --readmeLinkHover: #5b21b6;
  --readmeBlockquoteBg: #fafafa;
  --readmeBlockquoteBorder: #a78bfa;
  --readmeBlockquoteText: #52525b;
  --readmeTableBorder: #e4e4e7;
  --readmeTableHeaderBg: #f4f4f5;
  --readmeMuted: #71717a;
  color-scheme: light;
}

body {
  background-color: rgb(var(--appBg));
  background-image:
    radial-gradient(
      ellipse 900px 500px at 85% -10%,
      var(--bgGlowViolet),
      transparent 60%
    ),
    radial-gradient(
      ellipse 700px 400px at 10% 110%,
      var(--bgGlowCyan),
      transparent 55%
    );
  overflow: hidden;
}
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgb(var(--scrollbarThumb));
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--scrollbarThumbHover));
}

/* ── Prose (summary content) ─────────────────────────────────────────────── */
.prose {
  color: rgb(var(--proseBody));
  font-family: "Geist Sans", sans-serif;
  line-height: 1.75;
  font-size: 0.9375rem;
}
.prose strong {
  color: rgb(var(--proseStrong));
  font-weight: 500;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: rgb(var(--proseStrong));
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 0;
  margin-bottom: 0.5em;
}
.prose p {
  margin-bottom: 1.25em;
}
.prose ul > li::marker {
  color: #71717a;
}
.prose ul > li {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}
.prose img,
.prose video {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  border: 1px solid rgb(var(--borderSubtle));
}
.prose iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.5rem;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  border: 1px solid rgb(var(--borderSubtle));
  background: rgb(var(--appBg));
}

/* ── Repo cards (list row) ──────────────────────────────────────────────── */
.repo-card {
  position: relative;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}
.repo-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -12px rgba(139, 92, 246, 0.35);
}
.repo-card:active {
  transform: translateY(0);
  transition-duration: 0.05s;
}
.repo-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #8b5cf6, #22d3ee);
  opacity: 0;
  transition: opacity 0.15s ease;
  border-top-left-radius: inherit;
  border-bottom-left-radius: inherit;
}
.repo-card:hover::before {
  opacity: 0.4;
}
.repo-card.is-read {
  opacity: 0.72;
  background-color: rgb(var(--surface) / 0.85);
}
.repo-card.is-read:hover {
  opacity: 1;
}
.is-active {
  background-color: rgb(var(--surfaceHover)) !important;
  border-color: rgba(139, 92, 246, 0.35) !important;
  opacity: 1 !important;
}
.is-active::before {
  opacity: 1 !important;
}
body.hide-read-active .repo-card.is-read {
  display: none !important;
}
body.fav-only-active .repo-card:not(.is-fav) {
  display: none !important;
}

/* Compact filter buttons (feed header toolbar) */
.filter-btn-active {
  background-color: rgba(139, 92, 246, 0.12) !important;
  border-color: rgba(139, 92, 246, 0.45) !important;
  color: rgb(var(--textMain)) !important;
}
.filter-btn-fav-active {
  background-color: rgba(251, 191, 36, 0.12) !important;
  border-color: rgba(251, 191, 36, 0.45) !important;
  color: #f59e0b !important;
}

/* Favorite star button */
.fav-btn {
  color: rgb(var(--textMuted) / 0.6);
  transition: color 0.15s ease, transform 0.15s ease;
}
.fav-btn:hover {
  color: #fbbf24;
  transform: scale(1.15);
}
.fav-btn.is-popping {
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.repo-card.is-fav .fav-btn {
  color: #fbbf24;
}

/* Filter buttons tactile press + water-flow activation */
.filter-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease;
}
.filter-btn > * {
  position: relative;
  z-index: 1;
}
.filter-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(139, 92, 246, 0.45) 30%,
    rgba(34, 211, 238, 0.45) 60%,
    transparent 100%
  );
  transform: translateX(-110%);
  pointer-events: none;
  z-index: 0;
}
.filter-btn.is-flowing::after {
  animation: water-flow 0.7s cubic-bezier(0.45, 0, 0.25, 1) forwards;
}
.filter-btn-fav-active.is-flowing::after {
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(251, 191, 36, 0.45) 30%,
    rgba(244, 114, 182, 0.4) 60%,
    transparent 100%
  );
}
@keyframes water-flow {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(110%); }
}
.filter-btn:active:not(:disabled) {
  transform: scale(0.94);
}

/* Status pill text crossfade */
.status-fade {
  transition: opacity 0.15s ease;
}
.status-fade.is-fading {
  opacity: 0;
}

/* Right-pane view swap */
.pane-enter {
  animation: paneIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes paneIn {
  0% { opacity: 0; transform: translateX(8px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* Wordcloud canvas fade */
#wordcloudCanvas {
  transition: opacity 0.4s ease;
}
#wordcloudCanvas.is-appearing {
  opacity: 0;
}

/* ── Feed kind buttons ───────────────────────────────────────────────────── */
.feed-kind-btn {
  color: rgb(var(--textMuted) / 0.8);
  position: relative;
}
.feed-kind-btn:hover {
  color: rgb(var(--textMain));
}
.feed-kind-btn.feed-kind-active {
  background-color: rgb(var(--surfaceHover));
  color: rgb(var(--textMain));
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(139, 92, 246, 0.25);
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* ── Custom dropdown ─────────────────────────────────────────────────────── */
.ui-dropdown-trigger[aria-expanded="true"] [data-dropdown-caret] {
  transform: rotate(180deg);
}
[data-dropdown-caret] {
  transition: transform 0.15s ease;
}
.ui-dropdown-menu {
  background: var(--dropdownBg);
  border: 1px solid var(--dropdownBorder);
  border-radius: 0.5rem;
  padding: 0.25rem;
  box-shadow:
    0 8px 24px -12px rgba(0, 0, 0, 0.6),
    0 2px 6px -2px rgba(0, 0, 0, 0.4);
  list-style: none;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  animation: ui-dropdown-in 0.12s ease-out;
}
@keyframes ui-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ui-dropdown-menu [data-dropdown-item] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.625rem;
  font-size: 0.8125rem;
  color: rgb(var(--textMuted));
  border-radius: 0.375rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.1s ease, color 0.1s ease;
}
.ui-dropdown-menu [data-dropdown-item]:hover {
  background: var(--dropdownItemHoverBg);
  color: rgb(var(--textMain));
}
.ui-dropdown-menu [data-dropdown-item].is-selected {
  color: rgb(var(--textMain));
}
.ui-dropdown-menu [data-dropdown-item].is-selected::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b5cf6, #22d3ee);
  margin-left: 0.75rem;
  flex-shrink: 0;
}

/* ── Activity graph ──────────────────────────────────────────────────────── */
.activity-grid {
  display: grid;
  grid-template-rows: repeat(7, 9px);
  grid-auto-flow: column;
  gap: 3px;
}
.activity-grid > div {
  border-radius: 2px;
  transition: transform 0.1s ease, outline 0.1s ease;
}
.activity-grid > div:hover {
  outline: 1px solid rgb(var(--textMain) / 0.5);
  outline-offset: 1px;
}

.activity-days {
  display: grid;
  grid-template-rows: repeat(7, 9px);
  gap: 3px;
  font-size: 9px;
  font-family: "Geist Mono", ui-monospace, monospace;
  color: rgb(var(--textMuted) / 0.7);
  width: 22px;
  align-items: center;
  line-height: 9px;
}
.activity-days > span {
  display: block;
  text-align: right;
  padding-right: 4px;
}

.activity-months {
  height: 12px;
  margin-left: 28px; /* day col 22px + flex gap 6px */
  font-size: 9px;
  font-family: "Geist Mono", ui-monospace, monospace;
  color: rgb(var(--textMuted) / 0.8);
  position: relative;
}
.activity-months > span {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.activity-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--tooltipBg);
  border: 1px solid var(--tooltipBorder);
  color: rgb(var(--textMain));
  font-size: 10px;
  font-family: "Geist Mono", ui-monospace, monospace;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.5);
}
.activity-tooltip[hidden] {
  display: none;
}

/* ── Settings dialog ─────────────────────────────────────────────────────── */
dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  animation: dialog-backdrop-in 0.22s ease-out;
}
dialog[open] {
  animation: dialog-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dialog-in {
  0% { opacity: 0; transform: scale(0.94) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes dialog-backdrop-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ── Chat panel slide-in ─────────────────────────────────────────────────── */
.chat-pane-anim {
  animation: chat-slide-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes chat-slide-in {
  0% { opacity: 0; transform: translateX(40px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
@keyframes ui-shimmer {
  100% {
    transform: translateX(100%);
  }
}
.ui-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeletonBg);
  border-radius: 0.375rem;
}
.ui-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    var(--shimmer),
    transparent
  );
  animation: ui-shimmer 1.15s ease-in-out infinite;
}

/* ── Reader layout ───────────────────────────────────────────────────────── */
/* Avoid horizontal jump when vertical scrollbar appears/disappears */
#readerContent {
  scrollbar-gutter: stable;
}

.reader-title-source-link {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.4rem;
  font-size: 0.6875rem;
  font-family: "Geist Mono", ui-monospace, monospace;
  color: rgb(var(--textMuted) / 0.6);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.reader-title-source-link:hover {
  color: rgb(var(--textMuted));
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── README source panel ─────────────────────────────────────────────────── */
.reader-source-panel {
  border: 1px solid rgb(var(--borderSubtle));
  border-radius: 0.75rem;
  background: rgb(var(--appBg));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: min(86vh, 960px);
}
.reader-source-iframe-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: min(82vh, 900px);
  background: rgb(var(--appBg));
}
.reader-source-iframe-wrap.hidden {
  display: none;
}

/* ── Chat chips ──────────────────────────────────────────────────────────── */
.chat-chip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}
.chat-chip .chip-label {
  text-align: left;
}
.chat-chip:not(:disabled):hover {
  border-color: rgba(139, 92, 246, 0.55);
  color: rgb(var(--textMain));
}
.chat-chip:disabled {
  cursor: not-allowed;
}
.chat-chip.is-answered {
  border-color: rgba(34, 197, 94, 0.3);
  color: rgba(74, 222, 128, 0.7);
  opacity: 1;
}
