/* Crumble Bridge site tokens: the game's own (scripts/look.gd, docs/style.md), so a page and the
   game look one: a 1930s cartoon short. Cream paper, brown-black ink, the two-strip teal sky, Jost
   for words and Fraunces Black for the title cards; the marquee red for the main button; a
   projector's grain over all of it. */
@font-face { font-family: "Jost"; src: url("/fonts/Jost.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/fonts/Fraunces.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
:root {
  --ink: #1d1510; --ink-dim: #4e3d2e; --ink-faint: #7d6a55; --cream: #fff6de; --paper: #fbf1d6; --paper-dim: #f0e1ba;
  --row: #f2e3bd; --sky-top: #a9d6c9; --sky-low: #f5e6bf; --hill: #8fc2a2; --hill-low: #b5d08f; --sun: #f7cf4e;
  --stone: #c99a62; --stone-dark: #9a6b3c; --accent: #f2b320; --marquee: #d8432e; --danger: #c2301c; --success: #2e8a4f;
  --scrim: rgba(41, 26, 13, .62);
  --p0: #f08a24; --p1: #49ade0; --p2: #2bae7c; --p3: #f6d339; --p4: #3d59cf; --p5: #de3e2a; --p6: #e58dc0; --p7: #8e98a6;
  /* the old names, for anything still reading them */
  --bg-top: var(--sky-top); --bg-low: var(--sky-low); --panel: var(--paper); --edge: var(--ink); --on-light: var(--ink);
  --r-s: 8px; --r-m: 12px; --r-l: 18px;
  /* a hand-drawn card's corners: each a touch different */
  --hand: 16px 13px 18px 12px / 13px 17px 12px 16px;
  --font: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  --display: "Fraunces", "Cooper Black", Georgia, serif;
}
/* The sky, teal at the top and cream at the horizon (not background-attachment: fixed, which iOS
   ignores and a long page cuts short) */
html { min-height: 100dvh; background: var(--sky-low) linear-gradient(var(--sky-top), var(--sky-low) 80vh) no-repeat; color: var(--ink);
  font-family: var(--font); font-weight: 500; }
/* A title card's words: Fraunces Black, soft and wonky */
.display { font-family: var(--display); font-weight: 900; font-variation-settings: "SOFT" 100, "WONK" 1; font-optical-sizing: auto; }
/* Cream letters in a thick ink edge with a hard ink shadow: the logo, the big titles */
.card-title { color: var(--cream); -webkit-text-stroke: .09em var(--ink); paint-order: stroke fill; text-shadow: .06em .07em 0 var(--ink); }

/* The buttons: a painted sign, inked, a hard ink shadow; pressing one squashes it and drops the shadow */
.nb-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; box-sizing: border-box;
  font: 900 clamp(1.3rem, 3vw, 1.7rem)/1 var(--display); font-variation-settings: "SOFT" 100, "WONK" 1; letter-spacing: .01em;
  color: var(--cream); background: var(--marquee); border: 3px solid var(--ink); border-radius: var(--hand); padding: .62em 1.4em .68em;
  text-decoration: none; cursor: pointer; -webkit-text-stroke: .1em var(--ink); paint-order: stroke fill;
  box-shadow: 5px 6px 0 var(--ink); transition: transform .08s, box-shadow .08s; -webkit-tap-highlight-color: transparent; }
.nb-btn:hover { transform: translate(-1px, -2px) rotate(-.6deg); box-shadow: 6px 8px 0 var(--ink); }
.nb-btn:active { transform: translate(4px, 6px) scale(1.04, .92); box-shadow: 0 0 0 var(--ink); }
.nb-btn:focus-visible { outline: 4px solid var(--accent); outline-offset: 5px; }
/* A secondary button: the row's paper, ink words */
.nb-btn.quiet { color: var(--ink); background: var(--row); -webkit-text-stroke: 0; font: 700 clamp(1.15rem, 2.6vw, 1.4rem)/1 var(--font); box-shadow: 4px 5px 0 var(--ink); }
.nb-btn.quiet:hover { background: var(--cream); }
.nb-btn.quiet:active { box-shadow: 0 0 0 var(--ink); background: var(--accent); }

/* A cream card, inked, a hard shadow, like a sign painted for a cartoon */
.ink-card { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--hand); box-shadow: 6px 7px 0 var(--ink); }

/* The projector over every page: grain on twos, a browned gate at the edges, now and then a
   scratch. It only draws; still for anyone who asks the browser for less motion. */
.film { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.film::before { content: ""; position: absolute; inset: -60px; opacity: .55; mix-blend-mode: multiply;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .22 0 0 0 0 .14 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(12) infinite; }
.film::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 75% 70% at 50% 50%, transparent 62%, rgba(92, 56, 24, .2) 88%, rgba(60, 34, 14, .38));
  border-left: 1px solid transparent; animation: flicker 3.2s steps(1) infinite; }
.film i { position: absolute; top: 0; bottom: 0; left: 31%; width: 1.5px; background: rgba(46, 30, 18, .45); opacity: 0; animation: scratch 7s steps(1) infinite; }
@keyframes grain {
  0% { transform: translate(0, 0); } 8% { transform: translate(-37px, 21px); } 17% { transform: translate(14px, -45px); }
  25% { transform: translate(-22px, -9px); } 33% { transform: translate(41px, 30px); } 42% { transform: translate(-8px, 52px); }
  50% { transform: translate(26px, -18px); } 58% { transform: translate(-49px, -36px); } 67% { transform: translate(9px, 12px); }
  75% { transform: translate(-30px, 44px); } 83% { transform: translate(52px, -4px); } 92% { transform: translate(-15px, -27px); }
}
@keyframes flicker { 0%, 100% { opacity: 1; } 31% { opacity: .82; } 33% { opacity: 1; } 71% { opacity: .9; } 72% { opacity: 1; } }
@keyframes scratch { 0%, 100% { opacity: 0; } 40% { opacity: 1; left: 31%; } 43% { opacity: 0; } 81% { opacity: .8; left: 72%; } 83% { opacity: 0; } }
/* The world's bounce: 120 BPM, a sine held on twos (Look.beat); animation: bob .5s steps(1) infinite,
   --bob how high */
@keyframes bob {
  0%, 100% { transform: translateY(0); } 16.7% { transform: translateY(calc(var(--bob, 6px) * -.5)); }
  33.3% { transform: translateY(calc(var(--bob, 6px) * -.87)); } 50% { transform: translateY(calc(var(--bob, 6px) * -1)); }
  66.7% { transform: translateY(calc(var(--bob, 6px) * -.87)); } 83.3% { transform: translateY(calc(var(--bob, 6px) * -.5)); }
}
@media (prefers-reduced-motion: reduce) {
  .film::before, .film::after, .film i { animation: none; }
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; }
}
