/* Build 739: a four-stage creation flow with emotional depth on demand. */
html body .app-shell #memoryForm .memory-editor-progress,
html body main.app-shell #memoryForm#memoryForm .memory-editor-progress {
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto !important;
}

html body .app-shell #memoryForm .first-memory-details-toggle,
html body main.app-shell #memoryForm#memoryForm .first-memory-details-toggle {
  display: none !important;
}

/* The first memory still feels short, but Story and Feeling are no longer hidden. */
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-editor-progress,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-flow-step,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-flow-story > .memory-story-field,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-flow-story > .mappi-story-tip,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-flow-story > .favorite-toggle,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-flow-feeling,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .memory-optional-fields,
html body .app-shell #memoryForm.is-progressive-capture:not(.details-open) .editor-actions .save-step,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-editor-progress,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-flow-step,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-flow-story > .memory-story-field,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-flow-story > .mappi-story-tip,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-flow-story > .favorite-toggle,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-flow-feeling,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .memory-optional-fields,
html body main.app-shell #memoryForm#memoryForm.is-progressive-capture:not(.details-open) .editor-actions .save-step {
  display: grid !important;
}

html body .app-shell #memoryForm .memory-flow-substep,
html body main.app-shell #memoryForm#memoryForm .memory-flow-substep {
  color: #0b7e78;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* City and country are implementation details unless automatic lookup fails. */
html body .app-shell #memoryForm .memory-place-autofill-fields,
html body main.app-shell #memoryForm#memoryForm .memory-place-autofill-fields {
  display: none !important;
}

html body .app-shell #memoryForm.location-needs-manual-details .memory-place-autofill-fields,
html body main.app-shell #memoryForm#memoryForm.location-needs-manual-details .memory-place-autofill-fields {
  display: grid !important;
  padding: 11px;
  border: 1px dashed rgba(10, 108, 116, 0.22);
  border-radius: 16px;
  background: rgba(244, 251, 249, 0.78);
}

/* Inside this moment is the emotional invitation and comes before sound. */
html body .app-shell #memoryForm .memory-inside-moment-editor,
html body main.app-shell #memoryForm#memoryForm .memory-inside-moment-editor {
  margin-top: 10px !important;
}

/* Sound is a quiet disclosure until the user chooses to add or edit it. */
html body .app-shell #memoryForm details.memory-sound-capture,
html body main.app-shell #memoryForm#memoryForm details.memory-sound-capture {
  display: block !important;
  padding: 0 !important;
  overflow: clip;
}

html body .app-shell #memoryForm .memory-sound-capture > summary,
html body main.app-shell #memoryForm#memoryForm .memory-sound-capture > summary {
  min-height: 56px;
  padding: 10px 44px 10px 11px;
  cursor: pointer;
  list-style: none;
  position: relative;
}

html body .app-shell #memoryForm .memory-sound-capture > summary::-webkit-details-marker,
html body main.app-shell #memoryForm#memoryForm .memory-sound-capture > summary::-webkit-details-marker {
  display: none;
}

html body .app-shell #memoryForm .memory-sound-capture > summary::after,
html body main.app-shell #memoryForm#memoryForm .memory-sound-capture > summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #08776f;
  background: rgba(99, 207, 179, 0.14);
  transform: translateY(-50%);
  font-size: 1.05rem;
  font-weight: 800;
}

html body .app-shell #memoryForm .memory-sound-capture[open] > summary::after,
html body main.app-shell #memoryForm#memoryForm .memory-sound-capture[open] > summary::after {
  content: "−";
}

html body .app-shell #memoryForm .memory-sound-capture[open] > :not(summary),
html body main.app-shell #memoryForm#memoryForm .memory-sound-capture[open] > :not(summary) {
  margin-right: 12px;
  margin-left: 12px;
}

html body .app-shell #memoryForm .memory-sound-capture[open] > :last-child,
html body main.app-shell #memoryForm#memoryForm .memory-sound-capture[open] > :last-child {
  margin-bottom: 12px;
}

/* One quiet technical disclosure owns all direct links and song metadata. */
html body .app-shell #memoryForm .memory-media-advanced,
html body main.app-shell #memoryForm#memoryForm .memory-media-advanced {
  margin-top: 2px;
  border: 0;
  border-top: 1px solid rgba(10, 93, 104, 0.1);
  border-radius: 0;
  background: transparent;
}

html body .app-shell #memoryForm .memory-media-advanced > summary,
html body main.app-shell #memoryForm#memoryForm .memory-media-advanced > summary {
  padding: 12px 2px;
  color: #668084;
  font-size: 0.75rem;
  font-weight: 760;
}

html body .app-shell #memoryForm .memory-media-advanced .memory-sound-link-field,
html body .app-shell #memoryForm .memory-media-advanced .memory-song-field,
html body main.app-shell #memoryForm#memoryForm .memory-media-advanced .memory-sound-link-field,
html body main.app-shell #memoryForm#memoryForm .memory-media-advanced .memory-song-field {
  color: #244f59 !important;
}

/* The selected cover anchors Media; the rail beneath it manages the full set. */
html body .app-shell #memoryForm .memory-editor-cover-preview,
html body main.app-shell #memoryForm#memoryForm .memory-editor-cover-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 180px;
  overflow: hidden;
  border-radius: 20px;
  background: #dbe9e7;
  box-shadow: 0 14px 30px rgba(3, 48, 65, 0.11);
}

html body .app-shell #memoryForm .memory-editor-cover-preview[hidden],
html body main.app-shell #memoryForm#memoryForm .memory-editor-cover-preview[hidden] {
  display: none !important;
}

.memory-editor-cover-preview > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.memory-editor-cover-preview-shade {
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(transparent, rgba(2, 29, 40, 0.68));
  pointer-events: none;
}

.memory-editor-cover-preview-copy {
  position: absolute;
  right: 14px;
  bottom: 13px;
  left: 14px;
  display: grid;
  color: #ffffff;
  pointer-events: none;
}

.memory-editor-cover-preview-copy small {
  font-size: 0.63rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.memory-editor-cover-preview-copy strong {
  font-size: 0.77rem;
}

html body .app-shell #memoryForm .memory-editor-cover-preview .memory-editor-cover-focus,
html body main.app-shell #memoryForm#memoryForm .memory-editor-cover-preview .memory-editor-cover-focus {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 38px;
  margin: 0;
  color: #f7fffc;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(3, 45, 58, 0.72);
  box-shadow: 0 8px 20px rgba(2, 29, 40, 0.2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

html body .app-shell #memoryForm .memory-media-preview.has-scrollable-media > .memory-media-thumb,
html body main.app-shell #memoryForm#memoryForm .memory-media-preview.has-scrollable-media > .memory-media-thumb {
  flex: 0 0 104px !important;
  width: 104px !important;
  height: 128px !important;
  display: grid;
  grid-template-rows: 92px 30px;
  gap: 5px;
  border: 0;
  background: transparent;
}

.memory-media-thumb-image {
  position: relative;
  width: 100%;
  height: 92px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 15px;
  background: #dce9e7;
}

.memory-media-thumb.is-cover .memory-media-thumb-image {
  border-color: #18a978;
}

.memory-media-thumb-image > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.memory-media-thumb-image > small {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 5px;
  padding: 3px 5px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(3, 45, 58, 0.72);
  font-size: 0.56rem;
  font-weight: 800;
}

.memory-media-thumb-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.memory-media-thumb-controls button {
  min-width: 0;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(10, 108, 116, 0.14);
  border-radius: 9px;
  color: #075965;
  background: rgba(255, 255, 255, 0.84);
  font-weight: 800;
}

.memory-media-thumb-controls button:last-child {
  color: #9a4d55;
}

.memory-media-thumb-controls button:disabled,
.memory-media-thumb-image:disabled {
  opacity: 0.48;
}

/* One trust message at Save replaces competing reassurance copy. */
.memory-save-trust-status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  margin: 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: #426970;
  background: rgba(232, 246, 242, 0.82);
  font-size: 0.7rem;
  font-weight: 760;
}

html body .app-shell #memoryForm .editor-actions > .save-memory-note,
html body main.app-shell #memoryForm#memoryForm .editor-actions > .save-memory-note {
  display: none !important;
}

.memory-save-trust-status svg {
  width: 15px;
  height: 15px;
  color: #0b8a75;
}

.memory-save-trust-status[data-state="saving"] svg,
.memory-save-trust-status[data-state="uploading"] svg {
  animation: memory-trust-pulse 1.1s ease-in-out infinite;
}

.memory-save-trust-status[data-state="error"] {
  color: #91515a;
  background: rgba(255, 235, 235, 0.84);
}

html body .app-shell #memoryForm.is-editing-memory .editor-header,
html body main.app-shell #memoryForm#memoryForm.is-editing-memory .editor-header {
  border-bottom-color: rgba(10, 116, 116, 0.15);
}

@keyframes memory-trust-pulse {
  50% { opacity: 0.45; }
}

@media (max-width: 560px) {
  html body .app-shell #memoryForm .memory-editor-cover-preview,
  html body main.app-shell #memoryForm#memoryForm .memory-editor-cover-preview {
    min-height: 168px;
    aspect-ratio: 4 / 3;
  }

  html body .app-shell #memoryForm .memory-editor-cover-preview .memory-editor-cover-focus,
  html body main.app-shell #memoryForm#memoryForm .memory-editor-cover-preview .memory-editor-cover-focus {
    padding-inline: 11px;
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-save-trust-status[data-state="saving"] svg,
  .memory-save-trust-status[data-state="uploading"] svg {
    animation: none;
  }
}
