/* The photo grid at the foot of About (index.html .about-grid; Keyan, 2026-11-15: "make this grid at the bottom of about
   page, w the correct corner radius to match tidbits projects. give them the same magnatism and gap"). Figma
   keyan-folio-v2 1445:17529 (four portraits, 1309 by 1960) over 1445:17552 (two wide photos, 2635 and 2724 by 1591).
   Slots keep Figma's shapes; about-grid.js puts each slot's photo in it (--about-grid-slot-N), and each photo fills its
   slot as cover, then zooms by --about-grid-<photo>-zoom about its focus (-x, -y), so the focus stays put. Corners, line,
   gap, hover light and lean are the tidbits' (about.css .tidbit, tidbits.js). Tuned in labs/about-grid. */
.about-grid {
  container-type: inline-size;
  display: grid;
  gap: var(--about-grid-gap);
  /* In 6px, to the lede's text edges (about.css .lede), less any bleed. */
  margin: 0 calc(6px - var(--about-grid-bleed, 0px));
}

/* Page width (--about-grid-width page; Keyan, 2026-11-15: "the width of the whole page, like tidbits grid"): the card's
   width less --card-inset (12px) a side, as the tidbits grid has (about.css .tiles). The About panel is the card (style.css .panel) and
   the query container; the column sits centred in it, 33.5px left of centre (about.css .column), so the grid's left
   edge moves out by half the difference and back by that 33.5px. Desktop only: below 900px the column fills the card. */
.panel.about { container-type: inline-size; }
@media (min-width: 900px) {
  .about-grid[data-width="page"] {
    width: calc(100cqw - 2 * var(--card-inset));
    margin-inline: calc(var(--card-inset) + 33.5px - (100cqw - 100%) / 2) 0;
  }
}

/* At page width the photos centre on the card, so the flowers do too: the column sits 33.5px left of the card centre
   (about.css .column), and the flowers move back by that (Keyan, 2026-11-16: "seomthign here is not centered"). */
@media (min-width: 900px) {
  .column:has(> .about-grid[data-width="page"]) > .about-sign { translate: 33.5px 0; }
}

/* Flowers off at page width: as far from the card's foot as from its sides, 12px (Keyan, 2026-11-15: "when flowers
   off, ensure equal padding side bottom"). The column's foot room (about.css .column, 53px) gives way. */
@container style(--about-sign: off) {
  @media (min-width: 900px) {
    .column:has(> .about-grid[data-width="page"]) { padding-bottom: var(--card-inset); }
  }
}
/* The same with the flowers above the photos: the photos are last again. */
@container style(--about-sign: before) {
  @media (min-width: 900px) {
    .column:has(> .about-grid[data-width="page"]) { padding-bottom: var(--card-inset); }
  }
}

/* --about-grid-row-2 off: the portraits alone (Keyan, 2026-11-15: "have toggle for second row"). */
.about-grid[data-row2="off"] .about-grid-row + .about-grid-row { display: none; }
/* right: only the right photo, across the whole width at its own shape (Keyan, 2026-11-15: "just the right bottom iamge,
   1 image in bottom row"). */
.about-grid[data-row2="right"] .about-grid-slot[data-slot="6"] { display: none; }

.about-grid-row {
  display: flex;
  gap: var(--about-grid-gap);
}

.about-grid-slot {
  position: relative;
  flex: var(--r) 1 0;
  min-width: 0;
  margin: 0;
}

/* Figma's slot shapes: the portraits equal, the wide pair sharing one height by their own shapes. Slots 1 to 5 are the
   top row (5 only in the five version), 6 and 7 the wide pair. */
.about-grid-slot { --r: 0.6679; }
.about-grid-slot[data-slot="6"] { --r: 1.6562; }
.about-grid-slot[data-slot="7"] { --r: 1.7122; }
.about-grid:not([data-bento-version="five"], [data-bento-version="five-dog"], [data-bento-version="round-5"], [data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) .about-grid-slot[data-slot="5"] { display: none; }

/* figma (1445:17647): the wide pair taller, 2635 and 2724 by 1758. */
.about-grid:is([data-bento-version="figma"], [data-bento-version="figma-1"], [data-bento-version="board"], [data-bento-version="round-4"]) .about-grid-slot[data-slot="6"] { --r: 1.4989; }
.about-grid:is([data-bento-version="figma"], [data-bento-version="figma-1"], [data-bento-version="board"], [data-bento-version="round-4"]) .about-grid-slot[data-slot="7"] { --r: 1.5495; }

/* five: five portraits share the top row's width. free: their own shape. match: as tall as the wide pair, whose
   height is the grid's width less the gap, over the sum of their shapes. */
.about-grid:is([data-bento-version="five"], [data-bento-version="five-dog"], [data-bento-version="round-5"])[data-five-fit="free"] .about-grid-row:first-child .about-grid-slot { --r: var(--about-grid-five-shape); }
.about-grid:is([data-bento-version="five"], [data-bento-version="five-dog"], [data-bento-version="round-5"])[data-five-fit="match"] .about-grid-row:first-child .plate {
  aspect-ratio: auto;
  height: calc((100cqw - var(--about-grid-gap)) / (1.6562 + 1.7122));
}

/* round-6 (Figma 1463:18095) and round-7 (1463:18131, the blurry beanie selfie last), Keyan 2026-11-16: seven across in one row, each 1309 by 1814, no second row. Slots 8 and
   9 sit at the top row's end and show only here. Each photo has its own crop for this shorter slot (tokens.css
   --about-grid-round-6-<photo>-*), worked out from Figma's layers. */
.about-grid-slot:is([data-slot="8"], [data-slot="9"]) { display: none; }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) .about-grid-slot:is([data-slot="5"], [data-slot="8"], [data-slot="9"]) { display: block; }
/* round-8 (Figma 1463:18157): six across, round-6 less the hoodie. */
.about-grid[data-bento-version="round-8"] .about-grid-slot[data-slot="9"] { display: none; }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) .about-grid-row:first-child .about-grid-slot { --r: 0.7216; }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) .about-grid-row + .about-grid-row { display: none; }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="plant"] { --z: var(--about-grid-round-6-plant-zoom); --x: var(--about-grid-round-6-plant-x); --y: var(--about-grid-round-6-plant-y); }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="dog"] { --z: var(--about-grid-round-6-dog-zoom); --x: var(--about-grid-round-6-dog-x); --y: var(--about-grid-round-6-dog-y); }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="lanterns"] { --z: var(--about-grid-round-6-lanterns-zoom); --x: var(--about-grid-round-6-lanterns-x); --y: var(--about-grid-round-6-lanterns-y); }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="beanie"] { --z: var(--about-grid-round-6-beanie-zoom); --x: var(--about-grid-round-6-beanie-x); --y: var(--about-grid-round-6-beanie-y); }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="icecream"] { --z: var(--about-grid-round-6-icecream-zoom); --x: var(--about-grid-round-6-icecream-x); --y: var(--about-grid-round-6-icecream-y); }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="friends"] { --z: var(--about-grid-round-6-friends-zoom); --x: var(--about-grid-round-6-friends-x); --y: var(--about-grid-round-6-friends-y); }
.about-grid:is([data-bento-version="round-6"], [data-bento-version="round-7"], [data-bento-version="round-8"]) [data-photo="hoodie"] { --z: var(--about-grid-round-6-hoodie-zoom); --x: var(--about-grid-round-6-hoodie-x); --y: var(--about-grid-round-6-hoodie-y); }

.about-grid .plate {
  position: relative;
  aspect-ratio: var(--r);
  overflow: clip;
  border-radius: var(--picture-r);
  background: var(--tidbit-plate);
  /* Hovered, it lightens as a tidbit does (about.css .tidbit .plate). */
  --l: var(--tidbit-hover-light);
  transition: filter var(--tidbit-hover-time) var(--motion-ease-sheet);
}

/* The 1px line every picture has inside its edge, over the photo. */
.about-grid .plate::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px #f4f4f4;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .about-grid-slot:hover .plate {
    filter: contrast(calc((1 - var(--l)) / (1 + var(--l)))) brightness(calc(1 + var(--l)));
  }
}

/* Each photo sits in a .pic that zooms (scale, about the focus); the picture inside fills it as cover, showing the
   focus. The zoom is on the .pic, not the picture, as image-zoom.js presses the picture with its own scale. */
.about-grid .pic {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: var(--x) var(--y);
  scale: var(--z);
}

.about-grid .pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--x) var(--y);
  cursor: pointer;
}

.about-grid [data-photo="plant"] { --z: var(--about-grid-plant-zoom); --x: var(--about-grid-plant-x); --y: var(--about-grid-plant-y); }
.about-grid [data-photo="dog"] { --z: var(--about-grid-dog-zoom); --x: var(--about-grid-dog-x); --y: var(--about-grid-dog-y); }
.about-grid [data-photo="lanterns"] { --z: var(--about-grid-lanterns-zoom); --x: var(--about-grid-lanterns-x); --y: var(--about-grid-lanterns-y); }
.about-grid [data-photo="hoodie"] { --z: var(--about-grid-hoodie-zoom); --x: var(--about-grid-hoodie-x); --y: var(--about-grid-hoodie-y); }
.about-grid [data-photo="beanie"] { --z: var(--about-grid-beanie-zoom); --x: var(--about-grid-beanie-x); --y: var(--about-grid-beanie-y); }
.about-grid [data-photo="selfie"] { --z: var(--about-grid-selfie-zoom); --x: var(--about-grid-selfie-x); --y: var(--about-grid-selfie-y); }
.about-grid [data-photo="boardgame"] { --z: var(--about-grid-boardgame-zoom); --x: var(--about-grid-boardgame-x); --y: var(--about-grid-boardgame-y); }
.about-grid [data-photo="plant-right"] { --z: var(--about-grid-plant-right-zoom); --x: var(--about-grid-plant-right-x); --y: var(--about-grid-plant-right-y); }
/* The three Figma rounds side by side (Keyan, 2026-11-15: "have versions for the last 3 iterations"): figma-1 is the
   first (1445:17688), with the dog whole and the beanie at 25%; figma is the second (1456:17794), the dog zoomed in
   and the beanie moved over, on the photos' own tokens; board is the third (1456:17851). */
.about-grid[data-bento-version="figma-1"] [data-photo="dog"] { --z: var(--about-grid-figma-1-dog-zoom); --x: var(--about-grid-figma-1-dog-x); --y: var(--about-grid-figma-1-dog-y); }
.about-grid[data-bento-version="figma-1"] [data-photo="beanie"] { --z: var(--about-grid-figma-1-beanie-zoom); --x: var(--about-grid-figma-1-beanie-x); --y: var(--about-grid-figma-1-beanie-y); }
/* board keeps the dog at its old, wider crop (Figma 1456:17851). */
.about-grid[data-bento-version="board"] [data-photo="dog"] { --z: var(--about-grid-board-dog-zoom); --x: var(--about-grid-board-dog-x); --y: var(--about-grid-board-dog-y); }
.about-grid [data-photo="raccoons"] { --z: var(--about-grid-raccoons-zoom); --x: var(--about-grid-raccoons-x); --y: var(--about-grid-raccoons-y); }
/* five-dog and round-5 (Figma 1461:17898): the dog whole. five-dog: five, but the dog whole (Keyan, 2026-11-15: "make ver 6 which has 5 but the unzoomed dog"). */
.about-grid:is([data-bento-version="five-dog"], [data-bento-version="round-5"]) [data-photo="dog"] { --z: var(--about-grid-round-4-dog-zoom); --x: var(--about-grid-round-4-dog-x); --y: var(--about-grid-round-4-dog-y); }
.about-grid[data-bento-version="round-4"] [data-photo="dog"] { --z: var(--about-grid-round-4-dog-zoom); --x: var(--about-grid-round-4-dog-x); --y: var(--about-grid-round-4-dog-y); }
.about-grid [data-photo="icecream"] { --z: var(--about-grid-icecream-zoom); --x: var(--about-grid-icecream-x); --y: var(--about-grid-icecream-y); }
.about-grid [data-photo="friends"] { --z: var(--about-grid-friends-zoom); --x: var(--about-grid-friends-x); --y: var(--about-grid-friends-y); }
.about-grid [data-photo="beanie-blur"] { --z: var(--about-grid-beanie-blur-zoom); --x: var(--about-grid-beanie-blur-x); --y: var(--about-grid-beanie-blur-y); }
.about-grid [data-photo="group"] { --z: var(--about-grid-group-zoom); --x: var(--about-grid-group-x); --y: var(--about-grid-group-y); }

/* A phone: the portraits two by two, the wide pair one above the other. */
@media (max-width: 639px) {
  .about-grid { margin: 0; }
  .about-grid-row { flex-wrap: wrap; }
  .about-grid-row:first-child .about-grid-slot { flex: 1 1 calc(50% - var(--about-grid-gap) / 2); }
  .about-grid-row + .about-grid-row { flex-direction: column; }
}

/* Print and exposure (Keyan, 2026-11-16: "make sure that the asset textures are hitting these images like halftone ...
   give me a control to increase their exposure slightly for each"). Each photo takes the about photo's print (print.js,
   #print-snap: its dots, plates and cutoff) while the page's print is on, after its exposure: brightness by
   --about-grid-exposure (all of them) times --about-grid-<photo>-exposure (one), 1 for as shot. */
.about-grid .pic img { filter: brightness(calc(var(--about-grid-exposure, 1) * var(--exposure, 1))); }
.print-art .about-grid .pic img { filter: brightness(calc(var(--about-grid-exposure, 1) * var(--exposure, 1))) url(#print-snap); }
.about-grid [data-photo="plant"] { --exposure: var(--about-grid-plant-exposure, 1); }
.about-grid [data-photo="dog"] { --exposure: var(--about-grid-dog-exposure, 1); }
.about-grid [data-photo="lanterns"] { --exposure: var(--about-grid-lanterns-exposure, 1); }
.about-grid [data-photo="hoodie"] { --exposure: var(--about-grid-hoodie-exposure, 1); }
.about-grid [data-photo="beanie"] { --exposure: var(--about-grid-beanie-exposure, 1); }
.about-grid [data-photo="icecream"] { --exposure: var(--about-grid-icecream-exposure, 1); }
.about-grid [data-photo="friends"] { --exposure: var(--about-grid-friends-exposure, 1); }
.about-grid [data-photo="beanie-blur"] { --exposure: var(--about-grid-beanie-blur-exposure, 1); }
.about-grid [data-photo="boardgame"] { --exposure: var(--about-grid-boardgame-exposure, 1); }
.about-grid [data-photo="raccoons"] { --exposure: var(--about-grid-raccoons-exposure, 1); }
.about-grid [data-photo="plant-right"] { --exposure: var(--about-grid-plant-right-exposure, 1); }
.about-grid [data-photo="selfie"] { --exposure: var(--about-grid-selfie-exposure, 1); }
.about-grid [data-photo="group"] { --exposure: var(--about-grid-group-exposure, 1); }

/* Film (--about-grid-look film; about-film.js, Keyan, 2026-11-16): the photos take #about-film in place of the halftone
   print, after their exposure. about-film.js masks each row's ends. */
.about-grid[data-look="film"] .pic img,
.print-art .about-grid[data-look="film"] .pic img { filter: brightness(calc(var(--about-grid-exposure, 1) * var(--exposure, 1))) url(#about-film); }
/* Film, then the page's print over it (Keyan, 2026-11-16: "add halftone to the film look and the other effects on the
   orchard assets"), by --about-grid-film-print: orchard is the scene's own filter (print.js #print-art: its halftone at
   full and its plates out of register), photo the about photo's softer dots (#print-snap), off film alone. Only while
   the page's print is on. Exposure still goes first. */
.print-art .about-grid[data-look="film"][data-film-print="orchard"] .pic img { filter: brightness(calc(var(--about-grid-exposure, 1) * var(--exposure, 1))) url(#about-film) url(#print-art); }
.print-art .about-grid[data-look="film"][data-film-print="photo"] .pic img { filter: brightness(calc(var(--about-grid-exposure, 1) * var(--exposure, 1))) url(#about-film) url(#print-snap); }
