/* ==========================================================================
   FND Connect — Raffles module
   Self-contained styling for the public raffle pages. Uses the brand tokens
   defined in styles.css (:root). Loaded only on /raffles pages.
   ========================================================================== */

.raffle-page {
  background: var(--panel);
}

/* --- Hero (no background photo — brand gradient only) --------------------- */
.raffle-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(120% 140% at 85% -10%, rgba(237, 43, 123, 0.55), transparent 55%),
    linear-gradient(135deg, var(--fnd-deep-navy), var(--fnd-navy) 60%, #4a0f33);
  border-bottom: 1px solid rgba(0, 43, 95, 0.2);
}

.raffle-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.6;
}

.raffle-hero .wrap {
  padding: clamp(2.4rem, 6vw, 4rem) var(--gutter, 24px);
  max-width: var(--max);
  margin: 0 auto;
}

.raffle-hero .eyebrow {
  color: var(--fnd-rose);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.raffle-hero h1 {
  color: var(--white);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.05;
  margin: 0.4rem 0 0.6rem;
}

.raffle-hero .lead {
  color: rgba(255, 255, 255, 0.88);
  max-width: 640px;
  font-size: clamp(1.02rem, 2vw, 1.18rem);
}

.raffle-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.6rem;
}

.raffle-hero-meta div {
  display: flex;
  flex-direction: column;
}

.raffle-hero-meta strong {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.raffle-hero-meta span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 0.3rem;
}

/* --- Section scaffold ----------------------------------------------------- */
.raffle-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter, 24px);
}

.raffle-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.raffle-section-head h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  color: var(--fnd-navy);
  margin: 0;
}

.raffle-section-head p {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

/* --- Card grid ------------------------------------------------------------ */
.raffle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.raffle-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 43, 95, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a.raffle-card,
.raffle-card a {
  text-decoration: none;
  color: inherit;
}

.raffle-card.is-open:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 44px rgba(0, 43, 95, 0.14);
  border-color: rgba(201, 0, 90, 0.4);
}

.raffle-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--fnd-navy);
  text-align: center;
  margin: 0;
  padding: 1rem 1rem 0.6rem;
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.raffle-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fbfcfe, #eef3f9);
  padding: 0.75rem;
}

.raffle-card-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.raffle-card-media .raffle-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--fnd-navy);
  color: var(--white);
  font-size: 2rem;
}

.raffle-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.raffle-state {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--fnd-navy);
}

.raffle-amount {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--fnd-magenta);
  line-height: 1;
}

.raffle-amount-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: -0.2rem;
}

.raffle-winner {
  font-style: italic;
  color: var(--muted);
  font-size: 0.9rem;
}

.raffle-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.raffle-card-meta strong {
  color: var(--ink);
}

/* --- Progress bar --------------------------------------------------------- */
.raffle-progress {
  height: 10px;
  border-radius: 999px;
  background: #e6ecf3;
  overflow: hidden;
}

.raffle-progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fnd-navy), var(--fnd-magenta));
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.raffle-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

/* --- Countdown ------------------------------------------------------------ */
.raffle-countdown {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 800;
  color: var(--fnd-navy);
  font-variant-numeric: tabular-nums;
}

.raffle-countdown .unit {
  background: var(--pale);
  color: var(--fnd-magenta);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  font-size: 0.9rem;
}

.raffle-countdown.is-ended {
  color: var(--muted);
}

/* --- Card CTA / footer button -------------------------------------------- */
.raffle-card-cta {
  display: block;
  text-align: center;
  font-weight: 800;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--white);
  color: var(--fnd-magenta);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
}

.raffle-card.is-open .raffle-card-cta {
  background: linear-gradient(135deg, var(--fnd-magenta), #a8004d);
  color: var(--white);
  border-top: none;
}

.raffle-card.is-open:hover .raffle-card-cta {
  background: var(--fnd-navy);
}

.raffle-card-cta.is-disabled {
  color: var(--muted);
  background: var(--panel);
  cursor: default;
}

/* --- Corner ribbon -------------------------------------------------------- */
.raffle-ribbon {
  position: absolute;
  top: 14px;
  right: -34px;
  transform: rotate(45deg);
  width: 140px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  padding: 0.32rem 0;
  background: linear-gradient(135deg, #d11f4f, #a8004d);
  box-shadow: 0 6px 14px rgba(168, 0, 77, 0.35);
  z-index: 2;
}

.raffle-ribbon.is-muted {
  background: linear-gradient(135deg, #6b7890, #4b5670);
  box-shadow: 0 6px 14px rgba(75, 86, 112, 0.3);
}

.raffle-empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: var(--white);
}

/* --- Single raffle layout ------------------------------------------------- */
.raffle-single {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: start;
}

.raffle-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 43, 95, 0.06);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.raffle-panel + .raffle-panel {
  margin-top: 1.25rem;
}

.raffle-prize-media {
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, #fbfcfe, #eef3f9);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  margin-bottom: 1.25rem;
}

.raffle-prize-media img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.raffle-aside {
  position: sticky;
  top: calc(var(--anchor-offset, 120px) - 28px);
}

.raffle-price-tag {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.raffle-price-tag b {
  font-size: 2.1rem;
  color: var(--fnd-magenta);
  line-height: 1;
}

.raffle-price-tag span {
  color: var(--muted);
}

/* Quantity stepper */
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.qty-stepper button {
  width: 44px;
  border: none;
  background: var(--panel);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--fnd-navy);
  cursor: pointer;
}

.qty-stepper button:hover {
  background: var(--pale);
  color: var(--fnd-magenta);
}

.qty-stepper input {
  width: 64px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  -moz-appearance: textfield;
}

.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.raffle-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border-radius: 10px;
}

.raffle-total-row strong {
  font-size: 1.4rem;
  color: var(--fnd-navy);
}

.raffle-field {
  display: block;
  margin-bottom: 0.85rem;
}

.raffle-field span {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--ink);
}

.raffle-field input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.raffle-field input:focus {
  outline: none;
  border-color: var(--fnd-magenta);
  box-shadow: 0 0 0 3px rgba(201, 0, 90, 0.12);
}

.raffle-consent {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.7rem;
}

.raffle-consent input {
  margin-top: 0.2rem;
}

.raffle-btn {
  display: inline-flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.6rem;
  border: 2px solid var(--fnd-magenta);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--fnd-magenta), #a8004d);
  color: var(--white);
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
}

.raffle-btn:hover {
  background: var(--fnd-navy);
  border-color: var(--fnd-navy);
}

.raffle-btn.secondary {
  background: var(--white);
  color: var(--fnd-magenta);
}

.raffle-btn.secondary:hover {
  color: var(--white);
}

/* Free-entry callout */
.raffle-free-card {
  border: 1px solid rgba(0, 94, 184, 0.25);
  border-left: 6px solid var(--nhs-blue);
  background: var(--pale-blue);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}

.raffle-free-card h3 {
  margin: 0 0 0.5rem;
  color: var(--fnd-navy);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.raffle-free-card .pill {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--nhs-blue);
  color: var(--white);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

.raffle-address {
  font-weight: 700;
  color: var(--ink);
  background: var(--white);
  border: 1px dashed rgba(0, 94, 184, 0.4);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
}

.raffle-where-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 10px;
  background: var(--pale);
  border-left: 4px solid var(--fnd-magenta);
}

.raffle-where-box strong {
  color: var(--fnd-magenta);
}

/* Banner / notices */
.raffle-banner {
  max-width: var(--max);
  margin: 1.25rem auto 0;
  padding: 0 var(--gutter, 24px);
}

.raffle-note {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  background: var(--pale-blue);
  border: 1px solid rgba(0, 94, 184, 0.2);
  color: var(--text);
}

.raffle-result-banner {
  border-radius: 14px;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--fnd-navy), #4a0f33);
  color: var(--white);
  text-align: center;
}

.raffle-result-banner h2 {
  color: var(--white);
  margin: 0 0 0.4rem;
}

/* Order page */
.raffle-order-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.raffle-order-status.paid { background: #e6f6ec; color: #1c7a43; }
.raffle-order-status.pending { background: var(--pale); color: var(--fnd-magenta); }
.raffle-order-status.cancelled,
.raffle-order-status.refunded { background: #eef0f4; color: var(--muted); }

.raffle-bank {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.raffle-bank li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}

.raffle-bank li:last-child { border-bottom: none; }
.raffle-bank li:nth-child(odd) { background: var(--panel); }

.raffle-bank .label { color: var(--muted); }
.raffle-bank .value { font-weight: 700; color: var(--ink); }

.raffle-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--fnd-navy);
}

.raffle-copy:hover { border-color: var(--fnd-magenta); color: var(--fnd-magenta); }

.raffle-tickets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.raffle-ticket-chip {
  background: var(--fnd-navy);
  color: var(--white);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .raffle-single {
    grid-template-columns: 1fr;
  }
  .raffle-aside {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  .raffle-card,
  .raffle-progress > span {
    transition: none;
  }
}

/* ==========================================================================
   "Alive" / movement layer — live badges, ticking countdown, shimmer.
   ========================================================================== */

@keyframes raffle-pulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 0, 90, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(201, 0, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 0, 90, 0); }
}

@keyframes raffle-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes raffle-shimmer {
  0% { background-position: -180% 0; }
  100% { background-position: 180% 0; }
}

@keyframes raffle-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Live pill (single raffle aside) */
.raffle-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.raffle-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fnd-magenta);
  background: var(--pale);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}

.raffle-live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fnd-magenta);
  animation: raffle-blink 1.4s ease-in-out infinite;
}

.raffle-entries-headline {
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

.raffle-entries-headline strong {
  font-size: 1.4rem;
  color: var(--fnd-magenta);
  font-variant-numeric: tabular-nums;
}

/* Live ribbon on open cards (corner) */
.raffle-ribbon.is-live {
  background: linear-gradient(135deg, #2e8b57, #14794a);
  box-shadow: 0 6px 14px rgba(20, 121, 74, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.raffle-ribbon.is-live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c6ffd9;
  animation: raffle-blink 1.4s ease-in-out infinite;
}

/* Shimmer sweep across an active progress bar */
.raffle-progress[data-shimmer] > span {
  position: relative;
  overflow: hidden;
}

.raffle-progress[data-shimmer] > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: raffle-shimmer 2.4s linear infinite;
}

/* Countdown — big ticking units */
.raffle-countdown-box {
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--fnd-deep-navy), var(--fnd-navy));
  color: var(--white);
  text-align: center;
}

.raffle-countdown-box .cd-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.45rem;
}

/* On the dark countdown box, the numbers/labels must be white — otherwise
   they inherit the magenta used on light card backgrounds and clash. */
.raffle-countdown-box .raffle-countdown .unit {
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
}

.raffle-countdown-box .raffle-countdown .unit b {
  color: var(--white);
}

.raffle-countdown-box .raffle-countdown .unit i {
  color: rgba(255, 255, 255, 0.72);
}

.raffle-countdown {
  display: inline-flex;
  gap: 0.4rem;
  align-items: stretch;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.raffle-countdown .unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  min-width: 44px;
}

.raffle-countdown .unit b {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.raffle-countdown .unit i {
  font-style: normal;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
  margin-top: 0.2rem;
}

/* Compact countdown inside card meta rows: its own full-width line, four
   even blocks with the label stacked above the number so it never overflows. */
.raffle-card-meta .raffle-countdown {
  width: 100%;
  margin-top: 0.5rem;
  gap: 0.3rem;
  justify-content: space-between;
}

.raffle-card-meta .raffle-countdown .unit {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.05rem;
  background: var(--pale);
  color: var(--fnd-magenta);
  border-radius: 8px;
  padding: 0.28rem 0.1rem;
}

.raffle-card-meta .raffle-countdown .unit b { font-size: 0.95rem; }
.raffle-card-meta .raffle-countdown .unit i { font-size: 0.5rem; margin: 0; opacity: 0.8; }

.raffle-countdown.is-ended {
  color: var(--muted);
  font-weight: 700;
}

/* CTA nudge on open cards */
.raffle-card.is-open .raffle-card-cta {
  position: relative;
}

.raffle-card.is-open:hover .raffle-card-cta {
  animation: raffle-pop 0.5s ease;
}

/* ==========================================================================
   Homepage "Current raffles" band
   ========================================================================== */
.home-raffles {
  background:
    radial-gradient(120% 140% at 90% -20%, rgba(237, 43, 123, 0.12), transparent 55%),
    var(--panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.home-raffles .wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter, 24px);
}

.home-raffles-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.home-raffles-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: var(--fnd-navy);
  margin: 0;
}

.home-raffles-head p {
  color: var(--muted);
  margin: 0.3rem 0 0;
}

/* Nav highlight for the Raffles menu item */
.site-nav a.nav-raffles {
  color: var(--fnd-magenta);
  font-weight: 800;
}

.site-nav a.nav-raffles::before {
  content: "🎟️";
  margin-right: 0.3rem;
}

@media (prefers-reduced-motion: reduce) {
  .raffle-live .dot,
  .raffle-ribbon.is-live .dot,
  .raffle-progress[data-shimmer] > span::after,
  .raffle-card.is-open:hover .raffle-card-cta {
    animation: none;
  }
}
