/* athlete.css — страница профиля спортсмена */
.hidden { display: none !important; }

.ath-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
}
.ath-hero .mtn-bg {
  position: absolute; inset: 0; opacity: 0.16;
  background:
    radial-gradient(120% 80% at 80% 100%, color-mix(in oklch, var(--pine) 40%, transparent) 0%, transparent 60%),
    radial-gradient(70% 60% at 10% 100%, color-mix(in oklch, var(--sunset) 30%, transparent) 0%, transparent 55%);
}
.ath-hero .shell {
  position: relative; z-index: 2;
  padding-top: 28px; padding-bottom: 36px;
}
.ath-hero .crumb { font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.ath-hero .crumb a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--ink-3); }

.ath-grid {
  display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center;
}
@media (max-width: 760px) { .ath-grid { grid-template-columns: 1fr; } }

.ath-avatar {
  width: 124px; height: 124px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 56px;
  color: var(--paper);
  background: linear-gradient(135deg,
    color-mix(in oklch, var(--pine) 70%, var(--ink)) 0%,
    color-mix(in oklch, var(--sunset) 50%, var(--pine)) 100%);
  box-shadow: 0 12px 32px -12px color-mix(in oklch, var(--pine) 50%, transparent);
  position: relative;
  flex-shrink: 0;
  user-select: none;
}
.ath-avatar .ribbon {
  position: absolute; bottom: -10px; right: -10px;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 999px;
  border: 1px solid var(--line);
  letter-spacing: 0.05em;
}

.ath-id .tier-line {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
  letter-spacing: 0.06em; margin-bottom: 8px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.ath-id .tier-line .sep { opacity: 0.4; }
.ath-id h1 {
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(32px, 4vw, 52px); line-height: 1.05;
  letter-spacing: -0.02em; margin: 0 0 12px;
  color: var(--ink);
}
.ath-id h1 em { font-style: italic; }
.ath-id .meta-row {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 14px; color: var(--ink-2); align-items: center;
}
.ath-id .meta-row strong { color: var(--ink); font-weight: 600; }
.ath-id .cat-pill {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 4px; letter-spacing: 0.05em;
  background: color-mix(in oklch, var(--sunset) 18%, var(--paper));
  color: var(--sunset);
}

.ath-ranks {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 200px;
}
.ath-ranks .rank-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; display: flex; gap: 14px; align-items: center;
}
.ath-ranks .rank-card .body { flex: 1; }
.ath-ranks .rank-card .lbl {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.ath-ranks .rank-card .val {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 22px; line-height: 1.1; color: var(--ink);
  display: flex; align-items: baseline; gap: 6px;
}
.ath-ranks .rank-card .val .pts {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); font-weight: 500;
}

/* ── KPIs ────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin: 28px 0;
}
@media (max-width: 760px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi-row .kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px;
}
.kpi-row .kpi .lbl {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;
}
.kpi-row .kpi .val {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 30px; line-height: 1.1; color: var(--ink);
}
.kpi-row .kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ── Section cards ───────────────────────────────────────────────── */
.ath-section {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; margin-bottom: 20px;
}
.ath-section .head {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  margin-bottom: 18px;
}
.ath-section .head h2 {
  font-family: var(--font-serif); font-size: 22px; font-weight: 500;
  margin: 0; color: var(--ink); letter-spacing: -0.01em;
}
.ath-section .head .sub { font-size: 13px; color: var(--ink-3); }
.ath-section .spacer { flex: 1; }

/* ── Charts ──────────────────────────────────────────────────────── */
.chart-wrap {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 880px) { .chart-wrap { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--paper-2); border-radius: 10px; padding: 18px;
}
.chart-card h3 {
  margin: 0 0 12px;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 600;
  display: flex; gap: 8px; align-items: center;
}
.chart-card .legend {
  display: inline-flex; gap: 10px; margin-left: auto;
  font-size: 11px; color: var(--ink-3);
}
.chart-card .legend .lg { display: inline-flex; gap: 4px; align-items: center; }
.chart-card .legend .sw { width: 10px; height: 2px; background: var(--cl); }

.line-chart svg { width: 100%; height: auto; display: block; }
.line-chart .axis-y, .line-chart .axis-x {
  font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3);
}
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .line  { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .area  { opacity: 0.12; }
.line-chart .pt    { fill: var(--paper); stroke-width: 2; }
.line-chart .pt-lbl{ font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); font-weight: 600; }

.bar-stack svg { width: 100%; height: auto; display: block; }
.bar-stack .yr { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
.bar-stack .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 2; }

/* ── Season charts ───────────────────────────────────────────────── */
.chip-grp { display: flex; gap: 4px; flex-wrap: wrap; }

.season-chart { display: block; }
.season-chart .sc-meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  margin-bottom: 10px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase;
}
.season-chart .sc-meta .sc-stat b {
  display: inline-block; margin-right: 4px;
  font-family: var(--font-serif); font-size: 22px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em; text-transform: none;
  vertical-align: -3px;
}
.season-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.season-chart .grid  { stroke: var(--line); stroke-width: 1; }
.season-chart .axis-y { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
.season-chart .sc-zone {
  font-family: var(--font-mono); font-size: 10px;
  fill: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase;
}
.season-chart .area  { opacity: 0.10; }
.season-chart .line  { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.season-chart .pt    { stroke-width: 2; }
.season-chart .drop  { stroke: var(--line); stroke-width: 1; stroke-dasharray: 1 3; }
.season-chart .sc-pl {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
}
.season-chart .sc-stage {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  fill: var(--ink-2);
}
.season-chart .sc-disc { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
.season-chart .sc-loc { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }

.sc-seas-sel {
  appearance: none; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 500;
  padding: 5px 28px 5px 12px; cursor: pointer;
}
.sc-seas-sel:focus { outline: none; border-color: var(--ink-3); }

.sc-divider { height: 1px; background: var(--line); margin: 24px 0 16px; }
.sc-legend {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
}
.sc-leg-line {
  display: inline-block; width: 22px; height: 2px;
  border-radius: 1px; flex-shrink: 0;
}
.sc-leg-dash {
  display: inline-block; width: 22px; height: 0;
  border-top: 1.5px dashed var(--ink-4); flex-shrink: 0; margin-left: 14px;
}
.sc-leg-txt { margin-right: 2px; }
.sc-subtitle {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; margin-bottom: 10px;
}
.sc-empty {
  padding: 32px; text-align: center; color: var(--ink-3); font-style: italic;
  background: var(--paper-2); border-radius: 10px;
}

/* ── Personal records ───────────────────────────────────────────── */
.bests-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.best-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  background: linear-gradient(135deg, var(--paper-2) 0%, var(--paper) 100%);
  position: relative; overflow: hidden;
}
.best-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--bc, var(--ink-3));
}
.best-card .disc {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); margin-bottom: 6px;
}
.best-card .time {
  font-family: var(--font-serif); font-weight: 600; font-size: 24px;
  line-height: 1.1; color: var(--ink); margin-bottom: 6px;
}
.best-card .where { font-size: 12px; color: var(--ink-2); }
.best-card .where .pl {
  display: inline-block;
  font-family: var(--font-mono); font-weight: 700; font-size: 10px;
  background: var(--bc, var(--ink-3)); color: white;
  padding: 1px 6px; border-radius: 3px; margin-right: 6px;
}

/* ── History table ───────────────────────────────────────────────── */
.hist-tbl {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.hist-tbl thead th {
  text-align: left; padding: 10px 12px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-3); border-bottom: 1px solid var(--line);
}
.hist-tbl thead th.num { text-align: right; }
.hist-tbl tbody tr { border-bottom: 1px solid var(--line); }
.hist-tbl tbody tr:hover { background: var(--paper-2); }
.hist-tbl tbody tr:last-child { border-bottom: 0; }
.hist-tbl td { padding: 12px; vertical-align: middle; }
.hist-tbl td.num { text-align: right; font-family: var(--font-mono); }
.hist-tbl .dt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.hist-tbl .comp-cell { display: flex; flex-direction: column; gap: 2px; }
.hist-tbl .comp-cell .cn { font-weight: 600; color: var(--ink); }
.hist-tbl .comp-cell .cm { font-size: 12px; color: var(--ink-3); }
.hist-tbl .pl-cell { display: inline-flex; gap: 6px; align-items: baseline; }
.hist-tbl .pl-cell .pl {
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
}
.hist-tbl .pl-cell .pl.gold   { color: oklch(0.55 0.14 75); }
.hist-tbl .pl-cell .pl.silver { color: oklch(0.50 0.02 240); }
.hist-tbl .pl-cell .pl.bronze { color: oklch(0.50 0.10 40); }

/* ── Facts / Bio ─────────────────────────────────────────────────── */
.bio-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 20px;
}
@media (max-width: 880px) { .bio-grid { grid-template-columns: 1fr; } }
.bio-text { color: var(--ink-2); line-height: 1.65; max-width: 600px; }
.facts-list { display: flex; flex-direction: column; gap: 10px; }
.facts-list .row {
  display: flex; justify-content: space-between; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.facts-list .row:last-child { border-bottom: 0; }
.facts-list .k {
  color: var(--ink-3); font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.facts-list .v { color: var(--ink); font-weight: 500; }

/* ── Chip (link button) ──────────────────────────────────────────── */
.chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line);
  color: var(--ink-2); font-family: var(--font-sans);
  text-decoration: none; display: inline-flex; align-items: center;
}
.chip.on {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

@media (max-width: 700px) {
  .hist-tbl thead th.h-time, .hist-tbl tbody td.c-time,
  .hist-tbl thead th.h-pts,  .hist-tbl tbody td.c-pts { display: none; }
  .hist-tbl td, .hist-tbl thead th { padding: 10px 8px; font-size: 13px; }
}

/* ── Фильтры в блоке «История стартов» профиля ──────────────────── */
.hist-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.hist-disc-row .chip-grp { flex-wrap: wrap; }

/* ── Страница «История стартов» (athlete_all_results) ────────────── */
.comp-chip {
  display: inline-block; flex-shrink: 0;
  padding: 2px 7px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; white-space: nowrap;
  background: color-mix(in oklch, var(--chip-cl, #2c6fad) 14%, var(--paper));
  color: var(--chip-cl, #2c6fad);
  border: 1px solid color-mix(in oklch, var(--chip-cl, #2c6fad) 28%, transparent);
}

.ar-filters {
  padding: 16px 20px; margin-bottom: 0; border-radius: 14px 14px 0 0;
  border-bottom: 0; display: flex; flex-direction: column; gap: 10px;
}
.ar-disc-row .chip-grp { flex-wrap: wrap; }

.ar-table-wrap { overflow-x: auto; }
.ar-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.ar-table thead th {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); text-align: left;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ar-th-center { text-align: center !important; }
.ar-th-right  { text-align: right !important; }
.ar-table tbody tr.res-row { border-bottom: 1px solid var(--line); }
.ar-table tbody tr.res-row:last-child { border-bottom: 0; }
.ar-table tbody tr.res-row:hover td { background: var(--paper-2); }
.ar-table td { padding: 11px 16px; vertical-align: middle; }

.ar-td-comp { min-width: 200px; }
.ar-comp-row { display: flex; gap: 9px; align-items: flex-start; }
.ar-comp-body { min-width: 0; }
.ar-comp-name {
  font-weight: 500; color: var(--ink); text-decoration: none;
  display: block; line-height: 1.3;
}
.ar-comp-name:hover { color: var(--link, var(--pine)); }
.ar-comp-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.ar-td-disc { color: var(--ink-2); min-width: 120px; }
.ar-partner { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.ar-td-cat  { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.ar-td-place { text-align: center; white-space: nowrap; }
.ar-place {
  font-family: var(--font-mono); font-weight: 700; font-size: 14px; color: var(--ink);
}
.ar-gold   { color: oklch(0.55 0.14 75); }
.ar-silver { color: oklch(0.50 0.02 240); }
.ar-bronze { color: oklch(0.50 0.10 40); }
.ar-status { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); font-style: italic; }

.ar-gap { color: var(--ink-3); font-size: 11px; }
.pl-total { color: var(--ink-3); font-size: 11px; font-family: var(--font-mono); }
.ar-dnf td { opacity: 0.55; }
.ar-td-mono { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }

.ar-empty {
  padding: 48px; text-align: center; color: var(--ink-3);
  font-size: 14px;
}

.ar-filters + .ath-section {
  border-radius: 0 0 14px 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 700px) {
  .ar-col-pen { display: none; }
  .ar-table td, .ar-table thead th { padding: 10px 10px; }
  .ar-td-cat { display: none; }
}
