/* Rally: a gravel rally stage in a spruce forest. Boxy rally cars with door numbers kick up dust on a gravel
   road, the stage board is a yellow time-control sign in a brushed aluminium frame, rally plates are the prizes
   and stand on a birch log, a silver trophy bowl heaped with gold is the pot. The page is the co-driver's ruled
   pace-note paper; red and white spectator tape hangs under the spruce header. */
@font-face { font-family: 'Exo 2'; src: url(/fonts/exo2.woff2) format('woff2'); font-weight: 700 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Afacad'; src: url(/fonts/afacad.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Syne Mono'; src: url(/fonts/synemono.woff2) format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --wall: #efe9d8;         /* pace-note paper */
  --wall-2: #ddd5bf;
  --cream: #fbf8ef;
  --paper: #f6f1e2;
  --ink: #15201b;          /* spruce black */
  --ink-2: #414c46;
  --ink-3: #626c66;
  --red: #1e4636;          /* spruce: header, frames, every button */
  --red-dk: #143226;
  --rally: #d42a2c;        /* rally red */
  --sign: #f3c623;         /* time-control yellow */
  --bulb: #f3c623;
  --amber: #f3c623;
  --cobalt: #1f4fa3;       /* livery blue */
  --turf: #c9a66e;         /* gravel */
  --turf-2: #c29e64;
  --moss: #5f7d43;
  --birch: #f1ede2;
  --alu: #c7cdd1;
  --tin: #e3ddd0;
  --up: #1d7a3e;
  --down: #c0362a;
  --edge: 2.5px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --display: 'Exo 2', 'Arial Black', system-ui, sans-serif;
  --text: 'Afacad', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Syne Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --brushed: repeating-linear-gradient(180deg, rgba(255, 255, 255, .35) 0 1px, transparent 1px 3px, rgba(0, 0, 0, .04) 3px 4px, transparent 4px 6px),
    linear-gradient(180deg, #e2e6e9, #b9c0c5);
  --yellow-checks: conic-gradient(var(--ink) 25%, var(--sign) 0 50%, var(--ink) 0 75%, var(--sign) 0);
  --gravel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='54'%3E%3Cg fill='%23a98652'%3E%3Cellipse cx='14' cy='10' rx='2.2' ry='1.5'/%3E%3Cellipse cx='62' cy='30' rx='1.8' ry='1.3'/%3E%3Cellipse cx='104' cy='14' rx='2.4' ry='1.6'/%3E%3Cellipse cx='40' cy='46' rx='1.6' ry='1.2'/%3E%3C/g%3E%3Cg fill='%23e2c992'%3E%3Cellipse cx='32' cy='22' rx='2' ry='1.4'/%3E%3Cellipse cx='86' cy='42' rx='2.2' ry='1.5'/%3E%3Cellipse cx='112' cy='34' rx='1.4' ry='1'/%3E%3Cellipse cx='4' cy='38' rx='1.6' ry='1.1'/%3E%3C/g%3E%3Cg fill='%237d6040'%3E%3Ccircle cx='76' cy='8' r='1.2'/%3E%3Ccircle cx='24' cy='34' r='1'/%3E%3Ccircle cx='96' cy='26' r='1.1'/%3E%3C/g%3E%3C/svg%3E");
  --spruces: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='66' height='22'%3E%3Cg stroke='%2315201b' stroke-width='1.3' stroke-linejoin='round'%3E%3Cpath d='M11 1 L19 13 H15 L21 21 H1 L7 13 H3 Z' fill='%231e4636'/%3E%3Cpath d='M33 6 L39 15 H36 L41 22 H25 L30 15 H27 Z' fill='%232c5a45'/%3E%3Cpath d='M53 0 L61 12 H57 L64 21 H42 L49 12 H45 Z' fill='%23234d3c'/%3E%3C/g%3E%3C/svg%3E");
}

/* the page: the co-driver's ruled pace-note paper */
body { font-weight: 450; font-size: 18px;
  background: var(--wall) repeating-linear-gradient(180deg, transparent 0 33px, rgba(120, 150, 180, .2) 33px 34px); }
h1, h2, h3 { font-weight: 900; font-style: italic; letter-spacing: -.012em; line-height: 1.02; }
h1 { font-size: clamp(46px, 6.2vw, 86px); }
h2 { font-size: clamp(30px, 3.4vw, 44px); }
.btn { font-weight: 700; border-radius: 6px; font-size: 19px; }
.btn:hover { background: #275a46; }
.btn-cream:hover { background: #fffdf6; }
.btn-ink:hover { background: #26332d; }
.hero h1 { color: var(--ink); }
.hero h1 .h1b { color: var(--rally); text-shadow: 4px 4px 0 var(--ink); width: fit-content; padding-right: .1em; }

/* header: spruce, a forest line along its foot, spectator tape on stakes hanging below */
.top { background: var(--red); border-bottom: var(--edge);
  background-image: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .12)); }
.top-in { padding-bottom: 14px; }
.brand-horse { width: 98px; height: 58px; filter: drop-shadow(2px 2px 0 var(--red-dk)); }
.brand-word { font: italic 900 46px/1 var(--display); color: var(--cream); text-shadow: 3px 3px 0 var(--ink); letter-spacing: -.01em; padding-right: .08em; }
.nav a { color: var(--cream); font-weight: 700; font-size: 18px; }
.nav a:hover { border-color: rgba(251, 248, 239, .45); }
.nav a[aria-current='page'] { background: var(--cream); color: var(--ink); border-radius: 6px; }
.nav-mobile { padding-bottom: 16px; }
.nav-mobile a { font-weight: 700; }
.top .btn { background: var(--cream); color: var(--ink); }
.top .btn:hover { background: #fff; }
.bulbs { bottom: -26px; height: 28px; z-index: 5; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='28'%3E%3Cpath d='M6 7 Q88 19 170 7' fill='none' stroke='%2315201b' stroke-width='7.5'/%3E%3Cpath d='M6 7 Q88 19 170 7' fill='none' stroke='%23fbf8ef' stroke-width='4.5'/%3E%3Cpath d='M6 7 Q88 19 170 7' fill='none' stroke='%23d42a2c' stroke-width='4.5' stroke-dasharray='9 9'/%3E%3Cpath d='M3 0 H9 V25 L6 28 L3 25 Z' fill='%23b9824a' stroke='%2315201b' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 170px 28px repeat-x; }
.hero { padding-top: 68px; }
.page-head { padding-top: 64px; }

/* the stage board: brushed aluminium frame, a yellow time-control sign, rally plates on a birch log */
.booth { container-type: inline-size; background: var(--brushed); border-radius: 10px; padding: 12px; box-shadow: 6px 6px 0 var(--ink); }
.booth-sign { background: var(--sign); border-radius: 6px; box-shadow: inset 0 0 0 4px var(--sign), inset 0 0 0 6.5px var(--ink); }
.booth-sign .t-name, .booth-sign .clock { font: italic 900 26px/1 var(--display); }
.booth-sign .center .t-name { color: var(--rally); }
.booth-sign .t-meta { font-weight: 700; color: var(--ink); font-size: 15px; }
.booth-sign .clock small { font-weight: 700; color: var(--ink-2); font-size: 14px; }
.shelf { padding-top: 14px; }
/* a birch log, bark marks along it and the cut end grain on the right */
.shelf::after { height: 24px; left: 0; right: 0; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .7), transparent 38%, rgba(70, 60, 40, .16)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='22'%3E%3Cg fill='%232f2d29'%3E%3Cpath d='M8 7 q8 -3 18 0 q-9 2.5 -18 0z'/%3E%3Cpath d='M40 14 q5 -2 12 0 q-6 2 -12 0z'/%3E%3Cpath d='M62 5 q10 -3 22 0 q-11 3 -22 0z'/%3E%3Cpath d='M96 12 q7 -2.5 16 0 q-8 2.5 -16 0z'/%3E%3Cpath d='M120 6 q4 -1.6 9 0 q-4.5 1.6 -9 0z'/%3E%3Cpath d='M22 16 q3 -1.4 7 0 q-3.5 1.4 -7 0z'/%3E%3Cpath d='M78 16 q4 -1.6 9 0 q-4.5 1.6 -9 0z'/%3E%3C/g%3E%3Cpath d='M0 10 H140' stroke='%23d9d3c3' stroke-width='1'/%3E%3C/svg%3E") 0 1px / 140px 22px repeat-x, var(--birch); }
.shelf::before { content: ''; position: absolute; right: 0; bottom: 0; width: 24px; height: 24px; z-index: 2; border-radius: 50%; border: var(--edge);
  background: radial-gradient(circle, #c9915a 0 2px, #e8c48f 2px 4px, #c9915a 4px 5px, #e8c48f 5px 7px, #d6a670 7px); }
.prize { margin-bottom: 12px; }
.prize svg { width: clamp(62px, 7.4vw, 88px); height: clamp(62px, 7.4vw, 88px); }
.prize b { top: calc(clamp(62px, 7.4vw, 88px) * .57); left: 0; right: 0; translate: 0 -50%; color: var(--cream); font: italic 900 clamp(15px, 1.7vw, 21px)/1 var(--display); text-shadow: 1.5px 1.5px 0 var(--ink); }
.prize span { margin-top: -4px; border-radius: 4px; font-weight: 700; font-size: 14px; }
.pot { margin-bottom: 12px; }
.pot svg { width: clamp(88px, 10.4vw, 124px); height: clamp(69px, 8.2vw, 97px); }
.pot .pot-sum { top: 62%; translate: -50% -50%; border-radius: 4px; font: italic 900 clamp(13px, 1.4vw, 17px)/1 var(--display); }
.pot .pot-label { font-weight: 700; color: var(--cream); background: var(--ink); text-shadow: none; border-radius: 4px; padding: 3px 8px; position: relative; z-index: 2; margin-top: -2px; font-size: 13px; }

/* the stage: a gravel road with tyre ruts, spruces along the far side, a mossy verge on the near side */
.track { --lane-h: 76px; margin-top: 14px; border-radius: 6px; background: var(--turf); padding: 22px 0 12px; }
.track::before, .track::after { content: ''; position: absolute; left: 0; right: 0; z-index: 2; }
.track::before { top: 0; height: 22px; background: var(--spruces) 0 0 / 66px 22px repeat-x, linear-gradient(180deg, #7d9a5c, var(--moss)); border-bottom: 2px solid var(--ink); }
.track::after { bottom: 0; height: 12px; border-top: 2px solid var(--ink);
  background: repeating-linear-gradient(90deg, transparent 0 9px, #4c6a34 9px 11px, transparent 11px 17px, #86a35f 17px 19px, transparent 19px 26px), var(--moss); }
.lane, .lane:nth-child(even) { border-bottom: 0;
  background: linear-gradient(90deg, transparent 0 38px, #fbf8ef 38px 42px, transparent 42px), var(--gravel) left 40px top 0 / 120px 54px repeat-x; }
.lane { background-color: var(--turf); }
.lane:nth-child(even) { background-color: var(--turf-2); }
/* two tyre ruts worn into every lane */
.lane::after { left: 42px; right: 0; bottom: 3px; height: 10px; border-radius: 0; box-shadow: none; z-index: 1;
  background: linear-gradient(rgba(110, 80, 40, .35), rgba(110, 80, 40, .35)) 0 0 / 100% 3px no-repeat, linear-gradient(rgba(110, 80, 40, .35), rgba(110, 80, 40, .35)) 0 100% / 100% 3px no-repeat; }
.lane-no { width: 34px; background: var(--cream); color: var(--ink); font: italic 900 21px/1 var(--display); border-right: var(--edge); }
.lane-empty { color: var(--ink); text-shadow: none; font-weight: 700; font-size: 16px; }
.lane-empty > span:not(.lane-no) { position: relative; z-index: 3; padding: 3px 10px; margin: 0 34px 0 42px; max-width: calc(100% - 84px); background: rgba(251, 248, 239, .86); border-radius: 4px; text-align: center; line-height: 1.2; }
/* finish: the yellow flying-finish board with its chequers */
.finish { width: 26px; border-left: var(--edge); z-index: 3; background: var(--yellow-checks) 0 0 / 13px 13px; }
.zero { border-left: 3px dashed rgba(251, 248, 239, .9); }
.zero span { font: 400 13px/1 var(--mono); color: var(--ink); background: var(--cream); border-radius: 3px; padding: 2px 4px; top: 6px; }

.runner.car { --hw: calc((var(--lane-h, 64px) - 5px) * 1.692); top: 1px; bottom: 4px; --spin: running; }
.runner.car .horse { animation: bump .42s steps(2, jump-none) infinite; }
.lane:nth-child(2n) .runner.car .horse { animation-delay: -.2s; }
@keyframes bump { from { transform: translateY(0); } to { transform: translateY(-1.4px); } }
/* rims turn and the dust puffs only on cars that are on the stage (the --spin switch reaches into the sprite) */
.rim { transform-box: fill-box; transform-origin: center; animation: spin 1.1s linear infinite; animation-play-state: var(--spin, paused); }
.dust { transform-box: fill-box; transform-origin: 100% 60%; animation: puff 1.4s ease-in-out infinite alternate; animation-play-state: var(--spin, paused); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes puff { from { transform: scale(.9); opacity: .85; } to { transform: scale(1.06); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .runner.car .horse, .rim, .dust { animation: none; } }
.runner.car .rod { display: none; }
.runner.car .disc { left: 45%; top: 48.46%; width: 13.64%; background: var(--silk); }
.tag { border-radius: 4px; font-weight: 700; font-size: 14px; }
.tag em { font-weight: 400; }
.runner.me .tag { background: var(--sign); }
.runner.p1 .tag { background: #ffe9a0; }
.booth-more { color: var(--ink); text-shadow: none; }
.booth-more a { color: var(--ink); }

.step { grid-template-columns: 96px minmax(0, 1fr); }
.step svg.art { width: 96px; height: 72px; }
.step h3 { font-size: 25px; }
.step h3::before { color: var(--rally); }
.ticket-head h3 { font-size: 29px; }
.ticket-head .fee-in { font: italic 900 22px/1 var(--display); color: var(--rally); }
.ticket dt { font-weight: 600; }
.ticket dd { font-weight: 700; }
.ticket.sprint { --tk: var(--rally); }
.ticket.heat { --tk: var(--cobalt); }
.ticket.classic { --tk: var(--red); }
.ticket.dash { --tk: var(--sign); }
.panel { border-radius: 8px; }
.count .big, .potline b { font: italic 900 38px/1 var(--display); }
.seg button b { font: italic 900 19px/1 var(--display); }
.standings .place { font: italic 900 20px/1 var(--display); }

.dlg { border-radius: 10px; }
.dlg-head { background: var(--red); }
.dlg-head h2 { color: var(--cream); font-size: 29px; text-shadow: 2px 2px 0 var(--ink); }
.seg button { border-radius: 6px; }
.seg button[aria-pressed='true'] { background: var(--ink); box-shadow: 3px 3px 0 var(--rally); }
.test-note { background: #f7eab8; border-color: var(--wall-2); }
.launch { background: var(--ink); }
.launch a { color: var(--sign); }
/* the page ends at the forest: the footer sits under a line of spruces */
.foot { border-top: 0; background: var(--ink); color: #d9ddd5; position: relative; }
.foot::before { content: ''; position: absolute; left: 0; right: 0; top: -30px; height: 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='30'%3E%3Cg fill='%2315201b'%3E%3Cpath d='M12 2 L21 14 H17 L25 24 H19 L27 31 H-3 L5 24 H-1 L7 14 H3 Z'/%3E%3Cpath d='M40 12 L47 21 H44 L51 31 H29 L36 21 H33 Z'/%3E%3Cpath d='M70 0 L80 13 H76 L85 23 H79 L88 31 H52 L61 23 H55 L64 13 H60 Z'/%3E%3Cpath d='M101 10 L108 19 H105 L113 31 H89 L97 19 H94 Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 120px 30px repeat-x; }
.toast { box-shadow: 4px 4px 0 var(--rally); }
.mine-row .k, .count .sub, .lt-head .lt-meta { font-weight: 700; }

@media (max-width: 640px) {
  .track { --lane-h: 54px; padding: 16px 0 9px; }
  .track::before { height: 16px; background-size: 48px 16px, auto; }
  .track::after { height: 9px; }
  .lane, .lane:nth-child(even) { background-image: linear-gradient(90deg, transparent 0 26px, #fbf8ef 26px 29px, transparent 29px), var(--gravel);
    background-size: auto, 100px 45px; background-position: 0 0, left 28px top 0; }
  .lane::after { left: 30px; bottom: 2px; height: 8px; }
  .lane-no { width: 24px; font-size: 15px; }
  .lane-empty { font-size: 14px; }
  .lane-empty > span:not(.lane-no) { margin: 0 20px 0 30px; max-width: calc(100% - 56px); }
  .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: 3px 3px 0 var(--ink); }
  .hero { padding-top: 52px; }
  .booth-sign .t-name, .booth-sign .clock { font-size: 21px; }
}
