/* Bull Run public site. Light theme, phone first. */
:root {
  --primary: #2A9137;
  --primary-dark: #1f6f2a;
  --soft: #eef8f0;
  --border: #cfe7d4;
  --ink: #1E2B3C;
  --muted: #5F6B7A;       /* darkened from #7A8797 for AA contrast on text */
  --muted-deco: #7A8797;
  --bg: #f7faf8;
  --surface: #ffffff;
  --line: #e3ebe5;
  --buy: #1f6f2a;   --buy-bg: #e3f4e6;
  --hold: #8a5a00;  --hold-bg: #fdf1d8;
  --sell: #b42318;  --sell-bg: #fde7e5;
  --none: #4a5565;  --none-bg: #eef1f4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 43, 60, .06), 0 4px 16px rgba(30, 43, 60, .05);
  --shadow-hover: 0 2px 4px rgba(30, 43, 60, .08), 0 12px 28px rgba(30, 43, 60, .10);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --gutter: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img { max-width: 100%; }
a { color: var(--primary-dark); }
a:hover { color: var(--primary); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; color: var(--ink); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid rgba(42, 145, 55, .45); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header { background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(1.4) blur(8px); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; }
.brand { min-height: 44px; }
.brand img { height: 32px; width: auto; display: block; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .9375rem; padding: 0 12px; border-radius: 8px; }
.site-nav a:hover { background: var(--soft); color: var(--primary-dark); }

/* Hero */
.hero { background: linear-gradient(180deg, var(--soft) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.hero__inner { padding-top: 24px; padding-bottom: 24px; }
.hero__search { margin-top: 18px; max-width: 560px; }
.hero__search input { width: 100%; height: 52px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font: inherit; font-size: 1rem; color: var(--ink); padding: 0 14px 0 42px; box-shadow: var(--shadow); -webkit-appearance: none; appearance: none; }
.hero__search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42, 145, 55, .18); }
.hero__search .field__icon { left: 14px; width: 20px; height: 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; color: var(--primary-dark); margin-bottom: 12px; }
.hero h1 { font-size: clamp(1.6rem, 6.4vw, 3rem); letter-spacing: -.01em; max-width: 18ch; }
.lead { font-size: 1rem; color: #3b4859; margin: 12px 0 0; max-width: 62ch; }
.hero__stats { display: flex; gap: 28px; margin: 18px 0 0; }
.hero__stats dt { font-size: .8125rem; color: var(--muted); }
.hero__stats dd { margin: 0; font: 700 1.5rem/1.1 var(--serif); color: var(--primary-dark); }
.pillars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; align-content: start; }
.pillar { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.pillar__num { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .875rem; }
.pillar h2 { font-size: 1.0625rem; margin-bottom: 4px; }
.pillar p { margin: 0; color: var(--muted); font-size: .9375rem; }

/* Reports list */
.reports { padding: 28px 0 40px; scroll-margin-top: 56px; }
.method { padding: 8px 0 48px; scroll-margin-top: 56px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 20px; }
.section-head h2 { font-size: 1.625rem; }
.section-head p { margin: 0; }

.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
.field { position: relative; }
.field__icon { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.toolbar input, .toolbar select {
  width: 100%; height: 48px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; color: var(--ink); padding: 0 12px;
}
.toolbar input[type="search"] { padding-left: 38px; }
.toolbar select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42, 145, 55, .18); }
.chips { border: 0; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { position: relative; cursor: pointer; flex: none; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .875rem; font-weight: 500; color: var(--ink); transition: background .15s, border-color .15s, color .15s; }
.chip:hover span { border-color: var(--primary); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip--buy input:checked + span { background: var(--buy); border-color: var(--buy); }
.chip--hold input:checked + span { background: var(--hold); border-color: var(--hold); }
.chip--sell input:checked + span { background: var(--sell); border-color: var(--sell); }
.chip input:focus-visible + span { outline: 3px solid rgba(42, 145, 55, .45); outline-offset: 2px; }
.result-count { font-size: .875rem; margin: 0 0 16px; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid__item { min-width: 0; }
.card {
  display: flex; flex-direction: column; gap: 12px; height: 100%; min-width: 0; padding: 16px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #a9d6b2; color: inherit; }
.card__top { display: flex; align-items: center; gap: 12px; }
.card__id { min-width: 0; flex: 1; }
.card__name { font-size: 1.0625rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: .875rem; color: var(--muted); }
.card__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.card__facts dt { font-size: .75rem; color: var(--muted); }
.card__facts dd { margin: 0; font-weight: 600; font-size: .9375rem; }
.ticker { font: 700 .8125rem/1.2 var(--sans); letter-spacing: .04em; color: var(--primary-dark); }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .03em; padding: 2px 8px; border-radius: 6px; background: var(--soft); color: var(--primary-dark); border: 1px solid var(--border); }

/* Company logo with monogram fallback */
.co-logo { position: relative; flex: none; display: inline-grid; place-items: center; overflow: hidden; background: var(--soft); border: 1px solid var(--border); color: var(--primary-dark); font-weight: 700; }
.co-logo--md { width: 44px; height: 44px; border-radius: 10px; font-size: .9375rem; }
.co-logo--lg { width: 64px; height: 64px; border-radius: 14px; font-size: 1.25rem; }
.co-logo__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }

/* Badges */
.badge { flex: none; display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; }
.badge--buy { color: var(--buy); background: var(--buy-bg); }
.badge--hold { color: var(--hold); background: var(--hold-bg); }
.badge--sell { color: var(--sell); background: var(--sell-bg); }
.badge--none { color: var(--none); background: var(--none-bg); }

/* Score bar */
.score__label { display: flex; justify-content: space-between; align-items: baseline; font-size: .8125rem; color: var(--muted); margin-bottom: 6px; }
.score__label strong { color: var(--ink); font-size: 1rem; }
.score__label small, .tile__value small { color: var(--muted); font-weight: 500; }
.bar { height: 8px; border-radius: 999px; background: #e6efe8; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%); }
.bar--lg { height: 10px; margin-top: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font: 600 .9375rem/1 var(--sans); text-decoration: none; border: 1px solid var(--primary); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn svg { width: 18px; height: 18px; }
.btn--ghost { background: var(--surface); color: var(--primary-dark); border-color: var(--border); }
.btn--ghost:hover { background: var(--soft); color: var(--primary-dark); border-color: var(--primary); }
.btn--sm { height: 44px; padding: 0 14px; font-size: .875rem; }
@media (min-width: 900px) { .btn--sm { height: 38px; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.empty h3 { font-size: 1.25rem; margin-bottom: 8px; }
.empty p { color: var(--muted); }

/* Ticker page */
.page-head { background: linear-gradient(180deg, var(--soft) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); padding: 20px 0 28px; }
.crumbs { font-size: .875rem; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); }
.company { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.company__id h1 { font-size: clamp(1.5rem, 5vw, 2.25rem); }
.company__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; color: var(--muted); font-size: .9375rem; }
.company__market { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px 32px; padding-top: 4px; }
.company__market strong { display: block; font: 700 1.375rem/1.2 var(--serif); }
.company__market small { font-size: .75rem; }
.company__market > div > strong { display: inline; }
.company__market > div > .kpi-label { display: block; }
.kpi-label { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

.ticker-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 24px; padding-bottom: 56px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel h2 { font-size: 1.25rem; }
.prose { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.7; color: #26354a; }
.prose p:last-child { margin-bottom: 0; }
/* Summary clamp (enabled by JS only; without JS the full text stays visible). */
.prose.is-clamped { max-height: calc(1.7em * 6); overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
.clamp-toggle { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--primary-dark); font: 600 .9375rem/1 var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.clamp-toggle:hover { color: var(--primary); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.tile { min-width: 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.tile--hero { grid-column: 1 / -1; background: var(--soft); }
.tile__value { font: 700 1.75rem/1.1 var(--serif); }
.tile__value--text { font-size: 1.25rem; }
.tile__note { font-size: .8125rem; color: var(--muted); }
.dots { display: flex; gap: 4px; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: #e0e8e2; }
.dots i.on { background: var(--primary); }
.risk--low { color: var(--buy); }
.risk--medium { color: var(--hold); }
.risk--high { color: var(--sell); }

.iv { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 12px; }
.iv__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "track delta"; gap: 4px 12px; align-items: center; }
.iv__label { grid-area: label; font-weight: 600; font-size: .9375rem; }
.iv__value { grid-area: value; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.iv__track { grid-area: track; height: 10px; border-radius: 999px; background: #edf2ee; overflow: hidden; }
.iv__fill { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.iv__delta { grid-area: delta; font-size: .8125rem; font-weight: 600; text-align: right; min-width: 64px; font-variant-numeric: tabular-nums; }
.iv__row--price .iv__fill { background: var(--ink); }
.iv__row--price .iv__label { color: var(--muted); }
.iv__row.is-up .iv__delta { color: var(--buy); }
.iv__row.is-down .iv__delta { color: var(--sell); }
.iv__row.is-down .iv__fill { background: #d98b84; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.timeline__item:first-child { border-top: 0; padding-top: 4px; }
.timeline__main { display: flex; flex-direction: column; min-width: 0; }
.timeline__main time { font-weight: 600; }
.timeline__actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

/* Viewer */
.is-viewer, .viewer-body { height: 100%; }
.is-viewer { overflow: hidden; }
.viewer-body { display: flex; flex-direction: column; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; background: #fff; }
.viewer-bar { flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 1px 6px rgba(30, 43, 60, .06); }
.viewer-bar__back { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 44px; height: 44px; padding: 0 6px 0 2px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .9375rem; }
.viewer-bar__back:hover { background: var(--soft); color: var(--primary-dark); }
.viewer-bar__back svg { width: 22px; height: 22px; }
.viewer-bar__brand { display: none; }
.viewer-bar__brand img { display: block; }
.viewer-bar .btn--sm { height: 40px; padding: 0 12px; }
.viewer-bar .badge { display: none; }
.viewer-bar__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.viewer-bar__title strong { font-size: .9375rem; letter-spacing: .03em; }
.viewer-bar__title .muted { font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-frame { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.viewer-disclaimer { flex: none; margin: 0; padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); font-size: .6875rem; line-height: 1.4; color: var(--muted); text-align: center; background: var(--soft); border-top: 1px solid var(--border); }
.hide-sm { display: none; }

/* Error page */
.error-page { padding: 72px 0 96px; text-align: center; }
.error-page__inner { display: flex; flex-direction: column; align-items: center; }
.error-page__code { font: 700 clamp(4rem, 18vw, 7rem)/1 var(--serif); color: var(--primary); margin: 0 0 8px; opacity: .9; }
.error-page h1 { font-size: 1.75rem; }
.error-page .actions { justify-content: center; }

/* Footer */
.site-footer { flex: none; background: var(--ink); color: #d5dce5; padding: 28px 0; font-size: .875rem; }
.site-footer__inner { display: grid; gap: 10px; }
.site-footer p { margin: 0; }
.site-footer strong { color: #fff; }
.copyright { color: #aab4c0; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: minmax(0, 1fr) 200px; }
  .chips { grid-column: 1 / -1; flex-wrap: wrap; overflow: visible; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile--hero { grid-column: 1 / -1; }
  .timeline__item { grid-template-columns: minmax(0, 1fr) auto auto; }
  .timeline__actions { grid-column: auto; }
  .hide-sm { display: inline; }
  .viewer-bar__brand { display: block; }
  .viewer-bar .badge { display: inline-flex; }
  .viewer-bar { padding: 0 20px; gap: 14px; }
  .iv__row { grid-template-columns: 110px minmax(0, 1fr) 110px 72px; grid-template-areas: "label track value delta"; }
}
@media (min-width: 900px) {
  :root { --gutter: 24px; }
  .hero__inner { padding-top: 56px; padding-bottom: 48px; }
  .pillars { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: minmax(240px, 1fr) 200px auto; align-items: center; }
  .chips { grid-column: auto; }
  .company { grid-template-columns: auto minmax(0, 1fr) auto; }
  .company__market { grid-column: auto; text-align: right; justify-content: flex-end; }
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tile--hero { grid-column: auto; }
}
@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn, .chip span { transition: none; }
  .card:hover { transform: none; }
}
@media print {
  .site-header, .site-footer, .toolbar, .actions { display: none; }
}
