/* ============================================================
   algo.truthtide.tv — Broadcast Noir Theme
   Based on Truth Tide Design System (DESIGN_SYSTEM.md)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Broadcast Noir — Backgrounds */
  --bn-bg:        #050814;
  --bn-bg-soft:   #0a0f20;
  --bn-bg-softer: #111725;
  --bn-highlight: #19223b;

  /* Text */
  --bn-text-main:   #f4f5ff;
  --bn-text-subtle: #a5acc7;

  /* Accent system */
  --bn-accent-teal:  #7fe0ff;
  --bn-accent-warm:  #ff6a3d;

  /* Chrome */
  --bn-border-soft: #1b2235;
  --bn-pill-bg:     #111827;
  --bn-pill-border: #2a3655;
  --bn-tag-bg:      #151b2b;
  --bn-tag-border:  #252f45;

  /* Semantic — report tiers */
  --tier-conversation: #7fe0ff;
  --tier-attention:    #fbbf24;
  --tier-death:        #f87171;
  --tier-positive:     #34d399;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Sora", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bn-bg);
  color: var(--bn-text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ---- Header ---- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0 2rem;
  border-bottom: 1px solid var(--bn-border-soft);
  margin-bottom: 2.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-logo {
  height: 32px;
  width: auto;
  opacity: 0.9;
}

.header-logo:hover { opacity: 1; }

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bn-text-main);
}

header h1 span { color: var(--bn-accent-teal); }

.header-meta {
  text-align: right;
}

.subtitle {
  color: var(--bn-text-subtle);
  font-size: 0.85rem;
}

.gen-date {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.2rem 0.6rem;
  background: var(--bn-bg-softer);
  border: 1px solid var(--bn-border-soft);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--bn-text-subtle);
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
}

/* ---- Status Banner ---- */
.status-banner {
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
  border: 1px solid;
}

.status-banner strong { font-weight: 600; }

.status-banner.has-changes {
  background: linear-gradient(135deg, rgba(255, 106, 61, 0.08), rgba(127, 224, 255, 0.06));
  border-color: rgba(255, 106, 61, 0.3);
}

.status-banner.has-changes strong { color: var(--bn-accent-warm); }

.status-banner.no-changes {
  background: linear-gradient(135deg, rgba(127, 224, 255, 0.06), rgba(165, 172, 199, 0.04));
  border-color: rgba(127, 224, 255, 0.15);
}

.status-banner.no-changes strong { color: var(--bn-accent-teal); }

.accountability {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.6rem;
  background: var(--bn-bg-softer);
  border: 1px solid var(--bn-border-soft);
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  color: var(--bn-text-subtle);
}

/* ---- TL;DR ---- */
.tldr {
  background: linear-gradient(135deg, rgba(127, 224, 255, 0.08), rgba(165, 172, 199, 0.04));
  border: 1px solid rgba(127, 224, 255, 0.15);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  font-size: 1rem;
  line-height: 1.7;
}

.tldr strong { color: var(--bn-accent-teal); }

/* ---- Sections ---- */
section {
  margin-bottom: 3rem;
}

section > h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--bn-border-soft);
  letter-spacing: -0.01em;
  color: var(--bn-text-main);
}

/* ---- Funnel ---- */
.funnel {
  display: flex;
  gap: 0;
  margin: 1.5rem 0;
}

.funnel-step {
  flex: 1;
  padding: 1.25rem 1rem;
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  position: relative;
}

.funnel-step:first-child { border-radius: 8px 0 0 8px; }
.funnel-step:last-child { border-radius: 0 8px 8px 0; }

.funnel-step h3 {
  font-size: 0.8rem;
  color: var(--bn-accent-teal);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.funnel-step p {
  font-size: 0.82rem;
  color: var(--bn-text-subtle);
}

.funnel-step .step-num {
  position: absolute;
  top: -12px;
  left: 12px;
  background: var(--bn-accent-teal);
  color: var(--bn-bg);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ---- Scoring Table ---- */
.scoring-table {
  width: 100%;
  border-collapse: collapse;
}

.scoring-table th {
  text-align: left;
  padding: 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-text-subtle);
  border-bottom: 2px solid var(--bn-border-soft);
}

.weight-row td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--bn-border-soft);
  vertical-align: middle;
}

.signal-name {
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.88rem;
}

.signal-weight {
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 70px;
}

.weight-positive { color: var(--tier-positive); }
.weight-negative { color: var(--tier-death); }

.signal-bar { width: 30%; }

.bar-container {
  height: 20px;
  background: var(--bn-bg-softer);
  border-radius: 3px;
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.bar-conversation { background: linear-gradient(90deg, var(--tier-conversation), #b0ecff); }
.bar-positive { background: linear-gradient(90deg, var(--tier-attention), #fcd34d); }
.bar-death { background: linear-gradient(90deg, var(--tier-death), #fca5a5); }

.signal-desc {
  color: var(--bn-text-subtle);
  font-size: 0.8rem;
}

/* ---- Tier Labels ---- */
.tier-label {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.tier-label-conversation { background: rgba(127, 224, 255, 0.12); color: var(--tier-conversation); }
.tier-label-attention { background: rgba(251, 191, 36, 0.12); color: var(--tier-attention); }
.tier-label-death { background: rgba(248, 113, 113, 0.12); color: var(--tier-death); }

/* ---- Equivalence Grid ---- */
.equiv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.equiv-card {
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.equiv-action {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.equiv-equals {
  color: var(--bn-accent-teal);
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  font-weight: 700;
}

/* ---- Feature Cards ---- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  border-radius: 8px;
  padding: 1.25rem;
}

.feature-card h3 {
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
  color: var(--bn-accent-teal);
}

.feature-card p {
  font-size: 0.82rem;
  color: var(--bn-text-subtle);
  margin-bottom: 0.75rem;
}

.key-insight {
  background: rgba(127, 224, 255, 0.06);
  border-left: 3px solid var(--bn-accent-teal);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0 4px 4px 0;
  color: var(--bn-text-main);
}

/* ---- Strategy Cards ---- */
.strategy-card {
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.strategy-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.strategy-num {
  background: var(--bn-accent-teal);
  color: var(--bn-bg);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.strategy-header h3 {
  font-size: 1.02rem;
  margin-bottom: 0.15rem;
}

.weight-ref {
  font-size: 0.78rem;
  color: var(--tier-positive);
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
}

.strategy-card ul {
  list-style: none;
  padding: 0;
}

.strategy-card li {
  padding: 0.35rem 0 0.35rem 1.25rem;
  position: relative;
  font-size: 0.88rem;
  color: var(--bn-text-subtle);
}

.strategy-card li::before {
  content: "\25B8";
  position: absolute;
  left: 0;
  color: var(--bn-accent-teal);
}

/* ---- Changes Deep Dive ---- */
.changes-section {
  margin-bottom: 3rem;
}

.change-card {
  background: var(--bn-bg-soft);
  border: 1px solid rgba(255, 106, 61, 0.2);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.change-card h3 {
  font-size: 0.95rem;
  color: var(--bn-accent-warm);
  margin-bottom: 0.5rem;
}

.change-card p {
  font-size: 0.85rem;
  color: var(--bn-text-subtle);
  margin-bottom: 0.5rem;
}

.change-card .impact {
  background: rgba(255, 106, 61, 0.08);
  border-left: 3px solid var(--bn-accent-warm);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 0 4px 4px 0;
}

.change-file {
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--bn-text-subtle);
  padding: 0.15rem 0.4rem;
  background: var(--bn-bg-softer);
  border-radius: 3px;
  margin-bottom: 0.5rem;
  display: inline-block;
}

/* ---- Code blocks ---- */
.code-block {
  background: var(--bn-bg-softer);
  border: 1px solid var(--bn-border-soft);
  border-radius: 6px;
  padding: 1rem;
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--bn-text-subtle);
  overflow-x: auto;
  margin: 0.75rem 0;
  line-height: 1.5;
}

/* ---- Formula ---- */
.formula {
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  color: var(--bn-accent-teal);
}

/* ---- Meta Pills (telemetry style) ---- */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bn-text-subtle);
}

.meta-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bn-pill-bg);
  border: 1px solid var(--bn-pill-border);
}

/* ---- Tag Chips ---- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--bn-tag-border);
  background: var(--bn-tag-bg);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #cfd4ff;
}

/* ---- Footer ---- */
footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--bn-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-logo {
  height: 24px;
  width: auto;
  opacity: 0.7;
}

.footer-logo:hover { opacity: 0.9; }

.footer-meta {
  text-align: right;
  color: var(--bn-text-subtle);
  font-size: 0.75rem;
  line-height: 1.6;
}

.footer-meta a {
  color: var(--bn-accent-teal);
  text-decoration: none;
}

.footer-meta a:hover { text-decoration: underline; }

/* ---- Emphasis / Highlight ---- */
.highlight {
  color: var(--bn-accent-teal);
  text-decoration: underline;
  text-decoration-color: rgba(127, 224, 255, 0.4);
  text-underline-offset: 3px;
  font-weight: 600;
}

.glow {
  text-shadow: 0 0 12px rgba(127, 224, 255, 0.35);
}

/* ---- Quick Hits (action list) ---- */
.quick-hits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.quick-hit {
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  border-left: 4px solid var(--bn-accent-teal);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
}

.quick-hit strong {
  color: var(--bn-text-main);
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.25rem;
}

.quick-hit p {
  color: var(--bn-text-subtle);
  font-size: 0.85rem;
  margin: 0;
}

/* ---- Format Cards (viral formats) ---- */
.format-card {
  background: var(--bn-bg-soft);
  border: 1px solid var(--bn-border-soft);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.format-card h3 {
  font-size: 1.05rem;
  color: var(--bn-accent-warm);
  margin-bottom: 0.5rem;
}

.format-card .format-why {
  font-size: 0.82rem;
  color: var(--bn-text-subtle);
  margin-bottom: 0.75rem;
}

.format-card .format-recipe {
  background: rgba(127, 224, 255, 0.06);
  border: 1px solid rgba(127, 224, 255, 0.12);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--bn-text-main);
  line-height: 1.6;
}

.format-card .format-recipe strong {
  color: var(--bn-accent-teal);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container { padding: 1rem; }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .header-meta { text-align: left; }

  header h1 { font-size: 1.3rem; }

  .funnel { flex-direction: column; }
  .funnel-step { border-radius: 0; }
  .funnel-step:first-child { border-radius: 8px 8px 0 0; }
  .funnel-step:last-child { border-radius: 0 0 8px 8px; }

  .signal-desc { display: none; }
  .signal-bar { width: 40%; }

  .equiv-grid { grid-template-columns: repeat(2, 1fr); }

  footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-meta { text-align: left; }
}
