/* La ficha de cada nadador (/swimmers/<nombre>/ y /swimmer/?id=). Sacado de site.css el 23-11; lo común (la barra, el pie,
   los segmentados, la progresión que se dibuja sola, .wr y .pb) sigue allí. La dibujan web/swimmers.py y assets/swimmer.js.
   Colores con significado: --fast = mejor marca, más rápido; --rope = récord del mundo; oro, plata y bronce = medallas, con el
   año dentro; rojo = la cinta de la medalla (el rojo de la marca); gris = contexto. */

/* ---------------------------------------------------------------- la cabecera: la cara, el nombre, la frase y la piscina */
#sw { min-height: 100vh; }   /* mientras carga, el pie no asoma */
.swh { padding-top: calc(var(--barh) + 34px); }
.swh-top { display: grid; grid-template-columns: auto 1fr; gap: clamp(16px, 2.4vw, 30px); align-items: center; }
.swh .big { width: clamp(88px, 9vw, 132px); height: clamp(88px, 9vw, 132px); }
.swh .big .av { width: 100% !important; height: 100% !important; box-shadow: 0 0 0 5px var(--bg); }
.swh h1 { font-size: clamp(36px, 4.6vw, 68px); }
.sw-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sw-facts > span { display: inline-flex; align-items: center; gap: 7px; font: 600 14px var(--f-body); border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 13px; }
.sw-facts .hot { background: var(--rope); border-color: var(--rope); }
.sw-line { font-size: clamp(17px, 1.6vw, 21px); line-height: 1.35; max-width: 46em; margin: 16px 0 0; color: var(--ink); font-weight: 400; letter-spacing: -0.01em; }
.sw-line b { font-weight: 800; }
.swh .sw-band { height: clamp(110px, 12vw, 170px); margin-top: 22px; }
@media (max-width: 700px) {
  /* el nombre empieza en el margen, como el logo; la cara, a su derecha */
  .swh { padding-top: 96px; } .swh-top { grid-template-columns: minmax(0, 1fr) 72px; align-items: start; } .swh .big { order: 2; width: 72px; height: 72px; }
  /* el nombre en una línea en cualquier móvil: la letra se ajusta a su largo (--nl, letras del nombre) */
  .swh h1 { font-size: clamp(20px, calc((100vw - 2 * var(--gut) - 88px) / (var(--nl, 14) * 0.6)), 40px); white-space: nowrap; }
  .sw-facts { gap: 6px; margin-top: 10px; } .sw-facts > span { font-size: 13px; padding: 4px 10px; }
  .sw-line { font-size: 16px; }
}
@media (max-width: 359px) {
  .swh h1 { white-space: normal; overflow-wrap: anywhere; }
  .sw-facts > span { max-width: 100%; overflow-wrap: anywhere; }
}

/* ---------------------------------------------------------------- la fila de saltos: fija, se esconde al bajar y vuelve al subir
   (la pieza común X.autohide; aquí solo cuánto sube para salir de debajo de la cápsula) */
.jump { position: sticky; top: var(--stick); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); --ah-y: calc(-100% - var(--barh) - 12px); }
.jump .col { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 8px; padding-bottom: 8px; }
.jump .col::-webkit-scrollbar { display: none; }
.jump a { flex: none; text-decoration: none; font: 600 15px var(--f-body); color: var(--text); padding: 9px 14px; border-radius: 999px; transition: background .2s, color .2s; }
.jump a:hover { background: var(--soft); color: var(--ink); }
.jump a.on { background: var(--ink); color: #fff; }
@media (max-width: 900px) {
  /* en el móvil no caben todas: la última se funde con el borde para que se vea que siguen */
  .jump .col { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 40px; }
}

/* ---------------------------------------------------------------- la rejilla: las mejores marcas y su progresión juntas en una fila
   propia (la progresión se queda a la vista mientras se baja por las marcas y nunca pasa de su fila); debajo, dos columnas */
.swgrid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-auto-flow: row dense; gap: clamp(40px, 4.4vw, 64px) clamp(28px, 3.6vw, 56px); padding-top: 30px; padding-bottom: clamp(50px, 6vw, 90px); }
.swpair { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: inherit; align-items: start; }
.sws { min-width: 0; scroll-margin-top: calc(var(--barh) + 20px); }
.sws.full { grid-column: 1 / -1; }
.sws-h { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 12px; min-height: 40px; }
.sws-h .h3 { margin: 0; font-size: 20px; }
.sws-h .h3[title] { cursor: help; }
.sws-h .controls { margin: 0; }
@media (min-width: 1001px) { .swpair #chart { position: sticky; top: calc(var(--barh) + 76px); } }
@media (max-width: 1000px) { .swgrid, .swpair { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- las mejores marcas, estilo GPath: cifra grande, puesto histórico y la tira de los 100 mejores */
.pbs { border-top: 2px solid var(--ink); }
.pbr { border-bottom: 1px solid var(--line); }
.pbr > button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 96px 128px minmax(60px, 1fr) 70px 18px; align-items: center; gap: 12px; padding: 11px 4px; cursor: pointer; transition: background .2s; }
.pbr > button:hover { background: var(--panel); }
.pbr > button:focus-visible { outline: 3px solid var(--fast); }
.pbr .ev { font: 700 15px var(--f-body); }
.pbr .ev small { display: block; font: 500 12px var(--f-body); color: var(--muted); margin-top: 2px; }
.pbr .tmb { font: 900 38px/1 var(--f-num); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 10px; }
.pbr .rkb { text-align: right; }
.pbr .rkb b { font: 900 28px/1 var(--f-num); display: block; }
.pbr .rkb span { font: 600 12px var(--f-body); color: var(--muted); }
.pbr .chev { width: 18px; height: 18px; transition: transform .3s var(--ease); color: var(--muted); }
.pbr.open .chev { transform: rotate(180deg); }
.tape { position: relative; height: 40px; }
.tape .base { position: absolute; left: 0; right: 0; top: 19px; height: 2px; background: var(--soft); border-radius: 2px; }
.tape i { position: absolute; top: 17px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--grey); transform: scale(0); transition: transform .5s var(--spring); }
.tape .me { position: absolute; top: 7px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--bg); transform: scale(0); transition: transform .7s var(--spring) .45s; z-index: 2; }
.tape .me.rec { background: var(--rope); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.tape .me.out { left: 0 !important; background: var(--grey); }
.tape .tl { position: absolute; top: -8px; font: 700 10px var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pbs.in .tape i, .pbs.in .tape .me { transform: scale(1); }
.pbmore { overflow: hidden; height: 0; transition: height .45s var(--ease); }
.pbmore .inner { padding: 2px 4px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pbmore h4 { margin: 0 0 8px; font: 700 13px var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pbmore .natr { margin: 0; font-size: 17px; }
.pbmore .natr .num { font-size: 34px; }
.near { list-style: none; margin: 0; padding: 0; }
.near li a { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; text-decoration: none; border-bottom: 1px solid var(--soft); font-size: 15px; }
.near li.me { font-weight: 800; }
.near li .r { font: 900 20px var(--f-num); color: var(--muted); }
.near li.me .r { color: var(--ink); }
.near li .t { font-size: 22px; }
.near .ahead .t { color: var(--fast); } .near .behind .t { color: var(--slow-t); }
@media (max-width: 760px) {
  .pbr > button { grid-template-columns: 1fr auto 20px; gap: 6px 12px; }
  .pbr .tape { grid-column: 1 / -1; grid-row: 3; }
  .pbr .tmb { grid-column: 1; grid-row: 2; font-size: 40px; }
  .pbr .rkb { grid-column: 2; grid-row: 1 / 3; }
  .pbr .chev { grid-column: 3; grid-row: 1 / 3; }
  .pbmore .inner { grid-template-columns: 1fr; }
}
@media (max-width: 359px) {
  .pbr > button { grid-template-columns: minmax(0, 1fr) auto 18px; gap: 6px 8px; }
  .pbr .tmb { grid-column: 1 / -1; flex-wrap: wrap; }
  .pbr .rkb, .pbr .chev { grid-row: 1; }
  .sws { overflow-wrap: anywhere; }
  .medtot { flex-wrap: wrap; }
}
.sws .chart { padding: 12px 8px 6px; }

/* ---------------------------------------------------------------- medallas que caen, con su recuento */
.medtot { display: flex; gap: 18px; align-items: end; }
.medtot div { text-align: center; }
.medtot b { display: block; font: 900 clamp(44px, 4.4vw, 64px)/0.9 var(--f-num); }
.medtot span { font: 700 12px var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.medtot .g b { color: var(--gold); } .medtot .s b { color: var(--silver); } .medtot .b b { color: var(--bronze); }
.medtot .zero b { color: var(--soft); }
/* el recuento de cada competición: el mismo, en pequeño y en una línea, a la derecha de su nombre */
.medgh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.medgh h3 { margin: 0; font: 700 15px var(--f-body); color: var(--ink); }
.medtot.sm { gap: 12px; align-items: baseline; }
.medtot.sm div { display: flex; align-items: baseline; gap: 4px; }
.medtot.sm b { font-size: 26px; line-height: 1; }
.medtot.sm span { font-size: 10px; letter-spacing: .06em; }
.medtot.sm .zero b { color: var(--line); }
.medgrp { margin-top: 26px; }
.medals { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 8px; }
/* cada medalla: el disco con el año, colgando de su cinta; isolation para que la cinta se quede delante del fondo de la tarjeta */
.medal { position: relative; isolation: isolate; display: flex; align-items: center; gap: 12px; padding: 12px 12px 10px 10px; border-radius: 14px; background: var(--panel); opacity: 0; transform: translateY(-40px) rotate(-8deg); transition: opacity .4s, transform .8s var(--spring); }
.in .medal { opacity: 1; transform: none; }
.medal .disc { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 900 16px var(--f-num); color: var(--ink); flex: none; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14); }
.medal .disc::before { content: ''; position: absolute; bottom: 30px; left: 50%; width: 20px; height: 26px; margin-left: -10px; z-index: -1;
  background: linear-gradient(90deg, var(--red) 0 38%, #fff 38% 62%, var(--red) 62%); clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%); }
.medal .G { background: var(--gold); } .medal .S { background: var(--silver); } .medal .B { background: var(--bronze); }
.medal div { font-size: 15px; line-height: 1.25; }
.medal div small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
@media (max-width: 700px) { .medals { grid-template-columns: 1fr 1fr; } .medal { flex-direction: column; align-items: flex-start; gap: 8px; } }
@media (max-width: 360px) { .medals { grid-template-columns: 1fr; } .medal { flex-direction: row; align-items: center; } }

/* ---------------------------------------------------------------- récords del mundo: cuánto duró cada uno, una barra que crece */
.tenure { display: grid; gap: 4px; }
.ten { display: grid; grid-template-columns: 88px 1fr; gap: 6px 20px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--soft); }
.ten .t { font-size: 26px; line-height: 1; }
.ten .meta { font-size: 14px; color: var(--text); }
.ten .meta b { color: var(--ink); }
.ten .bar { grid-column: 2; position: relative; height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.ten .bar i { position: absolute; top: 0; bottom: 0; background: var(--ink); border-radius: 5px; transform: scaleX(0); transform-origin: left; transition: transform 1.2s var(--ease); }
.ten .bar i.live { background: var(--rope); }
.tenure.in .bar i { transform: none; }

/* ---------------------------------------------------------------- el calendario de cuadraditos: cada día que compitió */
.cal { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.cal .grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.cal .grid i { aspect-ratio: 1; border-radius: 3px; background: var(--soft); transform: scale(0); transition: transform .4s var(--spring); }
.cal .grid i.r1 { background: #9EBDE8; } .cal .grid i.r2 { background: #5486D3; } .cal .grid i.r3 { background: var(--fast); }
.cal.in .grid i { transform: scale(1); }
.cal .months { display: flex; justify-content: space-between; font: 600 12px var(--f-body); color: var(--muted); margin-top: 8px; }
@media (max-width: 359px) {
  .cal .year-wrap { overflow-x: auto; }
  .cal .months { padding-inline-end: 2px; }
  .cal .year { width: max-content; min-width: 100%; }
}
.cal ol { list-style: none; margin: 0; padding: 0; }
.cal ol li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--soft); font-size: 14px; }
.cal ol li b { font: 900 20px var(--f-num); }
.cal ol li small { display: block; color: var(--muted); }

/* ---------------------------------------------------------------- mejor marca a cada edad: un mapa de calor */
.agegrid { overflow-x: auto; }
.agegrid table { border-collapse: separate; border-spacing: 3px; }
.agegrid th { font: 700 12px var(--f-body); color: var(--muted); padding: 4px 6px; text-align: center; }
.agegrid td { font: 900 17px var(--f-num); font-variant-numeric: tabular-nums; padding: 8px 8px; text-align: center; border-radius: 6px; background: var(--panel); white-space: nowrap; }
.agegrid td:first-child { font: 700 14px var(--f-body); background: none; text-align: left; padding-left: 0; }
.agegrid td.best { background: var(--fast); color: #fff; }
.agegrid td:empty { background: transparent; }

/* ---------------------------------------------------------------- resultados por competición: la fecha a la izquierda, como en una
   agenda; la abierta se vuelve una tarjeta blanca con sus nados dentro, cada uno con su día */
#meetbox { border-top: 2px solid var(--ink); }
.meet { border-bottom: 1px solid var(--line); transition: background .25s, border-radius .25s, margin .25s; }
.meet summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 72px 1fr auto 18px; gap: 16px; align-items: center; padding: 12px 8px; border-radius: 12px; }
.meet summary::-webkit-details-marker { display: none; }
.meet summary:hover { background: var(--panel); }
.meet summary:focus-visible { outline: 3px solid var(--fast); }
.meet .mdate { font: 600 12px var(--f-body); color: var(--muted); line-height: 1.1; white-space: nowrap; }
.meet .mdate b { display: block; font: 900 22px/1 var(--f-num); color: var(--ink); }
.meet summary h4 { margin: 0; font: 700 16px var(--f-body); }
.meet summary .where { font-size: 13px; color: var(--muted); margin-top: 3px; }
.meet .mtag .wr, .meet .mtag .pb { white-space: nowrap; }
.meet .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .3s var(--ease); }
.meet[open] { background: var(--panel); border-radius: 14px; border-bottom-color: transparent; margin: 10px 0; box-shadow: 0 0 0 1px var(--line); }
.meet[open] summary:hover { background: none; }
.meet[open] .chev { transform: rotate(180deg); }
.meet table { width: calc(100% - 104px); margin: 0 8px 14px 96px; border-collapse: collapse; }
.meet td { padding: 8px 4px; border-top: 1px solid var(--soft); font-size: 15px; }
.meet td.sday { width: 64px; font: 600 13px var(--f-body); color: var(--muted); white-space: nowrap; }
.meet td.r { color: var(--muted); font-size: 13px; }
.meet td.t { text-align: right; font: 900 22px var(--f-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 700px) {
  .meet summary { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; padding: 12px 4px; }
  .meet summary .chev { display: none; }
  .meet .mdate b { font-size: 18px; }
  .meet[open] summary { padding: 12px 10px; }
  .meet table { width: calc(100% - 20px); margin: 0 10px 12px; }
  .meet td.sday { width: 46px; }
  .meet td.r { display: none; }
}
@media (max-width: 359px) {
  .meet td.t { white-space: normal; overflow-wrap: normal; }
}

/* ---------------------------------------------------------------- sus publicaciones: el vídeo se mueve solo mientras se ve; el
   titular y las visitas, al lado y fuera de la imagen (al pasar el ratón no se va nada) */
.swposts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr)); gap: 22px; }
.swpost { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: center; text-decoration: none; padding: 14px; border-radius: 22px; transition: background .3s; }
.swpost:hover { background: var(--panel); }
.swpost:focus-visible { outline: 3px solid var(--fast); }
.pm { position: relative; transition: transform .5s var(--spring); }
.swpost:hover .pm { transform: translateY(-6px) rotate(-1.5deg); }
.pm.reel { aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: var(--soft); box-shadow: 0 24px 40px -30px rgba(11, 34, 51, .7); }
.pm.reel img, .pm.reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pm.reel video { opacity: 0; transition: opacity .4s; }
.pm.reel video.on { opacity: 1; }
/* los carruseles: sus láminas apiladas, la primera delante; al pasar el ratón se abren en abanico */
.pm.car { aspect-ratio: 4 / 5; margin: 0 12px 0 0; }
.pm.car img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 12px; background: #fff;
  box-shadow: 0 14px 28px -20px rgba(11, 34, 51, .8); transform: translate(calc(var(--i) * 9px), calc(var(--i) * -7px)) rotate(calc(var(--i) * 3deg)); transition: transform .5s var(--spring); }
.swpost:hover .pm.car img { transform: translate(calc(var(--i) * 22px), calc(var(--i) * -10px)) rotate(calc(var(--i) * 6deg)); }
.pt .pd { font: 600 13px var(--f-body); color: var(--muted); }
.pt h3 { margin: 6px 0 0; font: 800 clamp(19px, 1.7vw, 24px)/1.2 var(--f-head); letter-spacing: -0.015em; color: var(--ink); text-transform: none; }
.pv { margin: 16px 0 0; display: flex; align-items: baseline; gap: 8px; }
.pv .num { font-size: 44px; line-height: 1; color: var(--ink); }
.pv span { font: 600 13px var(--f-body); color: var(--muted); }
@media (max-width: 560px) {
  .swpost { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 10px 0; }
  .pv .num { font-size: 34px; }
}
@media (max-width: 359px) {
  .swpost { grid-template-columns: 100px minmax(0, 1fr); }
  .pt { overflow-wrap: anywhere; }
  .pv { flex-wrap: wrap; row-gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .pm, .pm.car img { transition: none; } }
