/* ── The story in an activity's edit mode (issue #2313) ──
   The editing form of a story's blocks, inside the edit mode's form
   (activity-detail.css, "Edit mode"). Every control is native and labelled;
   every target is at least 44px (LOOK-8); everything wraps from 320px
   (LOOK-7). How a reader is shown the blocks is the story reader's. */

.story-editor {
  margin: 0;
  min-width: 0;
}

.story-editor-heading {
  margin-top: var(--space-5);
}

.story-note {
  margin: 0;
  font-size: var(--fs-small);
  line-height: var(--lh-body);
  color: var(--ink-muted);
}

.story-count {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-small);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.story-block-list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.story-block-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.story-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
}

.story-block .detail-edit-field {
  margin-top: var(--space-2);
}

.story-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.story-block-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.story-block-kind {
  font-size: var(--fs-kicker);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.story-block-place {
  font-size: var(--fs-small);
  color: var(--ink-subtle);
}

.story-block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.story-block-btn,
.story-add-btn,
.story-upload {
  min-height: 44px; /* LOOK-8 */
  min-width: 44px;
}

.story-block-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.story-block-remove {
  color: var(--danger);
}

.story-add {
  min-width: 0;
}

.story-add-summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* LOOK-8 */
  padding: 0 var(--space-3);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--accent-hover);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.story-add-summary:hover {
  background: var(--accent-soft);
}

.story-add-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-1);
}

.story-input,
.story-select {
  min-height: 44px; /* LOOK-8 */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 var(--space-3);
  font-size: var(--fs-small);
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
}

.story-body {
  min-height: 160px;
  font-family: var(--font-prose);
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--ink-body);
}

.story-quote {
  min-height: 88px;
  font-family: var(--font-prose);
  font-style: italic;
  font-size: var(--fs-body);
}

.story-preview > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* LOOK-8 */
  font-size: var(--fs-small);
  color: var(--ink-muted);
  cursor: pointer;
}

.story-preview .markdown-text {
  padding: var(--space-3);
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  font-family: var(--font-prose);
  color: var(--ink-body);
  overflow-wrap: anywhere;
}

.story-figure-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-3);
}

.story-figure-row > .detail-edit-field {
  flex: 1 1 12rem;
}

/* A choice of photos: thumbnails, each with its own native radio button or
   checkbox in the corner. */
.story-photo-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--space-2);
}

.story-photo-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunken);
  cursor: pointer;
}

.story-photo-option input {
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.story-photo-option:has(input:checked) {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.story-photo-option:focus-within {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.story-photo-none {
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-6);
  font-size: var(--fs-small);
  color: var(--ink-muted);
  text-align: start;
}

.story-thumb {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: cover;
}

.story-thumb-pending {
  background: var(--surface-alt);
}

.story-upload {
  justify-self: start;
  align-self: flex-start;
}

.story-number-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}
