/* Teddy Plops: shared tokens, type and controls. Used by every page. */
@view-transition { navigation: auto; }

:root {
  --ink: #3a1a12;
  --cream: #fff6e5;
  --shade: #f1cfa1;
  --gold: #ffcd2e;
  --gold-deep: #e89a10;
  --red: #e8352f;
  --red-deep: #a81d1c;
  --green: #4fb82f;
  --green-deep: #2f8a1c;
  --night: #120d3f;
  --sky-a: #ff7f36;
  --sky-b: #ffd25a;
  --text: var(--ink);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --outline: 3px solid var(--ink);
  --press: 0 6px 0 var(--ink);
  --gutter: clamp(16px, 4vw, 56px);
  --bounce: cubic-bezier(.3, 1.6, .5, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(17px, 1.05vw + 13px, 21px);
  line-height: 1.45;
  font-weight: 600;
  color: var(--ink);
  background: var(--sky-a);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
img { -webkit-user-drag: none; }
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid #1466ff; outline-offset: 3px; border-radius: 8px; }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 16px; background: var(--cream); border: var(--outline); border-radius: 12px; transform: translateY(-200%); }
.skip:focus { transform: none; }
[hidden] { display: none !important; }
html:not(.js) .js-only { display: none !important; }

/* Plopface lettering: see js/lettering.js. Before it upgrades, or with no JS, headings are plain heavy type. */
[data-plop] { font-weight: 900; line-height: 1; letter-spacing: -.02em; text-transform: uppercase; }
html.js [data-plop]:not(.plopped) { visibility: hidden; animation: show-anyway 0s 2.5s forwards; }
@keyframes show-anyway { to { visibility: visible; } }
.plrow { display: inline-flex; flex-wrap: wrap; justify-content: inherit; align-items: center; gap: .02em .2em; max-width: 100%; }
.plw { height: 1em; width: calc(1em * var(--ar)); overflow: visible; flex: none; max-width: 100%; }
.pl { transform-box: fill-box; transform-origin: 50% 100%; cursor: default; }
.pl path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pl-ink { stroke: var(--ink); stroke-width: 48; }
.pl-shade { stroke: var(--pl-shade, var(--shade)); stroke-width: 30; }
.pl-fill { stroke: var(--pl-fill, var(--cream)); stroke-width: 25; transform: translateY(-2.5px); }
.pl-gloss { stroke: #fff; stroke-width: 4.5; stroke-dasharray: 13 88; stroke-dashoffset: -6; transform: translate(-6px, -6px); opacity: .62; }
[data-tone="cream"] { --pl-fill: var(--cream); --pl-shade: var(--shade); }
[data-tone="gold"] { --pl-fill: var(--gold); --pl-shade: var(--gold-deep); }
[data-tone="red"] { --pl-fill: #f4493f; --pl-shade: var(--red-deep); }
html.js .plopped:not(.in) .pl { opacity: 0; }
.plopped.in .pl.landed { animation: none; opacity: 1; }
.plopped.in .pl { animation: plop-in .7s var(--bounce) both; animation-delay: calc(var(--i, 0) * 45ms); }
.pl.boing { animation: boing .55s var(--bounce) !important; }
@keyframes plop-in {
  0% { opacity: 0; transform: translateY(-46%) scale(.82, 1.2); }
  55% { opacity: 1; transform: translateY(2%) scale(1.12, .84); }
  100% { opacity: 1; transform: none; }
}
@keyframes boing {
  0% { transform: none; }
  30% { transform: translateY(-16%) scale(.9, 1.14) rotate(-4deg); }
  60% { transform: translateY(0) scale(1.14, .86); }
  100% { transform: none; }
}

/* Buttons feel like pressing a sticker. */
.btn, .chip {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: var(--outline); border-radius: 999px; background: var(--cream); color: var(--ink);
  font-weight: 800; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn { min-height: 52px; padding: .55em 1.25em; box-shadow: var(--press); white-space: normal; text-align: center; }
.btn:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 8px 0 var(--ink); }
.btn:active { transform: translateY(6px); box-shadow: 0 0 0 var(--ink); }
.btn-big, .btn-huge { background: var(--gold); }
.btn-big { min-height: 62px; font-size: 1.12em; }
.btn-huge { min-height: 84px; width: 100%; font-size: clamp(1.15em, 2.6vw, 1.9em); box-shadow: 0 8px 0 var(--ink); }
.chip { min-height: 44px; padding: 0 16px; font-size: 16px; background: var(--cream); box-shadow: 0 3px 0 var(--ink); }
.chip:hover { transform: translateY(-1px); }
.chip:active { transform: translateY(3px); box-shadow: none; }
.chip-gold { background: var(--gold); }

/* Teddy's rig: see js/puppet.js. */
.pp { position: relative; width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.pp-rig { position: absolute; inset: 0; transform-origin: 41.5% 90%; }
.pp-part { position: absolute; max-width: none; pointer-events: none; }
.pp-head { position: absolute; transform-origin: 50% 80%; z-index: 5; }
.pp-hide { visibility: hidden; }
.pp-pop { animation: pp-pop .35s var(--bounce); }
@keyframes pp-pop { from { scale: .4; } to { scale: 1; } }
.pp-shadow { position: absolute; left: 13%; right: 16%; bottom: 3%; height: 11%; border-radius: 50%; background: rgba(58, 26, 18, .2); }
.pp-collar { position: absolute; left: 14%; top: 78%; width: 72%; z-index: 1; pointer-events: none; }
.pp-collar svg { width: 100%; height: auto; overflow: visible; }

/* Top bar: brand, the time of day, and the way out. */
.bar {
  position: fixed; z-index: 40; inset: max(10px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) auto max(var(--gutter), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; text-decoration: none; background: var(--cream); border: var(--outline); border-radius: 999px; padding: 3px 16px 3px 3px; box-shadow: 0 3px 0 var(--ink); }
.bar-brand img { width: 36px; height: 36px; border-radius: 50%; }
.bar-clock { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; background: var(--ink); color: var(--cream); border-radius: 999px; font-variant-numeric: tabular-nums; font-size: 16px; }
.bar-clock b { min-width: 4.3ch; text-align: right; }
.bar-dial { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(255, 205, 46, .3); transition: background .4s ease, box-shadow .4s ease; }
.is-night .bar-dial { background: #cfd4ff; box-shadow: inset -5px -2px 0 #6e74c8; }
.bar-acts { display: flex; gap: 8px; }
.chip[aria-pressed="false"] .chip-on, .chip[aria-pressed="true"] .chip-off { display: none; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--cream); }

/* Phones: the bar steps out of the way when scrolling down, and comes back when scrolling up. */
.bar { transition: transform .25s ease; }
@media (max-width: 860px) {
  .bar-away:not(:focus-within) { transform: translateY(-160%); }
  .bar-brand span, .chip-off, .chip-on { font-size: 14px; }
  .bar-brand span { display: none; }
  .bar-brand { padding: 3px; }
  .chip { padding: 0 12px; font-size: 15px; }
  .bar-clock { display: none; }
}
@media (max-width: 420px) { .bar-acts { gap: 5px; } .chip { padding: 0 9px; font-size: 14px; } }
@media (max-width: 340px) { .bar-brand { display: none; } .bar { justify-content: flex-end; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html.js .plopped:not(.in) .pl { opacity: 1; }
  html .pl.boing { animation: none !important; }
  @view-transition { navigation: none; }
}
