@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Shantell Sans";
  src: url("fonts/shantell-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Taken from the RPR badge: its navy ink and shoe orange, on a cool near-white. The chain is the shoe orange. */
:root {
  --mist: #f4f6f7;
  --pine: #13252e;
  --moss: #ff6201;
  --lamp: #13252e;
  --lamp-ink: #a84000;
  --lichen: #c5ced3;
  --bark: #55646c;
  --you: #e4eaed;
  --strava: #fc5200;
  --cell: 26px;
  --gutter: 3px;
  --name-w: 12.5rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --mist: #0f1b21;
    --pine: #e6edf0;
    --moss: #ff7a29;
    --lamp: #e6edf0;
    --lamp-ink: #ff9a5c;
    --lichen: #33444c;
    --bark: #94a4ac;
    --you: #182830;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--pine);
  font: 400 1rem/1.5 "Barlow", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2.5rem) 2.5rem;
}

h1 {
  font: 700 clamp(2.1rem, 5.5vw, 3.9rem)/1.05 "Shantell Sans", sans-serif;
  margin: 0 0 0.75rem;
  max-width: 20ch;
}

.status {
  font-size: 1.15rem;
  color: var(--bark);
  margin: 0;
  max-width: 60ch;
}

.masthead {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.25rem);
  margin: 0 0 2.5rem;
}
.masthead h1 { margin-bottom: 0.5rem; }
.badge { flex: none; width: clamp(96px, 13vw, 156px); height: auto; }
.status strong { color: var(--pine); font-weight: 600; }

/* The board: a sticky name column, then one narrow column per day of the challenge. */
.board {
  position: relative;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0.5rem;
}
.row {
  display: grid;
  grid-template-columns: var(--name-w) repeat(var(--days), var(--cell));
  align-items: center;
  width: max-content;
  min-width: 100%;
}
.row.person { min-height: 3.5rem; }
.row.person.you, .row.person.you .who { background: var(--you); }
.row.person.you { border-radius: 0.6rem; }

.who {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--mist);
  align-self: stretch;
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: center;
  padding: 0.35rem 0.75rem 0.35rem 0.5rem;
  border-radius: 0.6rem 0 0 0.6rem;
}
.streak {
  font: 700 1.6rem/1 "Shantell Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-right: 0.65rem;
}
.streak.zero { color: var(--lichen); }
.bill { display: block; white-space: normal; font-size: 0.85rem; font-weight: 600; color: var(--lamp-ink); }
.row.hook .who { box-shadow: inset 3px 0 0 var(--moss); }

.section {
  position: sticky;
  left: 0;
  width: min(100%, 40rem);
  padding: 1.75rem 0 0.4rem 0.5rem;
}
.section h2 { font: 700 1.3rem/1.2 "Shantell Sans", sans-serif; margin: 0; }
.section p { margin: 0.15rem 0 0; color: var(--bark); font-size: 0.95rem; }
.head + .section { padding-top: 0.5rem; }
.name { font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally { display: block; white-space: normal; font-size: 0.85rem; font-weight: 400; color: var(--bark); }

.head { font: 500 0.8rem/1.1 "Barlow Condensed", sans-serif; color: var(--bark); padding-bottom: 0.4rem; }
.head .who { font: 400 0.8rem/1.2 "Barlow", sans-serif; align-items: end; }
.head .day { text-align: center; font-variant-numeric: tabular-nums; }
.head .month { display: block; color: var(--pine); font-weight: 700; height: 1.1em; }
.head .day.is-today .num {
  display: inline-block;
  min-width: 1.5rem;
  border-radius: 1rem;
  background: var(--lamp);
  color: var(--mist);
  font-weight: 700;
}

/* Each day is a mark; consecutive active days fuse into one unbroken bar. */
.cell { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 var(--gutter); }
.mark { display: block; width: 100%; height: 18px; }
.done .mark { background: var(--moss); border-radius: 9px; }
.done.jp { padding-left: 0; }
.done.jn { padding-right: 0; }
.done.jp .mark { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.done.jn .mark { border-top-right-radius: 0; border-bottom-right-radius: 0; }
a.mark:hover { filter: brightness(1.15); }
a.mark:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.missed .mark { width: 6px; height: 6px; border-radius: 50%; background: var(--lichen); }
.today .mark { width: 18px; border-radius: 50%; border: 2px solid var(--lamp); }
.future .mark { width: 3px; height: 3px; border-radius: 50%; background: var(--lichen); opacity: 0.6; }

.key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--bark);
}
.key li { display: flex; align-items: center; gap: 0.5rem; }
.key .cell { width: 2.4rem; height: 18px; padding: 0; }
.key .done .mark { width: 2.4rem; }

.empty { color: var(--bark); max-width: 50ch; }

footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--lichen);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--bark);
}
footer p { margin: 0; max-width: 52ch; }
footer form { display: inline; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

button, .button {
  font: 600 0.95rem/1 "Barlow", sans-serif;
  border-radius: 0.5rem;
  padding: 0.6rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.quiet { background: transparent; color: var(--pine); border: 1px solid var(--lichen); }
button.quiet:hover { border-color: var(--bark); }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.strava-button { background: var(--strava); color: #fff; border: 0; padding: 0.85rem 1.2rem; }
.powered { font-weight: 600; color: var(--strava); text-decoration: none; }
.powered img { display: block; height: 24px; width: auto; }
/* Strava's guidelines: the official button at 48px tall, unmodified. */
.connect { display: inline-block; border-radius: 4px; }
.connect img { display: block; height: 48px; width: auto; }
.connect:focus-visible, .powered:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }

.notice {
  border-left: 4px solid var(--lamp);
  padding: 0.6rem 0 0.6rem 1rem;
  margin: 0 0 2rem;
  max-width: 60ch;
}
.lede { font-size: 1.15rem; max-width: 52ch; margin: 0 0 2rem; }

@media (max-width: 640px) {
  :root { --name-w: 9.25rem; --cell: 24px; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .badge { width: 96px; }
  .who { grid-template-columns: 2.4rem 1fr; padding-right: 0.5rem; }
  .streak { font-size: 1.25rem; padding-right: 0.45rem; }
  .tally { font-size: 0.78rem; }
}
