/* ===================================================================
   MEDIATEA — Story Cluster Detail View (v2 Redesign)
   
   White background (mental model: colored = mega, white = cluster).
   Hero image header, Perspective Viewer, Publisher Mosaic,
   article list (reusing FeedArticleCard), and context footer.
   
   Note: tokens.css, _component-base.css, card-standard.css, and
   score-badge.css are loaded via <link> tags in the HTML to avoid
   nested @import issues with the file:// protocol.
   =================================================================== */

/* ═══════════════════════════════════════════════════════════════════
   SHOWCASE CHROME
   ═══════════════════════════════════════════════════════════════════ */

body {
  font-family: var(--font-body);
  background: #1A1A1E;
  min-height: 100vh;
  padding: 40px 20px;
}

.showcase-header {
  max-width: 520px;
  margin: 0 auto 40px;
  text-align: center;
}

.showcase-title {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  color: #E8E8E8;
  margin-bottom: 8px;
}

.showcase-subtitle {
  font-family: var(--font-body);
  font-size: 14px;
  color: #8A8A8A;
  line-height: 1.6;
}

.showcase-updated {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #666;
  margin-top: 8px;
  letter-spacing: 0.02em;
}

.annotation {
  max-width: 420px;
  margin: 24px auto 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.annotation-title {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  color: var(--accent-primary);
}

.annotation-text {
  font-family: var(--font-body);
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════════════
   DETAIL VIEW CANVAS
   
   White background — story cluster level.
   Mental model: colored = mega-cluster, white = story cluster.
   ═══════════════════════════════════════════════════════════════════ */

.detail-canvas {
  max-width: 420px;
  margin: 0 auto 32px;
  border-radius: var(--radius-lg);
  overflow-x: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  background: var(--bg-primary);
  position: relative;
  padding-bottom: 8px;
}


/* ═══════════════════════════════════════════════════════════════════
   ZONE A+B: COMBINED IDENTITY CARD
   Hero Image + Summary in one floating card
   ═══════════════════════════════════════════════════════════════════ */

.cluster-identity-card {
  margin: var(--space-sm) var(--feed-padding) var(--space-md);
  background: var(--surface-card);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color var(--duration-snappy) var(--ease-snappy);
  border-left: 4px solid transparent;
}

.cluster-identity-card.perspective--left  { border-left-color: #4A7EC0; }
.cluster-identity-card.perspective--right { border-left-color: #C0554F; }

.cluster-hero {
  position: relative;
  overflow: hidden;
}

.cluster-hero-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.cluster-hero-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 180px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.12) 25%,
    rgba(0, 0, 0, 0.50) 65%,
    rgba(0, 0, 0, 0.78) 100%
  );
  pointer-events: none;
}

/* Nav bar */
.cluster-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--feed-padding);
  z-index: 10;
}

.cluster-nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 6px 14px 6px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration-snappy) var(--ease-snappy);
}

.cluster-nav-back:hover { background: rgba(0, 0, 0, 0.45); }

.cluster-nav-back-chevron {
  font-size: 18px;
  line-height: 1;
}

.cluster-nav-publishers {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.90);
  background: rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}

/* Title + stats on gradient */
.cluster-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 var(--feed-padding) 20px;
  z-index: 5;
}

.cluster-hero-title {
  font-family: var(--font-headline);
  font-size: 24px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.15;
  margin-bottom: 8px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

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

.cluster-hero-stat {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.80);
}

.cluster-hero-stat strong {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
}

.cluster-hero-dot {
  color: rgba(255, 255, 255, 0.35);
  font-size: 4px;
}


/* ─── Layer 2: Ambient gradient tint ─── */

.ambient-gradient-tint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 680px;
  background: linear-gradient(
    to bottom,
    rgba(74, 126, 192, 0.22) 0%,
    rgba(74, 126, 192, 0.14) 20%,
    rgba(74, 126, 192, 0.07) 50%,
    rgba(74, 126, 192, 0) 100%
  );
  pointer-events: none;
  z-index: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}


/* ─── Layer 3: Inline breadcrumb (inside identity card) ─── */

.cluster-parent-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: background var(--duration-snappy) var(--ease-snappy);
}

.cluster-parent-breadcrumb:hover {
  background: rgba(74, 126, 192, 0.04);
}

.breadcrumb-accent {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: #4A7EC0;
  flex-shrink: 0;
}

.breadcrumb-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.breadcrumb-title {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: #4A7EC0;
}

.breadcrumb-chevron {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: rgba(74, 126, 192, 0.45);
  transition: transform var(--duration-snappy) var(--ease-snappy);
}

.cluster-parent-breadcrumb:hover .breadcrumb-chevron {
  transform: translateX(2px);
  color: rgba(74, 126, 192, 0.7);
}


/* ─── Layer 1: Floating bottom nav pill ─── */

.floating-nav-pill {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 var(--feed-padding);
  padding: 6px;
  z-index: 100;
}

.fnp-home-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-snappy) var(--ease-snappy);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.20);
}

.fnp-home-btn:hover {
  background: rgba(30, 30, 30, 0.95);
  transform: scale(1.05);
}

.fnp-home-icon {
  font-size: 22px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.90);
  line-height: 1;
}

.fnp-context-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(40, 60, 90, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  transition: all var(--duration-snappy) var(--ease-snappy);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.20);
}

.fnp-context-pill:hover {
  background: rgba(40, 60, 90, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.fnp-context-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6A9ED4;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(106, 158, 212, 0.5);
  animation: contextDotPulse 3s ease-in-out infinite;
}

@keyframes contextDotPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(106, 158, 212, 0.4); }
  50% { box-shadow: 0 0 14px rgba(106, 158, 212, 0.7); }
}

.fnp-context-text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.fnp-context-chevron {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.40);
  flex-shrink: 0;
  margin-left: auto;
  transition: transform var(--duration-snappy) var(--ease-snappy);
}

.fnp-context-pill:hover .fnp-context-chevron {
  transform: translateX(2px);
  color: rgba(255, 255, 255, 0.65);
}



/* ═══════════════════════════════════════════════════════════════════
   SUMMARY SECTION (inside identity card)
   ═══════════════════════════════════════════════════════════════════ */

.cluster-summary-section {
  padding: 20px;
}

.summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.summary-section-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
  padding-top: 4px;
  transition: color var(--duration-snappy) var(--ease-snappy);
}

.cluster-identity-card.perspective--left .summary-section-label  { color: #4A7EC0; }
.cluster-identity-card.perspective--right .summary-section-label { color: #C0554F; }

.perspective-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border-radius: var(--radius-pill);
  padding: 2px;
  flex-shrink: 0;
}

.perspective-toggle-btn {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-snappy) var(--ease-snappy);
}

.perspective-toggle-btn.is-active {
  background: #FFFFFF;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.perspective-toggle-btn[data-perspective="left"].is-active  { color: #4A7EC0; }
.perspective-toggle-btn[data-perspective="right"].is-active { color: #C0554F; }

.perspective-panel {
  display: none;
  animation: perspectiveFadeIn var(--duration-snappy) var(--ease-snappy);
}

.perspective-panel.is-active { display: block; }

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

.summary-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.ai-disclosure {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.ai-disclosure-icon { font-size: 10px; opacity: 0.7; }

.ai-disclosure-link {
  display: inline-block;
  margin-top: 2px;
  color: var(--text-tertiary);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.15);
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color var(--duration-snappy) var(--ease-snappy);
}

.ai-disclosure-link:hover { color: var(--text-secondary); }


/* ═══════════════════════════════════════════════════════════════════
   ZONE C: COVERAGE SNAPSHOT
   Distribution Bar + Publisher Favicon Mosaic
   ═══════════════════════════════════════════════════════════════════ */

.coverage-card {
  margin: 0 var(--feed-padding) var(--space-md);
  background: var(--surface-card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.coverage-card-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

/* Distribution bar */
.distribution-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  margin-top: 18px;
  margin-bottom: 6px;
}

.distribution-segment { border-radius: 4px; }
.distribution-segment--left   { background: linear-gradient(90deg, #4A7EC0, #6A9ED4); }
.distribution-segment--center { background: linear-gradient(90deg, #B0B8B2, #C8CFC9); }
.distribution-segment--right  { background: linear-gradient(90deg, #D47A6A, #C0554F); }

.distribution-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 0;
}

.distribution-labels span  { color: var(--text-tertiary); }
.distribution-labels .lean-left  { color: #4A7EC0; }
.distribution-labels .lean-right { color: #C0554F; }

/* Publisher Mosaic */
.publisher-mosaic {
  display: flex;
  gap: 0;
}

.publisher-mosaic-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.publisher-mosaic-column-label {
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.publisher-mosaic-column--left .publisher-mosaic-column-label   { color: #4A7EC0; }
.publisher-mosaic-column--center .publisher-mosaic-column-label { color: var(--text-tertiary); }
.publisher-mosaic-column--right .publisher-mosaic-column-label  { color: #C0554F; }

.publisher-mosaic-column--center {
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  padding: 0 6px;
}

.publisher-favicon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.publisher-favicon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: transform var(--duration-snappy) var(--ease-snappy);
}

.publisher-favicon-item:hover { transform: scale(1.12); }

.publisher-favicon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
}

.publisher-mosaic-column--left .publisher-favicon-circle {
  border-color: rgba(74, 126, 192, 0.25);
  background: rgba(74, 126, 192, 0.06);
}

.publisher-mosaic-column--center .publisher-favicon-circle {
  border-color: rgba(176, 184, 178, 0.25);
  background: rgba(176, 184, 178, 0.06);
}

.publisher-mosaic-column--right .publisher-favicon-circle {
  border-color: rgba(192, 85, 79, 0.25);
  background: rgba(192, 85, 79, 0.06);
}

.publisher-favicon-circle img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.publisher-favicon-name {
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: center;
  max-width: 42px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ═══════════════════════════════════════════════════════════════════
   ZONE D: ARTICLE LIST
   Sort/Filter bar + reused FeedArticleCard
   ═══════════════════════════════════════════════════════════════════ */

.article-list-section {
  padding: 0 var(--feed-padding);
  margin-bottom: var(--space-md);
}

.article-list-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* Sort / Filter bar */
.sort-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sort-select {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(123, 158, 135, 0.08);
  border: 1px solid rgba(123, 158, 135, 0.15);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.filter-row {
  display: flex;
  gap: 6px;
}

.filter-pill {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--surface-card);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-snappy) var(--ease-snappy);
}

.filter-pill.is-active {
  background: var(--text-primary);
  color: #FFFFFF;
  border-color: var(--text-primary);
}

.filter-pill--left.is-active   { background: #4A7EC0; border-color: #4A7EC0; }
.filter-pill--center.is-active { background: #8A9B8E; border-color: #8A9B8E; }
.filter-pill--right.is-active  { background: #C0554F; border-color: #C0554F; }

.filter-pill:hover:not(.is-active) {
  background: var(--bg-primary-deep);
  border-color: rgba(0, 0, 0, 0.12);
}

/* Article list stack */
.article-list-cards {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
}

/* Override wrapper side margin — already padded by parent */
.article-list-cards .standard-card-wrapper {
  margin-left: 0;
  margin-right: 0;
}

/* View More button */
.view-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px;
  margin-top: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
  cursor: pointer;
  transition: all var(--duration-snappy) var(--ease-snappy);
}

.view-more-btn:hover {
  background: rgba(123, 158, 135, 0.06);
  border-color: rgba(123, 158, 135, 0.25);
}

.view-more-chevron { font-size: 10px; }


/* ═══════════════════════════════════════════════════════════════════
   ZONE E: CONTEXT FOOTER
   Related story clusters from the same mega-cluster
   ═══════════════════════════════════════════════════════════════════ */

.context-footer {
  margin: var(--space-lg) var(--feed-padding) var(--space-lg);
}

.context-footer-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.context-footer-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.related-cluster-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--duration-snappy) var(--ease-snappy);
}

.related-cluster-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.related-cluster-accent {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}

.related-cluster-content { flex: 1; min-width: 0; }

.related-cluster-title {
  font-family: var(--font-headline);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.related-cluster-meta {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-tertiary);
}

.related-cluster-chevron {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform var(--duration-snappy) var(--ease-snappy);
}

.related-cluster-card:hover .related-cluster-chevron {
  transform: translateX(2px);
}

/* View All mega-cluster link */
.view-all-mega {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  margin-top: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: filter var(--duration-snappy) var(--ease-snappy);
}

.view-all-mega:hover { filter: brightness(1.05); }

.view-all-mega__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.12;
  border-radius: var(--radius-md);
}

.view-all-mega > span { position: relative; z-index: 1; }

.view-all-mega__text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
}

.detail-canvas-bottom { height: 16px; }


/* ─── Responsive ─── */

@media (max-width: 500px) {
  body { padding: 20px 12px; }
  .detail-canvas { border-radius: 18px; }
  .showcase-title { font-size: 22px; }
  .cluster-hero-title { font-size: 22px; }
}
