/* IDEARRHEA — $IDEA. Everything is drawn by one hand: Patrick Hand, black ink on off-white paper. */

@font-face {
  font-family: 'Patrick Hand';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url(fonts/patrick-hand-latin.woff2) format('woff2');
}

:root {
  --ink: #161616;
  --paper: #faf9f4;
  --note: #fff07a;
  --red: #c0262d;
  --s: 1;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', cursive;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---- background plate: cover, locked to the (contained) stage ---- */
#bg {
  position: fixed;
  left: 0; top: 0;
  width: 1920px; height: 1080px;
  background: url(assets/L0_bleed_plate.jpg) 0 0 / 100% 100% no-repeat;
  z-index: 0;
}

/* ---- stage: the 1920x1080 safe area, scaled to contain ---- */
#stage {
  position: fixed;
  left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  z-index: 1;
}

#dev {
  position: absolute;
  left: 0; top: 0;
  width: 1920px; height: 1080px;
  background: url(assets/M1_dev.png) 0 0 / 100% 100% no-repeat;
}

#notes { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }

/* the art and the notes never intercept clicks; the big note's chips re-enable them */
#bg, #dev, #notes { pointer-events: none; }
#big { pointer-events: auto; }

/* ---- header (anchored to the viewport) ---- */
header {
  position: fixed;
  left: 0; right: 0; top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 50;
  padding: max(16px, calc(22px * var(--s))) max(24px, calc(40px * var(--s)));
  pointer-events: none;
}
header .brand, header nav { pointer-events: auto; }

.brand { display: flex; align-items: baseline; gap: .3em; }

.logo {
  font-size: max(32px, calc(58px * var(--s)));
  letter-spacing: .02em;
  line-height: 1;
}

.tag {
  font-size: max(17px, calc(29px * var(--s)));
  line-height: 1.35;
  margin-left: .35em;
  border: 2px solid var(--ink);
  border-radius: 10px 14px 9px 12px;
  padding: 0 .3em;
  background: var(--note);
}

nav { display: flex; gap: max(10px, calc(14px * var(--s))); }

.pill {
  font-family: inherit;
  font-size: max(16px, calc(30px * var(--s)));
  line-height: 1.5;
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 14px 10px 13px 9px;
  padding: .02em .7em;
  background: var(--paper);
  cursor: pointer;
  transition: transform .12s ease;
}
.pill:hover { transform: rotate(-1deg); }
.pill:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }

.hidden { display: none !important; }

/* ---- whiteboard counter (diegetic) ---- */
#board {
  position: absolute;
  left: 170px; top: 268px;
  width: 396px; height: 220px;
  font-size: 38px;
  line-height: 1.18;
}
#board h3 {
  margin: 0 0 6px;
  font-weight: 400;
  font-size: 30px;
  text-decoration: underline;
  opacity: .7;
}
#board .num { display: inline-block; transform-origin: 0 60%; }
#board .num.pop { animation: pop .12s ease-out; }
#board .bad { color: var(--red); }
@keyframes pop { from { transform: scale(1.25); } to { transform: scale(1); } }

/* ---- sticky notes ---- */
.note {
  position: absolute;
  left: 0; top: 0;
  width: 150px; height: 118px;
  padding: 9px 10px;
  background: var(--note);
  border: 2.5px solid var(--ink);
  border-radius: 3px 6px 4px 7px;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  overflow: hidden;
  color: var(--ink);
}
.note .tk { font-size: 30px; line-height: 1; white-space: nowrap; }
.note .sb {
  margin-top: 5px;
  font-size: 17px;
  line-height: 1.06;
  max-height: 36px;
  overflow: hidden;
}

/* the big $IDEA payoff note */
#big {
  width: 470px; height: 240px;
  padding: 15px 18px 12px;
  border-width: 3.5px;
  border-radius: 5px 9px 6px 10px;
  text-align: center;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
#big .tk { font-size: 84px; line-height: 1; letter-spacing: .01em; }
#big.solo { gap: 0; }
#big .chips {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
  opacity: 0;
}
#big .chips.show { opacity: 1; transition: opacity .2s ease; }
#big .chip {
  font-family: inherit;
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 12px 9px 13px 8px;
  padding: 1px 12px;
  background: var(--paper);
  cursor: pointer;
}
#big .chip:hover { transform: rotate(-1deg); }
#big .chip:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }

/* ---- CTA + hint ---- */
#cta {
  position: absolute;
  left: 660px; top: 910px;
  width: 600px; height: 96px;
  background: var(--note);
  border: 3px solid var(--ink);
  border-radius: 18px 26px 16px 24px / 24px 16px 26px 18px;
  font-family: inherit;
  font-size: 48px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: transform .12s ease;
}
#cta:hover { transform: rotate(-1deg) scale(1.03); }
#cta:active { transform: scale(.97); }
#cta:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
#cta.is-busy { cursor: default; }

#hint {
  position: absolute;
  left: 660px; top: 1014px;
  width: 600px;
  text-align: center;
  font-size: 24px;
  opacity: .6;
}

/* ---- FX ---- */
.fx { pointer-events: none; }

#brrt {
  position: absolute;
  left: 800px; top: 560px;
  font-size: 72px;
  opacity: 0;
  z-index: 5;
  transform: translate(-50%, -50%) rotate(-14deg);
  transform-origin: 50% 50%;
  color: var(--ink);
  -webkit-text-stroke: 10px var(--paper);
  paint-order: stroke fill;
  text-shadow: 0 0 0 var(--paper);
}
#brrt.on { animation: brrt .18s steps(2, end) infinite; }
@keyframes brrt {
  0%   { transform: translate(-50%, -50%) rotate(-14deg) scale(.9) translate(0, 0); }
  50%  { transform: translate(-50%, -50%) rotate(-15deg) scale(1.12) translate(-2px, -2px); }
  100% { transform: translate(-50%, -50%) rotate(-13deg) scale(.92) translate(1px, 1px); }
}

#lines { position: absolute; left: 828px; top: 596px; opacity: 0; }

#toast {
  position: absolute;
  left: 470px; top: 470px;
  transform: translate(-50%, -50%) rotate(-2deg);
  padding: 6px 18px;
  font-size: 30px;
  background: var(--note);
  border: 2.5px solid var(--ink);
  border-radius: 4px 7px 5px 8px;
  opacity: 0;
  transition: opacity .12s ease;
}
#toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #cta:hover { transform: none; }
  #cta { transition: none; }
  .pill { transition: none; }
  .pill:hover { transform: none; }
}
