/*
 * Feature images (articles and projects, every theme): one shape everywhere, 1200 x 630
 * (the size social sites use), with the whole image visible. An image of another shape is
 * centred, and a blurred copy of it fills the spare edges (set by assets/js/media-frame.js).
 * "html body" outranks the single-class rules inside each theme template.
 */

/* ── Frames: single pages and card images ─────────────────────────────── */
html body :is(.bs-mag-img, .bs-corp-img, .bs-glass-img, .bs-min-img,
              .ps-mag-img, .ps-corp-img, .ps-glass-img, .ps-min-img,
              .blog-corp-img, .blog-glass-featured-img, .blog-glass-thumb,
              .proj-corp-img, .proj-glass-img) {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1200 / 630;
    height: auto;
    min-height: 0;
    max-height: none;
    isolation: isolate;
    flex: none;
    background: var(--bg3, #1e293b);
}
html body :is(.bs-mag-img, .bs-corp-img, .bs-glass-img, .bs-min-img,
              .ps-mag-img, .ps-corp-img, .ps-glass-img, .ps-min-img,
              .blog-corp-img, .blog-glass-featured-img, .blog-glass-thumb,
              .proj-corp-img, .proj-glass-img)::before {
    content: "";
    position: absolute;
    inset: -24px;
    z-index: -1;
    background: var(--mf-img, none) center / cover no-repeat;
    filter: blur(22px) saturate(1.1);
    opacity: .8;
}
html body :is(.bs-mag-img, .bs-corp-img, .bs-glass-img, .bs-min-img,
              .ps-mag-img, .ps-corp-img, .ps-glass-img, .ps-min-img,
              .blog-corp-img, .blog-glass-featured-img, .blog-glass-thumb,
              .proj-corp-img, .proj-glass-img) > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    object-fit: contain;
    margin: 0;
    border-radius: 0;
}
/* designs.css pins some card images to a fixed height on phones; the shape wins instead. */
html body .proj-corp-img { height: auto !important; }
/* Cards without an image keep the same shape, so a row of cards lines up. */
html body :is(.proj-corp-img-ph, .proj-glass-img-ph) { height: auto !important; aspect-ratio: 1200 / 630; }
/* The magazine project page pulled its image 24 px past each side, wider than a phone screen. */
html body .ps-mag-img { margin-left: 0; margin-right: 0; }

/* ── Magazine cards: photo on top (whole image), title underneath ─────────
   These cards used to print the title over the photo, which clashed with banners
   that carry their own text and cut the photo on phones. */
html body :is(.blog-mag-hero-main, .blog-mag-hero-side-item, .proj-mag-featured) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
    isolation: isolate;
    background: var(--card, var(--bg2));
    border-bottom: 1px solid var(--border);
}
html body :is(.blog-mag-hero-main, .blog-mag-hero-side-item, .proj-mag-featured)::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    aspect-ratio: 1200 / 630;
    z-index: -1;
    background: var(--mf-img, none) center / cover no-repeat;
    filter: blur(18px) saturate(1.1);
    opacity: .8;
}
html body :is(.blog-mag-hero-main, .blog-mag-hero-side-item, .proj-mag-featured) > img {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    object-fit: contain;
    flex: none;
}
html body :is(.blog-mag-hero-main, .blog-mag-hero-side-item, .proj-mag-featured) > div[style*="min-height"],
html body .proj-mag-featured > div[style*="inset"] { position: relative !important; inset: auto !important; min-height: 0 !important; height: auto !important; aspect-ratio: 1200 / 630; }
html body :is(.blog-mag-hero-main, .blog-mag-hero-side-item) .blog-mag-overlay,
html body .proj-mag-featured::after { display: none; }
html body :is(.blog-mag-overlay-content, .proj-mag-featured-content) {
    position: static;
    flex: 1;
    padding: 14px 16px 18px;
    background: var(--card, var(--bg2));
}
html body :is(.blog-mag-overlay-title, .proj-mag-featured-title) { color: var(--text) !important; font-size: 1.05rem !important; line-height: 1.35; }
html body .blog-mag-hero-main .blog-mag-overlay-title, html body .proj-mag-featured-title { font-size: 1.2rem !important; }
html body :is(.blog-mag-card:hover .blog-mag-overlay-title, .proj-mag-featured:hover .proj-mag-featured-title) { color: var(--primary) !important; }
html body .blog-mag-overlay-meta { color: var(--text3); }
html body .proj-mag-featured-link-g { background: transparent; border: 1px solid var(--border); color: var(--text); }
html body .proj-mag-featured:hover img, html body .blog-mag-card:hover .blog-mag-img { transform: none; }

/* The three newest articles: equal cards in a row (two on tablets, one on phones). */
html body .blog-mag-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
html body .blog-mag-hero-side { display: contents; }
@media (max-width: 1024px) {
    html body .blog-mag-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html body .blog-mag-hero-main { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    html body .blog-mag-hero { grid-template-columns: minmax(0, 1fr); }
}
