:root {
  --font-body: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-display: "Sora", "Avenir Next Condensed", "Trebuchet MS", sans-serif;
  --text-2xs: 0.76rem;
  --text-xs: 0.82rem;
  --text-sm: 0.92rem;
  --text-md: 1rem;
  --text-lg: 1.2rem;
  --text-xl: 1.35rem;
  --text-hero: clamp(1.5rem, 4vw, 2rem);
  --leading-tight: 1.22;
  --leading-normal: 1.4;
  --leading-body: 1.55;
  --tracking-tight: 0.02em;
  --tracking-wide: 0.05em;
  --bg: #edf7ff;
  --card: #f9fcff;
  --ink: #0f2438;
  --muted: #496178;
  --line: #c8dcec;
  --accent: #177ec7;
  --accent-soft: #d8edfd;
  --accent-strong: #0c5e99;
  --danger: #a53a3a;
  --shadow: 0 10px 30px rgba(14, 51, 84, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, #d6f1ff 0%, transparent 36%),
    radial-gradient(circle at 0% 14%, #dff3ff 0%, transparent 38%),
    radial-gradient(circle at 50% 100%, #cfe8fb 0%, transparent 44%),
    var(--bg);
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: var(--text-xl);
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: var(--text-md);
}

p {
  line-height: var(--leading-body);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.2rem;
}

.overview-page .container {
  max-width: min(96vw, 1680px);
}

.overview-page .page-header {
  background: linear-gradient(125deg, #08345d 0%, #1272b6 48%, #7dd7f0 100%);
  border-bottom: 0;
  box-shadow: 0 8px 24px rgba(9, 53, 88, 0.22);
}

.overview-page .page-header .container {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.overview-page .brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding: 0.2rem 0;
}

.overview-header-left {
  justify-self: start;
}

.overview-header-title {
  margin: 0;
  justify-self: center;
  font-size: clamp(var(--text-sm), 1.35vw, 1.1rem);
  letter-spacing: var(--tracking-tight);
  color: #fff;
}

.overview-page .brand-title {
  color: #fff;
}

.overview-page .header-controls {
  justify-self: end;
}

.header-control-inline {
  min-width: 0;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.header-control-inline select {
  min-width: 180px;
}

.header-inline-label {
  font-size: var(--text-xs);
  text-transform: none;
  letter-spacing: var(--tracking-tight);
  color: rgba(255, 255, 255, 0.96);
  font-weight: 700;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 244, 239, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
}

.header-controls {
  display: flex;
  align-items: end;
  gap: 0.8rem;
}

.header-control {
  min-width: 220px;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  font-size: var(--text-lg);
  font-weight: 700;
  text-decoration: none;
}

.brand-title-with-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  flex: 0 0 auto;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 650;
  transition: all 0.18s ease;
}

.nav-tab:hover,
.nav-tab:focus-visible {
  background: #eff8ff;
  border-color: #b1d7f3;
}

.nav-tab.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin: 1rem 0 1.2rem;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 220px;
}

label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--muted);
  font-weight: 700;
}

select,
input,
button {
  font-family: inherit;
  font-size: var(--text-sm);
}

select,
input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.58rem 0.68rem;
  background: #fff;
  color: var(--ink);
}

.hero {
  background: linear-gradient(125deg, #08345d 0%, #1272b6 48%, #7dd7f0 100%);
  color: #fff;
  border-radius: 20px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  margin: 1.1rem 0;
}

.hero h1 {
  margin: 0;
  font-size: var(--text-hero);
}

.hero-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.hero-mark {
  width: clamp(1.6rem, 3.8vw, 2.2rem);
  height: clamp(1.6rem, 3.8vw, 2.2rem);
  display: block;
  flex: 0 0 auto;
}

.hero p {
  margin: 0.65rem 0 0;
  max-width: 70ch;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.card h2,
.card h3 {
  margin-top: 0;
  margin-bottom: 0.7rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.kpi {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-tile {
  background: #f0f8ff;
  border: 1px solid #d4e7f5;
  border-radius: 12px;
  padding: 0.8rem;
}

.kpi-label {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.kpi-value {
  margin: 0.35rem 0 0;
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.56rem;
  text-align: left;
  font-size: var(--text-sm);
}

th {
  color: var(--muted);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}

.figure-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.6rem;
}

.figure-card img {
  width: 100%;
  display: block;
  border-radius: 8px;
  border: 1px solid #d7e8f6;
}

.figure-caption {
  margin: 0.45rem 0 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

.speed-profile-grid {
  display: grid;
  gap: 1rem;
}

.overview-layout {
  --sidebar-width: 520px;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
}

.speed-profile-section {
  grid-column: 2;
  grid-row: 1;
}

.technique-section {
  grid-column: 2;
  grid-row: 2;
}

.speed-profile-card {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  background: #fff;
}

.speed-profile-figure {
  margin: 0;
}

.speed-profile-stage {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}

.speed-profile-figure img {
  width: 100%;
  display: block;
  border-radius: 10px;
  border: 1px solid #d7e8f6;
}

.speed-profile-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.speed-profile-missing {
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f7fbff;
  padding: 1rem;
}

.speed-profile-notes h3 {
  margin-bottom: 0.5rem;
}

.speed-profile-notes ul {
  margin: 0.6rem 0 0.9rem;
  padding-left: 1.15rem;
}

.speed-profile-notes li + li {
  margin-top: 0.35rem;
}

.speed-reference-wrap table {
  min-width: 0;
}

.technique-sections {
  display: grid;
  gap: 0.8rem;
}

.technique-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

.technique-chart-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem;
  background: #fff;
}

.technique-chart-card h3 {
  margin: 0;
  font-size: var(--text-md);
}

.technique-chart-card .note {
  margin-top: 0.35rem;
}

.technique-chart-summary {
  margin-top: 0.6rem;
  font-weight: 600;
}

.technique-strips-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: #fff;
}

.technique-strips-card h3 {
  margin: 0;
}

.technique-strip-list {
  display: grid;
  gap: 0;
  margin-top: 0;
}

.technique-strip-card {
  display: grid;
  grid-template-columns: 12ch minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  border: 1px solid #d5e7f6;
  border-radius: 12px;
  background: #f9fcff;
  padding: 0 0.55rem;
}

.technique-strip-name {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.technique-strip-card img {
  width: 100%;
  display: block;
  border-radius: 8px;
  border: 1px solid #d1e5f5;
  background: #fff;
}

.technique-strip-missing {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f7fbff;
  padding: 0.65rem;
}

.athlete-sidebar {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 76px);
  overflow: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.sidebar-head h2 {
  margin-bottom: 0;
}

.sidebar-toggle-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.38rem 0.6rem;
  font-weight: 650;
  cursor: pointer;
}

.sidebar-toggle-button:hover,
.sidebar-toggle-button:focus-visible {
  background: #eff8ff;
  border-color: #b1d7f3;
}

.sidebar-toggle-icon {
  font-weight: 800;
  line-height: 1;
}

.sidebar-hint {
  margin: 0.38rem 0 0.68rem;
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-tight);
}

.sidebar-resize-handle {
  position: absolute;
  right: -10px;
  top: 12px;
  bottom: 12px;
  width: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8f4ff 0%, #c8e5fb 100%);
  border: 1px solid #9ec9ea;
  box-shadow: 0 6px 14px rgba(12, 94, 153, 0.18);
  cursor: ew-resize;
  z-index: 4;
}

.sidebar-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 58px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background:
    radial-gradient(circle, #2d7bad 42%, transparent 45%) center top / 4px 8px repeat-y;
}

.athlete-sidebar-body {
  margin-top: 0.7rem;
}

.event-filter-checklist {
  display: grid;
  gap: 0.34rem;
  max-height: 140px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem;
  background: #fff;
}

.event-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
}

.overview-layout.is-sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.athlete-sidebar.is-collapsed {
  overflow: hidden;
  padding: 0.58rem 0.42rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.athlete-sidebar.is-collapsed .athlete-sidebar-body,
.athlete-sidebar.is-collapsed .sidebar-resize-handle,
.athlete-sidebar.is-collapsed .sidebar-hint,
.athlete-sidebar.is-collapsed .sidebar-toggle-text,
.athlete-sidebar.is-collapsed .sidebar-head h2 {
  display: none;
}

.athlete-sidebar.is-collapsed .sidebar-head {
  justify-content: center;
}

.athlete-sidebar.is-collapsed .sidebar-toggle-button {
  width: 100%;
  justify-content: center;
  padding: 0.5rem 0.3rem;
}

.athlete-sidebar.is-collapsed::after {
  content: "Controls";
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.sidebar-controls {
  display: grid;
  gap: 0.7rem;
}

.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.sidebar-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-weight: 650;
  cursor: pointer;
}

.sidebar-actions button:hover,
.sidebar-actions button:focus-visible {
  background: #eff8ff;
  border-color: #b1d7f3;
}

.sidebar-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.sidebar-pagination-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 0.36rem 0.58rem;
  font-weight: 650;
  cursor: pointer;
}

.sidebar-pagination-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar-pagination-status {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 650;
  min-width: 84px;
}

.sidebar-pagination-label {
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-tight);
  margin-left: auto;
}

.sidebar-pagination-size {
  width: 72px;
}

.mini-table-wrap {
  margin-top: 0.7rem;
}

.mini-table {
  min-width: 0;
}

.mini-table th,
.mini-table td {
  font-size: var(--text-2xs);
  padding: 0.42rem 0.36rem;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.discipline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.discipline-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  background: var(--card);
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.discipline-card:hover,
.discipline-card:focus-visible {
  transform: translateY(-2px);
}

.discipline-card h3 {
  margin: 0;
}

.discipline-card p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.discipline-card.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  background: #edf3f8;
}

.discipline-state {
  margin-top: 0.8rem;
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--accent-strong);
  font-weight: 700;
}

.chart-strip {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 0.4rem;
  min-height: 170px;
  padding: 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.plot-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.6rem;
}

.scatter-plot {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbff;
  min-height: 240px;
  padding: 0.25rem;
}

.scatter-plot svg {
  display: block;
  width: 100%;
  height: 240px;
}

.bar {
  flex: 1;
  background: linear-gradient(180deg, #7bcaf1 0%, #176da8 100%);
  border-radius: 8px 8px 0 0;
  min-height: 12px;
  position: relative;
}

.bar span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -1.5rem;
  white-space: nowrap;
  font-size: var(--text-2xs);
  color: var(--muted);
}

.split {
  display: grid;
  gap: 1rem;
  grid-template-columns: 330px minmax(0, 1fr);
}

.list-panel {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e3eef7;
  background: transparent;
  padding: 0.62rem 0.7rem;
  cursor: pointer;
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item:hover,
.list-item:focus-visible {
  background: #eff8ff;
}

.list-item .title {
  display: block;
  font-weight: 650;
}

.list-item .meta {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
}

.peer-grid {
  display: grid;
  gap: 0.35rem;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
  background: #fff;
}

.peer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.45rem;
  border-radius: 10px;
  background: #edf6ff;
}

.mono {
  font-family: "IBM Plex Mono", "Consolas", monospace;
}

footer {
  margin: 2rem 0 1rem;
  color: var(--muted);
  font-size: var(--text-xs);
}

.project-footer {
  margin: 1.6rem 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f9fcff 0%, #f1f8ff 100%);
  color: var(--ink);
}

.project-footer p {
  margin: 0;
}

.project-footer p + p {
  margin-top: 0.48rem;
}

.project-footer-hint {
  color: var(--muted);
  font-size: var(--text-xs);
}

.contact-reveal-button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin: 0 0.25rem;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font: inherit;
}

.contact-reveal-button:hover,
.contact-reveal-button:focus-visible {
  background: #edf6ff;
}

.contact-reveal-value {
  margin-left: 0.25rem;
  color: var(--ink);
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }

  .overview-layout {
    grid-template-columns: 1fr;
  }

  .overview-layout.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .speed-profile-section,
  .technique-section,
  .athlete-sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .athlete-sidebar {
    position: static;
    max-height: none;
  }

  .sidebar-resize-handle {
    display: none;
  }

  .technique-strip-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .overview-page .brand-row {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 0.55rem;
    padding: 0.75rem 0;
  }

  .overview-header-title {
    justify-self: start;
  }

  .overview-page .header-controls {
    justify-self: start;
    width: 100%;
  }

  .header-control,
  .header-control-inline {
    min-width: 0;
    width: 100%;
  }

  .header-control-inline select {
    min-width: 0;
    flex: 1;
  }

  .controls-bar {
    gap: 0.65rem;
  }

  .control {
    min-width: 170px;
    flex: 1;
  }
}
