@font-face{font-family:"Barlow";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/barlow-latin-400-normal.woff2) format("woff2");}
@font-face{font-family:"Barlow";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/barlow-latin-500-normal.woff2) format("woff2");}
@font-face{font-family:"Barlow";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/barlow-latin-600-normal.woff2) format("woff2");}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2");}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2");}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:800;font-display:swap;src:url(fonts/barlow-condensed-latin-800-normal.woff2) format("woff2");}
:root {
  --paper: #f6f8ef;
  --wash: #e6eed8;
  --sky: #c8dba6;
  --blue: #5e8c3e;
  --navy: #22321c;
  --slate: #7a8a6b;
  --line: #dde6cc;
  --num: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", system-ui, sans-serif;
  --pad: clamp(20px, 5vw, 32px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { background-color: #e3edf0; }
body {
  background-color: #e3edf0;
  background-image: linear-gradient(#e3edf0 0, var(--paper) 340px, var(--paper) 100%);
  min-height: 100dvh;
  color: var(--navy);
  font: 400 17px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 10px; }
[hidden] { display: none !important; }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
}

/* Top bar */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad) 0;
}
.date {
  font: 600 19px/1 var(--num);
  letter-spacing: .01em;
  color: var(--slate);
  padding: 8px 0;
}
.date.is-today { color: var(--navy); }
.date .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  margin-left: 8px;
  vertical-align: 3px;
}
.icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--wash);
  transition: background .15s;
}
.icon:hover { background: var(--sky); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: var(--navy); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Day view */
.view { flex: 1; display: flex; flex-direction: column; }
.day { padding: 0 var(--pad) calc(18px + var(--safe-b)); touch-action: pan-y; }

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 0 32px;
}
.type {
  font: 600 26px/1 var(--num);
  color: var(--blue);
}
.miles {
  font: 800 clamp(150px, 46vw, 236px)/.82 var(--num);
  letter-spacing: -.035em;
  margin: 10px 0 0 -.04em;
  font-variant-numeric: tabular-nums;
}
.miles small {
  font: 600 .2em/1 var(--num);
  letter-spacing: 0;
  color: var(--slate);
  margin-left: .12em;
}
.miles.word {
  font-size: clamp(110px, 34vw, 176px);
  color: var(--sky);
  letter-spacing: -.02em;
}
.miles.race { color: var(--blue); }
.hero.swap .miles, .hero.swap .type { animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.steps {
  list-style: none;
  margin-top: 26px;
  border-left: 2px solid var(--sky);
  padding-left: 16px;
}
.steps:empty { display: none; }
.steps li { font-size: 18px; padding: 3px 0; }
.steps li.main { font-weight: 600; }
.pace { margin-top: 18px; color: var(--slate); font-size: 16px; }
.pace:empty { display: none; }
.pace b { color: var(--navy); font-weight: 600; }

.chip {
  align-self: flex-start;
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 12px;
  border-radius: 999px;
  background: var(--wash);
  font-weight: 500;
  font-size: 15px;
  transition: background .15s;
}
.chip:hover { background: var(--sky); }
.chip svg { width: 18px; height: 18px; fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; }

/* Week ribbon */
.week { padding-top: 8px; }
.ribbon {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 128px;
}
.bar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
  border-radius: 12px;
  padding: 0 0 4px;
}
.bar-day .n {
  font: 600 15px/1 var(--num);
  color: var(--slate);
  font-variant-numeric: tabular-nums;
}
.bar-day .b {
  width: 100%;
  max-width: 38px;
  border-radius: 8px;
  background: var(--sky);
  min-height: 4px;
  transition: background .15s;
}
.bar-day.rest .b { background: var(--line); }
.bar-day .l { font: 600 14px/1 var(--num); color: var(--slate); }
.bar-day.today .l { color: var(--blue); }
.bar-day.on .b { background: var(--blue); }
.bar-day.on .n, .bar-day.on .l { color: var(--navy); }
.bar-day:hover .b { background: #b3cc8a; }
.bar-day.on:hover .b { background: var(--blue); }

.weekfoot {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin-top: 14px;
}
.wk { text-align: center; font: 600 19px/1 var(--num); color: var(--slate); }
.wk b { color: var(--navy); font-weight: 700; }
.step {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.step:hover { background: var(--wash); }
.step svg { width: 22px; height: 22px; fill: none; stroke: var(--navy); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.step:disabled { opacity: .25; cursor: default; background: none; }

/* Calendar */
.cal { padding: 10px var(--pad) calc(24px + var(--safe-b)); }
.calhead, .row {
  display: grid;
  grid-template-columns: 34px repeat(7, 1fr) 46px;
  gap: 5px;
  align-items: center;
}
.calhead {
  position: sticky;
  top: 0;
  background: var(--paper);
  padding: 10px 0 8px;
  z-index: 1;
  font: 600 14px/1 var(--num);
  color: var(--slate);
  text-align: center;
}
.month {
  font: 700 22px/1 var(--num);
  margin: 22px 0 10px;
}
.month:first-child { margin-top: 6px; }
.row { margin-bottom: 5px; }
.row .w { font: 600 14px/1 var(--num); color: var(--slate); }
.cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font: 600 17px/1 var(--num);
  font-variant-numeric: tabular-nums;
  position: relative;
  background: var(--wash);
}
.cell.empty { background: none; cursor: default; }
.cell .dn {
  position: absolute;
  top: 4px; left: 6px;
  font: 500 10px/1 var(--text);
  opacity: .6;
}
.cell.today { box-shadow: inset 0 0 0 2px var(--navy); }
.cell.past { opacity: .45; }
.cell.race { background: var(--navy) !important; color: #fff; }
.row .t {
  text-align: right;
  font: 700 18px/1 var(--num);
  font-variant-numeric: tabular-nums;
}
.row.current .w, .row.current .t { color: var(--blue); }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: rgba(34, 50, 28, .28); animation: fade .2s ease-out; }
.panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 12px var(--pad) calc(22px + var(--safe-b));
  animation: up .24s cubic-bezier(.2, .8, .2, 1);
}
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 18px; }
.panel h2 { font: 700 30px/1 var(--num); }
.panel ol { list-style: none; margin-top: 18px; }
.panel li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.panel li span:last-child { color: var(--slate); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sheetnote { margin-top: 14px; color: var(--slate); font-size: 15px; }
.done {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

@media (min-width: 900px) {
  .hero { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Countryside scene */
.app { position: relative; isolation: isolate; }
.scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.scene svg { position: absolute; display: block; }
.hills { left: 50%; bottom: 0; width: max(100%, 760px); height: 300px; transform: translateX(-50%); }
.cloud { fill: #fff; }
.cloud-a { top: 70px; width: 170px; left: -40px; opacity: .95; animation: drift 90s linear infinite; }
.cloud-b { top: 150px; width: 110px; left: 60%; opacity: .8; animation: drift 120s linear infinite; animation-delay: -60s; }
.cloud-c { top: 30px; width: 90px; left: 35%; opacity: .7; animation: drift 150s linear infinite; animation-delay: -30s; }
@keyframes drift { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }
.sky-wash { position: absolute; inset: 0 0 auto 0; height: 340px; background: linear-gradient(#e3edf0, rgba(246,248,239,0)); }
.sprig { width: 96px; height: 96px; margin: 14px 0 0 4px; display: block; }
.sprig[hidden] { display: none; }
.cal ~ .scene .hills, body.on-cal .hills { opacity: .35; }
body.on-cal .cloud { opacity: .4; }
.calhead { background: rgba(246, 248, 239, .94); backdrop-filter: blur(6px); }
.cell.race { background: var(--blue) !important; }
@media (prefers-reduced-motion: reduce) { .cloud { animation: none; } }

.bar-day .b { background: rgba(255,255,255,.88); box-shadow: 0 0 0 1px rgba(94,140,62,.14) inset; }
.bar-day.rest .b { background: rgba(255,255,255,.7); box-shadow: none; }
.bar-day:hover .b { background: #fff; }
.bar-day.on .b, .bar-day.on:hover .b { background: var(--blue); box-shadow: none; }
.bar-day .n, .bar-day .l { color: #56684a; }
.wk { color: #4d5e42; }
.calhead { border-radius: 12px; }

/* Runs synced from Strava */
.bar-day.ran .b { background: #a9c98a; box-shadow: none; }
.bar-day.ran:hover .b { background: #9cc07a; }
.bar-day.ran.on .b, .bar-day.ran.on:hover .b { background: var(--blue); }
.cell.ran::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 12px; height: 2.5px; margin-left: -6px; border-radius: 2px; background: currentColor; opacity: .7; }

/* Actual vs goal */
.row .t small { display: block; margin-top: 3px; font: 600 12px/1 var(--num); color: var(--slate); }
.date .tally { margin-left: 12px; font: 600 16px/1 var(--num); color: var(--slate); }
.date .tally b { color: var(--blue); font-weight: 700; }
