:root {
  --ink: #171512;
  --paper: #fff3d6;
  --paper-shadow: #e5b84f;
  --sky: #78d5f0;
  --sky-deep: #2b92c2;
  --brick: #c45a3d;
  --brick-dark: #853623;
  --cream: #ffe2a5;
  --yellow: #ffd339;
  --red: #f24b37;
  --blue: #2f6df6;
  --green: #21a66f;
  --pink: #fa6fa8;
  --black: #14100d;
  --white: #fffaf0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 242, 126, 0.45) 0 12%, transparent 13%),
    linear-gradient(135deg, #ec5b42 0 18%, #ffd339 18% 36%, #4cbf8a 36% 54%, #53b9e8 54% 72%, #f47db2 72%);
  font-family: "Trebuchet MS", "Arial Black", Impact, system-ui, sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.comic-page {
  min-height: 100vh;
  padding: 20px;
  display: grid;
  place-items: center;
}

.hero-panel {
  position: relative;
  width: min(1180px, 100%);
  min-height: 720px;
  overflow: hidden;
  border: 6px solid var(--ink);
  box-shadow: 12px 12px 0 var(--ink);
  background:
    radial-gradient(circle, rgba(20, 16, 13, 0.16) 1.3px, transparent 1.5px) 0 0 / 10px 10px,
    linear-gradient(180deg, var(--sky) 0%, #aeeaf7 42%, #fff1b9 100%);
  cursor: pointer;
  isolation: isolate;
  touch-action: manipulation;
  user-select: none;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(23, 21, 18, 0.8);
  pointer-events: none;
  z-index: 20;
}

.sunburst {
  position: absolute;
  inset: -24%;
  background:
    repeating-conic-gradient(
      from -12deg,
      rgba(255, 243, 214, 0.48) 0deg 8deg,
      rgba(255, 211, 57, 0.16) 8deg 16deg
    );
  transform-origin: 50% 42%;
  animation: slowSpin 24s linear infinite;
  z-index: -1;
}

.masthead {
  position: absolute;
  top: 34px;
  left: 38px;
  max-width: 510px;
  transform: rotate(-2deg);
  z-index: 10;
}

.issue-tag,
.subtitle,
.caption,
.status,
.detail-label {
  text-transform: uppercase;
}

.issue-tag {
  display: inline-block;
  margin: 0 0 8px;
  padding: 6px 12px;
  border: 4px solid var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
}

h1 {
  margin: 0;
  color: var(--red);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 5rem;
  line-height: 0.88;
  letter-spacing: 0;
  text-shadow:
    4px 4px 0 var(--white),
    8px 8px 0 var(--ink);
}

.subtitle {
  display: inline-block;
  margin: 14px 0 0 16px;
  padding: 9px 16px;
  border: 4px solid var(--ink);
  background: var(--blue);
  color: var(--white);
  box-shadow: 5px 5px 0 var(--ink);
  font-size: 1.15rem;
  font-weight: 900;
}

.details-panel {
  position: absolute;
  top: 36px;
  right: 38px;
  width: 330px;
  padding: 16px;
  display: grid;
  gap: 10px;
  border: 5px solid var(--ink);
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(2deg);
  z-index: 12;
}

.details-panel::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -31px;
  width: 34px;
  height: 34px;
  background: var(--paper);
  border-right: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
  transform: rotate(45deg);
}

.detail {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 3px dashed rgba(23, 21, 18, 0.42);
}

.detail:last-child {
  border-bottom: 0;
}

.detail-label {
  display: inline-block;
  padding: 3px 5px;
  border: 3px solid var(--ink);
  background: var(--green);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 900;
  text-align: center;
}

.detail strong {
  font-size: 1rem;
  line-height: 1.15;
}

.caption {
  position: absolute;
  max-width: 220px;
  padding: 11px 13px;
  border: 4px solid var(--ink);
  background: var(--white);
  box-shadow: 6px 6px 0 var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.1;
  z-index: 12;
}

.caption-left {
  left: 56px;
  bottom: 96px;
  transform: rotate(3deg);
}

.caption-right {
  right: 78px;
  bottom: 176px;
  transform: rotate(-3deg);
}

.status {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: min(560px, calc(100% - 72px));
  margin: 0;
  padding: 10px 14px;
  border: 4px solid var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 900;
  z-index: 18;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 108px;
  height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  opacity: 0.78;
  z-index: 1;
}

.skyline span {
  width: 88px;
  height: 120px;
  border: 4px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 46%, rgba(23, 21, 18, 0.22) 47% 53%, transparent 54%),
    repeating-linear-gradient(180deg, #7cc7dc 0 20px, #fff3b9 20px 25px);
  box-shadow: 5px 5px 0 rgba(23, 21, 18, 0.55);
}

.skyline span:nth-child(2) {
  height: 166px;
  width: 110px;
}

.skyline span:nth-child(3) {
  height: 94px;
  width: 138px;
}

.skyline span:nth-child(4) {
  height: 190px;
  width: 86px;
}

.skyline span:nth-child(5) {
  height: 136px;
  width: 128px;
}

.building {
  position: absolute;
  left: 50%;
  bottom: 40px;
  width: min(760px, 78%);
  height: 350px;
  transform: translateX(-50%);
  z-index: 4;
}

.building-cornice {
  position: absolute;
  left: -24px;
  right: -24px;
  top: 30px;
  height: 36px;
  border: 5px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, var(--cream) 0 28px, #d89256 28px 37px);
  box-shadow: 8px 8px 0 var(--ink);
}

.building-face {
  position: absolute;
  left: 0;
  right: 0;
  top: 63px;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px 28px;
  padding: 28px 48px 34px;
  border: 5px solid var(--ink);
  border-top: 0;
  background:
    linear-gradient(90deg, rgba(23, 21, 18, 0.16) 0 4px, transparent 4px 100%) 0 0 / 56px 100%,
    repeating-linear-gradient(180deg, var(--brick) 0 24px, var(--brick-dark) 24px 28px);
  box-shadow: 10px 10px 0 var(--ink);
}

.window {
  border: 4px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 46%, var(--ink) 46% 54%, transparent 54%),
    linear-gradient(180deg, #fff7b6 0 48%, var(--ink) 48% 56%, #7fd6f1 56%);
  box-shadow: inset 4px 4px 0 rgba(255, 255, 255, 0.45);
  min-height: 42px;
}

.roof {
  position: absolute;
  left: 50%;
  bottom: 365px;
  width: min(860px, 86%);
  height: 130px;
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  z-index: 8;
}

.roof::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50px;
  border: 5px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, #5b5a57 0 34px, #706f6a 34px 68px),
    #67645f;
  box-shadow: 8px 8px 0 var(--ink);
}

.roof::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 45px;
  height: 20px;
  border: 4px solid var(--ink);
  background: #b5b0a3;
}

.roof-crack {
  position: absolute;
  left: 49%;
  bottom: 13px;
  width: 24px;
  height: 54px;
  opacity: 0;
  z-index: 20;
}

.roof-crack::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  clip-path: polygon(44% 0, 58% 0, 46% 23%, 65% 24%, 38% 54%, 57% 55%, 29% 100%, 36% 62%, 16% 62%, 39% 31%, 24% 31%);
}

.dj-booth {
  position: absolute;
  left: 50%;
  bottom: 62px;
  width: 154px;
  height: 96px;
  transform: translateX(-50%);
  z-index: 35;
}

.dj-person {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: 60px;
  height: 66px;
  transform: translateX(-50%);
}

.dj-head {
  position: absolute;
  left: 15px;
  top: 6px;
  width: 30px;
  height: 32px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: #d89b62;
}

.dj-head::before,
.dj-head::after {
  content: "";
  position: absolute;
  top: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
}

.dj-head::before {
  left: 8px;
}

.dj-head::after {
  right: 8px;
}

.dj-hair {
  position: absolute;
  left: 10px;
  top: 0;
  width: 40px;
  height: 24px;
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 22px 22px 8px 8px;
  background: var(--black);
}

.dj-body {
  position: absolute;
  left: 10px;
  bottom: 0;
  width: 40px;
  height: 34px;
  border: 4px solid var(--ink);
  border-radius: 18px 18px 4px 4px;
  background: var(--pink);
}

.turntable {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 5px solid var(--ink);
  background: var(--blue);
  color: var(--white);
  box-shadow: 6px 6px 0 var(--ink);
}

.turntable span {
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--yellow) 0 16%, var(--ink) 17% 26%, var(--white) 27% 100%);
}

.turntable strong {
  font-size: 1.1rem;
}

.crowd {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 54px;
  height: 92px;
  z-index: 30;
}

.person {
  position: absolute;
  left: var(--x);
  bottom: var(--y);
  width: var(--size);
  height: var(--height);
  transform: translateX(-50%) rotate(var(--tilt));
  transform-origin: 50% 100%;
  transition: transform 160ms ease-out;
  z-index: var(--layer);
}

.person::before {
  content: "";
  position: absolute;
  left: 22%;
  top: 0;
  width: 56%;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--skin);
}

.person::after {
  content: "";
  position: absolute;
  left: 10%;
  bottom: 18%;
  width: 80%;
  height: 52%;
  border: 3px solid var(--ink);
  border-radius: 45% 45% 6px 6px;
  background: var(--shirt);
}

.person .arm,
.person .leg {
  position: absolute;
  display: block;
  border: 3px solid var(--ink);
  background: var(--shirt);
}

.person .arm {
  top: 42%;
  width: 12%;
  height: 42%;
  border-radius: 999px;
}

.person .arm.left {
  left: -2%;
  transform: rotate(34deg);
}

.person .arm.right {
  right: -2%;
  transform: rotate(-34deg);
}

.person .leg {
  bottom: 0;
  width: 16%;
  height: 25%;
  border-radius: 999px;
  background: #263247;
}

.person .leg.left {
  left: 26%;
}

.person .leg.right {
  right: 26%;
}

.jumping .person {
  animation: guestJump 360ms cubic-bezier(0.17, 0.84, 0.44, 1);
  animation-delay: var(--delay);
}

.jumping .dj-booth {
  animation: djBounce 360ms cubic-bezier(0.17, 0.84, 0.44, 1);
}

.jumping .sound-pop {
  animation: popFlash 420ms ease-out;
}

.sound {
  position: absolute;
  border: 5px solid var(--ink);
  color: var(--ink);
  font-family: Impact, "Arial Black", sans-serif;
  line-height: 1;
  pointer-events: none;
  z-index: 25;
}

.sound-pop {
  top: 245px;
  left: 48%;
  padding: 12px 16px;
  background: var(--yellow);
  box-shadow: 6px 6px 0 var(--ink);
  font-size: 2.2rem;
  opacity: 0;
  transform: rotate(-8deg) scale(0.4);
}

.sound-boom {
  top: 280px;
  left: 50%;
  padding: 16px 22px;
  background: var(--red);
  color: var(--white);
  box-shadow: 8px 8px 0 var(--ink);
  font-size: 4.2rem;
  opacity: 0;
  transform: translateX(-50%) rotate(5deg) scale(0.2);
}

.collapsed .roof {
  animation: roofCollapse 1300ms ease-in forwards;
}

.collapsed .roof::before {
  background:
    linear-gradient(100deg, transparent 0 48%, var(--ink) 48% 52%, transparent 52%),
    repeating-linear-gradient(90deg, #5b5a57 0 34px, #706f6a 34px 68px);
}

.collapsed .roof-crack {
  opacity: 1;
  animation: crackPulse 500ms ease-out;
}

.collapsed .building {
  animation: buildingShake 600ms ease-out;
}

.collapsed .person {
  animation: partyFall 1250ms cubic-bezier(0.77, 0, 0.18, 1) forwards;
  animation-delay: var(--delay);
}

.collapsed .dj-booth {
  animation: djFall 1200ms cubic-bezier(0.77, 0, 0.18, 1) forwards;
}

.collapsed .sound-boom {
  animation: boomFlash 1100ms ease-out forwards;
}

@keyframes slowSpin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes guestJump {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) rotate(var(--tilt));
  }
  48% {
    transform: translateX(-50%) translateY(var(--jump-y)) rotate(var(--tilt-opposite));
  }
}

@keyframes djBounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-18px);
  }
}

@keyframes popFlash {
  0% {
    opacity: 0;
    transform: rotate(-8deg) scale(0.4);
  }
  18%,
  72% {
    opacity: 1;
    transform: rotate(-8deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: rotate(-8deg) scale(1.25);
  }
}

@keyframes roofCollapse {
  0% {
    transform: translateX(-50%) translateY(0) rotate(0deg);
  }
  18% {
    transform: translateX(-50%) translateY(7px) rotate(-1deg);
  }
  42% {
    transform: translateX(-50%) translateY(22px) rotate(3deg);
  }
  100% {
    transform: translateX(-50%) translateY(260px) rotate(-9deg);
  }
}

@keyframes partyFall {
  0% {
    transform: translateX(-50%) translateY(0) rotate(var(--tilt));
    opacity: 1;
  }
  38% {
    transform: translateX(-50%) translateY(-12px) rotate(16deg);
  }
  100% {
    transform: translateX(-50%) translateY(260px) rotate(var(--spin));
    opacity: 0;
  }
}

@keyframes djFall {
  0% {
    transform: translateX(-50%) translateY(0) rotate(0);
  }
  100% {
    transform: translateX(-50%) translateY(238px) rotate(18deg);
  }
}

@keyframes boomFlash {
  0% {
    opacity: 0;
    transform: translateX(-50%) rotate(5deg) scale(0.2);
  }
  18%,
  70% {
    opacity: 1;
    transform: translateX(-50%) rotate(5deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) rotate(5deg) scale(1.25);
  }
}

@keyframes crackPulse {
  0% {
    transform: scaleY(0.2);
  }
  100% {
    transform: scaleY(1);
  }
}

@keyframes buildingShake {
  0%,
  100% {
    transform: translateX(-50%);
  }
  20% {
    transform: translateX(calc(-50% - 8px));
  }
  40% {
    transform: translateX(calc(-50% + 8px));
  }
  60% {
    transform: translateX(calc(-50% - 5px));
  }
  80% {
    transform: translateX(calc(-50% + 5px));
  }
}

@media (max-width: 860px) {
  .comic-page {
    padding: 12px;
  }

  .hero-panel {
    min-height: 900px;
    box-shadow: 7px 7px 0 var(--ink);
  }

  .masthead {
    top: 28px;
    left: 28px;
    right: 24px;
    max-width: none;
  }

  h1 {
    font-size: 3.7rem;
  }

  .subtitle {
    margin-left: 8px;
    font-size: 1rem;
  }

  .details-panel {
    top: 206px;
    left: 26px;
    right: auto;
    width: min(330px, calc(100% - 52px));
    transform: rotate(-1deg);
  }

  .caption-left {
    display: none;
  }

  .caption-right {
    right: 34px;
    bottom: 112px;
    max-width: 190px;
    font-size: 0.82rem;
  }

  .building {
    width: 88%;
    height: 300px;
    bottom: 44px;
  }

  .building-face {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 22px 28px;
  }

  .building-face .window:nth-child(n + 10) {
    display: none;
  }

  .roof {
    width: 94%;
    bottom: 290px;
  }

  .crowd {
    left: 0;
    right: 0;
  }

  .dj-booth {
    width: 132px;
  }

  .sound-pop {
    top: 390px;
    left: 28%;
  }

  .sound-boom {
    top: 372px;
    font-size: 3rem;
  }
}

@media (max-width: 520px) {
  .comic-page {
    min-height: 100svh;
    padding: 8px;
  }

  .hero-panel {
    min-height: 980px;
    border-width: 4px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .hero-panel::before {
    inset: 8px;
    border-width: 2px;
  }

  .masthead {
    top: 24px;
    left: 22px;
    right: 18px;
  }

  h1 {
    font-size: 2.7rem;
    text-shadow:
      3px 3px 0 var(--white),
      6px 6px 0 var(--ink);
  }

  .issue-tag {
    max-width: calc(100% - 18px);
    font-size: 0.74rem;
    line-height: 1.05;
  }

  .subtitle {
    margin-top: 12px;
    padding: 8px 11px;
    font-size: 0.88rem;
  }

  .details-panel {
    top: 184px;
    left: 18px;
    width: calc(100% - 42px);
    padding: 12px;
    border-width: 4px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .detail {
    grid-template-columns: 64px 1fr;
    gap: 7px;
    padding: 6px 0;
  }

  .detail strong {
    font-size: 0.86rem;
  }

  .building {
    width: 110%;
    height: 292px;
    bottom: 70px;
  }

  .building-cornice {
    left: -10px;
    right: -10px;
  }

  .building-face {
    gap: 12px;
    padding: 20px 22px 28px;
  }

  .roof {
    width: 110%;
    bottom: 360px;
  }

  .crowd {
    transform: scale(0.82);
    transform-origin: 50% 100%;
  }

  .dj-booth {
    transform: translateX(-50%) scale(0.86);
    transform-origin: 50% 100%;
  }

  .caption-right {
    right: 16px;
    bottom: 116px;
    max-width: 160px;
    padding: 9px 10px;
    border-width: 3px;
    box-shadow: 4px 4px 0 var(--ink);
    font-size: 0.72rem;
  }

  .status {
    bottom: 16px;
    width: calc(100% - 32px);
    padding: 9px 10px;
    border-width: 3px;
    box-shadow: 4px 4px 0 var(--ink);
    font-size: 0.7rem;
    line-height: 1.08;
  }

  .sound-pop {
    top: 420px;
    left: 18%;
    font-size: 1.7rem;
  }

  .sound-boom {
    top: 420px;
    font-size: 2.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
