/* Always Smiling Cookies - floating glass card that slides up; follows the theme's colours and fonts. */
.asc {
  --asc-accent: var(--wp--preset--color--accent-1, #f4a261);
  --asc-ink: var(--wp--preset--color--contrast, #1f2328);
  --asc-paper: var(--wp--preset--color--base, #ffffff);
  --asc-radius: 20px;
  position: fixed;
  z-index: 99999;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 420px;
  font-family: var(--wp--preset--font-family--manrope, inherit), system-ui, sans-serif;
  pointer-events: none;
}
.asc--right { left: auto; }
.asc--center { margin-inline: auto; max-width: 560px; }
.asc[hidden] { display: none; }

.asc-card {
  pointer-events: auto;
  color: var(--asc-ink);
  background: color-mix(in srgb, var(--asc-paper) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid color-mix(in srgb, var(--asc-ink) 10%, transparent);
  border-radius: var(--asc-radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 12px 40px -8px rgb(0 0 0 / .25);
  padding: 20px 22px 18px;
  opacity: 0;
  transform: translateY(24px) scale(.98);
  transition: opacity .35s ease, transform .45s cubic-bezier(.2, .9, .3, 1.2);
}
.asc.is-open .asc-card { opacity: 1; transform: none; }

.asc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.asc-icon { font-size: 1.6rem; line-height: 1; display: inline-block; transform-origin: 50% 60%; }
.asc.is-open .asc-icon { animation: asc-wiggle 1.2s ease .4s 1; }
.asc-title { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.asc-message { margin: 0 0 14px; font-size: .9rem; line-height: 1.5; opacity: .85; }
.asc-message a { color: inherit; text-decoration-color: var(--asc-accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }

.asc-prefs { display: grid; gap: 8px; margin: 0 0 14px; }
.asc-prefs[hidden] { display: none; }
.asc-pref {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: color-mix(in srgb, var(--asc-ink) 5%, transparent);
}
.asc-pref-text { display: grid; gap: 2px; font-size: .88rem; }
.asc-pref-text small { font-size: .78rem; opacity: .7; line-height: 1.35; }

/* iOS-style switch */
.asc-switch {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 42px; height: 24px; border-radius: 999px; position: relative; cursor: pointer;
  background: color-mix(in srgb, var(--asc-ink) 22%, transparent);
  transition: background .2s ease;
}
.asc-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .25s cubic-bezier(.2, .9, .3, 1.3);
}
.asc-switch:checked { background: var(--asc-accent); }
.asc-switch:checked::after { transform: translateX(18px); }
.asc-switch:disabled { opacity: .55; cursor: not-allowed; }
.asc-switch:focus-visible { outline: 2px solid var(--asc-accent); outline-offset: 2px; }

.asc-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.asc-btn {
  font: inherit; font-size: .88rem; font-weight: 600; line-height: 1; cursor: pointer;
  padding: 11px 16px; border-radius: 999px; border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.asc-btn[hidden] { display: none; }
.asc-btn:hover { transform: translateY(-1px); }
.asc-btn:active { transform: translateY(0) scale(.98); }
.asc-btn:focus-visible { outline: 2px solid var(--asc-accent); outline-offset: 2px; }
.asc-btn--primary {
  background: var(--asc-ink); color: var(--asc-paper);
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--asc-ink) 60%, transparent);
}
.asc-btn--primary:hover { background: color-mix(in srgb, var(--asc-ink) 85%, var(--asc-accent)); }
.asc-btn--ghost { background: transparent; color: var(--asc-ink); border-color: color-mix(in srgb, var(--asc-ink) 18%, transparent); }
.asc-btn--ghost:hover { background: color-mix(in srgb, var(--asc-ink) 6%, transparent); }

/* Small floating cookie after a choice */
.asc-reopen {
  position: fixed; z-index: 99998; bottom: 16px; left: 16px;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid color-mix(in srgb, #000 10%, transparent);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  background: color-mix(in srgb, var(--wp--preset--color--base, #fff) 85%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px -6px rgb(0 0 0 / .3);
  opacity: .75; transition: opacity .2s ease, transform .2s ease;
  animation: asc-pop .4s cubic-bezier(.2, .9, .3, 1.4);
}
.asc-reopen--right { left: auto; right: 16px; }
.asc-reopen:hover, .asc-reopen:focus-visible { opacity: 1; transform: rotate(-12deg) scale(1.06); }
.asc-reopen[hidden] { display: none; }

@keyframes asc-wiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-14deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } }
@keyframes asc-pop { from { transform: scale(.4); opacity: 0; } }

@media (max-width: 480px) {
  .asc { bottom: 12px; left: 12px; right: 12px; }
  .asc-actions .asc-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .asc-card, .asc-switch, .asc-switch::after, .asc-btn, .asc-reopen { transition: none; animation: none; }
  .asc.is-open .asc-icon { animation: none; }
}
