/* Admin — same field, same type, more furniture */
:root {
  --field: #0A0A0A;
  --panel: #111110;
  --type-primary: #FFFFFF;
  --type-secondary: rgba(255, 255, 255, 0.42);
  --type-meta: #8E8C88;
  --rule: rgba(255, 255, 255, 0.12);
  --danger: #c96a5e;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --size-meta: 11px;
  --masthead-h: 61px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@font-face {
  font-family: "Playfair Display";
  src: url("fonts/playfair-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--field);
  color: var(--type-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea {
  font: inherit;
  color: var(--type-primary);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 8px 10px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--type-secondary); }
img { display: block; }

/* ---------- Buttons & fields ---------- */
.btn {
  font-size: var(--size-meta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--type-primary);
  text-decoration: none;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
  white-space: nowrap;
}
.btn.sm { padding: 6px 10px; }
.btn:hover { border-color: var(--type-primary); }
.btn.primary { background: var(--type-primary); color: var(--field); border-color: var(--type-primary); }
.btn.primary:hover { background: var(--type-secondary); }
.btn.primary:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { color: var(--type-secondary); }
.btn.ghost:hover { color: var(--type-primary); }
.btn.danger { color: var(--danger); border-color: rgba(201,106,94,0.4); }
.btn.danger:hover { border-color: var(--danger); }
.btn.wide { width: 100%; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field span {
  font-size: var(--size-meta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--type-meta);
}

/* ---------- Boot notice ---------- */
#notice {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--field);
  z-index: 100;
}
.notice-card { width: 400px; }
.notice-card .wordmark { font-family: var(--font-display); font-size: 22px; margin-bottom: 18px; }
#notice-msg { font-size: 14px; color: var(--type-secondary); line-height: 1.7; margin-bottom: 22px; }
#notice-msg code { font-size: 12px; border: 1px solid var(--rule); border-radius: 3px; padding: 1px 5px; }

/* ---------- Shell ---------- */
#app { height: 100vh; display: grid; grid-template-rows: var(--masthead-h) 1fr; grid-template-columns: 264px 1fr; }
#app[hidden], #notice[hidden] { display: none; } /* author display beats UA [hidden] — restate it */
.masthead {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
}
.brand { font-family: var(--font-display); font-size: 20px; }
.brand .tag {
  font-family: var(--font-body); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--type-meta); border: 1px solid var(--rule); border-radius: 3px;
  padding: 3px 7px; margin-left: 12px; vertical-align: 4px;
}
.actions { display: flex; align-items: center; gap: 12px; }
.dirty { font-size: var(--size-meta); letter-spacing: 0.1em; text-transform: uppercase; color: var(--type-meta); }
.dirty::before { content: "●"; color: #d8b25a; margin-right: 7px; font-size: 8px; vertical-align: 2px; }

/* ---------- Sidebar ---------- */
#sidebar {
  border-right: 1px solid var(--rule);
  padding: 20px 0;
  overflow-y: auto;
}
.side-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px 14px;
  font-size: var(--size-meta); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--type-meta);
}
.side-note { padding: 14px 20px 0; font-size: 12px; color: var(--type-meta); line-height: 1.6; }
#albums { list-style: none; }
#albums li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 200ms ease;
}
#albums li:hover { background: rgba(255,255,255,0.03); }
#albums li.on { border-left-color: var(--type-primary); background: rgba(255,255,255,0.05); }
#albums li.dragging { opacity: 0.35; }
#albums li .handle { color: var(--type-meta); cursor: grab; font-size: 13px; letter-spacing: 2px; }
#albums li .name { flex: 1; font-family: var(--font-display); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#albums li .n { font-size: 10px; color: var(--type-meta); font-variant-numeric: tabular-nums; }
#albums li .status {
  width: 6px; height: 6px; border-radius: 50%;
  background: transparent; border: 1px solid var(--type-meta);
}
#albums li.published .status { background: #9dc98a; border-color: #9dc98a; }

/* ---------- Main ---------- */
#main { overflow-y: auto; padding: 24px 28px 80px; }
.album-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.title-input {
  font-family: var(--font-display); font-size: 22px;
  background: transparent; border-color: transparent; padding: 6px 8px;
  min-width: 260px;
}
.title-input:hover, .title-input:focus { border-color: var(--rule); background: var(--panel); }
.year-input { width: 110px; font-variant-numeric: tabular-nums; }
.album-bar .btn { margin-left: auto; }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 32px; height: 18px; border-radius: 9px;
  border: 1px solid var(--rule);
  display: inline-flex; align-items: center; padding: 2px;
  transition: background 200ms ease;
}
.switch .thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--type-meta); transition: transform 250ms var(--ease), background 200ms ease; }
.switch input:checked + .track { background: rgba(157,201,138,0.15); }
.switch input:checked + .track .thumb { transform: translateX(14px); background: #9dc98a; }
.switch-label { font-size: var(--size-meta); letter-spacing: 0.12em; text-transform: uppercase; color: var(--type-secondary); }

.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--rule); margin-bottom: 22px; }
.tabs button {
  font-size: var(--size-meta); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--type-meta); padding: 0 2px 12px;
  border-bottom: 1px solid transparent; margin-bottom: -1px;
  transition: color 200ms ease;
}
.tabs button:hover { color: var(--type-primary); }
.tabs button.on { color: var(--type-primary); border-bottom-color: var(--type-primary); }
.tab-note { font-size: 13px; color: var(--type-meta); line-height: 1.7; max-width: 64ch; margin-bottom: 18px; }

/* ---------- Photographs ---------- */
#dropzone {
  border: 1px dashed var(--rule);
  border-radius: 4px;
  padding: 26px;
  text-align: center;
  margin-bottom: 22px;
  transition: border-color 200ms ease, background 200ms ease;
}
#dropzone.over { border-color: var(--type-primary); background: rgba(255,255,255,0.03); }
#dropzone p { color: var(--type-secondary); font-size: 14px; }
.dz-note { margin-top: 10px; font-size: 12px !important; color: var(--type-meta) !important; max-width: 58ch; margin-left: auto; margin-right: auto; line-height: 1.6; }

#uploads { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.up-card {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 9px 12px;
}
.up-card .nm { font-size: 13px; color: var(--type-secondary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-card .pct { font-size: 10px; color: var(--type-meta); font-variant-numeric: tabular-nums; width: 38px; text-align: right; }
.up-card .bar { width: 180px; height: 2px; background: var(--rule); }
.up-card .fill { height: 100%; width: 0; background: var(--type-primary); transition: width 120ms linear; }

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.cell { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 3px; cursor: pointer; }
.cell img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease), opacity 300ms ease; }
.cell:hover img { transform: scale(1.05); }
.cell.sel { outline: 2px solid var(--type-primary); outline-offset: 2px; }
.cell .ix {
  position: absolute; left: 7px; bottom: 6px;
  font-size: 9px; letter-spacing: 0.1em; color: rgba(255,255,255,0.75);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}
.cell .ti {
  position: absolute; right: 7px; top: 6px;
  font-size: 9px; color: #d8b25a; text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}

/* ---------- Spread editor ---------- */
#spread-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.sp-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 16px;
  cursor: grab;
  background: var(--panel);
  transition: border-color 200ms ease;
}
.sp-card:hover { border-color: var(--type-secondary); }
.sp-card.dragging { opacity: 0.35; }
.sp-card.drop-above { border-top-color: var(--type-primary); }
.sp-card .ord { font-size: 10px; color: var(--type-meta); font-variant-numeric: tabular-nums; width: 26px; }
.sp-card .frames { display: flex; gap: 6px; height: 84px; flex: 1; justify-content: center; overflow: hidden; }
.sp-card .frames img { height: 100%; object-fit: cover; border-radius: 2px; }
.sp-card .kind { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--type-meta); width: 86px; }
.sp-card .ops { display: flex; gap: 8px; }

/* ---------- Home image ---------- */
#home-stage {
  position: relative;
  max-width: 900px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
  margin-bottom: 12px;
}
#home-img { width: 100%; }
#focal-dot {
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--type-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.35);
  pointer-events: none;
}
#focal-dot::after {
  content: ""; position: absolute; inset: 5px;
  background: var(--type-primary); border-radius: 50%;
}
#home-strip { display: flex; gap: 8px; flex-wrap: wrap; max-width: 900px; }
#home-strip .cell { width: 96px; flex: none; }
#home-strip .cell.home { outline: 2px solid #d8b25a; outline-offset: 2px; }

/* ---------- Inspector ---------- */
#inspector {
  position: fixed;
  top: var(--masthead-h); right: 0; bottom: 0;
  width: 320px;
  background: var(--panel);
  border-left: 1px solid var(--rule);
  padding: 20px;
  overflow-y: auto;
  z-index: 40;
  animation: slidein 320ms var(--ease);
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.insp-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--size-meta); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--type-meta); margin-bottom: 16px;
}
#insp-img { width: 100%; border-radius: 3px; margin-bottom: 18px; }
.insp-exif { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--type-meta); line-height: 1.9; margin-bottom: 20px; font-variant-numeric: tabular-nums; }
.insp-actions { display: flex; gap: 10px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%; bottom: 30px;
  transform: translateX(-50%) translateY(10px);
  background: var(--type-primary); color: var(--field);
  font-size: 12px; letter-spacing: 0.06em;
  padding: 11px 20px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms var(--ease);
  z-index: 200;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
