/* Copyright (c) 2026 Brownie, LLC. All rights reserved. */

/*
 * An archer's progress (views/archer-progress.ts), its coaching details
 * (views/coaching-details.ts), the charts every analytics screen shares
 * (app/team/charts.ts), and the layout the Progress pages share: the
 * header with its filters, the stat tiles and the cards (the Season view,
 * the Compare view and an archer's page, laid out by the approved design).
 * Colors come from the variables in styles.css and app.css, so dark mode
 * follows by itself.
 */

/* ---------- The Progress pages' header and filters ---------- */

.progress-header {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.progress-header > p {
  margin: 0;
}

/* A page's tabs (components.ts pageTabs: an archer's page, the Season
   view): links under the header, the current one underlined, so they read
   as places on the page rather than one more filter. */
.page-tabs.segmented {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
}

.page-tabs .segment {
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}

.page-tabs .segment[aria-current="page"] {
  border-bottom-color: var(--color-accent);
  background: transparent;
  box-shadow: none;
  color: var(--color-text);
}

.archer-scorecards,
.archer-scorecard-list {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* The filters in one row that wraps: segmented controls, and the season list
   with its name beside it rather than above. */
.progress-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  min-width: 0;
}

.progress-filters .form-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.85rem;
}

.progress-filters .form-field select {
  width: auto;
  max-width: 100%;
  min-height: var(--size-control);
  font-weight: 600;
}

/* ---------- Charts ---------- */

.chart-figure {
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

/* Chart.js fills this box's width at its fixed height, at any screen size. */
.chart-box {
  position: relative;
  height: 260px;
  min-width: 0;
}

.chart-summary {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.chart-status:empty {
  display: none;
}

.chart-numbers > summary {
  width: fit-content;
  min-height: 32px;
  padding-block: 4px;
  list-style: none;
}

.chart-numbers > summary::-webkit-details-marker {
  display: none;
}

.chart-numbers[open] > summary {
  margin-bottom: 8px;
}

/* ---------- The archer's progress ---------- */

.progress-slot {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.progress-slot:empty {
  display: none;
}

.progress-trend {
  margin: 0;
  font-weight: 600;
}

/* The stat tiles (average, best, last 5, 10s per card, 50s; on the Season
   view, its headline numbers): a label, a big number and a line under it. */
.progress-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  gap: 12px;
  margin: 0;
}

.progress-tile {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
}

/* Not in capitals, which would turn "10s" into "10S". */
.progress-tile dt {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.progress-tile dd {
  margin: 0;
}

/* A number never breaks across lines; it shrinks with a narrow screen instead. */
.progress-tile-value {
  font: 700 clamp(1.5rem, 1rem + 2.5vw, 2.4rem) / 1.1 var(--font-display);
  white-space: nowrap;
}

.progress-tile-detail {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* A phone has three tiles to a row, as in the design. */
@media (max-width: 600px) {
  .progress-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .progress-tile {
    padding: 10px 12px;
  }

  .progress-tile dt,
  .progress-tile-detail {
    font-size: 0.78rem;
  }
}

/* ---------- An archer's page ---------- */

.progress-area {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.progress-area > p {
  margin: 0;
}

.progress-area-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
}

.progress-area-header h2 {
  margin: 0;
  font-size: 1.75rem;
}

.progress-area-header h2:focus:not(:focus-visible) {
  outline: none;
}

.progress-cards {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.progress-milestones {
  gap: 8px;
}

.milestone-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Milestone and 50 badges read as words, so they aren't in capitals. */
.badge.is-milestone,
.badge.is-personal-best,
.badge.is-fifty {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  white-space: nowrap;
}

.badge.is-milestone {
  padding: 6px 10px;
}

.badge.is-fifty,
.badge.is-personal-best {
  background: var(--color-ten-soft);
  color: var(--color-text);
  border: 1px solid var(--color-ten);
}

/* ---------- Coaching details (views/coaching-details.ts) ---------- */

.progress-coaching {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.progress-coaching > h3,
.progress-coaching > p {
  margin: 0;
}

/* A line above, so the details read as their own part of the section. */
.progress-coaching > h3 {
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 1.3rem;
}

.coaching-part {
  display: grid;
  gap: 8px;
  min-width: 0;
}

/* In the headings' narrow font, like the h3 above, so they read as a step below it. */
.coaching-part > h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-text-muted);
}

.coaching-part > p {
  margin: 0;
}

.coaching-hint {
  font-weight: 600;
}

/* Bar charts need less height than the score chart. */
.coaching-part .chart-box {
  height: 220px;
}

/* In its card, the coaching details lay their charts out two to a row on a
   wide screen, under the heading and its note. */
.progress-card .progress-coaching {
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 20px 28px;
}

.progress-card .progress-coaching > h3,
.progress-card .progress-coaching > p {
  grid-column: 1 / -1;
}

.progress-card .progress-coaching > h3 {
  padding-top: 0;
  border-top: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

/* An archer's scorecards in a season, in a card: each card a row. */
.scorecard-season .item-list > li {
  background: var(--color-page);
}
