/* my.specter.fit — the signed-in reading room.
   Identity carried over from specter.fit: near-black, emerald green primary,
   gold star accent, IBM Plex Sans. Data surfaces use IBM Plex Mono, matching
   the field-log feel of the app and the admin console. Dependency-free
   except Leaflet on the one page that draws a cover route. */

:root {
  --bg:        #070908;
  --bg-elev:   #0f1311;
  --surface:   #121714;
  --hairline:  #20271f;
  --green:     #2fd072;
  --green-deep:#1f6f4e;
  --gold:      #d9a657;
  --danger:    #d96a57;
  --ink:       #e9ece8;
  --muted:     #8c948c;
  --max-w:     1080px;
  --narrow:    720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 12px; }
h1 { font-size: 34px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }

.mono { font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }

/* ---------- layout ---------- */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: var(--narrow); }
.wrap.center { text-align: center; }
.center-block { margin-left: auto; margin-right: auto; }
.section { padding: 56px 0; }
main { min-height: 60vh; }

.eyebrow {
  text-transform: uppercase; letter-spacing: 2px; font-size: 12px;
  font-weight: 700; color: var(--green); margin: 0 0 10px;
}
.lead { color: var(--muted); font-size: 19px; max-width: 62ch; }
.fineprint { color: var(--muted); font-size: 14px; line-height: 1.55; }
.crumb { font-size: 14px; margin-bottom: 18px; }
.page-head { margin-bottom: 28px; }

/* ---------- header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 400;
  background: rgba(7,9,8,0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  justify-content: space-between; height: 64px;
}
.brand { font-weight: 800; letter-spacing: 3px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; flex: 1; }
.nav a { color: var(--muted); font-size: 15px; }
.nav a:hover, .nav a.active { color: var(--ink); text-decoration: none; }
.nav a.active { box-shadow: inset 0 -2px 0 var(--green); padding-bottom: 2px; }
.signout { color: var(--muted); font-size: 14px; white-space: nowrap; }

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 36px 0; margin-top: 48px;
  color: var(--muted); font-size: 14px;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; margin: 8px 0 0; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 24px;
  margin: 0 0 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.accent-panel { border-left: 3px solid var(--green); }
.danger-panel { border-left: 3px solid var(--danger); }

/* The privacy statements. Gold rail — the same accent the app uses for the
   logo star — so "this is the guarantee" reads consistently across surfaces. */
.ghost-panel {
  border-left: 3px solid var(--gold);
  background: linear-gradient(180deg, rgba(217,166,87,0.05), transparent 60%), var(--surface);
}
.ghost-panel h2 { color: var(--gold); }

/* ---------- stats ---------- */
.stat-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.stat-grid.primary {
  background: var(--bg-elev); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 24px; margin-bottom: 20px;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); font-weight: 600;
}
.stat-value { font-size: 22px; font-weight: 600; }
.stat-grid.primary .stat-value { font-size: 28px; }

.summary-strip {
  display: flex; gap: 40px; flex-wrap: wrap;
  padding: 18px 0 24px; border-bottom: 1px solid var(--hairline); margin-bottom: 8px;
}

/* ---------- activity list ---------- */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 4px; border-bottom: 1px solid var(--hairline);
  color: inherit;
}
.activity-row:hover { text-decoration: none; background: var(--bg-elev); }
.activity-row h3 { margin: 6px 0 4px; }
.activity-meta { color: var(--muted); font-size: 14px; margin: 0; }
.activity-row-stats {
  display: grid; grid-template-columns: repeat(4, minmax(72px, auto));
  gap: 18px; text-align: right; font-size: 15px;
}

.pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--hairline); color: var(--muted);
}
.pill-green { color: var(--green); border-color: var(--green-deep); }
.pill-gold  { color: var(--gold); border-color: rgba(217,166,87,0.4); }
.cover-tag { color: var(--green); }
.private-tag { color: var(--gold); }
.done-tag { color: var(--green); font-size: 12px; font-weight: 700; }

/* ---------- map ---------- */

/* The hero map leads the activity page. Taller than the inline variant and
   edge-to-edge within the column, so the cover route reads as the subject of
   the page rather than an attachment to the stats. */
.map-hero { margin: 0 0 24px; padding: 0; }
.map-hero .map {
  height: 460px; margin: 0;
  border: 1px solid var(--hairline); border-bottom: none;
  border-radius: 12px 12px 0 0;
}
.map-hero figcaption {
  background: var(--surface);
  border: 1px solid var(--hairline); border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 16px 20px;
}
.map-caption-main {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 4px;
}
.map-hero figcaption p { margin: 0; }

.map { height: 380px; border-radius: 10px; overflow: hidden; background: var(--bg-elev); margin: 8px 0 12px; }
.map-pending {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; text-align: center; padding: 24px;
}
.leaflet-container { background: var(--bg-elev); }

/* The cities map is a survey view, so it sits shorter than the route hero. */
.cities-hero .map { height: 340px; }

/* Leaflet's popup chrome is light by default and would flash white against
   the near-black page. */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.leaflet-popup-content { margin: 14px 16px; font-family: inherit; }
.leaflet-popup-close-button { color: var(--muted) !important; }
.leaflet-tooltip {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); box-shadow: none;
}
.leaflet-tooltip::before { border-top-color: var(--hairline); }

.city-popup h4 { margin: 0 0 2px; font-size: 16px; }
.city-popup .popup-count {
  margin: 0 0 10px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.1px; font-weight: 600;
}
.city-popup ul { list-style: none; margin: 0; padding: 0; }
.city-popup li {
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 0; border-top: 1px solid var(--hairline);
}
.city-popup li span { font-size: 12px; color: var(--muted); }
.city-popup .popup-more { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--hairline);
}
td { padding: 10px; border-bottom: 1px solid var(--hairline); }
tbody tr:last-child td { border-bottom: none; }
.leaderboard .is-you { background: rgba(47,208,114,0.07); }
.you-tag { color: var(--green); font-size: 12px; font-weight: 700; }

/* ---------- training ---------- */
.plan-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.plan-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 20px; }
.plan-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.progress { height: 6px; background: var(--bg-elev); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.progress-fill { height: 100%; background: var(--green); }

.workout-list { list-style: none; margin: 0; padding: 0; }
.workout-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 0; border-bottom: 1px solid var(--hairline);
}
.workout-list li:last-child { border-bottom: none; }
.workout-list li.done strong { color: var(--muted); text-decoration: line-through; }
.workout-targets { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); white-space: nowrap; }
.workout-targets .sep { opacity: 0.45; }

/* ---------- community ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 0; border-bottom: 1px solid var(--hairline);
}
.feed-row:last-child { border-bottom: none; }
.feed-row.is-you { background: rgba(47,208,114,0.05); }
.feed-who { display: flex; align-items: center; gap: 12px; }
.feed-who p { margin: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700;
  background: var(--green-deep); color: var(--ink);
}
.feed-stats { display: flex; gap: 16px; font-size: 15px; white-space: nowrap; }

.challenge-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.challenge-card {
  display: block; background: var(--bg-elev); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 16px; color: inherit;
}
.challenge-card:hover { text-decoration: none; border-color: var(--green-deep); }
.challenge-card.focused { border-color: var(--green); }
.challenge-card p { margin: 4px 0 0; }

/* ---------- sign-in ---------- */
.signin-section { padding-top: 80px; }
.signin-buttons { display: flex; flex-direction: column; gap: 12px; max-width: 320px; margin: 28px auto 20px; }
.btn {
  display: inline-block; padding: 13px 22px; border-radius: 10px;
  background: var(--green); color: #06210f; font-weight: 700; text-align: center;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn-provider {
  background: var(--surface); color: var(--ink);
  border-color: var(--hairline); display: flex; align-items: center; gap: 12px;
  justify-content: center;
}
.btn-provider:hover { border-color: var(--green-deep); filter: none; }
.provider-mark { font-weight: 800; width: 18px; text-align: center; color: var(--muted); }
.cta-row { margin-top: 20px; }

.banner {
  background: var(--bg-elev); border: 1px solid var(--hairline);
  border-left: 3px solid var(--gold);
  border-radius: 8px; padding: 12px 16px; margin: 20px auto 0;
  font-size: 15px; max-width: 420px; text-align: left; color: var(--ink);
}

/* ---------- misc ---------- */
.empty {
  color: var(--muted); font-size: 15px; text-align: center;
  padding: 40px 20px; border: 1px dashed var(--hairline); border-radius: 10px;
}
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 24px 4px; font-size: 15px;
}
.splits tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  h1 { font-size: 27px; }
  .section { padding: 36px 0; }
  .site-header .wrap { gap: 12px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; gap: 16px; overflow-x: auto; padding-bottom: 4px; }
  .activity-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .activity-row-stats { grid-template-columns: repeat(4, 1fr); width: 100%; text-align: left; gap: 10px; }
  .feed-row, .workout-list li { flex-direction: column; align-items: flex-start; gap: 8px; }
  .summary-strip { gap: 24px; }
  .map { height: 280px; }
  /* Tables are the one thing that genuinely can't reflow — let them scroll
     inside their panel rather than forcing the page to scroll sideways. */
  .panel { overflow-x: auto; }
}
