:root {
  color-scheme: light;
  --navy: #0b2340;
  --navy-light: #123a63;
  --heading: #0b2340;
  --blue: #1a56db;
  --blue-dark: #123f9e;
  --ink: #111827;
  --gray-600: #4b5563;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --bg: #ffffff;
  --bg-alt: #f7f9fc;
  --green: #0f7a3d;
  --green-bg: #e8f7ee;
  --red: #b3261e;
  --red-bg: #fdeceb;
  --gray-neutral: #6b7280;
  --gray-neutral-bg: #eef0f2;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(11, 35, 64, 0.08), 0 1px 2px rgba(11, 35, 64, 0.06);
  --max-width: 960px;
}

/* Dark mode: default tokens above are light-mode. These two blocks carry the
   same dark values — one applies when the OS is dark and the viewer hasn't
   overridden it, the other when they've explicitly chosen dark regardless of
   OS. Colors were run through the dataviz skill's CVD validator before use;
   see chart.js / renderComparisonChart for the series slots. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --heading: #e8eefc;
    --blue: #4d82f0;
    --blue-dark: #7aa2f5;
    --ink: #eef1f6;
    --gray-600: #a9b6cc;
    --gray-300: #34486b;
    --gray-100: #16283f;
    --bg: #0f2540;
    --bg-alt: #0a1c33;
    --green: #2fbd6b;
    --green-bg: #0f2e1d;
    --red: #f0645c;
    --red-bg: #3a1512;
    --gray-neutral: #9aa5b8;
    --gray-neutral-bg: #1c2836;
    --series-2: #d95926;
    --series-3: #199e70;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --heading: #e8eefc;
  --blue: #4d82f0;
  --blue-dark: #7aa2f5;
  --ink: #eef1f6;
  --gray-600: #a9b6cc;
  --gray-300: #34486b;
  --gray-100: #16283f;
  --bg: #0f2540;
  --bg-alt: #0a1c33;
  --green: #2fbd6b;
  --green-bg: #0f2e1d;
  --red: #f0645c;
  --red-bg: #3a1512;
  --gray-neutral: #9aa5b8;
  --gray-neutral-bg: #1c2836;
  --series-2: #d95926;
  --series-3: #199e70;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--gray-100);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--heading);
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: color 0.15s ease;
}

.nav a:hover { color: var(--heading); }

.theme-toggle {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--gray-600);
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--heading);
  border-color: var(--gray-600);
}

/* Hero */
.hero {
  padding: 96px 0 72px;
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--gray-100);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 12px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--heading);
  margin: 0 0 16px;
}

.lead {
  font-size: 1.15rem;
  color: var(--gray-600);
  max-width: 560px;
  margin: 0 0 32px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

/* Sections */
.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--gray-100);
}

.section h2 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin: 0 0 12px;
}

.section-lead {
  color: var(--gray-600);
  max-width: 640px;
  margin: 0 0 36px;
  font-size: 1.02rem;
}

/* Sentiment tool */
.sentiment-section { background: var(--bg-alt); }

.search-card {
  background: var(--bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 32px;
}

.stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.stock-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--heading);
}

.stock-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--gray-neutral);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.stock-chip-remove:hover {
  background: var(--gray-100);
  color: var(--red);
}

#sentiment-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#horizon-select {
  padding: 12px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

#horizon-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.autocomplete {
  position: relative;
  flex: 1 1 280px;
}

#stock-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

#stock-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.suggestion-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--gray-100);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(11, 35, 64, 0.16);
  max-height: 280px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
}

.suggestion-item .suggestion-symbol {
  color: var(--gray-neutral);
  font-size: 0.8rem;
  margin-left: 6px;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--bg-alt);
}

.suggestion-item mark {
  background: none;
  color: var(--blue);
  font-weight: 700;
}

.input-error {
  margin: 10px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--red);
}

.disclaimer {
  margin: 16px 0 0;
  font-size: 0.82rem;
  color: var(--gray-neutral);
}

.footnote {
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--gray-neutral);
}

.status {
  padding: 16px 20px;
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.95rem;
}

.status.error {
  background: var(--red-bg);
  color: var(--red);
}

.results { display: grid; gap: 28px; }

.results-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: -16px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
}

.btn-link:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.copy-link-confirm {
  font-size: 0.85rem;
  color: var(--green);
}

.article-group {
  margin-top: 8px;
}

.article-group-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 12px;
}

.summary-table-wrap {
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.summary-table th,
.summary-table td {
  padding: 16px 20px;
  text-align: left;
  white-space: nowrap;
}

.summary-table thead th {
  background: var(--navy);
  color: #fff;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.summary-table tbody td {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.summary-table tbody td:first-child {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--heading);
  white-space: normal;
}

.summary-table .positive { color: var(--green); }
.summary-table .negative { color: var(--red); }
.summary-table .neutral { color: var(--gray-neutral); }

.summary-note {
  margin: -8px 0 0;
  font-size: 0.85rem;
  color: var(--gray-neutral);
}

.chart-card {
  background: var(--bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 12px;
}

.chart-title {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--heading);
}

.chart-empty,
.empty-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--gray-neutral);
}

.chart-baseline {
  stroke: var(--gray-100);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-end-ring {
  fill: var(--bg);
}

.chart-end-dot {
  fill: var(--blue);
}

.chart-axis-label {
  font-size: 11px;
  fill: var(--gray-neutral);
}

.chart-crosshair {
  stroke: var(--gray-300);
  stroke-width: 1;
}

.chart-hover-dot {
  fill: var(--blue);
  stroke: var(--bg);
  stroke-width: 2;
}

.chart-card svg {
  display: block;
  cursor: crosshair;
}

.chart-card svg:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.chart-tooltip {
  position: absolute;
  background: var(--navy);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.3;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(11, 35, 64, 0.25);
}

.chart-tooltip-date {
  color: rgba(255, 255, 255, 0.7);
}

.chart-tooltip-price {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 10px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
}

.chart-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
}

.chart-zero-line {
  stroke: var(--gray-300);
  stroke-width: 1;
}

.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chart-tooltip-key {
  display: inline-block;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.article-item {
  background: var(--bg);
  border: 1px solid var(--gray-100);
  border-left: 4px solid var(--gray-neutral);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.article-item.positive { border-left-color: var(--green); }
.article-item.negative { border-left-color: var(--red); }
.article-item.neutral { border-left-color: var(--gray-neutral); }

.article-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.article-title {
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  color: var(--ink);
}

.article-title:hover { text-decoration: underline; }

.tag {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.tag.positive { background: var(--green-bg); color: var(--green); }
.tag.negative { background: var(--red-bg); color: var(--red); }
.tag.neutral { background: var(--gray-neutral-bg); color: var(--gray-neutral); }

.article-meta {
  font-size: 0.8rem;
  color: var(--gray-neutral);
}

/* Tools */
.tools-section { background: var(--bg); }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.tile {
  display: block;
  background: var(--bg);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tile h3 {
  margin: 10px 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
}

.tile p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.tile-live:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(11, 35, 64, 0.14);
  border-color: var(--blue);
}

.tile-placeholder {
  opacity: 0.6;
  cursor: not-allowed;
}

.tile-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--gray-neutral-bg);
  color: var(--gray-neutral);
}

.tile-badge-live {
  background: var(--green-bg);
  color: var(--green);
}

/* Contact */
.contact-section { background: var(--bg-alt); }

.contact-links {
  display: flex;
  gap: 20px;
}

.contact-links a {
  text-decoration: none;
  font-weight: 600;
  color: var(--blue);
}

.contact-links a:hover { color: var(--blue-dark); }

/* Footer */
.site-footer {
  padding: 28px 0;
  color: var(--gray-neutral);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .hero h1 { font-size: 2.2rem; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .nav { gap: 12px 16px; flex-wrap: wrap; }
  .theme-toggle { padding: 4px 10px; font-size: 0.85rem; }
  #sentiment-form { flex-direction: column; }
  #sentiment-form .btn { width: 100%; }
}
