/* ============================================
   components.css — Layout + UI components
   All styles use CSS custom properties
   ============================================ */

/* --- Site Header --- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-6);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-headline);
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.site-logo:hover { color: var(--accent); }
.site-logo__icon { font-size: var(--text-2xl); }

.site-nav {
  display: flex;
  gap: var(--space-4);
  margin-left: auto;
}

.site-nav__link {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms;
}

.site-nav__link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.site-actions { display: flex; gap: var(--space-2); }

/* --- Site Footer --- */
.site-footer {
  margin-top: var(--space-8);
  padding: var(--space-5) var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Page Main --- */
.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  min-height: 60vh;
}

/* --- Feed Header --- */
.feed-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.feed-title {
  font-family: var(--font-headline);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* --- Feed Controls --- */
.feed-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.feed-controls__sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.feed-controls__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.feed-controls__option {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 150ms;
}

.feed-controls__option:hover { background: var(--bg-hover); color: var(--text); }
.feed-controls__option.active { background: var(--accent); color: var(--text-inverse); }

.feed-controls__toggles { display: flex; gap: var(--space-2); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-body);
  line-height: 1.5;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 150ms;
  text-decoration: none;
}

.btn--primary { background: var(--accent); color: var(--text-inverse); }
.btn--primary:hover { background: var(--accent-hover); color: var(--text-inverse); }
.btn--ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); }

/* --- Live Pulse --- */
.live-pulse {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.live-pulse__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--noise-high);
  animation: pulse 2s ease-in-out infinite;
}

.live-pulse__text {
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--noise-high);
  letter-spacing: 0.1em;
}

/* --- Scandal Grid --- */
.scandal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 768px) { .scandal-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .scandal-grid { grid-template-columns: repeat(3, 1fr); } }

/* --- Scandal Card --- */
.scandal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: box-shadow 200ms, transform 200ms;
}

.scandal-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.scandal-card--breaking { border-left: 3px solid var(--noise-extreme); }

.scandal-card__link { text-decoration: none; color: inherit; display: block; }

.scandal-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.scandal-card__state { font-size: var(--text-lg); }

.scandal-card__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.scandal-card__title {
  font-family: var(--font-headline);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.scandal-card__parties {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.scandal-card__summary {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-3);
  line-height: 1.5;
}

/* Press/Simple text style toggle */
.simple-text { display: none; }
.style-simple .press-text { display: none; }
.style-simple .simple-text { display: block; }

/* --- Noise Meter --- */
.noise-meter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.noise-meter__track {
  flex: 1;
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.noise-meter--sm .noise-meter__track { height: 4px; }
.noise-meter--lg .noise-meter__track { height: 10px; }

.noise-meter__fill {
  height: 100%;
  width: var(--fill, 0%);
  border-radius: var(--radius-full);
  animation: meter-fill 800ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.noise-meter__label {
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 2ch;
  text-align: right;
}

.noise-meter__text {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* --- Noise Detailed --- */
.noise-detailed__header {
  margin-bottom: var(--space-4);
}

.noise-detailed__decay {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.noise-detailed__factors {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.noise-factor {
  display: grid;
  grid-template-columns: 120px 1fr 3ch;
  align-items: center;
  gap: var(--space-3);
}

.noise-factor__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.noise-factor__value {
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-mono);
  text-align: right;
}

/* --- Tier Badge --- */
.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: var(--radius-full);
  line-height: 1.4;
}

.tier-badge--s { background: var(--tier-s); color: #1a1a1a; }
.tier-badge--a { background: var(--tier-a); color: #1a1a1a; }
.tier-badge--b { background: var(--tier-b); color: #1a1a1a; }
.tier-badge--c { background: var(--tier-c); color: #fff; }

/* --- Party Badge --- */
.party-badge {
  display: inline-block;
  padding: 2px var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.party-badge--critic { background: var(--badge-critic-bg); color: var(--badge-critic-text); }
.party-badge--defender { background: var(--badge-defender-bg); color: var(--badge-defender-text); }
.party-badge--neutral { background: var(--badge-neutral-bg); color: var(--badge-neutral-text); }

/* --- Star Card --- */
.star-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: box-shadow 200ms;
}

.star-card:hover { box-shadow: var(--shadow-sm); }

.star-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-card__initials {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--accent);
}

.star-card__info { flex: 1; min-width: 0; }

.star-card__name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.star-card__name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.star-card__bio {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.star-card__handles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.star-card__handle {
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.star-card__followers {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.star-card__score {
  font-size: var(--text-2xl);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  flex-shrink: 0;
}

/* --- Stars Page --- */
.stars-page__title {
  font-family: var(--font-headline);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.stars-page__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.stars-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 768px) { .stars-grid { grid-template-columns: repeat(2, 1fr); } }

/* --- Scandal Page --- */
.scandal-page__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.scandal-page__back {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
}

.scandal-page__back:hover { color: var(--accent); }

.scandal-page__state {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font-mono);
}

.scandal-page__title {
  font-family: var(--font-headline);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--space-5);
}

.scandal-page__summaries { margin-bottom: var(--space-6); }
.scandal-page__summaries p { font-size: var(--text-lg); line-height: 1.7; color: var(--text); }

.scandal-page__noise,
.scandal-page__parties,
.scandal-page__timeline {
  margin-bottom: var(--space-6);
}

.scandal-page__noise h2,
.scandal-page__parties h2 {
  font-family: var(--font-headline);
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

/* --- Party Comparison --- */
.party-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 640px) { .party-comparison { grid-template-columns: 1fr; } }

.party-column__title {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--border);
}

.party-column--critic .party-column__title { border-color: var(--badge-critic-text); }
.party-column--defender .party-column__title { border-color: var(--badge-defender-text); }

.party-entry {
  padding: var(--space-3);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.party-entry__header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.party-entry__name { font-weight: 600; font-size: var(--text-sm); }
.party-entry__stance { font-size: var(--text-sm); color: var(--text-muted); }
.party-column__empty { font-size: var(--text-sm); color: var(--text-muted); font-style: italic; }

/* --- Timeline --- */
.timeline__title {
  font-family: var(--font-headline);
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

.timeline__list {
  list-style: none;
  border-left: 2px solid var(--border);
  padding-left: var(--space-5);
}

.timeline__item {
  position: relative;
  margin-bottom: var(--space-5);
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-5) - 5px);
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: block;
  margin-bottom: var(--space-1);
}

.timeline__headline { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-1); }
.timeline__detail { font-size: var(--text-sm); color: var(--text-muted); }
.timeline__source { font-size: var(--text-xs); color: var(--accent); }

/* --- Tweet Card --- */
.tweet-card {
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-style: normal;
  margin: 0;
}

.tweet-card__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-3); }
.tweet-card__author { display: flex; align-items: center; gap: var(--space-3); }

.tweet-card__avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.tweet-card__name { font-weight: 600; font-size: var(--text-sm); display: block; }
.tweet-card__handle { font-size: var(--text-xs); color: var(--text-muted); }
.tweet-card__link { font-size: var(--text-xl); color: var(--text-muted); text-decoration: none; }
.tweet-card__text { font-size: var(--text-base); line-height: 1.6; margin-bottom: var(--space-3); }

.tweet-card__footer { display: flex; justify-content: space-between; align-items: center; }
.tweet-card__date { font-size: var(--text-xs); color: var(--text-muted); }
.tweet-card__engagement { display: flex; gap: var(--space-4); }
.tweet-card__stat { font-size: var(--text-xs); color: var(--text-muted); }

/* --- Empty State --- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.empty-state__text {
  font-size: var(--text-lg);
  color: var(--text-muted);
}

/* --- Error Page --- */
.error-page {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.error-page h1 {
  font-size: var(--text-4xl);
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.error-page p { color: var(--text-muted); margin-bottom: var(--space-4); }

/* --- Compact View --- */
.view-compact .scandal-card { padding: var(--space-3); }
.view-compact .scandal-card__title { font-size: var(--text-base); }
.view-compact .scandal-card__summary { display: none; }
.view-compact .scandal-card__parties { display: none; }

/* --- Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* --- Mobile responsive --- */
@media (max-width: 640px) {
  .site-header__inner { gap: var(--space-3); }
  .site-logo { font-size: var(--text-base); }
  .feed-title { font-size: var(--text-2xl); }
  .feed-controls { flex-direction: column; align-items: stretch; }
  .feed-controls__sort { justify-content: center; }
  .feed-controls__toggles { justify-content: center; }
  .scandal-page__title { font-size: var(--text-2xl); }
  .noise-factor { grid-template-columns: 90px 1fr 3ch; }
}
