/* ui/BlueprintVote — the Review card in Daily Ops: the blueprint fully built, its name and
   "by <creator>", deny and approve as drawn marks, three pips, the Quanta earned and pending.
   Contract: ./BlueprintVote.spec.md. No words but the name and the credit (Jackson,
   docs/blueprints.md §8.1). Tokens only (ui/Theme C8). */

.sp-vote {
  --glow: var(--sp-accent);
  display: grid;
  gap: 10px;
  padding: 12px;
  color: var(--sp-text);
  background:
    radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--glow) 14%, transparent), transparent 64%),
    color-mix(in srgb, var(--sp-space-1) 84%, transparent);
  border: 1px solid var(--sp-line-strong);
  border-radius: var(--sp-radius);
  pointer-events: auto;
}

.sp-vote[data-state='done'] {
  padding: 10px 12px;
  background: color-mix(in srgb, var(--sp-space-1) 84%, transparent);
}

.sp-vote__stage {
  position: relative;
  border-radius: var(--sp-radius-sm);
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--glow) 10%, transparent), transparent 70%);
}

.sp-vote__art {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
}

.sp-vote__title {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
}

.sp-vote__name {
  max-width: 100%;
  overflow: hidden;
  font: 700 18px/1.2 var(--sp-font-display);
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-vote__by {
  max-width: 100%;
  overflow: hidden;
  font: 500 13px/1.2 var(--sp-font-ui);
  color: var(--sp-text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-vote__buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sp-vote__button {
  --tone: var(--sp-up);
  position: relative;
  display: grid;
  place-items: center;
  min-height: 56px;
  padding: 0;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 10%, var(--sp-space-2));
  border: 1px solid color-mix(in srgb, var(--tone) 55%, var(--sp-line-strong));
  border-radius: var(--sp-radius);
  cursor: pointer;
  transition: background var(--sp-dur-fast) var(--sp-ease-out), box-shadow var(--sp-dur) var(--sp-ease-out), transform var(--sp-dur-fast) var(--sp-ease-out), opacity var(--sp-dur-fast) var(--sp-ease-out);
}

.sp-vote__button--reject {
  --tone: var(--sp-danger);
}

.sp-vote__button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--tone) 18%, var(--sp-space-2));
  box-shadow: 0 0 var(--sp-glow-lg) color-mix(in srgb, var(--tone) 30%, transparent);
  transform: translateY(-1px);
}

.sp-vote__button:active:not(:disabled) {
  transform: scale(0.97);
}

.sp-vote__button:focus-visible {
  outline: 2px solid var(--sp-accent-2);
  outline-offset: 3px;
}

.sp-vote__button:disabled {
  cursor: default;
  opacity: 0.45;
}

.sp-vote__button[data-chosen='true'] {
  opacity: 1;
  background: color-mix(in srgb, var(--tone) 26%, var(--sp-space-2));
  box-shadow: 0 0 var(--sp-glow-lg) color-mix(in srgb, var(--tone) 45%, transparent);
}

/* The marks: a check and a cross, drawn, never written. */
.sp-vote__mark {
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
}

.sp-vote__button--approve .sp-vote__mark::before {
  content: '';
  position: absolute;
  left: 7px;
  top: -2px;
  width: 11px;
  height: 22px;
  border: solid currentColor;
  border-width: 0 4px 4px 0;
  border-radius: 2px;
  transform: rotate(45deg);
}

.sp-vote__button--reject .sp-vote__mark::before,
.sp-vote__button--reject .sp-vote__mark::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.sp-vote__button--reject .sp-vote__mark::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.sp-vote__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
}

.sp-vote__pips {
  display: flex;
  gap: 8px;
}

/* A pip's state is a shape as well as a colour. */
.sp-vote__pip {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-sizing: border-box;
}

.sp-vote__pip[data-state='open'] {
  border: 1px solid var(--sp-line-strong);
}

.sp-vote__pip[data-state='pending'] {
  border: 2px solid var(--sp-quanta);
  animation: sp-vote-breathe 2.1s var(--sp-ease-out) infinite;
}

.sp-vote__pip[data-state='matched'] {
  background: var(--sp-quanta);
  box-shadow: 0 0 var(--sp-glow-sm) color-mix(in srgb, var(--sp-quanta) 60%, transparent);
}

.sp-vote__pip[data-state='missed'] {
  border: 1px solid var(--sp-text-faint);
}

.sp-vote__pip[data-state='missed']::after {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--sp-text-faint);
  transform: translateY(-50%) rotate(-45deg);
}

@keyframes sp-vote-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sp-vote__quanta {
  display: flex;
  gap: 6px;
}

.sp-vote__chip {
  padding: 2px 8px;
  font: 600 13px/1.4 var(--sp-font-mono);
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  white-space: nowrap;
}

.sp-vote__chip[data-state='earned'] {
  color: var(--sp-quanta);
  background: color-mix(in srgb, var(--sp-quanta) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sp-quanta) 60%, transparent);
}

.sp-vote__chip[data-state='pending'] {
  color: var(--sp-text-dim);
  border: 1px dashed color-mix(in srgb, var(--sp-quanta) 45%, var(--sp-line-strong));
}

/* The Daily Ops station: a bigger stage and the buttons under it. */
.sp-vote[data-variant='station'] {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas: 'stage title' 'stage buttons' 'stage foot';
  align-items: center;
  gap: 12px 18px;
  padding: 16px;
}

.sp-vote[data-variant='station'] .sp-vote__stage { grid-area: stage; }
.sp-vote[data-variant='station'] .sp-vote__title { grid-area: title; align-self: end; }
.sp-vote[data-variant='station'] .sp-vote__buttons { grid-area: buttons; }
.sp-vote[data-variant='station'] .sp-vote__foot { grid-area: foot; align-self: start; }
.sp-vote[data-variant='station'] .sp-vote__name { font-size: 22px; }
.sp-vote[data-variant='station'] .sp-vote__button { min-height: 64px; }

.sp-vote[data-variant='station'][data-state='done'] {
  grid-template-columns: 1fr;
  grid-template-areas: 'foot';
}

@media (max-width: 600px) {
  .sp-vote[data-variant='station'] {
    grid-template-columns: 1fr;
    grid-template-areas: 'stage' 'title' 'buttons' 'foot';
    padding: 12px;
  }

  .sp-vote__button {
    min-height: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sp-vote__pip[data-state='pending'] {
    animation: none;
  }

  .sp-vote__button {
    transition: none;
  }

  .sp-vote__button:hover:not(:disabled),
  .sp-vote__button:active:not(:disabled) {
    transform: none;
  }
}

/* The stages of the blueprint under review: a button a stage, under the picture. */
.sp-vote__stages {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-top: 6px;
}

.sp-vote__stage-pick {
  min-height: 32px;
  padding: 0 10px;
  color: var(--sp-text-dim);
  font: 600 12px/1 var(--sp-font-ui);
  background: transparent;
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius-sm);
  cursor: pointer;
}

.sp-vote__stage-pick[aria-pressed='true'] {
  color: var(--sp-text);
  border-color: var(--sp-accent);
}
