/* Pigs: a county-fair pig race. Piglets in numbered silks trot down a dirt track between whitewashed rails,
   hay bales stack up at the finish, sandwich cookies on painted plates are the prizes and a wooden feed trough
   heaped with gold is the pot. Palette from the fairground: fresh straw, barn-red boards with white trim,
   dark barn-wood ink, blue and green show ribbons. */
@font-face { font-family: 'Spicy Rice'; src: url(/fonts/spicyrice.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url(/fonts/schibsted.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url(/fonts/courierprime.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url(/fonts/courierprime-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --wall: #f2d98e;         /* fresh straw */
  --wall-2: #e4c066;
  --cream: #fdf6e3;        /* whitewash */
  --paper: #f8ecd0;
  --ink: #2a1813;          /* old barn wood */
  --ink-2: #5a4036;
  --ink-3: #7d655a;
  --red: #9e2c25;          /* barn red: header, frames, every button */
  --red-dk: #7a1f1a;
  --bulb: #f2b632;         /* ribbon gold */
  --amber: #f2b632;
  --cobalt: #2f5fa8;       /* blue ribbon */
  --green: #2f7a3c;        /* green ribbon */
  --turf: #b98250;         /* the dirt track */
  --turf-2: #ad7746;
  --hay: #e9c25a;
  --hay-dk: #c99a34;
  --plank: #a8653b;
  --plank-dk: #7a4426;
  --tin: #eadcc0;
  --up: #1f7a3a;
  --down: #b3261e;
  --edge: 2.5px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --display: 'Spicy Rice', 'Cooper Black', Georgia, serif;
  --text: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Courier Prime', ui-monospace, 'SF Mono', Menlo, monospace;
  --boards: repeating-linear-gradient(90deg, rgba(42, 24, 19, 0) 0 32px, rgba(42, 24, 19, .34) 32px 34px, rgba(255, 255, 255, .05) 34px 36px, rgba(42, 24, 19, 0) 36px 70px);
}

/* the page: a floor of fresh straw, loose strands catching the light */
body { font-weight: 450;
  background: var(--wall) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='180'%3E%3Cg stroke-linecap='round' fill='none'%3E%3Cpath d='M14 30 L58 18 M120 40 L150 70 M170 20 L210 34 M30 120 L70 140 M96 110 L140 98 M180 140 L200 110 M60 70 L84 92 M150 160 L196 166 M8 170 L40 150' stroke='%23d6b052' stroke-width='2'/%3E%3Cpath d='M40 52 L90 46 M130 128 L170 136 M190 70 L214 92 M20 90 L36 64 M100 160 L116 134' stroke='%23fbecb6' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 220px 180px; }
h1, h2, h3 { font-weight: 400; letter-spacing: .005em; line-height: 1.02; }
h1 { font-size: clamp(46px, 6.3vw, 86px); }
h2 { font-size: clamp(30px, 3.4vw, 44px); }
.btn { font-weight: 800; border-radius: 8px; }
.btn:hover { background: #b2352d; }
.btn-cream:hover { background: #fffbef; }
.hero h1 { color: var(--ink); }
.hero h1 .h1b { color: var(--red); text-shadow: 3px 3px 0 var(--cream), 5px 5px 0 var(--ink); }

/* header: barn-red board siding, a whitewashed rail fence along its lower edge */
.top { background: var(--red) var(--boards); border-bottom: 0; }
.top-in { padding-bottom: 30px; }
.brand-horse { width: 82px; height: 62px; filter: drop-shadow(2px 2px 0 var(--red-dk)); }
.brand-word { font: 400 46px/1 var(--display); color: var(--cream); text-shadow: 3px 3px 0 var(--ink); letter-spacing: .02em; }
.nav a { color: var(--cream); font-weight: 700; }
.nav a:hover { border-color: rgba(253, 246, 227, .4); }
.nav a[aria-current='page'] { background: var(--cream); color: var(--ink); border-radius: 6px; }
.nav-mobile { padding-bottom: 30px; }
.nav-mobile a { font-weight: 700; border-radius: 6px; }
.top .btn { background: var(--cream); color: var(--ink); }
.top .btn:hover { background: #fff; }
.bulbs { bottom: 0; height: 26px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='26'%3E%3Crect y='5' width='96' height='6' fill='%23fdf6e3'/%3E%3Crect y='15' width='96' height='6' fill='%23fdf6e3'/%3E%3Cpath d='M0 5 H96 M0 11 H96 M0 15 H96 M0 21 H96' stroke='%232a1813' stroke-width='1.6'/%3E%3Cpath d='M8 26 V3 L13 0 L18 3 V26 Z' fill='%23fdf6e3' stroke='%232a1813' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 0 100% / 96px 26px repeat-x; }

/* the race: a barn-red stall, a hand-painted sign board, prizes on a hay bale */
.booth { background: var(--red) var(--boards); border-radius: 12px; padding: 12px; box-shadow: 6px 6px 0 var(--ink); }
.booth-sign { border-radius: 6px; position: relative;
  background:
    radial-gradient(circle at 9px 9px, #6b5248 0 2.2px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 9px) 9px, #6b5248 0 2.2px, transparent 2.8px),
    radial-gradient(circle at 9px calc(100% - 9px), #6b5248 0 2.2px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #6b5248 0 2.2px, transparent 2.8px),
    linear-gradient(180deg, transparent calc(50% - 1px), rgba(42, 24, 19, .16) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    var(--cream); }
.booth-sign .t-name, .booth-sign .clock { font-size: 26px; }
.booth-sign .center .t-name { color: var(--red); }
.booth-sign .t-meta { font-weight: 700; }
.booth-sign .clock small { font-weight: 700; }
.shelf { padding-top: 14px; }
.shelf::after { height: 22px; left: 0; right: 0; border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 0 22%, #8a5a2a 22% calc(22% + 3px), transparent calc(22% + 3px) 78%, #8a5a2a 78% calc(78% + 3px), transparent calc(78% + 3px)),
    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, #f3d57a, var(--hay) 45%, var(--hay-dk)); }
.prize svg { width: clamp(54px, 6.4vw, 76px); height: clamp(54px, 6.4vw, 76px); }
.prize b { top: calc(clamp(54px, 6.4vw, 76px) * .36); translate: 0 -50%; color: var(--cream); font-size: clamp(12px, 1.3vw, 16px); text-shadow: 1px 1px 0 var(--ink); }
.prize span { margin-top: -2px; border-radius: 4px; font-weight: 800; }
.pot svg { width: clamp(84px, 10vw, 118px); height: clamp(66px, 7.9vw, 93px); }
.pot .pot-sum { top: 46%; border-radius: 4px; font-size: clamp(13px, 1.4vw, 17px); }
.pot .pot-label { font-weight: 800; color: var(--ink); text-shadow: none; position: relative; z-index: 2; margin-top: 1px; }

.track { --lane-h: 74px; margin-top: 14px; border-radius: 6px; background: var(--turf); }
/* every lane is packed dirt with trotter prints and loose straw, split by a whitewashed rail */
.lane { border-bottom: 2px solid var(--ink); box-shadow: inset 0 -5px 0 #f6ead0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='60'%3E%3Cg fill='%238f5f36'%3E%3Cellipse cx='30' cy='22' rx='2.4' ry='3.6' transform='rotate(-12 30 22)'/%3E%3Cellipse cx='35' cy='21' rx='2.4' ry='3.6' transform='rotate(12 35 21)'/%3E%3Cellipse cx='104' cy='40' rx='2.4' ry='3.6' transform='rotate(-12 104 40)'/%3E%3Cellipse cx='109' cy='39' rx='2.4' ry='3.6' transform='rotate(12 109 39)'/%3E%3C/g%3E%3Cpath d='M60 46 L76 42 M140 16 L150 26 M8 50 L20 52' stroke='%23e9c25a' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") left 50px top 0 / 180px 60px repeat-x; }
.lane:nth-child(even) { background-color: var(--turf-2); background-position: left 140px top 4px; }
.lane:last-child { box-shadow: none; }
.lane::after { display: none; }
.lane-no { width: 34px; background: var(--red); color: var(--cream); font: 400 20px/1 var(--display); }
.lane:nth-child(3n+2) .lane-no { background: var(--cobalt); }
.lane:nth-child(3n) .lane-no { background: var(--green); }
.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 wall of stacked hay bales */
.finish { width: 22px; border-left: var(--edge);
  background:
    linear-gradient(180deg, transparent 0 34px, var(--ink) 34px 36px) 0 0 / 22px 36px repeat-y,
    linear-gradient(90deg, transparent 0 8px, #8a5a2a 8px 10px, transparent 10px) 0 0 / 22px 36px,
    repeating-linear-gradient(170deg, rgba(255, 246, 200, .6) 0 2px, transparent 2px 6px, rgba(150, 105, 30, .4) 6px 7px, transparent 7px 11px),
    var(--hay); }
.zero { border-left: 3px dashed rgba(253, 246, 227, .85); }
.zero span { font: 700 12px/1 var(--mono); color: var(--cream); text-shadow: 1px 1px 0 var(--ink); }

.runner.pig { --hw: calc((var(--lane-h, 64px) - 6px) * 1.333); top: 0; bottom: 5px; }
.runner.pig .horse { animation: trot .9s ease-in-out infinite alternate; transform-origin: 50% 92%; }
.lane:nth-child(2n) .runner.pig .horse { animation-delay: -.35s; }
.lane:nth-child(3n) .runner.pig .horse { animation-delay: -.7s; }
@keyframes trot {
  from { transform: translateY(0) rotate(-1deg); }
  to { transform: translateY(-2.5px) rotate(1.2deg); }
}
@media (prefers-reduced-motion: reduce) { .runner.pig .horse { animation: none; } }
/* the rod becomes a small kick of dust behind the hind trotters */
.runner.pig .rod { left: -6%; width: 32%; height: 10px; bottom: 0; border: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(226, 190, 140, .9), rgba(226, 190, 140, 0)); }
.runner.pig .disc { left: 45.5%; top: 33.4%; width: 17%; background: var(--cream); }
.tag { border-radius: 5px; font-weight: 800; }
.tag em { font-weight: 700; }
.runner.me .tag { background: var(--bulb); }
.runner.p1 .tag { background: #ffe1a6; }

.step h3 { font-size: 25px; }
.step h3::before { color: var(--red); }
.ticket-head h3 { font-size: 29px; }
.ticket-head .fee-in { font-size: 22px; }
.ticket dt { font-weight: 700; }
.ticket dd { font-weight: 800; }
.ticket.sprint { --tk: var(--red); }
.ticket.heat { --tk: var(--cobalt); }
.ticket.classic { --tk: var(--green); }
.ticket.dash { --tk: var(--bulb); }
.panel { border-radius: 10px; }

.dlg { border-radius: 12px; }
.dlg-head { background: var(--red) var(--boards); }
.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(--red); }
.test-note { background: #f8e7b4; border-color: var(--wall-2); }
.launch { background: var(--ink); }
.launch a { color: var(--bulb); }
.foot { border-top: 0; background: var(--ink); color: #e2d3c6; position: relative; }
/* the footer sits on a row of hay bales */
.foot::before { content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 14px; border-top: var(--edge);
  background:
    linear-gradient(90deg, transparent 0 116px, var(--ink) 116px 118px, transparent 118px) 0 0 / 118px 14px,
    linear-gradient(90deg, transparent 0 28px, #8a5a2a 28px 31px, transparent 31px 86px, #8a5a2a 86px 89px, transparent 89px) 0 0 / 118px 14px,
    repeating-linear-gradient(100deg, rgba(255, 246, 200, .55) 0 2px, transparent 2px 7px, rgba(150, 105, 30, .35) 7px 8px, transparent 8px 13px),
    var(--hay); }
.toast { box-shadow: 4px 4px 0 var(--red); }
.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; }
  .lane { background-size: 130px 44px; background-position: left 28px top 0; }
  .lane:nth-child(even) { background-position: left 90px top 2px; }
  .brand-horse { width: 60px; height: 45px; }
  .brand-word { font-size: 36px; }
  .lane-no { width: 24px; font-size: 15px; }
  .finish { width: 13px; background-size: 13px 24px, 13px 24px, auto, auto;
    background-image: linear-gradient(180deg, transparent 0 22px, var(--ink) 22px 24px), linear-gradient(90deg, transparent 0 5px, #8a5a2a 5px 7px, transparent 7px),
      repeating-linear-gradient(170deg, rgba(255, 246, 200, .6) 0 2px, transparent 2px 6px, rgba(150, 105, 30, .4) 6px 7px, transparent 7px 11px); }
  .count .big { font-size: 30px; }
  .hero h1 .h1b { text-shadow: 2px 2px 0 var(--cream), 4px 4px 0 var(--ink); }
}
