/* The editor. None of this is visible to a signed-out visitor except .admin-key. */

.admin-key {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); border-radius: 50%; color: var(--muted);
  opacity: .5; transition: opacity .3s, color .3s, border-color .3s;
}
.admin-key svg { width: 15px; height: 15px; }
.admin-key:hover { opacity: 1; color: var(--gold); border-color: var(--gold); }
@media (max-width: 1020px) { .admin-key { margin-right: 46px; } }

/* bar */
.admin-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 180;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px clamp(12px, 2vw, 24px);
  background: #0f0d0b; border-top: 1px solid var(--gold-lo);
  font: 400 13px/1 var(--sans); color: var(--text);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
}
.ab-left, .ab-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ab-brand { font: 500 10px/1 var(--sans); letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
.ab-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.ab-switch input { position: absolute; opacity: 0; }
.ab-switch span { width: 36px; height: 20px; border-radius: 99px; background: #2a2521; position: relative; transition: background .3s; }
.ab-switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--bone); transition: transform .3s; }
.ab-switch input:checked + span { background: var(--gold); }
.ab-switch input:checked + span::after { transform: translateX(16px); }
.ab-switch input:focus-visible + span { outline: 1px solid var(--gold-hi); outline-offset: 3px; }
.ab-btn {
  min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  font: 500 10px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
}
.ab-btn:hover { border-color: var(--gold); color: var(--ink); background: var(--gold); }
.ab-btn.gold { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.ab-btn.gold:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.ab-btn:disabled { opacity: .4; pointer-events: none; }
.ab-status { font-size: 12.5px; color: var(--muted); }
.ab-status.ok { color: #7fb98a; }
.ab-status.warn { color: var(--gold-hi); }
body.is-admin { padding-bottom: 62px; }

/* edit mode */
body.editing [data-edit] {
  outline: 1px dashed rgba(201, 164, 92, .55); outline-offset: 5px; cursor: text; border-radius: 2px;
}
body.editing [data-edit]:hover { outline-style: solid; background: rgba(201, 164, 92, .06); }
body.editing [data-edit]:focus { outline: 1px solid var(--gold-hi); background: rgba(201, 164, 92, .1); }
body.editing .can-drop { position: relative; outline: 1px dashed rgba(201, 164, 92, .45); outline-offset: 3px; }
body.editing .can-drop.drop-over { outline: 2px solid var(--gold-hi); background: rgba(201, 164, 92, .14); }
body.editing .can-drop::after {
  content: "Drop an image"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font: 500 9px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--bone);
  background: rgba(11, 10, 9, .78); padding: 7px 10px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 3;
}
body.editing .can-drop:hover::after, body.editing .can-drop.drop-over::after { opacity: 1; }

/* modal */
.admin-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(6, 5, 4, .82); overflow-y: auto; }
.am-card { width: min(460px, 100%); background: #14110e; border: 1px solid var(--line-strong); padding: clamp(22px, 3vw, 34px); color: var(--text); }
.am-card.wide { width: min(1080px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; }
.am-card h2 { margin: 0 0 8px; font: 300 clamp(1.6rem, 2.4vw, 2.1rem)/1.1 var(--serif); }
.am-card > p { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }
.am-card label { display: block; font: 500 10px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.am-card > form input { width: 100%; padding: 11px 12px; background: #0c0a08; border: 1px solid var(--line-strong); color: var(--text); font-size: 15px; }
.am-card > form input:focus { outline: none; border-color: var(--gold); }
/* several fields in a row need breathing space, or a focused box meets the next label */
.am-card > form label + input + label { margin-top: 16px; }
.am-row { display: flex; gap: 10px; margin-top: 18px; }
.am-err { color: #e0785c; font-size: 13px; margin: 10px 0 0; }
.am-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.am-head-actions { display: flex; gap: 8px; align-items: center; }
.am-head-actions label { margin: 0; cursor: pointer; display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; letter-spacing: .16em; color: var(--ink); }
.am-hint { margin: 10px 0 16px !important; }
.am-list { overflow-y: auto; display: grid; gap: 8px; padding-right: 4px; }

.am-row-x { display: none; }
.am-list .am-row {
  display: grid; grid-template-columns: 20px 54px minmax(0, 1fr) 108px; gap: 12px; align-items: center; margin: 0;
  padding: 8px; background: #0f0d0b; border: 1px solid var(--line);
}
.am-list .am-row.dragging { opacity: .45; }
.am-list .am-row.over { border-color: var(--gold); }
.am-list .am-row.is-hidden { opacity: .45; }
.am-grip { cursor: grab; color: var(--muted-dark); text-align: center; user-select: none; font-size: 15px; }
.am-thumb { width: 54px; height: 54px; background: #1b1713; display: grid; place-items: center; overflow: hidden; }
.am-thumb img { width: 100%; height: 100%; object-fit: cover; }
.am-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; min-width: 0; }
.am-fields input { width: 100%; padding: 6px 8px; background: #0c0a08; border: 1px solid var(--line); color: var(--text); font-size: 13px; font-family: var(--sans); }
.am-fields input:focus { outline: none; border-color: var(--gold); }
.am-fields .am-title { grid-column: 1 / -1; font-family: var(--serif); font-size: 17px; }
.am-fields input[data-f="story"] { grid-column: 1 / -1; }
.am-toggles { display: grid; gap: 4px; font-size: 11.5px; color: var(--muted); }
.am-toggles label { display: flex; align-items: center; gap: 6px; margin: 0; font: 400 11.5px/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted); cursor: pointer; }
.am-del { background: none; border: 0; color: #c8735c; font-size: 11.5px; text-align: left; cursor: pointer; padding: 2px 0; }
.am-del:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .am-list .am-row { grid-template-columns: 20px 52px minmax(0, 1fr); }
  .am-toggles { grid-column: 2 / -1; grid-auto-flow: column; justify-content: start; gap: 14px; }
  .am-fields { grid-template-columns: 1fr; }
  .admin-bar { font-size: 12px; }
}

/* the site-wide cursor dot gets in the way while editing */
body.editing .cursor { display: none !important; }

/* rearranging blocks */
body.editing .block { position: relative; outline: 1px dashed rgba(201, 164, 92, .3); outline-offset: -2px; }
body.editing .block > .block-tools {
  position: absolute; z-index: 60; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .2s;
}
body.editing .block:hover > .block-tools { opacity: 1; }
body.editing .block-tools .bt-grip, body.editing .block-tools .bt-hide {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: grab;
  background: rgba(11, 10, 9, .9); border: 1px solid var(--gold-lo); color: var(--bone);
  font: 500 9px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase;
}
body.editing .block-tools .bt-hide { cursor: pointer; }
body.editing .block-tools .bt-hide:hover, body.editing .block-tools .bt-grip:hover { background: var(--gold); color: var(--ink); }
body.editing .block-dragging { opacity: .4; }
body.editing .block-over { outline: 2px solid var(--gold-hi); }
/* a hidden block stays visible to the owner, greyed out, so it can be brought back */
body.editing [data-sort] > [hidden] { display: revert !important; opacity: .35; filter: grayscale(1); }
body.editing .sorting { min-height: 40px; }

/* upload feedback inside the Paintings panel, which covers the bar */
.am-status { font-size: 12.5px; color: var(--muted); margin-right: 6px; max-width: 46ch; }
.am-status.ok { color: #7fb98a; }
.am-status.warn { color: var(--gold-hi); }
.am-fields input[data-f="shop"] { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* comment moderation */
.ab-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 7px;
  border-radius: 99px; background: var(--gold); color: var(--ink); font: 500 10px/1 var(--sans); }
.ab-badge[hidden] { display: none; }
.cm-head { margin: 18px 0 10px; font: 500 10px/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.cm-head:first-child { margin-top: 0; }
.cm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px; background: #0f0d0b; border: 1px solid var(--line); margin-bottom: 8px; }
.cm-row.fresh { border-color: var(--gold); }
.cm-body b { font: 400 1.1rem/1.2 var(--serif); color: var(--bone); }
.cm-on { font-size: 12px; color: var(--gold); margin-left: 8px; }
.cm-at { font-size: 11.5px; color: var(--muted-dark); margin-left: 8px; }
.cm-body p { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); white-space: pre-wrap; }
.cm-acts { display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) { .cm-row { grid-template-columns: 1fr; } }
