/* =============================================
   GS Insights - Frontend Styles
   ============================================= */

.gs-insights {
    max-width: 1296px;
    margin: 0 auto;
    font-family: inherit;
}

/* ----- Tabs ----- */

.gs-insights__tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 40px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 20;
    pointer-events: auto !important;
    isolation: isolate;
}

.gs-insights__tab {
    display: inline-block;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    font-family: inherit;
    letter-spacing: 0.02em;
    text-decoration: none;
    position: relative;
    z-index: 21;
    pointer-events: auto !important;
}

.gs-insights__tab:hover {
    color: #222;
}

.gs-insights__tab--active {
    color: #222;
    border-bottom-color: #222;
    font-weight: 600;
}

.gs-insights__tabs-mobile {
    display: none;
    margin-bottom: 24px;
    position: relative;
}

.gs-insights__tabs-toggle {
    width: 100%;
    padding: 12px 40px 12px 14px;
    border: 1px solid #ddd;
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #222;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.gs-insights__tabs-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    z-index: 40;
    max-height: 300px;
    overflow-y: auto;
}

.gs-insights__tabs-mobile[data-open="true"] .gs-insights__tabs-menu {
    display: block;
}

.gs-insights__tabs-option {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #eee;
    padding: 11px 14px;
    font-size: 14px;
    color: #222;
    cursor: pointer;
}

.gs-insights__tabs-option:last-child {
    border-bottom: 0;
}

.gs-insights__tabs-option.is-active {
    background: #f6f6f6;
    font-weight: 600;
}

.gs-insights__tabs-option:hover {
    background: #f8f8f8;
}

/* ----- Panels ----- */

.gs-insights__panel {
    display: none;
    min-height: 200px;
}

.gs-insights__panel--active {
    display: block;
}

.gs-insights__panel[hidden] {
    display: none;
}

/* ----- Loading ----- */

.gs-insights__panel--loading {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.2s;
}

/* ----- Toolbar (Search + Sort) ----- */

.gs-insights__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.gs-insights__search {
    position: relative;
    flex: 0 1 320px;
}

.gs-insights__search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid #ddd;
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
}

.gs-insights__search-input:focus {
    outline: none;
    border-color: #999;
}

.gs-insights__search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    transition: opacity 0.15s;
}

.gs-insights__search-icon--hidden {
    opacity: 0;
}

.gs-insights__search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #666;
    display: none;
    line-height: 0;
}

.gs-insights__search-clear:hover {
    color: #222;
}

.gs-insights__search-clear--visible {
    display: block;
}

.gs-insights__sort {
    flex: 0 0 auto;
}

.gs-insights__sort-select {
    padding: 10px 36px 10px 16px;
    border: 1px solid #ddd;
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 160px;
}

.gs-insights__sort-select:focus {
    outline: none;
    border-color: #999;
}

/* ----- Card Grid ----- */

.gs-insights__grid {
    display: grid;
    gap: 30px;
}

.gs-insights__grid--3col {
    grid-template-columns: repeat(3, 1fr);
}

.gs-insights__grid--2col {
    grid-template-columns: repeat(2, 1fr);
}

.gs-insights__grid--mixed {
    grid-template-columns: repeat(3, 1fr);
}

.gs-insights__grid--mixed .gs-insights__card--featured {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

/* Custom mixed archive layout: videos left, articles right */
.gs-insights__mixed-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
}

.gs-insights__mixed-videos {
    grid-column: 1;
    display: grid;
    gap: 30px;
    align-content: start;
}

.gs-insights__mixed-articles {
    grid-column: 2 / 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
    align-content: start;
}

.gs-insights__mixed-layout--no-videos .gs-insights__mixed-articles {
    grid-column: 1 / 4;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gs-insights__mixed-layout--no-videos .gs-insights__mixed-videos {
    display: none;
}

/* ----- Card ----- */

.gs-insights__card {
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.gs-insights__card-thumb {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.gs-insights__card-thumb img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s;
}

/* Prevent theme/image styles from forcing "contain" behavior */
.gs-insights__card-thumb img,
.gs-insights__card-thumb .wp-post-image {
    width: 100% !important;
    height: 220px !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Video cards should always fill the 16:9 canvas on all breakpoints */
.gs-insights__card--video .gs-insights__video-poster img,
.gs-insights__card--video .gs-insights__video-poster .wp-post-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

.gs-insights__card:hover .gs-insights__card-thumb img {
    transform: scale(1.03);
}

.gs-insights__card-placeholder {
    width: 100%;
    height: 220px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gs-insights__card-placeholder--dark {
    background: #333;
}

/* ----- Video Card ----- */

.gs-insights__card--video .gs-insights__card-thumb--video {
    background: #1a1a1a;
}

.gs-insights__video-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* 1920 x 1080 */
    background: #111;
    overflow: hidden;
}

.gs-insights__video-poster,
.gs-insights__video-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.gs-insights__video-poster img,
.gs-insights__video-poster .gs-insights__card-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gs-insights__video-poster img.gs-insights__poster--auto {
    object-fit: cover !important;
    object-position: center;
    transform: none;
    transform-origin: center;
}

.gs-insights__card--video .gs-insights__card-thumb img {
    transform: none !important;
}

.gs-insights__card--video:hover .gs-insights__card-thumb img {
    transform: none !important;
}

.gs-insights__video-embed iframe,
.gs-insights__video-embed video {
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

.gs-insights__play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
    z-index: 3;
}

.gs-insights__card:hover .gs-insights__play-btn {
    background: rgba(0, 0, 0, 0.8);
}

.gs-insights__play-btn svg {
    width: 24px;
    height: 24px;
    margin-left: 2px;
}

/* ----- Category Pill ----- */

.gs-insights__card-pill {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #fff;
    color: #222;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: 20px;
    line-height: 1.4;
}

/* ----- Card Body ----- */

.gs-insights__card-body {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}


.gs-insights__card-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 8px;
    color: #222;
}

.gs-insights__card-title a {
    color: inherit;
    text-decoration: none;
}

.gs-insights__card-title a:hover {
    color: #555;
}

.gs-insights__card-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 16px;
    flex: 1;
}

.gs-insights__card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    text-decoration: none;
    margin-top: auto;
}

.gs-insights__card-cta:hover {
    color: #555;
}

.gs-insights__arrow {
    font-size: 16px;
    line-height: 1;
}

/* ----- Pagination ----- */

.gs-insights__pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    padding-bottom: 20px;
}

.gs-insights__page-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background: #fff;
    color: #222;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
}

.gs-insights__page-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.gs-insights__page-btn--active {
    background: #222;
    color: #fff;
    border-color: #222;
}

/* ----- No Results / Placeholder ----- */

.gs-insights__no-results,
.gs-insights__placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 15px;
}

.gs-insights__placeholder strong {
    color: #222;
}

/* ----- Responsive ----- */

@media (max-width: 992px) {
    .gs-insights__grid--3col,
    .gs-insights__grid--mixed {
        grid-template-columns: repeat(2, 1fr);
    }

    .gs-insights__grid--mixed .gs-insights__card--featured {
        grid-column: auto;
        grid-row: auto;
    }

    .gs-insights__card--featured .gs-insights__card-thumb img,
    .gs-insights__card--featured .gs-insights__card-placeholder {
        height: 220px;
        min-height: auto;
    }

    .gs-insights__mixed-layout {
        grid-template-columns: 1fr;
    }

    .gs-insights__mixed-videos,
    .gs-insights__mixed-articles {
        grid-column: auto;
    }
}

/* ----- Bi-Annual ScoreCards tab ----- */

.gs-scorecards {
    width: 100%;
    color: #222;
}

.gs-scorecards__blocks {
    display: grid;
    grid-template-columns: repeat(auto-fill, 300px);
    gap: 20px;
    margin-bottom: 48px;
    /* Center tracks so extra width (e.g. 1296px − four 300px cards − gaps) is split left/right */
    justify-content: center;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.gs-scorecards__card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 24px;
    background: #F5F5F5 !important;
    background-color: #F5F5F5 !important;
    text-decoration: none;
    color: inherit;
    font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
    width: 300px;
    height: 300px;
    min-width: 300px;
    min-height: 300px;
    max-width: 300px;
    max-height: 300px;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.2s, box-shadow 0.2s;
}

.gs-scorecards__card--linked:hover,
.gs-scorecards__card--linked:focus,
.gs-scorecards__card--linked:focus-visible {
    background: #F5F5F5 !important;
    background-color: #F5F5F5 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.gs-scorecards__card-icon {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 28px;
}

.gs-scorecards__card-icon-img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain !important;
    display: block;
}

.gs-scorecards__card-icon--dashicon {
    width: 40px;
    height: 40px;
    font-size: 28px;
    line-height: 40px;
    color: #333;
}

.gs-scorecards__card-icon--empty {
    display: none;
}

/* Title + “Read more” stay grouped and pinned to the bottom of the 300×300 card. */
.gs-scorecards__card-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    flex-shrink: 0;
    min-width: 0;
}

.gs-scorecards__card-title {
    color: #282828;
    font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 24px;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    text-transform: capitalize;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

.gs-scorecards__card-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 24px;
    text-transform: capitalize;
    color: #282828;
    text-decoration: none;
}

.gs-scorecards__card--linked .gs-scorecards__card-more:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gs-scorecards__card-more-icon {
    display: inline-block;
    width: 8.667px;
    height: 8.667px;
    flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2210%22%20height%3D%2210%22%20viewBox%3D%220%200%2010%2010%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M0.5%209.16663L9.16667%200.5M9.16667%200.5V8.82003M9.16667%200.5H0.84667%22%20stroke%3D%22%23282828%22%20stroke-width%3D%221%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")
        center / contain no-repeat;
}

.gs-scorecards__featured {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    margin-bottom: 48px;
}

.gs-scorecards__featured-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f0f0f0;
}

.gs-scorecards__featured-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.gs-scorecards__featured-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.gs-scorecards__featured-cta {
    margin: 0;
}

.gs-scorecards__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 16px 32px;
    box-sizing: border-box;
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    background: #282828;
    background-color: #282828;
    color: #fff !important;
    text-align: center;
    font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 24px;
    text-transform: capitalize;
    text-decoration: none;
    border: none;
    border-radius: 0;
    transition: background 0.2s, color 0.2s;
}

.gs-scorecards__btn:hover,
.gs-scorecards__btn:focus {
    background: #333;
    background-color: #333;
    color: #fff !important;
}

.gs-scorecards-prose {
    font-size: 15px;
    line-height: 1.7;
    color: #333;
}

.gs-scorecards-prose p {
    margin: 0 0 1em;
}

.gs-scorecards-prose p:last-child {
    margin-bottom: 0;
}

.gs-scorecards-prose h2,
.gs-scorecards-prose h3 {
    margin: 1.25em 0 0.5em;
    line-height: 1.3;
    color: #111;
}

.gs-scorecards-prose h2:first-child,
.gs-scorecards-prose h3:first-child {
    margin-top: 0;
}

.gs-scorecards-prose a {
    color: #111;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gs-scorecards-prose ul,
.gs-scorecards-prose ol {
    margin: 0 0 1em 1.2em;
    padding: 0;
}

@media (max-width: 992px) {
    .gs-scorecards__featured {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .gs-scorecards {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .gs-insights {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .gs-insights__tabs {
        display: none;
    }

    .gs-insights__tabs-mobile {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .gs-insights__tab {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Allow the shortcode root to fill the column and avoid lopsided empty space (e.g. flex/grid parents). */
    .gs-insights {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .gs-scorecards {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /*
     * Scorecard grid uses justify-content: center globally; keep horizontal scroll off on small screens.
     */
    .gs-scorecards__blocks {
        overflow-x: visible;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .gs-insights__toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .gs-insights__search {
        flex: 1 1 100%;
    }

    .gs-insights__sort {
        flex: 1 1 100%;
    }

    .gs-insights__sort-select,
    .gs-insights__tabs-toggle {
        width: 100%;
    }

    .gs-insights__grid--3col,
    .gs-insights__grid--2col,
    .gs-insights__grid--mixed {
        grid-template-columns: 1fr;
    }

    .gs-insights__mixed-articles {
        grid-template-columns: 1fr;
    }

    .gs-insights__card-thumb img {
        height: 200px;
    }
}
