/* ==========================================================================
   The activity list: the Activities page, the athlete's Tracks tab, the
   activity profile's archive and the home page cards.

   Every colour here is a theme token, which carries both faces, so there is
   no night copy to keep in step. This file used to declare its own palette
   on .tl-activities-page: --tl-ink, --tl-muted and the radii redeclared over
   the theme's under the same names, SkyTrackPro's cobalt hero, white glass
   panels, and a dark-mode block that set muted text to the body colour. The
   list read the fork's colours and the theme's tokens meant something else
   inside it.
   ========================================================================== */

.tl-activities-page {
  color: var(--tl-ink);
  background: none;
}

.tl-activities-shell {
  display: grid;
  gap: 1rem;
}

/* The page head sits on the page ground like every other list page; its
   parts are .tl-pagehead, .tl-kpis and .tl-filterbar in tl-ui.css. */
.tl-activities-hero {
  display: grid;
  gap: 0.95rem;
  color: var(--tl-ink);
}

.tl-activities-results {
  display: grid;
  gap: 0.85rem;
}

.tl-activity-feed {
  display: grid;
  gap: 0.85rem;
}

/* ---- one activity, as a card ------------------------------------------ */

.tl-activity-card {
  padding: 1rem 1.1rem;
  border-radius: var(--tl-radius-lg);
  background: var(--tl-panel);
  border: 1px solid var(--tl-hairline);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.tl-activity-card:hover {
  transform: translateY(-2px);
  border-color: var(--tl-hairline-strong);
  box-shadow: var(--tl-lift);
}

.tl-activity-card:focus-visible {
  outline: 3px solid rgba(var(--tl-accent-rgb), 0.25);
  outline-offset: 3px;
}

.tl-activity-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 0.85rem;
}

.tl-activity-card-copy {
  min-width: 0;
}

.tl-activity-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.tl-activity-card-flags {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.tl-activity-date {
  color: var(--tl-muted);
  font-size: 0.88rem;
}

/* The owner's row actions: view, plan, edit, delete.

   They carried their words and took a third of the row, pushing the figures
   into them. Icons with tooltips now, the way the delete button already was,
   and square rather than Bootstrap's wide btn-sm so four of them read as one
   group of controls. The word is still on each for a screen reader. */
/* THE GROUP IS A ROW AT EVERY WIDTH.

   display:flex and the gap lived only inside the wide-screen block, so below
   1200px the four buttons were inline elements with nothing between them:
   rendered from an implode with no separator, they came out as one 128px
   slab of touching squares. Placement in the row's third column is a
   wide-screen concern; being a row with air in it is not. */
.tl-activity-card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tl-activity-card-foot .tl-activity-foot-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  line-height: 1;
}

.tl-activity-card-foot .tl-activity-foot-icon i {
  font-size: 0.85rem;
}

/* A footnote, not a headline.

   These were Bootstrap tone pills: 2rem outlined discs in blue and amber
   beside a quiet date, the loudest marks on the card for the two facts that
   matter least, in colours from the fork's palette. Amber besides, which on
   TerraLoc means live and nothing else.

   They read as the date's own punctuation now: same size, same muted ink,
   saying there is more inside without competing with the title. */
.tl-activity-card .tl-activity-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  line-height: inherit;
  color: var(--tl-dim);
  font-size: 0.78rem;
  font-weight: 400;
}

.tl-activity-card .tl-activity-meta-badge i {
  font-size: 0.82rem;
}

/* A day of several sports is worth reading rather than only noticing, so
   this one keeps its words and its leg count. */
.tl-activity-card .tl-activity-meta-badge-multisport {
  color: var(--tl-muted);
}

.tl-activity-card-title {
  margin: 0;
  color: var(--tl-ink);
  font-size: clamp(1.15rem, 1.7vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.16;
}

.tl-activity-card-title a,
.tl-activity-link {
  color: inherit;
  text-decoration: none;
}

.tl-activity-card-title a:hover,
.tl-activity-link:hover {
  color: var(--tl-accent);
}

/* The way in. It is a .btn-dark in the markup and was a filled black pill;
   it is the site's plain button now, the same one that ends every row. */
.tl-activity-card-cta {
  --bs-btn-color: var(--tl-ink);
  --bs-btn-bg: var(--tl-panel);
  --bs-btn-border-color: var(--tl-hairline-strong);
  --bs-btn-hover-color: var(--tl-accent);
  --bs-btn-hover-bg: var(--tl-panel);
  --bs-btn-hover-border-color: var(--tl-accent);
  --bs-btn-active-color: var(--tl-accent);
  --bs-btn-active-bg: var(--tl-panel);
  --bs-btn-active-border-color: var(--tl-accent);
  --bs-btn-focus-shadow-rgb: var(--tl-accent-rgb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.5rem;
  min-height: 42px;
  padding-inline: 1rem;
  border-radius: var(--tl-radius);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Seven facts: who did it, where, what it was, how hard, how far, what it
   scored, how fast. The widths are positional, so this list and the order the
   cells are rendered in have to be read together.

   The sport used to be a filled pill under the title and was the loudest
   thing on the card; it is a fact in the row now and the title leads again. */
.tl-activity-details {
  display: grid;
  grid-template-columns:
    minmax(0, 1.15fr)
    minmax(0, 1.2fr)
    minmax(0, 1fr)
    minmax(0, 1.05fr)
    minmax(0, 0.8fr)
    minmax(0, 0.7fr)
    minmax(0, 1fr);
  gap: 0.7rem 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--tl-hairline);
}

.tl-activity-detail {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
  align-content: start;
}

.tl-activity-detail-label {
  display: block;
  color: var(--tl-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tl-activity-link,
.tl-activity-metric-value {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
  min-height: 0;
  color: var(--tl-ink);
  font-weight: 700;
  line-height: 1.25;
}

.tl-activity-metric-value {
  font-size: 1rem;
}

.tl-activity-flag {
  font-size: 1.15rem;
  line-height: 1;
}

.tl-activity-card .badge {
  padding: 0.38rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* A filter select outside .tl-filterbar, which dresses its own. Focus is the
   theme's accent ring. */
.tl-form-select {
  min-height: 44px;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius);
  background-color: var(--tl-white);
  color: var(--tl-ink);
}

/* ---- pagination --------------------------------------------------------

   The markup carries the fork template's .pagination-primary-soft, which
   paints the current page and every hover in --bs-primary, the
   call-to-action orange, with white on it. The theme's own pagination is
   accent on paper; the list asks for that. Its active rule is four classes
   deep, hence the extra one here. */
.tl-activities-pagination {
  margin-top: 0.5rem;
}

.tl-activities-pagination .pagination {
  gap: 0.35rem;
}

.tl-activities-pagination .page-link {
  min-width: 44px;
  border: 1px solid var(--tl-hairline);
  background: var(--tl-panel);
  color: var(--tl-muted);
  text-align: center;
}

.tl-activities-pagination .page-link:hover {
  color: var(--tl-accent);
  background: var(--tl-panel);
  border-color: var(--tl-accent);
}

.tl-activities-pagination .pagination .page-item.active .page-link {
  color: var(--tl-accent-ink);
  background: var(--tl-accent);
  border-color: var(--tl-accent);
}

@media (max-width: 1199.98px) {
  .tl-activity-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .tl-activity-card-top {
    flex-direction: column;
  }

  .tl-activity-card-cta {
    width: 100%;
  }

  .tl-activity-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .tl-activities-hero {
    gap: 0.8rem;
  }

  .tl-form-select {
    min-height: 42px;
  }

  .tl-activity-card {
    padding: 0.95rem;
  }

  .tl-activity-card-top {
    gap: 0.7rem;
    margin-bottom: 0.7rem;
  }

  .tl-activity-card-title {
    font-size: 1.2rem;
  }

  .tl-activity-card-cta {
    min-width: 5.75rem;
    min-height: 40px;
    padding-inline: 0.9rem;
  }
}

@media (max-width: 575.98px) {
  .tl-activities-shell {
    gap: 0.85rem;
  }

  .tl-form-select {
    min-height: 40px;
  }

  .tl-activity-card {
    padding: 0.9rem;
  }

  .tl-activity-card-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.55rem 0.75rem;
    margin-bottom: 0.65rem;
  }

  .tl-activity-card-meta {
    gap: 0.45rem;
    margin-bottom: 0.35rem;
  }

  .tl-activity-card-flags {
    gap: 0.3rem;
  }

  .tl-activity-date {
    font-size: 0.84rem;
  }

  .tl-activity-card .badge {
    padding: 0.32rem 0.56rem;
    font-size: 0.68rem;
  }

  .tl-activity-card-title {
    font-size: 1rem;
    line-height: 1.18;
  }

  .tl-activity-card-cta {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    width: auto;
    min-width: 5rem;
    min-height: 36px;
    padding-inline: 0.75rem;
    font-size: 0.9rem;
  }

  .tl-activity-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem 0.8rem;
    padding-top: 0.7rem;
  }

  .tl-activity-detail--athlete,
  .tl-activity-detail--place {
    grid-column: 1 / -1;
  }

  .tl-activity-detail-label {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  .tl-activity-detail--metric .tl-activity-detail-label {
    font-size: 0.56rem;
    letter-spacing: 0.04em;
  }

  .tl-activity-link,
  .tl-activity-metric-value {
    font-size: 0.98rem;
    line-height: 1.2;
  }

  .tl-activity-detail--metric .tl-activity-metric-value {
    font-size: 0.88rem;
  }

  .tl-activities-pagination {
    margin-top: 0.2rem;
  }

  .tl-activities-pagination .page-link {
    min-width: 40px;
  }

  .tl-activities-pagination .pagination {
    justify-content: center !important;
  }
}

/* ==========================================================================
   Activity Deck results sheet
   The public activities feed reads as a typeset results list: one activity per
   hairline row inside a single panel, mono tabular metrics, no card floats.
   Desktop only; below xl the cards keep their stacked layout.
   ========================================================================== */

/* The whole row is clickable, so this was hidden as a duplicate. It is back
   because a row of five figures with nothing at the end of it does not read
   as a link, and the mockup ends every row with the way in. */
/* ------------------------------------------------------------------
   The activity list as rows

   These were scoped to #tl-tracks-main, so only the Activities page
   could have them. The athlete page renders the same .tl-activity-card
   from the same PHP and, with nothing to match, fell back to a grid of
   stacked cards in profile-tracks.css: one list, two products. A class
   instead of an id, carried by both feeds.
   ------------------------------------------------------------------ */
.tl-feed-rows .tl-activity-card-cta {
  height: 30px;
  padding: 0 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.tl-feed-rows .tl-activity-feed {
  display: block;
  background: var(--tl-paper);
  border: 1px solid var(--tl-hairline);
  border-radius: 0.625rem;
  overflow: hidden;
}

.tl-feed-rows .tl-activity-card {
  border: 0;
  border-top: 1px solid var(--tl-hairline);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  background: transparent;
}

.tl-feed-rows .tl-activity-feed > .tl-activity-card:first-child {
  border-top: 0;
}

.tl-feed-rows .tl-activity-card:hover {
  transform: none;
  box-shadow: none;
  background: rgba(var(--tl-ink-rgb), 0.03);
}

.tl-feed-rows .tl-activity-detail-label {
  font-family: var(--tl-font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tl-feed-rows .tl-activity-metric-value {
  font-family: var(--tl-font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (min-width: 1200px) {
  /* Name and date, then the figures, then the way in. The CTA used to live
     inside the first cell with the title, which put it in the middle of the
     row between the name and the athlete. */
  .tl-feed-rows .tl-activity-card {
    display: grid;
    grid-template-columns: minmax(250px, 1.25fr) minmax(0, 2.1fr) auto;
    gap: 0.35rem 1.5rem;
    align-items: center;
    padding: 0.75rem 1.1rem;
  }

  /* THIS ROW CARRIES MORE THAN THE PUBLIC ONE. A public row ends in a single
     View link; the owner's own ends in View, Plan and Edit, and it gained the
     sport and the rating as facts. At the shared 1.5rem the last figure sat
     hard against the first button: not overlapping, but reading as though it
     were. The title needs less room than the figures do, so it gives some up
     and the gap before the buttons widens.

     Inside this media query on purpose: below it the card stacks and none of
     these three columns exist. */
  .tl-feed-rows.tl-profile-tracks-page .tl-activity-card {
    grid-template-columns: minmax(200px, 1fr) minmax(0, 2.5fr) auto;
    column-gap: 2rem;
  }

  /* ROOM FOR FIVE, SO THE ROWS LINE UP. Every row is its own grid, so its
     last column is as wide as that row's buttons: a plugin that adds one to
     some rows (terraloc_activity_card_actions) pushed those rows' figures
     ten pixels left of their neighbours'. Five 32px squares and their gaps,
     right-aligned, whatever a row carries. */
  .tl-feed-rows.tl-profile-tracks-page .tl-activity-card-foot {
    min-width: calc(5 * 32px + 4 * 0.4rem);
    justify-content: flex-end;
  }

  .tl-feed-rows .tl-activity-card-top {
    display: contents;
  }

  .tl-feed-rows .tl-activity-card-copy {
    grid-column: 1;
    min-width: 0;
  }

  .tl-feed-rows .tl-activity-details {
    grid-column: 2;
  }

  /* The way in, at the end of the row. A public row has one link; the
     owner's own Tracks tab has a group (view, edit, delete), so both land
     in the third column. */
  .tl-feed-rows .tl-activity-card-cta,
  .tl-feed-rows .tl-activity-card-foot {
    grid-column: 3;
    grid-row: 1;
  }

  /* Only the placement: being a flex row with a gap is declared once, above,
     for every width. */
  .tl-feed-rows .tl-activity-card-foot {
    justify-self: end;
  }

  .tl-feed-rows .tl-activity-card-note {
    margin: 0.25rem 0 0;
    max-width: 60ch;
  }

  .tl-feed-rows .tl-activity-card-meta {
    margin-bottom: 0.2rem;
  }

  .tl-feed-rows .tl-activity-date {
    font-family: var(--tl-font-mono);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
  }

  .tl-feed-rows .tl-activity-card-title {
    font-size: 0.98rem;
    margin: 0;
  }

  /* However many cells the row has. A fixed six-column template was written
     for the Activities feed's five, and gave the athlete page's three the
     first three narrow tracks of six: "DURATION" broke across two lines. */
  .tl-feed-rows .tl-activity-details {
    border-top: 0;
    padding-top: 0;
    display: grid;
    /* none first: the base .tl-activity-details declares six explicit tracks,
       and grid-auto-columns only ever reaches the implicit ones, so without
       this the three-cell rows still got the first three of six.
       max-content as the floor, not 0: the figures do not wrap, so a track
       narrower than its content does not make the row shorter, it makes
       "6.18 km" and "5.7 km/h" overlap. Widest wins, then they share. */
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(max-content, 1fr);
    gap: 0.25rem 1rem;
    align-items: center;
  }

  /* A column heading and its figure are each one line: "1h 15m" breaking
     after the hours is not a smaller row, it is a taller one. */
  .tl-feed-rows .tl-activity-detail-label,
  .tl-feed-rows .tl-activity-metric-value {
    white-space: nowrap;
  }

  .tl-feed-rows .tl-activity-card-cta {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
  }
}
