/* ==========================================================================
   News Cards Block
   File: /blocks/news-cards/news-cards-style.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   Grid layout
   -------------------------------------------------------------------------- */
.news-cards-block {
    padding-block-start: 2rem;
    width: 100%;
}

@media ( max-width: 781px) {
    .news-cards-grid-container {
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
}

.news-cards-grid {
    display: grid;
    grid-template-columns: repeat( 3, 1fr );          /* 1 column on mobile */
    gap: 2rem;
    justify-items: center;
}

@media (max-width: 781px) {
    .news-cards-grid {
        padding-top: 3px;
        width: 250%;
        gap: 10px;
    }
}

@media ( min-width: 782px ) {
    .news-cards-grid {
        grid-template-columns: repeat( 3, 1fr );  /* 3 columns on larger screens */
        align-items: start;
    }
}

/* --------------------------------------------------------------------------
   Individual card
   -------------------------------------------------------------------------- */
.news-card {
    background: var( --wp--preset--color--navy );
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 360px;

    /* Lime-green rounded border */
    border: 2px solid var( --wp--preset--color--lime );
    border-radius: 1.25rem;
    padding: 1.5rem 1.5rem 1.75rem;

    /* Push image upward so it overlaps the card top edge */
    padding-top: 5rem;
    margin-top: 4.5rem;          /* space for the circle that floats above */

    @media (max-width: 781px) {
        scroll-behavior: smooth;
        scroll-snap-align: center;
    }

    &:nth-child(2) {
        @media ( min-width: 781px ) {
             transform: translateY( -2rem );
         }
    }
}

/* --------------------------------------------------------------------------
   Circular featured image
   -------------------------------------------------------------------------- */
.news-card__image-wrap {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate( -50%, -50% );  /* center horizontally, overlap top */

    width: 9rem;
    height: 9rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;

    /* Subtle ring that echoes the card border */
    box-shadow: 0 0 0 3px var( --wp--preset--color--navy ),
                0 0 0 5px var( --wp--preset--color--lime );
}

.news-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --------------------------------------------------------------------------
   Card title
   -------------------------------------------------------------------------- */
.news-card__title {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 1.25rem;
}

/* --------------------------------------------------------------------------
   "Read Story" button
   Inherits .wp-block-button__link base styles from the theme,
   then adds the lime pill overrides to match the design.
   -------------------------------------------------------------------------- */
.news-card__button.wp-block-button__link {
    display: inline-block;
    background-color: var( --wp--preset--color--lime );
    color: var( --wp--preset--color--navy );
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 9999px;
    padding: 0.6rem 1.75rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
    border: none;
}

.news-card__button.wp-block-button__link:hover,
.news-card__button.wp-block-button__link:focus {
    opacity: 0.85;
    color: var( --wp--preset--color--navy );
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   "More News" link
   -------------------------------------------------------------------------- */
.news-cards-more {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
}

.news-cards-more__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var( --wp--preset--color--navy );
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: opacity 0.2s ease;

    .is-style-dark &,
    .is-style-midnight & {
        color: #ffffff;
    }
}

.news-cards-more__link:hover,
.news-cards-more__link:focus {
    opacity: 0.75;
    text-decoration: none;
    color: var( --wp--preset--color--navy );

    .news-cards-more__icon {
        transform: var( --yhb-button-arrow-transform );
    }

    .is-style-dark &,
    .is-style-midnight & {
        color: #ffffff;
    }
}

.news-cards-more__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background-color: var( --wp--preset--color--lime );
    color: var( --wp--preset--color--navy );
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.2s ease;

    svg {
        width: 0.75rem;
    }
}

/* --------------------------------------------------------------------------
   Empty state (editor only)
   -------------------------------------------------------------------------- */
.news-cards-empty {
    color: rgba( 255, 255, 255, 0.6 );
    text-align: center;
    font-style: italic;
}
