/* Municipality route pages (/reitit/<kunta>/, /en/routes/<kunta>/): summary, the map beside the route cards, and
   the neighbouring municipalities. The map column exists only with JavaScript; without it the cards fill the page. */
.kt { padding-block: 40px 72px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; } /* minmax: one long route name never widens the page */
.kt-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.kt-k-vaellus { --k: var(--kind-vaellus); } .kt-k-hiihto { --k: var(--kind-hiihto); } .kt-k-kelkkailu { --k: var(--kind-kelkkailu); }
.kt-k-pyoraily { --k: var(--kind-pyoraily); } .kt-k-melonta { --k: var(--kind-melonta); } .kt-k-muu { --k: var(--kind-muu); }
/* Pictograms as in the app: monoline, square caps, mitred joins, in the activity's map colour. */
.kt-ico { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--k, currentColor); stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; }

/* Summary: the numbers the data gives, read like the app's readouts. */
.kt-head { display: grid; gap: 14px; max-width: 880px; }
.kt-head h1, .kt-head .lead { margin: 0; }
.kt-stats { display: flex; flex-wrap: wrap; gap: 14px 36px; margin: 8px 0 0; }
.kt-stats div { display: grid; gap: 4px; align-content: start; }
.kt-stats dt { font: 400 13px/1.4 var(--mono); color: var(--muted); }
.kt-stats dd { margin: 0; font: 700 34px/1 var(--disp); color: var(--ink); }
.kt-stat-long { max-width: 26em; }
.kt-stats .kt-stat-long dd { display: grid; gap: 4px; font: 600 15px/1.35 var(--sans); }
.kt-stat-long .kt-km { order: -1; font: 700 34px/1 var(--disp); color: var(--ink); }
.kt-stat-long a { display: inline-block; padding: 12px 0; margin: -12px 0; color: var(--ink2); } /* 44 px to tap, same line height */
.kt-kinds ul { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.kt-kinds a { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 14px; border: 1px solid var(--action-line);
  border-radius: var(--btn-radius); color: var(--ink); font: 600 15px/1.2 var(--sans); text-decoration: none; }
@media (hover: hover) { .kt-kinds a:hover { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); } }
.kt-n { font: 400 14px/1 var(--mono); color: var(--muted); }

/* Map beside the list on wide screens (sticky, so a tapped card shows on it), above the list on phones. */
.kt-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
.kt-mapcol { display: none; }
.js .kt-mapcol { display: block; }
/* Wide screens: the summary and the cards on the left, the map on the right from the top of the page. */
@media (min-width: 980px) {
  .js .kt-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-areas: 'head map' 'list map'; grid-template-rows: auto 1fr; gap: 40px; }
  .js .kt-head { grid-area: head; }
  .js .kt-head h1 { font-size: clamp(44px, 4.4vw, 64px); }
  .js .kt-mapcol { grid-area: map; position: sticky; top: 16px; }
  .js .kt-lists { grid-area: list; }
}
.kt-map { position: relative; height: clamp(320px, 60vh, 460px); border: var(--rule); border-radius: var(--r); background: var(--panel2); overflow: hidden; }
/* The legend row stays on the first screen under the sticky map. */
@media (min-width: 980px) { .kt-map { height: max(420px, min(calc(100vh - 190px), 720px)); } }
.kt-map-ph { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 16px; text-align: center; }
.kt-map-msg { margin: 0; color: var(--ink2); font-size: 15px; max-width: 24em; }
.kt-map-msg:empty { display: none; }
.kt-map .maplibregl-ctrl.maplibregl-ctrl-attrib { background: var(--panel); color: var(--muted); font: 400 11px/1.4 var(--mono); }
.kt-map .maplibregl-ctrl-attrib a { color: var(--ink2); }
.kt-map .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.kt-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kt-lg { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--transparent);
  border: 1px solid var(--line); border-radius: var(--btn-radius); color: var(--ink2); font: 500 14px/1.2 var(--sans); cursor: pointer; }
.kt-sw { width: 18px; height: 4px; border-radius: 2px; background: var(--k); }
.kt-lg[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; }
.kt-lg[aria-pressed="false"] .kt-sw { background: var(--line); }
@media (hover: hover) { .kt-lg:hover { border-color: var(--accent); color: var(--ink); } }
.kt-lg:focus-visible, .kt-pick button:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: 2px; }

/* The route picked on the map: a plate at the foot of the map. Raised with the site's map shadow because it lies
   over the terrain. */
.kt-pick { position: absolute; left: 10px; right: 10px; bottom: 34px; z-index: 3; max-width: 440px; display: grid; gap: 6px;
  padding: 12px 12px 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--mv-shadow); }
.kt-pick-top { display: grid; grid-template-columns: 22px minmax(0, 1fr) 44px; gap: 10px; align-items: start; }
.kt-pick-name { margin: 0; font: 600 16px/1.3 var(--sans); color: var(--ink); overflow-wrap: anywhere; }
.kt-pick-meta { margin: 2px 0 0; font-size: 14px; color: var(--ink2); }
.kt-pick-x { width: 44px; height: 44px; margin: -10px -6px 0 0; background: none; border: 0; color: var(--ink2); font: 400 26px/1 var(--sans); cursor: pointer; }
.kt-pick .kt-acts { grid-column: auto; margin: 0; align-items: center; gap: 8px 16px; }
.kt-pick .btn-text { min-height: 44px; padding: 0; background: none; border: 0; font-size: 15px; cursor: pointer; }

/* Route cards: name and length first, the actions as 44 px plates. */
.kt-lists { display: grid; gap: 48px; container-type: inline-size; }
.kt-kind h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-size: clamp(30px, 3.4vw, 42px); }
.kt-kind h2 .kt-ico { width: 30px; height: 30px; }
.kt-kind h2 .kt-n { font-size: 16px; }
.kt-cards { display: grid; gap: 8px; }
.kt-card { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 12px; padding: 12px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); scroll-margin-top: 16px; transition: border-color .12s; }
.kt-card .kt-ico { margin-top: 1px; }
.kt-card.is-sel { border-color: var(--k); background: var(--panel2); }
.kt-name { margin: 0; font: 600 17px/1.3 var(--sans); color: var(--ink); overflow-wrap: anywhere; hyphens: auto; }
.kt-name:focus { outline: none; }
.kt-name:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: 2px; }
.kt-meta { margin: 3px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink2); }
.kt-meta .kt-km { font: 400 14px/1 var(--mono); color: var(--ink); }
.kt-acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kt-act { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 60px; padding: 0 14px;
  border: 1px solid var(--action-line); border-radius: var(--btn-radius); color: var(--ink); font: 700 17px/1 var(--disp);
  letter-spacing: .01em; text-decoration: none; transition: background-color .12s, border-color .12s; }
@media (hover: hover) { .kt-act:hover { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); } }
.kt-act:active { background: var(--accent-wash-press); border-color: var(--accent); }
.kt-act:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: 2px; }
@container (min-width: 540px) {
  .kt-card { grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; }
  .kt-card .kt-ico { align-self: start; margin-top: 3px; }
  .kt-acts { grid-column: 3; margin-top: 0; flex-wrap: nowrap; }
}
/* The longest routes first; the rest wait behind "Näytä kaikki". Without JavaScript every card shows. */
.js .kt-kind:not(.is-open) .kt-x { display: none; }
.kt-all { margin-top: 12px; }
.kt-source { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 60em; }
.kt-end { display: grid; gap: 16px; }
.kt-end p { margin: 0; }

.kt-near h2 { margin: 0; }
.kt-near ul { margin: 8px 0 0; display: grid; gap: 2px 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.kt-near li a { display: inline-block; padding: 10px 0; }
@media (max-width: 600px) {
  .kt { padding-block: 28px 56px; gap: 32px; }
  .kt-stats { gap: 12px 28px; }
  .kt-stats dd, .kt-stat-long .kt-km { font-size: 28px; }
  .kt-lists { gap: 40px; }
  .kt-card { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .kt-card, .kt-act { transition: none; } }
/* The hidden attribute loses to the display rules above; these stay hidden until the script shows them. */
.kt-pick[hidden], .kt-legend[hidden], .kt-all[hidden], .kt-map-open[hidden] { display: none; }
