/* The hero painting, its rising steam, and the bulletin ticker below it. */

.hero {
  --focus: var(--label-ink);
  --steam-left: 34.6%;
  --steam-width: 12.5%;
  position: relative;
  background-color: var(--wall);
  background-image: var(--grain);
  color: var(--label-ink);
}

/* The stage is the visible window. The canvas inside it is always exactly the painting's
   shape and at least as big as the stage, so anything placed on the canvas in percentages
   (the steam) stays glued to the same spot of the painting at every screen size. */
.hero__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 6 / 5;
  container-type: size;
}

.hero__canvas {
  position: absolute;
  top: 50%;
  right: 0;
  width: 100%;
  width: max(100cqw, 100cqh * 1064 / 887);
  aspect-ratio: 1064 / 887;
  translate: 0 -50%;
}

.hero__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Steam off the rice. Three strokes travel up their own curves and fade. */
.hero__steam {
  position: absolute;
  top: 42%;
  left: var(--steam-left);
  width: var(--steam-width);
  height: auto;
  overflow: visible;
  filter: blur(2px);
  pointer-events: none;
}

.hero__steam path {
  fill: none;
  stroke: #fff6e2;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 0.5 1;
  stroke-dashoffset: 0.5;
  opacity: 0;
  animation: steam 6.6s linear infinite;
}

.hero__steam path:nth-child(2) {
  stroke-width: 11;
  animation-delay: -2.2s;
}

.hero__steam path:nth-child(3) {
  stroke-width: 8;
  animation-delay: -4.4s;
}

@keyframes steam {
  0% {
    stroke-dashoffset: 0.5;
    opacity: 0;
  }

  18% {
    opacity: 0.85;
  }

  60% {
    opacity: 0.5;
  }

  100% {
    stroke-dashoffset: -1;
    opacity: 0;
  }
}

.hero__copy {
  padding: clamp(1.75rem, 6vw, 3rem) var(--gutter) clamp(2.25rem, 7vw, 3.5rem);
}

.hero__title {
  font-size: clamp(3.75rem, 21.5vw, 10rem);
}

/* The headline comes up line by line once, when the page opens. */
.hero__title .rise {
  display: block;
  overflow: hidden;
  margin-block: -0.04em;
  padding-block: 0.04em;
}

.hero__title .rise > span {
  display: block;
  white-space: nowrap;
  animation: rise 0.8s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.hero__title .rise:nth-child(2) > span {
  animation-delay: 0.09s;
}

@keyframes rise {
  from {
    translate: 0 110%;
  }
}

.hero__lede,
.hero__actions {
  animation: surface 0.6s ease 0.5s both;
}

@keyframes surface {
  from {
    opacity: 0;
    translate: 0 0.6rem;
  }
}

.hero__lede {
  max-width: 34em;
  margin-top: 1.25rem;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.45;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 1.75rem;
}

@media (min-width: 36em) and (max-width: 59.99em) {
  .hero__stage {
    aspect-ratio: 16 / 10;
  }

  .hero__title {
    font-size: clamp(6rem, 19vw, 10rem);
  }
}

/* From here up the full painting is used and the copy sits on its bare wall. */
@media (min-width: 60em) {
  .hero {
    --steam-left: 60.7%;
    --steam-width: 7.5%;
    display: grid;
    height: min(50vw, 100svh - 4.4rem);
    min-height: 30rem;
  }

  .hero__stage,
  .hero__copy {
    grid-area: 1 / 1;
  }

  .hero__stage {
    aspect-ratio: auto;
    min-height: 0;
  }

  .hero__canvas {
    width: max(100cqw, 200cqh);
    aspect-ratio: 2 / 1;
  }

  .hero__steam {
    filter: blur(3px);
  }

  .hero__copy {
    z-index: 1;
    align-self: center;
    width: min(31vw, 38rem);
    margin-left: var(--gutter);
    padding: 0;
  }

  .hero__title {
    font-size: clamp(3.5rem, 7vw, 9rem);
  }

  .hero__lede {
    max-width: min(27vw, 32rem);
    font-size: clamp(0.95rem, 1.22vw, 1.3rem);
  }
}

/* ---------- Bulletins from the Ministry ---------- */

.ticker {
  overflow: hidden;
  background: var(--label-ink);
  color: var(--on-colour);
}

.ticker__track {
  display: flex;
  width: max-content;
  animation: ticker 75s linear infinite;
}

.ticker:hover .ticker__track {
  animation-play-state: paused;
}

.ticker__list {
  display: flex;
  flex: none;
}

.ticker__list li {
  display: flex;
  align-items: center;
  padding-block: 0.8rem;
  font-size: 1.0625rem;
  font-weight: 800;
  font-stretch: 70%;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.ticker__list li::after {
  content: "";
  flex: none;
  width: 1.9em;
  height: 0.85em;
  margin-inline: 1.6rem;
  background: var(--label-yellow);
  -webkit-mask: var(--fish) center / contain no-repeat;
  mask: var(--fish) center / contain no-repeat;
}

/* Three identical lists sit side by side; moving by one list's width loops without a seam. */
@keyframes ticker {
  to {
    translate: -33.3333% 0;
  }
}

/* Reduced motion: the headline and copy fade in instead of rising, the ticker holds still,
   and the steam is a still wisp. */
@media (prefers-reduced-motion: reduce) {
  .hero__title .rise > span,
  .hero__lede,
  .hero__actions {
    animation-name: appear;
  }

  .hero__steam path {
    animation: none;
    stroke-dashoffset: -0.2;
    opacity: 0.4;
  }

  .ticker__track {
    animation: none;
  }
}
