/* 9 LIVES: tokens, fonts, shared controls, the cats. */
@font-face { font-family: 'Pixelify Sans'; src: url('../assets/fonts/pixelify.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Jacquard 24'; src: url('../assets/fonts/jacquard.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  /* beige-box plastic instead of system grey */
  --putty: #d8d0bd;
  --putty-hi: #fffbee;
  --putty-lo: #958c77;
  --putty-dk: #332d24;
  /* the cat */
  --tabby: #ee7b1a;
  --tabby-dk: #b44d06;
  --tabby-hi: #ffb866;
  /* dusk, taken from the wallpaper */
  --plum: #2c1740;
  --plum-mid: #5a3382;
  --lilac: #b9a0e3;
  --ink: #1d1424;
  --paper: #fffdf3;
  --stop: #d62828;
  --stop-dk: #8a0f0f;
  --night: #0b0710;

  --ui: 'Pixelify Sans', 'Trebuchet MS', Verdana, sans-serif;
  --rite: 'Jacquard 24', 'Pixelify Sans', Georgia, serif;
  --term: 'Lucida Console', Consolas, 'Courier New', monospace;

  --bar-h: 46px;
  --out: inset -2px -2px 0 var(--putty-dk), inset 2px 2px 0 var(--putty-hi), inset -4px -4px 0 var(--putty-lo), inset 4px 4px 0 #efe8d6;
  --in: inset 2px 2px 0 var(--putty-dk), inset -2px -2px 0 var(--putty-hi), inset 4px 4px 0 var(--putty-lo);
  --drop: 6px 8px 0 rgba(20, 8, 30, 0.38);
  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Cpath d='M3 2v19l5-4.4 3.3 7.4 3.4-1.5-3.2-7.3H18z' fill='%23ee7b1a' stroke='%231d1424' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E") 3 2, auto;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--night); overflow: hidden; }
body { font: 500 17px/1.3 var(--ui); color: var(--ink); cursor: var(--cursor); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#stage { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; }
#stage.shake { animation: shake 0.3s steps(6); }
#stage.shake.big { animation: shake-big 0.5s steps(9); }
@keyframes shake { 20% { transform: translate(-7px, 4px); } 40% { transform: translate(6px, -5px); } 60% { transform: translate(-5px, -3px); } 80% { transform: translate(4px, 5px); } }
@keyframes shake-big { 11% { transform: translate(-16px, 9px) rotate(-0.6deg); } 22% { transform: translate(14px, -11px) rotate(0.7deg); } 33% { transform: translate(-12px, -8px); } 44% { transform: translate(11px, 12px) rotate(-0.5deg); } 55% { transform: translate(-9px, 6px); } 66% { transform: translate(8px, -7px) rotate(0.4deg); } 77% { transform: translate(-5px, -4px); } 88% { transform: translate(4px, 3px); } }

body.nocursor, body.nocursor * { cursor: none !important; }
body.frozen #desk { pointer-events: none; }

/* Shared controls */
.btn { min-width: 86px; padding: 7px 16px 8px; border: 0; background: var(--putty); color: var(--ink); font-weight: 600; box-shadow: var(--out); }
.btn:active, .btn.down { box-shadow: var(--in); padding: 8px 15px 7px 17px; }
.btn:focus-visible { outline: 2px dotted var(--ink); outline-offset: -8px; }

.pain { border: 0; padding: 0.14em 0.5em 0.2em; font: 400 clamp(52px, 10vw, 112px)/1 var(--rite); color: #fff1dc; background: var(--stop);
  box-shadow: inset -5px -5px 0 var(--stop-dk), inset 5px 5px 0 #ff8a70, 0 12px 0 #4d0707, 0 12px 0 4px #000, 0 0 0 4px #000; text-shadow: 3px 3px 0 var(--stop-dk); }
.pain:hover { background: #e83a2e; }
.pain:active { transform: translateY(9px); box-shadow: inset -5px -5px 0 var(--stop-dk), inset 5px 5px 0 #ff8a70, 0 3px 0 #4d0707, 0 3px 0 4px #000, 0 0 0 4px #000; }
.pain:focus-visible { outline: 3px dotted var(--tabby-hi); outline-offset: 12px; }
.pain.small { font-size: clamp(30px, 5vw, 46px); box-shadow: inset -3px -3px 0 var(--stop-dk), inset 3px 3px 0 #ff8a70, 0 6px 0 #4d0707, 0 0 0 3px #000; }
.pain.small:active { transform: translateY(4px); box-shadow: inset -3px -3px 0 var(--stop-dk), inset 3px 3px 0 #ff8a70, 0 2px 0 #4d0707, 0 0 0 3px #000; }

/* The cats. Sound and picture start and stop together (js/cats.js). */
#cats { position: absolute; inset: 0; z-index: 850; pointer-events: none; overflow: hidden; }
.cat { position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); transform: translate(var(--x), var(--y)); }
.cat-in { width: 100%; height: 100%; animation: cat-pop 0.17s cubic-bezier(0.2, 1.7, 0.4, 1) both; }
.cat.rise .cat-in { animation: cat-rise 0.2s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.cat.out .cat-in { animation: cat-out 0.14s ease-in both; }
.cat.rise.out .cat-in { animation: cat-sink 0.16s ease-in both; }
.cat.laughing .cat-art { animation: cat-jig 0.1s steps(2) infinite alternate; }
.cat-art { width: 100%; height: 100%; rotate: var(--r, 0deg); }
.cat.white .cat-art { display: block; object-fit: cover; border: 4px solid var(--paper); box-shadow: var(--drop); background: #777; }
.cat.orange .cat-art { background: url('../assets/cat/orange.webp') 0 0 / 900% 600% no-repeat; filter: drop-shadow(5px 6px 0 rgba(20, 8, 30, 0.35));
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent 99%); mask-image: linear-gradient(90deg, #000 84%, transparent 99%); }
.cat.orange.float .cat-art { -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent 99%), linear-gradient(#000 86%, transparent 99%); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, #000 84%, transparent 99%), linear-gradient(#000 86%, transparent 99%); mask-composite: intersect; }
.cat.block { pointer-events: auto; }
.cat-cap { position: absolute; left: 50%; top: -0.4em; translate: -50% -100%; padding: 2px 10px 4px; white-space: nowrap; font: 700 22px/1 var(--ui); color: var(--ink); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
@keyframes cat-pop { from { transform: scale(0.1) rotate(-14deg); } }
@keyframes cat-out { to { transform: scale(0); opacity: 0; } }
@keyframes cat-rise { from { transform: translateY(105%); } }
@keyframes cat-sink { to { transform: translateY(105%); } }
@keyframes cat-jig { from { transform: translate(-3px, 2px) scale(1.02); } to { transform: translate(3px, -3px) scale(0.98); } }

/* The fake cursor that replaces the real one when the cat takes your mouse (life 3). Same drawing as --cursor. */
#paw { position: absolute; left: 0; top: 0; z-index: 900; width: 26px; height: 26px; margin: -2px 0 0 -3px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'%3E%3Cpath d='M3 2v19l5-4.4 3.3 7.4 3.4-1.5-3.2-7.3H18z' fill='%23ee7b1a' stroke='%231d1424' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat; }

@media (prefers-reduced-motion: reduce) {
  #stage.shake, #stage.shake.big { animation: none; }
  .cat.laughing .cat-art { animation: none; }
}
