/* My skiing (stats.html, stats.js): the days recorded on the Ski Map and each day's analytics. Grouped cards from
   settings.css, buttons from friends.css, colours and type from design/tokens.css. */

.stats-page { max-width: 760px; }
.stats-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.stats-head h1 { margin: 0 0 4px; font-family: var(--font-display); font-size: 28px; letter-spacing: var(--tracking-title); }
.stats-head p { margin: 0; color: var(--muted); max-width: 520px; }
.stats-head-actions { flex: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
/* What a GPX import did (stats.js): hidden while empty; red when the file was refused */
.st-import-msg { margin: calc(-1 * var(--space-3)) 0 var(--space-5); padding: 10px 14px; border-radius: var(--radius-sm);
  background: rgb(var(--accent-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .25); font-size: 14px; line-height: 1.45; }
.st-import-msg:empty { display: none; }
.st-import-msg.error { background: rgb(var(--sos-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--sos-rgb) / .3); color: var(--sos-dark); }
.st-import-msg a { margin-left: 6px; color: inherit; font-weight: 600; }
/* .visually-hidden comes from design/tokens.css */

/* This season / all time */
.st-scope { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 10px; flex-wrap: wrap; }
.st-scope .set-group-title { margin: 0; }

/* The totals, as tiles */
.st-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 0; }
.st-tiles div { padding: 12px 14px 10px; border-radius: var(--radius); background: #fff; box-shadow: 0 0 0 1px var(--separator); min-width: 0; }
.st-tiles dt { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.st-tiles dd { margin: 3px 0 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-tiles dd small { display: block; font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 1px; }
/* Nothing recorded in view (stats.js): every tile and list says so in muted text, in place of a figure */
.st-nodata { font-family: var(--font); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.st-tiles.is-empty dd { margin-top: 6px; line-height: 1.3; white-space: normal; }
.st-nodata-row { margin: 0; padding: 14px; }
.st-tiles + .st-empty { margin-top: var(--space-4); }

/* Days */
.st-days { list-style: none; margin: 0; padding: 0; }
.st-day { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.st-day + .st-day { box-shadow: inset 0 1px 0 var(--separator); }
.st-day:hover { background: var(--fill); }
.st-day-date { flex: none; width: 108px; display: flex; flex-direction: column; line-height: 1.25; }
.st-day-date strong { font-size: 15px; }
.st-day-date small { font-size: 12px; color: var(--muted); }
.st-day-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-day-main strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-day-main span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-day-tag { flex: none; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--fill-2); color: var(--muted); }
.st-day-tag.cloud { background: rgb(var(--accent-rgb) / .12); color: var(--accent); }
.st-day-tags { flex: none; display: flex; gap: 6px; }
.st-day svg.chev { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-season { margin: 14px 4px 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.st-season:first-child { margin-top: 0; }

/* Empty state */
.st-empty { padding: 32px 20px; text-align: center; background: #fff; border-radius: var(--radius-lg); box-shadow: 0 1px 3px rgb(var(--navy-rgb) / .08), 0 6px 20px rgb(var(--navy-rgb) / .06); }
.set-card .st-empty { background: none; border-radius: 0; box-shadow: none; }   /* already in a card */
.st-empty .st-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 16px; background: rgb(var(--navy-rgb) / .08); color: var(--navy); }
.st-empty .st-empty-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.st-empty strong { display: block; font-size: 16px; margin-bottom: 4px; }
.st-empty p { margin: 0 auto; max-width: 440px; color: var(--muted); font-size: 14px; }
.st-empty .btn { margin-top: 14px; }

/* Piste dots, shared with the lists: shaped as well as coloured, as the trail map's badges are (circle green, square
   blue, diamond red, hexagon black), so the difficulty doesn't rest on colour alone */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px #fff; vertical-align: middle; }
.dot.green { background: var(--piste-green); }
.dot.blue { background: var(--piste-blue); border-radius: 2px; }
.dot.red { background: var(--piste-red); border-radius: 1px; transform: rotate(45deg) scale(.86); }
.dot.black { width: 12px; background: var(--piste-black); border-radius: 0; box-shadow: none; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.dot.offpiste { background: var(--piste-offpiste); }
.dot.other { background: var(--piste-unknown); }
.dot.lift { background: var(--lift); border-radius: 2px; }

/* Pistes skied */
.st-pistes { list-style: none; margin: 0; padding: 0; }
.st-piste { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 14px; }
.st-piste + .st-piste { box-shadow: inset 0 1px 0 var(--separator); }
.st-piste strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.st-piste span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-colours { display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 14px; font-size: 13px; color: var(--muted); box-shadow: inset 0 -1px 0 var(--separator); }
.st-colours span { display: inline-flex; align-items: center; gap: 6px; }

/* A day */
.st-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -10px 0 0; font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }
.st-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.st-day-head { margin: 0 0 var(--space-4); }
.st-day-head h2 { margin: 0; font-family: var(--font-display); font-size: 24px; letter-spacing: var(--tracking-title); }
.st-day-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.st-day-head .st-imported { margin-top: 6px; overflow-wrap: anywhere; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--space-4) 0 0; }

/* Charts */
.st-chart { display: block; width: 100%; height: 150px; }
.st-chart-wrap { padding: 12px 14px 8px; }
.st-chart-wrap + .st-chart-wrap { box-shadow: inset 0 1px 0 var(--separator); }
.st-chart-title { display: flex; justify-content: space-between; margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.st-chart-title small { font-weight: 500; text-transform: none; letter-spacing: 0; }
.st-chart-sum { margin: 6px 0 0; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.st-legend { display: flex; gap: 12px; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.st-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; background: var(--accent); }
/* The same as a lift band on the charts: an 18% tint with darker edges */
.st-legend i.lift { width: 12px; height: 11px; border-radius: 0; background: color-mix(in srgb, var(--lift) 18%, transparent);
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--lift) 55%, transparent), inset -1px 0 0 color-mix(in srgb, var(--lift) 55%, transparent); }

/* Chart values: the readings behind both charts as a table, folded under a disclosure */
.st-values { box-shadow: inset 0 1px 0 var(--separator); }
.st-values summary { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 600; color: var(--accent); cursor: pointer; list-style: none; }
.st-values summary::-webkit-details-marker { display: none; }
.st-values summary::before { content: ""; width: 6px; height: 6px; margin: 0 4px 0 2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform var(--dur-fast) ease; }
.st-values[open] summary::before { transform: rotate(45deg); }
.st-table-wrap { overflow-x: auto; margin: 0 14px 14px; border-radius: 10px; box-shadow: 0 0 0 1px var(--separator); }
.st-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.st-table caption { padding: 8px 10px; text-align: left; font-size: 12.5px; color: var(--muted); }
.st-table th, .st-table td { padding: 7px 10px; text-align: left; white-space: nowrap; }
.st-table thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--fill); }
.st-table tbody tr + tr { box-shadow: inset 0 1px 0 var(--separator); }
.st-table tbody th { font-weight: 600; }

/* Runs and lifts */
.st-runs { list-style: none; margin: 0; padding: 0; counter-reset: run; }
.st-run { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 14px; }
.st-run + .st-run { box-shadow: inset 0 1px 0 var(--separator); }
.st-run-n { grid-row: span 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgb(var(--navy-rgb) / .08); color: var(--navy); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.st-run-pistes { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; }
.st-run-pistes span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-run-pistes .arrow { color: var(--muted); font-weight: 400; }
.st-run-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-run-stats { grid-column: 2 / 4; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-run-stats b { color: var(--text); font-weight: 600; }
.st-lifts { list-style: none; margin: 0; padding: 0; }
.st-lift { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 14px; }
.st-lift + .st-lift { box-shadow: inset 0 1px 0 var(--separator); }
.st-lift strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.st-lift span { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-note { margin: 8px 4px 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
#st-gpx-msg:empty { margin: 0; }   /* the phone app's answer about an exported file; no gap while there's none */
.st-loading { padding: 20px; text-align: center; color: var(--muted); }

@media (max-width: 599px) {
  .stats-head { flex-direction: column; }
  .st-day-date { width: 92px; }
  /* The tags go under the resort's name, so it and the day's figures keep the row's width */
  .st-day { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "date main chev" "date tags chev"; }
  .st-day-date { grid-area: date; }
  .st-day-main { grid-area: main; }
  .st-day-tags { grid-area: tags; margin-top: 6px; }
  .st-day svg.chev { grid-area: chev; }
  .st-tiles { grid-template-columns: repeat(2, 1fr); }
  .st-tiles dd { font-size: 20px; }
}
