/* ============================================================
   Research section: "markets / trading terminal" theme.
   Shared by the research hub (research.html) and each paper's
   detail page (research-*.html). Loaded AFTER styles.css, so it
   reuses the nav, footer, and base tokens, then intentionally
   breaks the monochrome palette with up/down colour.
   ============================================================ */

:root {
  --up: #35d69a;
  --up-rgb: 53, 214, 154;
  --down: #ff6b6b;
  --down-rgb: 255, 107, 107;
  --flat: #e6b25a;
  --panel: #0d0e11;
  --panel-2: #121318;
  --grid-line: rgba(255, 255, 255, 0.055);
}

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.mono { font-family: var(--font-display); }

/* ---- Ticker tape (full-bleed, scrolling) ---- */
.ticker {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  overflow: hidden;
  white-space: nowrap;
}
.ticker__row {
  display: inline-flex;
  gap: 44px;
  padding: 12px 22px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  animation: tickerScroll 42s linear infinite;
  will-change: transform;
}
.ticker:hover .ticker__row { animation-play-state: paused; }
.ticker__item { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); }
.ticker__sym { color: var(--heading); font-weight: 700; letter-spacing: 0.02em; }
.ticker__px { color: var(--text-dim); }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- Hero ---- */
.rsrch-hero { padding: clamp(38px, 6vw, 74px) 0 22px; }
.rsrch-hero .eyebrow { color: var(--up); }
.rsrch-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  letter-spacing: -0.03em;
  line-height: 0.98;
  color: var(--heading);
}
.rsrch-title--paper { font-size: clamp(2rem, 5.2vw, 3.4rem); line-height: 1.06; }
.rsrch-lead { color: var(--text-dim); max-width: 640px; margin-top: 20px; font-size: 1.12rem; }
.rsrch-byline { margin-top: 18px; font-size: 0.82rem; color: var(--text-dim); letter-spacing: 0.02em; }

/* ---- Back link (detail pages) ---- */
.rsrch-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 0.78rem;
  color: var(--text-dim); margin-bottom: 22px;
  transition: color var(--transition);
}
.rsrch-back:hover { color: var(--up); }

/* ---- Buttons ---- */
.rsrch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; }
.rsrch-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.86rem;
  padding: 13px 24px; border-radius: 999px;
  background: var(--up); color: #06110d;
  transition: transform var(--transition), box-shadow var(--transition);
}
.rsrch-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(var(--up-rgb), 0.25); }
.rsrch-btn--ghost { background: transparent; color: var(--up); border: 1px solid rgba(var(--up-rgb), 0.45); }
.rsrch-btn--ghost:hover { box-shadow: none; border-color: var(--up); }

/* ---- Section label ---- */
.section-label {
  font-family: var(--font-display); font-size: 0.76rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim); margin: 56px 0 18px;
}

/* ============================================================
   Hub page
   ============================================================ */

/* ---- Market stat tiles ---- */
.mkt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 42px; }
.mkt-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 20px 22px;
  overflow: hidden;
}
.mkt-tile::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--up); opacity: 0.8;
}
.mkt-tile.is-down::after { background: var(--down); }
.mkt-tile__label { font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-dim); }
.mkt-tile__val { font-family: var(--font-display); font-weight: 800; font-size: 2.1rem; color: var(--heading); margin-top: 8px; line-height: 1; }
.mkt-tile__chg { font-family: var(--font-display); font-size: 0.82rem; margin-top: 9px; display: flex; align-items: center; gap: 6px; }

/* ---- Terminal panel ---- */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
}
.panel__live { display: inline-flex; align-items: center; gap: 8px; }
.panel__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 10px var(--up); animation: pulseDot 2s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- Paper log table ---- */
.watchlist { width: 100%; border-collapse: collapse; }
.watchlist th {
  text-align: left; font-family: var(--font-display);
  font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 500;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
}
.watchlist th.num, .watchlist td.num { text-align: right; }
.watchlist td { padding: 18px 22px; border-bottom: 1px solid var(--grid-line); vertical-align: middle; }
.watchlist tbody tr:last-child td { border-bottom: none; }
.watchlist tbody tr { transition: background var(--transition); }
.watchlist tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.wl-sym { font-family: var(--font-display); font-weight: 700; color: var(--heading); }
.wl-title { color: var(--text); font-weight: 500; }
.wl-field { color: var(--text-dim); font-size: 0.85rem; margin-top: 3px; }
.chg-chip { font-family: var(--font-display); font-weight: 700; font-size: 0.82rem; padding: 4px 10px; border-radius: 7px; white-space: nowrap; }
.chg-chip.up { background: rgba(var(--up-rgb), 0.12); color: var(--up); }
.chg-chip.down { background: rgba(var(--down-rgb), 0.12); color: var(--down); }
.wl-open {
  font-family: var(--font-display); font-size: 0.78rem; color: var(--text-dim);
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.wl-open:hover { color: var(--up); border-color: rgba(var(--up-rgb), 0.5); }

/* ---- Featured paper cards ---- */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 20px; }
.feat-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 30px 32px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.feat-card:hover { transform: translateY(-5px); border-color: rgba(var(--up-rgb), 0.4); box-shadow: var(--shadow); }
.feat-card__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.feat-card__sym { font-family: var(--font-display); font-weight: 700; color: var(--heading); letter-spacing: 0.02em; }
.feat-card__spark { width: 100%; height: 54px; display: block; margin: 18px 0; color: var(--up); }
.feat-card--down .feat-card__spark { color: var(--down); }
.feat-card--down:hover { border-color: rgba(var(--down-rgb), 0.4); }
.feat-card__title { font-family: var(--font-display); font-weight: 700; color: var(--heading); font-size: 1.3rem; margin-bottom: 10px; }
.feat-card__abs { color: var(--text-dim); font-size: 0.94rem; max-width: 62ch; }
.feat-card__more { display: inline-block; margin-top: 18px; font-family: var(--font-display); font-size: 0.82rem; color: var(--up); }

/* ---- Empty slot (room for future papers) ---- */
.slot-note {
  margin-top: 18px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  padding: 20px; color: var(--text-dim);
  font-family: var(--font-display); font-size: 0.8rem;
}

/* ============================================================
   Paper detail page
   ============================================================ */

/* ---- Overview ---- */
.overview {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 30px 32px;
}
.overview p { color: var(--text-dim); margin-bottom: 16px; }
.overview p:last-child { margin-bottom: 0; }
.overview__thesis { border-left: 2px solid rgba(var(--up-rgb), 0.5); padding-left: 18px; }
.overview__thesis strong { color: var(--heading); }

/* ---- Key point cards ---- */
.kp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.kp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 26px 28px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.kp-card:hover { transform: translateY(-5px); border-color: rgba(var(--up-rgb), 0.35); box-shadow: var(--shadow); }
.kp-card__stat { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em; }
.kp-card__stat.up { color: var(--up); }
.kp-card__stat.down { color: var(--down); }
.kp-card__title { font-family: var(--font-display); font-weight: 700; color: var(--heading); font-size: 1.02rem; margin: 12px 0 10px; }
.kp-card__body { color: var(--text-dim); font-size: 0.9rem; }

/* ---- Full paper call to action ---- */
.paper-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 22px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--up);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 28px 32px;
}
.paper-cta__meta { flex: 1 1 260px; min-width: 0; }
.paper-cta__title { font-family: var(--font-display); font-weight: 700; color: var(--heading); font-size: 1.08rem; }
.paper-cta__sub { margin-top: 8px; font-size: 0.78rem; color: var(--text-dim); letter-spacing: 0.02em; }
.paper-cta__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---- Disclaimer ---- */
.disclaimer {
  margin-top: 34px;
  border: 1px solid var(--border);
  border-left: 3px solid rgba(230, 178, 90, 0.6);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  color: var(--text-dim);
  font-size: 0.83rem;
  line-height: 1.65;
  background: rgba(230, 178, 90, 0.035);
}
.disclaimer strong { color: var(--flat); }

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .mkt-stats { grid-template-columns: repeat(2, 1fr); }
  .kp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .watchlist .wl-hide { display: none; }
  .watchlist th, .watchlist td { padding: 14px 16px; }

  /* The row is wider than a phone once the thesis chip and button are in it,
     and body has overflow-x hidden, so it would be clipped rather than
     scrollable. Stack each row into a card instead. */
  .watchlist thead { display: none; }
  .watchlist, .watchlist tbody, .watchlist tr, .watchlist td { display: block; width: 100%; }
  .watchlist tr { padding: 18px 18px 20px; border-bottom: 1px solid var(--grid-line); }
  .watchlist tbody tr:last-child { border-bottom: none; }
  .watchlist td { padding: 0; border: none; }
  .watchlist td.num { text-align: left; }
  .watchlist td + td { margin-top: 12px; }
  .chg-chip { display: inline-block; white-space: normal; }
  .wl-open { display: block; text-align: center; padding: 12px 16px; }
  .overview, .kp-card, .feat-card, .paper-cta { padding: 22px 20px; }
  .paper-cta__actions { width: 100%; }
  .paper-cta__actions .rsrch-btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 480px) {
  /* Long values such as "Valuation" overflow a half-width tile at 2.1rem,
     and the tile clips its overflow, so scale the type down here. */
  .mkt-stats { gap: 12px; }
  .mkt-tile { padding: 16px 16px; }
  .mkt-tile__val { font-size: 1.35rem; overflow-wrap: anywhere; }
  .mkt-tile__chg, .mkt-tile__label { font-size: 0.68rem; }
  .rsrch-actions .rsrch-btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 380px) {
  /* "Valuation" is the longest tile value and still breaks mid-word above. */
  .mkt-tile__val { font-size: 1.15rem; }
}
