/* Photo mysteries (#425) — "who is this?" on a photo, and the one gentle
   place where every open question waits.

   Two visual states on the marker:
     - OPEN mystery  → a warm terracotta "?" badge, always visible, on every
       surface the photo appears on. It's a question the family is asking, so
       it never hides behind a hover.
     - ASK affordance → quiet and dark, revealed on hover/focus on a mouse, and
       ALWAYS visible on a touch viewport (MOBILE/TOUCH PARITY RULE — there is
       no hover to reveal it with). */

.mystery-marker {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  padding: 0;
  line-height: 1;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-surface);
  background-color: rgba(28, 25, 23, 0.62);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background-color var(--transition-fast),
    transform var(--transition-fast);
}

/* The ask affordance follows the same reveal as the remove button, so a photo
   cell has one hover behaviour rather than two. */
.panel__photo-cell:hover .mystery-marker,
.panel__moment-photo-cell:hover .mystery-marker,
.panel__story-photo-cell:hover .mystery-marker,
.mystery-marker:focus-visible {
  opacity: 1;
}

.mystery-marker:hover {
  background-color: rgba(28, 25, 23, 0.85);
  transform: scale(1.08);
}

.mystery-marker:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* An open question is never hidden — everyone sees it, on every surface. */
.mystery-marker--open {
  opacity: 1;
  background-color: var(--color-highlight-hover);
  box-shadow: 0 0 0 2px var(--color-surface);
}

.mystery-marker--open:hover {
  background-color: var(--color-highlight);
}

/* The read-only badge (a <span> on the reading surfaces, and everything a
   viewer sees) is a marker, not a control: no pointer, no hover lift. */
span.mystery-marker {
  display: block;
  cursor: default;
  text-align: center;
  line-height: 22px;
}

span.mystery-marker:hover {
  transform: none;
  background-color: var(--color-highlight-hover);
}

@media (prefers-reduced-motion: reduce) {
  .mystery-marker {
    transition: opacity var(--transition-fast);
  }

  .mystery-marker:hover {
    transform: none;
  }
}

@media (hover: none) and (pointer: coarse) {
  button.mystery-marker {
    /* No hover to reveal it with, so the ask affordance is always there — but
       quieter than an open question, since it sits on every photo at once. */
    opacity: 1;
    width: 26px;
    height: 26px;
    background-color: rgba(28, 25, 23, 0.45);
    touch-action: manipulation;
  }

  .mystery-marker--open {
    background-color: var(--color-highlight-hover);
  }

  /* The thumb needs 44px; the photograph needs the space. Grow the *hit area*,
     not the badge — a 44px disc covers nearly half a phone-width thumbnail. */
  button.mystery-marker::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    transform: translate(-50%, -50%);
  }
}

/* ---- the ask dialog ---- */

.mystery-ask__intro {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-loose);
  margin-bottom: var(--space-md);
}

/* ---- the Family mysteries surface ---- */

.mysteries__intro {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
}

.mysteries__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.mysteries__row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface-elevated);
}

.mysteries__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  /* Letterboxed like the panel gallery: a face shouldn't lose its forehead to
     a square crop in the one surface that exists to identify it. */
  background-color: var(--color-surface-alt);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.mysteries__text {
  flex: 1 1 auto;
  min-width: 0;
}

.mysteries__question {
  font-family: var(--font-serif);
  font-size: var(--font-size-md);
  color: var(--color-text);
  margin-bottom: var(--space-xxs);
}

.mysteries__where {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.mysteries__actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
}

.mysteries__empty {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
}

.mysteries__empty-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-lg);
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.mysteries__empty-hint {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-loose);
  max-width: 42ch;
  margin: 0 auto;
}

/* Narrow viewports: the row stacks so the question keeps its line length and
   the actions stay full-width thumb targets instead of a cramped column. */
@media (max-width: 560px) {
  .mysteries__row {
    flex-wrap: wrap;
  }

  /* Fill the space beside the thumbnail rather than claiming the content
     width and wrapping under it. */
  .mysteries__text {
    flex: 1 1 0;
  }

  .mysteries__actions {
    flex: 1 1 100%;
    flex-direction: row;
  }

  .mysteries__actions .btn {
    flex: 1 1 auto;
  }
}
