/* Westward — admin in-place editor styles.
   All affordances are visibility-gated by body.is-admin, so visitors see
   nothing even if the markup is present (defensive against JS race
   conditions when admin detect resolves after a render). */

.ed-edit-header,
.ed-add-block,
.ed-block-toolbar,
.ed-picker,
.ed-form { display: none; }

.can-edit .ed-edit-header,
.can-edit .ed-add-block { display: inline-flex; }

.can-edit .ed-picker,
.can-edit .ed-form { display: flex; }

/* ---- buttons ---- */
.ed-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 7px 12px;
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.ed-btn:hover { background: var(--line-bright); color: var(--accent); }
.ed-save {
  background: var(--accent-deep);
  border-color: var(--accent-dim);
  color: var(--bg);
}
.ed-save:hover { background: var(--accent-dim); color: var(--bg); }

/* ---- edit-header button at top of Marker body ---- */
.ed-edit-header {
  display: none;
  margin: 0 0 14px;
  border-style: dashed;
  background: transparent;
}
.can-edit .ed-edit-header { display: inline-flex; }

/* ---- add-block button at bottom of .ov-blocks ---- */
.ed-add-block {
  display: none;
  margin-top: 10px;
  width: 100%;
  border-style: dashed;
  justify-content: center;
}

/* ---- per-block hover toolbar ---- */
.ov-block { position: relative; }
.ov-block + .ov-block { margin-top: 6px; }

.ed-block-toolbar {
  position: absolute;
  top: -6px;
  right: -6px;
  display: none;
  gap: 1px;
  background: rgba(9, 12, 18, 0.94);
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  padding: 2px;
  opacity: 0;
  z-index: 2;
  transition: opacity 0.15s var(--ease);
}
.can-edit .ov-block:hover > .ed-block-toolbar,
.can-edit .ed-block-toolbar:hover { display: flex; opacity: 1; }
.ed-block-toolbar button {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 1px;
}
.ed-block-toolbar button:hover {
  background: var(--line-bright);
  color: var(--accent);
}

/* ---- inline forms ---- */
.ed-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  margin: 8px 0;
  background: rgba(15, 20, 29, 0.62);
  border: 1px solid var(--line-bright);
  border-radius: 3px;
}

.ed-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ed-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.ed-form input[type="text"],
.ed-form input[type="file"],
.ed-form select,
.ed-form textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  background: rgba(9, 12, 18, 0.7);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 9px;
  color: var(--ink);
  width: 100%;
}
.ed-form textarea {
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.ed-form input[type="text"]:focus,
.ed-form textarea:focus,
.ed-form select:focus,
.ed-form input[type="file"]:focus {
  outline: none;
  border-color: var(--accent-dim);
}

/* non-public blocks: hairline tier cue for whoever can see them */
.ov-block-vis-crew,
.ov-block-vis-private { position: relative; padding-left: 10px; }
.ov-block-vis-crew    { border-left: 1px solid var(--accent-deep); }
.ov-block-vis-private { border-left: 1px solid var(--line-bright); }
.ov-vis-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 4px;
}

.ed-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.ed-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin: 0;
}

/* ---- add-block type picker ---- */
.ed-picker {
  display: none;
  gap: 8px;
  padding: 12px;
  margin: 8px 0;
  background: rgba(15, 20, 29, 0.62);
  border: 1px solid var(--line-bright);
  border-radius: 3px;
}
.ed-picker .ed-btn { flex: 1; justify-content: center; }

/* ---- image picker (upload + existing grid) ---- */
.ed-image-preview {
  display: block;
  max-width: 100%;
  border-radius: 2px;
  border: 1px solid var(--line);
}

.ed-image-existing-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: none;
  border: 0;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}
.ed-image-existing-toggle:hover { color: var(--accent-dim); }

.ed-image-existing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(9, 12, 18, 0.6);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.ed-image-existing img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}
.ed-image-existing img:hover { border-color: var(--accent-dim); }

.ed-hint {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  margin: -4px 0 0;
}

/* ---- image block (rendered, not editor) ---- */
.ov-figure { margin: 0; }
.ov-figure img {
  display: block;
  width: 100%;
  border-radius: 2px;
  border: 1px solid var(--line);
}
.ov-figure figcaption {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ---- video block (rendered, not editor) ---- */
.ov-video video {
  display: block;
  width: 100%;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: #000;
}
.ov-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #000;
}
.ov-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- map block (rendered, not editor) ---- */
.ov-map-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 2px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #0b0e14;
}
.ov-map-embed iframe,
.ov-map-embed .ov-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- activity block (imported .fit summary) ---- */
.ov-activity {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.12));
}
.ov-activity-trace {
  display: block;
  width: 100%;
  aspect-ratio: 100 / 60;
  background: #0b0e14;
  border-bottom: 1px solid var(--line);
}
.ov-activity-route {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.ov-activity-start { fill: var(--accent); }
.ov-activity-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 12px 0;
}
.ov-activity-sport {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
}
.ov-activity-when {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.ov-activity-stats {
  display: flex; flex-wrap: wrap; gap: 18px;
  padding: 8px 12px 12px;
}
.ov-activity-stat { display: flex; flex-direction: column; gap: 1px; }
.ov-activity-val {
  font-family: var(--font-mono);
  font-size: 15px; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: 0.01em;
}
.ov-activity-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-dim, var(--ink-soft));
}
.ov-activity figcaption {
  font-family: var(--font-sans);
  font-size: 13px; line-height: 1.45; color: var(--ink-soft);
  padding: 0 12px 12px;
}
