/* The pour: the dripping headline, the three lines you fill, the hold-to-build button, the drop, the card. */

.pour {
  --charge: 0;
  position: relative;
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 48px) var(--gutter) clamp(28px, 5vw, 56px);
  isolation: isolate;
}
.pour[hidden] {
  display: none;
}
.pour-glow {
  position: absolute;
  /* bleed past the column, but never past the screen edge (the 10px leaves room for a scrollbar) */
  inset: -10% max(-20%, calc((100% - 100vw) / 2 + 10px)) 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 50% at 50% 92%, rgba(210, 255, 31, calc(0.06 + var(--charge) * 0.3)), transparent 70%),
    radial-gradient(30% 40% at 80% 30%, rgba(255, 61, 127, calc(0.05 + var(--charge) * 0.18)), transparent 70%);
  transition: background 0.2s linear;
}

.pour-form {
  display: grid;
  gap: clamp(6px, 1.4vw, 14px);
}

.pour-head {
  margin: 0;
  line-height: 0.8;
}
/* The glow lives on a wrapper, outside the goo: a shadow inside the filter gets thresholded into a blob.
   The goo's blur is in pixels, so it scales with the headline: a 6px blur on an 88px phone headline floods
   the counters and the word melts (it did, on iPhone). Small, medium and large goo keep it crisp and wet. */
.drip-glow {
  display: inline-block;
  filter: drop-shadow(0 0 calc(18px + var(--charge, 0) * 40px) rgba(210, 255, 31, calc(0.18 + var(--charge, 0) * 0.4)));
}
.drip {
  position: relative;
  display: inline-block;
  filter: url(#goo-s);
  padding: 0 0.06em 0.22em;
  margin-left: -0.08em;
}
@media (min-width: 560px) {
  .drip {
    filter: url(#goo-m);
  }
}
@media (min-width: 1100px) {
  .drip {
    filter: url(#goo);
  }
}
.drip-word {
  display: block;
  font-size: clamp(88px, 23vw, 300px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 0.8;
  color: var(--acid);
}
.drops {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.drops i {
  --x: 10%;
  --w: 0.07em;
  --len: 0.32em;
  --dur: 4.8s;
  --delay: 0s;
  position: absolute;
  left: var(--x);
  top: 0.62em;
  width: var(--w);
  height: 0.1em;
  font-size: clamp(88px, 23vw, 300px);
  border-radius: 0 0 999px 999px;
  background: var(--acid);
  transform-origin: top center;
  animation: drip var(--dur) var(--delay) infinite cubic-bezier(0.55, 0, 0.75, 0.4);
}
.drops i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: calc(var(--w) * 1.25);
  height: calc(var(--w) * 1.45);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--acid);
  transform: translate(-50%, -60%);
  animation: drop-fall var(--dur) var(--delay) infinite cubic-bezier(0.55, 0, 1, 0.45);
}
.drops i:nth-child(1) {
  --x: 6.5%;
  --len: 0.26em;
  --dur: 5.2s;
  --delay: -1.1s;
}
.drops i:nth-child(2) {
  --x: 17%;
  --w: 0.06em;
  --len: 0.44em;
  --dur: 6.1s;
  --delay: -3.4s;
}
.drops i:nth-child(3) {
  --x: 29.5%;
  --w: 0.08em;
  --len: 0.3em;
  --dur: 4.4s;
  --delay: -0.4s;
}
.drops i:nth-child(4) {
  --x: 40%;
  --w: 0.05em;
  --len: 0.52em;
  --dur: 7s;
  --delay: -5.1s;
}
.drops i:nth-child(5) {
  --x: 55%;
  --w: 0.07em;
  --len: 0.36em;
  --dur: 5.6s;
  --delay: -2.2s;
}
.drops i:nth-child(6) {
  --x: 63.5%;
  --w: 0.06em;
  --len: 0.22em;
  --dur: 4s;
  --delay: -1.7s;
}
.drops i:nth-child(7) {
  --x: 74%;
  --w: 0.08em;
  --len: 0.46em;
  --dur: 6.6s;
  --delay: -4.2s;
}
.drops i:nth-child(8) {
  --x: 84%;
  --w: 0.05em;
  --len: 0.3em;
  --dur: 5s;
  --delay: -0.9s;
}
.drops i:nth-child(9) {
  --x: 93%;
  --w: 0.07em;
  --len: 0.4em;
  --dur: 5.9s;
  --delay: -3s;
}

@keyframes drip {
  0% {
    height: 0.06em;
  }
  70% {
    height: var(--len);
  }
  78% {
    height: calc(var(--len) * 0.7);
  }
  100% {
    height: 0.06em;
  }
}
@keyframes drop-fall {
  0%,
  68% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(0.6);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -20%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 260%) scale(0.7);
  }
}

.pour.is-charging .drops i {
  animation-duration: calc(var(--dur) * (1 - var(--charge) * 0.75));
}

.pour-line {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  min-width: 0;
}

.pour-target {
  font-size: clamp(40px, 9vw, 112px);
  line-height: 0.95;
  margin-top: -0.06em;
}
.pour-to {
  flex: none;
  font-family: var(--serif);
  font-weight: 500;
  font-size-adjust: 0.47;
  font-style: italic;
  color: var(--bone);
  font-size: 1em;
  line-height: 1;
}
.target-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
#f-target {
  grid-area: 1 / 1;
  width: 100%;
  min-height: 1.05em;
  padding: 0 0 0.06em;
  border: 0;
  border-bottom: 3px solid var(--line-2);
  background: transparent;
  color: var(--bone);
  font-size: 1em;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  resize: none;
  overflow: hidden;
  caret-color: var(--acid);
  transition: border-color 0.25s;
}
#f-target:focus {
  outline: none;
  border-bottom-color: var(--acid);
}
#f-target:focus-visible {
  outline: none;
}
.ghost {
  grid-area: 1 / 1;
  pointer-events: none;
  font-size: 1em;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding-bottom: 0.06em;
}
.ghost::after {
  content: "";
  display: inline-block;
  width: 0.06em;
  height: 0.8em;
  margin-left: 0.04em;
  vertical-align: -0.06em;
  background: var(--acid);
  animation: caret 1s steps(1) infinite;
}
.target-wrap.has-text .ghost,
.target-wrap.is-focused .ghost::after {
  display: none;
}
.target-wrap.has-text .ghost {
  visibility: hidden;
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}

.pour-litany {
  font-size: clamp(19px, 2.8vw, 28px);
  align-items: flex-start;
  margin-top: 0.4em;
}
#f-litany {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0.25em 0;
  border: 0;
  border-bottom: 1px dashed var(--line-2);
  background: transparent;
  color: var(--bone-2);
  font-size: 1em;
  line-height: 1.3;
  resize: none;
  overflow: hidden;
  font-weight: 450;
}
#f-litany::placeholder {
  color: var(--dim);
}
#f-litany:focus {
  outline: none;
  border-bottom-color: var(--bone-2);
}
.count {
  position: absolute;
  right: 0;
  bottom: -1.5em;
  font: 500 12px/1 var(--mono);
  color: var(--dim);
}
.count.is-near {
  color: var(--gold);
}

.pour-bless {
  font-size: clamp(22px, 3.4vw, 38px);
  flex-wrap: wrap;
  margin-top: 0.3em;
  gap: 0.25em 0.3em;
}
.bless-lead {
  flex: none;
  font-family: var(--serif);
  font-weight: 500;
  font-size-adjust: 0.47;
  font-style: italic;
  color: var(--acid);
}
#f-bless {
  flex: 1 1 10em;
  min-width: 0;
  min-height: 44px;
  padding: 0.1em 0;
  border: 0;
  border-bottom: 1px dashed var(--line-2);
  background: transparent;
  color: var(--bone);
  font-family: var(--serif);
  font-weight: 500;
  font-size-adjust: 0.47;
  font-style: italic;
  font-size: 1em;
}
#f-bless::placeholder {
  color: var(--dim);
}
#f-bless:focus {
  outline: none;
  border-bottom-color: var(--acid);
}

.pour-error {
  margin: 10px 0 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 60ch;
  padding: 14px 16px;
  border-radius: var(--r-2);
  border: 1px solid rgba(255, 90, 79, 0.45);
  background: rgba(255, 90, 79, 0.08);
  color: #ffd2ce;
  font-size: 16px;
  animation: snack-in 0.35s var(--ease-spring);
}
.pour-error.is-care {
  border-color: rgba(143, 216, 255, 0.45);
  background: rgba(143, 216, 255, 0.08);
  color: #d7f1ff;
}
.pour-error a {
  color: inherit;
  font-weight: 700;
}

/* ---------- Hold to build, let go to drop ---------- */

.pour-raise {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: clamp(18px, 3vw, 30px);
}
.raise {
  --size: clamp(112px, 22vw, 140px);
  position: relative;
  flex: none;
  width: var(--size);
  height: var(--size);
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: radial-gradient(circle at 35% 30%, #efff9a, var(--acid) 45%, var(--acid-2));
  color: var(--acid-ink);
  box-shadow:
    0 0 0 6px rgba(210, 255, 31, 0.1),
    0 0 calc(30px + var(--charge, 0) * 90px) rgba(210, 255, 31, calc(0.25 + var(--charge, 0) * 0.5)),
    inset 0 -8px 20px rgba(0, 0, 0, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transform: scale(calc(1 + var(--charge, 0) * 0.08));
  transition:
    transform 0.12s linear,
    box-shadow 0.12s linear;
}
.raise:focus-visible {
  outline: 3px solid var(--bone);
  outline-offset: 6px;
  border-radius: 50%;
}
.raise.is-holding {
  animation: tremble 0.09s linear infinite;
}
.raise.is-busy {
  pointer-events: none;
}
.raise-ring {
  position: absolute;
  inset: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  transform: rotate(-90deg);
  overflow: visible;
}
.ring-track {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 3;
}
.ring-fill {
  fill: none;
  stroke: var(--bone);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: calc(339.3 * (1 - var(--charge, 0)));
  filter: drop-shadow(0 0 6px rgba(244, 241, 234, 0.6));
}
.raise-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: translateY(calc(-8px - var(--charge, 0) * 14px)) rotate(calc(var(--charge, 0) * -8deg));
  transition: transform 0.12s linear;
}
.raise-face .icon {
  width: 46%;
  height: 46%;
}
.raise-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  font: 800 13px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.raise-hint {
  margin: 0;
  display: grid;
  gap: 6px;
  color: var(--mute);
  font: 500 12px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.raise-hint span {
  display: block;
  white-space: nowrap;
}
.raise-hint b {
  color: var(--bone);
  font-weight: 700;
}

@keyframes tremble {
  0% {
    translate: 0 0;
  }
  25% {
    translate: calc(var(--charge, 0) * 2px) calc(var(--charge, 0) * -1.5px);
  }
  50% {
    translate: calc(var(--charge, 0) * -2px) calc(var(--charge, 0) * 1px);
  }
  75% {
    translate: calc(var(--charge, 0) * 1.5px) calc(var(--charge, 0) * 2px);
  }
  100% {
    translate: 0 0;
  }
}

.pour-stats {
  margin: 26px 0 0;
  min-height: 1.4em;
  font: 500 13px/1.4 var(--mono);
  color: var(--mute);
  letter-spacing: 0.02em;
}
.pour-stats b {
  color: var(--bone);
  font-weight: 700;
}

/* ---------- The drop ---------- */

.is-quaking #pour,
.is-quaking #view {
  animation: quake 0.62s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes quake {
  0% {
    transform: translate(0, 0) scale(1.012);
  }
  8% {
    transform: translate(-9px, 6px) scale(1.01);
  }
  16% {
    transform: translate(8px, -7px);
  }
  26% {
    transform: translate(-6px, 4px);
  }
  38% {
    transform: translate(4px, -3px);
  }
  52% {
    transform: translate(-2px, 2px);
  }
  70% {
    transform: translate(1px, -1px);
  }
  100% {
    transform: none;
  }
}
.is-scratch #pour-form {
  animation: no 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes no {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-8px);
  }
  40%,
  60% {
    transform: translateX(8px);
  }
}

.shock {
  --sx: 50vw;
  --sy: 70vh;
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
}
.shock.is-on {
  animation: shock 0.9s var(--ease-out);
  background:
    radial-gradient(
      circle at var(--sx) var(--sy),
      transparent 0,
      transparent var(--r, 0px),
      rgba(210, 255, 31, 0.55) calc(var(--r, 0px) + 2px),
      transparent calc(var(--r, 0px) + 40px)
    ),
    radial-gradient(circle at var(--sx) var(--sy), rgba(210, 255, 31, 0.22), transparent 55%);
}
@property --r {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@keyframes shock {
  0% {
    opacity: 1;
    --r: 0px;
  }
  100% {
    opacity: 0;
    --r: 140vmax;
  }
}

/* ---------- The card sheet ---------- */

.card-sheet .sheet-body {
  gap: 16px;
}
.card-frame {
  position: relative;
  margin: 0 auto;
  width: min(100%, calc(54dvh * 0.8));
  aspect-ratio: 1080 / 1350;
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--ink);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px var(--line-2);
  animation: card-slam 0.7s var(--ease-spring);
}
.card-frame img,
.card-frame canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-frame .card-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--mute);
}
@keyframes card-slam {
  0% {
    transform: translateY(-40px) rotate(-6deg) scale(1.12);
    opacity: 0;
  }
  55% {
    transform: translateY(4px) rotate(1deg) scale(0.99);
    opacity: 1;
  }
  100% {
    transform: none;
  }
}
.card-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  color: var(--bone-2);
}
.card-status .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 12px var(--acid-glow);
  flex: none;
}
.card-status.is-draft .dot {
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

@media (max-width: 760px) {
  .pour-raise {
    gap: 16px;
  }
  .raise-hint {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drops i,
  .drops i::after {
    animation: none;
    height: var(--len);
  }
  .drops i::after {
    opacity: 0;
  }
  .raise.is-holding {
    animation: none;
  }
}
