/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / JScms                         # ||
|| # css/routes.css                            # ||
|| # ----------------------------------------- # ||
|| # Copyright 2026 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/

/* ==================================================================
   PUBLIC ROUTES: the list page and the map page.

   Almost nothing is here, on purpose. The page head, the four figures,
   the filter bar, the scope line and the buttons are .tl-pagehead /
   .tl-kpis / .tl-filterbar / .tl-scope / .tl-btn out of tl-ui.css, and
   the numbers on a card are the same .tl-stat-* rows the activity
   statistics panel and the planner sidebar draw. The map page borrows
   explore.css whole, because it IS Explore's layout with a different
   set of markers on it.

   What is left is the route card, the two filter controls the activity
   list does not have (a search box and a checkbox), and the pagination
   wrapper. Everything reads theme tokens directly, so this file works
   wherever terraloc-theme.css is loaded.
   ================================================================== */

/* ---- the list page shell ---- */

.tl-routes-hero {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.tl-routes-results {
  display: grid;
  gap: 1rem;
}

/* The heading over the grid: what this set is, and how it is ordered. */
.tl-routes-results .tl-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tl-routes-results .tl-results-kicker {
  font-family: var(--tl-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tl-dim, #8B8F80);
}

.tl-routes-results .tl-results-title {
  font-size: clamp(1.15rem, 1.6vw, 1.6rem);
  font-weight: 700;
  color: var(--tl-ink, #23281F);
}

.tl-routes-results .tl-results-sorted {
  color: var(--tl-muted, #5C6253);
  font-size: 0.8rem;
}

/* ---- the two controls the activity list does not have ---- */

/* Matches .tl-form-select's proportions so the bar reads as one row of
   controls rather than a select next to a text box from another design. */
.tl-form-control {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--tl-hairline, rgba(0, 0, 0, 0.12));
  background-color: var(--tl-white, #fff);
  color: var(--tl-ink, #23281F);
}

.tl-form-control:focus {
  border-color: color-mix(in srgb, var(--tl-accent, #46603C) 45%, transparent);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--tl-accent, #46603C) 16%, transparent);
}

/* The search box earns more of the bar than a select does: a place name is
   longer than "Hiking". */
.tl-filterbar-field--grow,
.tl-explore-field--grow {
  flex: 1 1 14rem;
  min-width: 11rem;
}

/* A checkbox has no label above it, so it aligns to the bottom of the row
   where the selects have their control rather than to the top where they
   have their label. */
.tl-filterbar-field--check,
.tl-explore-field--check {
  display: flex;
  align-items: flex-end;
}

.tl-routes-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--tl-hairline, rgba(0, 0, 0, 0.12));
  background: var(--tl-white, #fff);
  color: var(--tl-ink, #23281F);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.tl-routes-check input {
  accent-color: var(--tl-accent, #46603C);
  width: 1rem;
  height: 1rem;
  margin: 0;
}

/* Checked reads as on without a second colour: the same accent wash the
   stat section icon uses. */
.tl-routes-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--tl-accent, #46603C) 45%, transparent);
  background: color-mix(in srgb, var(--tl-accent, #46603C) 10%, var(--tl-white, #fff));
}

/* ---- the card ----

   currentColor on the article is the sport's, set inline from the registry,
   which is how a leg section on the activity page and a line on any map
   already take their colour. Adding a sport colours a card with no rule here.
*/

.tl-route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}

.tl-route-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  padding: 1.05rem 1.1rem 1.1rem;
  border-radius: 1.15rem;
  background: var(--tl-panel, #fff);
  border: 1px solid var(--tl-hairline, rgba(0, 0, 0, 0.1));
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

/* One hairline of the sport's colour down the left edge, inherited rather
   than assigned by position. The same mark a stat tile wears. */
.tl-route-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.22rem;
  background: currentColor;
  opacity: 0.6;
}

.tl-route-card:hover,
.tl-route-card:focus-within {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, currentColor 35%, var(--tl-hairline, rgba(0, 0, 0, 0.1)));
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.tl-route-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.tl-route-sport {
  flex: 0 0 auto;
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 0.75rem;
  /* currentColor is the sport's; the wash follows it. */
  background: color-mix(in srgb, currentColor 12%, transparent);
}

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

.tl-route-card-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.tl-route-card-title a {
  color: var(--tl-ink, #23281F);
  text-decoration: none;
}

.tl-route-card-title a:hover {
  text-decoration: underline;
}

.tl-route-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  font-size: 0.76rem;
  color: var(--tl-muted, #5C6253);
}

/* The sport as a word, in the sport's colour. No pill: a row of bordered
   chips on every card is louder than the titles they sit under. */
.tl-route-chip {
  font-weight: 600;
  color: currentColor;
}

.tl-route-place {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.tl-route-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--tl-muted, #5C6253);
}

/* The stat rows fill the card's width, and the card owns the hairlines
   rather than the shared component, which draws one above and below. */
.tl-route-card-stats {
  margin-top: auto;
}

.tl-route-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: currentColor;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.tl-route-card-cta:hover {
  background: color-mix(in srgb, currentColor 18%, transparent);
  color: currentColor;
}

/* ---- pagination, the same control the activity list draws ---- */

.tl-routes-pagination {
  margin-top: 0.5rem;
}

.tl-routes-pagination .pagination {
  --bs-pagination-border-radius: 0.7rem;
}

.tl-routes-pagination .page-link {
  border: 1px solid var(--tl-hairline, rgba(0, 0, 0, 0.1));
  background: var(--tl-panel, #fff);
  color: var(--tl-ink, #23281F);
  border-radius: 0.7rem;
  font-size: 0.85rem;
}

.tl-routes-pagination .page-link:hover {
  background: var(--tl-paper, #F3F2EC);
  color: var(--tl-ink, #23281F);
}

.tl-routes-pagination .page-item.active .page-link {
  background: var(--tl-accent, #46603C);
  border-color: var(--tl-accent, #46603C);
  color: #fff;
}

.tl-routes-pagination .page-item.disabled .page-link {
  opacity: 0.45;
}

/* ---- dark ----

   Every colour above is a theme token or a mix of currentColor, both of
   which already have dark values, so there is very little to say here. The
   two panels take the dark paper the rest of the site takes.
*/

[data-bs-theme="dark"] .tl-route-card,
[data-bs-theme="dark"] .tl-routes-pagination .page-link,
[data-bs-theme="dark"] .tl-form-control,
[data-bs-theme="dark"] .tl-routes-check {
  background: var(--tl-panel, #1B1B14);
  border-color: var(--tl-hairline, #2F2F26);
  color: var(--tl-ink, #E8E6DA);
}

[data-bs-theme="dark"] .tl-route-card {
  box-shadow: none;
}

[data-bs-theme="dark"] .tl-routes-pagination .page-link:hover {
  background: var(--tl-paper, #15150F);
  color: var(--tl-ink, #E8E6DA);
}

/* The card sets its own colour inline, so the title has to say it is ink
   rather than inheriting the sport. */
[data-bs-theme="dark"] .tl-route-card-title a {
  color: var(--tl-ink, #E8E6DA);
}

@media (max-width: 575.98px) {
  .tl-route-grid {
    grid-template-columns: 1fr;
  }

  .tl-filterbar-field--grow,
  .tl-explore-field--grow {
    flex-basis: 100%;
  }
}
