: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;
  }
}
