/* Derby: a small-town soapbox derby. Home-built plywood cars with painted numbers roll down a steep street
   between hay bales, a chequered banner waits at the bottom, felt pennants are the prizes and the builder's red
   toolbox heaped with gold is the pot. Palette from derby day: sidewalk concrete, tar, a teal start ramp,
   tomato, mustard and navy enamel paint, golden hay. */
@font-face { font-family: 'Carter One'; src: url(/fonts/carterone.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url(/fonts/hanken.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Azeret Mono'; src: url(/fonts/azeret.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --wall: #ebe5d8;         /* sidewalk concrete */
  --wall-2: #d9d1c0;
  --cream: #fbf7ee;        /* enamel white */
  --paper: #f5f0e4;
  --ink: #221d18;          /* tar */
  --ink-2: #4d463e;
  --ink-3: #6f675d;
  --red: #146b63;          /* start-ramp teal: header, frames, every button */
  --red-dk: #0e4f49;
  --teal-2: #1f8a80;
  --tomato: #d4472a;
  --bulb: #f2b134;         /* mustard enamel */
  --amber: #f2b134;
  --cobalt: #284a8c;       /* navy enamel */
  --turf: #505256;         /* the street */
  --turf-2: #494b4f;
  --hay: #e7c15c;
  --hay-dk: #c39a3a;
  --plank: #b9824a;
  --plank-dk: #8a5a2e;
  --tin: #e3ddd0;
  --up: #1d7a3e;
  --down: #c0362a;
  --edge: 2.5px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --display: 'Carter One', 'Cooper Black', Georgia, serif;
  --text: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* painted plywood: faint grain running along the sheet */
  --ply: repeating-linear-gradient(178deg, rgba(255, 255, 255, 0) 0 9px, rgba(255, 255, 255, .05) 9px 11px, rgba(0, 0, 0, 0) 11px 23px, rgba(0, 0, 0, .06) 23px 24px);
  --checks: conic-gradient(var(--ink) 25%, var(--cream) 0 50%, var(--ink) 0 75%, var(--cream) 0);
  --bales: linear-gradient(90deg, transparent 0 64px, var(--ink) 64px 66px) 0 0 / 66px 100%,
    linear-gradient(90deg, transparent 0 18px, #9a6f22 18px 21px, transparent 21px 44px, #9a6f22 44px 47px, transparent 47px) 0 0 / 66px 100%,
    repeating-linear-gradient(100deg, rgba(255, 246, 200, .55) 0 2px, transparent 2px 7px, rgba(150, 105, 30, .35) 7px 8px, transparent 8px 13px),
    linear-gradient(180deg, #f1d47c, var(--hay) 45%, var(--hay-dk));
}

/* the page: sidewalk slabs with their joints and a little grit */
body { font-weight: 450;
  background: var(--wall) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='200'%3E%3Cpath d='M0 199 H260 M259 0 V200' stroke='%23cdc5b3' stroke-width='2'/%3E%3Cpath d='M0 1.5 H260 M1.5 0 V200' stroke='%23f7f3ea' stroke-width='1.5'/%3E%3Cg fill='%23d6cebd'%3E%3Ccircle cx='30' cy='40' r='1.4'/%3E%3Ccircle cx='130' cy='22' r='1.1'/%3E%3Ccircle cx='210' cy='90' r='1.5'/%3E%3Ccircle cx='70' cy='150' r='1.2'/%3E%3Ccircle cx='180' cy='170' r='1.1'/%3E%3Ccircle cx='100' cy='100' r='.9'/%3E%3C/g%3E%3Cg fill='%23f6f2e9'%3E%3Ccircle cx='60' cy='80' r='1.2'/%3E%3Ccircle cx='160' cy='130' r='1.3'/%3E%3Ccircle cx='230' cy='30' r='1'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 260px 200px; }
h1, h2, h3 { font-weight: 400; letter-spacing: .005em; line-height: 1.04; }
h1 { font-size: clamp(46px, 6.2vw, 84px); }
h2 { font-size: clamp(30px, 3.4vw, 44px); }
.btn { font-weight: 800; border-radius: 10px; }
.btn:hover { background: #1a7d74; }
.btn-cream:hover { background: #fffdf6; }
.btn-ink:hover { background: #3a322a; }
.hero h1 { color: var(--ink); }
/* the second line is painted in tomato and sits on a strip of chequered banner */
.hero h1 .h1b { color: var(--tomato); text-shadow: 3px 3px 0 var(--ink); width: fit-content; padding-bottom: 18px;
  background: var(--checks) left bottom / 12px 12px repeat-x; }

/* header: the teal start ramp, pennant bunting strung along its lower edge */
.top { background: var(--red) var(--ply); border-bottom: var(--edge); }
.top-in { padding-bottom: 12px; }
.brand-horse { width: 96px; height: 57px; filter: drop-shadow(2px 2px 0 var(--red-dk)); }
.brand-word { font: 400 44px/1 var(--display); color: var(--cream); text-shadow: 3px 3px 0 var(--ink); letter-spacing: .01em; }
.nav a { color: var(--cream); font-weight: 700; }
.nav a:hover { border-color: rgba(251, 247, 238, .45); }
.nav a[aria-current='page'] { background: var(--cream); color: var(--ink); border-radius: 8px; }
.nav-mobile { padding-bottom: 14px; }
.nav-mobile a { font-weight: 700; }
.top .btn { background: var(--cream); color: var(--ink); }
.top .btn:hover { background: #fff; }
.bulbs { bottom: -27px; height: 28px; z-index: 5; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='30'%3E%3Cg stroke='%23221d18' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M5 4.2 L27 5.6 L15 27 Z' fill='%23d4472a'/%3E%3Cpath d='M35 6.4 L57 7.1 L46 29 Z' fill='%23f2b134'/%3E%3Cpath d='M63 7.1 L85 6.4 L74 29 Z' fill='%23fbf7ee'/%3E%3Cpath d='M93 5.6 L115 4.2 L104 27 Z' fill='%23284a8c'/%3E%3C/g%3E%3Cpath d='M0 3 Q60 11 120 3' fill='none' stroke='%23221d18' stroke-width='2'/%3E%3C/svg%3E") 0 0 / 120px 30px repeat-x; }
.hero { padding-top: 64px; }
.page-head { padding-top: 64px; }

/* the race: a teal plywood frame, a sign-painted board, prizes on a striped street barricade */
.booth { container-type: inline-size; background: var(--red) var(--ply); border-radius: 12px; padding: 12px; box-shadow: 6px 6px 0 var(--ink); }
.booth-sign { border-radius: 6px; box-shadow: inset 0 0 0 5px var(--cream), inset 0 0 0 7px var(--tomato); }
.booth-sign .t-name, .booth-sign .clock { font-size: 25px; }
.booth-sign .center .t-name { color: var(--tomato); }
.booth-sign .t-meta { font-weight: 700; }
.booth-sign .clock small { font-weight: 700; }
.shelf { padding-top: 14px; }
.shelf::after { height: 20px; left: 0; right: 0; border-radius: 4px;
  background: repeating-linear-gradient(-45deg, var(--tomato) 0 16px, var(--cream) 16px 32px); }
.prize svg { width: clamp(56px, 6.6vw, 80px); height: clamp(56px, 6.6vw, 80px); }
.prize b { top: calc(clamp(56px, 6.6vw, 80px) * .37); left: 20%; right: 24%; translate: 0 -50%; color: var(--cream); font-size: clamp(12px, 1.3vw, 16px); text-shadow: 1px 1px 0 var(--ink); }
.prize span { margin-top: -6px; border-radius: 5px; font-weight: 800; }
.pot svg { width: clamp(84px, 10vw, 118px); height: clamp(66px, 7.9vw, 93px); }
.pot .pot-sum { top: 58%; translate: -50% -50%; border-radius: 5px; font-size: clamp(13px, 1.4vw, 17px); }
.pot .pot-label { font-weight: 800; color: var(--cream); background: var(--ink); text-shadow: none; border-radius: 5px; padding: 3px 8px; position: relative; z-index: 2; margin-top: -4px; }

/* the street runs downhill to the finish: the whole track leans 3 degrees, so the cars roll down it */
.track { --lane-h: 74px; margin-top: 14px; border-radius: 6px; background: var(--turf); padding: 13px 0;
  transform: skewY(3deg); transform-origin: 0 0; margin-bottom: 5.3cqw; }
/* hay bales line the street on both sides */
.track::before, .track::after { content: ''; position: absolute; left: 0; right: 0; height: 13px; z-index: 2; background: var(--bales); }
.track::before { top: 0; border-bottom: 2px solid var(--ink); }
.track::after { bottom: 0; border-top: 2px solid var(--ink); }
/* every lane is tar with grit, a painted start line and a dashed lane line */
.lane { border-bottom: 0;
  background: linear-gradient(90deg, transparent 0 38px, #f3efe4 38px 42px, transparent 42px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='60'%3E%3Cg fill='%23626468'%3E%3Ccircle cx='20' cy='14' r='1.3'/%3E%3Ccircle cx='70' cy='40' r='1.1'/%3E%3Ccircle cx='122' cy='22' r='1.4'/%3E%3Ccircle cx='146' cy='50' r='1'/%3E%3Ccircle cx='96' cy='8' r='1'/%3E%3C/g%3E%3Cg fill='%233d3f42'%3E%3Ccircle cx='44' cy='30' r='1.3'/%3E%3Ccircle cx='108' cy='48' r='1.2'/%3E%3Ccircle cx='8' cy='46' r='1'/%3E%3C/g%3E%3C/svg%3E") left 40px top 0 / 160px 60px repeat-x; }
.lane:nth-child(even) { background-color: var(--turf-2); }
.lane::after { left: 42px; right: 0; bottom: -2px; height: 4px; border-radius: 0; box-shadow: none; z-index: 1;
  background: repeating-linear-gradient(90deg, #f3efe4 0 26px, transparent 26px 46px); }
.lane:last-of-type::after { display: none; }
.lane-no { width: 34px; background: var(--cream); color: var(--ink); font: 400 20px/1 var(--display); border-right: var(--edge); }
.lane-empty { color: var(--cream); text-shadow: 1px 1px 0 var(--ink); font-weight: 800; }
.lane-empty > span:not(.lane-no) { position: relative; z-index: 3; padding: 0 30px 0 44px; text-align: center; line-height: 1.2; }
/* finish: a chequered banner hanging across the street */
.finish { width: 26px; border-left: var(--edge); z-index: 3; background: var(--checks) 0 0 / 13px 13px; }
.zero { border-left: 3px dashed rgba(251, 247, 238, .8); }
.zero span { font: 700 12px/1 var(--mono); color: var(--cream); text-shadow: 1px 1px 0 var(--ink); top: 16px; }

.runner.car { --hw: calc((var(--lane-h, 64px) - 5px) * 1.692); top: 1px; bottom: 4px; --spin: running; }
.runner.car .horse { animation: rattle .5s steps(2, jump-none) infinite; }
.lane:nth-child(2n) .runner.car .horse { animation-delay: -.2s; }
@keyframes rattle { from { transform: translateY(0); } to { transform: translateY(-1.2px); } }
/* wheel spokes turn only on cars that sit on the street (the --spin switch reaches into the sprite) */
.spk { transform-box: fill-box; transform-origin: center; animation: spin 1.6s linear infinite; animation-play-state: var(--spin, paused); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .runner.car .horse, .spk { animation: none; } }
.runner.car .rod { display: none; }
.runner.car .disc { left: 50.45%; top: 45.4%; width: 15.45%; background: var(--silk); }
/* the car itself is turned, not sheared: round wheels, nose pointing down the slope */
.runner.car { transform: skewY(-3deg) rotate(3deg); }
.runner.car .tag { transform: rotate(-3deg); }
.tag { border-radius: 6px; font-weight: 800; }
.tag em { font-weight: 600; }
.runner.me .tag { background: var(--bulb); }
.runner.p1 .tag { background: #ffe6a8; }
.booth-more { color: var(--cream); }

.step { grid-template-columns: 96px minmax(0, 1fr); }
.step svg.art { width: 96px; height: 72px; }
.step h3 { font-size: 24px; }
.step h3::before { color: var(--tomato); }
.ticket-head h3 { font-size: 28px; }
.ticket-head .fee-in { font-size: 22px; color: var(--tomato); }
.ticket dt { font-weight: 700; }
.ticket dd { font-weight: 800; }
.ticket.sprint { --tk: var(--tomato); }
.ticket.heat { --tk: var(--cobalt); }
.ticket.classic { --tk: var(--red); }
.ticket.dash { --tk: var(--bulb); }
.panel { border-radius: 10px; }

.dlg { border-radius: 12px; }
.dlg-head { background: var(--red) var(--ply); }
.dlg-head h2 { color: var(--cream); font-size: 28px; text-shadow: 2px 2px 0 var(--ink); }
.seg button { border-radius: 8px; }
.seg button[aria-pressed='true'] { background: var(--ink); box-shadow: 3px 3px 0 var(--tomato); }
.test-note { background: #f6e6bb; border-color: var(--wall-2); }
.launch { background: var(--ink); }
.launch a { color: var(--bulb); }
/* the page ends at the finish: the footer hangs under a chequered banner */
.foot { border-top: 0; background: var(--ink); color: #e2dbd0; position: relative; }
.foot::before { content: ''; position: absolute; left: 0; right: 0; top: -20px; height: 20px; border-top: var(--edge); background: var(--checks) 0 0 / 20px 20px; }
.toast { box-shadow: 4px 4px 0 var(--tomato); }
.count .big, .potline b { font-size: 38px; }
.mine-row .k, .count .sub, .lt-head .lt-meta { font-weight: 700; }

@media (max-width: 640px) {
  .track { --lane-h: 54px; padding: 9px 0; }
  .track::before, .track::after { height: 9px; background-size: 44px 100%, 44px 100%, auto, auto;
    background-image: linear-gradient(90deg, transparent 0 42px, var(--ink) 42px 44px), linear-gradient(90deg, transparent 0 12px, #9a6f22 12px 14px, transparent 14px 30px, #9a6f22 30px 32px, transparent 32px),
      repeating-linear-gradient(100deg, rgba(255, 246, 200, .55) 0 2px, transparent 2px 7px, rgba(150, 105, 30, .35) 7px 8px, transparent 8px 13px), linear-gradient(180deg, #f1d47c, var(--hay) 45%, var(--hay-dk)); }
  .lane { background-size: auto, 120px 44px; background-position: 0 0, left 28px top 0; }
  .lane-no { width: 24px; font-size: 15px; }
  .lane { background-image: linear-gradient(90deg, transparent 0 26px, #f3efe4 26px 29px, transparent 29px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='60'%3E%3Cg fill='%23626468'%3E%3Ccircle cx='20' cy='14' r='1.3'/%3E%3Ccircle cx='70' cy='40' r='1.1'/%3E%3Ccircle cx='122' cy='22' r='1.4'/%3E%3C/g%3E%3C/svg%3E"); }
  .lane::after { left: 30px; background: repeating-linear-gradient(90deg, #f3efe4 0 18px, transparent 18px 32px); }
  .finish { width: 14px; background-size: 7px 7px; }
  .brand-horse { width: 70px; height: 42px; }
  .brand-word { font-size: 34px; }
  .count .big { font-size: 30px; }
  .hero h1 .h1b { text-shadow: 2px 2px 0 var(--ink); padding-bottom: 14px; background-size: 10px 10px; }
  .hero { padding-top: 52px; }
}
