/* Rhino photography: frames compose the image; semantic img elements deliver it.
   Placement-specific focal points live in scripts/image_placements.json.
   The #main scope deliberately supersedes the older page-specific image rules. */
#main img.rhino-photo {
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:var(--focus-x,50%) var(--focus-y,50%);
}
#main :is(.hero-image,.programme-photo,.route-card-photo,.page-hero-photo,
  .about-photo,.coach-photo,.coach-portrait,.gallery-photo-frame) {
  position:relative;
  overflow:hidden;
  background:transparent;
}

/* Programme previews: one shared ratio, including the hub audience cards. */
#main :is(.programme-photo,.route-card-photo) {
  height:auto;
  min-height:0;
  aspect-ratio:4/3;
}
#main :is(.programme-photo,.route-card-photo)>img {
  position:absolute;
  inset:0;
}
#main .programme:hover .programme-photo img {transform:none}

/* Keep the established split heroes; portrait mobile frames avoid extreme crops. */
#main .page-hero-photo {height:clamp(540px,50vw,780px)}
#main.page-private .page-hero-photo {
  height:auto;
  aspect-ratio:4/5;
  align-self:center;
}
#main.page-private .page-hero-photo>img {position:absolute;inset:0}
/* This narrow source tops out at 721px; let copy use the remaining desktop space. */
#main.page-private .page-hero.has-photo {
  grid-template-columns:minmax(0,1fr) min(47.619%,721px);
}

/* The broad academy group is editorial: its natural frame protects both edges. */
#main .about-photo {
  min-height:0;
  aspect-ratio:1280/1151;
  align-self:center;
}
#main .academy-team-photo {background:transparent;overflow:hidden}

/* Homepage coach feature and named profiles share a portrait treatment. */
#main .coaches {grid-template-columns:min(50%,716px) minmax(0,1fr)}
#main .coach-photo {min-height:0;aspect-ratio:4/5;align-self:center}
#main :is(.coach-portrait,.private-coach-card>figure,.advanced-coach-feature>figure) {
  position:relative;
  aspect-ratio:4/5;
  overflow:hidden;
  background:transparent;
}
#main :is(.coach-portrait,.private-coach-card>figure,.advanced-coach-feature>figure)>img {
  position:absolute;
  inset:0;
}

/* Programme features retain a useful portrait frame rather than a wide slot. */
#main .kids-environment {
  grid-template-columns:minmax(0,1fr) min(calc((100% - 48px)/2),600px);
}
#main .kids-environment>figure {
  position:relative;
  height:auto;
  aspect-ratio:4/5;
  overflow:hidden;
  background:transparent;
}
#main .kids-environment>figure>img {position:absolute;inset:0}
#main img.media--natural {height:auto}

/* Curated gallery: portrait rows, one consistent gap, no staggered empty slots. */
#main .gallery-grid {
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:24px;
  align-items:start;
}
#main .gallery-grid figure {
  height:auto;
  aspect-ratio:4/5;
  margin:0;
  background:transparent;
}
#main .gallery-grid img {position:absolute;inset:0}
#main .gallery-photo-frame {aspect-ratio:4/5}
#main .gallery-photo-frame>img {position:absolute;inset:0}
/* Narrow clay-court frame: a little more height keeps both coaching subjects. */
#main .gallery-photo-frame:has(.media--gallery-narrow) {aspect-ratio:3/5}
#main .gallery-photo-frame:has(.media--gallery-landscape) {aspect-ratio:4/3}
#main .rhino-gallery-grid {align-items:start}

@media(max-width:1100px) {
  #main .gallery-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px) {
  #main img.rhino-photo {
    object-position:var(--focus-x-mobile,var(--focus-x,50%)) var(--focus-y-mobile,var(--focus-y,50%));
  }
  #main .hero-image {min-height:0;aspect-ratio:3/4}
  #main .page-hero-photo {height:auto;aspect-ratio:4/5}
  #main .page-hero-photo>img {position:absolute;inset:0}
  #main.page-private .page-hero.has-photo {grid-template-columns:1fr}
  #main .coaches {grid-template-columns:1fr}
  #main .kids-environment {grid-template-columns:1fr}
}
@media(max-width:600px) {
  #main .gallery-grid {grid-template-columns:1fr}
}

/* Supplied artwork remains uncropped, with its existing size and proportions. */
.brand>img {object-fit:contain}

/* October gallery originals: preserve the complete action and both coaches. */
#main .gallery-photo-frame:has(.media--gallery-original) {aspect-ratio:auto}
#main .gallery-photo-frame>img.media--gallery-original {position:static;height:auto}
