:root {
  --res-bg: #0f172a;
  --res-muted: #64748b;
  --res-chip: #e2e8f0;
  --res-chip-active: #0b6efd;
  --res-card-radius: 18px;
}

.res-hero {
  padding: clamp(3rem, 6vw, 5rem) 0;
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.08) 0%, rgba(13, 110, 253, 0) 70%);
}

.res-title {
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.res-sub {
  max-width: 720px;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--res-muted);
  margin: 0 0 clamp(1.5rem, 4vw, 2.5rem);
}

.res-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.res-search {
  flex: 1 1 320px;
  min-width: 240px;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  background: #fff;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--res-bg);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.res-search:focus {
  outline: 3px solid rgba(13, 110, 253, 0.25);
  outline-offset: 2px;
}

.res-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.res-chip {
  border: 1px solid var(--res-chip);
  background: #fff;
  color: var(--res-bg);
  padding: 0.55rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.res-chip:hover {
  border-color: rgba(13, 110, 253, 0.4);
}

.res-chip.is-active {
  background: var(--res-chip-active);
  border-color: var(--res-chip-active);
  color: #fff;
}

.res-featured {
  padding: 0 0 clamp(2.5rem, 6vw, 4rem);
}

.res-featured.is-hidden {
  display: none;
}

.res-featured.is-collapsed {
  display: none;
}

.res-featured-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 1.25rem;
  font-weight: 700;
}

.res-carousel-wrapper {
  position: relative;
  overflow: hidden;
}

.res-carousel {
  display: flex;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 110, 253, 0.3) rgba(148, 163, 184, 0.1);
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.res-carousel::-webkit-scrollbar {
  height: 8px;
}

.res-carousel::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.1);
  border-radius: 4px;
}

.res-carousel::-webkit-scrollbar-thumb {
  background: rgba(13, 110, 253, 0.3);
  border-radius: 4px;
}

.res-carousel::-webkit-scrollbar-thumb:hover {
  background: rgba(13, 110, 253, 0.5);
}

.res-featured .res-card {
  flex: 0 0 auto;
  width: min(90vw, 800px);
  display: grid;
  grid-template-columns: minmax(240px, 380px) 1fr;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
  border: none;
  scroll-snap-align: start;
}

.res-grid-wrap {
  padding: 0 0 clamp(4rem, 8vw, 5.5rem);
}

.res-grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.res-card {
  background: #fff;
  border-radius: var(--res-card-radius);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.18);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.res-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.res-thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e2e8f0;
}

.res-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.res-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.res-badge-external {
  background: rgba(13, 110, 253, 0.95);
}

.res-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: clamp(1.25rem, 2.2vw, 1.75rem);
  flex: 1 1 auto;
}

.res-tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.12);
  color: #0b6efd;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.res-card-title {
  font-size: 1.2rem;
  margin: 0;
  line-height: 1.35;
}

.res-card-title a {
  color: inherit;
  text-decoration: none;
}

.res-card-title a:hover {
  text-decoration: underline;
}

.res-excerpt {
  margin: 0;
  color: var(--res-muted);
}

.res-source {
  margin: -0.15rem 0 0;
  font-size: 0.85rem;
  color: #475569;
}

.res-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--res-muted);
}

.res-link {
  margin-top: auto;
  font-weight: 700;
  color: #0b6efd;
  text-decoration: none;
}

.res-link:hover {
  text-decoration: underline;
}

.res-load {
  display: flex;
  justify-content: center;
  margin-top: clamp(2rem, 5vw, 3rem);
}

.res-load .btn {
  padding: 0.85rem 2.5rem;
  font-size: 1rem;
  border-radius: 999px;
}

.res-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  background: #fff;
  border-radius: var(--res-card-radius);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--res-muted);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

/* Floating State Insights Button */
.floating-state-btn {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #0b6efd;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(11, 110, 253, 0.4);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  z-index: 1000;
}

.floating-state-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(11, 110, 253, 0.5);
  background: #0958d9;
}

.floating-state-btn svg {
  flex-shrink: 0;
}

.floating-btn-text {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .floating-state-btn {
    right: 1rem;
    bottom: 1rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
  }

  .floating-btn-text {
    display: none;
  }

  .floating-state-btn {
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 960px) {
  .res-featured .res-card {
    grid-template-columns: 1fr;
    width: min(85vw, 600px);
  }
}

@media (max-width: 680px) {
  .res-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .res-search {
    width: 100%;
  }

  .res-filters {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .res-card,
  .res-chip {
    transition: none;
  }
}

/* ========================================
   Series Container Components (Phase 3)
   Scalable for multiple series (up to 12+)
   ======================================== */

.res-series {
  padding: 0 0 clamp(2rem, 4vw, 3rem);
}

.res-series.is-hidden {
  display: none;
}

.res-series-container {
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.04) 0%, rgba(13, 110, 253, 0) 70%);
  border: 1px solid rgba(13, 110, 253, 0.12);
  border-radius: calc(var(--res-card-radius) + 6px);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
}

.res-series-container:last-child {
  margin-bottom: 0;
}

.res-series-header {
  margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
}

.res-series-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: rgba(13, 110, 253, 0.1);
  color: #0b6efd;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.res-series-title {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #0f172a;
}

.res-series-description {
  margin: 0;
  color: var(--res-muted);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 600px;
}


/* Main article card - larger and more prominent */
.res-series-main {
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.res-series-main .res-card {
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
  border: 2px solid rgba(13, 110, 253, 0.2);
  box-shadow: 0 8px 24px rgba(13, 110, 253, 0.08);
}

.res-series-main .res-card:hover {
  border-color: rgba(13, 110, 253, 0.4);
  box-shadow: 0 12px 32px rgba(13, 110, 253, 0.12);
}

.res-series-main .res-thumb {
  border-radius: calc(var(--res-card-radius) - 4px);
  aspect-ratio: 16 / 10;
}

.res-series-main .res-body {
  padding: clamp(1rem, 2vw, 1.5rem);
  padding-left: 0;
}

.res-series-main .res-card-title {
  font-size: clamp(1.15rem, 2vw, 1.35rem);
}

/* Main article badge */
.res-main-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, #0b6efd 0%, #0958d9 100%);
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* Sub-articles grid - 4 cards in a row */
.res-series-sub-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.75rem, 1.5vw, 1rem);
}

/* Sub-card content (no images - compact text cards) */
.res-series-sub-card {
  background: #fff;
  border-radius: var(--res-card-radius);
  padding: clamp(1rem, 2vw, 1.25rem);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.res-series-sub-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  border-color: rgba(13, 110, 253, 0.3);
}

/* Part badge on sub-cards */
.res-part-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.25rem 0.6rem;
  background: rgba(13, 110, 253, 0.1);
  color: #0b6efd;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.res-series-sub-body {
  padding: clamp(0.75rem, 1.5vw, 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.res-series-sub-title {
  font-size: clamp(0.85rem, 1.2vw, 0.95rem);
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: #0f172a;
}

.res-series-sub-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--res-muted);
}

.res-series-sub-arrow {
  color: #0b6efd;
  font-weight: 700;
  transition: transform 0.2s ease;
}

.res-series-sub-card:hover .res-series-sub-arrow {
  transform: translateX(3px);
}

/* Section divider between series and regular articles */
.res-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: clamp(2rem, 4vw, 3rem) 0;
  color: var(--res-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.res-divider::before,
.res-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.3);
}

/* Responsive: Tablet */
@media (max-width: 960px) {
  .res-series-main .res-card {
    grid-template-columns: 1fr;
  }

  .res-series-main .res-body {
    padding: clamp(1rem, 2vw, 1.5rem);
  }

  .res-series-sub-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive: Mobile */
@media (max-width: 600px) {
  .res-series-container {
    padding: clamp(1rem, 3vw, 1.5rem);
  }

  .res-series-sub-cards {
    grid-template-columns: 1fr;
  }

  .res-series-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

