/*
 * NGP Blog Roll public stylesheet (p21 2026-12-04).
 *
 * Scoped under .ngp-blog-roll per plugincoexistence contract (CSS class
 * prefix dimension 3.18). All colors, radii, border widths, and shadow
 * depths come from CSS custom properties the shortcode PHP emits in
 * style="" on the root element.
 *
 * p21 ships a static responsive row of cards. The autoscroll + arrows +
 * dots carousel chrome lands in p22; p23 polishes the card typography
 * and spacing. This file intentionally stays conservative so p22/p23
 * can layer on without a rewrite.
 */

.ngp-blog-roll {
    margin: 1.25rem 0;
    box-sizing: border-box;
    --ngp-blog-roll-cards: 3;
    --ngp-blog-roll-aspect: 16 / 9;
    --ngp-blog-roll-border-width: 0px;
    --ngp-blog-roll-border-color: transparent;
    --ngp-blog-roll-radius: 4px;
    --ngp-blog-roll-bg: transparent;
}

.ngp-blog-roll *,
.ngp-blog-roll *::before,
.ngp-blog-roll *::after {
    box-sizing: border-box;
}

.ngp-blog-roll-track {
    display: grid;
    grid-template-columns: repeat(var(--ngp-blog-roll-cards, 3), minmax(0, 1fr));
    gap: 1.25rem;
    width: 100%;
}

/* Responsive drop: tablet goes to 2 columns (clamped to the author's
   pick so a 1-per-slide choice never widens), phone goes to 1. The drop
   only engages when the class is on the root -- it mirrors the editor's
   responsive_drop toggle. */
@media (max-width: 960px) {
    .ngp-blog-roll.ngp-blog-roll-responsive-drop .ngp-blog-roll-track {
        grid-template-columns: repeat(min(var(--ngp-blog-roll-cards, 3), 2), minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .ngp-blog-roll.ngp-blog-roll-responsive-drop .ngp-blog-roll-track {
        grid-template-columns: 1fr;
    }
}

.ngp-blog-roll-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--ngp-blog-roll-bg, transparent);
    border: var(--ngp-blog-roll-border-width, 0) solid var(--ngp-blog-roll-border-color, transparent);
    border-radius: var(--ngp-blog-roll-radius, 4px);
    overflow: hidden;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

/* Card shadows. One class per enum value from PSD H3. */
.ngp-blog-roll-shadow-none .ngp-blog-roll-card {
    box-shadow: none;
}
.ngp-blog-roll-shadow-soft .ngp-blog-roll-card {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
}
.ngp-blog-roll-shadow-medium .ngp-blog-roll-card {
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.06);
}
.ngp-blog-roll-shadow-strong .ngp-blog-roll-card {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18), 0 4px 8px rgba(15, 23, 42, 0.08);
}

.ngp-blog-roll-card:hover,
.ngp-blog-roll-card:focus-within {
    transform: translateY(-1px);
}

.ngp-blog-roll-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.ngp-blog-roll-card-link:hover,
.ngp-blog-roll-card-link:focus {
    text-decoration: none;
}

/* Media (featured image) frame. Aspect ratio comes from the custom
   property; object-fit flips between cover (crop) and contain
   (letterbox) based on the ngp-blog-roll-fit-* modifier on the root. */
.ngp-blog-roll-card-media {
    margin: 0;
    width: 100%;
    aspect-ratio: var(--ngp-blog-roll-aspect, 16 / 9);
    background: #f4f4f5;
    overflow: hidden;
}

.ngp-blog-roll-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
}

.ngp-blog-roll-fit-letterbox .ngp-blog-roll-card-img {
    object-fit: contain;
    background: #f4f4f5;
}

/* Body. */
.ngp-blog-roll-card-body {
    padding: 0.9rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
}

.ngp-blog-roll-card-meta {
    margin: 0;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.ngp-blog-roll-card-meta-sep {
    color: #cbd5e1;
}

.ngp-blog-roll-card-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: #0f172a;
}

.ngp-blog-roll-card-title {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.3;
    color: inherit;
    font-weight: 700;
    /* p23: clamp to 2 lines so long titles do not balloon the card and
       break the responsive grid. Fallback max-height for older browsers
       uses line-height * 2.1. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.73em;
}

.ngp-blog-roll-card-byline {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
    font-style: italic;
}

.ngp-blog-roll-card-excerpt {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.45;
    /* p23: clamp to 3 lines so a long-excerpt card never grows taller
       than its neighbors in the responsive grid. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.4em;
}

.ngp-blog-roll-card-excerpt p {
    margin: 0;
}

.ngp-blog-roll-card-readmore {
    display: inline-block;
    align-self: flex-start;
    margin-top: 0.25rem;
    padding: 0.4em 0.9em;
    background: #0f172a;
    color: #ffffff;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.ngp-blog-roll-card-link:hover .ngp-blog-roll-card-readmore,
.ngp-blog-roll-card-link:focus .ngp-blog-roll-card-readmore {
    background: #1e293b;
}


/* ---------------- p22 carousel chrome ---------------- */

/* The .ngp-blog-roll-has-chrome modifier is added by the carousel JS
   once the script wires up. CSS switches the track from a grid to a
   scroll-snap flex row only when the modifier is present, so the
   no-JS / pre-script state renders as a clean responsive grid. */

.ngp-blog-roll-has-chrome {
    position: relative;
    padding: 0 3rem;  /* room for the arrow buttons at the edges */
}

.ngp-blog-roll-has-chrome .ngp-blog-roll-track {
    display: flex;
    grid-template-columns: unset;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 1.25rem;
}
.ngp-blog-roll-has-chrome .ngp-blog-roll-track::-webkit-scrollbar {
    display: none;
}

.ngp-blog-roll-has-chrome .ngp-blog-roll-card {
    flex: 0 0 calc((100% - (var(--ngp-blog-roll-cards, 3) - 1) * 1.25rem) / var(--ngp-blog-roll-cards, 3));
    scroll-snap-align: start;
}

/* Responsive drop also applies to the chrome path. Narrow screens pull
   the effective cards-per-slide down. */
@media (max-width: 960px) {
    .ngp-blog-roll-has-chrome.ngp-blog-roll-responsive-drop .ngp-blog-roll-card {
        flex: 0 0 calc((100% - (min(var(--ngp-blog-roll-cards, 3), 2) - 1) * 1.25rem) / min(var(--ngp-blog-roll-cards, 3), 2));
    }
}
@media (max-width: 640px) {
    .ngp-blog-roll-has-chrome.ngp-blog-roll-responsive-drop .ngp-blog-roll-card {
        flex: 0 0 100%;
    }
}

/* Arrow buttons -- absolutely positioned on top of the viewport padding. */
.ngp-blog-roll-arrows {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.ngp-blog-roll-arrow {
    pointer-events: auto;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    border: 0;
    border-radius: 999px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: background 120ms ease, transform 120ms ease;
}
.ngp-blog-roll-arrow:hover,
.ngp-blog-roll-arrow:focus {
    background: #0f172a;
    outline: none;
}
.ngp-blog-roll-arrow:focus-visible {
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.5);
}
.ngp-blog-roll-arrow-prev { left:  0.4rem; }
.ngp-blog-roll-arrow-next { right: 0.4rem; }

/* On phone widths move the arrows below the cards so they don't cover
   the images. The track stops reserving edge padding on this breakpoint. */
@media (max-width: 640px) {
    .ngp-blog-roll-has-chrome {
        padding: 0;
    }
    .ngp-blog-roll-arrows {
        position: static;
        display: flex;
        justify-content: center;
        gap: 0.75rem;
        margin-top: 0.75rem;
    }
    .ngp-blog-roll-arrow {
        position: static;
        transform: none;
    }
}

/* Dot pagination row. */
.ngp-blog-roll-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.8rem;
}
.ngp-blog-roll-dot {
    width: 0.65rem;
    height: 0.65rem;
    padding: 0;
    background: transparent;
    border: 1.5px solid #94a3b8;
    border-radius: 999px;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.ngp-blog-roll-dot:hover {
    border-color: #475569;
}
.ngp-blog-roll-dot:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.5);
}
.ngp-blog-roll-dot.is-active {
    background: #0f172a;
    border-color: #0f172a;
    transform: scale(1.15);
}

/* prefers-reduced-motion disables smooth scroll animation too; the JS
   also stops the auto-scroll interval under the same media query. */
@media (prefers-reduced-motion: reduce) {
    .ngp-blog-roll-has-chrome .ngp-blog-roll-track {
        scroll-behavior: auto;
    }
    .ngp-blog-roll-card,
    .ngp-blog-roll-arrow,
    .ngp-blog-roll-dot {
        transition: none;
    }
}


/* ---------------- p23 card content polish ---------------- */

/* Missing-featured-image placeholder. The build_card_html method always
   emits an empty <figure class="ngp-blog-roll-card-media"> for posts
   without a thumbnail (p23) so the responsive grid keeps cards at the
   same height. Give that empty frame a soft visual cue: a diagonal
   stripe pattern tinted the same gray as the normal placeholder, so a
   missing image reads as "no featured image" rather than "failed to
   load." */
.ngp-blog-roll-card-media.ngp-blog-roll-card-media-missing {
    background:
        repeating-linear-gradient(
            45deg,
            #f1f5f9,
            #f1f5f9 10px,
            #e2e8f0 10px,
            #e2e8f0 20px
        );
}
