/* Avatar editor modal (src/site/avatar-editor.jsx). Loaded by BOTH footyUP.html
   and admin.html, so it's fully self-contained — it relies only on the shared
   design tokens (hero.css), never on site- or admin-only classes. Works in dark
   and light themes via the tokens. */

.av-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
  animation: avFade 0.18s ease-out;
}
@keyframes avFade { from { opacity: 0; } to { opacity: 1; } }

.av-modal {
  width: min(560px, 100%);
  background: var(--ink);
  border: 1px solid var(--bone-faint);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  animation: avIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes avIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.av-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--bone-faint);
}
.av-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 125%;
  font-size: 20px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--bone);
}
.av-title .av-accent { color: var(--accent); font-style: italic; }
.av-x {
  width: 34px; height: 34px;
  flex: none;
  background: transparent;
  border: 1px solid var(--bone-faint);
  color: var(--bone-dim);
  font-size: 14px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: color 0.15s, border-color 0.15s;
}
.av-x:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }

.av-stage {
  position: relative;
  height: min(58vh, 440px);
  background: var(--surface-faint, rgba(244, 241, 235, 0.04));
  overflow: hidden;
}
.av-stage img { display: block; max-width: 100%; }
.av-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--bone-dim);
  pointer-events: none;
}
/* Square frame in the brand accent. */
.av-stage .cropper-view-box { outline: 1px solid var(--accent); outline-color: var(--accent); }
.av-stage .cropper-line, .av-stage .cropper-point { background-color: var(--accent); }

.av-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bone-faint);
}
.av-tool {
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  flex: none;
  background: transparent;
  border: 1px solid var(--bone-faint);
  color: var(--bone);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: grid; place-items: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.av-tool.av-reset { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; margin-left: auto; }
.av-tool:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.av-tool:disabled { opacity: 0.4; cursor: default; }

.av-zoom {
  flex: 1;
  min-width: 80px;
  accent-color: var(--accent);
  cursor: pointer;
}
.av-zoom:disabled { opacity: 0.4; cursor: default; }

.av-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
}
.av-btn {
  height: 42px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #0a0a0a;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.av-btn:hover:not(:disabled) { opacity: 0.88; }
.av-btn:disabled { opacity: 0.5; cursor: default; }
.av-btn.ghost {
  background: transparent;
  border-color: var(--bone-faint);
  color: var(--bone);
}
.av-btn.ghost:hover:not(:disabled) { border-color: var(--bone); opacity: 1; }

@media (max-width: 520px) {
  .av-overlay { padding: 0; }
  .av-modal { width: 100%; height: 100%; max-height: 100vh; }
  .av-stage { height: auto; flex: 1; }
}
