.coach-photo-framing { margin-block: .85rem; }
.coach-photo-framing fieldset {
  min-inline-size: 0;
  margin: 0;
  padding: .75rem;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
}
.coach-photo-framing legend { padding-inline: .3rem; font-weight: 650; }
.coach-photo-framing-images,
.coach-photo-framing-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
  gap: .75rem;
  margin-block: .7rem;
}
.coach-photo-framing figure { margin: 0; min-inline-size: 0; }
.coach-photo-framing figcaption { color: var(--color-muted); font-size: .8rem; margin-block-start: .25rem; }
.coach-photo-framing img { display: block; inline-size: 100%; border-radius: var(--radius-xs); }
.coach-photo-framing-source { position: relative; max-inline-size: 13rem; }
.coach-photo-framing-source img { cursor: crosshair; }
.coach-photo-framing-source span {
  position: absolute;
  inline-size: .85rem;
  block-size: .85rem;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--color-dark);
  box-shadow: 0 0 0 1px var(--color-dark);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.coach-photo-square-preview { aspect-ratio: 1; object-fit: cover; }
.coach-photo-framing-controls label { display: grid; gap: .2rem; font-size: .85rem; }
.coach-photo-framing-controls input { min-inline-size: 0; inline-size: 100%; accent-color: var(--color-lime); }

.coach-profile-form .coach-photo-framing { grid-column: 1 / -1; order: 1; }

.coach-photo-framing-source [data-photo-region] {
  inline-size: auto;
  block-size: auto;
  transform: none;
  border: 1px dashed var(--color-lime);
  border-radius: .15rem;
  background: transparent;
  box-shadow: none;
}
.coach-photo-headroom { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.coach-photo-headroom label { font-size: .85rem; }
.coach-photo-headroom input { accent-color: var(--color-lime); }
.coach-result-photo img.coach-photo-safe-fit,
.coach-profile-heading img.coach-photo-safe-fit,
.coach-photo-framing img.coach-photo-safe-fit {
  box-sizing: border-box;
  object-fit: var(--coach-photo-fit, contain);
  padding-block-start: var(--photo-headroom);
  mask-image: var(--coach-photo-mask-x), var(--coach-photo-mask-y);
  mask-composite: intersect;
}

.coach-photo-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* Frame the square first, then trim its lower edge in the directory grid. */
.coach-photo-bottom-trim { aspect-ratio: 21 / 20; }
.coach-photo-bottom-trim > :is(img, .coach-photo-placeholder) {
  position: absolute;
  inset: 0 0 auto;
}

.coach-photo-framing .coach-photo-frame { border-radius: var(--radius-xs); }

.coach-photo-has-backdrop::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2rem;
  background: linear-gradient(rgb(7 19 33 / 25%), rgb(7 19 33 / 25%)), var(--coach-photo-backdrop) center / cover;
  filter: blur(1.35rem);
  pointer-events: none;
}
