/* ERHML: photographer badges + the curator "Photographers" view
 * ------------------------------------------------------------------
 * Loaded on the public pages (for the inline badge beside a name) and
 * on the console (for the management view). It only adds new pieces;
 * existing classes (.panel, .notice, .lib-search, .empty-state …) come
 * from the site/admin stylesheets. */

:root {
  --badge-green: #11804B;
  --badge-blue: #1E73BE;
  --badge-red: #C0392B;
  --badge-org-ring: #C4CCC6;
}

/* ---- The badge mark itself (shared, public + console) ---- */
.erhml-badge {
  display: inline-block;
  vertical-align: -0.17em;
  flex: 0 0 auto;
  line-height: 0;
}
/* Beside a photographer's name in the viewer / list, leave a hair of space. */
#vAuthor .erhml-badge { vertical-align: -0.2em; margin-left: 0.1em; }
.list-col.author .erhml-badge { vertical-align: -0.16em; }

/* ---- Hover tooltip for badges ---- */
.erhml-badge-tip {
  position: relative;
  display: inline-flex;
  line-height: 0;
  vertical-align: -0.17em;
  cursor: help;
}
.erhml-badge-tip > .erhml-badge { vertical-align: 0; }
.erhml-badge-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  width: max-content;
  max-width: 230px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #16201b;
  color: #fff;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  letter-spacing: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.45);
  z-index: 50;
}
.erhml-badge-tip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #16201b;
  opacity: 0;
  transition: opacity 0.14s ease;
  pointer-events: none;
}
.erhml-badge-tip:hover::after,
.erhml-badge-tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.erhml-badge-tip:hover::before,
.erhml-badge-tip:focus-visible::before { opacity: 1; }
.erhml-badge-tip:focus-visible { outline: 2px solid var(--badge-green); outline-offset: 2px; border-radius: 4px; }
/* Keep tooltip on screen near the right edge of a page */
.erhml-badge-tip[data-tip-side="left"]::after { left: auto; right: 0; transform: translate(0, 4px); }
.erhml-badge-tip[data-tip-side="left"]:hover::after { transform: translate(0, 0); }

/* ======================= Console: Photographers ======================= */

/* ---- Badge key / legend ---- */
.badge-key { margin-bottom: 20px; }
.badge-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 22px;
}
.badge-legend li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 50, 35, 0.1);
  border-radius: 12px;
  background: rgba(17, 128, 75, 0.02);
}
.badge-legend-mark { display: inline-flex; line-height: 0; }
.badge-legend-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.badge-legend-text b { font-size: 0.94rem; }
.badge-legend-text span { font-size: 0.8rem; color: #5a665e; line-height: 1.35; }
.badge-legend-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(20, 50, 35, 0.08);
  color: #2f3a34;
}

/* ---- Toolbar (search) ---- */
.authors-toolbar { margin: 4px 0 16px; }
.lib-search.mini { max-width: 420px; }

/* ---- The grid of photographers ---- */
.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.author-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(20, 50, 35, 0.12);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(20, 50, 35, 0.04);
}
@media (prefers-reduced-motion: no-preference) {
  .author-card.animate {
    animation: authorIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 28ms);
  }
  @keyframes authorIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}

.author-id { display: flex; align-items: center; gap: 11px; }
.author-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.08rem;
  color: #fff;
  background: linear-gradient(135deg, #2f7a53, #11804b);
  overflow: hidden;
}
.author-avatar.has-pic { background: #eef2ef; }
.author-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.avatar-upload {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
}
.avatar-upload:hover .author-avatar { filter: brightness(0.9); }
.avatar-upload:focus-within { outline: 2px solid var(--badge-green); outline-offset: 2px; }
.avatar-upload-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--badge-green);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}
.avatar-upload-edit .icon { width: 11px; height: 11px; stroke-width: 2.2; }
.avatar-upload:hover .avatar-upload-edit { transform: scale(1.08); }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--badge-green);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.linklike:hover { color: #0a5d36; }
.linklike.danger { color: #b3261e; margin-left: 14px; }
.linklike.danger:hover { color: #7f1a15; }
.author-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.author-name {
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.author-sub { font-size: 0.8rem; color: #5a665e; }

.author-badge-now {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2f3a34;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
  background: rgba(20, 50, 35, 0.06);
}
.author-badge-now.none { color: #8a948d; font-weight: 500; padding-left: 10px; }

/* ---- The chooser ---- */
.badge-choose {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}
.badge-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #41504a;
  background: #f2f5f2;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 5px 11px 5px 9px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
}
.badge-opt .erhml-badge { margin: 0; }
.badge-opt:hover { background: #e8ede9; }
.badge-opt:active { transform: translateY(1px); }
.badge-opt:focus-visible { outline: 2px solid var(--badge-green); outline-offset: 2px; }

.badge-opt-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #b4beb7;
  display: inline-block;
}
.badge-opt-dot.big { width: 26px; height: 26px; border-width: 2.5px; }

/* Selected states, tinted to each badge. */
.badge-opt.on { color: #fff; }
.badge-opt[data-set=""].on { background: #3a4a42; border-color: #3a4a42; color: #fff; }
.badge-opt[data-set=""].on .badge-opt-dot { border-color: #fff; }
.badge-opt.b-verified.on { background: var(--badge-green); border-color: var(--badge-green); }
.badge-opt.b-top.on { background: var(--badge-blue); border-color: var(--badge-blue); }
.badge-opt.b-partner.on { background: var(--badge-red); border-color: var(--badge-red); }
.badge-opt.b-org.on { background: #566; border-color: #566; }

.author-foot { margin-top: auto; padding-top: 2px; }

/* Keep the console view comfortable on small screens. */
@media (max-width: 560px) {
  .author-grid { grid-template-columns: 1fr; }
  .author-id { flex-wrap: wrap; }
  .author-badge-now { order: 3; }
}