/* ===== Photographs (ALIVE.md §5b, seat P) ===============================================================
   Nine treated photographs, three uses. Classes ph-* only; colours only from the DESIGN.md §2 tokens
   (fallbacks are the same colours as rgb()). Motion per ALIVE.md §2: loops only under .motion .is-live,
   transform only (the `scale` property), the image always clipped by its frame; without .motion: still.

   ph-hero  the right half of a dark hero, bleeding to the screen's right edge, fading into the oxblood on its
            left (and under the header at its top), so a headline to its left always reads.
            Place the include as the LAST child of the hero section (after its .wrap). The hero gets
            `isolation: isolate` from the rule below, and the photo sits behind the hero's text (z-index -1).
            Under 1000px it becomes a band 220px tall across the bottom of the hero, under the text.
   ph-card  4:3, for field cards (fcard__photo) and tiles.
            Place it as the card's first child.
   ph-band  a wide strip behind large light type, darkened evenly (see --ph-band-veil); the type sits on it
            in the page (the creed on company.html).
   Natural colour (DAYLIGHT.md §5), for the light middle of the pages; roots also carry ph-nat (a pale ice
   ground while the picture loads, instead of oxblood):
   ph-feature  16:10 in a large media frame (a "feature" half, 520px wide and up), radius 8px on all corners.
   ph-card     reused: the natural 4:3 card (photo-<name>-nat-card.html), for cards and the mosaic.
   ========================================================================================================= */

.ph-hero, .ph-card, .ph-band, .ph-feature { position: relative; overflow: hidden; background: var(--ox-900, rgb(42, 12, 24)); }
.ph-hero img, .ph-card img, .ph-band > img, .ph-feature img { display: block; width: 100%; height: 100%; object-fit: cover; scale: 1; transform-origin: 50% 50%; }

/* ---- hero ---------------------------------------------------------------------------------------- */
:where(*):has(> .ph-hero) { isolation: isolate; }
.ph-hero { position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; width: 50%; background: transparent;
  /* fade to nothing at the left, into the hero's own oxblood whatever its gradient: no seam */
  -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .12) 10%, rgba(0, 0, 0, .45) 24%, rgba(0, 0, 0, .85) 42%, rgba(0, 0, 0, 1) 58%);
  mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .12) 10%, rgba(0, 0, 0, .45) 24%, rgba(0, 0, 0, .85) 42%, rgba(0, 0, 0, 1) 58%); }
/* the scrim: an oxblood veil, solid under the header (its words stay on plain oxblood), heavier on the left,
   so the picture stays quiet next to the headline */
.ph-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--ox-900, rgb(42, 12, 24)) 0, var(--ox-900, rgb(42, 12, 24)) var(--header-h, 76px),
      color-mix(in srgb, var(--ox-900, rgb(42, 12, 24)) 0%, transparent) calc(var(--header-h, 76px) + 64px)),
    linear-gradient(to right, color-mix(in srgb, var(--ox-900, rgb(42, 12, 24)) 70%, transparent) 0%,
      color-mix(in srgb, var(--ox-900, rgb(42, 12, 24)) 18%, transparent) 60%, transparent 100%); }
.ph-hero img { object-position: 60% 50%; }

@media (max-width: 999px) {
  /* the band closes the hero: it runs to the hero's bottom edge and across the full screen width */
  :where(*):has(> .ph-hero) { padding-bottom: 0; }
  .ph-hero { position: relative; top: auto; right: auto; bottom: auto; width: auto; height: 220px; margin-top: 40px;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 45%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 45%); }
  .ph-hero::after { background: color-mix(in srgb, var(--ox-900, rgb(42, 12, 24)) 22%, transparent); }
  .ph-hero img { object-position: 50% 50%; }
}

/* ---- card ---------------------------------------------------------------------------------------- */
.ph-card { display: block; aspect-ratio: 4 / 3; margin: -33px -33px 24px; border-radius: 6px 6px 0 0; }
@media (max-width: 899px) { .ph-card { margin: -29px -25px 20px; } }
/* inside the Home field cards' own photo slot (.fcard__photo already sizes, places and clips it) */
.fcard__photo > .ph-card { margin: 0; aspect-ratio: auto; border-radius: 0; }

/* ---- feature and the natural set (DAYLIGHT.md §5) ------------------------------------------------- */
.ph-feature { display: block; aspect-ratio: 16 / 10; border-radius: 8px; isolation: isolate; }
.ph-nat { background: var(--ice-100); }

/* ---- band ---------------------------------------------------------------------------------------- */
.ph-band { --ph-band-veil: 58%; min-height: clamp(280px, 30vw, 440px); display: grid; align-items: center; isolation: isolate; color: var(--on-dark, rgb(255, 255, 255)); }
.ph-band > img { position: absolute; inset: 0; z-index: -2; }
.ph-band::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: color-mix(in srgb, var(--ox-950, rgb(31, 8, 18)) var(--ph-band-veil), transparent); }

/* ---- motion (ALIVE.md §2): slow drift while on screen; zoom on hover of a link or card ------------- */
@keyframes ph-drift { from { scale: 1; } to { scale: 1.05; } }
.motion .is-live:is(.ph-hero, .ph-card, .ph-band, .ph-feature) img {
  animation: ph-drift 14s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -2.3s); }
.motion :is(.ph-hero, .ph-card, .ph-band, .ph-feature) img { transition: transform 600ms var(--ease-out, cubic-bezier(.16, 1, .3, 1)), opacity 700ms var(--ease, ease); }
/* a picture still loading is held back and fades in when ready (site.js sets and clears .is-loading), so nothing pops */
.motion :is(.ph-hero, .ph-card, .ph-band, .ph-feature) img.is-loading { opacity: 0; }
/* on hover the drift holds where it is and the picture moves on to 1.06 of that, smoothly, with no jump */
.motion a:is(:hover, :focus-visible) :is(.ph-card, .ph-band, .ph-hero, .ph-feature) img,
.motion .ph-feature:hover img { transform: scale(1.06); animation-play-state: paused; }

/* ph-band--nat: the natural-colour photograph behind the words, darkened from the left (where the type sits)
   instead of an even oxblood veil, so the stone keeps its own colour at the right (company "Our principle") */
.ph-band--nat::after { background: linear-gradient(90deg, rgba(31, 8, 18, .86), rgba(31, 8, 18, .72) 45%, rgba(31, 8, 18, .34)); }
@media (max-width: 899px) {
  .ph-band--nat::after { background: rgba(31, 8, 18, .76); }
}
