/* ── Reset & Base ──────────────────────────────────────────── */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1a1a25;
  --bg-elevated: #1e1e2a;
  --bg-input: #1a1a24;

  --border-subtle: #222233;
  --border-default: #2a2a3d;
  --border-hover: #3a3a55;

  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-tertiary: #686880;
  --text-muted: #505068;

  --accent-blue: #5b8def;
  --accent-blue-dim: rgba(91, 141, 239, 0.12);
  --accent-purple: #a78bfa;
  --accent-purple-dim: rgba(167, 139, 250, 0.12);
  --accent-green: #34d399;
  --accent-green-dim: rgba(52, 211, 153, 0.12);
  --accent-orange: #fb923c;
  --accent-orange-dim: rgba(251, 146, 60, 0.12);
  --accent-rose: #f472b6;
  --accent-rose-dim: rgba(244, 114, 182, 0.12);

  --type-article: var(--accent-blue);
  --type-article-dim: var(--accent-blue-dim);
  --type-video: var(--accent-rose);
  --type-video-dim: var(--accent-rose-dim);
  --type-podcast: var(--accent-purple);
  --type-podcast-dim: var(--accent-purple-dim);
  --type-other: var(--accent-orange);
  --type-other-dim: var(--accent-orange-dim);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3), 0 0 0 1px var(--border-subtle);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 26px;
  height: 26px;
  color: var(--accent-blue);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

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

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:hover {
  border-color: var(--border-hover);
}

.search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-dim);
  background: var(--bg-secondary);
}

.search-input:focus ~ .search-icon {
  color: var(--accent-blue);
}

.search-input:focus ~ .search-kbd {
  opacity: 0;
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

/* ── Filters ──────────────────────────────────────────────── */

.filters {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.filters-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.filter-btn.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

.filter-btn[data-type="article"].active {
  color: var(--type-article);
  background: var(--type-article-dim);
  border-color: transparent;
}

.filter-btn[data-type="video"].active {
  color: var(--type-video);
  background: var(--type-video-dim);
  border-color: transparent;
}

.filter-btn[data-type="podcast"].active {
  color: var(--type-podcast);
  background: var(--type-podcast-dim);
  border-color: transparent;
}

.filter-btn[data-type="other"].active {
  color: var(--type-other);
  background: var(--type-other-dim);
  border-color: transparent;
}

.entry-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Main / Feed ──────────────────────────────────────────── */

.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Empty state ──────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* ── Card ─────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: all var(--transition-base);
  animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 60ms; }
.card:nth-child(3) { animation-delay: 120ms; }
.card:nth-child(4) { animation-delay: 180ms; }
.card:nth-child(5) { animation-delay: 240ms; }
.card:nth-child(6) { animation-delay: 300ms; }

/* Card header */

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

.card-type-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.card-type-icon svg {
  width: 18px;
  height: 18px;
}

.card-type-icon.type-article {
  background: var(--type-article-dim);
  color: var(--type-article);
}

.card-type-icon.type-video {
  background: var(--type-video-dim);
  color: var(--type-video);
}

.card-type-icon.type-podcast {
  background: var(--type-podcast-dim);
  color: var(--type-podcast);
}

.card-type-icon.type-other {
  background: var(--type-other-dim);
  color: var(--type-other);
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.card-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.card-title a:hover {
  color: var(--accent-blue);
}

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

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 100px;
}

.card-badge.type-article {
  color: var(--type-article);
  background: var(--type-article-dim);
}

.card-badge.type-video {
  color: var(--type-video);
  background: var(--type-video-dim);
}

.card-badge.type-podcast {
  color: var(--type-podcast);
  background: var(--type-podcast-dim);
}

.card-badge.type-other {
  color: var(--type-other);
  background: var(--type-other-dim);
}

.card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-url {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  transition: color var(--transition-fast);
}

.card-url:hover {
  color: var(--text-secondary);
}

/* Tags */

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-radius: 100px;
  transition: all var(--transition-fast);
}

.tag:hover {
  color: var(--text-primary);
  background: var(--border-default);
}

/* TL;DR */

.card-tldr {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-left: 14px;
  border-left: 2px solid var(--border-default);
}

/* Expandable sections */

.expandable {
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
}

.expandable + .expandable {
  border-top: none;
}

.expand-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.expand-trigger:hover {
  color: var(--text-primary);
}

.expand-trigger .chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.expandable.open .expand-trigger .chevron {
  transform: rotate(180deg);
}

.expand-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--transition-slow);
}

.expandable.open .expand-content {
  grid-template-rows: 1fr;
}

.expand-inner {
  overflow: hidden;
}

/* Key points list */

.key-points {
  list-style: none;
  padding: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-points li {
  position: relative;
  padding-left: 20px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.key-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-blue);
  opacity: 0.6;
}

/* Full summary */

.full-summary {
  padding-bottom: 16px;
}

.full-summary p {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.full-summary p:last-child {
  margin-bottom: 0;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }

  .brand {
    align-self: flex-start;
  }

  .search-wrapper {
    max-width: 100%;
  }

  .filters-inner {
    padding: 10px 16px;
  }

  .main {
    padding: 16px 16px 60px;
  }

  .card {
    padding: 18px;
    border-radius: var(--radius-lg);
  }

  .card-header {
    gap: 10px;
  }

  .card-type-icon {
    width: 34px;
    height: 34px;
  }

  .card-title {
    font-size: 0.95rem;
  }

  .card-meta {
    gap: 8px;
  }

  .card-url {
    max-width: 140px;
  }
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
}

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

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

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

/* ── Selection ────────────────────────────────────────────── */

::selection {
  background: var(--accent-blue-dim);
  color: var(--text-primary);
}

/* ── Focus visible ────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ── Search highlight ─────────────────────────────────────── */

mark {
  background: rgba(91, 141, 239, 0.25);
  color: var(--text-primary);
  border-radius: 2px;
  padding: 0 1px;
}
