/*
  Running for Water

  Colors follow Team World Vision: their orange for race bibs and primary
  actions, a water blue, and the yellow of the jerrycans people carry water
  in. Big Shoulders (a condensed face drawn for Chicago, home of Team World
  Vision's biggest marathon) sets headlines; Lato, Team World Vision's text
  face, sets everything else.
*/

:root {
  color-scheme: light;
  --ink: #103140;
  --ink-soft: #3e5a66;
  --paper: #ffffff;
  --mist: #e6f4f7;
  --water: #00a3c4;
  --water-deep: #006e85;
  --jerrycan: #f9ac00;
  --orange: #f37021;
  --line: #c9dde3;
  --danger: #b42318;
  --success: #e5f4ea;

  --font-display: 'Big Shoulders', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --font-body: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --measure: 38rem;
  --page: 74rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-space: clamp(3.5rem, 8vw, 6.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
}

@media (min-width: 48em) {
  body {
    font-size: 1.125rem;
  }
}

img,
svg {
  display: block;
  max-width: 100%;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--water-deep);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--water);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  color: var(--paper);
  transform: none;
}

.muted {
  color: var(--ink-soft);
}

.break {
  overflow-wrap: anywhere;
}

.nowrap {
  white-space: nowrap;
}

/* Header and footer */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font: 800 1.625rem/1 var(--font-display);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark__drop {
  width: 1.625rem;
  height: 1.625rem;
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  font-size: 0.9375rem;
}

.account form {
  margin: 0;
}

.account__email {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--water-deep);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.site-footer__inner p {
  max-width: 44rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

/* Hero */

.hero {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3.5rem) var(--gutter) var(--section-space);
}

.hero__title {
  max-width: 13ch;
  margin: 0;
  font: 900 clamp(3.25rem, 10.5vw, 7.75rem)/0.9 var(--font-display);
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.hero__body {
  display: grid;
  gap: 2.5rem;
  margin-top: clamp(1.5rem, 4vw, 3rem);
}

.hero__lede {
  max-width: 30rem;
  margin: 0;
  font-size: clamp(1.1875rem, 2.1vw, 1.375rem);
  line-height: 1.5;
}

@media (min-width: 62em) {
  .hero__body {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: start;
    gap: 4rem;
  }
}

/* Runner buttons, drawn as race bibs */

.runners__title {
  margin: 0 0 1rem;
  font: 700 1.125rem/1.3 var(--font-body);
}

.runners__empty {
  max-width: 30rem;
  padding: 1.25rem 1.5rem;
  border: 2px dashed var(--line);
  border-radius: 0.75rem;
}

.runners__note {
  max-width: 30rem;
  margin: 1.5rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.bibs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Bibs in a row share one height, so their Donate buttons line up. */
.bibs__item {
  display: grid;
}

.bib {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 12rem;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 0.875rem;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 0.375rem 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Safety-pin holes in the four corners */
.bib::after {
  content: '';
  position: absolute;
  inset: 0.5rem;
  pointer-events: none;
  --hole: radial-gradient(circle, var(--paper) 0 3px, var(--ink) 3.5px 5px, transparent 5.5px);
  background:
    var(--hole) top left / 12px 12px no-repeat,
    var(--hole) top right / 12px 12px no-repeat,
    var(--hole) bottom left / 12px 12px no-repeat,
    var(--hole) bottom right / 12px 12px no-repeat;
}

.bib:hover {
  color: var(--ink);
  transform: translateY(-3px);
  box-shadow: 0 0.5625rem 0 var(--ink);
}

.bib:active {
  transform: translateY(3px);
  box-shadow: 0 0.1875rem 0 var(--ink);
}

.bib:focus-visible {
  outline: 4px solid var(--water);
  outline-offset: 5px;
}

.bib__event {
  padding: 0.625rem 2rem;
  background: var(--orange);
  font-size: 0.875rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.bib__name {
  align-self: center;
  padding: 0.75rem 2rem 0.5rem;
  font: 900 clamp(3rem, 6.5vw, 4.25rem)/0.95 var(--font-display);
  overflow-wrap: anywhere;
}

.bib__action {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 2rem 1.375rem;
  border-top: 2px dashed var(--line);
}

/* Drawn like the site's primary buttons, so the bib reads as a donation
   button without the small print. */
.bib__donate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  background: var(--orange);
  font: 900 1.1875rem/1.2 var(--font-body);
}

/* A chevron pointing to the runner's page */
.bib__donate::after {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.bib:hover .bib__donate {
  background: #f68a48;
}

.bib:hover .bib__donate::after {
  transform: translateX(3px) rotate(45deg);
}

.bib__via {
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .bib,
  .bib__donate::after {
    transition: none;
  }

  .bib:hover,
  .bib:active {
    transform: none;
  }

  .bib:hover .bib__donate::after {
    transform: rotate(45deg);
  }
}

/* Race day compared with a week of walking for water */

.week {
  background: var(--mist);
}

.week__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--section-space) var(--gutter);
}

.section-title {
  max-width: 18ch;
  margin: 0 0 1.25rem;
  font: 800 clamp(2.25rem, 5.5vw, 3.75rem)/0.95 var(--font-display);
  text-wrap: balance;
}

.week__inner > p,
.impact > p,
.help > p {
  max-width: var(--measure);
}

.race {
  margin: clamp(2rem, 5vw, 3.5rem) 0 0;
}

.race__chart {
  display: grid;
  gap: 2rem;
}

.race__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.race__label {
  font-weight: 700;
}

.race__total {
  font: 900 clamp(1.5rem, 3.5vw, 2.25rem)/1 var(--font-display);
  white-space: nowrap;
}

.race__bar {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
}

.race__bar--marathon {
  height: 1.5rem;
  border-radius: 0.75rem;
  background: var(--orange);
}

/* Seven segments of 3.7 miles on the same scale as the 26.2-mile bar: the
   last column is the 0.3 miles a week falls short of a marathon. */
.race__bar--week {
  display: grid;
  grid-template-columns: repeat(7, 37fr) 3fr;
  margin-bottom: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 700;
}

.race__bar--week li::before {
  content: '';
  display: block;
  height: 1.5rem;
  margin-bottom: 0.375rem;
  border-right: 3px solid var(--mist);
  background: var(--jerrycan);
}

.race__bar--week li:first-child::before {
  border-radius: 0.75rem 0 0 0.75rem;
}

.race__bar--week li:last-child::before {
  border-right: 0;
  border-radius: 0 0.75rem 0.75rem 0;
}

.race__caption {
  max-width: var(--measure);
  margin-top: 1.5rem;
  color: var(--ink-soft);
}

/* Impact and ways to help */

.impact,
.help {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--section-space) var(--gutter) 0;
}

.help {
  padding-bottom: var(--section-space);
}

.facts {
  display: grid;
  gap: 1.25rem;
  max-width: 44rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
  font-size: clamp(1.1875rem, 2.1vw, 1.375rem);
  line-height: 1.45;
}

.facts li {
  position: relative;
  padding-left: 2.25rem;
}

/* A small water drop marks each fact */
.facts li::before {
  content: '';
  position: absolute;
  top: 0.2em;
  left: 0;
  width: 1.125rem;
  height: 1.125rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 2.5c-.4 0-9.5 10.6-9.5 17.2a9.5 9.5 0 0 0 19 0C25.5 13.1 16.4 2.5 16 2.5Z' fill='%2300a3c4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.facts strong {
  font-weight: 900;
}

.source {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1.5rem 0;
}

.share__status {
  color: var(--ink-soft);
  font-weight: 700;
}

.help__give {
  margin: 0;
  font-weight: 700;
}

/* On wide screens every section shares the hero's two columns: headings on
   the left, content on the right, under the runner buttons. */
@media (min-width: 62em) {
  .week__inner,
  .impact,
  .help {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    column-gap: 4rem;
    align-items: start;
  }

  .week__inner > *,
  .impact > *,
  .help > * {
    grid-column: 2;
  }

  .week__inner > .section-title,
  .impact > .section-title,
  .help > .section-title {
    grid-row: 1 / span 5;
    grid-column: 1;
  }

  .week__inner > .race {
    grid-column: 1 / -1;
  }

  .section-title {
    margin-bottom: 0;
  }
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 2.875rem;
  padding: 0.6875rem 1.25rem;
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  background: var(--orange);
  color: var(--ink);
  font: 900 1rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #f68a48;
  color: var(--ink);
}

.button[hidden] {
  display: none;
}

.button--secondary {
  background: var(--paper);
}

.button--secondary:hover {
  background: var(--mist);
}

.button--danger {
  border-color: var(--danger);
  background: var(--paper);
  color: var(--danger);
}

.button--danger:hover {
  background: #fdecea;
  color: var(--danger);
}

/* Follows Google's sign-in button guidance: white, gray outline, full logo. */
.button--google {
  border: 1px solid #747775;
  border-radius: 999px;
  background: var(--paper);
  color: #1f1f1f;
  font-weight: 700;
}

.button--google:hover {
  background: #f2f2f2;
  color: #1f1f1f;
}

.button--google svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Admin pages */

.page--admin {
  background: #f2f8fa;
}

/* Admin pages are one narrow column; the header and footer line up with it. */
.page--admin .site-header,
.page--admin .site-footer__inner {
  max-width: 52rem;
}

.flash {
  max-width: calc(52rem - 2 * var(--gutter));
  margin: 0 auto 1.5rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid #9fd3b0;
  border-radius: 0.5rem;
  background: var(--success);
  font-weight: 700;
}

@media (max-width: 54em) {
  .flash {
    margin-right: var(--gutter);
    margin-left: var(--gutter);
  }
}

.admin {
  display: grid;
  gap: 1.75rem;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.5rem var(--gutter) 4rem;
}

.panel {
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--paper);
}

.panel--narrow {
  max-width: 34rem;
}

.panel--danger {
  border-color: #f1b8b2;
}

.admin__title {
  margin: 0 0 1rem;
  font: 800 clamp(2.25rem, 6vw, 3rem)/0.95 var(--font-display);
  text-wrap: balance;
}

.panel__title {
  margin: 0 0 0.75rem;
  font: 800 clamp(1.75rem, 4vw, 2.25rem)/1 var(--font-display);
}

.back-link {
  margin: 0;
  font-weight: 700;
}

.callout {
  padding: 0.875rem 1.125rem;
  border-left: 4px solid var(--jerrycan);
  border-radius: 0.25rem;
  background: #fff7e0;
}

.preview {
  max-width: 17rem;
  margin: 0.5rem 0 1.25rem;
}

.bib--preview {
  min-height: 0;
  pointer-events: none;
}

.bib--preview .bib__name {
  font-size: 2.75rem;
}

.form {
  display: grid;
  gap: 1.375rem;
  max-width: 34rem;
  margin-top: 1.5rem;
}

.form > p {
  margin: 0;
}

.field label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 700;
}

.field input[type='text'],
.field input[type='email'] {
  width: 100%;
  padding: 0.6875rem 0.8125rem;
  border: 2px solid #7f99a4;
  border-radius: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.field input:focus {
  border-color: var(--water-deep);
  outline: 3px solid rgb(0 163 196 / 0.35);
  outline-offset: 0;
}

.field__help {
  margin: 0.375rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.field__error {
  margin: 0.375rem 0 0;
  color: var(--danger);
  font-size: 0.9375rem;
  font-weight: 700;
}

.field--invalid input[type='text'],
.field--invalid input[type='email'] {
  border-color: var(--danger);
}

.field--checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.field--checkbox input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.2rem 0 0;
  accent-color: var(--water-deep);
}

.field--checkbox label {
  margin: 0;
  font-weight: 400;
}

.dev-sign-in {
  margin: 2rem 0;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--line);
}

.people {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.people th,
.people td {
  padding: 0.75rem 0.625rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.people th {
  color: var(--ink-soft);
  font-weight: 700;
}

.people__edit {
  text-align: right;
  white-space: nowrap;
}

/* On phones each person becomes a short stack of labeled lines. */
@media (max-width: 40em) {
  .people thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .people tr {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }

  .people td {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.25rem 0;
    border: 0;
  }

  .people td::before {
    content: attr(data-label);
    color: var(--ink-soft);
    font-weight: 700;
  }

  .people__edit {
    text-align: left;
  }
}

/* Simple pages: not found, errors */

.message {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--section-space) var(--gutter);
}

.message__title {
  margin: 0 0 1rem;
  font: 900 clamp(3rem, 8vw, 5rem)/0.95 var(--font-display);
}
