/* ============ $motivation ============ */
/* a blank sheet of paper somebody wrote on with a black marker. */

@font-face {
  font-family: "Caveat";
  src: url("assets/fonts/caveat-700.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("assets/fonts/caveat-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Patrick Hand";
  src: url("assets/fonts/patrick-hand-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}

:root {
  --paper: #fdfdfc;
  --ink: #141414;
  --ink-soft: #4a4a4a;
  --hand: "Patrick Hand", "Comic Sans MS", cursive;
  --marker: "Caveat", "Patrick Hand", cursive;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--hand);
  font-size: clamp(1.05rem, 1rem + .5vw, 1.4rem);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { max-width: 100%; display: block; }

/* line art drops onto the paper with no seam */
.mascot img,
.story__mascot { mix-blend-mode: multiply; }

/* ---------- error banner ---------- */
#err-banner {
  display: none;
  position: fixed; inset: 0 0 auto 0; z-index: 9999;
  background: #ffd3d3; color: #5a0000;
  font-family: monospace; font-size: 13px;
  padding: 10px 14px; border-bottom: 2px solid #5a0000;
}

/* ---------- top chrome ---------- */
.chrome {
  position: fixed; top: 0; right: 0; z-index: 50;
  display: flex; gap: .9rem;
  padding: clamp(.8rem, 2vw, 1.4rem);
}

/* hand-drawn box: irregular radius reads as a marker rectangle */
.scrawl-btn {
  font-family: var(--hand);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 255px 12px 225px 15px / 15px 225px 18px 255px;
  padding: .45rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform .18s var(--ease), background .18s var(--ease);
  transform: rotate(-1.2deg);
}
.scrawl-btn:nth-child(2) { transform: rotate(1.4deg); }
.scrawl-btn:hover,
.scrawl-btn:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(0) scale(1.04);
  outline: none;
}
.scrawl-btn.is-copied {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(0) scale(1.06);
}
.scrawl-btn--big {
  font-size: clamp(1.1rem, 1rem + 1vw, 1.5rem);
  padding: .65rem 1.6rem;
  border-width: 3px;
}

/* ---------- section frame ---------- */
section {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 6rem) clamp(1.4rem, 6vw, 5rem);
}

/* ---------- 1. hero ---------- */
.hero {
  min-height: 90svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: clamp(4rem, 10vh, 6rem);
}
.hero__page {
  position: relative;
  min-height: min(56vh, 460px);
}
.title {
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(2.8rem, 11vw, 7.5rem);
  line-height: .95;
  max-width: 62%;
  transform: rotate(-1.5deg);
}
.title__sub {
  font-size: clamp(1.5rem, 4.5vw, 2.6rem);
  margin: .4rem 0 0 .5rem;
  transform: rotate(-1deg);
}

/* mascot */
.mascot {
  position: absolute;
  right: 0;
  top: 2%;
  width: clamp(148px, 23vw, 262px);
  outline: none;
}
.mascot--hero { animation: breathe 4.5s ease-in-out infinite; }
.mascot img { width: 100%; height: auto; }
.mascot:hover { cursor: help; }

.mascot__say {
  position: absolute;
  left: -8%;
  top: -14%;
  transform: translateX(-100%) rotate(-4deg);
  white-space: nowrap;
  font-family: var(--marker);
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.mascot__say::after {
  content: "";
  position: absolute;
  right: -34px; bottom: 8px;
  width: 30px; height: 14px;
  border-bottom: 2.5px solid var(--ink);
  border-right: 2.5px solid var(--ink);
  transform: rotate(28deg);
}
.mascot__say.show {
  opacity: 1;
  transform: translateX(-100%) rotate(-4deg) translateY(-4px);
}

/* scattered hero notes */
.scatter {
  position: absolute;
  left: var(--x); top: var(--y);
  font-size: clamp(.95rem, 2vw, 1.4rem);
  transform: rotate(var(--r)) translate(var(--dx, 0px), var(--dy, 0px));
  color: var(--ink-soft);
  will-change: transform;
  transition: transform .35s var(--ease);
}

.cta {
  position: absolute;
  left: 0; bottom: 0;
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.scroll-cue {
  text-align: center;
  margin-top: 2.5rem;
  color: var(--ink-soft);
  font-size: 1.1rem;
  animation: nudge 2.4s ease-in-out infinite;
}

/* ---------- 2. story ---------- */
.story {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 6vh, 4rem);
  padding-block: clamp(3.5rem, 9vh, 6rem);
  justify-content: center;
}
.write {
  font-size: clamp(1.6rem, 2.6vw + .8rem, 3.3rem);
  line-height: 1.24;
  font-family: var(--hand);
  max-width: 22ch;
  position: relative;
  /* start hidden, "written" left to right when it enters view */
  clip-path: inset(0 100% -0.2em 0);
}
.write:nth-child(2) { margin-left: clamp(1rem, 8vw, 6rem); }
.write.written {
  clip-path: inset(0 -0.15em -0.2em 0);
  transition: clip-path 1.05s steps(22, end);
}
.story__mascot {
  position: absolute;
  right: clamp(.5rem, 4vw, 3rem);
  top: 50%;
  transform: translateY(-50%) rotate(2deg);
  width: clamp(96px, 12vw, 140px);
  opacity: .55;
}

/* ---------- 3. wall ---------- */
.wall {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(1.4rem, 5vw, 4rem) clamp(1.8rem, 6vw, 5rem);
  padding-block: clamp(5rem, 14vh, 9rem);
  align-content: center;
}
.word {
  font-family: var(--marker);
  font-weight: 700;
  font-size: calc(clamp(1.6rem, 4vw, 3.4rem) * var(--s, 1));
  line-height: 1;
  transform: rotate(var(--r)) translate(var(--dx, 0px), var(--dy, 0px));
  transition: transform .4s var(--ease);
  will-change: transform;
  user-select: none;
}
.word:nth-child(3n)  { margin-top: -1.4rem; }
.word:nth-child(4n)  { margin-bottom: 2rem; }
.word:nth-child(2n)  { color: var(--ink); }
.word:nth-child(2n+1){ color: #262626; }

/* ---------- 4. final ---------- */
.final {
  min-height: 82svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.6rem;
}
.final__line {
  font-family: var(--marker);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 1.05;
  max-width: 16ch;
  transform: rotate(-1.5deg);
}
.final__ticker {
  font-family: var(--marker);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 3rem);
}
.cta--end { position: static; justify-content: center; }

/* ---------- footer ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem clamp(1.4rem, 6vw, 5rem) 3rem;
}
.foot__note { font-size: 1.15rem; color: var(--ink-soft); transform: rotate(-1deg); }
.canary { font-size: .8rem; color: #cfcfcf; letter-spacing: .05em; }

/* ---------- keyframes ---------- */
@keyframes breathe {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-10px) rotate(1deg); }
}
@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: .6; }
  50%      { transform: translateY(6px); opacity: 1; }
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero__page { min-height: auto; }
  .mascot--hero {
    position: relative;
    right: auto; top: auto;
    width: 46vw;
    margin: 1.5rem 0 1rem auto;
  }
  .mascot__say { left: auto; right: 4%; transform: translateX(0) rotate(-4deg); }
  .mascot__say.show { transform: translateX(0) rotate(-4deg) translateY(-4px); }
  .mascot__say::after { right: auto; left: -30px; transform: rotate(152deg); }
  .scatter { position: relative; left: auto; top: auto; display: inline-block; margin: .5rem .8rem; transform: rotate(var(--r)); }
  .cta { position: relative; bottom: auto; margin-top: 2.5rem; }
  .write:nth-child(2) { align-self: flex-start; text-align: left; }
  .story__mascot {
    position: relative;
    right: auto; top: auto;
    transform: rotate(2deg);
    width: 34vw;
    opacity: .7;
    align-self: center;
    margin-top: 1rem;
  }
  .story { padding-block: clamp(3rem, 7vh, 4.5rem); }

  .wall { gap: 1.6rem 1.4rem; padding-block: clamp(4rem, 10vh, 6rem); }
  .word {
    font-size: calc(clamp(1.3rem, 7vw, 2.1rem) * var(--s, 1));
    text-align: center;
  }
  .word:nth-child(3n),
  .word:nth-child(4n) { margin-top: 0; margin-bottom: 0; }
}

/* ---------- reduced motion: keep the identity, drop the movement ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mascot--hero,
  .scroll-cue { animation: none; }
  .write { clip-path: none !important; transition: none !important; }
  .word,
  .scatter { transition: none; }
}
