.page-template-athlete {
  --ath-green: #529062;
  --ath-yellow: #ffd50e;
  --ath-rule: #e4e4e4;
  --ath-mute: #767676;
}

/* google charts redraw the whole svg on every filter change -- the global
   `* { transition }` turns that into a flicker */
.page-template-athlete .chart-frame * {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .page-template-athlete * {
    transition: none !important;
    animation: none !important;
  }
}

/* the athlete's name is the headline here, not the page title */
.sub-header .header-title h1 {
  font-size: 2.8em;
  letter-spacing: -0.015em;
}
.sub-header .header-title h1 small {
  display: block;
  font-size: 0.38em;
  font-weight: 800;
  letter-spacing: 0.24em;
  margin-bottom: 0.8em;
  opacity: 0.9;
}
/* names are arbitrarily long and the banner is only 25% of its width tall, so keep
   the title inside it rather than letting it spill onto the section below */
.sub-header .header-title {
  max-width: calc(100% - 2em);
  text-align: center;
}

.page-template-athlete .athlete-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1em;
}
.page-template-athlete article a.ath-link {
  opacity: 1;
  text-decoration: none;
  color: black;
  border: 2px solid black;
  padding: 0.5em 1em;
  font-size: 0.62em;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.page-template-athlete article a.ath-link:hover,
.page-template-athlete article a.ath-link:focus-visible {
  background-color: black;
  color: white;
}

/* the scoreboard: best result across the current selection */
.page-template-athlete .scoreboard {
  display: grid;
  grid-template-columns: 3fr 2fr;
  background-color: black;
  color: white;
}
.page-template-athlete .sb-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}
.page-template-athlete .sb-totals {
  border-left: 3px solid var(--ath-yellow);
}
.page-template-athlete .sb-cell {
  padding: 1.1em 1em 1.2em;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  min-width: 0;
}
.page-template-athlete .sb-group > .sb-cell:first-child {
  border-left: none;
}
.page-template-athlete .sb-label {
  display: block;
  font-size: 0.58em;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.8em;
}
.page-template-athlete .sb-value {
  display: block;
  font-size: clamp(1.5rem, 4.2vw, 2.7rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.page-template-athlete .sb-value small {
  font-size: 0.34em;
  font-weight: 700;
  letter-spacing: 0;
  margin-left: 0.2em;
  color: rgba(255, 255, 255, 0.55);
}
.page-template-athlete .sb-hero .sb-value {
  color: var(--ath-yellow);
}
.page-template-athlete .scoreboard-note {
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ath-mute);
  margin: 0.9em 0 0;
}

.page-template-athlete .filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background-color: var(--ath-rule);
  border: 1px solid var(--ath-rule);
  margin: 1em 0 1.5em;
}
.page-template-athlete .filters fieldset {
  background-color: white;
  padding: 0.9em 1em 1em;
  min-width: 0;
}
.page-template-athlete .filters label {
  display: block;
  font-size: 0.58em;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ath-mute);
  margin-bottom: 0.6em;
}
.page-template-athlete .filters select {
  width: 100%;
  font: inherit;
  font-size: 0.78em;
  font-weight: 700;
  padding: 0.45em 0.5em;
  border: 2px solid black;
  border-radius: 0;
  background-color: white;
  color: black;
  cursor: pointer;
}

.page-template-athlete .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75em 1.5em;
  border-bottom: 2px solid black;
  padding-bottom: 0.6em;
  margin: 3em 0 1.5em;
}
.page-template-athlete .section-head h3 {
  margin: 0;
  font-size: 1em;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.page-template-athlete .section-aside {
  font-size: 0.62em;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ath-mute);
}

.page-template-athlete .seg {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background-color: black;
  border: 2px solid black;
}
.page-template-athlete .seg button {
  flex: 1 0 auto;
  font: inherit;
  font-size: max(11px, 0.62em);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5em 0.9em;
  border: none;
  background-color: white;
  color: black;
  cursor: pointer;
  white-space: nowrap;
}
.page-template-athlete .seg button:hover {
  background-color: var(--ath-rule);
}
.page-template-athlete .seg button[aria-pressed="true"] {
  background-color: black;
  color: white;
}
.page-template-athlete .seg button:focus-visible,
.page-template-athlete .filters select:focus-visible,
.page-template-athlete article a.ath-link:focus-visible {
  outline: 3px solid var(--ath-green);
  outline-offset: 2px;
}

.page-template-athlete .attempt-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background-color: var(--ath-rule);
  border: 1px solid var(--ath-rule);
}
.page-template-athlete .stat-card {
  background-color: white;
  padding: 1.1em 1.2em 1.3em;
  min-width: 0;
}
.page-template-athlete .stat-card h4 {
  margin: 0 0 1em;
  font-size: 0.58em;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ath-mute);
}
.page-template-athlete .stat-card table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
/* the left padding is what keeps adjacent .pct-bar fills from reading as one rule */
.page-template-athlete .stat-card td {
  padding: 0.5em 0 0.55em 0.8em;
  text-align: right;
  font-size: 0.78em;
  font-weight: 800;
  border-bottom: 1px solid #f0f0f0;
}
.page-template-athlete .stat-card tr:last-child td {
  border-bottom: none;
}
.page-template-athlete .stat-card td small {
  font-size: 0.68em;
  font-weight: 600;
  color: var(--ath-mute);
  margin-left: 0.1em;
}
.page-template-athlete .stat-card .head-row td,
.page-template-athlete .stat-card .row-title {
  font-size: 0.58em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ath-mute);
}
.page-template-athlete .stat-card .head-row td {
  border-bottom: 1px solid var(--ath-rule);
  padding-bottom: 0.45em;
}
.page-template-athlete .stat-card .row-title {
  text-align: left;
}
.page-template-athlete .stat-card .increase-12,
.page-template-athlete .stat-card .increase-23 {
  font-weight: 600;
  color: #6d6d6d;
}
.page-template-athlete .stat-card .value-na {
  color: #b5b5b5;
}
/* proportion bar -- the percentage above it is the primary read, so the colour is
   reinforcement rather than the only encoding (matters for red/green colour blindness) */
.page-template-athlete .pct-bar {
  display: block;
  height: 5px;
  margin-top: 0.5em;
  background-color: var(--ath-rule);
}
.page-template-athlete .pct-bar > i {
  display: block;
  height: 100%;
  background-color: black;
}
.page-template-athlete .pct-bar > i.pct-good {
  background-color: #86cc44;
}
.page-template-athlete .pct-bar > i.pct-ok {
  background-color: #ccc144;
}
.page-template-athlete .pct-bar > i.pct-bad {
  background-color: #c44;
}

.page-template-athlete .chart-frame {
  border: 1px solid var(--ath-rule);
  padding: 0.6em;
  min-width: 0;
}
.page-template-athlete .attempt-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1em;
  margin-top: 1.5em;
}
.page-template-athlete .attempt-charts h4 {
  margin: 0.2em 0 0.4em 0.4em;
  font-size: 0.58em;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ath-mute);
}

.page-template-athlete .table-scroll {
  overflow-x: auto;
}
.page-template-athlete .meet-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.page-template-athlete .meet-table th {
  background-color: black;
  color: white;
  font-size: 0.55em;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: right;
  padding: 0.8em 0.6em;
  white-space: nowrap;
}
.page-template-athlete .meet-table th.col-date,
.page-template-athlete .meet-table th.col-meet {
  text-align: left;
}
.page-template-athlete .meet-table td {
  padding: 0.75em 0.6em;
  font-size: 0.78em;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid #ededed;
}
.page-template-athlete .meet-table td.col-date,
.page-template-athlete .meet-table td.col-meet {
  text-align: left;
}
.page-template-athlete .meet-table td.col-meet {
  white-space: normal;
  min-width: 13em;
  font-weight: 800;
}
.page-template-athlete .meet-table .meet-sub {
  display: block;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ath-mute);
  margin-top: 0.35em;
}
.page-template-athlete .meet-table .meet-place {
  display: none;
}
.page-template-athlete .meet-table .medal {
  font-size: 1.15em;
  margin-right: 0.25em;
  vertical-align: -0.08em;
}
.page-template-athlete .meet-table td.col-total {
  font-weight: 900;
}
.page-template-athlete .meet-table td .value-na {
  color: #b5b5b5;
}
.page-template-athlete .meet-table tbody tr:hover td {
  background-color: #fafafa;
}

.page-template-athlete .empty-state {
  border: 1px dashed var(--ath-rule);
  padding: 2.5em 1.5em;
  margin: 0;
  text-align: center;
  color: var(--ath-mute);
  font-size: 0.8em;
}

@media (max-width: 1100px) {
  .page-template-athlete .attempt-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .page-template-athlete .attempt-charts {
    grid-template-columns: 1fr;
  }
  /* a 25%-of-width banner is only ~100px tall on a phone -- give it a floor and
     crop the photo to fill it, so a two-line name still has somewhere to sit */
  .sub-header .banner {
    padding-bottom: 0;
    min-height: 11em;
    background-size: cover;
  }
  .sub-header .header-title h1 {
    font-size: 2em;
  }
  .sub-header .header-title h1 small {
    margin-bottom: 0.8em;
  }
}

@media (max-width: 600px) {
  .sub-header .header-title h1 {
    font-size: 1.7em;
  }
}

@media (max-width: 820px) {
  .page-template-athlete .scoreboard {
    grid-template-columns: 1fr;
  }
  .page-template-athlete .sb-totals {
    border-left: none;
    border-top: 3px solid var(--ath-yellow);
  }
}

@media (max-width: 700px) {
  main {
    padding: 1.75em 1.15em;
  }
  .page-template-athlete .filters {
    grid-template-columns: 1fr 1fr;
  }
  /* a wrapped flex row leaves a stray full-width button, so split the five evenly */
  .page-template-athlete .seg {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
  }
  .page-template-athlete .seg button {
    font-size: 10px;
    letter-spacing: 0.04em;
    padding: 0.7em 0.2em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .page-template-athlete .section-head {
    margin: 2.25em 0 1.1em;
  }
  .page-template-athlete .sb-cell {
    padding: 0.9em 0.9em 1em;
  }
  .page-template-athlete .stat-card {
    padding: 0.9em 1em 1em;
  }
  /* squeeze the meet table down to a phone: GL lives in the chart above, and the
     place moves into the meet cell, which leaves date + lifts + total on screen */
  .page-template-athlete .meet-table .col-gl,
  .page-template-athlete .meet-table .col-place {
    display: none;
  }
  .page-template-athlete .meet-table .meet-place {
    display: inline;
  }
  .page-template-athlete .meet-table th {
    font-size: 0.5em;
    letter-spacing: 0.04em;
    padding: 0.7em 0.3em;
  }
  .page-template-athlete .meet-table td {
    padding: 0.6em 0.3em;
    font-size: 0.72em;
  }
  .page-template-athlete .meet-table td.col-meet {
    min-width: 8.5em;
  }
}

@media (max-width: 560px) {
  .page-template-athlete .attempt-stats {
    grid-template-columns: 1fr;
  }
  .page-template-athlete .athlete-id {
    align-items: flex-start;
    flex-direction: column;
  }
}
