/* ============================================================================
 * Jury area styling.
 * Reuses .admin-body chrome from admin.css for header/buttons/flash,
 * adds blind-gallery grid, single-submission viewer, star-rating control,
 * results list. Mobile-first; the gallery and form sit comfortably at 375 px.
 * ==========================================================================*/

.jury-body { /* same chrome as admin */ }

.jury-count {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.muted { color: var(--ink-mute); }

.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;
}

/* ---------- gallery grid (index) ---------- */
.jury-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .jury-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 920px) {
  .jury-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
}

.jury-tile {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
}
.jury-tile:hover { border-color: var(--ink-mute); }
.jury-tile.is-rated { border-color: var(--moss); }
[data-theme="dark"] .jury-tile.is-rated { border-color: var(--moss-bright); }
.jury-tile.is-own { border-style: dashed; border-color: var(--umber); }
.jury-tile.is-own .jury-tile-image { opacity: 0.78; }

.jury-tile-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.jury-tile-frame {
  position: relative;
  background: var(--rule-soft);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.jury-tile-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.jury-tile-empty {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.jury-tile-index {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.55);
  color: #f4ede0;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.jury-tile-own {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--umber);
  color: #f4ede0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.jury-tile-meta {
  padding: 0.7rem 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.jury-tile-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 0.98rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jury-tile-score {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.jury-tile-score strong { color: var(--moss-deep); font-weight: 500; }
[data-theme="dark"] .jury-tile-score strong { color: var(--moss-bright); }
.jury-tile-score .muted { letter-spacing: 0.2em; }

/* ---------- show page ---------- */
.jury-show-head h1 {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.jury-pos {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 400;
}

.jury-criteria {
  margin: 0;
  padding-left: 1.1rem;
  max-width: 50ch;
  color: var(--ink-mute);
  font-size: 0.9rem;
  line-height: 1.5;
}
.jury-criteria li + li { margin-top: 0.15rem; }

.jury-pager {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.jury-show {
  display: grid;
  gap: 2rem;
}
@media (min-width: 960px) {
  .jury-show {
    grid-template-columns: minmax(0, 2fr) 21rem;
    align-items: start;
  }
}

.jury-images {
  display: grid;
  gap: 1rem;
}
.jury-figure {
  margin: 0;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
}
.jury-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.jury-sidebar {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem;
  position: sticky;
  top: 5rem;
  display: grid;
  gap: 1.25rem;
}
@media (max-width: 959px) {
  .jury-sidebar { position: static; }
}

.jury-meta {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 0.85rem;
  font-size: 0.88rem;
}
.jury-meta dt {
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  align-self: center;
}
.jury-meta dd { margin: 0; color: var(--ink); }

/* ---------- star rating control ---------- */
.rating-form { display: grid; gap: 1rem; }

.rating-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.rating-form label {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.rating-form textarea {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.7rem 0.85rem;
  width: 100%;
  min-height: 5rem;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color .15s ease, background .15s ease;
}
.rating-form textarea:focus {
  outline: none;
  border-color: var(--moss-bright);
  background: var(--bg-elev);
}

.rating-form .hint {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin: 0;
}

.star-field {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.star-field legend {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 0;
}

.star-input {
  display: flex;
  flex-direction: row-reverse;   /* DOM is 5..1, displays as 1..5 */
  justify-content: flex-end;
  gap: 0.15rem;
}
.star-input input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px; height: 1px;
}
.star-label {
  cursor: pointer;
  padding: 0.25rem;
  color: rgba(38, 40, 25, 0.16);
  transition: color .12s ease, transform .12s ease;
  font-size: 0; /* hide the sr-only span sizing */
  text-transform: none;
  letter-spacing: 0;
}
.star-icon {
  width: 2.1rem;
  height: 2.1rem;
  fill: currentColor;
  display: block;
}
@media (min-width: 540px) {
  .star-icon { width: 1.85rem; height: 1.85rem; }
}

/* hovered star + all stars after it (= lower scores in DOM order, since row-reverse) */
.star-input .star-label:hover,
.star-input .star-label:hover ~ .star-label {
  color: var(--moss);
  transform: scale(1.12);
}
/* checked star + all later siblings (lower scores). Yellow rather than a
   moss tone: on the cream background any olive sat too close to the faint
   placeholder stars to read as "voted". */
.star-input input[type="radio"]:checked ~ .star-label {
  color: var(--star);
}
[data-theme="dark"] .star-label { color: var(--ink-faint); }
/* keyboard focus ring around the star you're tabbing through */
.star-input input[type="radio"]:focus-visible + .star-label {
  outline: 2px solid var(--moss-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

.rating-form .form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* autosave feedback; empty (and so invisible) until the first save */
.rating-form .rating-status { min-height: 1.2em; }

/* the reset button lives outside .rating-form (see show.html.erb) */
.rating-reset form { margin: 0.6rem 0 0; }

/* ---------- voting closed ---------- */
.jury-notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--moss);
  border-radius: 4px;
  background: var(--bg-elev);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.rating-closed {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1rem;
  background: var(--bg-elev);
}
.rating-closed h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.rating-closed p {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.rating-closed p:last-child { margin-bottom: 0; }
.rating-closed-own strong {
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--moss-bright);
}
.rating-closed-note {
  border-left: 2px solid var(--rule);
  padding-left: 0.7rem;
  font-style: italic;
}

/* ---------- own entry: visible to the jury, not votable ---------- */
.rating-conflict { border-left: 3px solid var(--umber); }
.rating-conflict form { margin: 0; }

/* ---------- results release (admins only) ---------- */
.results-release {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}
.results-release form { margin: 0; }
.results-release-state {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
}
.results-release .hint {
  margin: 0;
  max-width: 34ch;
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.status-pill.released { color: var(--moss-deep); border-color: var(--moss); }
[data-theme="dark"] .status-pill.released { color: var(--moss-bright); border-color: var(--moss-bright); }
.status-pill.withheld { color: var(--umber); border-color: var(--umber); }

/* ---------- results list ---------- */
.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  counter-reset: rank;
}
.result-row {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.75rem 0.85rem;
  display: grid;
  grid-template-columns: auto 80px 1fr auto;
  align-items: center;
  gap: 0.75rem;
}
@media (max-width: 540px) {
  .result-row {
    grid-template-columns: auto 64px 1fr;
    grid-template-areas:
      "rank thumb meta"
      "rank thumb score";
    row-gap: 0.25rem;
  }
  .result-row .result-score { grid-area: score; justify-self: start; }
}

.result-rank {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.6rem;
  color: var(--ink-mute);
  width: 2.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.result-thumb-link {
  display: block;
  width: 80px;
  height: 60px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--rule-soft);
}
@media (max-width: 540px) {
  .result-thumb-link { width: 64px; height: 48px; }
}
.result-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.result-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.result-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-title:hover { color: var(--moss-deep); }
[data-theme="dark"] .result-title:hover { color: var(--moss-bright); }

.result-sub {
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}
.result-avg {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--ink);
}
.result-avg-max {
  font-size: 0.8rem;
  color: var(--ink-mute);
}
