/* The C4 Cat. everything is drawn with a shaky mouse hand. */

@font-face {
  font-family: 'Rock Salt';
  src: url('./fonts/rock-salt-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Arimo';
  src: url('./fonts/arimo-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Arimo';
  src: url('./fonts/arimo-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('./fonts/courier-prime-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --ink: #000000;
  --paper: #ffffff;
  --red: #ff0000;
  --yellow: #ffff00;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: 'Arimo', Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* the shake when he goes off */
body.shaking { animation: shake 420ms steps(2, end) 3; }
@keyframes shake {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(7px, -5px) rotate(0.5deg); }
  50%  { transform: translate(-6px, 4px) rotate(-0.6deg); }
  75%  { transform: translate(4px, 6px) rotate(0.3deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 34px 20px 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
}

/* wordmark, written by hand, slightly off level */
.wordmark {
  font-family: 'Rock Salt', 'Comic Sans MS', cursive;
  font-weight: 400;
  font-size: clamp(28px, 8.4vw, 52px);
  line-height: 1.28;
  margin: 6px 0 0;
  transform: rotate(-1.8deg);
  letter-spacing: 0.5px;
}

/* ---- the hero slot. the cat lands here ---- */
.slot {
  position: relative;
  width: min(78vw, 420px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  transform: rotate(0.7deg);
  border: 3px dashed var(--ink);
}
.cat {
  max-width: 100%;
  max-height: 100%;
  display: block;
  image-rendering: auto;
}
.cat.gone { display: none; }
.slot.filled {
  border-color: transparent;
  width: min(88vw, 520px);
  aspect-ratio: auto;
  height: auto;
}
.slot.filled .cat { max-height: min(66vh, 560px); width: auto; }

.slot-note {
  padding: 10px;
  display: none;
}
.slot-note.showing { display: block; }
.note-big {
  font-family: 'Rock Salt', 'Comic Sans MS', cursive;
  font-size: clamp(16px, 4.6vw, 22px);
  margin: 0 0 12px;
  transform: rotate(-2.4deg);
}
.note-small {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 13px;
  margin: 0;
  color: #555;
}

/* ---- the deadpan line ---- */
.line {
  font-size: clamp(14px, 3.8vw, 17px);
  line-height: 1.5;
  margin: 0;
  max-width: 22em;
}

/* ---- the button he asked you not to press ---- */
.boom {
  font-family: 'Rock Salt', 'Comic Sans MS', cursive;
  font-size: clamp(15px, 4.4vw, 20px);
  color: var(--red);
  background: var(--paper);
  border: 3px solid var(--red);
  padding: 16px 26px 14px;
  cursor: pointer;
  transform: rotate(1.5deg);
  line-height: 1.2;
}
.boom:active { transform: rotate(1.5deg) translateY(3px); }
.boom:focus-visible { outline: 3px solid var(--red); outline-offset: 5px; }

.count {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 13px;
  margin: -8px 0 0;
  color: #333;
}

/* ---- the contract window, drawn like a dialog box ---- */
.win {
  position: relative;
  width: min(88vw, 460px);
  background: var(--paper);
  border: 3px solid var(--ink);
  transform: rotate(-0.9deg);
  text-align: left;
}
.win-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 7px;
}
.win-title {
  font-family: 'Rock Salt', 'Comic Sans MS', cursive;
  font-size: 13px;
}
.win-x { width: 20px; height: 20px; position: relative; display: inline-block; }
.win-rule { position: relative; height: 3px; margin: 0 0 2px; background: var(--ink); }
body.inked .win-rule { background: transparent; }

.win-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  flex-wrap: wrap;
}
.ca {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: clamp(11px, 3vw, 14px);
  word-break: break-all;
  flex: 1 1 200px;
  line-height: 1.45;
}
.copy {
  font-family: 'Arimo', Arial, sans-serif;
  font-weight: 700;
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  padding: 8px 14px;
  cursor: pointer;
  transform: rotate(-1.2deg);
  position: relative;
}
.copy:active { transform: rotate(-1.2deg) translateY(2px); }
.copy:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

/* ---- twitter ---- */
.x {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: 'Rock Salt', 'Comic Sans MS', cursive;
  font-size: 15px;
  padding: 12px 20px 10px;
  border: 3px solid var(--ink);
  background: var(--paper);
  transform: rotate(-1.1deg);
  position: relative;
}
.x:active { transform: rotate(-1.1deg) translateY(2px); }
.x:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.x-mark { width: 22px; height: 22px; position: relative; display: inline-block; }

.canary {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 11px;
  color: #666;
  margin: 6px 0 0;
}

/* ---- the hand drawn strokes sit on top of every box ---- */
.ink {
  position: absolute;
  left: -9px; top: -9px;
  width: calc(100% + 18px);
  height: calc(100% + 18px);
  overflow: visible;
  pointer-events: none;
}
body.inked [data-ink] { border-color: transparent; }

/* ---- the explosion doodle ---- */
.fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  display: none;
}
.fx.on { display: block; }

/* toast, because a click that does nothing is a dead click */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) rotate(-1.4deg);
  background: var(--paper);
  border: 3px solid var(--ink);
  font-family: 'Rock Salt', 'Comic Sans MS', cursive;
  font-size: 13px;
  padding: 11px 16px 9px;
  z-index: 60;
}

@media (prefers-reduced-motion: reduce) {
  body.shaking { animation: none; }
  .boom:active, .copy:active, .x:active { transform: none; }
}
