@import url("../tokens/fonts.css");

/* ==========================================================================
   Gumdrop — squishy clay & gummy candy
   Reads every colour, radius, spacing, depth and shadow from tokens.css.
   Motion lives here (tokens.json has no motion family).
   ========================================================================== */

:root {
  /* springs and easings */
  --gd-spring: cubic-bezier(.34, 1.56, .64, 1);      /* release, puff, pop: ~10% overshoot */
  --gd-spring-soft: cubic-bezier(.25, 1.25, .5, 1);  /* travel: knobs, pucks, tilts: ~5% overshoot */
  --gd-squash: cubic-bezier(.3, .7, .4, 1);          /* press-in: fast, no overshoot */
  --gd-settle: cubic-bezier(.2, .8, .2, 1);          /* exits and fades */
  /* durations */
  --gd-t-press: 120ms;
  --gd-t-quick: 180ms;
  --gd-t-spring: 380ms;
  --gd-t-travel: 420ms;
  --gd-t-settle: 450ms;
  color-scheme: light;
}
[data-theme="dark"] { color-scheme: dark; --gd-knob: color-mix(in oklab, var(--clay) 66%, var(--ink-soft)); }

body {
  margin: 0;
  background: var(--table);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- preview / layout helpers ---------- */
.gd-stage { box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); padding: var(--space-6); }
.gd-stage--top { align-items: flex-start; }
.gd-col { display: flex; flex-direction: column; gap: var(--space-3); }
.gd-row-flex { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.gd-spacer { flex: 1; }
.gd-overline { font-family: var(--font-body); font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.gd-h { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 28px; color: var(--ink); }
.gd-t { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 38px; letter-spacing: -.01em; color: var(--ink); }
.gd-d { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 56px; line-height: 56px; letter-spacing: -.015em; color: var(--ink); }
.gd-p { margin: 0; font-size: 16px; line-height: 24px; }
.gd-sm { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-soft); }
.gd-num { font-family: var(--font-display); font-weight: 600; font-stretch: 112%; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.gd-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gd-icon { width: 20px; height: 20px; flex: none; display: block; }
.gd-icon path, .gd-icon circle, .gd-icon rect, .gd-icon line, .gd-icon polyline { vector-effect: non-scaling-stroke; }

/* ==========================================================================
   The slab: face + solid base. Pressables move only their FACE (transform),
   the base stays on the table, so a press is a real sink — no shadow anims.
   ========================================================================== */
.gd-btn, .gd-iconbtn, .gd-chip {
  --_fill: var(--clay);
  --_ink: var(--ink);
  --_base: color-mix(in oklab, var(--_fill) 72%, var(--shade));
  --_d: var(--depth-md);
  --_h: 44px;
  --_r: var(--radius-md);
  --_px: 20px;
  --_fs: 15px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex: none;
  vertical-align: middle;
  box-sizing: border-box;
  margin: 0;
  padding: 0 0 var(--_d);
  border: 0;
  border-radius: var(--_r);
  background: none;
  color: var(--_ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.gd-btn::before, .gd-iconbtn::before, .gd-chip::before {
  content: "";
  position: absolute;
  inset: var(--_d) 0 0;
  z-index: -1;
  border-radius: var(--_r);
  background: var(--_base);
  box-shadow: var(--clay-ambient);
  transform-origin: 50% 100%;
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
.gd-btn__face, .gd-iconbtn__face, .gd-chip__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  width: 100%;
  height: var(--_h);
  padding: 0 var(--_px);
  border-radius: var(--_r);
  background: var(--_fill) linear-gradient(180deg, color-mix(in oklab, var(--_fill) 84%, #fff) 0%, color-mix(in oklab, var(--_fill) 84%, #fff) 8%, var(--_fill) 62%);
  color: var(--_ink);
  box-shadow: var(--clay-highlight), var(--clay-shade);
  font-family: var(--font-body);
  font-size: var(--_fs);
  line-height: 20px;
  font-weight: 700;
  letter-spacing: .005em;
  white-space: nowrap;
  transform-origin: 50% 100%;
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
/* neutral clay keeps the clay-base underside */
.gd-btn--secondary, .gd-iconbtn--secondary, .gd-chip { --_base: var(--clay-base); }
.gd-btn--primary, .gd-iconbtn--primary { --_fill: var(--tangerine); --_ink: var(--on-candy); --_base: color-mix(in oklab, var(--tangerine) 72%, var(--shade)); }
.gd-btn--danger, .gd-iconbtn--danger { --_fill: var(--cherry); --_ink: var(--on-candy); --_base: color-mix(in oklab, var(--cherry) 70%, var(--shade)); }
.gd-btn[class*="gd-tone-"], .gd-iconbtn[class*="gd-tone-"] { --_base: color-mix(in oklab, var(--_fill) 72%, var(--shade)); }

/* hover: puff up a touch (hover-capable pointers only) */
@media (hover: hover) {
  .gd-btn:hover .gd-btn__face, .gd-iconbtn:hover .gd-iconbtn__face, .gd-chip:hover .gd-chip__face { transform: translateY(-2px) scale(1.03); }
}
/* press: squash — sink into the base, scaleY down, widen a hair */
.gd-btn:active .gd-btn__face, .gd-btn.is-pressed .gd-btn__face,
.gd-iconbtn:active .gd-iconbtn__face, .gd-iconbtn.is-pressed .gd-iconbtn__face,
.gd-chip:active .gd-chip__face, .gd-chip.is-pressed .gd-chip__face {
  transform: translateY(calc(var(--_d) - 1px)) scale(1.04, .92);
  transition: transform var(--gd-t-press) var(--gd-squash);
}
.gd-btn:active::before, .gd-btn.is-pressed::before,
.gd-iconbtn:active::before, .gd-iconbtn.is-pressed::before,
.gd-chip:active::before, .gd-chip.is-pressed::before {
  transform: scale(1.02, .92);
  transition: transform var(--gd-t-press) var(--gd-squash);
}
/* dark theme: candy glows on plum */
[data-theme="dark"] .gd-btn--primary::before, [data-theme="dark"] .gd-btn--danger::before,
[data-theme="dark"] .gd-iconbtn--primary::before, [data-theme="dark"] .gd-iconbtn--danger::before,
[data-theme="dark"] .gd-btn[class*="gd-tone-"]::before, [data-theme="dark"] .gd-iconbtn[class*="gd-tone-"]::before {
  box-shadow: var(--clay-ambient), 0 8px 26px -8px color-mix(in oklab, var(--_fill) 60%, transparent);
}

/* focus: solid ring around the face */
.gd-btn:focus-visible, .gd-iconbtn:focus-visible, .gd-chip:focus-visible { outline: none; }
.gd-btn:focus-visible .gd-btn__face, .gd-iconbtn:focus-visible .gd-iconbtn__face, .gd-chip:focus-visible .gd-chip__face {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ghost: no slab, a soft clay-sunk puddle on hover */
.gd-btn--ghost { --_d: 0px; }
.gd-btn--ghost::before { display: none; }
.gd-btn--ghost .gd-btn__face { background: transparent; box-shadow: none; }
.gd-btn--ghost::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--_r);
  background: var(--clay-sunk); box-shadow: var(--well);
  opacity: 0; transform: scale(.92);
  transition: opacity var(--gd-t-quick) var(--gd-settle), transform var(--gd-t-spring) var(--gd-spring);
}
@media (hover: hover) {
  .gd-btn--ghost:hover::after { opacity: 1; transform: scale(1); }
  .gd-btn--ghost:hover .gd-btn__face { transform: scale(1.02); }
}
.gd-btn--ghost:active .gd-btn__face, .gd-btn--ghost.is-pressed .gd-btn__face { transform: scale(1.04, .92); }
.gd-btn--ghost:active::after { opacity: 1; transform: scale(.98); }

/* sizes */
.gd-btn--sm, .gd-iconbtn--sm { --_h: 36px; --_d: var(--depth-sm); --_px: 14px; --_fs: 14px; --_r: 13px; }
.gd-btn--lg, .gd-iconbtn--lg { --_h: 54px; --_d: var(--depth-lg); --_px: 28px; --_fs: 17px; --_r: 19px; }
.gd-btn--block { display: flex; width: 100%; }
.gd-btn--ghost.gd-btn--sm, .gd-btn--ghost.gd-btn--lg { --_d: 0px; }

/* disabled: flattened into the table */
.gd-btn:disabled, .gd-btn[aria-disabled="true"], .gd-iconbtn:disabled { cursor: not-allowed; }
.gd-btn:disabled::before, .gd-btn[aria-disabled="true"]::before, .gd-iconbtn:disabled::before { background: transparent; box-shadow: none; }
.gd-btn:disabled .gd-btn__face, .gd-btn[aria-disabled="true"] .gd-btn__face, .gd-iconbtn:disabled .gd-iconbtn__face {
  background: var(--clay-sunk); color: var(--ink-soft); box-shadow: var(--well);
  transform: translateY(var(--_d)) !important;
}
.gd-btn--ghost:disabled .gd-btn__face { background: transparent; box-shadow: none; transform: none !important; }

/* loading: three gum drops bounce in place of the label */
.gd-btn.is-loading { cursor: progress; }
.gd-btn__label { display: inline-flex; align-items: center; gap: var(--space-2); transition: opacity var(--gd-t-quick) var(--gd-settle); }
.gd-btn.is-loading .gd-btn__label { opacity: 0; }
.gd-btn__dots { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 5px; opacity: 0; transition: opacity var(--gd-t-quick) var(--gd-settle); pointer-events: none; }
.gd-btn.is-loading .gd-btn__dots { opacity: 1; }
.gd-btn__dots i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: gd-gum-bounce 900ms var(--gd-spring) infinite; }
.gd-btn__dots i:nth-child(2) { animation-delay: 120ms; }
.gd-btn__dots i:nth-child(3) { animation-delay: 240ms; }
@keyframes gd-gum-bounce { 0%, 60%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-5px) scale(.9, 1.1); } }

/* ---------- IconButton ---------- */
.gd-iconbtn { --_px: 0px; }
.gd-iconbtn .gd-iconbtn__face { width: var(--_h); }
.gd-iconbtn--round { --_r: var(--radius-full); }
.gd-iconbtn--sm .gd-icon { width: 18px; height: 18px; }
.gd-iconbtn--lg .gd-icon { width: 24px; height: 24px; }
.gd-iconbtn--ghost { --_d: 0px; }
.gd-iconbtn--ghost::before { display: none; }
.gd-iconbtn--ghost .gd-iconbtn__face { background: transparent; box-shadow: none; }
@media (hover: hover) { .gd-iconbtn--ghost:hover .gd-iconbtn__face { background: var(--clay-sunk); } }
.gd-iconbtn--ghost:active .gd-iconbtn__face { transform: scale(.9); }
.gd-icon.is-popping { animation: gd-pop-wobble var(--gd-t-settle) var(--gd-spring); }
/* toggle icon buttons (aria-pressed): fill turns candy and the glyph pops */
.gd-iconbtn[aria-pressed="true"] { --_fill: var(--_on, var(--cherry)); --_ink: var(--on-candy); --_base: color-mix(in oklab, var(--_fill) 70%, var(--shade)); }
.gd-iconbtn[aria-pressed="true"].is-touched .gd-icon { animation: gd-pop-wobble var(--gd-t-settle) var(--gd-spring); }
.gd-iconbtn[aria-pressed="true"] .gd-icon .gd-fillable { fill: currentColor; }

/* ==========================================================================
   Toggle — jelly knob that stretches as it travels
   ========================================================================== */
.gd-toggle { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; -webkit-tap-highlight-color: transparent; font-size: 16px; line-height: 24px; color: var(--ink); }
.gd-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.gd-toggle__track {
  position: relative; flex: none; width: 58px; height: 34px; border-radius: var(--radius-full);
  background: var(--clay-sunk); box-shadow: var(--well);
}
.gd-toggle__track::before { /* candy layer fades in: opacity only */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--tangerine);
  box-shadow: inset 0 3px 0 color-mix(in oklab, var(--tangerine) 70%, var(--shade)), inset 0 2px 6px #00000026;
  opacity: 0; transition: opacity var(--gd-t-quick) var(--gd-settle);
}
.gd-toggle__knob {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 25px;
  transition: transform var(--gd-t-travel) var(--gd-spring-soft);
}
.gd-toggle__jelly {
  display: block; width: 28px; height: 25px; border-radius: 14px / 13px;
  background: var(--gd-knob, var(--clay));
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 3px 0 var(--clay-base), 0 5px 8px -3px #00000040;
  transform-origin: 50% 50%;
}
.gd-toggle input:checked + .gd-toggle__track::before { opacity: 1; }
.gd-toggle input:checked + .gd-toggle__track .gd-toggle__knob { transform: translateX(24px); }
.gd-toggle.is-touched input:checked + .gd-toggle__track .gd-toggle__jelly { animation: gd-jelly-right var(--gd-t-travel) var(--gd-settle); }
.gd-toggle.is-touched input:not(:checked) + .gd-toggle__track .gd-toggle__jelly { animation: gd-jelly-left var(--gd-t-travel) var(--gd-settle); }
.gd-toggle:active .gd-toggle__jelly { transform: scale(1.12, .9); transition: transform var(--gd-t-press) var(--gd-squash); }
.gd-toggle input:focus-visible + .gd-toggle__track { outline: 3px solid var(--focus); outline-offset: 3px; }
.gd-toggle input:disabled + .gd-toggle__track { opacity: .5; }
.gd-toggle:has(input:disabled) { cursor: not-allowed; color: var(--ink-soft); }
@keyframes gd-jelly-right {
  0% { transform: scaleX(1); transform-origin: 0 50%; }
  35% { transform: scale(1.38, .86); transform-origin: 100% 50%; }
  70% { transform: scale(.93, 1.05); transform-origin: 100% 50%; }
  100% { transform: scale(1); transform-origin: 100% 50%; }
}
@keyframes gd-jelly-left {
  0% { transform: scaleX(1); transform-origin: 100% 50%; }
  35% { transform: scale(1.38, .86); transform-origin: 0 50%; }
  70% { transform: scale(.93, 1.05); transform-origin: 0 50%; }
  100% { transform: scale(1); transform-origin: 0 50%; }
}

/* ==========================================================================
   Checkbox & Radio — pop with a wobble
   ========================================================================== */
.gd-check, .gd-radio { position: relative; display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; font-size: 16px; line-height: 24px; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.gd-check input, .gd-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.gd-check { --_fill: var(--tangerine); }
.gd-check--mint { --_fill: var(--mint); }
.gd-check--blueberry { --_fill: var(--blueberry); }
.gd-check__box, .gd-radio__dot {
  position: relative; flex: none; display: grid; place-items: center;
  width: 26px; height: 26px; box-sizing: border-box;
  border-radius: 9px; border: 2px solid var(--rim);
  background: var(--clay); box-shadow: inset 0 2px 0 #5a2d3a14;
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
.gd-radio__dot { border-radius: 50%; }
.gd-check__box::before, .gd-radio__dot::before { /* candy slab fades in over the outline */
  content: ""; position: absolute; inset: -2px; border-radius: inherit;
  background: var(--_fill, var(--tangerine));
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 3px 0 color-mix(in oklab, var(--_fill, var(--tangerine)) 70%, var(--shade));
  opacity: 0; transition: opacity var(--gd-t-quick) var(--gd-settle);
}
.gd-check__mark { position: relative; width: 18px; height: 18px; color: var(--on-candy); opacity: 0; transform: scale(.3); }
.gd-radio__pip { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--clay); box-shadow: 0 2px 0 #5a2d3a40; opacity: 0; transform: scale(.3); }
.gd-check input:checked + .gd-check__box::before, .gd-radio input:checked + .gd-radio__dot::before,
.gd-check input:indeterminate + .gd-check__box::before { opacity: 1; }
.gd-check input:checked + .gd-check__box .gd-check__mark,
.gd-radio input:checked + .gd-radio__dot .gd-radio__pip { opacity: 1; transform: none; }
.gd-check.is-touched input:checked + .gd-check__box .gd-check__mark,
.gd-radio.is-touched input:checked + .gd-radio__dot .gd-radio__pip { animation: gd-pop-wobble var(--gd-t-settle) var(--gd-spring); }
.gd-check:active .gd-check__box, .gd-radio:active .gd-radio__dot { transform: scale(.88); transition: transform var(--gd-t-press) var(--gd-squash); }
.gd-check input:focus-visible + .gd-check__box, .gd-radio input:focus-visible + .gd-radio__dot { outline: 3px solid var(--focus); outline-offset: 3px; }
.gd-check:has(input:disabled), .gd-radio:has(input:disabled) { cursor: not-allowed; color: var(--ink-soft); }
.gd-check input:disabled + .gd-check__box, .gd-radio input:disabled + .gd-radio__dot { opacity: .5; }
.gd-check__text { display: flex; flex-direction: column; }
.gd-check__text small { font-size: 14px; line-height: 20px; color: var(--ink-soft); }
@keyframes gd-pop-wobble {
  0% { opacity: 0; transform: scale(.3) rotate(-18deg); }
  45% { opacity: 1; transform: scale(1.22) rotate(8deg); }
  70% { transform: scale(.94) rotate(-4deg); }
  85% { transform: scale(1.03) rotate(1.5deg); }
  100% { transform: none; }
}

/* ==========================================================================
   TextField
   ========================================================================== */
.gd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gd-field__label { font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink); }
.gd-field__box {
  position: relative; display: flex; align-items: center; gap: var(--space-2);
  height: 50px; box-sizing: border-box; padding: 0 var(--space-4);
  border: 2px solid var(--rim); border-radius: var(--radius-md);
  background: var(--clay); box-shadow: var(--well);
  color: var(--ink-soft);
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
.gd-field--search .gd-field__box { border-radius: var(--radius-full); padding-right: 6px; }
.gd-field__input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; line-height: 24px; color: var(--ink);
}
.gd-field__input::placeholder { color: var(--ink-soft); opacity: 1; }
.gd-field__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.gd-field__box:focus-within { border-color: var(--focus); transform: scale(1.012); }
.gd-field__box:focus-within { outline: 3px solid color-mix(in oklab, var(--focus) 35%, transparent); outline-offset: 0; }
.gd-field__hint { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; color: var(--ink-soft); }
.gd-field--error .gd-field__box { border-color: color-mix(in oklab, var(--cherry) 78%, var(--shade)); }
.gd-field--error .gd-field__hint { color: var(--ink); }
.gd-field__badge { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--cherry); color: var(--on-candy); font-size: 12px; font-weight: 800; line-height: 1; box-shadow: 0 2px 0 color-mix(in oklab, var(--cherry) 70%, var(--shade)); flex: none; }
.gd-field.is-shaking .gd-field__box { animation: gd-nope 360ms var(--gd-settle); }
.gd-field__clear { opacity: 0; transform: scale(.4); pointer-events: none; transition: opacity var(--gd-t-quick) var(--gd-settle), transform var(--gd-t-spring) var(--gd-spring); }
.gd-field.has-value .gd-field__clear { opacity: 1; transform: none; pointer-events: auto; }
.gd-field__box .gd-icon { color: var(--ink-soft); }
@keyframes gd-nope { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }

/* ==========================================================================
   SegmentedControl — a clay puck that squishes as it slides
   ========================================================================== */
.gd-seg {
  --n: 3; --i: 0;
  position: relative; display: inline-grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  box-sizing: border-box; padding: 5px; border-radius: 20px;
  background: var(--clay-sunk); box-shadow: var(--well);
}
.gd-seg--block { display: grid; width: 100%; }
.gd-seg__puck {
  position: absolute; top: 5px; bottom: 8px; left: 5px; width: calc((100% - 10px) / var(--n));
  transform: translateX(calc(var(--i) * 100%));
  transition: transform var(--gd-t-travel) var(--gd-spring-soft);
  pointer-events: none;
}
.gd-seg__puck::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius-md);
  background: var(--clay);
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 3px 0 var(--clay-base), 0 6px 10px -4px #00000033;
}
.gd-seg.is-moving .gd-seg__puck::before { animation: gd-squish-x var(--gd-t-travel) var(--gd-settle); }
.gd-seg__opt { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 var(--space-4) 3px; cursor: pointer; font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: color var(--gd-t-quick) var(--gd-settle); }
.gd-seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.gd-seg__opt:has(input:checked) { color: var(--ink); }
.gd-seg__opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -1px; border-radius: var(--radius-md); }
.gd-seg__opt span { display: inline-flex; align-items: center; gap: 6px; transition: transform var(--gd-t-spring) var(--gd-spring); }
.gd-seg__opt:active span { transform: scale(.94); transition-duration: var(--gd-t-press); }
@keyframes gd-squish-x { 0% { transform: none; } 40% { transform: scale(1.1, .9); } 75% { transform: scale(.97, 1.03); } 100% { transform: none; } }

/* ==========================================================================
   Slider — gummy thumb that squishes while dragged
   A real <input type=range> sits on top (invisible) for touch, keyboard & a11y.
   ========================================================================== */
.gd-slider { --p: .5; display: flex; flex-direction: column; gap: var(--space-2); min-width: 200px; }
.gd-slider__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; line-height: 20px; font-weight: 700; }
.gd-slider__value { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.gd-slider__body { position: relative; height: 36px; }
.gd-slider__track { position: absolute; left: 0; right: 0; top: 11px; height: 14px; border-radius: var(--radius-full); background: var(--clay-sunk); box-shadow: var(--well); overflow: hidden; }
.gd-slider__fill { position: absolute; inset: 0; border-radius: inherit; background: var(--tangerine); box-shadow: inset 0 2px 0 #ffffff59, inset 0 -3px 0 color-mix(in oklab, var(--tangerine) 72%, var(--shade)); transform: translateX(calc((var(--p) - 1) * 100% + var(--p) * -36px + 18px)); }
.gd-slider__rail { position: absolute; inset: 0; pointer-events: none; }
.gd-slider__thumb { position: absolute; left: calc(var(--p) * (100% - 36px)); top: 2px; width: 36px; height: 30px; } /* positioned, not animated: the drag is direct manipulation */
.gd-slider__gum {
  display: block; width: 36px; height: 30px; border-radius: 18px / 15px;
  background: var(--gd-knob, var(--clay));
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 4px 0 var(--clay-base), 0 8px 12px -4px #00000040;
  transform-origin: 50% 100%;
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
.gd-slider__gum::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -6px 0 0 -5px; border-radius: 50%; background: var(--tangerine); box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--tangerine) 72%, var(--shade)); }
.gd-slider__bubble {
  position: absolute; left: 50%; bottom: calc(100% + 8px); min-width: 34px; padding: 4px 8px; box-sizing: border-box;
  border-radius: 12px; background: var(--ink); color: var(--table); text-align: center;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 18px; font-variant-numeric: tabular-nums; white-space: nowrap;
  transform: translateX(-50%) translateY(6px) scale(.6); transform-origin: 50% 100%; opacity: 0;
  transition: transform var(--gd-t-spring) var(--gd-spring), opacity var(--gd-t-quick) var(--gd-settle);
}
.gd-slider__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: grab; -webkit-appearance: none; appearance: none; background: transparent; }
.gd-slider__input::-webkit-slider-thumb { -webkit-appearance: none; width: 36px; height: 36px; }
.gd-slider__input::-moz-range-thumb { width: 36px; height: 36px; border: 0; }
@media (hover: hover) { .gd-slider__body:hover .gd-slider__gum { transform: scale(1.06); } }
.gd-slider.is-dragging .gd-slider__input { cursor: grabbing; }
.gd-slider.is-dragging .gd-slider__gum { transform: translateY(2px) scale(1.16, .84); transition-duration: var(--gd-t-press); transition-timing-function: var(--gd-squash); }
.gd-slider.is-dragging .gd-slider__bubble, .gd-slider__input:focus-visible ~ .gd-slider__rail .gd-slider__bubble { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.gd-slider__input:focus-visible ~ .gd-slider__rail .gd-slider__gum { outline: 3px solid var(--focus); outline-offset: 3px; }
.gd-slider__ticks { display: flex; justify-content: space-between; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-soft); padding: 0 6px; }

/* ==========================================================================
   Tabs — a gummy bean slides under the active tab
   ========================================================================== */
.gd-tabs__list { position: relative; display: flex; gap: var(--space-1); padding-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.gd-tabs__list::-webkit-scrollbar { display: none; }
.gd-tabs__list::after { content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 4px; border-radius: 2px; background: var(--clay-sunk); }
.gd-tab {
  position: relative; flex: none; padding: 8px 14px; border: 0; border-radius: 12px; background: none; cursor: pointer;
  font: inherit; font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink-soft);
  transition: transform var(--gd-t-spring) var(--gd-spring), color var(--gd-t-quick) var(--gd-settle);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .gd-tab:hover { color: var(--ink); transform: translateY(-1px); } }
.gd-tab:active { transform: scale(.94); transition-duration: var(--gd-t-press); }
.gd-tab[aria-selected="true"] { color: var(--ink); }
.gd-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.gd-tab__count { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; background: var(--clay-sunk); font-size: 12px; line-height: 18px; color: var(--ink); }
.gd-tabs__bean {
  position: absolute; left: 0; bottom: 0; z-index: 1; width: 100px; height: 10px; border-radius: 5px;
  background: var(--tangerine);
  box-shadow: inset 0 2px 0 #ffffff66, 0 2px 0 color-mix(in oklab, var(--tangerine) 70%, var(--shade));
  transform-origin: 0 50%;
  transition: transform var(--gd-t-travel) var(--gd-spring-soft);
}
.gd-tabs__panel { padding-top: var(--space-4); }
.gd-tabs__panel.is-entering { animation: gd-rise var(--gd-t-spring) var(--gd-spring-soft); }
@keyframes gd-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Card — a clay slab; lifts and tilts toward the pointer (fine pointers only)
   ========================================================================== */
.gd-card {
  --_fill: var(--clay); --_ink: var(--ink);
  --rx: 0deg; --ry: 0deg; --ty: 0px;
  position: relative; box-sizing: border-box;
  padding: var(--space-6); border-radius: var(--radius-lg);
  background: var(--_fill); color: var(--_ink);
  box-shadow: var(--clay-slab);
  transform: perspective(900px) translateY(var(--ty)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform var(--gd-t-settle) var(--gd-spring-soft);
}
.gd-card[class*="gd-tone-"]:not(.gd-tone-clay) {
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 var(--depth-lg) 0 color-mix(in oklab, var(--_fill) 70%, var(--shade)), var(--clay-ambient);
}
[data-theme="dark"] .gd-card[class*="gd-tone-"]:not(.gd-tone-clay) {
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 var(--depth-lg) 0 color-mix(in oklab, var(--_fill) 62%, var(--shade)), var(--clay-ambient), 0 14px 40px -12px color-mix(in oklab, var(--_fill) 45%, transparent);
}
.gd-card[class*="gd-tone-"]:not(.gd-tone-clay) .gd-sm, .gd-card[class*="gd-tone-"]:not(.gd-tone-clay) .gd-overline { color: var(--on-candy); }
.gd-card::after { /* the lifted shadow: opacity only */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; box-shadow: var(--clay-ambient-lift);
  opacity: 0; transition: opacity var(--gd-t-settle) var(--gd-settle); pointer-events: none;
}
.gd-card--sm { padding: var(--space-4); border-radius: 20px; }
.gd-card__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.gd-card__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 28px; }
.gd-card__body { margin: 0; font-size: 15px; line-height: 22px; }
.gd-card__foot { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
@media (hover: hover) and (pointer: fine) {
  .gd-card--lift { cursor: pointer; }
  .gd-card--lift:hover { --ty: -4px; }
  .gd-card--lift:hover::after { opacity: 1; }
}
.gd-card--lift:active { --ty: -1px; transition-duration: var(--gd-t-quick); }
.gd-card--lift:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* ==========================================================================
   Chip & Badge
   ========================================================================== */
.gd-chip { --_d: var(--depth-sm); --_h: 34px; --_r: var(--radius-full); --_px: 14px; --_fs: 14px; }
.gd-chip .gd-chip__face { gap: 6px; }
.gd-chip[aria-pressed="true"] { --_fill: var(--blueberry); --_ink: var(--on-candy); --_base: color-mix(in oklab, var(--blueberry) 70%, var(--shade)); }
.gd-chip__tick { width: 0; overflow: hidden; display: inline-flex; transition: width var(--gd-t-spring) var(--gd-spring); }
.gd-chip__tick .gd-icon { width: 16px; height: 16px; transform: scale(.3); opacity: 0; transition: transform var(--gd-t-spring) var(--gd-spring), opacity var(--gd-t-quick); }
.gd-chip[aria-pressed="true"] .gd-chip__tick { width: 16px; }
.gd-chip[aria-pressed="true"] .gd-chip__tick .gd-icon { transform: none; opacity: 1; }
.gd-chip__x { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: -6px; border-radius: 50%; background: color-mix(in oklab, var(--_ink) 12%, transparent); }
.gd-chip__x .gd-icon { width: 12px; height: 12px; }
.gd-chip.is-leaving { animation: gd-poof 260ms var(--gd-settle) forwards; pointer-events: none; }
@keyframes gd-poof { 40% { transform: scale(1.08); } 100% { transform: scale(.4); opacity: 0; } }

.gd-badge {
  --_fill: var(--clay-sunk); --_ink: var(--ink);
  display: inline-flex; align-items: center; gap: 4px; box-sizing: border-box;
  height: 24px; min-width: 24px; padding: 0 9px; border-radius: var(--radius-full);
  background: var(--_fill); color: var(--_ink);
  font-family: var(--font-body); font-size: 12px; line-height: 16px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; justify-content: center;
  box-shadow: var(--clay-highlight), 0 2px 0 color-mix(in oklab, var(--_fill) 70%, var(--shade));
  vertical-align: middle;
}
.gd-badge .gd-icon { width: 13px; height: 13px; }
.gd-badge--dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.gd-badge.is-bumped { animation: gd-bump var(--gd-t-settle) var(--gd-spring); }
@keyframes gd-bump { 0% { transform: scale(1); } 30% { transform: scale(1.28, .82); } 60% { transform: scale(.92, 1.08); } 100% { transform: none; } }

/* ==========================================================================
   Avatar & AvatarStack
   ========================================================================== */
.gd-avatar {
  --_fill: var(--blueberry); --_ink: var(--on-candy); --_s: 44px;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--_s); height: var(--_s); border-radius: 50%;
  background: var(--_fill); color: var(--_ink);
  box-shadow: var(--clay-highlight), inset 0 -4px 0 #5a2d3a24, 0 3px 0 color-mix(in oklab, var(--_fill) 68%, var(--shade));
  font-family: var(--font-display); font-weight: 600; font-size: calc(var(--_s) * .38); line-height: 1; letter-spacing: .01em;
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
.gd-avatar--sm { --_s: 32px; }
.gd-avatar--lg { --_s: 64px; }
.gd-avatar--xl { --_s: 88px; }
.gd-avatar__status { position: absolute; right: -1px; bottom: 0; width: 28%; height: 28%; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--table); }
.gd-avatar__status--away { background: var(--lemon); }
.gd-avatars { display: inline-flex; align-items: center; padding-left: 8px; }
.gd-avatars > .gd-avatar { margin-left: -8px; font-size: calc(var(--_s) * .32); box-shadow: 0 0 0 3px var(--_ring, var(--table)), var(--clay-highlight), inset 0 -4px 0 #5a2d3a24; }
.gd-avatars > .gd-avatar--more { --_fill: var(--clay); --_ink: var(--ink); font-family: var(--font-body); font-weight: 800; font-size: 13px; }
@media (hover: hover) {
  .gd-avatars > .gd-avatar:hover { transform: translateY(-5px) scale(1.06); z-index: 2; }
}

/* ==========================================================================
   Tooltip — pops from its arrow
   ========================================================================== */
.gd-tip { position: relative; display: inline-flex; }
.gd-tip__bubble {
  position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 50;
  padding: 7px 11px; border-radius: 12px; background: var(--ink); color: var(--table);
  font-size: 13px; line-height: 18px; font-weight: 700; white-space: nowrap; pointer-events: none;
  box-shadow: 0 3px 0 color-mix(in oklab, var(--ink) 75%, #000), 0 10px 18px -8px #00000059;
  opacity: 0; transform: translateX(-50%) translateY(6px) scale(.8); transform-origin: 50% 100%;
  transition: opacity 120ms var(--gd-settle), transform 120ms var(--gd-settle);
}
.gd-tip__bubble::after { content: ""; position: absolute; left: 50%; top: 100%; width: 10px; height: 10px; margin: -6px 0 0 -5px; border-radius: 0 0 3px 0; background: inherit; transform: rotate(45deg); }
.gd-tip--below .gd-tip__bubble { bottom: auto; top: calc(100% + 12px); transform-origin: 50% 0; transform: translateX(-50%) translateY(-6px) scale(.8); }
.gd-tip--below .gd-tip__bubble::after { top: auto; bottom: 100%; margin: 0 0 -6px -5px; border-radius: 3px 0 0 0; }
.gd-tip:hover .gd-tip__bubble, .gd-tip:focus-within .gd-tip__bubble, .gd-tip.is-open .gd-tip__bubble {
  opacity: 1; transform: translateX(-50%) translateY(0) scale(1);
  transition: opacity var(--gd-t-quick) var(--gd-settle) 120ms, transform var(--gd-t-spring) var(--gd-spring) 120ms;
}
.gd-tip__key { margin-left: 8px; padding: 1px 5px; border-radius: 5px; background: color-mix(in oklab, var(--table) 22%, transparent); font-size: 11px; }

/* ==========================================================================
   Toast — drops in and settles
   ========================================================================== */
.gd-toasts { position: fixed; top: var(--space-4); left: 50%; z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); width: min(400px, calc(100vw - 32px)); transform: translateX(-50%); pointer-events: none; }
.gd-toast {
  --_fill: var(--mint);
  pointer-events: auto; display: flex; align-items: flex-start; gap: var(--space-3); box-sizing: border-box; width: 100%;
  padding: 14px 10px 14px 14px; border-radius: 20px; background: var(--clay); color: var(--ink);
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 var(--depth-md) 0 var(--clay-base), var(--clay-ambient-lift);
  animation: gd-drop var(--gd-t-settle) var(--gd-spring-soft) both;
}
.gd-toast.is-leaving { animation: gd-lift-out 220ms var(--gd-settle) forwards; }
.gd-toast__icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--_fill); color: var(--on-candy); box-shadow: var(--clay-highlight), 0 3px 0 color-mix(in oklab, var(--_fill) 70%, var(--shade)); }
.gd-toast__text { flex: 1; min-width: 0; padding-top: 1px; }
.gd-toast__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 22px; }
.gd-toast__body { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--ink-soft); }
.gd-toast__action { margin-top: var(--space-2); }
.gd-toasts--inline { position: static; transform: none; width: auto; max-width: 400px; pointer-events: auto; }
@keyframes gd-drop {
  0% { opacity: 0; transform: translateY(-120%) scale(.96); }
  55% { opacity: 1; transform: translateY(6px) scale(1.01, .98); }
  78% { transform: translateY(-2px) scale(1); }
  100% { opacity: 1; transform: none; }
}
@keyframes gd-lift-out { to { opacity: 0; transform: translateY(-14px) scale(.95); } }

/* ==========================================================================
   Modal / Dialog
   ========================================================================== */
.gd-modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: var(--space-4); box-sizing: border-box; }
.gd-modal__scrim { position: absolute; inset: 0; background: var(--scrim); animation: gd-fade var(--gd-t-quick) var(--gd-settle) both; }
.gd-modal__panel {
  position: relative; box-sizing: border-box; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  padding: var(--space-8); border-radius: var(--radius-xl); background: var(--clay); color: var(--ink);
  box-shadow: var(--clay-highlight), var(--clay-shade), 0 var(--depth-lg) 0 var(--clay-base), var(--clay-ambient-lift);
  animation: gd-panel-in var(--gd-t-settle) var(--gd-spring) both;
}
.gd-modal.is-leaving .gd-modal__scrim { animation: gd-fade 200ms var(--gd-settle) reverse forwards; }
.gd-modal.is-leaving .gd-modal__panel { animation: gd-panel-out 200ms var(--gd-settle) forwards; }
.gd-modal__icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: var(--space-4); border-radius: 16px; background: var(--_fill, var(--lemon)); color: var(--on-candy); box-shadow: var(--clay-highlight), var(--clay-shade), 0 4px 0 color-mix(in oklab, var(--_fill, var(--lemon)) 70%, var(--shade)); }
.gd-modal__icon .gd-icon { width: 26px; height: 26px; }
.gd-modal__title { margin: 0 0 var(--space-2); font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 32px; letter-spacing: -.01em; }
.gd-modal__body { margin: 0; font-size: 16px; line-height: 24px; color: var(--ink-soft); }
.gd-modal__content { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-5); }
.gd-modal__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }
.gd-modal__close { position: absolute; top: var(--space-4); right: var(--space-4); }
.gd-modal--inline { position: relative; inset: auto; z-index: auto; display: block; padding: 0; }
.gd-modal--inline .gd-modal__panel { animation: none; max-height: none; }
@keyframes gd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gd-panel-in { 0% { opacity: 0; transform: translateY(18px) scale(.9); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes gd-panel-out { to { opacity: 0; transform: translateY(10px) scale(.94); } }
@media (max-width: 480px) {
  .gd-modal__panel { padding: var(--space-6); }
  .gd-modal__actions { flex-direction: column-reverse; }
  .gd-modal__actions .gd-btn { display: flex; width: 100%; }
}

/* ==========================================================================
   ProgressBar & ProgressRing
   ========================================================================== */
.gd-progress { --p: .5; --_fill: var(--tangerine); display: flex; flex-direction: column; gap: var(--space-2); min-width: 180px; }
.gd-progress__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); font-size: 15px; line-height: 20px; font-weight: 700; }
.gd-progress__pct { font-family: var(--font-display); font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; display: inline-block; }
.gd-progress__track { position: relative; height: 16px; border-radius: var(--radius-full); background: var(--clay-sunk); box-shadow: var(--well); overflow: hidden; }
.gd-progress__bar {
  position: absolute; inset: 0; border-radius: inherit; background: var(--_fill);
  box-shadow: inset 0 3px 0 #ffffff59, inset 0 -4px 0 color-mix(in oklab, var(--_fill) 72%, var(--shade));
  transform: translateX(calc((var(--p) - 1) * 100%));
  transition: transform var(--gd-t-settle) var(--gd-spring-soft);
}
.gd-progress--thin .gd-progress__track { height: 10px; }
.gd-progress__meta { font-size: 14px; line-height: 20px; color: var(--ink-soft); }

.gd-ring { --_fill: var(--tangerine); --_s: 120px; position: relative; display: inline-grid; place-items: center; width: var(--_s); height: var(--_s); flex: none; }
.gd-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.gd-ring__track { fill: none; stroke: var(--clay-sunk); }
.gd-ring__base { fill: none; stroke: color-mix(in oklab, var(--_fill) 70%, var(--shade)); stroke-linecap: round; }
.gd-ring__arc { fill: none; stroke: var(--_fill); stroke-linecap: round; }
.gd-ring__shine { fill: none; stroke: #ffffff; stroke-opacity: .35; stroke-linecap: round; }
.gd-ring.is-pulsing svg { animation: gd-ring-pulse var(--gd-t-settle) var(--gd-spring); }
.gd-ring__center { position: relative; text-align: center; line-height: 1; }
.gd-ring__num--big { font-size: calc(var(--_s) * .34); }
.gd-ring__num { font-family: var(--font-display); font-weight: 600; font-stretch: 108%; font-size: calc(var(--_s) * .24); line-height: 1; color: var(--ink); }
.gd-ring__label { display: block; margin-top: 4px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-soft); }
@keyframes gd-ring-pulse { 0% { transform: rotate(-90deg) scale(1); } 35% { transform: rotate(-90deg) scale(1.06); } 100% { transform: rotate(-90deg) scale(1); } }

/* ==========================================================================
   Counter digits — each digit bounces into place
   ========================================================================== */
.gd-count { display: inline-flex; font-family: var(--font-display); font-weight: 600; font-stretch: 112%; font-variant-numeric: tabular-nums; line-height: 1; overflow: hidden; padding: .08em 0; margin: -.08em 0; }
.gd-count__d { display: inline-block; }
.gd-count__d.is-up { animation: gd-digit-up var(--gd-t-settle) var(--gd-spring); }
.gd-count__d.is-down { animation: gd-digit-down var(--gd-t-settle) var(--gd-spring); }
@keyframes gd-digit-up { 0% { transform: translateY(70%) scale(.8, 1.1); opacity: 0; } 60% { transform: translateY(-8%) scale(1.05, .95); opacity: 1; } 100% { transform: none; } }
@keyframes gd-digit-down { 0% { transform: translateY(-70%) scale(.8, 1.1); opacity: 0; } 60% { transform: translateY(8%) scale(1.05, .95); opacity: 1; } 100% { transform: none; } }

/* ---------- Stepper ---------- */
.gd-stepper { display: inline-flex; flex-direction: column; gap: var(--space-2); }
.gd-stepper__label { font-size: 15px; line-height: 20px; font-weight: 700; }
.gd-stepper__body { display: inline-flex; align-items: center; gap: var(--space-2); padding: 6px 6px 3px; border-radius: 22px; background: var(--clay-sunk); box-shadow: var(--well); }
.gd-stepper__value { min-width: 64px; text-align: center; font-size: 30px; color: var(--ink); display: flex; justify-content: center; align-items: baseline; gap: 4px; padding-bottom: 3px; }
.gd-stepper__unit { font-family: var(--font-body); font-size: 13px; font-weight: 700; color: var(--ink-soft); }

/* ==========================================================================
   ListRow
   ========================================================================== */
.gd-list { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2); border-radius: var(--radius-lg); background: var(--clay); box-shadow: var(--clay-slab); }
.gd-row {
  position: relative; display: flex; align-items: center; gap: var(--space-3); box-sizing: border-box; width: 100%;
  min-height: 64px; padding: 10px 12px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink);
  font: inherit; text-align: left; text-decoration: none;
  transition: transform var(--gd-t-spring) var(--gd-spring);
  -webkit-tap-highlight-color: transparent;
}
.gd-row + .gd-row::before { content: ""; position: absolute; top: -1px; left: 64px; right: 12px; height: 2px; border-radius: 1px; background: var(--clay-sunk); }
.gd-row__lead { --_fill: var(--lemon); flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--_fill); color: var(--on-candy); box-shadow: var(--clay-highlight), var(--clay-shade), 0 3px 0 color-mix(in oklab, var(--_fill) 70%, var(--shade)); transition: transform var(--gd-t-spring) var(--gd-spring); }
.gd-row__lead .gd-icon { width: 22px; height: 22px; }
.gd-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gd-row__title { font-size: 16px; line-height: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-row__meta { font-size: 14px; line-height: 20px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-row__trail { flex: none; display: flex; align-items: center; gap: var(--space-2); color: var(--ink-soft); }
.gd-row__chev { transition: transform var(--gd-t-spring) var(--gd-spring); }
button.gd-row, a.gd-row, .gd-row--action { cursor: pointer; }
@media (hover: hover) {
  button.gd-row:hover, a.gd-row:hover, .gd-row--action:hover { background: var(--clay-sunk); }
  button.gd-row:hover .gd-row__lead, a.gd-row:hover .gd-row__lead, .gd-row--action:hover .gd-row__lead { transform: rotate(-6deg) scale(1.08); }
  button.gd-row:hover .gd-row__chev, a.gd-row:hover .gd-row__chev, .gd-row--action:hover .gd-row__chev { transform: translateX(3px); }
}
button.gd-row:active, a.gd-row:active, .gd-row--action:active { transform: scale(.985); transition-duration: var(--gd-t-press); }
button.gd-row:focus-visible, a.gd-row:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.gd-row.is-done .gd-row__title { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in oklab, var(--ink-soft) 60%, transparent); }

/* ==========================================================================
   EmptyState — three gumdrops; the middle one is the system's ONE idle wiggle
   ========================================================================== */
.gd-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); padding: var(--space-8) var(--space-6); }
.gd-empty__art { display: flex; align-items: flex-end; gap: 8px; height: 88px; margin-bottom: var(--space-4); }
.gd-drop {
  --_fill: var(--tangerine); --_w: 52px;
  display: block; width: var(--_w); height: calc(var(--_w) * 1.05);
  border-radius: 50% 50% 14px 14px / 62% 62% 14px 14px;
  background: var(--_fill);
  box-shadow: inset 0 3px 0 #ffffff73, inset -5px -6px 0 #5a2d3a1f, 0 5px 0 color-mix(in oklab, var(--_fill) 68%, var(--shade)), 0 12px 16px -8px #5a2d3a59;
}
.gd-drop--sm { --_w: 40px; }
.gd-drop--lg { --_w: 64px; }
.gd-drop.is-idle { transform-origin: 50% 100%; animation: gd-idle-wiggle 5s var(--gd-settle) 1.2s infinite; }
@keyframes gd-idle-wiggle { 0%, 84%, 100% { transform: none; } 88% { transform: rotate(-4deg) scale(1.02, .98); } 92% { transform: rotate(3deg); } 96% { transform: rotate(-1deg); } }
.gd-empty__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 30px; }
.gd-empty__body { margin: 0 0 var(--space-4); max-width: 320px; font-size: 15px; line-height: 22px; color: var(--ink-soft); }

/* ==========================================================================
   Widgets
   ========================================================================== */
.gd-widget { width: 340px; max-width: 100%; }
.gd-widget__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }

/* Now playing */
.gd-player__top { display: flex; gap: var(--space-4); align-items: center; }
.gd-player__art { position: relative; flex: none; width: 76px; height: 76px; border-radius: 20px; overflow: hidden; background: var(--blueberry); box-shadow: var(--clay-highlight), 0 4px 0 color-mix(in oklab, var(--blueberry) 68%, var(--shade)); }
.gd-player__art i { position: absolute; display: block; border-radius: 50% 50% 10px 10px / 62% 62% 10px 10px; box-shadow: inset 0 3px 0 #ffffff66, 0 3px 0 #5a2d3a40; }
.gd-player__art.is-playing i { animation: gd-gum-bob 1.6s var(--gd-settle) infinite; }
.gd-player__art.is-playing i:nth-child(2) { animation-delay: .2s; }
.gd-player__art.is-playing i:nth-child(3) { animation-delay: .4s; }
@keyframes gd-gum-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px) scale(1.03, .97); } }
.gd-player__meta { flex: 1; min-width: 0; }
.gd-player__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-player__artist { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--ink-soft); }
.gd-player__times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.gd-player__controls { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin-top: var(--space-3); }
.gd-player .gd-progress { margin-top: var(--space-5); }

/* Day card */
.gd-day { position: relative; overflow: hidden; }
.gd-day__top { display: flex; justify-content: space-between; align-items: flex-start; }
.gd-day__temp { font-size: 72px; line-height: 72px; margin-top: var(--space-2); }
.gd-day__temp sup { font-size: .45em; vertical-align: top; position: relative; top: .25em; margin-left: 2px; }
.gd-day__sky { position: relative; width: 104px; height: 84px; flex: none; }
.gd-day__sun { position: absolute; right: 4px; top: 0; width: 64px; height: 64px; border-radius: 50%; background: var(--lemon); box-shadow: inset 0 4px 0 #ffffff80, inset -6px -8px 0 #5a2d3a1a, 0 4px 0 color-mix(in oklab, var(--lemon) 68%, var(--shade)); }
/* the cloud is fair-weather clay white in every theme: no theme selector, its base takes the card's candy */
.gd-day { --gd-cloud: #fffaf3; --gd-cloud-base: color-mix(in oklab, #fffaf3 58%, var(--_fill, var(--blueberry))); }
.gd-day__cloud { position: absolute; left: 0; bottom: 6px; width: 74px; height: 30px; border-radius: 16px; background: var(--gd-cloud); box-shadow: inset 0 3px 0 #ffffffb3, 0 4px 0 var(--gd-cloud-base); }
.gd-day__cloud::before { content: ""; position: absolute; left: 14px; bottom: 12px; width: 34px; height: 34px; border-radius: 50%; background: var(--gd-cloud); box-shadow: inset 0 3px 0 #ffffffb3; }
.gd-day__hours { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); margin-top: var(--space-5); }
.gd-day__hour { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 14px; background: color-mix(in oklab, var(--_fill) 62%, #fff); box-shadow: inset 0 -2px 0 #5a2d3a1a; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--on-candy); transition: transform var(--gd-t-spring) var(--gd-spring); }
.gd-day__hour b { font-family: var(--font-display); font-size: 18px; line-height: 22px; font-weight: 600; }
@media (hover: hover) { .gd-day__hour:hover { transform: translateY(-3px); } }

/* Habit streak */
.gd-streak__num { display: flex; align-items: baseline; gap: var(--space-2); }
.gd-streak__num .gd-count { font-size: 56px; }
.gd-streak__flame { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--tangerine); color: var(--on-candy); box-shadow: var(--clay-highlight), var(--clay-shade), 0 3px 0 color-mix(in oklab, var(--tangerine) 70%, var(--shade)); }
.gd-streak__flame.is-bumped { animation: gd-bump var(--gd-t-settle) var(--gd-spring); }
.gd-streak__week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: var(--space-5); }
.gd-streak__day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-soft); }
.gd-streak__pip {
  --_fill: var(--clay-sunk);
  position: relative; display: grid; place-items: center; width: 36px; height: 38px; padding: 0; border: 0; cursor: default;
  border-radius: 50% 50% 11px 11px / 60% 60% 11px 11px; background: var(--_fill); color: var(--on-candy);
  box-shadow: var(--well);
  transition: transform var(--gd-t-spring) var(--gd-spring);
}
.gd-streak__pip.is-done { --_fill: var(--mint); box-shadow: inset 0 3px 0 #ffffff66, inset 0 -3px 0 #5a2d3a1f, 0 3px 0 color-mix(in oklab, var(--mint) 68%, var(--shade)); }
.gd-streak__pip.is-today:not(.is-done) { background: var(--clay); box-shadow: inset 0 0 0 2px var(--rim), 0 3px 0 var(--clay-base); cursor: pointer; color: var(--ink-soft); }
.gd-streak__pip.is-today:not(.is-done):hover { transform: translateY(-2px) scale(1.06); }
.gd-streak__pip.is-today:active { transform: scale(1.1, .86); transition-duration: var(--gd-t-press); }
.gd-streak__pip:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.gd-streak__pip .gd-icon { width: 16px; height: 16px; }
.gd-streak__pip.is-popping { animation: gd-pop-wobble var(--gd-t-settle) var(--gd-spring); }
.gd-streak__day.is-today { color: var(--ink); }

/* Stat + sparkline */
.gd-stat__num { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-1); }
.gd-stat__num .gd-count { font-size: 48px; }
.gd-spark { position: relative; height: 84px; margin-top: var(--space-4); }
.gd-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gd-spark__area { fill: var(--tangerine); fill-opacity: .2; }
.gd-spark__base { fill: none; stroke: color-mix(in oklab, var(--tangerine) 70%, var(--shade)); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.gd-spark__line { fill: none; stroke: var(--tangerine); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.gd-spark__dot { position: absolute; left: 0; top: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--clay); box-shadow: inset 0 0 0 4px var(--tangerine), 0 2px 0 color-mix(in oklab, var(--tangerine) 70%, var(--shade)); opacity: 0; transition: opacity var(--gd-t-quick), transform 260ms var(--gd-spring-soft); pointer-events: none; }
.gd-spark__tip { position: absolute; left: 0; top: 0; padding: 3px 8px; border-radius: 9px; background: var(--ink); color: var(--table); font-size: 12px; line-height: 16px; font-weight: 800; white-space: nowrap; opacity: 0; transition: opacity var(--gd-t-quick), transform 260ms var(--gd-spring-soft); pointer-events: none; }
.gd-spark.is-hover .gd-spark__dot, .gd-spark.is-hover .gd-spark__tip { opacity: 1; }
.gd-spark__axis { display: flex; justify-content: space-between; margin-top: var(--space-2); font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-soft); }

/* Mini calendar */
.gd-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px 2px; }
.gd-cal__dow { display: grid; place-items: center; height: 24px; font-size: 12px; line-height: 16px; font-weight: 800; color: var(--ink-soft); }
.gd-cal__day {
  --_fill: transparent;
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; margin: 0 auto; padding: 0; border: 0; border-radius: 13px;
  background: var(--_fill); color: var(--ink); cursor: pointer;
  font-family: var(--font-body); font-size: 14px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: transform var(--gd-t-spring) var(--gd-spring);
  -webkit-tap-highlight-color: transparent;
}
.gd-cal__day.is-muted { color: var(--ink-soft); font-weight: 500; }
@media (hover: hover) { .gd-cal__day:hover { background: var(--clay-sunk); transform: translateY(-1px); } }
.gd-cal__day:active { transform: scale(1.1, .86); transition-duration: var(--gd-t-press); }
.gd-cal__day.is-today { --_fill: var(--lemon); color: var(--on-candy); box-shadow: var(--clay-highlight), 0 3px 0 color-mix(in oklab, var(--lemon) 66%, var(--shade)); }
.gd-cal__day.is-selected { --_fill: var(--tangerine); color: var(--on-candy); box-shadow: var(--clay-highlight), var(--clay-shade), 0 3px 0 color-mix(in oklab, var(--tangerine) 70%, var(--shade)); }
.gd-cal__day.is-today:hover, .gd-cal__day.is-selected:hover { background: var(--_fill); }
.gd-cal__day.is-popping { animation: gd-bump var(--gd-t-settle) var(--gd-spring); }
.gd-cal__day:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.gd-cal__dots { position: absolute; bottom: 3px; left: 50%; display: flex; gap: 2px; transform: translateX(-50%); }
.gd-cal__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--_dot, var(--blueberry)); }
.gd-cal__day.is-selected .gd-cal__dots i, .gd-cal__day.is-today .gd-cal__dots i { background: var(--on-candy); }
.gd-cal__month { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 24px; }
.gd-cal__body.is-turning-next { animation: gd-turn-next var(--gd-t-spring) var(--gd-spring-soft); }
.gd-cal__body.is-turning-prev { animation: gd-turn-prev var(--gd-t-spring) var(--gd-spring-soft); }
@keyframes gd-turn-next { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes gd-turn-prev { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* ---------- tone helpers: any slab can take a candy (last, so they win) ---------- */
.gd-tone-tangerine { --_fill: var(--tangerine); --_ink: var(--on-candy); }
.gd-tone-cherry    { --_fill: var(--cherry);    --_ink: var(--on-candy); }
.gd-tone-mint      { --_fill: var(--mint);      --_ink: var(--on-candy); }
.gd-tone-lemon     { --_fill: var(--lemon);     --_ink: var(--on-candy); }
.gd-tone-blueberry { --_fill: var(--blueberry); --_ink: var(--on-candy); }
.gd-tone-clay      { --_fill: var(--clay);      --_ink: var(--ink); }


/* ==========================================================================
   Reduced motion: no movement, same colours and states
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  [class*="gd-"], [class*="gd-"]::before, [class*="gd-"]::after { animation: none !important; transition-duration: 0ms !important; transition-delay: 0ms !important; }
  .gd-card { --rx: 0deg !important; --ry: 0deg !important; }
}
