/* =============================================
   JOE FUND YOURSELF — Quick Pitch Broadcast Style
   ============================================= */

/* === RESET & BASE === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Broadcast dark palette */
  --bg-studio: #0b1120;
  --bg-panel: #111a2e;
  --bg-card: #162036;
  --bg-card-hover: #1c2a45;
  --bg-input: #1a2540;
  --border: #1e2d4a;
  --border-light: #263550;

  /* Text */
  --text-bright: #ffffff;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accents — broadcast colors */
  --green: #00e676;
  --green-dim: rgba(0, 230, 118, 0.12);
  --green-glow: rgba(0, 230, 118, 0.25);
  --amber: #ffab00;
  --amber-dim: rgba(255, 171, 0, 0.12);
  --red: #ff5252;
  --red-dim: rgba(255, 82, 82, 0.12);
  --blue: #448aff;
  --blue-dim: rgba(68, 138, 255, 0.12);
  --orange: #ff6d00;

  /* Stripe accent */
  --stripe: var(--green);

  /* Type */
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-studio);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === TOP BAR — Network Bug === */
#top-bar {
  background: linear-gradient(180deg, #0d1526, #0b1120);
  border-bottom: 2px solid var(--green);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--bg-studio);
  background: var(--green);
  padding: 2px 8px;
  letter-spacing: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--text-bright);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--red);
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.6); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255, 82, 82, 0); }
}

/* === TICKER === */
#ticker {
  background: #060d1a;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  height: 38px;
}

.ticker-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--bg-studio);
  background: var(--amber);
  padding: 0 16px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-window {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  animation: ticker-scroll 40s linear infinite;
  width: max-content;
}

.ticker-track:hover {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
  height: 100%;
}

.ticker-pair {
  color: var(--text-bright);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.5px;
}

.ticker-rate {
  font-family: var(--font-body);
  font-weight: 700;
}

.ticker-rate.positive { color: var(--green); }
.ticker-rate.negative { color: var(--red); }

.ticker-earnings {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}

/* === HERO === */
#hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  text-align: center;
}

#hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.15;
  color: var(--text-bright);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hero-accent {
  color: var(--green);
}

.hero-sub {
  margin-top: 12px;
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

.hero-caveat {
  font-size: 12px;
  color: var(--text-muted);
}

/* === CAPITAL INPUT === */
#capital-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 24px 32px;
  display: flex;
  justify-content: center;
}

.capital-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 24px;
}

.capital-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.capital-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.currency-sign {
  font-size: 24px;
  font-weight: 700;
  color: var(--green);
  font-family: var(--font-display);
}

#capital-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text-bright);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  width: 140px;
  padding: 0 4px;
  outline: none;
  text-align: left;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

#capital-input::-webkit-inner-spin-button,
#capital-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

#capital-input:focus {
  border-color: var(--green);
}

/* === SECTION HEADERS — Lower Third Style === */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.section-stripe {
  width: 4px;
  height: 24px;
  background: var(--green);
  border-radius: 2px;
}

.section-stripe.stripe-blue {
  background: var(--blue);
}

.section-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--text-bright);
}

.update-time, .pair-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* === TOP 3 CARDS — Matchup Cards === */
#top-cards {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.matchup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.matchup-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.matchup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.matchup-card.card-gold::before { background: var(--amber); }
.matchup-card.card-silver::before { background: var(--text-secondary); }
.matchup-card.card-bronze::before { background: #cd7f32; }

.card-rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 48px;
  color: var(--border-light);
  position: absolute;
  top: 8px;
  right: 16px;
  line-height: 1;
}

.card-pair {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 1px;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.card-direction {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.card-direction .dir-label {
  color: var(--green);
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card-stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--green);
  line-height: 1.2;
}

.card-stat-value.amber { color: var(--amber); }

.card-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* === SCOREBOARD TABLE === */
#scoreboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #0d1526;
}

th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-align: right;
  padding: 14px 16px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}

th:first-child { text-align: center; width: 50px; }
th:nth-child(2) { text-align: left; }

th:hover { color: var(--text-secondary); }
th.active { color: var(--blue); }
th.active.asc::after { content: ' ▲'; font-size: 10px; }
th.active.desc::after { content: ' ▼'; font-size: 10px; }

.col-direction { cursor: default; }

td {
  text-align: right;
  padding: 12px 16px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td:first-child {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-muted);
}

td:nth-child(2) {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.loading-cell {
  text-align: center !important;
  color: var(--text-muted);
  padding: 40px;
  font-size: 14px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Row colors */
.row-hot { background: var(--green-dim); }
.row-hot td:nth-child(2) { color: var(--green); }
.row-hot:hover { background: var(--green-glow); }

.row-warm { background: var(--amber-dim); }
.row-warm td:nth-child(2) { color: var(--amber); }
.row-warm:hover { background: rgba(255, 171, 0, 0.18); }

.row-cold { }
.row-cold td:nth-child(2) { color: var(--text-primary); }
.row-cold:hover { background: var(--bg-card-hover); }

.row-neg { background: var(--red-dim); }
.row-neg td:nth-child(2) { color: var(--red); }
.row-neg:hover { background: rgba(255, 82, 82, 0.18); }

tbody tr {
  transition: background 0.12s;
}

.rate-green { color: var(--green); font-weight: 600; }
.rate-amber { color: var(--amber); font-weight: 600; }
.rate-neutral { color: var(--text-secondary); }
.rate-red { color: var(--red); font-weight: 600; }

.dir-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.dir-tag.longs-pay {
  background: var(--green-dim);
  color: var(--green);
}

.dir-tag.shorts-pay {
  background: var(--red-dim);
  color: var(--red);
}

/* === EXPLAINER === */
#explainer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.explainer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.explainer-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.explainer-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.explainer-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.explainer-card em {
  color: var(--green);
  font-style: normal;
  font-weight: 600;
}

/* === CTA === */
#cta {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cta-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px;
  text-align: center;
}

#cta h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 1px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.cta-btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--bg-studio);
  background: var(--green);
  padding: 18px 56px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  margin: 20px 0 12px;
  box-shadow: 0 0 20px rgba(0, 230, 118, 0.2);
}

.cta-btn:hover {
  background: #00c864;
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 230, 118, 0.35);
}

.cta-sub-link {
  margin-bottom: 16px;
}

.cta-sub-link a {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.cta-sub-link a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

.cta-help {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}

.cta-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.cta-link:hover {
  text-decoration: underline;
}

/* Secondary CTA at bottom (after scoreboard) */
.cta-secondary {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cta-secondary .cta-inner {
  padding: 32px 24px;
}

.cta-secondary .cta-btn {
  font-size: 22px;
  padding: 14px 40px;
}

/* === FOOTER === */
footer {
  background: var(--bg-studio);
  padding: 32px 24px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.disclaimer-box {
  max-width: 700px;
  margin: 0 auto 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
}

.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 8px;
}

.disclaimer:last-child {
  margin-bottom: 0;
}

.affiliate-disclosure {
  font-style: italic;
}

.footer-brand {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 1px;
}

/* === ERROR TOAST === */
#error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  transition: opacity 0.3s;
}

#error-toast.hidden {
  display: none;
}

.toast-dismiss {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .brand-name { font-size: 14px; letter-spacing: 1px; }
  .brand-mark { font-size: 18px; }

  #hero { padding: 32px 16px 16px; }
  #hero h1 { font-size: 24px; }
  .hero-sub { font-size: 14px; }

  #capital-section { padding: 8px 16px 24px; }
  .capital-box { padding: 10px 16px; }
  #capital-input { font-size: 24px; width: 100px; }

  #top-cards, #scoreboard, #explainer { padding: 0 16px 32px; }

  .cards-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card-rank { font-size: 36px; }
  .card-pair { font-size: 22px; }
  .card-stat-value { font-size: 18px; }

  .explainer-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  th, td { padding: 10px 8px; font-size: 13px; }
  td:nth-child(2) { font-size: 14px; }

  /* Hide monthly column on mobile */
  th:nth-child(6), td:nth-child(6) { display: none; }

  .cta-inner { padding: 32px 16px; }
  #cta h2 { font-size: 24px; }
  .cta-btn { font-size: 16px; padding: 12px 32px; }
}

@media (max-width: 480px) {
  .top-bar-inner { padding: 10px 12px; }
  .brand-name { display: none; }

  #ticker { height: 34px; }
  .ticker-label { font-size: 10px; padding: 0 10px; }
  .ticker-item { padding: 0 14px; font-size: 12px; }
  .ticker-earnings { display: none; }

  /* Hide APR column on small mobile */
  th:nth-child(4), td:nth-child(4) { display: none; }
  /* Hide direction column on small mobile */
  th:nth-child(7), td:nth-child(7) { display: none; }
}
