/* Site editor (/admin). Plain and practical; shares the site's tokens and type. */

[data-view="admin"] .topbar { display: none; }

.edit-pill {
  position: fixed; left: 16px; bottom: 16px; z-index: 350;
  display: inline-flex; align-items: center; height: 42px; padding: 0 18px;
  border-radius: 999px; background: var(--sphere-1); color: #fff;
  font-size: 0.74rem; font-weight: 600; font-stretch: 112%; letter-spacing: 0.08em; text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.adm {
  --adm-card: #f7f6f3;
  display: grid; grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100svh;
}
.adm-side {
  position: sticky; top: 0; height: 100svh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 22px; border-right: 1px solid var(--line);
}
.adm-brand { display: grid; gap: 4px; margin: 0; font-size: 1.05rem; font-weight: 600; font-stretch: 118%; text-transform: uppercase; letter-spacing: -0.01em; line-height: 1.1; }
.adm-brand span { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.12em; color: var(--muted); }
.adm-nav { display: grid; gap: 2px; }
.adm-nav a { padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.adm-nav a:hover { background: var(--panel); }
.adm-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.adm-side-foot { margin-top: auto; display: grid; gap: 10px; justify-items: start; }

.adm-main { padding: 28px clamp(18px, 3vw, 44px) 80px; display: grid; gap: 22px; align-content: start; max-width: 1180px; }
/* save banner, pinned to the top of the editor: quiet when saved, loud when there's unsaved work */
.adm-status {
  position: sticky; top: 0; z-index: 20; justify-self: end;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: -8px 0 0; padding: 7px 14px 7px 32px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 0.84rem; color: var(--muted);
}
.adm-status::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: #3f8f5a;
}
.adm-status[data-state="saving"] { color: var(--ink); }
.adm-status[data-state="saving"]::before { background: var(--sphere-1); animation: adm-pulse 1s ease-in-out infinite alternate; }
.adm-status[data-state="dirty"], .adm-status[data-state="error"] {
  justify-self: stretch; justify-content: space-between;
  padding: 10px 12px 10px 36px; border-radius: 12px;
  font-size: 0.95rem; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.adm-status[data-state="dirty"] { background: #fff1dc; border-color: #e9b46a; color: #6b3c05; }
.adm-status[data-state="dirty"]::before { left: 16px; background: var(--sphere-1); }
.adm-status[data-state="error"] { background: #fdf0ee; border-color: rgba(163, 38, 27, 0.4); color: #a3261b; }
.adm-status[data-state="error"]::before { left: 16px; background: #a3261b; }
.adm-status-btns { display: flex; gap: 8px; }
.adm-status .adm-btn-save { background: var(--sphere-1); border-color: var(--sphere-1); color: #fff; }
@keyframes adm-pulse { to { opacity: 0.3; } }
.adm-upload-note { margin: 0 0 12px; font-size: 0.88rem; color: var(--ink); }
.adm-upload-note[data-state="error"] { color: #a3261b; }
.adm-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: #fbe7d7; color: #6b2a12; font-size: 0.88rem; }

.adm-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.adm-head h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; }
.adm-head p { margin: 6px 0 0; }
.adm-head-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-back { display: inline-block; margin-bottom: 8px; font-size: 0.85rem; color: var(--muted); }
.adm-back:hover { color: var(--ink); }

.adm-card { background: var(--adm-card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.adm-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.adm-card-head h2 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.adm-muted { color: var(--muted); font-size: 0.88rem; font-weight: 400; }
.adm-empty { margin: 0; color: var(--muted); }
.adm-link { display: inline-flex; align-items: center; gap: 0.3em; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; }
.adm-link:hover { color: var(--muted); }

/* buttons */
.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 8px; cursor: pointer;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
  font-size: 0.88rem; font-weight: 600; white-space: nowrap;
}
.adm-btn:hover { opacity: 0.88; }
.adm-btn-sm { height: 32px; padding: 0 12px; font-size: 0.8rem; }
.adm-btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.adm-btn-ghost:hover { border-color: var(--ink); opacity: 1; }
.adm-btn-danger { background: transparent; color: #a3261b; border-color: rgba(163, 38, 27, 0.35); }
.adm-btn-danger:hover { background: #a3261b; color: #fff; opacity: 1; }
.adm-icon {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  display: inline-grid; place-items: center; font-size: 0.9rem; background: var(--bg);
}
.adm-icon:hover:not(:disabled) { border-color: var(--ink); }
.adm-icon:disabled { opacity: 0.35; cursor: default; }
.adm-danger:hover:not(:disabled) { border-color: #a3261b; color: #a3261b; }

/* archive: the main "remove" action; amber so it reads as "put away", not "destroy" */
.adm-archive {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 9px;
  border-radius: 8px; border: 1.5px solid #c98a2e; background: #fff4e0; color: #7a4c0c;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.adm-archive:hover, .adm-archive:focus-visible { background: #7a4c0c; border-color: #7a4c0c; color: #fff; }
.adm-archive-icon { width: 18px; height: 18px; flex: none; }
.adm-archive-card { background: transparent; border-style: dashed; }
.adm-archive-h { display: flex; align-items: center; gap: 8px; }
.adm-archive-h .adm-archive-icon { color: #7a4c0c; width: 20px; height: 20px; }
.adm-archive-note { margin: -6px 0 12px; }
.adm-archive-card .adm-row-title a:hover { text-decoration: underline; }
.adm-archive-card .adm-thumb { filter: grayscale(0.6); opacity: 0.8; }
.adm-row.no-thumb { grid-template-columns: minmax(0, 1fr) auto; }
.adm-archived-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; background: #fff4e0; border-color: #e3bf86; color: #5a3808; }
.adm-archived-notice > .adm-archive-icon { width: 26px; height: 26px; }
.adm-archived-notice p { margin: 0; flex: 1 1 280px; }

/* featured event */
.adm-event-status { margin: 0 0 16px; padding: 9px 12px 9px 30px; border-radius: 8px; position: relative; font-size: 0.9rem; background: var(--panel); color: var(--ink); }
.adm-event-status::before { content: ""; position: absolute; left: 12px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--muted); }
.adm-event-status[data-state="on"] { background: #e8f3ea; color: #1f5a31; }
.adm-event-status[data-state="on"]::before { background: #3f8f5a; }
.adm-event-status[data-state="error"] { background: #fdf0ee; color: #a3261b; }
.adm-event-status[data-state="error"]::before { background: #a3261b; }
.adm-event-preview { padding: 26px 18px; border-radius: 10px; background: var(--bg); display: flex; }
.adm-event-clear { justify-self: start; }

/* form fields */
.adm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px 20px; align-items: start; }
.adm-form > .adm-field:has(textarea) { grid-column: 1 / -1; }
.adm-field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.adm-field > span, .adm-field legend { font-size: 0.8rem; font-weight: 600; padding: 0; }
.adm-field em { font-style: normal; font-weight: 400; color: var(--muted); }
.adm-field input, .adm-field textarea, .adm-field select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: 0.95rem; color: var(--ink);
}
.adm-field textarea { resize: vertical; line-height: 1.5; }
.adm-field input:focus, .adm-field textarea:focus, .adm-field select:focus { outline: 2px solid var(--sphere-1); outline-offset: 0; border-color: transparent; }
.adm-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-choice label, .adm-check {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 0.92rem;
}
.adm-choice label { white-space: nowrap; }
.adm-choice label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.adm-check { align-self: end; justify-self: start; }
.adm-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* collection rows */
.adm-rows, .adm-list, .adm-works { list-style: none; margin: 0; padding: 0; }
.adm-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.adm-row:first-child { border-top: 0; }
.adm-row.is-hidden .adm-thumb, .adm-row.is-hidden .adm-row-title { opacity: 0.45; }
.adm-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--panel); }
.adm-thumb-empty { display: grid; place-items: center; font-size: 0.62rem; color: var(--muted); text-align: center; }
.adm-row-main { display: grid; gap: 2px; min-width: 0; }
.adm-row-title { font-weight: 600; font-size: 1rem; }
.adm-row-title:hover { text-decoration: underline; }
.adm-row-title .sub { font-size: 0.8em; }
.adm-row-btns { display: flex; align-items: center; gap: 6px; }
.adm-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; padding: 0 6px; cursor: pointer; }

/* photos */
.adm-drop {
  margin-bottom: 16px; padding: 22px; border: 1.5px dashed var(--line); border-radius: 10px;
  text-align: center; color: var(--muted); font-size: 0.9rem;
}
.adm-drop.is-over { border-color: var(--sphere-1); background: #fdf1e9; color: var(--ink); }
.adm-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.adm-work { display: grid; gap: 10px; align-content: start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.adm-work.is-cover { border-color: var(--sphere-1); box-shadow: inset 0 0 0 1px var(--sphere-1); }
.adm-work-img { position: relative; aspect-ratio: 4 / 3; background: var(--panel); border-radius: 6px; overflow: hidden; }
.adm-work-img img { width: 100%; height: 100%; object-fit: contain; }
.adm-badge { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px; background: var(--sphere-1); color: #fff; font-size: 0.7rem; font-weight: 600; }
.adm-work-btns { display: flex; align-items: center; gap: 6px; }
.adm-work-btns .adm-danger { margin-left: auto; }
.adm-cover-note { font-size: 0.8rem; }

/* generic list rows (socials, exhibitions, press) */
.adm-list-row { display: grid; gap: 10px 12px; align-items: end; padding: 14px 0; border-top: 1px solid var(--line); }
.adm-list-row:first-child { border-top: 0; padding-top: 0; }
.adm-list-social, .adm-list-press { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
/* exhibitions: two rows per show */
.adm-list-show {
  grid-template-columns: 96px minmax(0, 1.6fr) minmax(0, 1fr) 190px;
  grid-template-areas: "year venue location type" "title title link btns";
}
.adm-list-show > :nth-child(1) { grid-area: year; }
.adm-list-show > :nth-child(2) { grid-area: venue; }
.adm-list-show > :nth-child(3) { grid-area: title; }
.adm-list-show > :nth-child(4) { grid-area: location; }
.adm-list-show > :nth-child(5) { grid-area: type; }
.adm-list-show > :nth-child(6) { grid-area: link; }
.adm-list-show > :nth-child(7) { grid-area: btns; justify-self: end; }

/* portrait */
.adm-portrait { display: flex; align-items: center; gap: 14px; }
.adm-portrait img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; }

/* login */
.adm-login { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.adm-login-card { width: min(380px, 100%); display: grid; gap: 16px; }
.adm-login-card .adm-brand { margin-bottom: 6px; }
.adm-login-card .adm-btn { height: 46px; }
.adm-login-card .adm-link { justify-self: center; }
.adm-login-help { margin: 0; text-align: center; color: var(--ink); font-size: 0.92rem; }
.adm-error { margin: 0; color: #a3261b; font-size: 0.88rem; }

@media (max-width: 1100px) {
  .adm-list-show {
    grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "year venue venue" "location location type" "title title title" "link link btns";
  }
}
@media (max-width: 760px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .adm-nav { display: flex; flex-wrap: wrap; }
  .adm-side-foot { margin-top: 0; flex-direction: row; display: flex; flex-wrap: wrap; gap: 14px; }
  .adm-main { padding: 18px 14px 60px; }
  .adm-row { grid-template-columns: 52px minmax(0, 1fr); }
  .adm-thumb { width: 52px; height: 52px; }
  .adm-row-btns { grid-column: 1 / -1; flex-wrap: wrap; }
  .adm-list-social, .adm-list-press { grid-template-columns: minmax(0, 1fr); }
  .adm-list-show { grid-template-columns: minmax(0, 1fr); grid-template-areas: "year" "venue" "title" "location" "type" "link" "btns"; }
}
