/* Training plan builder (/train/). Tokens, .wrap, .btn, .brand, .section-label,
   .section-title and the header/footer come from styles.css — this file only
   adds the builder + plan components. */

/* Effort-zone hues, the page's information design: easy = the brand green,
   moderate = amber, hard = coral. Same three-state pattern as styles.css so
   the theme toggle wins in both directions. */
:root {
  --z-easy: #1F3D33;
  --z-mod: #B45309;
  --z-hard: #E8674A;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --z-easy: #9DC3AE;
    --z-mod: #E0B457;
    --z-hard: #F0836A;
  }
}
:root[data-theme="dark"] {
  --z-easy: #9DC3AE;
  --z-mod: #E0B457;
  --z-hard: #F0836A;
}

.train .num, .train .zones td, .train .legchip, .train .sumline, .train .day, .train .barlegend { font-variant-numeric: tabular-nums; }

/* ---- hero ---- */
.thero { padding: 40px 0 6px; }
.thero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.05; letter-spacing: -1.2px; font-weight: 800; margin: 0 0 12px; color: var(--text-hi); text-wrap: balance; }
.thero .lede { font-size: 17px; color: var(--text-lo); max-width: 46em; margin: 0; }
.thero .lede b { color: var(--text-hi); }

/* ---- builder ---- */
.builder { padding: 22px 0 4px; }
.bcard { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 0 0 12px; }
.bstep { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-lo); margin: 0 0 12px; }
.bstep b { color: var(--coral); font-size: 14px; margin-right: 4px; }
.frow { display: flex; gap: 10px 26px; flex-wrap: wrap; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
.field label { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-lo); }
.field label .opt { text-transform: none; letter-spacing: 0; font-weight: 600; }
.field input {
  font: 700 15px/1.2 'Manrope', system-ui, sans-serif; color: var(--text-hi);
  background: var(--surface-alt); border: 1px solid var(--divider); border-radius: 12px;
  padding: 9px 12px; min-width: 110px; max-width: 170px;
}
.field input:focus-visible { outline: 2px solid var(--coral); outline-offset: 1px; }
.field .hint, .bactions .hint, .exports .hint { font-size: 12px; color: var(--text-lo); font-weight: 500; max-width: 24em; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font: 700 13.5px/1 'Manrope', system-ui, sans-serif; color: var(--text-hi);
  border: 1px solid var(--divider); background: var(--surface); border-radius: 999px;
  padding: 9px 14px; cursor: pointer;
}
.pill:hover { border-color: var(--pine); }
.pill[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--ink-on-accent); }
.pill:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.derive { font-size: 13.5px; color: var(--text-lo); margin: 4px 0 0; }
.derive b { color: var(--text-hi); }
.err { color: var(--coral); font-size: 13.5px; font-weight: 700; margin: 6px 0 0; }
.bactions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 16px 0 8px; }

/* Connect Strava. Brand orange per Strava's guidelines — never themed. */
#stravaBox { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin: 0 0 16px; padding: 0 0 14px; border-bottom: 1px dashed var(--divider); }
#stravaBox[hidden] { display: none; }
.btn-strava {
  font: 800 14px/1 'Manrope', system-ui, sans-serif; color: #fff;
  background: #FC4C02; border: none; border-radius: 8px;
  padding: 11px 18px; cursor: pointer; white-space: nowrap;
}
.btn-strava:hover { filter: brightness(1.06); }
.btn-strava:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
#stravaBox .hint { max-width: 34em; }
#stravaOut { flex-basis: 100%; }
#stravaOut .sline { margin: 6px 0 0; font-size: 13.5px; color: var(--text-lo); }
#stravaOut .sline b { color: var(--text-hi); font-variant-numeric: tabular-nums; }
#stravaOut .flag { color: var(--coral); font-weight: 700; }
#stravaOut .sfoot { margin: 8px 0 0; font-size: 12px; color: var(--text-lo); }
.linkbtn { background: none; border: none; padding: 0; font: 700 12.5px 'Manrope', system-ui, sans-serif; color: var(--pine); text-decoration: underline; cursor: pointer; }
/* display:flex on .field/.frow would silently beat the hidden attribute. */
#relayFields[hidden], .field[hidden], .frow[hidden] { display: none; }

/* ---- results ---- */
#results { padding: 8px 0 0; }
.sumline { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 0; }
.sumline .chip { background: var(--surface); border: 1px solid var(--divider); border-radius: 999px; padding: 8px 15px; font-size: 13.5px; font-weight: 700; color: var(--text-hi); }
.sumline .chip small { color: var(--text-lo); font-weight: 600; margin-right: 5px; }
.notes { margin: 10px 0 0; }
.notes p { font-size: 13px; color: var(--text-lo); border-left: 3px solid var(--sage); padding-left: 10px; margin: 6px 0; max-width: 62em; }

.rescard { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 16px 0 0; }
.rescard h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.4px; font-weight: 800; color: var(--text-hi); }
.rescard .sub, .tsec .sub { font-size: 13.5px; color: var(--text-lo); margin: 0 0 14px; max-width: 56em; }

/* leg chips (relay) */
.legchips { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; }
.legchip { background: var(--surface-alt); border: 1px solid var(--divider); border-radius: 14px; padding: 12px 14px; }
.legchip b { display: block; font-size: 15px; font-weight: 800; color: var(--text-hi); }
.legchip b .night { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--slate); margin-left: 6px; }
.legchip .facts { font-size: 12.5px; color: var(--text-lo); }
.legchip .goal { margin-top: 7px; font-size: 15px; font-weight: 800; color: var(--coral); }
.legchip .goal small { display: block; font-weight: 600; font-size: 11.5px; color: var(--text-lo); }

/* zones table */
.zscroll { overflow-x: auto; }
.zones { width: 100%; min-width: 560px; border-collapse: collapse; }
.zones th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-lo); padding: 8px 10px; border-bottom: 1px solid var(--divider); }
.zones td { padding: 12px 10px; border-bottom: 1px solid var(--divider); font-size: 14.5px; color: var(--text-hi); vertical-align: top; }
.zones tr:last-child td { border-bottom: none; }
.zones .zn { font-weight: 800; white-space: nowrap; }
.zones .feel { color: var(--text-lo); font-size: 13px; }
.zones .pct { font-weight: 800; font-size: 17px; letter-spacing: -0.4px; }
.zones .pct small { display: block; font-weight: 600; font-size: 11px; color: var(--text-lo); letter-spacing: 0; }
.zdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }
.z-easy .zdot, .zdot.e { background: var(--z-easy); }
.z-mod .zdot, .zdot.m { background: var(--z-mod); }
.z-hard .zdot, .zdot.h { background: var(--z-hard); }

/* plan arc */
.arcscroll { overflow-x: auto; }
.arcscroll > div { min-width: 600px; }
.arc { display: flex; align-items: flex-end; gap: 5px; height: 120px; margin: 20px 0 0; }
.arc .bar { flex: 1; min-width: 12px; border: none; padding: 0; cursor: pointer; background: color-mix(in srgb, var(--pine) 32%, var(--surface)); border-radius: 6px 6px 2px 2px; position: relative; }
.arc .bar:hover { background: color-mix(in srgb, var(--pine) 55%, var(--surface)); }
.arc .bar.recovery { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--pine) 45%, var(--divider)); }
.arc .bar.taper { background: color-mix(in srgb, var(--pine) 18%, var(--surface)); }
.arc .bar.race { background: var(--surface-alt); border: 1.5px solid var(--coral); }
.arc .bar.tuneup { background: color-mix(in srgb, var(--z-mod) 26%, var(--surface)); border: 1.5px solid var(--z-mod); }
.arc .bar.tuneup .v { color: var(--z-mod); }
.arc .bar.now { background: var(--coral); }
.arc .bar:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.arc .bar .v { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 800; color: var(--text-lo); white-space: nowrap; }
.wknums { display: flex; gap: 5px; margin: 6px 0 0; }
.wknums span { flex: 1; min-width: 12px; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-lo); }
.phases { display: flex; gap: 5px; margin: 10px 0 0; }
.phase { border-top: 3px solid var(--sage); padding-top: 5px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-lo); text-align: center; }

/* whole-plan effort bar */
.bigsplit { margin: 26px 0 0; }
.tickrow { position: relative; height: 18px; }
.tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 10.5px; font-weight: 800; color: var(--text-lo); }
.tick::after { content: ""; display: block; width: 2px; height: 7px; background: var(--text-lo); margin: 1px auto 0; border-radius: 1px; }
.bigbar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; }
.bigbar .seg.e { background: var(--z-easy); }
.bigbar .seg.m { background: var(--z-mod); }
.bigbar .seg.h { background: var(--z-hard); }
.barlegend { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; margin: 12px 0 0; }
.bl { font-size: 13px; color: var(--text-hi); }
.bl b { display: block; font-size: 16px; letter-spacing: -0.3px; }
.bl small { color: var(--text-lo); font-weight: 600; }
.onstatus { margin-left: auto; font-size: 11.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--pine); border: 1.5px solid var(--pine); border-radius: 999px; padding: 5px 12px; }

/* goal odds card */
.oddsrow { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; margin: 6px 0 12px; }
.oddsnum b { display: block; font-size: 44px; font-weight: 800; letter-spacing: -2px; line-height: 1; color: var(--text-hi); }
.oddsnum .verdict { display: inline-block; margin: 8px 0 0; font-size: 11.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; border: 1.5px solid var(--divider); border-radius: 999px; padding: 4px 11px; }
.oddsnum .verdict.good { color: var(--pine); border-color: var(--pine); }
.oddsnum .verdict.mid { color: var(--z-mod); border-color: var(--z-mod); }
.oddsnum .verdict.low { color: var(--coral); border-color: var(--coral); }
.oddsnum small { display: block; margin: 6px 0 0; font-size: 12px; color: var(--text-lo); font-weight: 600; }
.oddsmeter { flex: 1; min-width: 240px; }
.meter { position: relative; height: 14px; border-radius: 7px;
  background: linear-gradient(to right, var(--coral), var(--z-mod) 42%, var(--pine) 78%);
  opacity: 0.9; }
.mmark { position: absolute; top: -5px; width: 4px; height: 24px; border-radius: 2px; background: var(--text-hi); transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.mmark.ghost { opacity: 0.4; }
.mlabels { display: flex; justify-content: space-between; margin: 8px 0 0; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-lo); }
#goalCard .derive b { font-variant-numeric: tabular-nums; }
.factors { margin: 10px 0 0; padding: 0 0 0 18px; }
.factors li { font-size: 13px; color: var(--text-lo); margin: 4px 0; max-width: 56em; }
.factors li b { color: var(--text-hi); }
.factors li.warn { color: var(--coral); font-weight: 700; list-style: none; margin-left: -18px; }

/* exports */
.exports { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0 0; }

/* week cards */
#weeks { margin: 8px 0 0; }
.wk { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--radius); padding: 16px 16px 12px; margin: 14px 0 0; scroll-margin-top: 80px; }
.wk.now { border-color: var(--coral); }
.wkhead { display: flex; align-items: baseline; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 10px; }
.wkhead h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--text-hi); }
.wkhead .ph { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--text-lo); }
.wkhead .load { font-size: 13px; color: var(--text-lo); font-weight: 600; }
.wkhead .mini { display: flex; height: 8px; width: 120px; border-radius: 4px; overflow: hidden; align-self: center; margin-left: auto; }
.wkhead .mini i.e { background: var(--z-easy); } .wkhead .mini i.m { background: var(--z-mod); } .wkhead .mini i.h { background: var(--z-hard); }
.wkscroll { overflow-x: auto; padding-bottom: 4px; }
.week7 { display: grid; grid-template-columns: repeat(7, minmax(138px, 1fr)); gap: 8px; min-width: 1020px; }
.day { background: var(--surface-alt); border: 1px solid var(--divider); border-radius: 12px; border-top: 4px solid var(--divider); padding: 10px 11px; display: flex; flex-direction: column; gap: 5px; }
.day.z-easy { border-top-color: var(--z-easy); }
.day.z-mod { border-top-color: var(--z-mod); }
.day.z-hard { border-top-color: var(--z-hard); }
.day.rest { opacity: 0.6; }
.day .dl { font-size: 10.5px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; color: var(--text-lo); }
.day h4 { margin: 0; font-size: 13.5px; font-weight: 800; color: var(--text-hi); }
.day p { margin: 0; font-size: 12px; color: var(--text-lo); line-height: 1.45; }
.dbl { border: 1px solid var(--divider); border-radius: 9px; padding: 6px 8px; background: var(--surface); }
.dbl b { font-size: 12px; display: block; color: var(--text-hi); }
.dbl span { font-size: 11px; color: var(--text-lo); }
.dblgap { text-align: center; font-size: 10.5px; font-weight: 800; color: var(--coral); letter-spacing: 1px; }

/* static sections */
.tsec { padding: 40px 0 4px; }
.tsec .sub.wide { max-width: 62em; font-size: 14.5px; }
.diff { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 18px 0 0; }
.diffcard { background: var(--surface); border: 1px solid var(--divider); border-radius: 16px; padding: 16px; }
.diffcard .big { font-size: 26px; font-weight: 800; letter-spacing: -1px; color: var(--coral); }
.diffcard .big small { font-size: 13px; font-weight: 700; color: var(--text-lo); letter-spacing: 0; margin-left: 2px; }
.diffcard h3 { margin: 4px 0 4px; font-size: 15px; font-weight: 800; color: var(--text-hi); }
.diffcard p { margin: 0; font-size: 13px; color: var(--text-lo); line-height: 1.5; }
.method p { font-size: 14.5px; color: var(--text-lo); max-width: 62em; margin: 0 0 12px; }
.method p b { color: var(--text-hi); }
.method .fine { font-size: 12.5px; }

@media (max-width: 560px) {
  .frow { gap: 8px 18px; }
  .field input { max-width: 100%; }
}
@media print {
  header.site nav, .builder, .exports, footer.site .fnav, .arc .bar { box-shadow: none; }
  .builder, .exports, #theme { display: none !important; }
  .rescard, .wk { box-shadow: none; break-inside: avoid; }
  .wkscroll { overflow: visible; }
  .week7 { min-width: 0; grid-template-columns: repeat(4, 1fr); }
}
