/* ------------------------------------------------------------------
   Potato Popup — a half-height character reminder that rises from the
   bottom edge of the page. Drop this file in as-is; everything is
   namespaced under .pp- so it cannot collide with host site styles.
   ------------------------------------------------------------------ */

.pp-popup {
  --pp-width: min(260px, 44vw);   /* on-screen width of the character   */
  --pp-peek: 30%;                 /* how much of him stays below the fold */
  --pp-ink: #14180f;
  --pp-paper: #ffffff;
  --pp-field: #1e3d2b;
  --pp-flash: #e8b22a;
  --pp-edge: rgba(20, 24, 15, 0.14);

  position: fixed;
  bottom: 0;
  left: clamp(10px, 3vw, 40px);
  width: var(--pp-width);
  z-index: 2147483000;
  pointer-events: none; /* only the character + bubble are clickable */
  font-family: inherit;
}

.pp-popup[data-side="right"] {
  left: auto;
  right: clamp(10px, 3vw, 40px);
}

/* --- the character ------------------------------------------------- */

.pp-char {
  display: block;
  width: 100%;
  transform: translateY(100%);
  transition: transform 720ms cubic-bezier(0.22, 1.18, 0.36, 1);
  will-change: transform;
  pointer-events: auto;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

.pp-popup.is-open .pp-char {
  transform: translateY(var(--pp-peek));
}

.pp-char video,
.pp-char img {
  display: block;
  width: 100%;
  height: auto;
  /* the matte is clean, so a soft contact shadow sells the "standing
     in front of the page" read without a visible box */
  filter: drop-shadow(0 10px 14px rgba(20, 24, 15, 0.22));
}

.pp-char:focus-visible {
  outline: 3px solid var(--pp-flash);
  outline-offset: 4px;
  border-radius: 12px;
}

/* --- the speech bubble ---------------------------------------------- */

.pp-bubble {
  position: absolute;
  bottom: 58%;
  left: calc(100% - 26px);
  width: max-content;
  max-width: min(268px, calc(100vw - var(--pp-width) - 48px));
  box-sizing: border-box;
  padding: 14px 16px 14px;
  background: var(--pp-paper);
  color: var(--pp-ink);
  border: 1px solid var(--pp-edge);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 12px 28px rgba(20, 24, 15, 0.18);
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  transform-origin: 0% 100%;
  transition: opacity 260ms ease, transform 420ms cubic-bezier(0.22, 1.3, 0.4, 1);
  pointer-events: auto;
}

.pp-popup[data-side="right"] .pp-bubble {
  left: auto;
  right: calc(100% - 26px);
  border-radius: 16px 16px 4px 16px;
  transform-origin: 100% 100%;
}

.pp-popup.is-open .pp-bubble {
  opacity: 1;
  transform: none;
  transition-delay: 380ms, 380ms;
}

.pp-bubble-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
  text-wrap: balance;
}

.pp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pp-cta,
.pp-later {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 9px 13px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.pp-cta {
  background: var(--pp-field);
  color: #fff;
}

.pp-cta:hover {
  background: #2c5a3c;
}

.pp-later {
  background: transparent;
  color: rgba(20, 24, 15, 0.62);
  border-color: var(--pp-edge);
}

.pp-later:hover {
  color: var(--pp-ink);
}

.pp-cta:focus-visible,
.pp-later:focus-visible,
.pp-close:focus-visible {
  outline: 3px solid var(--pp-flash);
  outline-offset: 2px;
}

/* --- dismiss -------------------------------------------------------- */

.pp-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--pp-edge);
  background: var(--pp-paper);
  color: rgba(20, 24, 15, 0.55);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(20, 24, 15, 0.16);
}

.pp-close:hover {
  color: var(--pp-ink);
}

/* --- narrow screens: bubble sits above his head --------------------- */

@media (max-width: 560px) {
  .pp-popup {
    --pp-width: min(190px, 42vw);
  }

  .pp-bubble {
    left: 0;
    right: auto;
    bottom: calc(100% - var(--pp-peek) - 6px);
    max-width: calc(100vw - 32px);
    width: max-content;
    border-radius: 16px 16px 16px 4px;
    transform-origin: 0% 100%;
  }

  .pp-popup[data-side="right"] .pp-bubble {
    left: auto;
    right: 0;
    border-radius: 16px 16px 4px 16px;
    transform-origin: 100% 100%;
  }
}

/* --- reduced motion: no rise, no loop, just a still fade-in --------- */

@media (prefers-reduced-motion: reduce) {
  .pp-char,
  .pp-bubble {
    transition: opacity 200ms ease;
  }

  .pp-char {
    transform: translateY(var(--pp-peek));
    opacity: 0;
  }

  .pp-popup.is-open .pp-char {
    opacity: 1;
  }

  .pp-popup.is-open .pp-bubble {
    transition-delay: 0ms;
  }
}

/* --- Mashed Potatoes house style (newsprint) ------------------------ */
.pp-popup{--pp-paper:#FAF8F4;--pp-ink:#1E4D2B;--pp-field:#1E4D2B;--pp-flash:#C9A96E;--pp-edge:#1E4D2B}
.pp-bubble{border:3px solid #1E4D2B;border-radius:0;box-shadow:5px 5px 0 0 #C9A96E;padding:16px 18px}
.pp-popup[data-side="right"] .pp-bubble{border-radius:0}
.pp-bubble::before{content:"Extra! Extra!";display:block;font-family:'Barlow Condensed','Oswald','Arial Narrow',sans-serif;font-weight:700;letter-spacing:.24em;text-transform:uppercase;font-size:11px;color:#8B4513;margin-bottom:6px}
.pp-bubble-text{font-family:'Playfair Display',Georgia,serif;font-weight:900;font-size:19px;line-height:1.15;color:#1E4D2B}
.pp-cta,.pp-later{font-family:'Barlow Condensed','Oswald','Arial Narrow',sans-serif;font-weight:700;letter-spacing:.14em;text-transform:uppercase;font-size:12px;border-radius:0;padding:10px 14px}
.pp-cta{background:#C9A96E;color:#1E4D2B;border:3px solid #1E4D2B;box-shadow:3px 3px 0 0 #1E4D2B}
.pp-cta:hover{background:#D6B97A;color:#1E4D2B}
.pp-later{border:2px solid rgba(30,77,43,.35);color:#1E4D2B;background:transparent}
.pp-later:hover{border-color:#1E4D2B}
.pp-close{border:2px solid #1E4D2B;color:#1E4D2B;box-shadow:none;background:#FAF8F4}
@media (max-width:560px){.pp-bubble{border-radius:0}.pp-popup[data-side="right"] .pp-bubble{border-radius:0}}
