/* ---------------------------------------------------------------
   peterkobak.com — Ohio to Erie ride
   Palette pulled from the trail itself: crushed limestone, towpath
   green blazes, canal water, and the orange of a you-are-here pin.
   --------------------------------------------------------------- */

:root {
  --paper:       #E9E6DC;
  --paper-deep:  #DFDBCC;
  --paper-edge:  #F3F1E9;
  --ink:         #23261F;
  --ink-soft:    #5C6155;
  --ink-faint:   #8A8D80;
  --rule:        #C7C2B1;
  --trail:       #4A6B3A;
  --canal:       #2F566B;
  --marker:      #C4502B;

  --display: 'Zilla Slab', Georgia, serif;
  --body:    'Source Serif 4', Georgia, serif;
  --data:    'IBM Plex Mono', ui-monospace, monospace;

  --measure: 34rem;
  --gutter:  1.5rem;
}

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

/* No image is ever allowed to be wider than its container. A safety net: if a
   specific rule goes missing or a stylesheet arrives stale, the layout bends
   instead of breaking. */
img { max-width: 100%; height: auto; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.75;
  /* Faint topo-contour texture. Two very low-contrast gradients, not an image
     file — keeps the page fast on trailside cell service. */
  background-image:
    repeating-linear-gradient(112deg, rgba(74,107,58,.035) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(28deg,  rgba(47,86,107,.03) 0 1px, transparent 1px 64px);
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.wrap--narrow { max-width: var(--measure); }

/* ---------- Type ---------- */

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; }

h1 { font-size: clamp(2.1rem, 7vw, 3.4rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.3rem, 3.6vw, 1.7rem); letter-spacing: -0.005em; }
h3 { font-size: 1.05rem; font-weight: 500; }

p { margin: 0 0 1.15em; }

a { color: var(--canal); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

.eyebrow {
  font-family: var(--data);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
}

.lede { font-size: 1.16rem; color: var(--ink-soft); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* The "what we fund" list. Marked with a trail blaze rather than a bullet, so
   it reads as a set of field notes and not a pitch deck. */
.funds {
  list-style: none;
  margin: 0 0 1.15em;
  padding: 0;
}

.funds li {
  position: relative;
  padding-left: 1.5rem;
  margin: 0 0 1rem;
}

.funds li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.7rem;
  height: 2px;
  background: var(--trail);
}

.funds strong { font-weight: 600; }

/* The lede is a copy block now, so it wraps a paragraph instead of being one. */
.lede p { margin-bottom: 0; }

/* A quiet aside — the referral note under the funding list. Set apart by a
   hairline rather than a box, so it reads as a margin note and doesn't
   compete with the donate ask. */
.note--aside {
  border-left: 2px solid var(--rule);
  padding-left: 0.9rem;
  margin: -0.2rem 0 1.4rem;
}

.note--aside a { color: var(--canal); }

/* ---------- Structure ---------- */

.masthead { padding: 3.5rem 0 0; }

.section { padding: 2.75rem 0; border-top: 1px solid var(--rule); }
.section:first-of-type { border-top: 0; }

.section__title {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.section__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.site-foot {
  border-top: 1px solid var(--rule);
  padding: 2rem 0 3.5rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* ---------- The mile ribbon: the route as a profile you fill in ---------- */

.ribbon { margin: 2rem 0 0; }

.ribbon__track {
  position: relative;
  height: 66px;
  border-bottom: 2px solid var(--ink);
}

.ribbon__profile { display: block; width: 100%; height: 100%; }

.ribbon__fill { fill: rgba(74,107,58,.28); stroke: var(--trail); stroke-width: 1.5; }
.ribbon__rest { fill: none; stroke: var(--rule); stroke-width: 1.5; }

.ribbon__pin {
  position: absolute;
  bottom: -7px;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: var(--marker);
  box-shadow: 0 0 0 3px var(--paper);
  transition: left .6s ease;
}
.ribbon__pin::after {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid var(--marker);
  opacity: 0;
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0%   { transform: scale(.7); opacity: .7; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { opacity: 0; }
}

.ribbon__ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--data);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 0.55rem;
}

/* Fundraising track, running on the same axis as the miles above it. */

.ribbon__money { margin-top: 1rem; }

.ribbon__bar {
  height: 12px;
  background: var(--surface-0, #F3F1E9);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.ribbon__bar-fill {
  height: 100%;
  background: var(--canal);
  transition: width .6s ease;
}

.ribbon__ends--money {
  text-transform: none;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.ribbon__ends--money strong {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.stat { background: var(--paper-edge); padding: 1rem 1.1rem; }

.stat__label {
  font-family: var(--data);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.35rem;
}

.stat__value {
  font-family: var(--data);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.1;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.stat__unit { font-size: 0.8rem; color: var(--ink-soft); margin-left: 0.15em; }

/* ---------- Status pill ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--data);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border: 1px solid currentColor;
  border-radius: 999px;
}
.pill--riding   { color: var(--trail); }
.pill--resting  { color: var(--ink-faint); }
.pill--finished { color: var(--canal); }

.pill__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.pill--riding .pill__dot { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Map ---------- */

#map {
  height: 340px;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
}

/* ---------- Leaflet, wearing the site's clothes ----------
   Stock web-map tiles are built to be legible on a white page: scarlet
   motorways, bright green parks, hard blue water. Next to limestone and
   towpath green they look like a different website. This washes the tiles
   toward the paper palette and quiets the browser chrome around them.

   To adjust: raise --map-sepia for warmer, --map-grey for flatter. Set
   --map-wash to none to see the tiles as they ship. */

:root {
  --map-wash: grayscale(.55) sepia(.45) saturate(.75) brightness(1.06) contrast(.92);
}

.leaflet-tile-pane { filter: var(--map-wash); }

/* The line, the markers and the controls sit above the wash, so the trail
   green and the position marker keep their real colour. */

.leaflet-container {
  background: var(--paper-deep);
  font-family: var(--body);
}

/* Leaflet adds a .leaflet-touch class on most devices and styles the controls
   again through it, so these have to be at least as specific to win. */
.leaflet-bar,
.leaflet-touch .leaflet-bar {
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: none;
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a {
  background: var(--paper-edge);
  color: var(--ink);
  font-family: var(--data);
  font-weight: 500;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}

.leaflet-bar a:last-child,
.leaflet-touch .leaflet-bar a:last-child { border-bottom: 0; }

.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a:hover { background: var(--paper); color: var(--trail); }

/* live.php loads Leaflet's stylesheet after this one, so on a tie Leaflet
   wins on source order. Every rule below is scoped through .leaflet-container
   to out-specify it. */
.leaflet-container .leaflet-control-attribution {
  background: rgba(233, 230, 220, .82);
  font-family: var(--data);
  font-size: 9.5px;
  letter-spacing: .02em;
  color: var(--ink-faint);
  padding: 2px 6px;
}

.leaflet-container .leaflet-control-attribution a { color: var(--ink-soft); }
.leaflet-container .leaflet-control-attribution a:hover { color: var(--ink); }

/* Leaflet ships a Ukraine flag next to its own credit; it renders as a stray
   blue-yellow rectangle in a field of limestone. Leaflet sets it with
   !important, so this has to answer in kind. The credit itself stays. */
.leaflet-container .leaflet-attribution-flag { display: none !important; }

/* ---------- Inline photo ---------- */

.photo-figure {
  margin: 2rem auto 2.25rem;
  max-width: 21rem;
}

.photo-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
}

.photo-figure figcaption {
  font-family: var(--data);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-align: center;
  padding-top: 0.55rem;
}

/* ---------- The ask ---------- */

.ask {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  background: var(--canal);
  color: #F1EFE7;
  padding: 1.75rem;
}
.ask h2 { color: #fff; margin-bottom: 0.6rem; }
.ask p { color: #D2DDE4; }
.ask a { color: #fff; }

.ask__logo {
  flex: none;
  width: 6.5rem;
  display: block;
}
.ask__logo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .85);
}

.ask__body { flex: 1; min-width: 0; }
.ask__body > :last-child { margin-bottom: 0; }

.button {
  display: inline-block;
  font-family: var(--data);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper-edge);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #000; color: #fff; }

.ask .button { background: var(--paper-edge); color: var(--canal); }
.ask .button:hover { background: #fff; color: var(--ink); }

.button--wide { width: 100%; text-align: center; }

/* ---------- Form ---------- */

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-family: var(--data);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.field input[type=text],
.field input[type=email],
.field textarea {
  width: 100%;
  font-family: var(--body);
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  background: var(--paper-edge);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
}

.field input:focus,
.field textarea:focus,
.button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--canal);
  outline-offset: 2px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  cursor: pointer;
}
.check input { margin-top: 0.45rem; flex: none; }

.check-group {
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  margin-top: 1.5rem;
}

.nested { padding-left: 1.55rem; margin-bottom: 1.25rem; }

.hp { position: absolute; left: -9999px; }

.note {
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.6;
}

.flash {
  border-left: 3px solid var(--trail);
  background: var(--paper-edge);
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}
.flash--bad { border-left-color: var(--marker); }
.flash p:last-child { margin-bottom: 0; }

/* ---------- Photos ---------- */

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.75rem;
}
.photos figure { margin: 0; }
.photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
}
.photos figcaption {
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding-top: 0.35rem;
}

/* The thumbnails are links. Make them feel like it. */
.photo-link {
  display: block;
  position: relative;
  line-height: 0;
}
.photo-link img { transition: opacity .15s ease; }
.photo-link:hover img,
.photo-link:focus-visible img { opacity: .82; }
.photo-link:focus-visible { outline: 2px solid var(--canal); outline-offset: 2px; }

/* ---------- The photo viewer ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: clamp(1rem, 4vw, 3rem);
  /* The page's own ink, nearly opaque — a plain black overlay would look like
     a different website had taken over. */
  background: rgba(35, 38, 31, .93);
}

/* [hidden] is how the script shows and hides it; without this the flex display
   above would win and the box would never go away. */
.lightbox[hidden] { display: none; }

.lightbox__inner {
  margin: 0;
  max-width: 100%;
  text-align: center;
}

.lightbox img {
  max-width: min(100%, 1000px);
  /* Leave room for the caption so a tall photo can't push it off screen. */
  max-height: 78vh;
  width: auto;
  object-fit: contain;
  border: 1px solid rgba(233, 230, 220, .25);
  background: var(--paper-deep);
}

.lightbox figcaption {
  font-family: var(--data);
  font-size: 0.78rem;
  letter-spacing: .04em;
  color: var(--paper-deep);
  padding-top: 0.9rem;
}

.lightbox__close {
  position: absolute;
  top: clamp(.5rem, 2vw, 1.25rem);
  right: clamp(.5rem, 2vw, 1.25rem);
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--paper);
  background: none;
  border: 1px solid rgba(233, 230, 220, .35);
  border-radius: 2px;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(233, 230, 220, .12); }

/* ---------- Practice-ride notice ---------- */

.preview-note {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--marker);
  border-left-width: 3px;
  background: var(--paper-edge);
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.preview-note strong { color: var(--ink); }

/* ---------- Messages ---------- */

.msg {
  border-left: 2px solid var(--rule);
  padding: 0.1rem 0 0.1rem 1rem;
  margin-bottom: 1.35rem;
}
.msg p { margin: 0 0 0.2rem; }
.msg__by {
  font-family: var(--data);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* ---------- Day ledger ---------- */

.ledger { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.ledger th {
  font-family: var(--data);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  text-align: right;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger td {
  font-family: var(--data);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.ledger td:first-child { font-family: var(--body); }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .is-today td { color: var(--trail); }

/* ---------- Gate ---------- */

.gate { max-width: 30rem; margin: 6rem auto; padding: 0 var(--gutter); }

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .masthead { padding-top: 2.25rem; }
  .section { padding: 2rem 0; }
  #map { height: 260px; }
  .photo-figure { max-width: 100%; }
  .ask {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .ask__logo { width: 7.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
