/* =========================================================
 * E42 Articles Widget — Frontend Styles
 * ========================================================= */

.e42-articles-widget {
    width: 100%;
    box-sizing: border-box;
}

/* In Elementor editor: disable pointer events on interactive elements
   so the widget edit handle (top-right icons) stays clickable */
.elementor-editor-active .e42-articles-widget,
.elementor-editor-preview .e42-articles-widget,
body.elementor-editor-active .e42-articles-widget .e42-tab,
body.elementor-editor-active .e42-articles-widget .e42-filter-button,
body.elementor-editor-active .e42-articles-widget .e42-filter-menu,
body.elementor-editor-active .e42-articles-widget .e42-filter-option,
body.elementor-editor-active .e42-articles-widget .e42-filter-clear,
body.elementor-editor-active .e42-articles-widget .e42-pagination-wrap,
body.elementor-editor-active .e42-articles-widget a {
    pointer-events: none !important;
}

.e42-articles-widget *,
.e42-articles-widget *::before,
.e42-articles-widget *::after {
    box-sizing: border-box;
}
.e42-articles-widget ul,
.e42-articles-widget li {
    list-style: none;
    margin: 0;
}
.e42-articles-widget img {
    max-width: 100%;
    height: auto;
    border: 0;
    display: block;
}

/* --- Override theme button defaults (Hello theme, etc.) --- */
.e42-articles-widget button,
.e42-articles-widget [type="button"],
.e42-articles-widget [type="submit"] {
    background: transparent;
    background-color: transparent;
    background-image: none;
    color: inherit;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    line-height: inherit;
    text-transform: none;
    letter-spacing: normal;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    cursor: pointer;
}
.e42-articles-widget button:hover,
.e42-articles-widget button:focus,
.e42-articles-widget button:active,
.e42-articles-widget [type="button"]:hover,
.e42-articles-widget [type="button"]:focus,
.e42-articles-widget [type="submit"]:hover,
.e42-articles-widget [type="submit"]:focus {
    background: transparent;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    outline: none;
}

/* --- Category Tabs ------------------------------------- */
.e42-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: center;
    margin: 0 0 40px;
    padding: 0;
    list-style: none;
}
.e42-articles-widget .e42-tab {
    position: relative;
    background: transparent;
    background-color: transparent;
    border: 0;
    box-shadow: none;
    padding: 8px 0;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #999;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
}
.e42-articles-widget .e42-tab:hover,
.e42-articles-widget .e42-tab:focus,
.e42-articles-widget .e42-tab:active {
    background: transparent;
    background-color: transparent;
    box-shadow: none;
    outline: none;
    cursor: pointer;
}
.e42-articles-widget .e42-tab:focus-visible {
    outline: 1px dashed currentColor;
    outline-offset: 4px;
}
.e42-articles-widget .e42-tab.is-active {
    color: #000;
    font-weight: 600;
    cursor: default;
}
.e42-articles-widget .e42-tab.is-active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: currentColor;
}

/* --- Date Filter --------------------------------------- */
.e42-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 37px;
    margin: 0 0 28px;
    padding: 0;
}
.e42-filter-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Trigger button — styled to look exactly like plain label+icon.
   The !important flags on the layout properties protect us from Hello Theme
   (and similar) which can force <button> to compute as inline-block and
   collapse our inline-flex row into a stacked layout. */
.e42-filter-button {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    background-color: transparent;
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #000;
    cursor: pointer;
    line-height: 1; /* tight so vertical-centering with the icon is exact */
    -webkit-appearance: none;
    appearance: none;
}
.e42-filter-button:hover,
.e42-filter-button:focus,
.e42-filter-button:active {
    background: transparent;
    background-color: transparent;
    box-shadow: none;
    outline: none;
}
.e42-filter-button:focus-visible {
    outline: 1px dashed currentColor;
    outline-offset: 4px;
}
/* The label sits on the same baseline as the icon */
.e42-filter-text {
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
}
.e42-filter-icon {
    color: currentColor;
    /* flex shorthand: no grow, no shrink, intrinsic basis */
    flex: 0 0 auto;
    /* vertical-align kicks in on the off-chance the button can't be flexed,
       keeping the icon centered with the cap-height of the text. */
    vertical-align: middle;
    /* Fallback spacing for browsers/themes that strip flex `gap` (older Safari,
       some Elementor reset stacks). Stacks with the gap above. */
    margin-left: 4px;
}

/* Custom dropdown menu */
.e42-filter-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 100;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #000;
    border-radius: 2px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.e42-filter-menu[hidden] { display: none; }
.e42-filter-option {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #000;
    cursor: pointer;
    transition: background-color 0.12s ease;
    white-space: nowrap;
    line-height: 1.3;
}
.e42-filter-option:hover,
.e42-filter-option:focus {
    background: #f5f5f5;
    outline: none;
}
.e42-filter-option.is-active {
    background: #000;
    color: #fff;
}
/* Greyed-out months when they don't match the active time-mode tab
   (e.g. past months while "Upcoming" is selected). */
.e42-filter-option.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.e42-filter-option.is-disabled:hover,
.e42-filter-option.is-disabled:focus {
    background: transparent;
}

/* Active pill shown when a month is picked */
.e42-filter-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border: 1px solid #000;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #000;
    line-height: 1;
}
.e42-filter-active[hidden] { display: none; }
.e42-filter-active-text { white-space: nowrap; }
.e42-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    border-radius: 999px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.e42-filter-clear:hover,
.e42-filter-clear:focus-visible {
    background: #000;
    color: #fff;
    outline: none;
}

/* --- Grid ---------------------------------------------- */
.e42-articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 24px;
    row-gap: 40px;
    transition: opacity 0.2s ease;
}
.e42-articles-grid.is-loading {
    opacity: 0.4;
    pointer-events: none;
}

/* --- Card ---------------------------------------------- */
.e42-article-card {
    display: flex;
    flex-direction: column;
    margin: 0;
}
.e42-article-image {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f2f2f2;
    line-height: 0;
    border: 0;
    outline: none;
    box-shadow: none;
    text-decoration: none;
}
.e42-article-image:hover,
.e42-article-image:focus,
.e42-article-image:focus-visible,
.e42-article-image:active,
.e42-article-image:visited {
    border: 0;
    outline: none;
    box-shadow: none;
    text-decoration: none;
}

/* Neutralize theme-inherited focus/border styles on all card links */
.e42-articles-widget a {
    border: 0;
    box-shadow: none;
}
.e42-articles-widget a:focus,
.e42-articles-widget a:focus-visible,
.e42-articles-widget a:active {
    outline: none;
    box-shadow: none;
}
.e42-article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.55s ease;
}
.e42-article-card:hover .e42-article-image img {
    transform: scale(1.035);
}
.e42-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #efefef, #f8f8f8);
}

.e42-article-content {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.e42-article-category {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #888;
    line-height: 1.4;
}
.e42-article-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 2px 0 0;
    color: #000;
}
.e42-article-title a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.e42-article-title a:hover {
    text-decoration: none;
    opacity: 0.7;
}
.e42-article-date {
    font-size: 14px;
    color: #333;
    margin: 0 0 12px;
    line-height: 1.4;
}
.e42-articles-widget .e42-article-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #000;
    background: transparent;
    background-color: transparent;
    border-width: 1px;
    border-style: solid;
    border-color: #000;
    border-radius: 2px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    line-height: 1;
    margin-top: auto;
    font-family: inherit;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}
.e42-articles-widget .e42-article-button:hover,
.e42-articles-widget .e42-article-button:focus {
    background: #000;
    background-color: #000;
    color: #fff;
    text-decoration: none;
    border-color: #000;
    box-shadow: none;
    outline: none;
}
.e42-arrow {
    width: 5px;
    height: 9px;
    flex-shrink: 0;
    display: inline-block;
    color: currentColor;
    margin-left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.e42-arrow path {
    fill: currentColor;
}

/* Hover animation variants (opt-in via class on widget root) */

/* Slide right — smoothly slides the arrow to the right */
.e42-arrow-hover-slide .e42-article-button:hover .e42-arrow,
.e42-arrow-hover-slide .e42-article-button:focus .e42-arrow {
    transform: translateX(6px);
}

/* Slide right + fade back — the arrow slides out, a ghost slides in from left */
.e42-arrow-hover-bounce .e42-article-button .e42-arrow {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.e42-arrow-hover-bounce .e42-article-button:hover .e42-arrow,
.e42-arrow-hover-bounce .e42-article-button:focus .e42-arrow {
    animation: e42-arrow-bounce 0.5s ease forwards;
}
@keyframes e42-arrow-bounce {
    0%   { transform: translateX(0); }
    45%  { transform: translateX(10px); opacity: 0; }
    55%  { transform: translateX(-10px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* Grow — arrow scales up slightly */
.e42-arrow-hover-grow .e42-article-button:hover .e42-arrow,
.e42-arrow-hover-grow .e42-article-button:focus .e42-arrow {
    transform: scale(1.3) translateX(3px);
}

/* --- Pagination wrap --------------------------------- */
.e42-pagination-wrap {
    width: 100%;
}

/* --- Load More Button --------------------------------- */
.e42-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 48px;
    width: 100%;
}
.e42-articles-widget .e42-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-family: inherit;
    line-height: 1;
    color: #000;
    background: transparent;
    background-color: transparent;
    border-width: 1px;
    border-style: solid;
    border-color: #000;
    border-radius: 2px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.e42-articles-widget .e42-load-more:hover:not([disabled]),
.e42-articles-widget .e42-load-more:focus:not([disabled]) {
    background: #000;
    background-color: #000;
    color: #fff;
    outline: none;
    box-shadow: none;
}
.e42-load-more[disabled],
.e42-load-more.is-loading {
    cursor: wait;
    opacity: 0.7;
}
.e42-load-more.is-loading .e42-load-more__label {
    animation: e42-pulse 1.2s ease-in-out infinite;
}
@keyframes e42-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
.e42-load-more-end {
    display: inline-block;
    padding: 14px 32px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #999;
}

/* Infinite scroll sentinel + spinner */
.e42-infinite-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60px;
    padding: 20px 0;
}
.e42-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(0,0,0,0.12);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: e42-spin 0.7s linear infinite;
    color: #000;
}
.e42-infinite-sentinel.is-idle .e42-spinner {
    opacity: 0.4;
}
@keyframes e42-spin {
    to { transform: rotate(360deg); }
}
.e42-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 15px;
}

/* --- Responsive fallbacks (when Elementor responsive    */
/*     columns control is not touched, design still holds)*/
@media (max-width: 1024px) {
    .e42-articles-grid {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 48px;
    }
}
@media (max-width: 640px) {
    .e42-articles-grid {
        grid-template-columns: 1fr;
        row-gap: 40px;
    }
    .e42-tabs {
        gap: 10px;
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 28px;
        padding: 0 4px;
    }
    .e42-tabs::-webkit-scrollbar { display: none; }
    .e42-tab {
        font-size: 10px;
        letter-spacing: 0.06em;
        white-space: nowrap;
        padding: 4px 0;
    }
    .e42-filter-button {
        font-size: 11px;
        letter-spacing: 0.08em;
    }
    .e42-filter-icon {
        width: 16px;
        height: 16px;
    }
    .e42-filter-bar {
        flex-wrap: wrap;
        margin-bottom: 24px;
    }
    .e42-article-content {
        padding-top: 14px;
        gap: 4px;
    }
}
