/* CognioNews homepage tweaks — sidebar pair carousels, topic filter header, prime rotation
   Layered over style.css + homepage-v2.css. Non-destructive. */

/* ---------- Sidebar ad pair carousel ---------- */
.sidebar-ad-carousel {
  position: relative;
  display: grid;
  grid-template: 1fr / 1fr;
  margin-bottom: 1.5rem;
  isolation: isolate;
}
.sidebar-ad-carousel .sidebar-ad {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 600ms ease, visibility 0s linear 600ms;
  margin-bottom: 0 !important;
}
.sidebar-ad-carousel .sidebar-ad.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 600ms ease, visibility 0s;
  z-index: 1;
}
.sidebar-ad-carousel-dots {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  z-index: 3;
  padding: 4px 6px;
  background: rgba(0,0,0,.45);
  border-radius: 10px;
  backdrop-filter: blur(2px);
}
.sidebar-ad-carousel-dots button {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,.45);
  cursor: pointer;
  transition: background .2s, width .2s, border-radius .2s;
}
.sidebar-ad-carousel-dots button.active {
  background: var(--gold, #c9a227);
  width: 16px;
  border-radius: 3px;
}
.sidebar-ad-carousel-dots button:hover { background: #fff; }

/* ---------- Topic filters now in a header band above stories ---------- */
.stories-section-header {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 0 0.85rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.stories-section-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--fg, #f0e7d4);
}
.stories-section-title::before {
  content: '— ';
  color: var(--gold, #c9a227);
}
.stories-section-header .topic-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

/* ---------- Prime Signal — per-card rotation fade ---------- */
.prime-signal-card {
  transition: opacity 350ms ease;
  position: relative;
}
.prime-signal-card.swapping { opacity: 0.25; }
.prime-signal-card-rotate-dots {
  position: absolute;
  bottom: 8px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}
.prime-signal-card-rotate-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  transition: background .2s, width .2s, border-radius .2s;
}
.prime-signal-card-rotate-dots span.active {
  background: var(--gold, #c9a227);
  width: 12px;
  border-radius: 3px;
}

/* ---------- Story-card actions (save / share / expand hint) ---------- */
.story-card { position: relative; }
.cn-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.cn-card-actions button {
  width: 28px;
  height: 28px;
  border: 0;
  background: rgba(0,0,0,.45);
  color: rgba(255,255,255,.65);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: color .15s, background .15s, transform .15s;
}
.cn-card-actions button:hover {
  color: var(--gold, #c9a227);
  background: rgba(0,0,0,.75);
  transform: scale(1.1);
}
.cn-save-btn.saved { color: var(--gold, #c9a227); }
.cn-expand-hint {
  font-size: 11px !important;
  letter-spacing: .04em;
}
.story-card.expanded .cn-expand-hint { transform: rotate(180deg); }

/* Topic badge → behave like a clickable chip */
.story-card .topic-badge {
  cursor: pointer;
  transition: opacity .15s, text-decoration-color .15s;
}
.story-card .topic-badge:hover {
  opacity: .85;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

/* ---------- Story card — expanded state ---------- */
.story-card.expanded {
  grid-column: 1 / -1;
  background: rgba(255,255,255,.03);
  outline: 1px solid rgba(201,162,39,.4);
  outline-offset: -1px;
}
.story-card.list.expanded,
.stories-grid.list .story-card.expanded { grid-column: 1 / -1; }

.cn-expand-panel {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  animation: cnExpandIn 380ms cubic-bezier(.22,.61,.36,1);
}
@keyframes cnExpandIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cn-expand-content { max-width: 980px; }
.cn-loading-panel {
  padding: 2rem 1rem;
  text-align: center;
  color: rgba(255,255,255,.5);
  font-size: .9rem;
}
.cn-loading-panel::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,.18);
  border-top-color: var(--gold, #c9a227);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: cnSpin .85s linear infinite;
}
@keyframes cnSpin { to { transform: rotate(360deg); } }

/* What's missing — flagship block */
.cn-whats-missing {
  background: rgba(201,162,39,.08);
  border-left: 3px solid var(--gold, #c9a227);
  padding: 14px 18px;
  margin: 0 0 1rem;
  border-radius: 0 4px 4px 0;
}
.cn-whats-missing-label {
  display: block;
  font-size: .68rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--gold, #c9a227);
  margin-bottom: 6px;
  font-weight: 700;
}
.cn-whats-missing-text {
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(255,255,255,.92);
}

/* Sectioned details */
.cn-detail-section { margin: 1.25rem 0; }
.cn-detail-label {
  font-size: .68rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  margin-bottom: 6px;
  font-weight: 700;
  display: block;
}
.cn-detail-text {
  font-size: .94rem;
  line-height: 1.55;
  color: rgba(255,255,255,.78);
}

/* Lens chips */
.cn-lens-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0.6rem 0 1rem;
  align-items: flex-start;
}
.cn-lens-chip {
  font-size: .73rem;
  font-family: inherit;
  padding: 6px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  color: rgba(255,255,255,.78);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .02em;
}
.cn-lens-chip.covered::before {
  content: '✓ ';
  color: var(--gold, #c9a227);
  margin-right: 2px;
}
.cn-lens-chip.absent {
  opacity: .42;
  font-style: italic;
}
.cn-lens-chip.absent::before {
  content: '— ';
  color: rgba(255,255,255,.4);
  margin-right: 2px;
  font-style: normal;
}
.cn-lens-chip:hover {
  background: rgba(201,162,39,.15);
  border-color: rgba(201,162,39,.6);
  color: #fff;
}
.cn-lens-chip.open {
  background: var(--gold, #c9a227);
  color: #0a0c14;
  border-color: var(--gold, #c9a227);
  font-weight: 700;
}
.cn-lens-text {
  flex-basis: 100%;
  display: none;
  margin: 8px 0 6px;
  padding: 14px 16px;
  background: rgba(0,0,0,.35);
  border-left: 3px solid var(--gold, #c9a227);
  font-size: .9rem;
  line-height: 1.55;
  color: rgba(255,255,255,.88);
  border-radius: 0 4px 4px 0;
}
.cn-lens-text.open { display: block; }

/* Action row */
.cn-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.cn-read-full-btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--gold, #c9a227);
  color: #0a0c14;
  text-decoration: none;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 3px;
  transition: transform .15s, background .15s;
}
.cn-read-full-btn:hover {
  transform: translateX(4px);
  background: #e5b942;
}
.cn-close-expand {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.6);
  font-family: inherit;
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s;
}
.cn-close-expand:hover {
  color: #fff;
  border-color: rgba(255,255,255,.4);
}

/* Toast */
.cn-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--gold, #c9a227);
  color: #0a0c14;
  padding: 10px 22px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  pointer-events: none;
}
.cn-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .story-card.expanded { padding-bottom: 1.25rem; }
  .cn-action-row { flex-wrap: wrap; }
  .cn-close-expand { margin-left: 0; }
}
