/* Photo contest pages (list + contest). Scoped under .photo-contest. */

.photo-contest .crumbs a { color: var(--muted); }
.photo-contest .pc-banner { margin-bottom: 16px; }

.photo-contest .pc-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.photo-contest .pc-description,
.photo-contest .pc-nominations-section,
.photo-contest .pc-empty { max-width: 760px; }

.photo-contest .pc-description { font-size: 15px; line-height: 1.6; margin-bottom: 28px; }
.photo-contest .pc-description p + p { margin-top: 10px; }

.photo-contest .pc-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 12px;
}
.photo-contest .pc-section-head h2 { font-size: 22px; font-weight: 600; }
.photo-contest .pc-section-head p { font-size: 13px; color: var(--muted); }

.photo-contest .pc-nominations { list-style: none; padding: 0; overflow: hidden; }
.photo-contest .pc-nomination { padding: 20px 22px; scroll-margin-top: 16px; }
.photo-contest .pc-nomination + .pc-nomination { border-top: 1px solid var(--line); }

.photo-contest .pc-nomination-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.photo-contest .pc-nomination-head h3 { font-size: 17px; font-weight: 600; line-height: 1.3; }
.photo-contest .pc-count {
  flex: none;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.photo-contest .is-full .pc-count {
  padding: 1px 9px;
  border-radius: 999px;
  background: #e7eef7;
  color: var(--primary);
  font-weight: 500;
}
.photo-contest .pc-nomination-descr {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.photo-contest .pc-nomination > .pc-note { margin-top: 12px; }
.photo-contest .pc-vote {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
}
.photo-contest .pc-vote .pc-note { margin: 0; }

.photo-contest .pc-thumbs {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}
.photo-contest .pc-thumb {
  position: relative;
  width: 104px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.photo-contest .pc-thumb img {
  display: block;
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--line-soft);
}
.photo-contest .pc-thumb-link { display: block; border-radius: var(--radius-sm); }
.photo-contest .pc-thumb-link:hover img { opacity: .88; }
.photo-contest .pc-thumb-link:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.photo-contest .pc-thumb .pc-status {
  position: absolute;
  top: 6px;
  left: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7);
  pointer-events: none;
}
.photo-contest .pc-thumb-rejected img { opacity: .45; filter: grayscale(1); }
.photo-contest .pc-delete { color: var(--danger); font-size: 12.5px; font-weight: 400; }

.photo-contest .pc-add { margin-top: 14px; }
.photo-contest .pc-add summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  color: var(--primary-2);
  font-size: 14px;
  font-weight: 500;
}
.photo-contest .pc-add summary::-webkit-details-marker { display: none; }
.photo-contest .pc-add summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e7eef7;
  color: var(--primary);
  font-size: 15px;
  line-height: 1;
}
.photo-contest .pc-add[open] summary::before { content: "−"; }
.photo-contest .pc-add summary:hover { color: var(--primary-dk); }
.photo-contest .pc-add summary:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 3px;
  border-radius: 4px;
}
.photo-contest .pc-add-form {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  max-width: 520px;
}
.photo-contest .pc-add-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.photo-contest .pc-optional { font-weight: 400; color: var(--muted); }
.photo-contest .pc-file { padding: 8px 10px; background: var(--paper-2); }

.photo-contest .pc-login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
}

.photo-contest .pc-status {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.photo-contest .pc-status-pending { background: var(--warn-bg); color: var(--warn); }
.photo-contest .pc-status-approved { background: #eaf4ee; color: var(--success-dk); }
.photo-contest .pc-status-rejected { background: var(--danger-bg); color: var(--danger); }

.photo-contest .pc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.photo-contest .pc-list-item { display: block; color: inherit; text-decoration: none; }
.photo-contest .pc-list-item:hover { border-color: #c7cdd6; }
.photo-contest .pc-list-item h2 { font-size: 18px; font-weight: 600; margin: 8px 0 4px; }

.photo-contest .pc-viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.photo-contest .pc-viewer::backdrop { background: rgba(16, 19, 24, .97); }
.photo-contest .pc-viewer[open] { display: grid; place-items: center; }
.photo-contest .pc-viewer-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 128px);
}
.photo-contest .pc-viewer-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  border-radius: 6px;
  object-fit: contain;
}
.photo-contest .pc-viewer-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}
.photo-contest .pc-viewer-meta { color: rgba(255, 255, 255, .6); }
.photo-contest .pc-viewer-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-family: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.photo-contest .pc-viewer-btn:hover { background: rgba(255, 255, 255, .22); }
.photo-contest .pc-viewer-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.photo-contest .pc-viewer-btn[hidden] { display: none; }
.photo-contest .pc-viewer-close { top: 16px; right: 16px; }
.photo-contest .pc-viewer-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.photo-contest .pc-viewer-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* Moderator sidebar; the page is a single column for everyone else. */
.photo-contest .pc-main { min-width: 0; }
.photo-contest .pc-sidebar .card { margin-bottom: 0; }
.photo-contest .pc-side-pad { padding-top: 10px; }
.photo-contest .pc-pending { font-size: 14px; color: var(--ink-soft); }
.photo-contest .pc-pending strong { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.photo-contest .pc-moderators { scroll-margin-top: 16px; }
.photo-contest .pc-moderators .card-pad { padding-top: 10px; }
.photo-contest .pc-moderators-msg { font-size: 14px; color: var(--success-dk); margin-bottom: 12px; }
.photo-contest .pc-moderators-msg.is-error { color: var(--danger); }
.photo-contest .pc-moderators-list { list-style: none; padding: 0; margin-bottom: 8px; }
.photo-contest .pc-moderators-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  min-width: 0;
}
.photo-contest .pc-moderators-list li > span { min-width: 0; overflow-wrap: anywhere; }
.photo-contest .pc-moderators-list form { flex: none; }
.photo-contest .pc-moderators-list li + li { border-top: 1px solid var(--line-soft); }
.photo-contest .pc-moderators-meta { display: block; color: var(--muted); overflow-wrap: anywhere; }
.photo-contest .pc-moderators-remove {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}
.photo-contest .pc-moderators-remove:hover { color: var(--danger); }
.photo-contest .pc-moderators-add {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.photo-contest .pc-moderators-add .btn { justify-content: center; }

@media (max-width: 600px) {
  .photo-contest .pc-nomination { padding: 16px; }
  .photo-contest .pc-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .photo-contest .pc-thumb,
  .photo-contest .pc-thumb img { width: 100%; }
  .photo-contest .pc-thumb img { height: auto; aspect-ratio: 1; }
  .photo-contest .pc-add-form { padding: 14px 12px; }
  .photo-contest .pc-viewer-figure { max-width: calc(100vw - 24px); }
  .photo-contest .pc-viewer-img { max-height: calc(100vh - 160px); }
  .photo-contest .pc-viewer-prev,
  .photo-contest .pc-viewer-next { top: auto; bottom: 16px; transform: none; }
  .photo-contest .pc-add-actions .btn,
  .photo-contest .pc-login .btn { width: 100%; }
}

/* Results: justified rows. Tiles of a row grow by the same factor and keep
   their photo's ratio, so the row gets taller instead of cropping. */
.photo-contest .pc-thumbs.pc-gallery {
  --row: 220px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px;
  margin-top: 0;
}
/* Soaks up the free space so the last row keeps the natural tile widths. */
.photo-contest .pc-thumbs.pc-gallery::after { content: ""; flex-grow: 999; }
.photo-contest .pc-gallery .pc-thumb-link {
  position: relative;
  flex-grow: calc(var(--w) / var(--h));
  flex-basis: calc(var(--w) / var(--h) * var(--row));
  aspect-ratio: var(--w) / var(--h);
  border-radius: 0;
  overflow: hidden;
  background: var(--line-soft);
}
.photo-contest .pc-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-contest .pc-medal {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.photo-contest .pc-medal-1 { background: #f6d77a; }
.photo-contest .pc-medal-2 { background: #dfe3e8; }
.photo-contest .pc-medal-3 { background: #ecc39b; }

.photo-contest .pc-thumbs.pc-top { --row: 160px; margin-top: 14px; }
.photo-contest .pc-results-link { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 500; }

.pc-results .pc-results-title { font-size: 20px; font-weight: 600; margin: 20px 0 14px; }
.pc-results .pc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.pc-results .pc-tab {
  padding: 10px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.pc-results .pc-tab:hover { color: var(--ink); }
.pc-results .pc-tab.is-active { color: var(--ink); border-bottom-color: var(--primary-2); }

@media (max-width: 600px) {
  .photo-contest .pc-thumbs.pc-gallery { --row: 120px; display: flex; gap: 3px; }
  .photo-contest .pc-thumbs.pc-top { --row: 100px; }
  .photo-contest .pc-medal { top: 4px; left: 4px; width: 22px; height: 22px; font-size: 12px; }
  .pc-results .pc-tab { padding: 8px 10px; font-size: 13px; }
}
