/* =========================================================================
   Rumbo a la Largada — identidad "Celeste y Sol" 🇦🇷
   Cielo celeste porteño, Sol de Mayo dorado, fileteado con onda.
   Bricolage / Inter / Space Mono.
   ========================================================================= */

:root {
  /* paleta */
  --bg:        #eaf3fb;   /* cielo celeste pálido */
  --bg-deep:   #d8e8f6;
  --surface:   #ffffff;
  --ink:       #14253f;   /* azul noche porteña */
  --ink-soft:  #46586f;
  --ink-faint: #8593a6;
  --line:      #d3e1ee;

  --celeste:    #74acdf;  /* celeste de la bandera */
  --celeste-dk: #3f86c9;
  --sol:        #f6b40e;  /* Sol de Mayo */
  --sol-dk:     #d99500;

  /* alias usados por los componentes */
  --coral:     var(--celeste-dk);  /* acento primario */
  --coral-dk:  #2f6fb0;
  --sun:       var(--sol);
  --sun-dk:    var(--sol-dk);

  /* colores por tipo de día */
  --t-easy:     #2f9e6b;  /* verde */
  --t-runwalk:  #18a0a8;  /* teal */
  --t-long:     #3f86c9;  /* celeste */
  --t-walk:     #c98a2b;  /* arena */
  --t-strength: #7a52c4;  /* uva */
  --t-rest:     #93a0b0;  /* gris */
  --t-race:     #3f86c9;  /* celeste */

  /* tipografía */
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body:    'Inter', system-ui, sans-serif;
  --mono:    'Space Mono', 'SF Mono', ui-monospace, monospace;

  --radius:  18px;
  --radius-sm: 12px;
  --shadow:  0 14px 36px -22px rgba(20, 37, 63, .55);
  --maxw:    1080px;
}

* { box-sizing: border-box; }

/* Mantené el texto seleccionado legible en todos lados — incluido el banner
   celeste-y-sol de la carrera, donde el resaltado claro lo borraría. */
::selection { background: var(--ink); color: #fff; }
::-moz-selection { background: var(--ink); color: #fff; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(130% 60% at 80% -10%, #fff6e0 0%, rgba(255, 246, 224, 0) 50%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* franja de la bandera 🇦🇷 */
.flagbar {
  height: 8px;
  background: linear-gradient(to bottom,
    var(--celeste) 0 33.33%, #ffffff 33.33% 66.66%, var(--celeste) 66.66% 100%);
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 50;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

strong { font-weight: 700; }

/* ------------------------------- hero ---------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 5rem) 1.25rem clamp(2rem, 4vw, 3rem);
}
.hero__inner { max-width: var(--maxw); margin: 0 auto; position: relative; z-index: 1; }

/* Sol de Mayo radiante */
.sol {
  position: absolute;
  top: -150px; right: -90px;
  width: 440px; height: 440px;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--sol) 0 23%, rgba(246, 180, 14, 0) 25%),
    repeating-conic-gradient(from 0deg, var(--sol) 0deg 6deg, rgba(246, 180, 14, 0) 6deg 14deg);
  opacity: .20;
  -webkit-mask-image: radial-gradient(circle at center, #000 0 58%, transparent 72%);
  mask-image: radial-gradient(circle at center, #000 0 58%, transparent 72%);
}
@media (prefers-reduced-motion: no-preference) {
  .sol { animation: spin 120s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  color: var(--coral-dk);
  margin: 0 0 1rem;
  font-weight: 700;
}

.hero__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 11vw, 7rem);
  line-height: .92;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
}
.hero__title-accent {
  color: var(--celeste-dk);
  position: relative;
}
.hero__title-accent::after {
  content: '';
  position: absolute;
  left: 0; right: -2%;
  bottom: .08em;
  height: .12em;
  background: var(--sol);
  border-radius: 4px;
  transform: skewX(-12deg);
}

.hero__lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 0 0 2rem;
}

/* cuenta regresiva en vivo */
.countdown {
  display: inline-flex;
  flex-direction: column;
  gap: .55rem;
  background: var(--ink);
  color: #fff;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}
.countdown__lead {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .68rem;
  font-weight: 700;
  color: var(--celeste);
}
.countdown__clock { display: flex; gap: .55rem; }
.seg {
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: .5rem .55rem .45rem;
  min-width: 62px;
  text-align: center;
}
.seg__num {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1;
  color: var(--sol);
  font-variant-numeric: tabular-nums;
}
.seg__lbl {
  font-family: var(--mono);
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #aebfd2;
}
.countdown__date { font-family: var(--mono); font-size: .72rem; color: #aebfd2; }
.countdown__bigmsg {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  color: var(--sol);
}

/* firma: el gráfico de subida */
.climb {
  margin: 0 0 2.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--shadow);
}
.climb__chart { width: 100%; }
.climb__chart svg { width: 100%; height: auto; display: block; }
.climb__cap {
  font-size: .85rem;
  color: var(--ink-soft);
  margin: .75rem .25rem 0;
}

/* internos del gráfico */
.climb-area { opacity: .9; }
.climb-line {
  fill: none;
  stroke: var(--celeste-dk);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.climb-dot { fill: #fff; stroke: var(--celeste-dk); stroke-width: 2.5; }
.climb-dot--now { fill: var(--sol); stroke: #fff; }
.climb-label { font-family: var(--mono); font-size: 9px; fill: var(--ink-faint); }
.climb-km { font-family: var(--mono); font-size: 9px; fill: var(--ink-soft); font-weight: 700; }
.climb-flag { font-size: 18px; }
.climb-base { stroke: var(--line); stroke-width: 1; }

@media (prefers-reduced-motion: no-preference) {
  .climb-line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.6s ease forwards .2s; }
  .climb-area { opacity: 0; animation: fade 1.2s ease forwards 1.1s; }
  .climb-dot, .climb-flag, .climb-km { opacity: 0; animation: fade .4s ease forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* progreso */
.progress {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: var(--shadow);
  max-width: 640px;
}
.progress__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.progress__title { font-family: var(--display); font-weight: 600; font-size: 1.2rem; }
.progress__count { font-family: var(--mono); font-weight: 700; color: var(--coral-dk); }
.progress__track {
  height: 14px;
  background: var(--bg-deep);
  border-radius: 99px;
  margin: .8rem 0;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--t-easy), var(--sol), var(--celeste-dk));
  transition: width .5s cubic-bezier(.22,1,.36,1);
}
.progress__stats {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.2rem;
  font-size: .85rem;
  color: var(--ink-soft);
  margin-bottom: .9rem;
}
.progress__stats b { color: var(--ink); font-family: var(--mono); }

.ghost-btn {
  font: inherit;
  font-size: .8rem;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: .35rem .9rem;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.ghost-btn:hover { color: var(--coral-dk); border-color: var(--celeste-dk); }

/* ------------------------------- bandas -------------------------------- */
.band {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) 1.25rem;
}
.band__h {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  letter-spacing: -0.01em;
  margin: 0 0 .35rem;
}
.band__sub { color: var(--ink-soft); margin: 0 0 1.8rem; max-width: 52ch; }

/* referencias */
.legend {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .8rem;
}
.legend li {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--t, var(--ink));
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
}
.legend__emoji { font-size: 1.4rem; line-height: 1.2; }
.legend__name { font-weight: 700; }
.legend__desc { font-size: .82rem; color: var(--ink-soft); }

/* tarjetas de guía */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--accent, var(--ink));
}
.card--missed { --accent: var(--sol); }
.card--injury { --accent: var(--celeste-dk); }
.card--how    { --accent: var(--t-easy); }
.card__icon { font-size: 1.8rem; }
.card__h {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  margin: .5rem 0 .6rem;
}
.card p { margin: 0 0 .8rem; color: var(--ink-soft); }
.card__list { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--ink-soft); }
.card__list li { margin-bottom: .4rem; }

/* ------------------------------- semanas ------------------------------- */
.week {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.4rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.week__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  background: linear-gradient(100deg, #eaf4fc, #ffffff);
  border-bottom: 1px solid var(--line);
}
.week__num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--celeste-dk);
  display: flex;
  flex-direction: column;
}
.week__num small {
  font-family: var(--mono);
  font-size: .58rem;
  color: var(--ink-faint);
  letter-spacing: .12em;
  margin-bottom: .15rem;
  font-weight: 700;
}
.week__meta { min-width: 0; }
.week__phase {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
}
.week__range { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.week__focus { font-size: .82rem; color: var(--ink-faint); margin-top: .15rem; }

.week__summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  text-align: right;
}
.chip-km {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .95rem;
  background: var(--ink);
  color: #fff;
  padding: .2rem .6rem;
  border-radius: 99px;
  white-space: nowrap;
}
.week__sessions { font-size: .72rem; color: var(--ink-soft); }
.week__bar {
  width: 110px;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 99px;
  overflow: hidden;
}
.week__bar > span {
  display: block; height: 100%; width: 0;
  background: var(--t-easy);
  transition: width .4s ease;
}

/* filas de día */
.days { list-style: none; margin: 0; padding: 0; }
.day {
  display: grid;
  grid-template-columns: 56px 30px 1fr auto;
  align-items: center;
  gap: .9rem;
  padding: .8rem 1.3rem;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--t, var(--t-rest));
  transition: background .15s;
}
.day:last-child { border-bottom: none; }
.day:hover { background: #f3f8fd; }

.day__date { text-align: center; }
.day__dow {
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  font-weight: 700;
}
.day__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
}
.day__emoji { font-size: 1.4rem; text-align: center; }

.day__body { min-width: 0; }
.day__type {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: .98rem;
}
.day__type .pill {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .68rem;
  color: var(--t, var(--ink));
  background: color-mix(in srgb, var(--t) 12%, #fff);
  padding: .12rem .5rem;
  border-radius: 99px;
}
.day__dist { font-family: var(--mono); color: var(--ink); }
.day__opt {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 .3rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.day__intensity { font-size: .8rem; color: var(--ink-soft); margin-top: .15rem; }
.day__notes { font-size: .8rem; color: var(--ink-faint); margin-top: .2rem; }

/* checkbox */
.day__check {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .18s;
  flex-shrink: 0;
}
.day__check:hover { border-color: var(--t-easy); }
.day__check::after {
  content: '✓';
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  transform: scale(0);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.day__check[aria-pressed="true"] {
  background: var(--t-easy);
  border-color: var(--t-easy);
}
.day__check[aria-pressed="true"]::after { transform: scale(1); }
.day__check:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }

.day.is-done { background: #f1f8f3; }
.day.is-done .day__type, .day.is-done .day__dist { text-decoration: line-through; text-decoration-color: var(--ink-faint); }

/* marcador de hoy */
.day.is-today {
  background: linear-gradient(90deg, #fff6e0, #fff);
  border-left-color: var(--sol) !important;
}
.day.is-today .day__num { color: var(--sol-dk); }
.day__today-tag {
  font-family: var(--mono);
  font-size: .58rem;
  background: var(--sol);
  color: var(--ink);
  padding: .05rem .4rem;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-left: .4rem;
}

/* DÍA DE CARRERA — la cima */
.day--race {
  grid-template-columns: 1fr auto;
  background: linear-gradient(115deg, var(--celeste), var(--sol));
  color: var(--ink);
  padding: 1.5rem 1.5rem;
  border-left: none;
}
.race-banner__top {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .72rem;
  font-weight: 700;
  opacity: .85;
}
.race-banner__h {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
  margin: .2rem 0 .4rem;
}
.race-banner__meta { font-family: var(--mono); font-weight: 700; }
.race-banner__notes { font-size: .9rem; opacity: .95; margin-top: .5rem; max-width: 52ch; }
.day--race .day__check {
  width: 44px; height: 44px;
  border-color: rgba(20, 37, 63, .45);
  background: rgba(255, 255, 255, .35);
}
.day--race .day__check::after { font-size: 1.4rem; color: #fff; }
.day--race .day__check[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.day--race .day__check[aria-pressed="true"]::after { color: var(--sol); }

/* ------------------------------- footer -------------------------------- */
.foot {
  text-align: center;
  padding: 0 0 4rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}
.foot .flagbar { margin-bottom: 2.5rem; }
.foot__big {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin: 0 0 .6rem;
  padding: 0 1.25rem;
}
.foot__small { font-size: .8rem; color: var(--ink-faint); max-width: 54ch; margin: 0 auto; padding: 0 1.25rem; }

/* ------------------------------ confeti -------------------------------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -10px;
  width: 9px; height: 14px;
  opacity: .95;
  will-change: transform;
  box-shadow: 0 0 0 1px rgba(20,37,63,.04);
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
}

/* ------------------------------ responsive ----------------------------- */
@media (max-width: 620px) {
  .day {
    grid-template-columns: 48px 1fr auto;
    gap: .7rem;
    padding: .8rem 1rem;
  }
  .day__emoji { display: none; }
  .week__head { grid-template-columns: auto 1fr; padding: 1rem; }
  .week__summary { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .week__bar { width: 80px; }
  .countdown { width: 100%; }
  .seg { min-width: 0; flex: 1; }
  .day__notes { display: none; }
}
