/**
 * FOTOFILE Home Section Builder — frontend (Home only).
 *
 * SETTINGS-P2-R2B. Loaded after theme.css. Two jobs:
 *   1. Make Builder DOM order authoritative by neutralizing the legacy fixed
 *      `order:` values that theme.css assigns to the feed sections on mobile.
 *   2. Style the Builder-only enhancements (blog image/excerpt, YouTube cards,
 *      banner blocks). The default parity DOM (date + title blog, no YouTube,
 *      no banner block) is untouched, so migrated Home stays equivalent.
 */

/* ------------------------------------------------------------
 * 1. Order ownership: Builder DOM order wins.
 *    Higher specificity than theme.css `.fotofile-v2-home-<x> { order:N }`
 *    (and than its `body.home` feed grid), and loaded later.
 * ------------------------------------------------------------ */
body.home .fotofile-v2-home-feed--builder > .fotofile-v2-home-section {
  order: 0;
}

/* ------------------------------------------------------------
 * 2a. Blog featured image (progressive; only when enabled).
 * ------------------------------------------------------------ */
.fotofile-v2-home-blog--with-image .fotofile-v2-home-post a {
  min-height: 0;
}

.fotofile-v2-home-post__media {
  display: block;
  overflow: hidden;
  border-radius: 6px;
  background: #f2f2f2;
  aspect-ratio: 16 / 9;
}

.fotofile-v2-home-blog--ratio-1-1 .fotofile-v2-home-post__media {
  aspect-ratio: 1 / 1;
}

.fotofile-v2-home-blog--ratio-4-3 .fotofile-v2-home-post__media {
  aspect-ratio: 4 / 3;
}

.fotofile-v2-home-blog--ratio-16-9 .fotofile-v2-home-post__media {
  aspect-ratio: 16 / 9;
}

.fotofile-v2-home-post__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fotofile-v2-home-post__excerpt {
  margin: 0;
  color: var(--fotofile-v2-muted, #6b6b6b);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
}

/* ------------------------------------------------------------
 * 2b. YouTube section (click-to-load privacy cards).
 * ------------------------------------------------------------ */
.fotofile-v2-home-youtube-list {
  display: grid;
  gap: 10px;
}

.fotofile-v2-home-youtube--grid .fotofile-v2-home-youtube-list {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.fotofile-v2-home-youtube--rail .fotofile-v2-home-youtube-list {
  grid-auto-flow: column;
  grid-auto-columns: min(82vw, 320px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.fotofile-v2-home-youtube--rail .fotofile-v2-home-youtube-card {
  scroll-snap-align: start;
}

.fotofile-v2-home-youtube-card {
  min-width: 0;
}

.fotofile-v2-home-youtube-play {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 8px;
  background: #000;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.fotofile-v2-home-youtube-play:focus-visible {
  outline: 2px solid var(--fotofile-v2-accent, #ee4d2d);
  outline-offset: 2px;
}

.fotofile-v2-home-youtube-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fotofile-v2-home-youtube-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  transition: background 0.15s ease;
}

.fotofile-v2-home-youtube-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
}

.fotofile-v2-home-youtube-play:hover .fotofile-v2-home-youtube-badge {
  background: var(--fotofile-v2-accent, #ee4d2d);
}

.fotofile-v2-home-youtube-frame {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  aspect-ratio: 16 / 9;
}

/* ------------------------------------------------------------
 * 2c. Banner block (validated Media Library image).
 * ------------------------------------------------------------ */
.fotofile-v2-home-banner-block {
  overflow: hidden;
  border-radius: 10px;
}

.fotofile-v2-home-banner-block__link,
.fotofile-v2-home-banner-block__media {
  display: block;
}

.fotofile-v2-home-banner-block__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fotofile-v2-home-banner-block--ratio-wide .fotofile-v2-home-banner-block__image {
  aspect-ratio: 3 / 1;
}

.fotofile-v2-home-banner-block--ratio-16-9 .fotofile-v2-home-banner-block__image {
  aspect-ratio: 16 / 9;
}

.fotofile-v2-home-banner-block--ratio-4-3 .fotofile-v2-home-banner-block__image {
  aspect-ratio: 4 / 3;
}

.fotofile-v2-home-banner-block--ratio-1-1 .fotofile-v2-home-banner-block__image {
  aspect-ratio: 1 / 1;
}
