/* Featured Items Plugin - Styles */

/* Base grid using CSS variable for columns */
.fh-grid {
    display: grid;
    grid-template-columns: repeat(var(--fh-cols-desktop, 4), 1fr);
    gap: 20px;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

/* Each item */
.fh-item {
    position: relative;
    overflow: hidden;
    border: 4px solid var(--fh-border-color, #d4a017);
    border-radius: 2px;
    background: #000; /* optional */
}

/* Image wrapper keeps aspect ratio - feel free to change height */
.fh-imgwrap {
    width: 100%;
    height: 320px; /* adjust as needed or make responsive */
    overflow: hidden;
    display: block;
    position: relative;
}

.fh-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, filter 0.4s ease;
    transform-origin: center center;
}

/* Zoom effect on hover/focus (keyboard accessible) */
.fh-item:hover img,
.fh-item:focus-within img {
    transform: scale(1.08);
    filter: brightness(0.85);
}

/* Overlay that contains title - positioned at bottom and hidden initially */
.fh-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
}

/* The visible background panel for title */
.fh-overlay::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 20%, rgba(0,0,0,0.45) 60%, rgba(0,0,0,0.0) 100%);
    z-index: 1;
}

/* Title container */
.fh-title {
    position: relative;
    z-index: 2;
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    padding: 18px 14px;
    text-align: left; /* left aligned as requested */
    line-height: 1.2;
}

/* When hover - slide overlay up */
.fh-item:hover .fh-overlay,
.fh-item:focus-within .fh-overlay {
    transform: translateY(0%);
    opacity: 1;
    pointer-events: auto;
}

/* Make overlay area clickable with link later if needed (style only) */
.fh-overlay a { color: inherit; text-decoration: none; }

/* Responsive: tablet and mobile using CSS variables set from PHP */
@media (max-width: 1024px) {
    .fh-grid {
        grid-template-columns: repeat(var(--fh-cols-tablet, 2), 1fr);
    }
    .fh-imgwrap { height: 280px; }
}

@media (max-width: 600px) {
    .fh-grid {
        grid-template-columns: repeat(var(--fh-cols-mobile, 1), 1fr);
    }
    .fh-imgwrap { height: 220px; }
}

/* Small accessibility improvement: focus outline on keyboard users */
.fh-item:focus-within {
    outline: 3px solid rgba(255,255,255,0.12);
    outline-offset: 2px;
}
