/* ==========================================================================
   Cozy Cottage Oven — product photography placement
   Load AFTER tokens.css and components/bundle.css.
   Every image ships as WebP (use first) + JPG (fallback) at the widths in
   its filename (…-800w, …-1200w, …-1600w). See PHOTO-PLACEMENT.md for the
   slot-by-slot map, srcset/sizes strings and alt text.

   Upload path: put every file from /web in the WordPress Media Library, or in
   /wp-content/uploads/cco-photos/ if you want stable URLs. The paths
   below assume the latter; change --cco-photo-base if you use another folder.

   Brand rules these follow (README › Imagery): square corners (radius-0),
   no text over photos, product images 4:3, hero 4:3 on phones.
   ========================================================================== */

:root {
  --cco-photo-base: "/wp-content/uploads/cco-photos/";
  --cco-photo-bg: var(--surface-alt);       /* shows while an image loads */
}

/* ---------- Shared image behavior ---------- */
.cco-photo,
.cco-hero__media img,
.cco-product-card__media img,
.cco-gallery img,
.cco-feature-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-0);
  background: var(--cco-photo-bg);
}

/* ---------- Hero (home) ----------
   Phones/tablets: 4:3 photo on top (hero-country-loaf-4x3).
   Desktop ≥1024px: the media column is full height, so swap to the 4:5 crop
   with <picture> (see PHOTO-PLACEMENT.md). object-position keeps the ear of
   the loaf and the wheat-stalk scoring in frame at every column height. */
.cco-hero__media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--cco-photo-bg); }
.cco-hero__media img { object-position: 50% 50%; }
@media (min-width: 1024px) {
  .cco-hero__media { aspect-ratio: auto; height: 100%; min-height: 560px; }
  .cco-hero__media img { object-position: 50% 42%; }
}

/* ---------- Product cards (This week's bake + shop grid) ----------
   All card files are 4:3, matching .cco-product-card__media.
   Per-product focal points (add the modifier class to the <img>). */
.cco-product-card__media { aspect-ratio: 4 / 3; overflow: hidden; }
.cco-photo--classic-sourdough   { object-position: 50% 50%; }
.cco-photo--jalapeno-cheddar    { object-position: 50% 40%; } /* keep the cheese-crusted ear */
.cco-photo--funfetti            { object-position: 55% 50%; } /* nudge away from the neighbor loaf */
.cco-photo--cinnamon-rolls      { object-position: 50% 50%; }

/* Products with no photo yet (Chocolate Chip, Strawberry White Chocolate,
   Croissant Loaf): keep the flour-colored ground; don't reuse another loaf. */
.cco-product-card__media:empty { background: var(--surface-alt); }

/* ---------- Product page gallery ----------
   Main image 4:3 + thumbnails. Gallery files: 4:3 except the 4:5 "pair". */
.cco-gallery { display: grid; gap: var(--units-105); }
.cco-gallery__main { aspect-ratio: 4 / 3; overflow: hidden; }
.cco-gallery__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--units-1); }
.cco-gallery__thumbs button {
  aspect-ratio: 1 / 1; padding: 0; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--cco-photo-bg); cursor: pointer;
  min-height: var(--target-min);
}
.cco-gallery__thumbs button[aria-current="true"] { border: 2px solid var(--ink); }
.cco-photo--portrait { object-position: 50% 30%; } /* 4:5 pair shown in square/4:3 frames */

/* ---------- Feature photo (How ordering works step 3, Our story) ----------
   Image beside copy from tablet up, stacked on phones. */
.cco-feature-photo { display: grid; gap: var(--units-4); align-items: center; }
.cco-feature-photo__media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--cco-photo-bg); }
@media (min-width: 640px) {
  .cco-feature-photo { grid-template-columns: 1fr 1fr; }
  .cco-feature-photo__media--portrait { aspect-ratio: 4 / 5; }   /* pickup-bagged-loaf-4x5 */
  .cco-feature-photo--reverse .cco-feature-photo__media { order: 2; }
}

/* ---------- Dark theme ----------
   Photos are graded for the light linen ground. If dark mode ships,
   tone them down a touch so highlights don't glare. */
[data-theme="dark"] .cco-photo,
[data-theme="dark"] .cco-hero__media img,
[data-theme="dark"] .cco-product-card__media img { filter: brightness(0.94); }
/* Card hover stays as the design system defines it (shadow-lift only, no image zoom). */
