/*
 * Galyam Smart Search – Magazine Card Styles v1.2.3
 *
 * Loaded globally via wp_enqueue_style.
 * Editorial/magazine grid + sticky search bar.
 */

/* ================================================================
 * Sticky search bar – fixed to top when scrolling past
 * ================================================================ */
#gss-search-host {
    transition: box-shadow 0.3s ease;
    width: 100%;
}
#gss-search-host.gss-stuck {
    position: fixed !important;
    top: var(--gss-sticky-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 99999 !important;
    background: #fff !important;
    padding: 8px 20px !important;
    box-shadow: 0 3px 20px rgba(0,0,0,0.10) !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    animation: gssSlideDown 0.3s ease both;
}
@keyframes gssSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.gss-sticky-spacer {
    display: none;
}
.gss-sticky-spacer.is-active {
    display: block;
}

/* ================================================================
 * Grid centering – ensures grid fills parent and is centered
 * ================================================================ */
.gss-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100% !important;
    max-width: 1200px;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
    direction: rtl;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Heebo', 'Rubik', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1e293b;
}

/* Force grid parent chain to allow full width */
.gss-grid-parent-fix {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ── Scoped reset ── */
.gss-grid *,
.gss-grid *::before,
.gss-grid *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ================================================================
 * Card
 * ================================================================ */
.gss-card {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.gss-card:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-4px);
}

/* ================================================================
 * Link wrapper
 * ================================================================ */
.gss-card__link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.gss-card__link:hover,
.gss-card__link:visited,
.gss-card__link:active {
    text-decoration: none;
    color: inherit;
}

/* ================================================================
 * Thumbnail
 * ================================================================ */
.gss-card__thumb {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 60%;
    overflow: hidden;
    background: #f1f5f9;
}
.gss-card__thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.gss-card:hover .gss-card__thumb img {
    transform: scale(1.05);
}

/* ================================================================
 * Category badge
 * ================================================================ */
.gss-card__cat {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 2;
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #fff;
    background: #05A4CB;
    border-radius: 4px;
    line-height: 1.5;
}

/* ================================================================
 * Body
 * ================================================================ */
.gss-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 18px 18px;
    text-align: right;
}

/* ================================================================
 * Title
 * ================================================================ */
.gss-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a2e;
    margin-bottom: 8px;
    transition: color 0.2s ease;
}
.gss-card:hover .gss-card__title {
    color: #05A4CB;
}

/* ================================================================
 * Excerpt
 * ================================================================ */
.gss-card__excerpt {
    font-size: 0.84rem;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
    flex: 1;
}

/* ================================================================
 * Date
 * ================================================================ */
.gss-card__date {
    font-size: 0.72rem;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    margin-top: auto;
    display: block;
}

/* ================================================================
 * Responsive – Tablet
 * ================================================================ */
@media (max-width: 900px) {
    .gss-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

/* ================================================================
 * Responsive – Mobile
 * ================================================================ */
@media (max-width: 580px) {
    .gss-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .gss-card__thumb {
        padding-bottom: 55%;
    }
    .gss-card__body {
        padding: 14px 14px 16px;
    }
    .gss-card__title {
        font-size: 1rem;
    }
}

/* ================================================================
 * Grid mount – neutralize host container alignment (Elementor flex)
 * ================================================================ */
.gss-grid-mount {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important;
    text-align: initial !important;
}
.gss-grid-mount > .gss-grid {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-inline: auto !important;
}
/* Elementor-specific override */
.elementor-posts-container.gss-grid-mount {
    justify-content: center !important;
}
