/* ── TruePrint design system ─────────────────────────────────────────────
   Paper-and-ink editorial aesthetic. Fraunces for display, Inter for UI,
   JetBrains Mono for figures. One accent: press red. Category hues carry
   the color-coding load. */

:root {
  --paper: #f7f4ee;
  --paper-raised: #fffdf9;
  --paper-dim: #efeae0;
  --ink: #16130f;
  --ink-soft: #4d463c;
  --ink-faint: #877e70;
  --rule: #ddd5c7;
  --rule-dark: #16130f;
  --accent: #c8371e;          /* press red */
  --accent-soft: #fbe9e5;
  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(22, 19, 15, .06), 0 4px 14px rgba(22, 19, 15, .05);
  --shadow-hover: 0 2px 4px rgba(22, 19, 15, .08), 0 10px 28px rgba(22, 19, 15, .10);
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ── Masthead ──────────────────────────────────────────────────────────── */
.masthead {
  background: var(--paper);
  border-bottom: 2.5px solid var(--rule-dark);
  position: sticky;
  top: 0;
  z-index: 50;
}
.masthead-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 28px 14px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.brand-mark { width: 46px; height: 46px; }
.brand-text h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -0.5px;
  line-height: 1;
}
.brand-text h1::after { content: '.'; color: var(--accent); }
.tagline {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--ink-faint);
  margin-top: 3px;
  font-weight: 600;
}
/* Edition switch — Business / Science */
.edition-switch {
  display: flex;
  gap: 3px;
  background: var(--paper-dim);
  border-radius: 999px;
  padding: 3px;
  border: 1.5px solid var(--rule);
}
.edition-btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all .15s;
}
.edition-btn:hover { color: var(--ink); }
.edition-btn.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-card);
}
body.sci .edition-btn.active { background: #1e3a8a; }

.masthead-meta {
  margin-left: auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.masthead-date {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  font-style: italic;
  white-space: nowrap;
}
.masthead-stats { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.masthead-stats strong { color: var(--accent); font-weight: 700; }

.masthead-actions { display: flex; align-items: center; gap: 10px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-raised);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--ink-faint);
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--ink); color: var(--ink); }
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  width: 190px;
  color: var(--ink);
}
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s, transform .1s;
}
.refresh-btn:hover { background: var(--accent); }
.refresh-btn:active { transform: scale(.97); }
.refresh-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Category ribbon ───────────────────────────────────────────────────── */
.category-ribbon {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-ribbon::-webkit-scrollbar { display: none; }
.cat-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--rule);
  background: var(--paper-raised);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: all .15s;
}
.cat-chip:hover { border-color: var(--ink-soft); }
.cat-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.cat-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cat-chip .n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  font-weight: 600;
}
.cat-chip.active .n { color: rgba(247, 244, 238, .65); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.layout {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 28px 60px;
  display: grid;
  grid-template-columns: 1fr 292px;
  gap: 34px;
  align-items: start;
}

.feed-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.feed-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.feed-count { font-size: 12.5px; color: var(--ink-faint); font-family: var(--font-mono); }

/* ── Lead story ────────────────────────────────────────────────────────── */
.lead-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 26px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.lead-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.lead-media {
  min-height: 300px;
  background: var(--paper-dim);
  position: relative;
  overflow: hidden;
}
.lead-media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.lead-media .media-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.lead-body { padding: 28px 30px; display: flex; flex-direction: column; gap: 13px; }
.lead-body .headline {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.4px;
}
.lead-body .summary { font-size: 14.5px; color: var(--ink-soft); line-height: 1.6; }
.lead-kicker { display: flex; align-items: center; gap: 10px; }

/* ── Card grid ─────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 18px;
  align-items: start;
}
.story-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 19px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.story-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.story-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-color, var(--rule));
}
.card-top { display: flex; align-items: center; gap: 10px; }
.co-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: #fff;
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}
.co-monogram {
  width: 34px; height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  color: var(--paper);
}
.card-meta { min-width: 0; }
.card-company {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  font-size: 11px;
  color: var(--ink-faint);
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
}
.card-headline {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-summary {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-image {
  margin: -4px -19px 0;
  height: 140px;
  object-fit: cover;
  width: calc(100% + 38px);
  background: var(--paper-dim);
}

/* badges / chips */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--cat-color, var(--ink-soft));
}
.cat-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cat-color, var(--ink-faint)); }
.type-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--paper-dim);
  color: var(--ink-soft);
}
.type-badge.public { background: #e5edfb; color: #1d4ed8; }
.type-badge.startup { background: #e2f5ec; color: #047857; }
.type-badge.private { background: #f0ebfa; color: #6d28d9; }

.metric-row { display: flex; flex-wrap: wrap; gap: 6px; }
.metric-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--ink);
  color: var(--paper);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}
.ticker-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 2.5px 7px;
  color: var(--ink-soft);
  background: var(--paper);
}

.why-callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: #7c2d1c;
}
.why-callout strong {
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
}

.card-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-faint);
}
.card-foot .source { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot .read {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s;
}
.story-card:hover .card-foot .read, .lead-card:hover .read { opacity: 1; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 132px; }
.panel {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow-card);
}
.panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.type-toggle button {
  border: 1.5px solid var(--rule);
  background: var(--paper);
  border-radius: 7px;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all .15s;
}
.type-toggle button:hover { border-color: var(--ink-soft); }
.type-toggle button.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.sector-list { list-style: none; display: flex; flex-direction: column; }
.sector-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  padding: 7px 6px;
  font-size: 13px;
  color: var(--ink-soft);
  border-radius: 6px;
  transition: background .12s;
}
.sector-list button:hover { background: var(--paper-dim); }
.sector-list button.active { background: var(--ink); color: var(--paper); font-weight: 600; }
.sector-list .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.sector-list button.active .n { color: rgba(247,244,238,.6); }

.source-list { list-style: none; display: flex; flex-direction: column; }
.source-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 6px;
  font-size: 13px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
}
.source-list li:last-child { border-bottom: none; }
.source-list .s-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-list .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); flex-shrink: 0; margin-left: 8px; }

.movers-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.movers-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 6px;
  border-radius: 7px;
  text-align: left;
  transition: background .12s;
}
.movers-list button:hover { background: var(--paper-dim); }
.movers-list .co-logo, .movers-list .co-monogram { width: 28px; height: 28px; font-size: 12px; border-radius: 6px; }
.movers-list .m-name {
  font-size: 12.5px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movers-list .m-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--paper);
  background: var(--accent);
  border-radius: 999px;
  padding: 1.5px 7px;
  font-weight: 600;
}
.about-panel p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }
.about-panel p + p { margin-top: 8px; }
.about-panel .about-cut { color: var(--ink-faint); font-size: 11.5px; }

/* ── States ────────────────────────────────────────────────────────────── */
.load-more-wrap { display: flex; justify-content: center; margin-top: 26px; }
.load-more {
  border: 1.5px solid var(--ink);
  background: transparent;
  border-radius: 999px;
  padding: 10px 26px;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.load-more:hover { background: var(--ink); color: var(--paper); }

.empty-state { text-align: center; padding: 70px 0; color: var(--ink-faint); }
.empty-state button {
  margin-top: 12px;
  border: none;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
}
.loading-state { text-align: center; padding: 90px 0; color: var(--ink-faint); font-size: 14px; }
.press-spinner {
  width: 44px; height: 44px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

.site-footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 28px 34px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-hover);
  transition: transform .25s ease;
  z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .lead-card { grid-template-columns: 1fr; }
  .lead-media { min-height: 200px; }
}
@media (max-width: 1120px) {
  .masthead-meta { display: none; }
}
@media (max-width: 760px) {
  .masthead-inner { flex-wrap: wrap; gap: 12px; padding: 14px 16px 10px; }
  .masthead-actions { margin-left: auto; }
  .search-box input { width: 120px; }
  .layout { padding: 18px 16px 40px; }
  .category-ribbon { padding: 0 16px 10px; }
  .card-grid { grid-template-columns: 1fr; }
}
