/* ==================================================================
   Image blocks. Markup from inc/image-blocks.php.

   Built from the tokens in assets/css/site.css :root and nothing else,
   except the two duotone inks, which are the first pigment pair the
   generated duotone plates use (assets/js/site.js PIGMENTS). Breakpoints
   are the site's own: 400, 680, 780, 860 and 900.

   Columns use the same gap as the card grids, so a pair lines up with a
   two card section band, three with a three card band, and a feature
   with The Front above it.
   ================================================================== */

.idz-imgs{--imgs-gap:var(--gap-grid)}
/* Two pictures 34px apart on a phone read as two separate things. */
@media(width <= 680px){.idz-imgs{--imgs-gap:var(--gap-tight)}}

.idz-imgs-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--imgs-gap)}
.idz-imgs-fig{min-width:0}
.idz-imgs-link{display:block}
.idz-imgs-frame{position:relative;overflow:hidden;background:var(--tint);aspect-ratio:var(--ar,3/2);isolation:isolate}
/* site.css gives every img height:auto and max-width:100%, which would let a
   picture fall short of its frame. The frame decides the shape; the picture
   fills it and is cropped. */
.idz-imgs-frame img{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:none;
  object-fit:cover;object-position:var(--pos,50% 50%)}
.idz-imgs-cap{margin-top:var(--s2);font-family:var(--sans);font-size:10px;line-height:1.6;letter-spacing:.13em;
  text-transform:uppercase;color:var(--ink-faint);text-align:right}

.idz-imgs-link .idz-imgs-frame img{transition:transform .6s cubic-bezier(.16,1,.3,1)}
.idz-imgs-link:hover .idz-imgs-frame img{transform:scale(1.02)}
@media(prefers-reduced-motion:reduce){.idz-imgs-link .idz-imgs-frame img{transition:none}}

/* ---- grounds ----
   Tint and dark are bands the width of the screen, like the fiction panel,
   with the pictures kept to the column by an inner .wrap. */
.idz-imgs--tint{background:var(--tint);border-block:1px solid var(--rule);padding-block:var(--flow-in)}
.idz-imgs--tint .idz-imgs-frame{background:var(--tint2)}
.idz-imgs--dark{background:var(--dark);color:var(--on-dark);padding-block:var(--flow-in)}
.idz-imgs--dark .idz-imgs-frame{background:#221F1D;background:color-mix(in srgb,var(--on-dark) 6%,var(--dark))}
.idz-imgs--dark .idz-imgs-cap{color:var(--on-dark-soft)}

/* ---- wide ---- */
.idz-imgs--wide .idz-imgs-frame{--ar:16/9}
@media(width <= 680px){.idz-imgs--wide .idz-imgs-frame{--ar:4/3}}

/* ---- edge to edge ----
   No side padding anywhere, so the picture is exactly the width of the page.
   The heading and the caption keep to the column through their own .wrap. */
.idz-imgs.idz-imgs--bleed{padding-block:0}
.idz-imgs--bleed .idz-imgs-frame{aspect-ratio:auto;height:clamp(320px,62svh,720px)}
.idz-imgs--bleed>.hdr{padding-top:var(--flow)}
.idz-imgs--bleed.idz-imgs--tint>.hdr,.idz-imgs--bleed.idz-imgs--dark>.hdr{padding-top:var(--flow-in)}
/* On a band the caption would otherwise sit on the band's bottom edge. */
.idz-imgs--bleed.idz-imgs--tint .idz-imgs-cap,.idz-imgs--bleed.idz-imgs--dark .idz-imgs-cap{padding-bottom:var(--s4)}
@media(width <= 680px){.idz-imgs--bleed .idz-imgs-frame{aspect-ratio:1/1;height:auto}}

/* ---- pair ---- */
@media(width > 680px){.idz-imgs--pair .idz-imgs-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* ---- large and small ----
   Two columns at 2:1 exclude the gap, so a 3:2 frame in the first and a 3:4
   frame in the second come out exactly the same height at every width. Their
   bottoms line up without either being stretched, and so do their captions. */
.idz-imgs--major .idz-imgs-fig+.idz-imgs-fig .idz-imgs-frame{--ar:3/4}
@media(width > 680px){.idz-imgs--major .idz-imgs-grid{grid-template-columns:minmax(0,2fr) minmax(0,1fr);align-items:start}}
/* On a phone the small one keeps its rank: narrower, set to the right, and
   square, because at 3:4 and 62% of the width it stood taller than the large one. */
@media(width <= 680px){
  .idz-imgs--major .idz-imgs-fig+.idz-imgs-fig{width:62%;margin-left:auto}
  .idz-imgs--major .idz-imgs-fig+.idz-imgs-fig .idz-imgs-frame{--ar:1/1}
}

/* ---- three ---- */
@media(400px < width <= 680px){
  .idz-imgs--three .idz-imgs-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .idz-imgs--three .idz-imgs-fig:first-child{grid-column:1/-1}
  .idz-imgs--three .idz-imgs-fig+.idz-imgs-fig .idz-imgs-frame{--ar:1/1}
}
@media(680px < width < 780px){
  .idz-imgs--three .idz-imgs-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .idz-imgs--three .idz-imgs-frame{--ar:4/5}
  .idz-imgs--three .idz-imgs-fig:nth-child(3){grid-column:1/-1}
  .idz-imgs--three .idz-imgs-fig:nth-child(3) .idz-imgs-frame{--ar:16/9}
}
@media(width >= 780px){
  .idz-imgs--three .idz-imgs-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .idz-imgs--three .idz-imgs-frame{--ar:4/5}
}

/* ---- feature ----
   The columns are The Front's, 1.42 to 1. From 900px the large picture runs
   from the top of the first small one to the bottom of the second, captions
   or not: the rows are shared (subgrid), five of them, which are the first
   small, its caption, the gap, the second small, and the caption line. */
.idz-imgs--feature .idz-imgs-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.idz-imgs--feature .idz-imgs-fig:first-child{grid-column:1/-1}
@media(width <= 400px){.idz-imgs--feature .idz-imgs-grid{grid-template-columns:minmax(0,1fr)}}
@media(width >= 900px){
  .idz-imgs--feature .idz-imgs-grid{grid-template-columns:minmax(0,1.42fr) minmax(0,1fr);
    grid-template-rows:auto auto var(--imgs-gap) auto auto;row-gap:0}
  .idz-imgs--feature .idz-imgs-fig{display:grid;grid-template-rows:subgrid;row-gap:0}
  .idz-imgs--feature .idz-imgs-fig:nth-child(1){grid-column:1;grid-row:1/6}
  .idz-imgs--feature .idz-imgs-fig:nth-child(2){grid-column:2;grid-row:1/3}
  .idz-imgs--feature .idz-imgs-fig:nth-child(3){grid-column:2;grid-row:4/6}
  .idz-imgs--feature .idz-imgs-fig:first-child>:first-child{grid-row:1/5}
  .idz-imgs--feature .idz-imgs-fig:first-child .idz-imgs-frame{aspect-ratio:auto;height:100%}
  .idz-imgs--feature .idz-imgs-fig:first-child .idz-imgs-cap{grid-row:5}
}

/* ---- stagger ----
   The same columns as the feature. The second picture is set a full section
   step lower and made exactly as tall as the first, so what it gives up at
   the top it takes back at the bottom and the two offsets are equal. */
.idz-imgs--stagger .idz-imgs-fig:first-child{width:86%}
.idz-imgs--stagger .idz-imgs-fig+.idz-imgs-fig{width:72%;margin-left:auto}
.idz-imgs--stagger .idz-imgs-fig+.idz-imgs-fig .idz-imgs-frame{--ar:1/1}
@media(width > 680px){
  .idz-imgs--stagger .idz-imgs-grid{grid-template-columns:minmax(0,1.42fr) minmax(0,1fr);container-type:inline-size}
  .idz-imgs--stagger .idz-imgs-fig:first-child,.idz-imgs--stagger .idz-imgs-fig+.idz-imgs-fig{width:auto}
  .idz-imgs--stagger .idz-imgs-fig+.idz-imgs-fig{margin:var(--s8) 0 0}
  .idz-imgs--stagger .idz-imgs-fig+.idz-imgs-fig .idz-imgs-frame{aspect-ratio:auto;
    height:calc((100cqw - var(--imgs-gap)) * 1.42 / 2.42 * 2 / 3)}
}

/* ---- picture and line ----
   The caption set as a pull line, in the voice of .pull in a piece. Beside the
   picture from 860px, the fiction panel's split. */
.idz-imgs-pull{margin-top:var(--s4);padding-block:var(--s5);border-top:2px solid var(--rule-ink);
  border-bottom:1px solid var(--rule);font-family:var(--display);font-weight:400;font-style:italic;
  font-size:clamp(1.35rem,2.4vw,1.78rem);line-height:1.3;text-align:center;text-wrap:balance;
  font-variation-settings:'opsz' 40}
@media(width <= 680px){.idz-imgs-pull{padding-block:var(--s4);font-size:1.28rem}}
@media(width >= 860px){
  .idz-imgs--pull .idz-imgs-fig{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);
    gap:var(--imgs-gap);align-items:center}
  .idz-imgs--pull .idz-imgs-frame{--ar:4/5}
  .idz-imgs--pull .idz-imgs-pull{margin-top:0}
}
.idz-imgs--dark .idz-imgs-pull{border-top-color:var(--on-dark);border-bottom-color:rgba(246,242,234,.22)}

/* ---- treatments ----
   On the page only; the file in the library is untouched. */
.idz-imgs--ink .idz-imgs-frame img{filter:grayscale(1) contrast(1.05)}
.idz-imgs--duotone .idz-imgs-frame{--duo-deep:#A32017;--duo-light:#E0A32E;background:var(--duo-deep)}
.idz-imgs--duotone .idz-imgs-frame img{filter:grayscale(1) contrast(1.1);mix-blend-mode:screen}
.idz-imgs--duotone .idz-imgs-frame::after{content:"";position:absolute;inset:0;background:var(--duo-light);
  mix-blend-mode:multiply;pointer-events:none}
.idz-imgs--screen .idz-imgs-frame img{filter:grayscale(1) contrast(1.2)}
.idz-imgs--screen .idz-imgs-frame::after{content:"";position:absolute;inset:0;pointer-events:none;mix-blend-mode:multiply;
  background:radial-gradient(circle,rgba(15,13,11,.5) 1px,transparent 1.4px) 0 0/4px 4px}

/* ---- two dark masses never touch without a line between them ----
   The same hairline site.css draws between dark panels. A dark block and a
   picture across the whole screen both count as dark masses. */
.slab+.idz-imgs--dark,.photoband+.idz-imgs--dark,.idz-imgs--dark+.slab,.idz-imgs--dark+.photoband,
.idz-imgs--dark+.idz-imgs--dark,.slab+.idz-imgs--bleed,.photoband+.idz-imgs--bleed,.idz-imgs--bleed+.slab,
.idz-imgs--bleed+.photoband,.idz-imgs--bleed+.idz-imgs--bleed,.idz-imgs--dark+.idz-imgs--bleed,
.idz-imgs--bleed+.idz-imgs--dark,
.sechero+main>.idz-imgs--dark:first-child,.sechero+main>.idz-imgs--bleed:first-child{border-top:1px solid rgba(255,252,247,.20)}
/* Two tinted grounds meeting would draw their borders twice. */
.fiction+.idz-imgs--tint,.idz-imgs--tint+.fiction,.idz-imgs--tint+.idz-imgs--tint{border-top:0}

/* ---- inside a page ----
   A page holds its writing to a 60ch column. A block breaks out of it to the
   width of the page's .wrap, the bookshop's technique, but measured against
   main (100cqw) rather than 100vw. 100vw counts the scrollbar, so on a screen
   that draws one a shelf sized from it is wider than the page, sits off centre
   against the header, and an edge to edge picture scrolls sideways. Measured
   with a 15px scrollbar at 1440: the picture spans 0 to 1425, the page width. */
main:has(.body .idz-imgs){container-type:inline-size}
.body .idz-imgs{--shelf:calc(min(var(--max),100cqw) - 2 * var(--gutter));width:var(--shelf);max-width:var(--shelf);
  margin-block:var(--s6);margin-inline:calc(50% - var(--shelf) / 2);padding-block:0}
.body .idz-imgs--tint,.body .idz-imgs--dark,.body .idz-imgs--bleed{--shelf:100cqw}
.body .idz-imgs--tint:not(.idz-imgs--bleed),.body .idz-imgs--dark:not(.idz-imgs--bleed){padding-block:var(--flow-in)}
.body .idz-imgs a{text-decoration:none}
/* In a page the block's own margin already sets the space above it; the layout's
   flow padding on top of that put 110px over an edge-to-edge heading against 42
   for every other headed block on the same page. */
.body .idz-imgs--paper.idz-imgs--bleed>.hdr{padding-top:0}
/* .body h2 is sized for a subhead in the writing. Here it is a band header. */
.body .idz-imgs .hdr h2{margin:0;font-size:clamp(1rem,1.45vw,1.28rem);font-variation-settings:'opsz' 14}

/* ==================================================================
   The shared block styling. The classes come from inc/block-styling.php
   and the adverts carry the same ones; the two custom properties,
   --idz-blk-bg and --idz-blk-ink, come from idz_blk_style() on the
   section itself.

   Every selector below needs a class only a styled block carries, so a
   block nobody has touched is not reached by any of it. The breakpoint
   is the file's own: 680 and under is a phone.
   ================================================================== */

/* ---- the chosen ground ----
   It stands in for the block's own ground, so everything that ground painted
   is painted again from the two properties: the band, the type on it, the
   frame behind a picture, the caption and the pull rules. The duotone frame is
   left alone, because that background is the red plate the treatment prints
   through rather than a ground. */
.idz-imgs.idz-blk-bg{background:var(--idz-blk-bg);color:var(--idz-blk-ink);
  border-color:color-mix(in srgb,var(--idz-blk-ink) 16%,transparent)}
.idz-imgs.idz-blk-bg:not(.idz-imgs--bleed){padding-block:var(--flow-in)}
.idz-imgs.idz-blk-bg:not(.idz-imgs--duotone) .idz-imgs-frame{background:color-mix(in srgb,var(--idz-blk-ink) 8%,var(--idz-blk-bg))}
.idz-imgs.idz-blk-bg .idz-imgs-cap{color:color-mix(in srgb,var(--idz-blk-ink) 66%,var(--idz-blk-bg))}
.idz-imgs.idz-blk-bg .idz-imgs-pull{border-top-color:var(--idz-blk-ink);
  border-bottom-color:color-mix(in srgb,var(--idz-blk-ink) 30%,transparent)}
/* Inside a page a ground runs the full width, the way tint and dark already do. */
.body .idz-imgs.idz-blk-bg{--shelf:100cqw}

/* ---- heights, by name ----
   min-height and never height, so a block told to be short still grows when
   the words in it need the room. The lengths are the ones idz_blk_heights()
   offers. --imgs-fill-min goes with them: once a block has a height of its
   own, the floor under a filled picture has nothing left to guard against. */
@media(width > 680px){
  .idz-imgs.idz-blk-hd-short{min-height:260px;--imgs-fill-min:0}
  .idz-imgs.idz-blk-hd-medium{min-height:400px;--imgs-fill-min:0}
  .idz-imgs.idz-blk-hd-tall{min-height:560px;--imgs-fill-min:0}
  .idz-imgs.idz-blk-hd-screen{min-height:100svh;--imgs-fill-min:0}
}
@media(width <= 680px){
  .idz-imgs.idz-blk-hp-short{min-height:260px;--imgs-fill-min:0}
  .idz-imgs.idz-blk-hp-medium{min-height:400px;--imgs-fill-min:0}
  .idz-imgs.idz-blk-hp-tall{min-height:560px;--imgs-fill-min:0}
  .idz-imgs.idz-blk-hp-screen{min-height:100svh;--imgs-fill-min:0}
}

/* ---- filling ----
   The pictures crop to the block's height instead of keeping their own shape,
   which means the height has to be handed down every step from the section to
   the frame: each step is a column that stretches, and the frame takes what is
   left. Nothing is given min-height:0, because the default is what stops a
   heading or a caption being squashed; the frame measures nothing of its own,
   so the frame is the only thing that gives way.

   A filled block with no height set has nothing to be as tall as, so the frame
   keeps a floor until a height above clears it. */
.idz-imgs.idz-blk-fill{display:flex;flex-direction:column}
/* A ground's padding would be the one thing the picture could not fill, and on a
   short block it took more room than the picture it framed. The heading carries
   its own space instead. */
.idz-imgs.idz-blk-fill:is(.idz-blk-bg,.idz-imgs--tint,.idz-imgs--dark):not(.idz-imgs--bleed){padding-block:0}
/* A wrap centres itself with auto margins, and an auto margin on a grid or a flex
   item takes the free space rather than letting the item take it, so a wrap left
   to itself here shrinks to the width of its own words. It is told to take the
   whole column; its max-width still holds it to the page on a wide screen. */
.idz-imgs.idz-blk-fill>.wrap{width:100%}
.idz-imgs.idz-blk-fill>.wrap:not(.hdr){display:flex;flex-direction:column;flex:1 1 auto}
.idz-imgs.idz-blk-fill .idz-imgs-grid{flex:1 1 auto;align-items:stretch}
.idz-imgs.idz-blk-fill .idz-imgs-fig{display:flex;flex-direction:column;align-items:stretch}
.idz-imgs.idz-blk-fill .idz-imgs-link{display:flex;flex-direction:column;flex:1 1 auto}
/* height:auto as well as the ratio: edge to edge sets a height of its own, and a
   frame holding one would keep it and push the block past what it was asked for. */
.idz-imgs.idz-blk-fill .idz-imgs-fig .idz-imgs-frame{aspect-ratio:auto;height:auto;flex:1 1 auto;
  min-height:var(--imgs-fill-min,180px)}

/* ---- where the words sit ----
   Only ever on a filled block, and the words are the block's own heading.

   Under the pictures, the heading is all that moves, so the space that sat
   below it goes above it instead.

   Over them, the heading and the pictures share one cell, and the heading is
   laid on a fade of the ground the block was given rather than on a black of
   its own: that way it holds on a pale photograph as surely as on a dark one.
   With no ground chosen the fade falls back to the site's dark.

   The fade is a layer under the words rather than a background on them, and it
   hangs below the heading. Painted on the heading itself it would have needed
   that depth as padding, and the heading is the one thing a short block is not
   allowed to squash, so every short block would have grown to make room for it. */
.idz-imgs.idz-blk-fill.idz-blk-words-below>.hdr,
.idz-imgs.idz-blk-fill.idz-blk-words-below>.wrap:not(.hdr)>.hdr{order:2;padding-block:var(--gap-hdr) var(--s5)}

.idz-imgs.idz-blk-fill.idz-blk-words-over,
.idz-imgs.idz-blk-fill.idz-blk-words-over>.wrap:not(.hdr){display:grid;
  grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(min-content,1fr)}
.idz-imgs.idz-blk-fill.idz-blk-words-over>*,
.idz-imgs.idz-blk-fill.idz-blk-words-over>.wrap:not(.hdr)>*{grid-area:1/1}
.idz-imgs.idz-blk-fill.idz-blk-words-over .hdr{position:relative;align-self:start;z-index:2;
  padding-block:var(--s5);color:var(--idz-blk-ink,var(--on-dark))}
.idz-imgs.idz-blk-fill.idz-blk-words-over .hdr::before{content:"";position:absolute;z-index:-1;
  inset:0 0 calc(-1 * var(--s8));pointer-events:none;
  background:linear-gradient(to bottom,var(--idz-blk-bg,var(--dark)) 0,
    var(--idz-blk-bg,var(--dark)) calc(100% - var(--s8)),
    color-mix(in srgb,var(--idz-blk-bg,var(--dark)) 55%,transparent) calc(100% - var(--s8) / 2),transparent)}
/* The fade and the ground's strength, when the edit screen asks for other than the
   above (stage ZZ55; the properties are set in site.css, with the adverts'). A block
   nobody has changed carries none of these classes and keeps the rule above to the
   letter. Here the words stand at the top, so the fade runs down below them. */
.idz-imgs.idz-blk-fill.idz-blk-words-over:is([class*="idz-blk-fade-"],[class*="idz-blk-shade-"]) .hdr::before{
  --f:var(--idz-fade,var(--s8));--w:var(--idz-wash,var(--idz-blk-bg,var(--dark)));
  inset:0 0 calc(-1 * var(--f));
  background:linear-gradient(to bottom,var(--w) 0,var(--w) calc(100% - var(--f)),
    color-mix(in srgb,var(--w) 91%,transparent) calc(100% - var(--f) * .85),
    color-mix(in srgb,var(--w) 74%,transparent) calc(100% - var(--f) * .68),
    color-mix(in srgb,var(--w) 50%,transparent) calc(100% - var(--f) * .5),
    color-mix(in srgb,var(--w) 26%,transparent) calc(100% - var(--f) * .32),
    color-mix(in srgb,var(--w) 9%,transparent) calc(100% - var(--f) * .15),transparent)}
/* Edge to edge the picture is the width of the screen, so the fade over it has
   to be too, with the heading still standing where the column would put it. */
.idz-imgs.idz-imgs--bleed.idz-blk-fill.idz-blk-words-over>.hdr{max-width:none;
  padding-inline:max(var(--gutter),calc((100% - var(--max)) / 2 + var(--gutter)))}

/* ---- one screen and not the other ----
   Last of all, so that it beats the display a filled block sets for itself.
   Nothing is kept back: no gap, no padding, and a browser does not fetch a
   lazy picture inside a block that has no box. The one picture that would
   have been fetched at once is turned off in idz_imgb_markup(). */
/* !important because the fill rules above set display on a longer selector, and a
   block told to stay off one screen has to win that argument whatever else it is. */
@media(width > 680px){.idz-imgs.idz-blk-off-d{display:none!important}}
@media(width <= 680px){.idz-imgs.idz-blk-off-p{display:none!important}}
