/* gift_gallery.css - Engineering Gift Guide cards (ptGiftGallery)
 *
 * A File in gift-gallery/; ptGiftGallery links it itself.
 *
 * The card layout itself comes from the site-wide Wrap09 CSS
 * (.link-list / .ll-card-tiles-with-images-*).  This file only adds what the
 * stock tile doesn't have: the filter buttons, a placeholder for gifts
 * without an image, the whole-card link, the age line and the "New" badge.
 *
 * Review-page styles are in handoff/gift_review.css (installed in Wrap09).
 */

/* The card title is the stretched-link (see ptGiftGallery), so it should keep
 * the stock black title look rather than the site's link colour.  Scoped
 * under .block to outrank the theme's `.block a { underline }`. */
.block .gift-tile-link,
.block .gift-tile-link:hover,
.block .gift-tile-link:focus {
    color: inherit;
    text-decoration: none;
    border-bottom: none;
}

/* Hover anywhere on the card: lift it slightly and underline the title */
.gift-tile {
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.gift-tile:hover {
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.2) !important;
    transform: translateY(-2px);
}
.block .gift-tile:hover .gift-tile-link {
    text-decoration: underline;
}

/* Keyboard focus lands on the title link.  Its stretched-link ::after already
 * covers the card, so outlining that outlines the whole card - and the Buy
 * Now button keeps its own focus ring. */
.gift-tile-link:focus-visible {
    outline: none;
}
.gift-tile-link:focus-visible::after {
    outline: 3px solid var(--rush-gold);
    outline-offset: -3px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .gift-tile,
    .gift-tile:hover {
        transition: none;
        transform: none;
    }
}

/* Keeps tiles without an image the same height as their neighbours.  The
 * stock tile sizes images by width, so match the ratio of the guide's
 * 712x400 product photos rather than a fixed height. */
.gift-tile-no-image {
    aspect-ratio: 712 / 400;
    background-color: var(--light-gray);
}

/* --- Card: age range above the title --------------------------------- */
.block .link-list .gift-tile .gift-tile-ages {
    width: 100%;
    margin: 0;
    padding: 1.25rem 1.25rem 0;
    font-family: var(--united-sans-cond);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.09375rem;
    text-transform: uppercase;
    color: var(--steel-gray);       /* AA on white */
}
/* The stock title has 1.25rem top padding; tighten it under the age line.
 * Selector matches the theme's specificity and loads after it. */
.block .link-list .gift-tile .gift-tile-ages + .ll-card-tiles-with-images-card-tile-title {
    padding-top: 0.25rem;
}

/* --- Card: "New for 2026" badge on the image ------------------------- */
.gift-tile-new {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    background-color: var(--boiler-gold);
    color: black;
    font-family: var(--united-sans-cond);
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.09375rem;
    text-transform: uppercase;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

/* --- Filter buttons --------------------------------------------------
 * The buttons are the theme's purdue-btn (btn-gold, btn-black when
 * selected); this only lays out the row.  purdue-btn brings its own margin,
 * so no gap here. */
.gift-filters {
    display: flex;
    flex-wrap: wrap;
    padding: 2rem 0 1.5rem;
}
.gift-filters[hidden] {
    display: none;
}

/* The selected button stays black on hover.  The theme's btn-black:hover
 * turns it gold with !important, so this needs !important too; the extra
 * class and attribute make it the more specific rule. */
.gift-filters .purdue-btn.btn-black[aria-pressed="true"]:hover {
    background-color: black !important;
    color: white !important;
}

/* Cards the current filter leaves out.  The stock tile sets its own
 * display, which would otherwise beat the hidden attribute. */
.gift-tile[hidden] {
    display: none !important;
}

/* --- Full-width gray background ----------------------------------------
 * The Page Template Embed block wraps the gallery like this:
 *   section.block > div.page-template-embed > div.container > section.gift-gallery
 * Colour that outer section and its embed div gray, so the whole block is
 * gray however its container is padded.  :has() picks only the embed block
 * that holds the gallery, so other embed blocks on the site keep their own
 * background. */
.block:has(> .page-template-embed .gift-gallery),
.page-template-embed:has(.gift-gallery) {
    background-color: var(--light-gray);
}

/* Fallback for browsers without :has(), and for any other wrapper: a gray
 * shadow spreads the --bg-light-gray background out to both edges of the
 * window, and clip-path stops it spilling above or below the gallery.
 * Neither changes the layout, so the cards stay in the theme's container. */
.gift-gallery > .link-list.--bg-light-gray {
    box-shadow: 0 0 0 100vmax var(--light-gray);
    clip-path: inset(0 -100vmax);
}

/* --- Line up titles across a row -------------------------------------
 * Cards in a row stretch to the tallest card.  The stock tile is a
 * *wrapping row* flexbox, so a short card shares that extra height out
 * between its lines and its age line and title slide down.  As a column,
 * the extra height collects in one place: above the button, which the
 * stock margin-top: auto pins to the bottom.  Same selector as the theme's
 * tile rule; this file loads later, so it wins. */
.block .link-list.ll-card-tiles-with-images .ll-card-tiles-with-images-cards-container .gift-tile {
    flex-direction: column;
    flex-wrap: nowrap;
}

/* Every image box is the same height: the guide's 712x400 ratio, with the
 * whole photo shown (contain), so a tall box shot isn't cropped and doesn't
 * push its title below its neighbours'. */
.block .link-list.ll-card-tiles-with-images .gift-tile .ll-card-tiles-with-images-card-tile-image-container {
    aspect-ratio: 712 / 400;
    flex-shrink: 0;
}
.block .link-list.ll-card-tiles-with-images .gift-tile .ll-card-tiles-with-images-card-tile-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* A gift without ages keeps an empty age line, so its title lines up too */
.block .link-list .gift-tile .gift-tile-ages:empty::before {
    content: "\00a0";
}
