/* ==========================================================================
   Cookie consent: circular prompt, floating cookie button, privacy options
   ========================================================================== */

/* ----- Circular prompt (echoes the hero sun) ----- */

.consent-bubble {
  --diameter: min(400px, calc(100vw - 32px));

  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: max(24px, env(safe-area-inset-left, 0px));
  z-index: 70;
  display: grid;
  place-items: center;
  width: var(--diameter);
  height: var(--diameter);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--saffron), var(--terracotta) 62%, var(--rust));
  color: var(--espresso);
  box-shadow: 0 30px 80px rgba(42, 26, 20, 0.45), inset 0 0 0 10px rgba(246, 238, 227, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: scale(0) rotate(-120deg);
  transform-origin: 15% 85%;
  transition: transform 0.7s var(--ease-spring), opacity 0.3s;
}

.consent-bubble.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.consent-bubble.is-visible .consent-bubble__content {
  animation: rise 0.5s 0.35s ease-out both;
}

.consent-bubble__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  animation: spin 22s linear infinite;
}

.consent-bubble__content {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 70%;
  text-align: center;
}

.consent-bubble h4 {
  font-size: clamp(26px, 8vw, 34px);
  line-height: 0.9;
}

.consent-bubble h4 span {
  color: var(--cream);
}

.consent-bubble p {
  font-size: clamp(12.5px, 3.5vw, 14px);
  line-height: 1.4;
}

.consent-bubble__gpc {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(42, 26, 20, 0.14);
  font-size: 12px;
  font-weight: 700;
}

.consent-bubble__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.consent-bubble__actions button {
  flex: 1;
  padding: 11px 8px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.consent-choice--primary {
  background: var(--espresso);
  color: var(--cream);
}

.consent-choice--secondary {
  background: var(--cream);
  color: var(--espresso);
}

.consent-choice--primary:hover {
  background: var(--cream);
  color: var(--espresso);
}

.consent-choice--secondary:hover {
  background: var(--espresso);
  color: var(--cream);
}

/* ----- Floating cookie button (after a choice) ----- */

.consent-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: max(24px, env(safe-area-inset-left, 0px));
  z-index: 65;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--saffron), var(--terracotta) 68%);
  box-shadow: 0 12px 30px rgba(42, 26, 20, 0.38);
  transform: scale(0) rotate(-180deg);
  transition: transform 0.55s var(--ease-spring);
}

.consent-fab.is-visible {
  transform: none;
}

/* Hidden while the footer is on screen (it has its own cookie links)
   and while the bag drawer is open (it would cover the checkout). */
.consent-fab.is-tucked,
body.bag-is-open .consent-fab {
  transform: scale(0) rotate(120deg);
}

.consent-fab:focus-visible {
  outline-offset: 4px;
}

.consent-fab__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: spin 12s linear infinite;
}

.consent-fab:hover .consent-fab__ring {
  animation-duration: 4s;
}

.consent-fab__icon {
  width: 34px;
  height: 34px;
  background: var(--espresso);
  -webkit-mask: url("../assets/icons/cookie.svg") center / contain no-repeat;
  mask: url("../assets/icons/cookie.svg") center / contain no-repeat;
  animation: bob 3s ease-in-out infinite;
}

.consent-fab:hover .consent-fab__icon {
  animation: nibble 0.6s ease-in-out;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%      { transform: translateY(-3px) rotate(8deg); }
}

@keyframes nibble {
  30%  { transform: rotate(-20deg) scale(1.12); }
  65%  { transform: rotate(14deg) scale(1.12); }
  100% { transform: none; }
}

/* ----- Privacy choices dialog ----- */

.demo-region {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.demo-region select {
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--espresso);
  font: 13px var(--font-body);
  letter-spacing: 0;
  text-transform: none;
}

.privacy-option {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.privacy-option b {
  font-size: 15px;
}

.privacy-option p {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Toggle switch built on a real checkbox */
.switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--line);
  pointer-events: none;
  transition: background-color 0.2s;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.switch input:checked + span {
  background: var(--terracotta);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:disabled + span {
  opacity: 0.55;
}

.switch input:focus-visible + span {
  outline: 3px solid var(--saffron);
  outline-offset: 2px;
}

/* ----- Responsive ----- */

@media (max-width: 520px) {
  .consent-bubble {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: calc(50% - var(--diameter) / 2);
    transform-origin: 50% 100%;
  }

  .consent-bubble__content {
    width: 74%;
    gap: 8px;
  }

  .consent-fab {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    width: 66px;
    height: 66px;
  }

  .consent-fab__icon {
    width: 28px;
    height: 28px;
  }
}
