fpa-poppy {
  position: relative;
  display: block;
  /* The extra space at the right accommodates the leaning blossom. */
  aspect-ratio: 1048.8 / 1718;
  pointer-events: none;
  -webkit-user-select: none; user-select: none;
}

fpa-poppy::before,
fpa-poppy > canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 86.956522%;
  height: 100%;
  pointer-events: none;
  transform-origin: 50% 57%;
  transform: rotate(12deg);
}

fpa-poppy::before {
  content: "";
  background: url("./painted-poppy.webp") center / contain no-repeat;
}

fpa-poppy > canvas {
  visibility: hidden;
}

fpa-poppy[data-rendered] > canvas {
  visibility: visible;
}

fpa-poppy[data-rendered]::before {
  visibility: hidden;
  animation: none;
}

@media (prefers-reduced-motion: no-preference) {
  fpa-poppy:not([data-rendered])::before {
    animation: fpa-poppy-sway 4.1s ease-in-out infinite alternate;
  }
}

@keyframes fpa-poppy-sway {
  from { transform: perspective(65rem) translateY(1%) rotateZ(8deg) rotateY(-12deg); }
  to { transform: perspective(65rem) translateY(-2%) rotateZ(16deg) rotateY(14deg); }
}

@media print {
  fpa-poppy[data-rendered] > canvas { visibility: hidden; }
  fpa-poppy[data-rendered]::before { visibility: visible; animation: none; }
}

.mag-title-wrap.with-poppy {
  --poppy-width: clamp(112px, 15.7vw, 196px);
  display: grid;
  grid-template-columns: minmax(0, max-content) var(--poppy-width);
  width: fit-content;
  max-width: 100%;
  gap: clamp(9px, 1.8vw, 22px);
  align-items: center;
}

.mag-title-wrap.with-poppy > .mag-title { grid-area: 1 / 1; min-width: 0; }
.mag-title-wrap.with-poppy > .painted-poppy {
  grid-area: 1 / 2;
  width: var(--poppy-width);
  justify-self: end;
}

@media (max-width: 700px) {
  .mag-title-wrap.with-poppy { --poppy-width: clamp(92px, 21.8vw, 137px); }
}

.mag-title-wrap.with-poppy[data-flow] {
  display:block;
  touch-action:pan-y;
  overflow-anchor:none;
}
.mag-title-wrap.with-poppy[data-flow] > .mag-title,
.mag-title-wrap.with-poppy[data-flow] > .mag-title > a {
  display:block;
  width:100%;
  height:100%;
}
.mag-title-wrap.with-poppy[data-flow] > .mag-title { position:absolute; inset:0; }
.mag-title-wrap.with-poppy[data-flow] .poppy-words {
  position:absolute; inset:0; display:block; pointer-events:none; text-align:left;
}
.mag-title-wrap.with-poppy[data-flow] .poppy-word {
  display:block; position:absolute; top:0; left:0; width:max-content;
  white-space:pre; margin:0; padding:0; line-height:inherit; transform-origin:top left;
}
.poppy-readable-title {
  position:absolute!important; width:1px!important; height:1px!important; padding:0!important;
  margin:-1px!important; white-space:nowrap; overflow:hidden; clip-path:inset(50%); border:0;
}
.mag-title-wrap.with-poppy[data-flow] > .painted-poppy {
  position:absolute; top:0; left:0; z-index:2;
  touch-action:none; pointer-events:auto; cursor:grab; -webkit-tap-highlight-color:transparent;
  -webkit-touch-callout:none; -webkit-user-drag:none; -webkit-user-select:none; user-select:none;
  outline:none; box-shadow:none; background-color:transparent;
}
.mag-title-wrap.with-poppy[data-flow] > .painted-poppy[data-dragging] {cursor:grabbing;will-change:transform}
.painted-poppy[data-dragging]::before {animation-play-state:paused}
.mag-title-wrap.with-poppy[data-flow] > .painted-poppy:focus-visible:not([data-pointer-used]):not([data-dragging]) {
  outline:2px solid #002fa7;outline-offset:3px;border-radius:4px;
}
@media (prefers-reduced-motion: reduce) {
  .mag-title-wrap.with-poppy > .painted-poppy::before {animation:none;transform:rotate(12deg);}
}
.painted-poppy .poppy-hint{position:absolute;z-index:4;bottom:2%;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:3px;white-space:nowrap;pointer-events:none;color:#37332e;background:rgba(255,255,255,.92);border-radius:8px;padding:2px 4px;font:500 10px/1.15 Arial,sans-serif;letter-spacing:0}.poppy-hint svg{display:block;width:12px;height:12px;flex:none}
