/* =============================================================================
   THE MASTHEAD — standard topic page redesign (design_handoff_topic_pages
   1a team / 1c player, one shell). Banner -> profile circle + 44px name +
   facts -> fact band (2px ink stack rules) -> underline tab bar -> native
   Home tab bands. Loads AFTER the topic retrofit stack and owns the page
   chrome; tab CONTENT styling stays with the existing sheets.
   Dark base; light values (the spec) at the end.
   ============================================================================= */

.tpm { padding: 24px 40px 56px; }
.page-topic main.container { max-width: 100%; width: 100%; padding-left: 0; padding-right: 0; }
@media (max-width: 900px) { .tpm { padding: 18px 20px 48px; } }

/* ---- banner + masthead row ---- */
.tpm-banner {
  height: 230px; border-radius: 16px; overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.tpm-banner img,
.tpm .tpm-banner img { width: 100%; height: 100%; object-fit: cover; display: block; background: transparent; }
.tpm-row {
  display: flex; align-items: flex-end; gap: 22px;
  margin: -44px 0 0; padding: 0 28px; position: relative;
}
.tpm-avatar,
.tpm .tpm-avatar img {
  width: 112px; height: 112px; border-radius: 50%; flex: none;
}
.tpm-avatar {
  overflow: hidden; border: 4px solid #14171b; background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.tpm .tpm-avatar img { border: none; object-fit: contain; background: #fff; padding: 8px; box-sizing: border-box; }
.tpm-avatar-blank { font-size: 34px; font-weight: 800; color: rgba(16, 20, 24, 0.55); }
.tpm-id { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; min-width: 0; flex: 1; }
.tpm-name { margin: 0; font-size: 44px; font-weight: 850; letter-spacing: -1.2px; line-height: 1; color: #fff; }
.tpm-facts {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.tpm-facts i { font-style: normal; color: rgba(255, 255, 255, 0.35); }
.tpm-facts a { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.tpm-facts a:hover { text-decoration: underline; text-underline-offset: 2px; }
.tpm-facts a img,
.tpm .tpm-facts a img { width: 14px; height: 14px; object-fit: contain; background: transparent !important; border-radius: 0 !important; }
.tpm-actions { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; flex: none; }
.tpm-follow {
  display: inline-flex !important; align-items: center; height: 36px; width: auto !important;
  margin: 0 !important; padding: 0 20px !important;
  border: 0 !important; border-radius: 999px !important;
  background: #e9edf2 !important; color: #0b0d10 !important;
  font-size: 13px !important; font-weight: 700; font-family: inherit;
  line-height: 1 !important; white-space: nowrap; cursor: pointer; box-shadow: none !important;
}
.tpm-follow:hover { background: #fff !important; }
.tpm-follow.is-on { background: transparent !important; border: 1px solid rgba(255, 255, 255, 0.4) !important; color: #fff !important; }
.tpm-iconbtn {
  display: inline-flex !important; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none; margin: 0 !important; padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important; border-radius: 999px !important;
  background: transparent !important; color: rgba(255, 255, 255, 0.8) !important;
  cursor: pointer; box-shadow: none !important;
}
.tpm-iconbtn:hover { border-color: rgba(255, 255, 255, 0.6) !important; color: #fff !important; }
.tpm-iconbtn.is-copied { border-color: #47c47d !important; color: #47c47d !important; }
.topic-admin-controls { display: flex; align-items: center; gap: 8px; }
@media (max-width: 860px) {
  .tpm-row { flex-wrap: wrap; }
  .tpm-name { font-size: 32px; letter-spacing: -0.8px; }
  .tpm-avatar, .tpm .tpm-avatar img { width: 88px; height: 88px; }
}

/* ---- fact band ---- */
.tpm-band { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; margin: 24px 0 0; }
.tpm-slot { border-top: 2px solid #e9edf2; padding-top: 10px; min-width: 0; }
.tpm-slot-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.tpm-slot-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tpm-slot-value {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px; color: #fff;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tpm-slot-value.is-sm { font-size: 20px; }
.tpm-slot-suffix { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpm-slot-suffix.is-up { color: #47c47d; font-weight: 700; }
.tpm-slot-suffix.is-down { color: #e5595b; font-weight: 700; }
.tpm-slot-suffix.is-meta { color: rgba(255, 255, 255, 0.62); }
@media (max-width: 900px) { .tpm-band { grid-template-columns: 1fr 1fr; gap: 18px; } }

/* ---- tab bar (the system, restyled: underline tabs) ---- */
.tpm .portfolio-tabs {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  margin: 26px 0 0; padding: 0;
  border: none; border-radius: 0; background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.tpm .portfolio-tab {
  display: inline-flex !important; align-items: center; gap: 7px;
  width: auto !important; margin: 0 0 -1px 0 !important;
  padding: 11px 16px 12px !important;
  border: none !important; border-bottom: 2px solid transparent !important;
  border-radius: 0 !important; background: transparent !important;
  color: rgba(255, 255, 255, 0.62) !important;
  font-size: 13.5px !important; font-weight: 600; font-family: inherit;
  line-height: 1.3 !important; white-space: nowrap; cursor: pointer; box-shadow: none !important;
}
.tpm .portfolio-tab svg { display: none; }   /* the masthead bar is text-only */
.tpm .portfolio-tab:hover { color: #fff !important; }
.tpm .portfolio-tab.active {
  color: #fff !important; font-weight: 800;
  border-bottom-color: #e9edf2 !important;
}
.tpm .portfolio-tab .tab-menu-trigger { color: rgba(255, 255, 255, 0.45); }
.tpm .portfolio-tab.add-tab-btn { color: rgba(255, 255, 255, 0.5) !important; }

/* ---- native Home tab ---- */
.tpm-home { padding-top: 26px; }
.tpm-shead.si-shead { margin-bottom: 14px; }
.tpm-goto {
  margin: 0 !important; padding: 0 !important; border: none !important;
  width: auto !important; background: transparent !important; box-shadow: none !important;
  font-size: 13px !important; font-weight: 600; font-family: inherit;
  color: #fff !important; cursor: pointer; white-space: nowrap;
}
.tpm-goto:hover { text-decoration: underline; text-underline-offset: 2px; }

.tpm-lead { display: grid; grid-template-columns: 1fr 1.15fr; gap: 32px; align-items: stretch; margin: 0 0 36px; }
.tpm-lead.is-stories-only { grid-template-columns: 1fr; }
.tpm-featured { display: flex; flex-direction: column; min-width: 0; }
.tpm-feat-title {
  display: block; margin: 0 0 10px;
  font-size: 26px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.15;
  color: #fff; text-decoration: none;
}
.tpm-feat-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.tpm-feat-img {
  position: relative; display: block; flex: 1; min-height: 300px;
  border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, 0.06);
}
.tpm-feat-img img,
.tpm .tpm-feat-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.tpm-stories { display: flex; flex-direction: column; min-width: 0; }
.tpm-story-list { flex: 1; display: flex; flex-direction: column; }
.tpm-story {
  flex: 1; display: grid; grid-template-columns: 18px 118px minmax(0, 1fr);
  column-gap: 16px; align-items: center; padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  text-decoration: none; color: inherit;
}
.tpm-story-rank { text-align: center; font-size: 15px; font-weight: 800; color: rgba(255, 255, 255, 0.35); font-variant-numeric: tabular-nums; }
.tpm-story-thumb {
  position: relative; width: 118px; height: 76px; border-radius: 10px; overflow: hidden;
  background: rgba(255, 255, 255, 0.06); flex: none;
  display: flex; align-items: center; justify-content: center;
}
.tpm-story-thumb img,
.tpm .tpm-story-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.tpm-story-thumb img.is-blank,
.tpm .tpm-story-thumb img.is-blank { position: static; width: 18px; height: 18px; border-radius: 5px; opacity: 0.45; object-fit: contain; }
.tpm-story-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tpm-story-kicker {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}
.tpm-story-title { font-size: 15.5px; font-weight: 800; letter-spacing: -0.2px; line-height: 1.28; color: #fff; }
.tpm-story:hover .tpm-story-title { text-decoration: underline; text-underline-offset: 2px; }

.tpm-sec { margin: 0 0 36px; }

/* schedule strip */
.tpm-sched { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.tpm-sched::-webkit-scrollbar { display: none; }
.tpm-sched-slot {
  flex: 1 0 auto; display: flex; flex-direction: column; gap: 7px;
  padding: 16px 18px 14px; min-width: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}
.tpm-sched-slot:first-child { padding-left: 0; }
.tpm-sched-slot:last-child { border-right: none; padding-right: 0; }
.tpm-sched-when { font-size: 9.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); }
.tpm-sched-opp { display: flex; align-items: center; gap: 8px; }
.tpm-sched-opp img,
.tpm .tpm-sched-opp img { width: 20px; height: 20px; flex: none; object-fit: contain; background: transparent !important; border-radius: 0 !important; }
.tpm-sched-opp b { font-size: 14px; font-weight: 800; color: #fff; white-space: nowrap; }
.tpm-sched-res { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tpm-sched-res.is-up { color: #47c47d; }
.tpm-sched-res.is-down { color: #e5595b; }
.tpm-sched-res.is-meta { color: rgba(255, 255, 255, 0.62); }

/* game log */
.tpm-log-wrap { overflow-x: auto; }
.tpm-log-row {
  display: grid; column-gap: 12px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); min-width: 640px;
  font-variant-numeric: tabular-nums;
}
.tpm-log-head {
  padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 10px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.tpm-num { text-align: right; }
.tpm-log-wk { font-size: 12.5px; font-weight: 800; color: rgba(255, 255, 255, 0.35); }
.tpm-log-opp { font-size: 13.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpm-log-res { font-size: 12.5px; font-weight: 700; }
.tpm-log-res.is-up { color: #47c47d; }
.tpm-log-res.is-down { color: #e5595b; }
.tpm-log-res.is-meta { color: rgba(255, 255, 255, 0.62); }
.tpm-log-lead { font-size: 13.5px; font-weight: 800; color: #fff; }
.tpm-log-stat { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.72); }

/* community cards */
.tpm-comm { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tpm-post {
  display: flex; flex-direction: column; gap: 9px; padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 14px;
  text-decoration: none; color: inherit; min-width: 0;
}
.tpm-post-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tpm-type {
  display: inline-block; padding: 2px 8px; border: 1px solid rgba(0, 168, 255, 0.45);
  border-radius: 999px; font-size: 9.5px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: #00a8ff; white-space: nowrap;
}
.tpm-post-date { font-size: 11px; color: rgba(255, 255, 255, 0.5); white-space: nowrap; }
.tpm-post-title { font-size: 15.5px; font-weight: 800; letter-spacing: -0.2px; line-height: 1.3; color: #fff; }
.tpm-post:hover .tpm-post-title { text-decoration: underline; text-underline-offset: 2px; }
.tpm-post-author { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.tpm-post-av {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); font-size: 9px; font-weight: 800; color: rgba(255, 255, 255, 0.8);
}
.tpm-post-author b { font-size: 12.5px; font-weight: 700; color: #fff; }
@media (max-width: 980px) {
  .tpm-lead { grid-template-columns: 1fr; }
  .tpm-comm { grid-template-columns: 1fr; }
}

/* restyle the built-in tab headers to the shead voice */
.tpm .topic-tab-header { margin: 22px 0 6px; }
.tpm .topic-tab-header-title {
  margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 1.4px;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.8);
}
.tpm .topic-tab-header-desc { margin: 4px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.62); }

/* =============================================================================
   LIGHT MODE — the spec values.
   ============================================================================= */
html.si-light body.si-themed .tpm-banner { background: rgba(16, 20, 24, 0.06); }
html.si-light body.si-themed .tpm-avatar { border-color: #eceef1; box-shadow: 0 6px 20px rgba(16, 20, 24, 0.15); }
html.si-light body.si-themed .tpm-avatar-blank { color: rgba(16, 20, 24, 0.55); background: rgba(16, 20, 24, 0.08); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
html.si-light body.si-themed .tpm-name { color: #101418; }
html.si-light body.si-themed .tpm-facts { color: rgba(16, 20, 24, 0.65); }
html.si-light body.si-themed .tpm-facts i { color: rgba(16, 20, 24, 0.4); }
html.si-light body.si-themed .tpm-follow { background: #101418 !important; color: #fff !important; }
html.si-light body.si-themed .tpm-follow:hover { background: #000 !important; }
html.si-light body.si-themed .tpm-follow.is-on { background: transparent !important; border: 1px solid rgba(16, 20, 24, 0.45) !important; color: #101418 !important; }
html.si-light body.si-themed .tpm-iconbtn { border-color: rgba(16, 20, 24, 0.35) !important; color: rgba(16, 20, 24, 0.78) !important; }
html.si-light body.si-themed .tpm-iconbtn:hover { border-color: rgba(16, 20, 24, 0.6) !important; color: #101418 !important; }
html.si-light body.si-themed .tpm-iconbtn.is-copied { border-color: #16a34a !important; color: #16a34a !important; }
html.si-light body.si-themed .tpm-slot { border-top-color: #101418; }
html.si-light body.si-themed .tpm-slot-label { color: rgba(16, 20, 24, 0.65); }
html.si-light body.si-themed .tpm-slot-value { color: #101418; }
html.si-light body.si-themed .tpm-slot-suffix.is-up { color: #16a34a; }
html.si-light body.si-themed .tpm-slot-suffix.is-down { color: #dc2626; }
html.si-light body.si-themed .tpm-slot-suffix.is-meta { color: rgba(16, 20, 24, 0.65); }
html.si-light body.si-themed .tpm .portfolio-tabs { border-bottom-color: rgba(16, 20, 24, 0.35); }
html.si-light body.si-themed .tpm .portfolio-tab { color: rgba(16, 20, 24, 0.65) !important; }
html.si-light body.si-themed .tpm .portfolio-tab:hover { color: #101418 !important; }
html.si-light body.si-themed .tpm .portfolio-tab.active { color: #101418 !important; border-bottom-color: #101418 !important; }
html.si-light body.si-themed .tpm-goto { color: #101418 !important; }
html.si-light body.si-themed .tpm-feat-title { color: #101418; }
html.si-light body.si-themed .tpm-feat-img { background: rgba(16, 20, 24, 0.06); }
html.si-light body.si-themed .tpm-story { border-top-color: rgba(16, 20, 24, 0.2); }
html.si-light body.si-themed .tpm-story-rank { color: rgba(16, 20, 24, 0.3); }
html.si-light body.si-themed .tpm-story-thumb { background: rgba(16, 20, 24, 0.06); }
html.si-light body.si-themed .tpm-story-kicker { color: rgba(16, 20, 24, 0.78); }
html.si-light body.si-themed .tpm-story-title { color: #101418; }
html.si-light body.si-themed .tpm-sched-slot { border-right-color: rgba(16, 20, 24, 0.2); }
html.si-light body.si-themed .tpm-sched-when { color: rgba(16, 20, 24, 0.55); }
html.si-light body.si-themed .tpm-sched-opp b { color: #101418; }
html.si-light body.si-themed .tpm-sched-res.is-up { color: #16a34a; }
html.si-light body.si-themed .tpm-sched-res.is-down { color: #dc2626; }
html.si-light body.si-themed .tpm-sched-res.is-meta { color: rgba(16, 20, 24, 0.65); }
html.si-light body.si-themed .tpm-log-row { border-bottom-color: rgba(16, 20, 24, 0.16); }
html.si-light body.si-themed .tpm-log-head { border-bottom-color: rgba(16, 20, 24, 0.35); color: rgba(16, 20, 24, 0.65); }
html.si-light body.si-themed .tpm-log-wk { color: rgba(16, 20, 24, 0.35); }
html.si-light body.si-themed .tpm-log-opp,
html.si-light body.si-themed .tpm-log-lead { color: #101418; }
html.si-light body.si-themed .tpm-log-res.is-up { color: #16a34a; }
html.si-light body.si-themed .tpm-log-res.is-down { color: #dc2626; }
html.si-light body.si-themed .tpm-log-res.is-meta,
html.si-light body.si-themed .tpm-log-stat { color: rgba(16, 20, 24, 0.72); }
html.si-light body.si-themed .tpm-post { border-color: rgba(16, 20, 24, 0.38); }
html.si-light body.si-themed .tpm-type { color: #0084cc; }
html.si-light body.si-themed .tpm-post-date { color: rgba(16, 20, 24, 0.55); }
html.si-light body.si-themed .tpm-post-title { color: #101418; }
html.si-light body.si-themed .tpm-post-av { background: rgba(16, 20, 24, 0.08); color: rgba(16, 20, 24, 0.78); }
html.si-light body.si-themed .tpm-post-author b { color: #101418; }
html.si-light body.si-themed .tpm .topic-tab-header-title { color: rgba(16, 20, 24, 0.8); }
html.si-light body.si-themed .tpm .topic-tab-header-desc { color: rgba(16, 20, 24, 0.65); }
