/* ============================================================================
   VOTE PAGE — premium carousel redesign
   ----------------------------------------------------------------------------
   Hand-maintained stylesheet (like mcdermott.css — no build step required).
   Loaded only by page-vote.hbs via {{asset "built/vote.css"}}.

   Sections:
     1.  Page shell
     2.  Hero
     3.  Carousel stage & cards
     4.  Card internals
     5.  Vote button
     6.  Arrows & progress
     7.  Empty state
     8.  Extra content (FAQ / prose below the table)
     9.  Page-load choreography
     10. Responsive
     11. Reduced motion
   ============================================================================ */


/* ---------------------------------------------------------------------------
   1. PAGE SHELL
   Layout only — the page sits on the theme's original background.
--------------------------------------------------------------------------- */

.vote-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 90px max(4vmin, 20px) 90px;
  color: var(--txtWhite);
}


/* ---------------------------------------------------------------------------
   2. HERO
--------------------------------------------------------------------------- */

.vote-hero {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 0 10px;
  text-align: left;
}

/* Optional feature image: fixed full-screen backdrop, soft vignette
   fading out to the screen edges */
.vote-hero-media {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  opacity: 0.35;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000 30%, transparent 75%);
  mask-image: radial-gradient(70% 70% at 50% 50%, #000 30%, transparent 75%);
}

.vote-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Same look as .article-title on regular pages (rules etc.) */
.vote-hero-title {
  margin: 0;
  font-size: clamp(3.2rem, 5vw, 5.2rem);
  font-weight: 800;
  line-height: 1.05;
  color: #fff;
}

.vote-hero-subtitle {
  max-width: 560px;
  margin: 20px 0 0;
  font-size: 1.7rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
}


/* ---------------------------------------------------------------------------
   3. CAROUSEL STAGE & CARDS
   Cards are absolutely stacked; JS assigns each a signed offset (-1, 0, +1)
   from the active card via [data-pos]. CSS transitions do all the motion.
--------------------------------------------------------------------------- */

.vote-carousel {
  position: relative;
  max-width: 1080px;
  margin: 76px auto 0;
  outline: none;
}

.vote-carousel:focus-visible {
  box-shadow: 0 0 0 2px rgba(147, 203, 252, 0.5);
  border-radius: 24px;
}

.vote-stage {
  position: relative;
  height: 560px;
  perspective: 1400px;
  /* Horizontal swipes are ours; vertical scrolling still works */
  touch-action: pan-y;
}

.vote-card {
  position: absolute;
  top: 0;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(400px, 84vw);
  height: 100%;
  padding: 34px 34px 30px;
  text-align: center;

  /* Frosted glass */
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.025) 55%, rgba(147, 203, 252, 0.04) 100%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 26px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  /* Layered lighting */
  box-shadow:
    0 30px 60px -24px rgba(0, 0, 0, 0.65),
    0 4px 18px -6px rgba(0, 0, 0, 0.35);

  opacity: 0;
  transform: translateX(-50%) scale(0.9);
  transform-style: preserve-3d;
  pointer-events: none;
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.45s ease,
    filter 0.55s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;
  will-change: transform, opacity;
}

/* Top highlight hairline — gives the glass its lit edge */
.vote-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  border-radius: 50em;
}

/* --- Positions (set by JS) --- */

.vote-card[data-pos="0"] {
  z-index: 3;
  opacity: 1;
  filter: none;
  transform: translateX(-50%) translateZ(0) scale(1);
  pointer-events: auto;
}

.vote-card[data-pos="-1"],
.vote-card[data-pos="1"] {
  z-index: 2;
  opacity: 0.22;
  filter: blur(5px) saturate(0.7);
  pointer-events: none;
}

.vote-card[data-pos="-1"] {
  transform: translateX(calc(-50% - 58%)) scale(0.82) rotateY(7deg);
}

.vote-card[data-pos="1"] {
  transform: translateX(calc(-50% + 58%)) scale(0.82) rotateY(-7deg);
}

/* Cards beyond the immediate neighbours: parked offstage, invisible */
.vote-card[data-pos="off"] {
  z-index: 1;
  opacity: 0;
  filter: blur(4px);
  transform: translateX(-50%) scale(0.7);
  pointer-events: none;
}

/* Mouse tilt is applied by JS as an inline custom property pair */
.vote-card[data-pos="0"] {
  --tiltX: 0deg;
  --tiltY: 0deg;
  transform: translateX(-50%) perspective(1100px) rotateX(var(--tiltX)) rotateY(var(--tiltY)) scale(1);
}

/* While tilting, transform follows the cursor quickly; the slow
   spring transition only applies to carousel position changes */
.vote-card.is-tilting {
  transition:
    transform 0.15s ease-out,
    opacity 0.45s ease,
    filter 0.55s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

/* One-time swipe hint on touch devices (JS adds .vote-hint-nudge) */
@keyframes voteNudge {
  0%, 100% { transform: translateX(-50%) perspective(1100px) rotateX(0deg) rotateY(0deg) scale(1); }
  35%      { transform: translateX(calc(-50% - 22px)) perspective(1100px) rotateX(0deg) rotateY(0deg) scale(1); }
  70%      { transform: translateX(calc(-50% + 10px)) perspective(1100px) rotateX(0deg) rotateY(0deg) scale(1); }
}

.vote-card.vote-hint-nudge {
  animation: voteNudge 0.95s ease-in-out 1;
}


/* ---------------------------------------------------------------------------
   4. CARD INTERNALS
--------------------------------------------------------------------------- */

.vote-card-name {
  margin: 0;
  font-family: 'Rajdhani', 'Nunito', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #fff;
}

.vote-card-desc {
  margin: 6px 0 0;
  font-size: 1.4rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.6);
}

.vote-card-hr {
  width: 100%;
  height: 1px;
  margin: 20px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

/* Logo area — one fixed square so every site's logo sits in the
   same-sized box. Favicons can be soft; drop a 512px image in the
   Logo column of the table for a crisp one. */
.vote-card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 148px;
  height: 148px;
  margin: 0 auto;
  padding: 10px;
}

.vote-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
}

/* Monogram fallback (JS swaps this in when no logo loads) */
.vote-card-monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  font-family: 'Rajdhani', 'Nunito', sans-serif;
  font-size: 3.4rem;
  font-weight: 700;
  color: var(--dark1);
  background: linear-gradient(150deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 20px;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}

/* Reward + cooldown meta row */
.vote-card-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.vote-card-reward {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: 'Rajdhani', 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #dff0ff;
  background: linear-gradient(120deg, rgba(147, 203, 252, 0.16) 0%, rgba(51, 125, 154, 0.22) 100%);
  border: 1px solid rgba(147, 203, 252, 0.3);
  border-radius: 50em;
}

.vote-card-reward svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.vote-card-cooldown {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50em;
}

.vote-card-cooldown svg {
  width: 13px;
  height: 13px;
}


/* ---------------------------------------------------------------------------
   5. VOTE BUTTON
--------------------------------------------------------------------------- */

.vote-card-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
  padding: 15px 26px;
  overflow: hidden;

  font-family: 'Rajdhani', 'Nunito', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--dark1);

  background: linear-gradient(120deg, var(--primary) 0%, #b3dcff 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.55);

  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.vote-card-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.vote-card-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.6);
}

.vote-card-btn:hover svg {
  transform: translateX(4px);
}

.vote-card-btn:active {
  transform: translateY(0);
}

.vote-card-btn:focus-visible {
  outline: none;
  box-shadow:
    0 12px 28px -12px rgba(0, 0, 0, 0.55),
    0 0 0 3px var(--dark1),
    0 0 0 6px var(--primary);
}

/* Voted state — set by JS while the site's cooldown is running */
.vote-card-btn.is-voted,
.vote-card-btn.is-voted:hover {
  transform: none;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  cursor: default;
}

.vote-card-btn.is-voted svg {
  transform: none;
  color: var(--primary);
}

.vote-card-btn-timer {
  font-weight: 600;
  opacity: 0.75;
}


/* ---------------------------------------------------------------------------
   6. ARROWS & PROGRESS
--------------------------------------------------------------------------- */

.vote-arrow {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  color: rgba(255, 255, 255, 0.75);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}

.vote-arrow svg {
  width: 20px;
  height: 20px;
}

.vote-arrow:hover {
  color: #fff;
  border-color: rgba(147, 203, 252, 0.5);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.6);
}

.vote-arrow-prev { left: 6px; }
.vote-arrow-next { right: 6px; }

.vote-arrow-prev:hover { transform: translateY(-50%) translateX(-3px); }
.vote-arrow-next:hover { transform: translateY(-50%) translateX(3px); }

.vote-arrow:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--dark1), 0 0 0 6px var(--primary);
}

.vote-progress {
  margin-top: 34px;
  font-family: 'Rajdhani', 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.vote-progress-current {
  color: var(--primary);
}

.vote-progress-sep,
.vote-progress-total {
  color: rgba(255, 255, 255, 0.35);
}

/* Screen-reader-only live region */
.vote-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ---------------------------------------------------------------------------
   7. EMPTY STATE
--------------------------------------------------------------------------- */

.vote-empty {
  max-width: 460px;
  margin: 76px auto 0;
  padding: 48px 32px;
  text-align: center;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 22px;
}

.vote-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  color: rgba(255, 255, 255, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.vote-empty-icon svg {
  width: 24px;
  height: 24px;
}

.vote-empty-title {
  margin: 0 0 6px;
  font-family: 'Rajdhani', 'Nunito', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.vote-empty-text {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.45);
}


/* ---------------------------------------------------------------------------
   8. EXTRA CONTENT (anything written below the table in Ghost)
--------------------------------------------------------------------------- */

.vote-extra {
  max-width: 720px;
  margin: 80px auto 0;
  padding-top: 48px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.vote-extra h2,
.vote-extra h3,
.vote-extra h4 {
  color: #fff;
}

.vote-extra p,
.vote-extra li {
  color: rgba(255, 255, 255, 0.65);
}

/* --- Vote ranks -------------------------------------------------------------
   Rendered from an HTML card the admin pastes below the vote table:
   <div class="vote-ranks"> with an <ol class="vote-ranks-list"> of
   <li class="vote-rank"> items (votes + body). Kept deliberately plain
   so it reads like the rest of the page's content, not a feature card.
--------------------------------------------------------------------------- */

.vote-ranks-sub {
  margin: 10px 0 0;
  font-size: 1.5rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}

.vote-ranks-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

.vote-rank {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 0 20px;
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.vote-rank:first-child {
  border-top: none;
}

.vote-rank-votes {
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.vote-rank-votes b {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  color: var(--primary);
}

.vote-rank-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vote-rank-name {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: #fff;
}

.vote-rank-perks {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.62);
}


/* ---------------------------------------------------------------------------
   9. PAGE-LOAD CHOREOGRAPHY (pure CSS)
--------------------------------------------------------------------------- */

@keyframes voteRise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes voteFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.vote-hero {
  animation: voteRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.vote-carousel,
.vote-empty {
  animation: voteFade 0.8s ease 0.2s both;
}


/* ---------------------------------------------------------------------------
   10. RESPONSIVE
--------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .vote-stage { height: 540px; }

  .vote-card[data-pos="-1"] { transform: translateX(calc(-50% - 52%)) scale(0.8) rotateY(7deg); }
  .vote-card[data-pos="1"]  { transform: translateX(calc(-50% + 52%)) scale(0.8) rotateY(-7deg); }
}

@media (max-width: 768px) {
  .vote-page { padding-top: 64px; }

  .vote-stage { height: 520px; }

  /* Neighbours tuck closer on small screens */
  .vote-card[data-pos="-1"] { transform: translateX(calc(-50% - 34%)) scale(0.76) rotateY(7deg); opacity: 0.15; }
  .vote-card[data-pos="1"]  { transform: translateX(calc(-50% + 34%)) scale(0.76) rotateY(-7deg); opacity: 0.15; }

  /* Ranks: narrower vote-count column on small screens */
  .vote-rank { grid-template-columns: 88px 1fr; }
  .vote-rank-votes b { font-size: 1.9rem; }

  /* Arrows shrink but stay visible */
  .vote-arrow {
    width: 42px;
    height: 42px;
  }

  .vote-arrow svg {
    width: 17px;
    height: 17px;
  }

  .vote-arrow-prev { left: 2px; }
  .vote-arrow-next { right: 2px; }
}

@media (max-width: 560px) {
  .vote-hero { padding-top: 24px; }
  .vote-hero-subtitle { font-size: 1.5rem; }
  .vote-stage { height: 500px; }
  .vote-card { padding: 26px 22px 24px; }
  .vote-card-name { font-size: 1.9rem; }
  .vote-progress { margin-top: 26px; }
}


/* ---------------------------------------------------------------------------
   11. REDUCED MOTION
--------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .vote-hero,
  .vote-carousel,
  .vote-empty {
    animation: none !important;
  }

  .vote-card,
  .vote-card-btn,
  .vote-card-btn svg,
  .vote-arrow {
    transition-duration: 0.01s !important;
  }
}
