/* Reader-vote contest page. Loaded only by sites/niche/contest/ContestPage.jsx;
   colors and type come from the site's --np-* tokens. The scene and object
   art come from the backend; parts tagged lights / beam / beacon react here. */

.np-contest {
  padding-bottom: 5rem;
}

/* Wide enough for a one-line title on desktop; the intro keeps a reading width. */
.np-contest-head {
  max-width: 56rem;
  margin: 0 auto;
  padding-top: 1rem;
  text-align: center;
}

.np-contest-intro {
  max-width: 42rem;
  margin: 0.75rem auto 0;
  color: var(--np-ink-soft);
  font-family: var(--np-body);
  font-size: 1.1rem;
  line-height: 1.5;
}

.np-contest-meta {
  margin: 0.9rem 0 0;
  text-align: center;
  font-family: var(--np-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--np-muted);
}

.np-contest-dot {
  display: inline-block;
  margin-right: 0.5rem;
  vertical-align: 0.05em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2fb35d;
}

.np-contest-note {
  margin: 0.75rem 0 0;
  text-align: center;
  font-family: var(--np-sans);
  font-size: 0.95rem;
  color: var(--np-muted);
}

.np-contest-note.is-error {
  color: var(--np-accent);
}

/* stage: scene left, chips + panel right */

.np-contest-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
  column-gap: 2.5rem;
  align-items: center;
  padding: 0.75rem 0;
}

.np-contest-scene {
  position: relative;
  perspective: 1100px;
  touch-action: manipulation;
}

.np-contest-scene-in {
  position: relative;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out;
}

.np-contest-scene-in > svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--np-sans);
}

.np-contest-scene-in::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 0.55), transparent 32%);
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 0.3s;
}

.np-contest-scene[data-live] .np-contest-scene-in::after {
  opacity: 1;
}

/* objects */

.np-contest-object {
  cursor: pointer;
  outline: none;
}

/* Accent parts of any object take the nominee's colour; without one the art keeps its own fill. */
.np-contest-object.has-accent .accent {
  fill: var(--np-object-accent);
}

.np-contest-object.has-accent .accent-dark {
  fill: color-mix(in srgb, var(--np-object-accent) 75%, black);
}

.np-contest-object.has-accent .accent-light {
  fill: color-mix(in srgb, var(--np-object-accent) 80%, white);
}

.np-contest-object-move,
.np-contest-object-lift {
  transition: transform 0.55s cubic-bezier(0.3, 1.25, 0.5, 1);
}

.np-contest-object-lift {
  transition-duration: 0.3s;
}

.np-contest-object.is-hover .np-contest-object-lift,
.np-contest-object.is-selected .np-contest-object-lift {
  transform: translateY(-9px);
}

.np-contest-object .beam {
  opacity: 0;
  transition: opacity 0.35s;
}

.np-contest-object.is-hover .beam,
.np-contest-object.is-selected .beam {
  opacity: 0.6;
}

.np-contest-object .lights {
  transition: filter 0.3s;
}

.np-contest-object.is-hover .lights,
.np-contest-object.is-selected .lights,
.np-contest-object.is-rev .lights {
  filter: brightness(1.15) drop-shadow(0 0 4px #ffe680);
}

.np-contest-object.is-selected:not(.is-mine) .beacon {
  animation: np-contest-blink 0.5s steps(2, jump-none) infinite;
}

.np-contest-object.is-rev .np-contest-object-lift {
  animation: np-contest-rev 0.9s ease-out;
}

@keyframes np-contest-blink {
  50% { opacity: 0.25; }
}

@keyframes np-contest-rev {
  0% { transform: none; }
  18% { transform: translateY(-8px); }
  34% { transform: none; }
  50% { transform: translateY(-4px); }
  66%, 100% { transform: none; }
}

/* name tags over objects */

.np-contest-tag {
  position: absolute;
  transform: translate(-50%, calc(-100% - 6px));
  pointer-events: none;
  white-space: nowrap;
  padding: 6px 8px;
  background: rgb(255 255 255 / 0.92);
  border: 1px solid var(--np-rule);
  color: var(--np-ink);
  font-family: var(--np-sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  transition: left 0.55s cubic-bezier(0.3, 1.25, 0.5, 1), top 0.55s cubic-bezier(0.3, 1.25, 0.5, 1), background 0.2s, color 0.2s, transform 0.3s;
}

.np-contest-tag::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: inherit;
  border-right: 1px solid var(--np-rule);
  border-bottom: 1px solid var(--np-rule);
  transform: translateX(-50%) rotate(45deg);
}

.np-contest-tag.is-hot {
  background: var(--np-ink);
  border-color: var(--np-ink);
  color: var(--np-paper);
  transform: translate(-50%, calc(-100% - 14px));
}

.np-contest-tag.is-mine {
  background: var(--np-accent);
  border-color: var(--np-accent);
  color: var(--np-paper);
}

.np-contest-tag.is-hot::after,
.np-contest-tag.is-mine::after {
  border-color: inherit;
}

/* intro cue */

.np-contest-cue {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgb(255 255 255 / 0.82) 0%, rgb(255 255 255 / 0.55) 55%, transparent 80%);
  transition: opacity 0.6s ease;
}

.np-contest-cue.is-gone {
  opacity: 0;
}

.np-contest-cue-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 12px;
  background: var(--np-paper);
  border: 1px solid var(--np-rule);
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.16);
  font-family: var(--np-sans);
  font-size: 1.1rem;
  color: var(--np-ink);
  animation: np-contest-cue-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  transition: transform 0.6s ease;
}

.np-contest-cue.is-gone .np-contest-cue-card {
  transform: translateY(-8px);
}

.np-contest-cue-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--np-ink);
  color: var(--np-paper);
}

.np-contest-cue-icon svg {
  animation: np-contest-tap 1.4s ease-in-out infinite;
}

@keyframes np-contest-cue-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
}

@keyframes np-contest-tap {
  0%, 100% { transform: translate(0, 0); }
  45% { transform: translate(-2px, -4px); }
  60% { transform: translate(0, 1px) scale(0.88); }
}

/* chips and panel */

.np-contest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.np-contest-chip {
  border: 1px solid var(--np-rule);
  border-radius: 0;
  background: var(--np-paper);
  color: var(--np-ink);
  padding: 9px 14px;
  font-family: var(--np-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.np-contest-chip[aria-pressed="true"] {
  border-color: var(--np-ink);
  background: var(--np-ink);
  color: var(--np-paper);
}

.np-contest-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 250px;
  padding: 20px 22px;
  border: 1px solid var(--np-rule);
  background: var(--np-paper);
}

.np-contest-close {
  display: none;
}

.np-contest-empty {
  margin: 0;
  text-align: center;
  font-family: var(--np-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--np-muted);
}

.np-contest-card:not([hidden]) {
  animation: np-contest-up 0.35s ease-out;
}

@keyframes np-contest-up {
  from { opacity: 0; transform: translateY(8px); }
}

.np-contest-logo {
  display: block;
  max-width: 180px;
  max-height: 56px;
  margin: 0 0 12px;
}

.np-contest-name {
  margin: 0 0 4px;
  font-family: var(--np-serif);
  font-weight: var(--np-headline-weight);
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--np-ink);
}

.np-contest-subtitle {
  margin: 0 0 10px;
  font-family: var(--np-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--np-muted);
}

.np-contest-fact {
  margin: 0 0 6px;
  font-family: var(--np-body);
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--np-ink-soft);
}

.np-contest-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
}

.np-root .np-contest-links a {
  font-family: var(--np-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--np-accent);
  text-decoration: none;
}

.np-contest-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--np-rule);
}

.np-contest-today {
  font-family: var(--np-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--np-muted);
}

.np-contest-today.is-zero {
  color: var(--np-accent);
}

.np-contest-badge {
  padding: 6px 10px;
  background: var(--np-accent);
  color: var(--np-paper);
  font-family: var(--np-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.np-contest-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0;
  background: var(--np-ink);
  color: var(--np-paper);
  padding: 14px 22px;
  font-family: var(--np-sans);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, transform 0.1s;
}

.np-contest-btn:hover:not(:disabled),
.np-contest-btn.is-done {
  background: var(--np-accent);
}

.np-contest-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.np-contest-btn:disabled {
  background: var(--np-shade);
  color: var(--np-muted);
  cursor: default;
}

.np-contest-btn:focus-visible,
.np-contest-chip:focus-visible {
  outline: 2px solid var(--np-accent);
  outline-offset: 2px;
}

.np-contest-share-url {
  box-sizing: border-box;
  width: 100%;
  margin-top: 0.6rem;
  border: 1px solid var(--np-rule);
  border-radius: 0;
  background: var(--np-paper);
  color: var(--np-ink);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
}

.np-contest-turnstile {
  position: fixed;
  left: 50%;
  bottom: 6rem;
  z-index: 60;
  transform: translateX(-50%);
}

.np-contest-rules {
  max-width: 46rem;
  margin-top: 2.25rem;
  font-family: var(--np-sans);
  color: var(--np-muted);
}

.np-contest-rules h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--np-ink);
}

.np-contest-rules ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.np-root .np-contest-rules a {
  color: var(--np-accent);
  text-decoration: underline;
}

/* phones and narrow tablets: scene full width, panel as a bottom sheet */

@media (max-width: 860px) {
  .np-contest-stage {
    grid-template-columns: 1fr;
    padding-top: 0.25rem;
  }

  .np-contest-scene {
    margin: 0 calc(-1 * var(--np-gutter));
  }

  .np-contest-chips {
    justify-content: center;
  }

  .np-contest-panel {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 0;
    border: 0;
    border-top: 1px solid var(--np-rule);
    box-shadow: 0 -10px 30px rgb(0 0 0 / 0.18);
    padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(105%);
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.05);
  }

  .np-contest-panel.is-open {
    transform: none;
  }

  .np-contest-close {
    display: block;
    position: absolute;
    right: 10px;
    top: 8px;
    border: 0;
    background: none;
    padding: 6px 10px;
    font-size: 26px;
    line-height: 1;
    color: var(--np-muted);
    cursor: pointer;
  }

  .np-contest-name {
    padding-right: 32px;
    font-size: 1.25rem;
  }
}

@media (max-width: 600px) {
  .np-contest-cue-card {
    gap: 11px;
    padding: 12px 16px 12px 12px;
    font-size: 1.02rem;
  }

  .np-contest-cue-icon {
    width: 38px;
    height: 38px;
  }

  .np-contest-tag {
    padding: 5px 6px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .np-contest *,
  .np-contest *::before,
  .np-contest *::after {
    animation: none !important;
    transition: none !important;
  }
}
