/* ---------- tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f5f7;
  --text: #1c2024;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 6px 16px rgba(16, 24, 40, 0.1);
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; }

.site-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.3;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-soft); }

/* ---------- home: search + filter ---------- */
.home-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.search-wrap { position: relative; flex: 1; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
  pointer-events: none;
}
#q {
  width: 100%;
  padding: 13px 16px 13px 42px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
#q:focus { border-color: var(--accent); background: #fff; }

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.dropdown { position: relative; }
.caret { font-size: 10px; color: var(--text-muted); }
.dropdown-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
}
.tag-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}
.tag-check:hover { background: var(--bg-soft); }
.clear-tags {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.result-count { color: var(--text-muted); font-size: 13px; margin: 0; }

/* ---------- card grid ---------- */
.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card a {
  display: block;
  color: inherit;
  padding: 0 0 16px;
}
.card a:hover { text-decoration: none; }
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 132px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg,
    hsl(var(--seed) 62% 58%), hsl(calc(var(--seed) + 28) 58% 46%));
}
/* every logo image fills its tile edge-to-edge — same treatment on the
   home cards and the company page, so they all read as one size */
.logo.has-img { background: #fff; }
.logo.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.card-name {
  display: block;
  padding: 14px 16px 0;
  font-weight: 650;
  font-size: 16px;
}
.card-ticker {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  margin-left: 6px;
}
.card-cap {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}
.card-cap::before {
  content: "\00b7";
  margin: 0 4px;
  color: var(--border-strong);
}
.up-to-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.no-results { color: var(--text-muted); padding: 24px 0; }

/* ---------- page top (subpages) ---------- */
.page-top { margin-bottom: 24px; }

/* ---------- company page ---------- */
.company-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.logo-lg {
  flex: none;
  width: 92px;
  height: 92px;
  border-radius: 16px;
  font-size: 30px;
}
.company-head h1 { margin: 0 0 8px; font-size: 28px; }
.ticker-pill {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.lede { margin: 0; color: var(--text); font-size: 16px; max-width: 68ch; }

/* facts list */
dl.facts { margin: 0 0 32px; }
dl.facts > div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}
dl.facts dt { color: var(--text-muted); font-size: 14px; }
dl.facts dd { margin: 0; font-size: 15px; }

/* hot takes */
.hot-takes { margin: 0 0 32px; }
.hot-takes h2, .sheet h2, .quarterly h2 { font-size: 19px; margin: 0 0 12px; }
.hot-takes p { margin: 0 0 12px; max-width: 72ch; }
.commentary-byline {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* google sheet */
.sheet { margin: 0 0 32px; }
.sheet-embed {
  width: 100%;
  height: 520px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

/* quarterly */
.quarterly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.qfilter { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.qfilter select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}
.note { color: var(--text-muted); font-size: 13px; margin: 6px 0 20px; }
section.q {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
section.q h3 { margin: 0 0 2px; font-size: 16px; }
.q-date { margin: 0 0 10px; color: var(--text-muted); font-size: 13px; }
section.q ul { margin: 0; padding-left: 20px; }
section.q li { margin: 4px 0; }

/* ---------- about ---------- */
.about h1 { font-size: 28px; margin: 0 0 18px; }
.about > p { max-width: 68ch; margin: 0 0 14px; }
.photo-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 28px;
}
.photo { margin: 0; }
.photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.photo-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.photo figcaption { margin-top: 8px; font-size: 13px; color: var(--text-muted); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .home-top { flex-wrap: wrap; }
  .about-link { width: 100%; text-align: center; }
  dl.facts > div { grid-template-columns: 1fr; gap: 2px; }
  .company-head { gap: 14px; }
  .logo-lg { width: 66px; height: 66px; font-size: 22px; }
}
