/* Koeru — the homepage, search results, and (under profile.css) a runner's
 * page. All light: a directory of runs, every one on the same card.
 */

.home { display: block; }

/* --- shared ------------------------------------------------------------------ */

.btn-lg { height: 50px; padding: 0 22px; font-size: 16px; border-radius: 6px; }

.card-badge.is-live i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--k-signal);
  animation: home-pulse 2s var(--k-ease) infinite;
}
@keyframes home-pulse {
  0% { box-shadow: 0 0 0 0 rgb(255 212 0 / .6); }
  70%, 100% { box-shadow: 0 0 0 9px rgb(255 212 0 / 0); }
}

/* --- categories -------------------------------------------------------------- */

.browse { display: grid; gap: 40px; }
.cats {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cat-group { display: contents; }
.cat-group::before {
  content: ''; width: 1px; height: 20px; margin: 0 4px; background: var(--k-rule);
}
.cat {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--k-rule); color: var(--k-night);
  font-size: 14px; text-decoration: none; white-space: nowrap; font-variation-settings: 'wdth' 100, 'wght' 550;
}
.cat:hover { border-color: var(--k-granite); }
.cat.is-on { background: var(--k-night); border-color: var(--k-night); color: var(--k-snow); }

.card-lock {
  position: absolute; right: 10px; top: 10px; display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 4px; background: rgb(255 255 255 / .92);
  border: 1px solid var(--k-rule); color: var(--k-night); font-size: 12px;
}
.card-lock svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- body ------------------------------------------------------------------ */

.home-body { width: min(1200px, 100% - 48px); margin: 0 auto; padding: 56px 0 24px; display: grid; gap: 56px; }

.week { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.week-stat { display: grid; gap: 6px; padding: 22px 24px; background: #fff; border: 1px solid var(--k-rule); border-radius: 10px; }
.week-stat .label { font-size: 14px; color: var(--k-granite); }
.week-stat .value {
  font-size: 44px; line-height: 1; font-variation-settings: 'wdth' 88, 'wght' 700;
  font-feature-settings: 'tnum'; font-variant-numeric: tabular-nums;
}

.section { display: grid; gap: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-title { margin: 0; font-size: 34px; line-height: 1; font-variation-settings: 'wdth' 125, 'wght' 800; letter-spacing: -.01em; }
.more { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; text-decoration: none; font-variation-settings: 'wdth' 100, 'wght' 600; }
.more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.more:hover { color: var(--k-granite); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 32px; }
.run-card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: var(--k-night);
  background: #fff; border: 1px solid var(--k-rule); border-radius: 10px;
  transition: transform .2s var(--k-ease), box-shadow .2s var(--k-ease);
}
.run-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgb(19 28 46 / .1); }
.run-card-map {
  position: relative; aspect-ratio: 12 / 7; border-bottom: 1px solid var(--k-rule);
  background-color: #EDF1EE;
  background-image: radial-gradient(circle at 1px 1px, rgb(89 97 110 / .16) 1px, transparent 0);
  background-size: 18px 18px;
}
.run-card-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Hidden only once home.js has promised to draw it, so a page whose script
   never ran still shows every track. */
.run-card-map .draw { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s var(--k-ease); }
.will-draw .run-card-map:not(.is-drawn) .draw { stroke-dashoffset: 1; }
.card-badge, .card-time {
  position: absolute; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 4px; background: rgb(19 28 46 / .88); color: var(--k-snow); font-size: 12px;
}
.card-badge { left: 10px; top: 10px; }
.card-time { right: 10px; bottom: 10px; font-variation-settings: 'wdth' 88, 'wght' 700; font-variant-numeric: tabular-nums; }
.run-card-body { display: grid; gap: 10px; padding: 14px 16px 16px; }
.run-card-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.run-card-who > div { min-width: 0; }
.run-card h3 { margin: 0; font-size: 16px; font-variation-settings: 'wdth' 108, 'wght' 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-card-stats {
  margin: 0; display: flex; gap: 16px; font-size: 14px;
  font-variation-settings: 'wdth' 88, 'wght' 700; font-variant-numeric: tabular-nums;
}
.crowd { display: flex; gap: 6px; flex-wrap: wrap; }
.crowd-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 999px;
  background: var(--k-snow); font-size: 13px; font-variation-settings: 'wdth' 88, 'wght' 700; font-variant-numeric: tabular-nums;
}

/* --- how it works ------------------------------------------------------------ */

.how {
  display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 48px;
  padding: 44px 48px; background: #fff; border: 1px solid var(--k-rule); border-radius: 14px; scroll-margin-top: 90px;
}
.how-copy { display: grid; gap: 14px; align-content: start; justify-items: start; }
.how h2 { margin: 0; font-size: 40px; line-height: 1; font-variation-settings: 'wdth' 125, 'wght' 800; letter-spacing: -.01em; }
.how-copy p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--k-granite); }
.how-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.step { display: grid; gap: 10px; align-content: start; }
.step-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--k-night); color: var(--k-signal); }
.step-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.step h3 { margin: 0; font-size: 18px; font-variation-settings: 'wdth' 108, 'wght' 650; }
.step p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--k-granite); }

/* --- results ----------------------------------------------------------------- */

.results-for { margin: 0; font-size: 15px; color: var(--k-granite); }
.results-for a { color: var(--k-night); }
.empty { margin: 0; padding: 48px 24px; text-align: center; color: var(--k-granite); border: 1px dashed var(--k-rule); border-radius: 10px; }

@media (prefers-reduced-motion: reduce) {
  .run-card-map .draw { transition: none; stroke-dashoffset: 0; }
  .card-badge.is-live i { animation: none; }
}

/* --- narrower ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how { grid-template-columns: minmax(0, 1fr); padding: 32px; }
}

@media (max-width: 640px) {
  .home-body { width: calc(100% - 32px); }
  /* One swipeable row on a phone, rather than three rows of chips before
     the first run. */
  .cats { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .browse { gap: 28px; }
  .home-body { padding: 24px 0 8px; gap: 32px; }
  .week { gap: 10px; }
  .week-stat { padding: 14px; }
  .week-stat .value { font-size: 30px; }
  .week-stat .label { font-size: 12px; }
  .section-title { font-size: 26px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  /* A phone scrolls past six full-width cards to reach anything else. Only on
     the homepage, and never in a section marked `is-all`: the live section is
     what the page is for, and truncating it hides the very thing somebody came
     to find. On a profile those cards are the only place those runs appear. */
  .home.is-home .section:not(.is-all) .cards .run-card:nth-child(n+4) { display: none; }
  .how { padding: 24px 18px; gap: 24px; background: var(--k-night); color: var(--k-snow); border: 0; }
  .how h2 { font-size: 30px; }
  .how-copy p, .step p { color: var(--k-glacier); }
  .how-steps { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .step { grid-template-columns: 40px 1fr; column-gap: 12px; row-gap: 2px; }
  .step-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in oklab, var(--k-night) 85%, var(--k-snow)); }
  .how-copy .btn { order: 3; width: 100%; justify-content: center; }
  .how-copy { display: flex; flex-direction: column; }
}

/* --- on the dark stage ----------------------------------------------------
 *
 * Live is watched, and everything watched is dark: the live band on the
 * homepage, and the Live now page in the app frame. The map inside each card
 * stays light, as it does on the live page — contours vanish on a dark
 * basemap, and the signal dot reads best on light ground.
 */

.live-band {
  --band-1: color-mix(in oklab, var(--k-night) 92%, var(--k-snow));
  --band-line: color-mix(in oklab, var(--k-night) 82%, var(--k-glacier));
  background: var(--k-night); color: var(--k-snow);
}
.live-band > .home-body { padding: 48px 0 56px; }

.on-dark { --band-1: color-mix(in oklab, var(--k-night) 92%, var(--k-snow)); --band-line: color-mix(in oklab, var(--k-night) 82%, var(--k-glacier)); color: var(--k-snow); }
.on-dark .section-title { color: var(--k-snow); }
.on-dark .more { color: var(--k-snow); }
.on-dark .more:hover { color: var(--k-glacier); }
.on-dark .run-card { background: var(--band-1); border-color: var(--band-line); color: var(--k-snow); }
.on-dark .run-card:hover { box-shadow: 0 14px 34px rgb(0 0 0 / .35); }
.on-dark .run-card-map { border-bottom-color: var(--band-line); }
.on-dark .run-card .muted { color: var(--k-glacier); }
.on-dark .avatar { background: color-mix(in oklab, var(--k-night) 78%, var(--k-snow)); color: var(--k-snow); }
.on-dark .crowd-chip { background: color-mix(in oklab, var(--k-night) 84%, var(--k-snow)); }
.on-dark .empty { color: var(--k-glacier); border-color: var(--band-line); }
.on-dark .cat { background: transparent; border-color: var(--band-line); color: var(--k-snow); }
.on-dark .cat:hover { border-color: var(--k-glacier); }
.on-dark .cat.is-on { background: var(--k-snow); border-color: var(--k-snow); color: var(--k-night); }
.on-dark .cat-group::before { background: var(--band-line); }

/* The Live now page, inside the app frame's main column. */
.live-list { display: grid; gap: 28px; max-width: 1400px; }
.live-list .section { display: grid; gap: 20px; }
.live-list .section-head { display: flex; align-items: baseline; justify-content: space-between; }

@media (max-width: 640px) {
  .live-band > .home-body { padding: 32px 0 40px; }
}

/* --- people, in search results ------------------------------------------- */

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--k-rule); border-radius: 10px;
}
.person-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; color: var(--k-night); }
.person-link:hover b { text-decoration: underline; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.person-text { display: grid; min-width: 0; gap: 1px; }
.person-text b { font-size: 15px; font-variation-settings: 'wdth' 100, 'wght' 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text > span { font-size: 13px; color: var(--k-granite); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-lock svg { width: 13px; height: 13px; vertical-align: -1px; fill: none; stroke: var(--k-granite); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.person-live { display: inline-flex; align-items: center; gap: 6px; color: var(--k-night) !important; }
.person-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--k-signal); box-shadow: 0 0 0 2px var(--k-night); }
.person .btn { height: 34px; padding: 0 12px; font-size: 13px; flex: none; }
/* In a list, ten yellow buttons shout over the one thing yellow is for. */
.person .btn-signal { background: #fff; color: var(--k-night); border: 1px solid var(--k-rule); }
.person .btn-signal:hover { border-color: var(--k-granite); filter: none; }
