/* ══════════════════════════════════════════════════════════════════════════
   THE HALLOWEEN WHEEL OF FORTUNE (js/wheel.js) — opens from the cart's Checkout
   button while the owner has the Halloween look on (admin.html → Holidays), and
   the order wins a discount. A night card above the cart: the wheel, a
   candy-corn pointer, a jack-o'-lantern hub. Always dark, whatever the site's
   theme, as the Regatta window was always navy.

   Its own file rather than a block in css/holidays.css, which must never style
   the cart's form or payment buttons (tests/holiday-css.test.mjs). Nothing here
   shows unless the wheel exists, or the cart marks its Checkout button and its
   discount line for it.
   ══════════════════════════════════════════════════════════════════════════ */
html.wheel-open,
html.wheel-open body { overflow: hidden; }

.wheel-dialog {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-cart) + 20);
  display: grid;
  place-items: center;
  padding: 16px;
}
.wheel-dialog[hidden] { display: none; }
.wheel-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 4, 22, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.wheel-dialog__card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 30px 24px 20px;
  border-radius: 28px;
  text-align: center;
  color: #f6eefc;
  font-family: var(--font-body);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 122, 26, 0.22), transparent 60%),
    linear-gradient(170deg, #3d1a63 0%, #241038 52%, #140920 100%);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.55), 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.wheel-dialog__card:focus { outline: none; }
/* A cobweb in the top corner. */
.wheel-dialog__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 112px;
  height: 112px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M0 0L140.0 0.0M0 0L129.3 53.6M0 0L99.0 99.0M0 0L53.6 129.3M0 0L0.0 140.0M18.0 0.0Q15.2 3.0 16.6 6.9Q12.9 8.6 12.7 12.7Q8.6 12.9 6.9 16.6Q3.0 15.2 0.0 18.0M36.0 0.0Q30.4 6.0 33.3 13.8Q25.7 17.2 25.5 25.5Q17.2 25.7 13.8 33.3Q6.0 30.4 0.0 36.0M56.0 0.0Q47.2 9.4 51.7 21.4Q40.0 26.8 39.6 39.6Q26.8 40.0 21.4 51.7Q9.4 47.2 0.0 56.0M78.0 0.0Q65.8 13.1 72.1 29.8Q55.8 37.3 55.2 55.2Q37.3 55.8 29.8 72.1Q13.1 65.8 0.0 78.0M100.0 0.0Q84.3 16.8 92.4 38.3Q71.5 47.8 70.7 70.7Q47.8 71.5 38.3 92.4Q16.8 84.3 0.0 100.0' fill='none' stroke='%23f6eefc' stroke-width='1.1' stroke-opacity='0.9' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
  opacity: 0.35;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .wheel-dialog__card { animation: wheel-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.2); }
  .wheel-dialog__backdrop { animation: wheel-fade 0.2s ease-out; }
}
@keyframes wheel-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}
@keyframes wheel-fade { from { opacity: 0; } to { opacity: 1; } }

.wheel-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #f6eefc;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--t-fast);
}
.wheel-dialog__close:hover { background: rgba(255, 255, 255, 0.16); }
/* Gone from the moment the wheel turns: the order is on its way (js/wheel.js canLeave). */
.wheel-dialog__close[hidden] { display: none; }

/* Two bats keep the card company. */
.wheel-dialog__bat {
  position: absolute;
  width: 34px;
  height: 17px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50'%3E%3Cpath fill='%230c0514' d='M50 17C52 11 54 9 56 5C56.5 9 57.5 12 59.5 14.5C67 8.5 80 6 96 9C88 13.5 85.5 19.5 87.5 27.5C80 23.5 72.5 25.5 68 31.5C64 27.5 59.5 27.5 55.5 30C53.5 34 51.8 38.5 50 44C48.2 38.5 46.5 34 44.5 30C40.5 27.5 36 27.5 32 31.5C27.5 25.5 20 23.5 12.5 27.5C14.5 19.5 12 13.5 4 9C20 6 33 8.5 40.5 14.5C42.5 12 43.5 9 44 5C46 9 48 11 50 17Z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
}
/* Clear of the title: one over the cobweb, one beside the wheel (no room for it on a phone). */
.wheel-dialog__bat--1 { top: 22px; left: 64px; rotate: -12deg; }
.wheel-dialog__bat--2 { top: 44%; right: 12px; width: 26px; height: 13px; rotate: 10deg; }
@media (max-width: 420px) { .wheel-dialog__bat--2 { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .wheel-dialog__bat--1 { animation: wheel-bat 3.2s ease-in-out infinite; }
  .wheel-dialog__bat--2 { animation: wheel-bat 2.6s ease-in-out -1.1s infinite; }
}
@keyframes wheel-bat {
  0%, 100% { translate: 0 0; scale: 1 1; }
  25%      { scale: 1 0.55; }
  50%      { translate: 4px -6px; scale: 1 1; }
  75%      { scale: 1 0.6; }
}

.wheel-dialog__kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff9a3c;
}
.wheel-dialog__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(1.5rem, 5.4vw, 1.95rem);
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 2px 18px rgba(255, 122, 26, 0.45);
}
.wheel-dialog__sub {
  margin: 8px auto 0;
  max-width: 32ch;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(246, 238, 252, 0.8);
}

/* The wheel: only the rotor turns (js/wheel.js sets its transform); the pointer and hub stay. */
.wheel {
  position: relative;
  width: min(300px, 72vw);
  aspect-ratio: 1;
  margin: 26px auto 6px;
}
.wheel__rotor { position: absolute; inset: 0; will-change: transform; }
.wheel__face {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.5));
}
.wheel__rim { fill: #1a0b29; stroke: #ff7a1a; stroke-width: 2; }
.wheel__edge { fill: none; stroke: rgba(0, 0, 0, 0.35); stroke-width: 1.2; }
.wheel__slice { stroke: #1a0b29; stroke-width: 1.4; stroke-linejoin: round; transition: filter 0.3s; }
.wheel__slice--a { fill: #ff7a1a; }
.wheel__slice--b { fill: #4b2381; }
.wheel__slice--top { fill: #8bd450; }
.wheel__slice.is-win { stroke: #fff6e5; stroke-width: 2.6; filter: brightness(1.18) saturate(1.15); }
.wheel__label { font-family: var(--font-heading); font-weight: 900; font-size: 19px; }
.wheel__off { font-family: var(--font-body); font-weight: 800; font-size: 7.5px; letter-spacing: 0.2em; }
.wheel__label--a { fill: #2a0f3d; }
.wheel__label--b { fill: #ffb067; }
.wheel__label--top { fill: #15260b; }
/* A gift segment's picture (an emoji, drawn by the system's emoji font). */
.wheel__label--icon { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 25px; font-weight: 400; }
.wheel__light { fill: #ffd23f; }
@media (prefers-reduced-motion: no-preference) {
  .wheel-dialog__card[data-state="spinning"] .wheel__light:nth-of-type(odd),
  .wheel-dialog__card[data-state="won"] .wheel__light:nth-of-type(odd) { animation: wheel-blink 0.5s steps(1) infinite; }
  .wheel-dialog__card[data-state="spinning"] .wheel__light:nth-of-type(even),
  .wheel-dialog__card[data-state="won"] .wheel__light:nth-of-type(even) { animation: wheel-blink 0.5s steps(1) 0.25s infinite; }
}
@keyframes wheel-blink { 50% { fill: #6b3aa8; } }

.wheel__pointer {
  position: absolute;
  top: -13px;
  left: 50%;
  z-index: 2;
  width: 32px;
  height: 42px;
  transform: translateX(-50%);
  transform-origin: 50% 25%;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}
.wheel__pointer svg,
.wheel__hub svg { display: block; width: 100%; height: 100%; }
.wheel__hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 23%;
  height: 23%;
  transform: translate(-50%, -50%);
  padding: 4%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #3a1a58, #1a0b29);
  box-shadow: 0 0 0 3px #ff7a1a, 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.4s;
}
.wheel-dialog__card[data-state="won"] .wheel__hub { box-shadow: 0 0 0 3px #ffd23f, 0 0 22px 6px rgba(255, 210, 63, 0.55); }

/* When the wheel stops: pumpkin dots, slime triangles and bats fly out of the hub. */
.wheel__burst { position: absolute; left: 50%; top: 50%; z-index: 3; width: 0; height: 0; pointer-events: none; }
.wheel__bit {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  animation: wheel-bit 1.2s cubic-bezier(0.15, 0.6, 0.3, 1) both;
}
.wheel__bit--0 { border-radius: 50%; background: #ff7a1a; }
.wheel__bit--1 { background: #8bd450; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.wheel__bit--2 { left: -11px; width: 22px; height: 11px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50'%3E%3Cpath fill='%23ffd23f' d='M50 17C52 11 54 9 56 5C56.5 9 57.5 12 59.5 14.5C67 8.5 80 6 96 9C88 13.5 85.5 19.5 87.5 27.5C80 23.5 72.5 25.5 68 31.5C64 27.5 59.5 27.5 55.5 30C53.5 34 51.8 38.5 50 44C48.2 38.5 46.5 34 44.5 30C40.5 27.5 36 27.5 32 31.5C27.5 25.5 20 23.5 12.5 27.5C14.5 19.5 12 13.5 4 9C20 6 33 8.5 40.5 14.5C42.5 12 43.5 9 44 5C46 9 48 11 50 17Z'/%3E%3C/svg%3E") center / contain no-repeat; }
@keyframes wheel-bit {
  from { transform: translate(0, 0) rotate(0deg) scale(0.4); opacity: 1; }
  80%  { opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(1); opacity: 0; }
}

.wheel-dialog__result {
  min-height: 3.4em;
  margin: 8px 0 12px;
  display: grid;
  place-content: center;
  gap: 4px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(246, 238, 252, 0.86);
}
.wheel-dialog__won {
  display: block;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1.15;
  color: #ffd23f;
  text-shadow: 0 2px 16px rgba(255, 122, 26, 0.6);
}
@media (prefers-reduced-motion: no-preference) {
  .wheel-dialog__won { animation: wheel-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
}
@keyframes wheel-pop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: none; }
}
.wheel-dialog__err { color: #ffb4a8; }
.wheel-dialog__total { font-weight: 700; color: #fff; }
/* "Placing your order..." - the order goes by itself a moment after the wheel stops. */
.wheel-dialog__going {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin-top: 6px;
  font-size: 0.9rem;
  color: rgba(246, 238, 252, 0.75);
}
.wheel-dialog__going::before {
  content: '';
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  border: 2px solid rgba(255, 179, 71, 0.35);
  border-top-color: #ffb347;
  animation: wheel-turn 0.8s linear infinite;
}
@keyframes wheel-turn { to { transform: rotate(360deg); } }
/* A pay-at-pickup order is sent the moment the prize is known: by the time it shows, it is in. */
.wheel-dialog__placed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  margin-top: 6px;
  font-weight: 700;
  color: #8bd450;
}
.wheel-dialog__placed::before {
  content: "\2713";
  display: grid;
  place-items: center;
  width: 1.35em;
  height: 1.35em;
  border-radius: 50%;
  background: #8bd450;
  color: #15260b;
  font-size: 0.85em;
  font-weight: 900;
}

/* The prize again on the order confirmation (js/cart.js showOrderConfirmed). */
.order-confirmed__wheel { color: #b8480a; font-weight: 700; }
html[data-theme="dark"] .order-confirmed__wheel { color: #ff9a3c; }

.wheel-dialog__actions { display: grid; gap: 8px; }
.wheel-dialog__btn {
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: #2a0f3d;
  background: linear-gradient(135deg, #ffb347, #ff7a1a 55%, #e8620c);
  box-shadow: 0 8px 22px rgba(255, 122, 26, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.wheel-dialog__btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(255, 122, 26, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.wheel-dialog__btn:active:not(:disabled) { transform: scale(0.98); }
.wheel-dialog__btn:disabled { opacity: 0.75; cursor: progress; }
.wheel-dialog__link {
  justify-self: center;
  padding: 6px 10px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  color: rgba(246, 238, 252, 0.72);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.wheel-dialog__link:hover { color: #fff; }
/* Each sets display (or sits in a grid), so [hidden] needs saying out loud. */
.wheel-dialog__btn[hidden],
.wheel-dialog__link[hidden] { display: none; }
.wheel-dialog__close:focus-visible,
.wheel-dialog__btn:focus-visible,
.wheel-dialog__link:focus-visible { outline: 2px solid #ffd23f; outline-offset: 3px; }

@media (max-height: 640px) {
  .wheel { width: min(230px, 60vw); margin-top: 16px; }
  .wheel-dialog__card { padding-top: 22px; }
}

/* The cart's note while the wheel is still to be spun: placing the order spins it
   (updateWheelNote in js/cart.js). */
.cart-wheel-note {
  margin: 6px 0 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #b8480a;
}
html[data-theme="dark"] .cart-wheel-note { color: #ff9a3c; }
.cart-wheel-note[hidden] { display: none; }
.cart-wheel-note::before,
.cart-summary__discount--wheel span::before {
  content: '';
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.4em;
  vertical-align: -0.2em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 11C20 7 21.5 4 24.5 2' fill='none' stroke='%234a7d22' stroke-width='3' stroke-linecap='round'/%3E%3Cellipse cx='12.5' cy='24.5' rx='9.5' ry='12' fill='%231a0b29'/%3E%3Cellipse cx='27.5' cy='24.5' rx='9.5' ry='12' fill='%231a0b29'/%3E%3Cellipse cx='20' cy='24.5' rx='10' ry='13.5' fill='%232a0f3d'/%3E%3Cpath d='M10.5 20.5l5.5 1.5-4.8 3.6zM29.5 20.5l-5.5 1.5 4.8 3.6z' fill='%23ffd23f'/%3E%3Cpath d='M11 28.5c3 4.6 15 4.6 18 0l-2.6.9-1.8 2.3-2.4-1.7-2.2 2.3-2.2-2.3-2.4 1.7-1.8-2.3z' fill='%23ffd23f'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* The prize in the totals, in the same orange. */
.cart-summary__discount.cart-summary__discount--wheel { color: #b8480a; font-weight: 700; }
html[data-theme="dark"] .cart-summary__discount.cart-summary__discount--wheel { color: #ff9a3c; }
html[data-theme="dark"] .cart-wheel-note::before,
html[data-theme="dark"] .cart-summary__discount--wheel span::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 11C20 7 21.5 4 24.5 2' fill='none' stroke='%234a7d22' stroke-width='3' stroke-linecap='round'/%3E%3Cellipse cx='12.5' cy='24.5' rx='9.5' ry='12' fill='%23e8620c'/%3E%3Cellipse cx='27.5' cy='24.5' rx='9.5' ry='12' fill='%23e8620c'/%3E%3Cellipse cx='20' cy='24.5' rx='10' ry='13.5' fill='%23ff7a1a'/%3E%3Cpath d='M10.5 20.5l5.5 1.5-4.8 3.6zM29.5 20.5l-5.5 1.5 4.8 3.6z' fill='%23ffd23f'/%3E%3Cpath d='M11 28.5c3 4.6 15 4.6 18 0l-2.6.9-1.8 2.3-2.4-1.7-2.2 2.3-2.2-2.3-2.4 1.7-1.8-2.3z' fill='%23ffd23f'/%3E%3C/svg%3E"); }
