/* =============================================================
   PULSE — Night Desk (Default Theme)
   Warm dark editorial. Serif headlines on charcoal, amber accent,
   cozy late-night reading. Like catching up with a reading lamp on.
   ============================================================= */

/* ===== Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg: #1C1917;
  --bg-raised: #231F1D;
  --bg-card: #2A2522;
  --bg-card-hover: #322C28;
  --border: #3A332E;
  --border-subtle: #2E2925;
  --text: #C8BFB5;
  --text-strong: #E8E0D8;
  --text-muted: #7A7068;
  --text-faint: #504840;
  --accent: #D4915A;
  --accent-dim: rgba(212, 145, 90, 0.1);

  /* Category colors */
  --cat-release: #6A9AD5;
  --cat-breaking: #E06060;
  --cat-tip: #6AAA75;
  --cat-tutorial: #D4A050;
  --cat-discussion: #7A7068;
  --cat-opinion: #A88BC0;

  /* Source colors */
  --src-reddit: #E08050;
  --src-twitter: #6AA0D5;
  --src-youtube: #E06060;
  --src-hackernews: #DDA040;
  --src-tiktok: #50BFBB;
  --src-github: #6AAA75;
  --src-blog: #D4A050;

  --font-headline: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  --feed-max: 720px;
  --radius: 6px;
  --radius-sm: 4px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  background: rgba(28, 25, 23, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.header-title {
  font-family: var(--font-headline);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.header-tagline {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-updated {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
}

.refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ===== Layout ===== */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ===== Sidebar ===== */
.sidebar {
  width: 180px;
  min-width: 180px;
  padding: 28px 20px;
  background: var(--bg);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 32px;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.sidebar-heading {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
}

/* ===== Filter Buttons ===== */
.filter-buttons {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.84rem;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-weight: 400;
}

.filter-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.filter-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 500;
}

/* ===== Sort Select ===== */
.sort-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23504840' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.sort-select:focus {
  border-color: var(--accent);
}

/* ===== Source Status ===== */
.source-status-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.source-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 3px 0;
  cursor: pointer;
  transition: color 0.15s;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--cat-tip);
}

.source-name {
  flex: 1;
}

.source-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
}

/* Source drill-down */
.source-status-row:hover .source-name {
  color: var(--text);
}

.source-status-row.expanded .source-name {
  color: var(--accent);
}

.source-detail-list {
  display: none;
  flex-direction: column;
  padding-left: 13px;
  margin-bottom: 4px;
}

.source-detail-list.expanded {
  display: flex;
}

.source-detail-item {
  font-size: 0.68rem;
  color: var(--text-faint);
  padding: 2px 0;
  display: flex;
  flex-direction: column;
}

.source-detail-label {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.source-detail-link {
  font-family: var(--font-mono);
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

.source-detail-link:hover {
  color: #E8A870;
  text-decoration: underline;
}

.source-detail-extra {
  font-size: 0.62rem;
  color: var(--text-faint);
}

/* ===== Feed ===== */
.feed {
  flex: 1;
  padding: 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-width: calc(var(--feed-max) + 80px);
}

.empty-message,
.error-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 48px 0;
  text-align: center;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: 2px solid var(--text-faint);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  border-top-color: inherit;
}

/* Category top-border colors */
.card[data-category="release"] { border-top-color: var(--cat-release); }
.card[data-category="breaking"] { border-top-color: var(--cat-breaking); }
.card[data-category="tip"] { border-top-color: var(--cat-tip); }
.card[data-category="tutorial"] { border-top-color: var(--cat-tutorial); }
.card[data-category="discussion"] { border-top-color: var(--cat-discussion); }
.card[data-category="opinion"] { border-top-color: var(--cat-opinion); }

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-category {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.6;
}

/* Category badge colors */
.card-category.release {
  background: rgba(106, 154, 213, 0.12);
  color: var(--cat-release);
}
.card-category.breaking {
  background: rgba(224, 96, 96, 0.12);
  color: var(--cat-breaking);
}
.card-category.tip {
  background: rgba(106, 170, 117, 0.12);
  color: var(--cat-tip);
}
.card-category.tutorial {
  background: rgba(212, 160, 80, 0.12);
  color: var(--cat-tutorial);
}
.card-category.discussion {
  background: rgba(122, 112, 104, 0.12);
  color: var(--cat-discussion);
}
.card-category.opinion {
  background: rgba(168, 139, 192, 0.12);
  color: var(--cat-opinion);
}

.card-time {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
}

.card-score {
  font-size: 0.68rem;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: 2px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-faint);
  transition: color 0.15s;
}

.card:hover .card-score {
  color: var(--text-muted);
}

.card-score.hot {
  background: rgba(224, 96, 96, 0.1);
  color: var(--cat-breaking);
}

.card-score.rising {
  background: rgba(212, 160, 80, 0.1);
  color: var(--cat-tutorial);
}

.card-updated-badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(106, 170, 117, 0.15);
  color: var(--cat-tip);
  margin-left: 4px;
}

.card-headline {
  font-family: var(--font-headline);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 10px;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.card:hover .card-headline {
  color: var(--accent);
}

/* Bullets — clean editorial list with thin left accent */
.card-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card-bullets li {
  font-size: 0.86rem;
  color: var(--text);
  padding: 8px 0 8px 14px;
  position: relative;
  line-height: 1.6;
  opacity: 1;
  background: transparent;
  border-left: 2px solid var(--border);
  border-radius: 0;
  transition: border-color 0.15s;
}

.card-bullets li + li {
  border-top: 1px solid var(--border-subtle);
}

.card:hover .card-bullets li {
  border-left-color: var(--border);
}

/* Bullet left-border tints on hover */
.card[data-category="release"]:hover .card-bullets li  { border-left-color: rgba(106, 154, 213, 0.35); }
.card[data-category="breaking"]:hover .card-bullets li { border-left-color: rgba(224, 96, 96, 0.35); }
.card[data-category="tip"]:hover .card-bullets li      { border-left-color: rgba(106, 170, 117, 0.35); }
.card[data-category="tutorial"]:hover .card-bullets li { border-left-color: rgba(212, 160, 80, 0.35); }
.card[data-category="discussion"]:hover .card-bullets li { border-left-color: rgba(122, 112, 104, 0.25); }
.card[data-category="opinion"]:hover .card-bullets li  { border-left-color: rgba(168, 139, 192, 0.35); }

.card-bullets li::before {
  display: none;
}

.card-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.source-pill {
  font-size: 0.68rem;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  text-transform: lowercase;
}

/* Source pill colors */
.source-pill.reddit {
  color: var(--src-reddit);
  border-color: rgba(224, 128, 80, 0.18);
  background: rgba(224, 128, 80, 0.06);
}

.source-pill.twitter {
  color: var(--src-twitter);
  border-color: rgba(106, 160, 213, 0.18);
  background: rgba(106, 160, 213, 0.06);
}

.source-pill.youtube {
  color: var(--src-youtube);
  border-color: rgba(224, 96, 96, 0.18);
  background: rgba(224, 96, 96, 0.06);
}

.source-pill.hackernews {
  color: var(--src-hackernews);
  border-color: rgba(221, 160, 64, 0.18);
  background: rgba(221, 160, 64, 0.06);
}

.source-pill.tiktok {
  color: var(--src-tiktok);
  border-color: rgba(80, 191, 187, 0.18);
  background: rgba(80, 191, 187, 0.06);
}

.source-pill.github-releases,
.source-pill.github-changelog {
  color: var(--src-github);
  border-color: rgba(106, 170, 117, 0.18);
  background: rgba(106, 170, 117, 0.06);
}

.source-pill.anthropic-blog {
  color: var(--src-blog);
  border-color: rgba(212, 160, 80, 0.18);
  background: rgba(212, 160, 80, 0.06);
}

/* ===== Hide theme-specific card elements ===== */
.card-avatar          { display: none; }
.card-summary-prose   { display: none; }
.card-score-bar       { display: none; }
.card-engagement      { display: none; }

/* ===== Detail Panel ===== */
.detail-panel {
  display: none;
  width: 420px;
  min-width: 420px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  padding: 32px 28px;
  overflow-y: auto;
  flex-direction: column;
}

.detail-panel.open {
  display: flex;
}

.detail-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.1rem;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 10;
}

.detail-close:hover {
  color: var(--text-strong);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.detail-content {
  margin-top: 8px;
}

.detail-content h2,
.detail-headline {
  font-family: var(--font-headline);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 14px;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.detail-content .detail-category {
  margin-bottom: 16px;
}

.detail-content .detail-summary {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 20px;
  opacity: 0.85;
}

.detail-content .detail-sources-title {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 24px 0 10px;
}

.detail-content .detail-sources {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-content .detail-source-link {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.detail-content .detail-source-link:hover {
  color: #E8A870;
  text-decoration: underline;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeInUp 0.25s ease both;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.03s; }
.card:nth-child(3) { animation-delay: 0.05s; }
.card:nth-child(4) { animation-delay: 0.07s; }
.card:nth-child(5) { animation-delay: 0.09s; }
.card:nth-child(6) { animation-delay: 0.11s; }
.card:nth-child(7) { animation-delay: 0.13s; }
.card:nth-child(8) { animation-delay: 0.15s; }
.card:nth-child(n+9) { animation-delay: 0.17s; }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  .header {
    padding: 0 16px;
    height: 48px;
  }

  .header-tagline {
    display: none;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    gap: 16px;
    align-items: flex-start;
    position: static;
    height: auto;
  }

  .sidebar-section {
    flex-shrink: 0;
  }

  .filter-buttons {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .filter-btn {
    white-space: nowrap;
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .source-status {
    display: none;
  }

  .feed {
    padding: 16px;
    max-width: 100%;
  }

  .detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: unset;
    height: 100%;
    z-index: 200;
    border-left: none;
  }
}

/* Read status badges */
.card-new { border-left: 3px solid var(--accent, #4a9fe5); }
.card-updated { border-left: 3px solid var(--accent-secondary, #f0860e); }

.card-read-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
}
.card-badge-new {
  background: var(--accent, #4a9fe5);
  color: #fff;
}
.card-badge-updated {
  background: var(--accent-secondary, #f0860e);
  color: #fff;
}
