/* YieldChampion - base layout + token defaults.
   Token catalogue mirrors dividend-portfolio's :root block, retoned for
   the green/teal "obsidian" brand. Theme/style permutations live in themes.css.
   All colors MUST be referenced via CSS custom properties; never hardcode hex
   in component CSS or in JS. */

:root {
  --surface: #0e1116;
  --surface-elevated: #1a1f27;
  --surface-overlay: #252b35;
  --ink: #e8eef5;
  --ink-muted: #9aa4b2;
  --border: #2a313c;
  --accent: #22c08a;
  --accent-strong: #0e8a5c;
  --accent-ink: #051910;
  --success: #22c08a;
  --danger: #e95252;
  --warn: #e8a13c;
  --focus-ring: #6ee7b7;

  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.18);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.24);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

h1, h2, h3 { color: var(--ink); line-height: 1.2; margin-top: 1.5em; margin-bottom: 0.5em; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0.6em 0; }

.yc-container { max-width: 980px; margin: 0 auto; padding: 1rem 1.25rem 4rem; }

/* --- Top nav --- */
.yc-nav {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  position: sticky; top: 0; z-index: 10;
}
.yc-nav__brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.yc-nav__brand-yield { color: var(--ink); }
.yc-nav__brand-champ { color: var(--accent); }
.yc-nav__links { display: flex; gap: 1rem; align-items: center; }
.yc-nav__theme-toggle {
  background: var(--surface-overlay); color: var(--ink); border: 1px solid var(--border);
  padding: 0.3rem 0.6rem; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
}
.yc-nav__theme-toggle:hover { background: var(--accent); color: var(--accent-ink); }

/* --- Calculator + form layout --- */
.yc-calculator {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm);
}
.yc-calculator h2 { margin-top: 0; }
.yc-form { display: grid; grid-template-columns: 1fr; gap: 0.75rem; max-width: 30rem; }
.yc-form label { display: flex; flex-direction: column; font-size: 0.9rem; color: var(--ink-muted); gap: 0.2rem; }
.yc-form input, .yc-form select {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  padding: 0.5rem 0.6rem; border-radius: var(--radius-sm); font: inherit;
}
.yc-form input:focus-visible, .yc-form select:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
}
.yc-btn {
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm); font: inherit; font-weight: 600;
  cursor: pointer;
}
.yc-btn:hover { background: var(--accent-strong); color: var(--ink); }
.yc-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.yc-result { margin-top: 1rem; padding: 1rem; background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); }
.yc-result__big { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.yc-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.yc-table th, .yc-table td { text-align: right; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
.yc-table th { font-weight: 600; color: var(--ink-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.yc-table td:first-child, .yc-table th:first-child { text-align: left; }

/* --- Tooltips --- */
.yc-tooltip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.1em; height: 1.1em; line-height: 1; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 0.7em; margin-left: 0.3em; cursor: help;
  position: relative; vertical-align: baseline; font-weight: 700;
}
.yc-tooltip__body {
  display: none;
  position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: var(--surface-overlay); color: var(--ink); border: 1px solid var(--border);
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  width: max-content; max-width: 18rem;
  font-size: 0.8rem; font-weight: normal; line-height: 1.4;
  box-shadow: var(--shadow-md); z-index: 5;
}
.yc-tooltip:hover .yc-tooltip__body,
.yc-tooltip:focus .yc-tooltip__body,
.yc-tooltip:focus-within .yc-tooltip__body { display: block; }

/* --- How It Works --- */
.yc-howitworks {
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.5rem 1rem; margin: 1.25rem 0;
}
.yc-howitworks summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; color: var(--accent); }
.yc-howitworks[open] summary { margin-bottom: 0.5rem; }
.yc-howitworks__body { color: var(--ink); }
.yc-howitworks__body p { margin: 0.6rem 0; }

/* --- Disclaimer / footer --- */
.yc-disclaimer {
  margin-top: 2rem; padding: 0.75rem 1rem;
  background: var(--surface-elevated); border-left: 3px solid var(--warn);
  color: var(--ink-muted); font-size: 0.85rem; border-radius: var(--radius-sm);
}
.yc-footer {
  margin-top: 3rem; padding: 1.5rem 1.25rem; border-top: 1px solid var(--border);
  text-align: center; color: var(--ink-muted); font-size: 0.85rem;
}
.yc-footer a { color: var(--ink-muted); margin: 0 0.5rem; }

/* --- Ad slots: fixed dimensions to prevent CLS (per design 8). --- */
.yc-ad-slot {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-elevated); border: 1px dashed var(--border);
  color: var(--ink-muted); font-size: 0.85rem; margin: 1.25rem auto;
  border-radius: var(--radius-sm);
  /* Note: explicit width+height overrides per slot below. Keep these defaults. */
}
.yc-ad--leaderboard { width: 728px; height: 90px; }
.yc-ad--rect-medium { width: 300px; height: 250px; }
.yc-ad--half-page  { width: 300px; height: 600px; }
.yc-ad--responsive { width: 100%; min-height: 280px; }
@media (max-width: 768px) {
  .yc-ad--leaderboard { width: 320px; height: 50px; }
  .yc-ad--half-page { display: none; }
}

/* --- Comparison table + chart --- */
.yc-compare-table { width: 100%; border-collapse: collapse; }
.yc-compare-table th, .yc-compare-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); text-align: right; }
.yc-compare-table th:first-child, .yc-compare-table td:first-child { text-align: left; }
.yc-flag { display: inline-block; padding: 0.1rem 0.4rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-size: 0.7rem; margin-left: 0.25rem; font-weight: 700; }
.yc-chart { width: 100%; max-width: 720px; height: 240px; margin-top: 1rem; }
.yc-chart polyline { fill: none; stroke-width: 2; }

/* --- Stale data warning banner --- */
.yc-warn {
  background: var(--warn); color: var(--surface);
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  margin: 0.5rem 0; font-weight: 600;
}

/* --- Loader --- */
.yc-loader { color: var(--ink-muted); font-style: italic; }
