/* Editorial image frames
   Keep photography in aspect-ratio frames that match the supplied artwork.
   This stylesheet loads after the legacy page-specific rules so image crops
   stay predictable at every viewport width. */

img {
  max-width: 100%;
}

.hero-card,
.feature-photo,
.postcard,
.gallery-slide,
.details figure,
.story-photo,
.article-hero,
.journal-reading-card {
  min-width: 0;
}

.hero-card {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.hero-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.feature-photo {
  position: relative;
  min-height: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}

.feature-photo > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.postcard {
  position: relative;
  min-height: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}

.postcard > img {
  position: absolute;
  inset: 9px;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  object-fit: cover;
  object-position: center;
}

.details figure {
  min-width: 0;
}

.details figure > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
}

.gallery-window {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.gallery-track {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: clamp(14px, 1.4vw, 22px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-slide {
  display: block;
  flex: 0 0 clamp(300px, 34vw, 430px);
  width: auto;
  max-width: 430px;
  height: auto;
  overflow: visible;
  scroll-margin-inline: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery-slide > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
}

.gallery-slide figcaption {
  min-height: 62px;
  padding-top: 15px;
}

.story-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.story-photo > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.journal-reading-card {
  overflow: hidden;
}

.journal-reading-card > img {
  display: block;
  max-width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
}

.article-hero {
  position: relative;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 1;
  overflow: hidden;
}

.article-hero > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.article-hero > img[src*="work-life"] {
  object-position: 54% 42%;
}

.article-hero > img[src*="new-chapter"] {
  object-position: 50% 42%;
}

.article-hero > img[src*="family-hopes"] {
  object-position: 52% 42%;
}

@media (min-width: 741px) and (max-width: 1100px) {
  .gallery-slide {
    flex-basis: clamp(300px, 42vw, 400px);
  }

  .article-hero {
    aspect-ratio: 3 / 2;
  }
}

@media (min-width: 741px) and (max-width: 800px) {
  .article-body blockquote {
    margin-inline: 0;
  }
}

@media (max-width: 740px) {
  .hero-card {
    aspect-ratio: 3 / 2;
  }

  .feature-photo {
    aspect-ratio: 4 / 5;
  }

  .postcard-grid {
    display: flex;
    grid-template-columns: none;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
  }

  .postcard {
    flex: 0 0 min(82vw, 380px);
    scroll-snap-align: start;
  }

  .gallery {
    padding-inline: 22px;
  }

  .gallery-head {
    flex-wrap: wrap;
  }

  .gallery-head > div:first-child {
    flex: 1 0 100%;
  }

  .gallery-controls {
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
  }

  .gallery-track {
    gap: 14px;
  }

  .gallery-slide {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .details figure > img {
    aspect-ratio: 3 / 2;
  }

  .journal-reading-card > img {
    flex: 0 0 31%;
    width: 31%;
    align-self: center;
    aspect-ratio: 4 / 3;
  }

  .article-hero {
    display: flex;
    flex-direction: column;
    aspect-ratio: auto;
    overflow: visible;
    background: var(--wine);
  }

  .article-hero > img {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    flex: none;
  }

  .hero-fade {
    display: none;
  }

  .article-hero .hero-caption {
    position: relative;
    inset: auto;
    max-width: none;
    padding: 24px 24px 30px;
    background: var(--wine);
    color: var(--cream);
  }
}

/* Keep portrait artwork intact even if browser zoom or a future frame rule
   changes the available box ratio. These are original 4:5 image assets, so
   contain prevents faces and shoulders being clipped at wide and narrow sizes. */
.gallery-window {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.gallery-track {
  min-width: 0;
  max-width: 100%;
  align-items: flex-start;
}

.gallery-slide {
  flex: 0 0 min(38vw, 430px);
  width: auto;
  max-width: 430px;
  min-width: 0;
}

.gallery-slide > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1122 / 1402;
  object-fit: contain;
  object-position: center;
  background: #54202a;
}

@media (max-width: 740px) {
  .gallery-slide {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .gallery {
    padding-inline: 16px;
  }

  .gallery-slide {
    flex-basis: 100%;
  }

  .postcard {
    flex-basis: min(88vw, 340px);
  }

  .journal-reading-card > img {
    flex-basis: 29%;
    width: 29%;
  }
}

@media (min-width: 1600px) {
  .gallery {
    padding-inline: max(calc((100vw - 1320px) / 2), 6vw);
  }

  .gallery-slide {
    flex-basis: min(34vw, 460px);
    max-width: 460px;
  }

  .article-hero {
    aspect-ratio: 2.1 / 1;
  }
}

/* Subject-aware framing: each generated image keeps the people or table that
   tells its story in view when a fixed editorial frame crops its edges. */
.hero-card > img[src*="dinner-table"] {
  object-position: 50% 48%;
}

.feature-photo > img[src*="feature-aperitif-group"] {
  object-position: 50% 38%;
}

.postcard > img[src*="postcard-townhouse-oxblood"] {
  object-position: 50% 38%;
}

.postcard > img[src*="postcard-jade-salon"] {
  object-position: 50% 34%;
}

.postcard > img[src*="postcard-midnight-room"] {
  object-position: 50% 34%;
}

.gallery-slide > img[src*="cocktail-conversation"] {
  object-position: 50% 32%;
}

.gallery-slide > img[src*="couple-at-the-bar"] {
  object-position: 50% 30%;
}

.gallery-slide > img[src*="gallery-solo-portrait"] {
  object-position: 50% 28%;
}

.details figure > img[src*="details-private-dining-room"] {
  object-position: 50% 48%;
}

.story-photo > img[src*="london-table-card"] {
  object-position: 50% 52%;
}

.story-photo > img[src*="work-life-card"] {
  object-position: 50% 42%;
}

.story-photo > img[src*="soft-dating-card"] {
  object-position: 50% 42%;
}

.story-photo > img[src*="new-chapter-card"] {
  object-position: 50% 42%;
}

.story-photo > img[src*="family-hopes-card"] {
  object-position: 50% 42%;
}

.article-hero > img[src*="london-table.jpg"] {
  object-position: 50% 43%;
}

.article-hero > img[src*="soft-dating.jpg"] {
  object-position: 50% 43%;
}

@media (max-width: 740px) {
  .gallery-slide > img[src*="cocktail-conversation"] {
    object-position: 50% 29%;
  }

  .gallery-slide > img[src*="couple-at-the-bar"] {
    object-position: 50% 28%;
  }

  .gallery-slide > img[src*="gallery-solo-portrait"] {
    object-position: 50% 26%;
  }
}
