/* ============================================
   Inline editor + admin overlays
   ============================================ */

/* Top admin bar */
.edit-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--gold-deep);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.edit-bar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.edit-status {
  color: var(--gold-soft);
  font-weight: 500;
  letter-spacing: 0.5px;
}
.edit-status.saving { color: var(--gold-soft); }
.edit-status.saved { color: #8acd9e; }
.edit-status.error { color: #d49090; }
.edit-bar-actions { display: flex; gap: 8px; }
.edit-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.edit-btn:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.edit-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }

/* When edit bar is visible, push site content down */
body.has-edit-bar { padding-top: 44px; }

/* Editable elements - active state */
body.edit-mode [data-ck] {
  outline: 1px dashed rgba(212, 167, 71, 0.3);
  outline-offset: 4px;
  cursor: text;
  transition: outline 0.2s, background 0.2s;
  border-radius: 2px;
}
body.edit-mode [data-ck]:hover {
  outline: 1px solid var(--gold);
  background: rgba(212, 167, 71, 0.05);
}
body.edit-mode [data-ck]:focus,
body.edit-mode [data-ck][contenteditable="true"]:focus {
  outline: 2px solid var(--gold);
  background: rgba(212, 167, 71, 0.08);
  box-shadow: 0 0 0 4px rgba(212, 167, 71, 0.1);
}
body.edit-mode [data-ck].dirty {
  outline-color: #d4a747;
  background: rgba(212, 167, 71, 0.06);
}
body.edit-mode [data-ck].just-saved {
  animation: justSaved 1.5s ease;
}
@keyframes justSaved {
  0% { background: rgba(138, 205, 158, 0.2); }
  100% { background: transparent; }
}

/* ============ ADMIN IMAGE ACTIONS ============ */
.gallery-item, .map-card {
  position: relative;
}

/* Image action overlay (only shown in admin mode) */
.img-actions {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}
body.admin-mode .img-actions { display: flex; }

.img-action-btn {
  background: rgba(15, 10, 6, 0.85);
  border: 1px solid var(--gold-deep);
  color: var(--gold-soft);
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-body);
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.img-action-btn:hover {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}

/* Selection checkbox (admin mode) */
.img-select {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: rgba(15, 10, 6, 0.85);
  border: 1.5px solid var(--gold);
  border-radius: 3px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  font-size: 14px;
  color: var(--gold);
  transition: all 0.2s;
}
body.admin-mode .img-select { display: flex; }
.img-select.checked { background: var(--gold); color: var(--bg); }
.img-select.checked::after { content: '✓'; font-weight: 700; }

/* Section toolbar (shown in admin mode above each section's grid) */
.section-toolbar {
  display: flex !important;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
}
body:not(.admin-mode) .section-toolbar { display: none !important; }

.toolbar-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.toolbar-btn:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.toolbar-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.toolbar-btn:disabled:hover { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.toolbar-count {
  margin-right: auto;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.5px;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-deep);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  padding: 12px 20px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  animation: toastIn 0.3s ease;
}
.toast.success { border-color: #8acd9e; color: #8acd9e; }
.toast.error { border-color: #d49090; color: #d49090; }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .edit-bar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .img-actions { top: 4px; left: 4px; }
  .img-action-btn { padding: 4px 8px; font-size: 10px; }
}

/* ============ COLLECTION ADMIN TOOLS ============ */
/* Per-item edit/delete buttons */
.admin-editable {
  position: relative;
}
.item-tools {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
  gap: 4px;
  z-index: 10;
}
body.admin-mode .item-tools { display: flex; }

.item-tool-btn {
  background: rgba(15, 10, 6, 0.9);
  border: 1px solid var(--gold-deep);
  color: var(--gold-soft);
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: all 0.2s;
}
.item-tool-btn:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.item-tool-danger:hover { background: var(--crimson); color: var(--ink); border-color: var(--crimson); }

/* Add new item button at end of collection */
.add-item-btn {
  display: none;
  margin-top: 32px;
  padding: 16px 28px;
  background: transparent;
  border: 2px dashed var(--line-strong);
  color: var(--gold-soft);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s;
  width: 100%;
}
body.admin-mode .add-item-btn { display: block; }
.add-item-btn:hover {
  background: rgba(212, 167, 71, 0.05);
  border-color: var(--gold);
  color: var(--gold);
}

/* ============ ITEM MODAL ============ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-inner {
  background: var(--bg-card);
  max-width: 560px;
  width: 100%;
  padding: 44px;
  position: relative;
  border: 1px solid var(--line);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--line-strong);
  font-size: 16px;
  cursor: pointer;
  color: var(--ink-soft);
}
.modal-close:hover { background: var(--bg-elev); color: var(--gold); border-color: var(--gold); }
.modal-inner h2 {
  font-family: var(--font-display);
  margin-bottom: 28px;
  color: var(--gold-cream);
  font-size: 22px;
}

.modal-inner .form-row { margin-bottom: 18px; }
.modal-inner label {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
}
.modal-inner input,
.modal-inner textarea,
.modal-inner select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
  border-radius: 0;
}
.modal-inner textarea { resize: vertical; min-height: 80px; font-family: var(--font-body); }
.modal-inner select option { background: var(--bg-card); }
.modal-inner input:focus, .modal-inner textarea:focus, .modal-inner select:focus { border-color: var(--gold); }

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.form-actions .btn-primary { flex: 1; }

.btn-primary {
  padding: 12px 24px;
  background: var(--gold);
  color: var(--bg);
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--gold-soft); }

.btn-danger {
  padding: 12px 24px;
  background: transparent;
  color: #d49090;
  border: 1px solid #d49090;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
}
.btn-danger:hover { background: var(--crimson); color: var(--ink); border-color: var(--crimson); }

/* ============ FEATURED PROFILES (hero top-right) — supports 1-4 cards ============ */
.featured-profile {
  position: absolute;
  top: 80px;
  right: 40px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  max-width: 230px;
  animation: profileFadeIn 1.2s ease;
}
@keyframes profileFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100px;
}
.fp-card-empty .featured-profile-trigger { opacity: 0.4; }
.fp-card-empty:hover .featured-profile-trigger { opacity: 0.7; }

.featured-profile-trigger {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid var(--gold-deep);
  background: var(--bg-deep);
  padding: 3px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 0 1px rgba(212, 167, 71, 0.1);
}
.featured-profile-trigger::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold-deep), var(--gold-soft));
  z-index: -1;
  opacity: 0.4;
  transition: opacity 0.4s;
}
.featured-profile-trigger:hover {
  transform: scale(1.06);
  border-color: var(--gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.7), 0 0 0 1px rgba(212, 167, 71, 0.3);
}
.featured-profile-trigger:hover::before { opacity: 0.8; }
.featured-profile-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  filter: sepia(0.1) brightness(0.95);
  transition: filter 0.4s;
}
.featured-profile-trigger:hover img { filter: sepia(0) brightness(1); }

.featured-profile-caption {
  text-align: center;
  max-width: 100px;
}
.fp-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-cream);
  margin-bottom: 1px;
  line-height: 1.3;
}
.fp-dates {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.3px;
}

/* Profile modal */
.profile-modal {
  position: fixed; inset: 0;
  background: rgba(5, 3, 2, 0.95);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.profile-modal.open { display: flex; }
.profile-modal-inner {
  background: var(--bg-card);
  max-width: 760px;
  width: 100%;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  border: 1px solid var(--gold-deep);
  position: relative;
  box-shadow: 0 50px 100px rgba(0,0,0,0.8);
  animation: modalIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 38px;
  height: 38px;
  background: rgba(15, 10, 6, 0.8);
  border: 1px solid var(--line-strong);
  color: var(--gold-soft);
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  transition: all 0.2s;
}
.profile-modal-close:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }

.profile-modal-photo {
  background: var(--bg-deep);
  overflow: hidden;
  min-height: 360px;
}
.profile-modal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(0.08);
}

.profile-modal-info {
  padding: 48px 44px;
  color: var(--ink);
}
.pm-eyebrow {
  font-size: 11px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.pm-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--gold-cream);
  margin-bottom: 8px;
  line-height: 1.1;
}
.pm-dates {
  font-family: var(--font-quote);
  font-style: italic;
  font-size: 16px;
  color: var(--gold-soft);
  margin-bottom: 6px;
}
.pm-role {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.5px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.pm-bio {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-soft);
  font-weight: 300;
}

.profile-admin-tools {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: none;
  flex-direction: column;
  gap: 8px;
}
.profile-admin-tools .btn-primary {
  padding: 10px 20px;
  font-size: 12px;
}

/* Inline-editing visual for profile fields */
.profile-modal-info [data-ck][contenteditable="true"] {
  outline: 1px dashed var(--gold);
  outline-offset: 4px;
  border-radius: 2px;
  cursor: text;
  background: rgba(212, 167, 71, 0.05);
}
.profile-modal-info [data-ck][contenteditable="true"]:focus {
  outline: 2px solid var(--gold);
  background: rgba(212, 167, 71, 0.1);
}
.profile-modal-info [data-ck].saving {
  outline-color: var(--gold-soft);
}

@media (max-width: 768px) {
  .featured-profile { top: 70px; right: 12px; max-width: 170px; gap: 8px; }
  .fp-card { width: 70px; }
  .featured-profile-trigger { width: 62px; height: 62px; padding: 2px; }
  .featured-profile-caption { max-width: 70px; }
  .fp-name { font-size: 10px; }
  .fp-dates { font-size: 8px; }
  .profile-modal-inner { grid-template-columns: 1fr; }
  .profile-modal-photo { min-height: 280px; }
  .profile-modal-info { padding: 32px 24px; }
  .pm-name { font-size: 24px; }
}
