/* Frames take the shape of their photo, so wide photos stay wide and tall photos stay tall.
   The page generator tags each frame: o-l (landscape), o-p (portrait), o-s (square),
   and --ar, the photo's own width/height. Loaded after each page's styles. */

/* Grids: one landscape, one portrait and one square shape, so rows still line up */
.img.o-l,.img.o-p,.img.o-s{height:auto!important;max-height:none!important}
.img.o-l{aspect-ratio:3/2!important}
.img.o-p{aspect-ratio:4/5!important}
.img.o-s{aspect-ratio:1/1!important}

/* Rows of cards: every photo in a row is the same height, and each card is as wide as its
   photo's shape (--g, set on the card). Widths grow in proportion, so heights stay equal. */
.sel .card,.grid>a,.places>a{min-width:0}
@media (min-width:901px){
  .sel,.grid,.places{display:flex!important;flex-wrap:wrap;align-items:flex-start;--h:300px}
  .sel .card,.grid>a,.places>a{flex:var(--g,1) 1 calc(var(--g,1)*var(--h))!important;max-width:calc(var(--g,1)*var(--h)*1.6)}
  /* Single rows stay on one line; shrinking is in proportion too, so heights still match */
  .sel,.places,.grid:not(:has(>a.card)){flex-wrap:nowrap}
  /* Section pages: one photo height for every row; three wide cards fill a line */
  .grid:has(>a.card){container-type:inline-size}
  .grid:has(>a.card)>a{flex:0 0 calc(var(--g,1)*(100cqw - 64px)/4.5)!important;max-width:none}
}
@media (max-width:900px){
  /* Swipe rows: one fixed photo height */
  .sel,.places,.grid:not(:has(>a.card)){--h:200px}
  .sel .card,.places>a,.grid:not(:has(>a.card))>a{flex:0 0 calc(var(--g,1)*var(--h))!important;max-width:none}
  /* Section pages: one card per line, every photo the height of a full-width wide photo */
  .grid:has(>a.card){display:flex!important;flex-wrap:wrap;align-items:flex-start;container-type:inline-size}
  .grid:has(>a.card)>a{flex:0 0 100%!important;max-width:none}
  .grid:has(>a.card)>a>.img{width:calc(var(--g,1)*100cqw/1.5)}
}

/* A photo that stands on its own shows in full */
.lead .img.o-l,.lead .img.o-p,.lead .img.o-s,
.est>.img.o-l,.est>.img.o-p,.est>.img.o-s,
.editor .img.o-l,.editor .img.o-p,.editor .img.o-s,
.conv .img.o-l,.conv .img.o-p,.conv .img.o-s{aspect-ratio:var(--ar)!important}

/* Profile cover: a tall photo fills the right half; a wide one sits there at its own shape */
.hero:has(>.img.o-l),.hero:has(>.img.o-s){min-height:0;align-items:center}
.hero .img.o-l,.hero .img.o-s{aspect-ratio:var(--ar)!important}
@media (min-width:901px){.hero .img.o-p{aspect-ratio:auto!important;height:auto!important}}
@media (max-width:900px){.hero .img.o-p{aspect-ratio:4/5!important}}

/* The homepage cover and the small list thumbnails keep their fixed crops */
.cover .img.o-l,.cover .img.o-p,.cover .img.o-s{aspect-ratio:auto!important;height:auto!important}
.latest .img.o-l,.latest .img.o-p,.latest .img.o-s{aspect-ratio:1/1!important}

/* Rows of photos: same height, each as wide as its shape needs, nothing cropped */
.trio{display:flex!important;align-items:flex-start}
.trio img{flex:var(--g,1) 1 0;min-width:0;width:auto!important;height:auto!important;aspect-ratio:var(--ar)!important}

/* City pages (Along the Coast): one fixed layout on every city. The lead is always 3:2,
   then an even grid of identical square photos (one per row on phones); portraits are framed on the face. */
.city .lead .img{aspect-ratio:3/2!important}
.city .grid{display:grid!important;grid-template-columns:repeat(3,1fr);gap:40px 32px;align-items:start}
.city .grid>a{flex:none!important;max-width:none!important;width:auto!important}
.city .grid>a>.img{aspect-ratio:1/1!important;width:auto!important}
.city .grid .img.o-p img{object-position:50% 20%}
@media (max-width:900px){.city .grid{grid-template-columns:1fr;gap:32px}}

/* Section and city pages: every story uses the same large layout and the same 3:2 photo
   frame, so the page reads as an even list. Portraits are framed on the face. */
.lead .img.o-l,.lead .img.o-p,.lead .img.o-s{aspect-ratio:3/2!important}
.lead .img.o-p img{object-position:50% 20%}
.leads{padding:0 0 88px}
.leads>.lead{margin-top:48px}
@media (max-width:900px){.leads{padding-bottom:56px}.leads>.lead{margin-top:32px}}
