/* ==========================================================================
   ADMIN — the panel behind the login.

   Same tokens as the public site, denser. This is a workbench: rows are
   compact, every control is labelled, and nothing animates for decoration.
   ========================================================================== */

.admin { padding-block: var(--sp-7) var(--sp-10); }

/* --- Gate: sign in / first-run setup ------------------------------------- */
.gate {
  min-height: 70svh;
  display: grid;
  place-content: center;
  padding-block: var(--sp-8);
}

.gate__card {
  width: min(100%, 420px);
  display: grid;
  gap: var(--sp-5);
  padding: var(--sp-7);
  border: var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
}

.gate__title {
  font-family: var(--font-display);
  font-weight: var(--fw-black);
  font-size: var(--fs-h2);
  text-transform: uppercase;
  letter-spacing: var(--tr-display);
}

.gate__note { font-size: var(--fs-small); color: var(--text-muted); line-height: var(--lh-snug); }

/* --- Head ---------------------------------------------------------------- */
.admin__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-6);
  border-bottom: var(--rule);
}

.admin__title {
  font-family: var(--font-display);
  font-weight: var(--fw-black);
  font-size: var(--fs-h2);
  text-transform: uppercase;
  letter-spacing: var(--tr-display);
}

.admin__who {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.admin__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* --- Banner -------------------------------------------------------------- */
.banner {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border: var(--rule);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: var(--fs-small);
  line-height: var(--lh-snug);
}
.banner[data-tone="error"] { border-left-color: var(--danger); }
.banner[data-tone="ok"]    { border-left-color: var(--ok); }
.banner code {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  background: var(--bg-field);
  padding: 2px 6px;
  border-radius: var(--radius);
}

/* --- Tabs ---------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--sp-1);
  margin-block: var(--sp-6) var(--sp-6);
  padding-bottom: var(--sp-1);
  /* The tab strip scrolls rather than wrapping: eleven wrapped tabs push the
     panel below the fold on a laptop. */
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: var(--rule);
}

.tab {
  flex: 0 0 auto;
  position: relative;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-quiet); border-bottom-color: var(--accent); }

.tab__badge {
  display: inline-block;
  min-width: 18px;
  margin-left: var(--sp-2);
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--c-cream);
  font-size: 0.625rem;
  text-align: center;
}

/* --- Panels -------------------------------------------------------------- */
.panel { display: grid; gap: var(--sp-5); }

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}

.panel__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  letter-spacing: var(--tr-tight);
}

.panel__note { font-size: var(--fs-small); color: var(--text-faint); max-width: 58ch; }

/* --- Copy editor --------------------------------------------------------- */
.copy-group {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border: var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
}

.copy-group__title {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--accent-quiet);
}

.copy-grid { display: grid; gap: var(--sp-4); }

@media (min-width: 900px) {
  .copy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .copy-grid .field--wide { grid-column: 1 / -1; }
}

/* --- Item rows ------------------------------------------------------------
   One row per record. The thumbnail is fixed-width so the titles line up
   down the column however tall the images are.
   ========================================================================== */
.rows { display: grid; gap: var(--sp-3); }

.row {
  display: grid;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4);
  border: var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  grid-template-columns: 64px minmax(0, 1fr);
}

.row.is-hidden { opacity: 0.55; }
.row.is-hidden .row__title::after {
  content: " · hidden";
  color: var(--warn);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  text-transform: uppercase;
}

.row__thumb {
  width: 64px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-pressed);
  display: grid;
  place-items: center;
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.row__thumb span {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.row__main { display: grid; gap: 2px; min-width: 0; }

.row__title {
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-tight);
  overflow-wrap: anywhere;
}

.row__meta {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.row__kind {
  display: inline-block;
  margin-right: var(--sp-2);
  padding: 1px 6px;
  border: var(--rule);
  border-radius: var(--radius-pill);
  color: var(--accent-quiet);
}

.row__tools {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: var(--rule);
}

@media (min-width: 760px) {
  .row { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .row__tools { grid-column: auto; padding-top: 0; border-top: 0; flex-wrap: nowrap; }
}

.tool {
  padding: var(--sp-2) var(--sp-3);
  border: var(--rule);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tool:hover { color: var(--text); border-color: var(--rule-color-strong); }
.tool--danger:hover { color: var(--danger); border-color: var(--danger); }
.tool[disabled] { opacity: 0.35; pointer-events: none; }

/* --- Editor drawer -------------------------------------------------------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  justify-items: end;
  background: rgba(11, 10, 9, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}
.drawer.is-open { opacity: 1; pointer-events: auto; }

.drawer__panel {
  width: min(100%, 560px);
  height: 100%;
  overflow-y: auto;
  padding: var(--sp-6) var(--sp-6) var(--sp-9);
  background: var(--bg);
  border-left: var(--rule);
  display: grid;
  gap: var(--sp-5);
  align-content: start;
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease);
}
.drawer.is-open .drawer__panel { transform: none; }

/* The body is a single grid child of the panel, so its own fields would sit
   flush against each other without this — a hint line would read as the
   caption of the field below it rather than the one above. */
.drawer__panel [data-drawer-body] {
  display: grid;
  gap: var(--sp-5);
}

.drawer__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: var(--rule);
}

.drawer__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  letter-spacing: var(--tr-tight);
}

.drawer__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding-top: var(--sp-5);
  border-top: var(--rule);
}

/* --- Video source picker --------------------------------------------------
   The two ways to get a video onto the site, presented as a choice rather
   than two forms stacked on top of each other.
   ========================================================================== */
.source { display: grid; gap: var(--sp-4); }

.source__pick { display: flex; gap: var(--sp-2); }

.source__opt {
  flex: 1;
  padding: var(--sp-3);
  border: var(--rule);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
}
.source__opt[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent-quiet);
  background: var(--c-gold-16);
}

.dropzone {
  display: grid;
  gap: var(--sp-2);
  place-items: center;
  padding: var(--sp-7) var(--sp-4);
  border: var(--rule-width) dashed var(--rule-color-strong);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.dropzone:hover,
.dropzone.is-over { border-color: var(--accent); background: var(--bg-pressed); }

/* A determinate bar, because an upload is the one operation here long enough
   that a spinner tells the owner nothing useful. */
.progress {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-pressed);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 160ms linear;
}

/* --- Live preview inside the editor --------------------------------------- */
.preview {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
}

.preview__frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.preview__frame[data-ratio="9-16"] { aspect-ratio: 9 / 16; max-width: 240px; }
.preview__frame[data-ratio="1-1"]  { aspect-ratio: 1 / 1; max-width: 320px; }
.preview__frame iframe,
.preview__frame video,
.preview__frame img { width: 100%; height: 100%; border: 0; object-fit: contain; }

.preview__note {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-faint);
  text-align: center;
}
.preview__note[data-tone="ok"]    { color: var(--ok); }
.preview__note[data-tone="error"] { color: var(--danger); }

/* --- Inbox ---------------------------------------------------------------- */
.msg {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
}
.msg.is-unread { border-left: 3px solid var(--accent); }

.msg__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: space-between;
  align-items: baseline;
}

.msg__who { font-weight: var(--fw-medium); }

.msg__when {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-faint);
}

.msg__body { white-space: pre-wrap; color: var(--text-muted); line-height: var(--lh-body); }

.msg__tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* --- Toast ----------------------------------------------------------------
   Confirmation that a save landed. Fixed to the bottom so it does not move
   the row that was just edited.
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  translate: -50% 0;
  z-index: calc(var(--z-overlay) + 10);
  padding: var(--sp-3) var(--sp-5);
  border: var(--rule);
  border-radius: var(--radius-pill);
  background: var(--c-charcoal-3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.toast.is-shown { opacity: 1; transform: none; }
.toast[data-tone="error"] { border-color: var(--danger); color: var(--danger); }
.toast[data-tone="ok"]    { border-color: var(--ok); }

/* --- Confirm dialog -------------------------------------------------------- */
.confirm {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 5);
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(11, 10, 9, 0.8);
}

.confirm__card {
  width: min(100%, 400px);
  display: grid;
  gap: var(--sp-5);
  padding: var(--sp-6);
  border: var(--rule);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
}

.confirm__title { font-size: var(--fs-h3); font-weight: var(--fw-bold); }
.confirm__text  { font-size: var(--fs-small); color: var(--text-muted); line-height: var(--lh-snug); }
.confirm__row   { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: flex-end; }
