/*
Theme Name: KabuWire
Description: Dark financial news theme
Version: 1.0
Author: Finance Autopilot
*/

/* ========== VARIABLES ========== */
:root {
  --bg-dark: #0b0e11;
  --bg-card: #16191e;
  --bg-card-hover: #1c2028;
  --bg-widget: #16191e;
  --bg-input: #1c2028;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #5f6368;
  --accent: #4a90e2;
  --accent-hover: #5ba0f2;
  --green: #00c853;
  --green-dim: rgba(0,200,83,0.12);
  --red: #ff5252;
  --red-dim: rgba(255,82,82,0.12);
  --border: #2d3139;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-w: 1280px;
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--text-primary); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ========== TICKER TAPE ========== */
.ticker-tape {
  background: #0d1117;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: 36px;
  display: flex;
  align-items: center;
}
.ticker-inner {
  display: flex;
  gap: 2rem;
  animation: tickerScroll 30s linear infinite;
  white-space: nowrap;
}
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.t-name { color: var(--text-secondary); }
.t-pos { color: var(--green); }
.t-neg { color: var(--red); }

/* ========== SITE HEADER ========== */
.site-header {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-brand a { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; }
.logo-accent { color: var(--accent); }

.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.site-nav a:hover { color: var(--text-primary); border-bottom-color: var(--accent); }

/* ========== MAIN LAYOUT ========== */
.site-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem;
}
.main-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

/* ========== HERO CARD ========== */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 1rem;
  transition: background 0.2s;
}
.hero-card:hover { background: var(--bg-card-hover); }
.hero-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.cat-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cat-badge-sm {
  display: inline-block;
  background: rgba(74,144,226,0.15);
  color: var(--accent) !important;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.post-time { color: var(--text-muted); font-size: 0.8rem; }
.hero-title { font-size: 1.75rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.hero-title a { color: var(--text-primary); }
.hero-title a:hover { color: var(--accent); }
.hero-excerpt { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }

/* ========== NEWS CARDS ========== */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}
.news-card:hover { background: var(--bg-card-hover); transform: translateX(2px); }
.news-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.news-title { font-size: 1.1rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.3rem; }
.news-title a { color: var(--text-primary); }
.news-title a:hover { color: var(--accent); }
.news-excerpt { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; }

.no-posts {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3rem 2rem;
  text-align: center;
}
.no-posts h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.no-posts p { color: var(--text-secondary); }

/* ========== SIDEBAR ========== */
.sidebar { display: flex; flex-direction: column; gap: 1rem; }
.sidebar-widget {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.widget-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Market Widget */
.market-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(45,49,57,0.5);
}
.market-row:last-child { border-bottom: none; }
.m-name { font-size: 0.85rem; font-weight: 500; }
.m-ticker { color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }
.m-data { text-align: right; }
.m-price { font-size: 0.85rem; font-weight: 600; margin-right: 0.5rem; }
.m-pos { color: var(--green); font-size: 0.8rem; font-weight: 600; background: var(--green-dim); padding: 0.1rem 0.4rem; border-radius: 3px; }
.m-neg { color: var(--red); font-size: 0.8rem; font-weight: 600; background: var(--red-dim); padding: 0.1rem 0.4rem; border-radius: 3px; }

/* Sector Widget */
.sector-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.82rem;
}
.sector-row span:first-child { color: var(--text-secondary); }
.s-bar { font-weight: 600; }
.s-pos { color: var(--green); }
.s-neg { color: var(--red); }

/* Headlines Widget */
.headline-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(45,49,57,0.5);
}
.headline-item:last-child { border-bottom: none; }
.headline-item a {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  display: block;
  color: var(--text-primary);
}
.headline-item a:hover { color: var(--accent); }
.headline-time { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.15rem; display: block; }
.no-headlines { color: var(--text-muted); font-size: 0.85rem; }

/* ========== SINGLE POST ========== */
.single-main { padding-top: 2rem; }
.single-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
}
.single-article { max-width: 100%; }
.single-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.single-title {
  color: #ffffff !important;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.single-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #d4d8de;
}
.single-content p { margin-bottom: 1.25rem; }
.single-content h2 {
  color: #f0f2f4 !important;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.single-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
}
.single-content strong { color: var(--text-primary); font-weight: 600; }
.single-content ul { padding-left: 1.25rem; margin: 1rem 0; }
.single-content li { margin-bottom: 0.5rem; }

.single-content article > p:first-child {
  font-size: 1.15rem;
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 1.75rem;
}

/* Tables in articles */
.single-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.single-content th {
  background: rgba(74,144,226,0.08);
  font-weight: 600;
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.single-content td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(45,49,57,0.5);
}
.single-content tr:hover td { background: rgba(255,255,255,0.02); }

.single-content p.disclaimer {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem;
  background: rgba(74,144,226,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========== FOOTER ========== */
.site-footer {
  background: #0a0c0f;
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  margin-top: 3rem;
  text-align: center;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-brand { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.5rem; }
.footer-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; max-width: 500px; margin-left: auto; margin-right: auto; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1.25rem; }
.footer-links a { color: var(--text-secondary); font-size: 0.82rem; font-weight: 500; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { color: var(--text-muted); font-size: 0.75rem; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .main-grid, .single-grid { grid-template-columns: 1fr; }
  .site-nav { gap: 0.75rem; }
  .site-nav a { font-size: 0.75rem; }
  .hero-title { font-size: 1.35rem; }
  .single-title {
  color: #ffffff !important; font-size: 1.65rem; }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; gap: 0.75rem; }
  .site-nav { flex-wrap: wrap; justify-content: center; }
  .ticker-tape { height: 32px; }
  .ticker-item { font-size: 0.72rem; }
}

/* ========== READABILITY FIXES ========== */
.single-title {
  color: #ffffff !important;
  font-size: 2.1rem !important;
}

.single-content,
.single-content p,
.single-content li {
  color: #d6dae0 !important;
}

.single-content h2 {
  color: #f0f2f5 !important;
}

.single-content h3 {
  color: #e0e4e8 !important;
}

.single-content strong {
  color: #f0f2f5 !important;
}

/* Lede: only the very first paragraph inside the article wrapper */
.single-content article > p:first-child {
  color: #eef0f2 !important;
  font-size: 1.15rem !important;
  border-left: 3px solid #2563eb !important;
  padding-left: 1rem !important;
  margin-bottom: 1.75rem !important;
}

/* Don't apply lede style to all other paragraphs */
.single-content article > p:not(:first-child) {
  border-left: none !important;
  padding-left: 0 !important;
}

/* Links in article */
.single-content a {
  color: #5ba0f2 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Homepage hero text */
.hero-title a {
  color: #ffffff !important;
}
.hero-excerpt {
  color: #a0a8b4 !important;
}

/* News cards text */
.news-title a {
  color: #eef0f2 !important;
}
.news-excerpt {
  color: #8a929c !important;
}

/* Sidebar text readability */
.m-name { color: #c8cdd4 !important; }
.m-price { color: #d8dce2 !important; }
.headline-item a { color: #dce0e5 !important; }
.headline-item a:hover { color: #5ba0f2 !important; }

/* Post date */
.single-meta-top .post-time { color: #808890 !important; }

/* Disclaimer */
.single-content p.disclaimer {
  color: #808890 !important;
}

/* Footer legal links */
.footer-legal {
  margin-top: 0.25rem !important;
  margin-bottom: 1.25rem !important;
}
.footer-legal a {
  color: var(--text-muted) !important;
  font-size: 0.78rem !important;
}
.footer-legal a:hover {
  color: var(--accent) !important;
}

/* Push notification subscribe button */
.push-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.push-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74,144,226,0.08);
}
.push-btn.subscribed {
  border-color: var(--green);
  color: var(--green);
  cursor: default;
}
.push-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 600px) {
  .push-btn { display: none; }
}

/* Related Articles */
.related-articles {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.related-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.related-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(45,49,57,0.5);
  text-decoration: none !important;
  transition: background 0.2s;
}
.related-item:last-child { border-bottom: none; }
.related-item:hover { background: rgba(255,255,255,0.02); }
.related-cat {
  display: inline-block;
  background: rgba(74,144,226,0.15);
  color: #4a90e2 !important;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.related-item-title {
  color: #dce0e5 !important;
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
}
.related-item:hover .related-item-title { color: #5ba0f2 !important; }
.related-time {
  color: #5f6368;
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Author byline */
.post-author {
  color: #9aa0a6;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Related Articles — override fixes */
.single-article .related-articles {
  margin-top: 2.5rem !important;
  padding-top: 1.5rem !important;
  border-top: 1px solid #2d3139 !important;
}
.single-article .related-title {
  font-family: var(--font) !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  color: #9aa0a6 !important;
  margin-bottom: 1rem !important;
}
.single-article a.related-item {
  display: block !important;
  padding: 0.75rem 1rem !important;
  margin-bottom: 0.5rem !important;
  border: 1px solid #2d3139 !important;
  border-radius: 8px !important;
  background: #16191e !important;
  text-decoration: none !important;
  transition: all 0.2s !important;
  font-style: normal !important;
}
.single-article a.related-item:hover {
  background: #1c2028 !important;
  border-color: #4a90e2 !important;
  transform: translateX(2px) !important;
}
.single-article .related-cat {
  display: inline-block !important;
  background: rgba(74,144,226,0.15) !important;
  color: #4a90e2 !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  font-style: normal !important;
  padding: 0.15rem 0.5rem !important;
  border-radius: 3px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  margin-bottom: 0.35rem !important;
}
.single-article .related-item-title {
  display: block !important;
  color: #dce0e5 !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  font-style: normal !important;
  line-height: 1.35 !important;
  margin-bottom: 0.2rem !important;
}
.single-article a.related-item:hover .related-item-title {
  color: #5ba0f2 !important;
}
.single-article .related-time {
  display: block !important;
  color: #5f6368 !important;
  font-size: 0.72rem !important;
  font-style: normal !important;
}
