/* The site's buttons (designed in lab/goo/; js/site/buttons.js makes them
   live). Load after the page's own stylesheet.

   Primary (.btn--warm, the order page's .big): the main action, one per
   screen. Poured, not stamped: a gooey edge with one small, soft hump at its
   right end, a warm glow that follows the pointer while the edge swells a
   little toward it, and a spring that settles it. Amber on the dark sections, espresso on
   cream; the colours are the palette's. The goo is a blur hardened again by
   an SVG filter (after Ana Tudor's CodePen; the button after Simon
   Goellner's "Gooey button"); until the script has added the filter, the
   button is a plain pill.

   Secondary (.btn--ghost, .btn--ink, and the order page's .ocancel and
   .again): words over a wavy stem. (Small buttons inside a list, like an
   order line's Change and Remove, stay plain real buttons.) Hover or keyboard focus
   draws the stem out, then coffee gathers at its end and drips. */

/* ---------- primary ---------- */
@property --a { syntax: "<percentage>"; initial-value: 0%; inherits: true; }
:is(.btn--warm, .big) {
  --a: 0%; --x: 50; --y: 50;
  --fill: var(--ink); --glow: color-mix(in srgb, var(--fill) 60%, var(--amber)); --label: var(--cream);
  position: relative; isolation: isolate; border: 0; border-radius: 999px;
  background: transparent !important; color: var(--label) !important; box-shadow: none !important;
  font-weight: 600; letter-spacing: 0.01em; transform: none !important;
  scale: 0.97;
  transition: --a 0.5s ease-in-out, scale 1.4s linear(0, 0.002, 0.01 0.9%, 0.038 1.8%, 0.156, 0.312 5.8%, 0.789 11.1%, 1.015 14.2%, 1.096, 1.157, 1.199, 1.224 20.3%, 1.231, 1.231, 1.226, 1.214 24.6%, 1.176 26.9%, 1.057 32.6%, 1.007 35.5%, 0.984, 0.968, 0.956, 0.949 42%, 0.946 44.1%, 0.95 46.5%, 0.998 57.2%, 1.007, 1.011 63.3%, 1.012 68.3%, 0.998 84%, 1);
}
/* amber, like the lamp, where the page is dark */
:is([data-tone="dark"], .hero) .btn--warm { --fill: var(--amber); --glow: color-mix(in srgb, var(--fill) 45%, white); --label: var(--espresso); }
:is(.btn--warm, .big)::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 999px; background: var(--fill); }
.has-goo :is(.btn--warm, .big)::before {
  inset: -22px; padding: 22px; border-radius: 0;
  filter: blur(9px) url(#goo) drop-shadow(0 0.3em 0.5em rgba(20, 10, 4, 0.4));
  background: none;
  background-image: linear-gradient(var(--fill), var(--fill)),
    radial-gradient(24% 40% at calc(var(--x) * 1%) calc(var(--y) * 1%), color-mix(in srgb, var(--glow) var(--a), transparent) 0%, transparent 70%),
    radial-gradient(4% 18% at 94% 50%, var(--fill) 30%, transparent 62%);   /* the hump, at the right end (kept small: Jeni, October 9) */
  background-clip: content-box, border-box, border-box;
}
:is(.btn--warm, .big):not(:disabled):is(:hover, :focus-visible) { --a: 100%; scale: 1; transition-duration: 0.5s, 1s; }
:is(.btn--warm, .big):not(:disabled):active { scale: 0.97; transition-duration: 0.1s; }
:is(.btn--warm, .big):focus-visible { outline: none; }
:is(.btn--warm, .big):focus-visible::after { content: ""; position: absolute; inset: -6px; border-radius: 999px; outline: 2px dashed currentColor; opacity: 0.5; }

/* ---------- secondary ---------- */
.drip {
  position: relative; display: inline-flex; align-items: baseline; gap: 0.35em;
  padding: 0.35rem 1.6rem 0.55rem 0.15rem !important; border: 0 !important; border-radius: 0 !important;
  background: none !important; box-shadow: none !important; transform: none !important;
  text-decoration: none !important; cursor: pointer;
}
.drip:is(.btn--ghost, .btn--ink) { font: italic 500 1.25rem/1.1 var(--serif); letter-spacing: 0.01em; }
.drip.again { display: flex; width: max-content; margin: 1rem auto 0; color: var(--ink); }
.drip .arrow { width: 0.9em; height: 0.9em; align-self: center; }
.drip__stem { position: absolute; left: 0; bottom: 0; width: calc(100% - 1.25rem); height: 7px; overflow: visible; pointer-events: none; }
.drip__stem path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.drip__rest { opacity: 0.3; }
.drip__draw { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.55s cubic-bezier(0.5, 0, 0.2, 1); }
.drip:is(:hover, :focus-visible) .drip__draw { stroke-dashoffset: 0; }
.drip:focus-visible { outline: none; }
.drip__drops { position: absolute; right: calc(1.25rem - 0.42rem); top: calc(100% - 0.42rem); width: 0.8rem; height: 1.45rem; overflow: visible; pointer-events: none; }
.drip__drops path { fill: currentColor; transform-box: fill-box; transform-origin: 50% 0%; scale: 0; opacity: 0; }
.drip:is(:hover, :focus-visible) .drip__drops .d1 { animation: drip1 2.6s 0.5s cubic-bezier(0.4, 0, 0.3, 1) infinite; }
.drip:is(:hover, :focus-visible) .drip__drops .d2 { animation: drip2 2.6s 0.5s cubic-bezier(0.4, 0, 0.3, 1) infinite; }
@keyframes drip1 { 0% { scale: 0; opacity: 1; translate: 0 0; } 25%, 45% { scale: 1; opacity: 1; translate: 0 0; } 75% { scale: 0.9; opacity: 0.9; translate: 0 9px; } 90%, 100% { scale: 0.8; opacity: 0; translate: 0 13px; } }
@keyframes drip2 { 0%, 40% { scale: 0; opacity: 1; translate: 0 0; } 62% { scale: 0.7; opacity: 1; translate: 0 0; } 90% { scale: 0.65; opacity: 0.8; translate: 0 7px; } 100% { scale: 0.6; opacity: 0; translate: 0 10px; } }
/* touch screens have no hover: the stem shows drawn */
@media (hover: none) { .drip .drip__draw { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  :is(.btn--warm, .big) { transition: none; scale: 1; }
  .drip__draw { transition: none; }
  .drip__drops path { animation: none !important; }
  .drip:is(:hover, :focus-visible) .drip__drops .d1 { scale: 1; opacity: 1; }
}
