﻿/**
 * AP ACF Repeater â€“ Front-end Styles
 *
 * Provides the base layout for both the Grid and Carousel display modes.
 * All colours and typography can be overridden through Elementor's Style tab
 * or your theme's CSS without touching this file.
 */

/* ==========================================================================
   0a. ACF: Background Image widget
   ========================================================================== */

/* The widget and its Elementor wrapper fill the parent column/section height. */
.elementor-widget-ap-acf-bg,
.elementor-widget-ap-acf-bg > .elementor-widget-container {
    height: 100%;
}

.ap-acf-bg {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 50px;
    background-size:     cover;
    background-position: center center;
    background-repeat:   no-repeat;
}

/* Optional dark overlay â€” controlled by the "Overlay Opacity" style control. */
.ap-acf-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #000;
    opacity: 0;
    pointer-events: none;
}

/* Editor placeholder when no sub-field is configured. */
.ap-acf-bg-placeholder {
    min-height: 80px;
    background-color: #f0f0f0;
    border: 2px dashed #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
    font-size: 13px;
    padding: 12px;
    text-align: center;
}

/* ==========================================================================
   0b. Slide background image (applied as inline style by the widget)
   ========================================================================== */

/* When the widget applies a background image directly on the slide wrapper
   (via the "Background Image Sub-Field" setting), these defaults ensure it
   renders as a full cover without extra CSS from the user. */
.ap-acf-item[style*="background-image"] {
    background-size:     cover;
    background-position: center center;
    background-repeat:   no-repeat;
}

/* ==========================================================================
   1. Grid
   ========================================================================== */

.ap-acf-grid {
    display: grid;
    grid-template-columns: repeat( var( --ap-cols, 3 ), 1fr );
    /* column-gap and row-gap are driven by Elementor's responsive slider controls */
}

/* Tablet: Elementor's default breakpoint â‰¤ 1024 px */
@media ( max-width: 1024px ) {
    .ap-acf-grid {
        grid-template-columns: repeat( var( --ap-cols-tablet, 2 ), 1fr );
    }
}

/* Mobile: â‰¤ 767 px */
@media ( max-width: 767px ) {
    .ap-acf-grid {
        grid-template-columns: repeat( var( --ap-cols-mobile, 1 ), 1fr );
    }
}

/* ==========================================================================
   2. Flex
   ========================================================================== */

/* Base display â€” all other flex properties (direction, justify-content,
   align-items, column-gap, row-gap, flex-wrap) are injected by Elementor's
   responsive controls via {{WRAPPER}} .ap-acf-flex selectors. */
.ap-acf-flex {
    display: flex;
}

/* ==========================================================================
   3. Carousel
   ========================================================================== */

/* Outer wrapper â€” always present, controls arrow layout */
.ap-carousel-wrapper {
    position: relative;
}

/* Outside arrows: absolutely positioned relative to the wrapper.
   Negative left/right values (set via Elementor controls) push them
   outside the carousel boundaries. The section needs enough padding
   to show them without clipping. */
.ap-carousel-wrapper.ap-arrows-outside {
    overflow: visible;
}

.ap-carousel-wrapper.ap-arrows-outside .ap-carousel-btn {
    position: absolute;
    top: 50%;           /* overridden by arrow_v_position control */
    transform: translateY( -50% );
}

.ap-carousel-wrapper.ap-arrows-outside .ap-carousel-prev { left:  -24px; }
.ap-carousel-wrapper.ap-arrows-outside .ap-carousel-next { right: -24px; }

/* Inside arrows are absolute over the slides (default behaviour) */
.ap-carousel-wrapper.ap-arrows-inside .ap-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY( -50% );
}

.ap-carousel-wrapper.ap-arrows-inside .ap-carousel-prev { left:  12px; }
.ap-carousel-wrapper.ap-arrows-inside .ap-carousel-next { right: 12px; }

.ap-acf-carousel {
    position: relative;
    overflow: hidden;
}

.ap-acf-carousel-track {
    display: flex;
    /* transition is set dynamically by JS */
    gap: var( --ap-space-between, 20px );
    will-change: transform;
    user-select: none;
}

/**
 * Each slide width:
 *   ( 100% - ( N - 1 ) Ã— gap ) / N
 * where N = --ap-slides-per-view, set as an inline CSS variable by JS.
 */
.ap-acf-carousel-slide {
    flex: 0 0 calc(
        ( 100% - ( var( --ap-slides-per-view, 3 ) - 1 ) * var( --ap-space-between, 20px ) )
        / var( --ap-slides-per-view, 3 )
    );
    min-width: 0; /* prevents flex children from overflowing */
}

/* --------------------------------------------------------------------------
   Equal card height
   --------------------------------------------------------------------------
   The track is a flexbox, so slides already stretch to the tallest sibling
   (align-items: stretch by default). The visible "card", however, is usually
   the Elementor template rendered INSIDE each slide, which only grows to fit
   its own content. These rules make that template â€” and its first-level
   container â€” fill the full slide height so every card matches.            */

.ap-acf-carousel.ap-equal-height .ap-acf-carousel-track {
    align-items: stretch;
}

.ap-acf-carousel.ap-equal-height .ap-acf-carousel-slide {
    display: flex;
    flex-direction: column;
    height: auto;
}

/* The wrapper Elementor outputs around the template content. */
.ap-acf-carousel.ap-equal-height .ap-acf-carousel-slide > .elementor {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
}

/* First-level container(s) of the template fill the remaining height so their
   background / border / padding stretch the whole card. Covers both the modern
   flexbox containers (.e-con) and legacy section/column markup. */
.ap-acf-carousel.ap-equal-height .ap-acf-carousel-slide > .elementor > .e-con,
.ap-acf-carousel.ap-equal-height .ap-acf-carousel-slide > .elementor > .elementor-section,
.ap-acf-carousel.ap-equal-height .ap-acf-carousel-slide > .elementor > .elementor-column {
    flex: 1 1 auto;
    height: 100%;
}

/* --------------------------------------------------------------------------
   Adaptive height (single-slide views, e.g. mobile)
   --------------------------------------------------------------------------
   When only one slide is visible, JS adds .ap-adaptive-height and sets an
   explicit track height equal to the active card. These rules un-stretch the
   cards so the measured height is the card's own content (no empty space below
   a short card) and animate the height change smoothly.                      */
.ap-acf-carousel.ap-adaptive-height .ap-acf-carousel-track {
    align-items: flex-start;
    transition: height .3s ease;
}
.ap-acf-carousel.ap-adaptive-height.ap-equal-height .ap-acf-carousel-slide > .elementor,
.ap-acf-carousel.ap-adaptive-height.ap-equal-height .ap-acf-carousel-slide > .elementor > .e-con,
.ap-acf-carousel.ap-adaptive-height.ap-equal-height .ap-acf-carousel-slide > .elementor > .elementor-section,
.ap-acf-carousel.ap-adaptive-height.ap-equal-height .ap-acf-carousel-slide > .elementor > .elementor-column {
    flex: 0 0 auto;
    height: auto;
}

/* ==========================================================================
   3. Navigation arrows
   ========================================================================== */

.ap-carousel-btn {
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 26px;
    line-height: 1;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background-color: rgba( 0, 0, 0, 0.45 );
    color: #fff;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    /* Prevent text selection on rapid clicks */
    user-select: none;
}

.ap-carousel-btn:hover {
    background-color: rgba( 0, 0, 0, 0.7 );
}

.ap-carousel-btn:disabled {
    opacity: 0;
    cursor: default;
    pointer-events: none;
}

/* Legacy fallback â€” positions handled by .ap-arrows-inside / .ap-arrows-outside */

/* ==========================================================================
   4. Pagination dots
   ========================================================================== */

.ap-carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-bottom: 3px;
}

.ap-carousel-dot {
    display: block;
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.ap-carousel-dot.is-active {
    background-color: #333;
    transform: scale( 1.3 );
}

/* ==========================================================================
   5. Card / Item
   ========================================================================== */

.ap-acf-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.25s ease;
}

/* --- Image --- */

.ap-item-image-link {
    display: block;
    overflow: hidden;
}

.ap-item-image {
    overflow: hidden;
    height: 200px; /* overridden by Elementor slider control */
}

.ap-item-image img,
.ap-item-img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
}

.ap-acf-item:hover .ap-item-img {
    transform: scale( 1.03 );
}

/* --- Text content --- */

.ap-item-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.ap-item-extra {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 6px;
    color: #888;
}

.ap-item-title {
    margin: 0 0 10px;
}

.ap-item-title a {
    color: inherit;
    text-decoration: none;
}

.ap-item-title a:hover {
    text-decoration: underline;
}

.ap-item-body {
    flex: 1;
    margin-bottom: 14px;
}

/* --- Button --- */

.ap-item-button {
    display: inline-block;
    align-self: flex-start;
    padding: 8px 20px;
    background-color: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.ap-item-button:hover {
    background-color: #555;
    color: #fff;
}

/* Overflow visible â€” slides at edges peek outside the container.
   Enable via "Show Slides at Edges" toggle in widget settings. */
.ap-acf-carousel.ap-carousel-overflow-visible {
    overflow: visible;
}

/* ==========================================================================
   6. Scale Effect
   ========================================================================== */

/* Base state for all slides when scale effect is on */
.ap-scale-effect .ap-acf-carousel-slide {
    transform: scale( 0.9 );
    /* transition is set via the Elementor style control (scale_duration) */
}

/* Active (first visible) slide â€” expands rightward from its left edge
   so it never clips against the container's left boundary. */
.ap-scale-effect .ap-acf-carousel-slide.is-center {
    transform-origin: left center;
    transform: scale( 1.15 );
}

/* ==========================================================================
   7. Taxonomy Filter Bar (AP Posts Filter widget)
   ========================================================================== */

.ap-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.ap-filter-btn {
    display: inline-block;
    padding: 8px 18px;
    background-color: transparent;
    color: inherit;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.ap-filter-btn:hover {
    opacity: 0.8;
}

.ap-filter-btn.is-active {
    cursor: default;
}

/* Loading state: dims the items while AJAX is in flight */
.ap-filter-items {
    transition: opacity 0.2s ease;
}

.ap-filter-items.is-loading {
    opacity: 0.4;
    pointer-events: none;
}

/* "No posts found" message */
.ap-no-posts {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* ==========================================================================
   8. AP Spotlight Carousel
   ========================================================================== */

/* CSS custom-property defaults â€” overridden by inline style set in PHP render(). */
.ap-spotlight {
    --spotlight-featured-w: 40%;
    --spotlight-h: 480px;
    --spotlight-gap: 12px;
    display: flex;
    gap: var( --spotlight-gap );
    height: var( --spotlight-h );
    user-select: none;
}

/* ---- Two-column layout ---------------------------------------------------- */

/* Left column: featured card, full height */
.ap-spotlight-featured-col {
    flex: 0 0 var( --spotlight-featured-w );
    min-width: 0;
    height: 100%;
}

.ap-spotlight-card--featured {
    height: 100%;
    cursor: grab;
}

.ap-spotlight-card--featured:active {
    cursor: grabbing;
}

/* Right column: header (heading + nav) stacked above thumbnails */
.ap-spotlight-right-col {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px; /* overridden by Elementor heading_gap control */
}

/* ---- Header row: heading text + nav arrows ------------------------------- */

.ap-spotlight-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.ap-spotlight-heading-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.ap-spotlight-heading {
    margin: 0 0 6px;
    line-height: 1.25;
}

.ap-spotlight-subtext {
    margin: 0;
    line-height: 1.5;
}

.ap-spotlight-heading-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background-color: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.ap-spotlight-heading-btn:hover {
    background-color: #555;
    color: #fff;
}

/* Nav arrows group â€” aligned to the top-right */
.ap-spotlight-nav {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding-top: 2px;
}

/* Override base .ap-carousel-btn colours for the nav context */
.ap-spotlight-nav .ap-carousel-btn {
    background-color: transparent;
    color: #333;
}

.ap-spotlight-nav .ap-carousel-btn:hover {
    background-color: rgba( 0, 0, 0, 0.08 );
}

/* ---- Thumbnails strip ---------------------------------------------------- */

.ap-spotlight-thumbs-outer {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.ap-spotlight-thumbs-track {
    display: flex;
    height: 100%;
    gap: var( --spotlight-gap );
}

/* Thumb card: equal-width flex children â€” no translateX in content-swap arch */
.ap-spotlight-card--thumb {
    flex: 1 1 0;
    height: 100%;
    min-width: 0;
    cursor: pointer;
}

/* ---- Individual card base styles ----------------------------------------- */

.ap-spotlight-card {
    position: relative;
    overflow: hidden;
}

/* Full-card link overlay â€” transparent, sits above everything, makes the
   entire card a single clickable target. Drag suppression fires first
   (capture phase in JS) so drags never trigger navigation. */
.ap-spotlight-card-link {
    position: absolute;
    inset: 0;
    z-index: 5;
}

/* Background image */
.ap-spotlight-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.8s ease, opacity 0.25s ease;
}

.ap-spotlight-card:hover .ap-spotlight-bg {
    transform: scale( 1.04 );
}

/* Gradient overlay */
.ap-spotlight-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba( 0, 0, 0, 0.65 ) 0%,
        rgba( 0, 0, 0, 0.1 ) 55%,
        transparent 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Dark hover overlay â€” sits above the gradient, below the content */
.ap-spotlight-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba( 0, 0, 0, 0 );
    transition: background-color 0.35s ease;
    z-index: 2;
    pointer-events: none;
}

.ap-spotlight-card:hover::before {
    background-color: rgba( 0, 0, 0, 0.3 );
}

/* ---- Content overlay (bottom) -------------------------------------------- */

.ap-spotlight-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 6; /* above .ap-spotlight-card-link (5) so text and buttons are clickable */
    transition: opacity 0.2s ease;
}

/* Taxonomy label */
.ap-spotlight-label {
    display: block;
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba( 255, 255, 255, 0.7 );
    margin-bottom: 5px;
}

/* Title */
.ap-spotlight-title {
    margin: 0;
    line-height: 1.3;
}

.ap-spotlight-title a {
    color: #fff;
    text-decoration: none;
    position: relative;
    display: inline;
}

/* Animated underline â€” grows left-to-right on hover */
.ap-spotlight-title a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: currentColor;
    transition: width 0.4s ease;
}

.ap-spotlight-card:hover .ap-spotlight-title a::after {
    width: 100%;
}

/* â†— arrow icon â€” inline after the title text */
.ap-spotlight-arrow-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    opacity: 0;
    transform: translate( -3px, 3px );
    transition: opacity 0.4s ease, transform 0.4s ease;
    text-decoration: none;
    vertical-align: middle;
}

/* Arrow: visible only on hover */
.ap-spotlight-card:hover .ap-spotlight-arrow-icon {
    opacity: 1;
    transform: translate( 0, 0 );
}

/* Excerpt */
.ap-spotlight-excerpt {
    margin-top: 10px;
    font-size: 0.875em;
    line-height: 1.55;
    color: rgba( 255, 255, 255, 0.88 );
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.6s ease, opacity 0.5s ease;
}

/* Featured card always shows excerpt; thumbs only on hover */
.ap-spotlight-card--featured .ap-spotlight-excerpt,
.ap-spotlight-card:hover .ap-spotlight-excerpt {
    max-height: 200px;
    opacity: 1;
}

/* Card CTA button */
.ap-spotlight-card-btn {
    display: inline-block;
    margin-top: 14px;
    padding: 8px 18px;
    background-color: rgba( 255, 255, 255, 0.15 );
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative; /* ensures z-index works above card-link */
    z-index: 1;
}

.ap-spotlight-card-btn:hover {
    background-color: rgba( 255, 255, 255, 0.3 );
    color: #fff;
}

/* ---- Mobile: stack vertically, single card at a time -------------------- */

@media ( max-width: 767px ) {
    .ap-spotlight {
        flex-direction: column;
        height: auto;
    }

    .ap-spotlight-featured-col,
    .ap-spotlight-right-col {
        width: 100%;
        height: auto;
    }

    .ap-spotlight-card--featured {
        height: var( --spotlight-h );
    }

    .ap-spotlight-thumbs-outer {
        height: 160px;
    }
}

/* ==========================================================================
   9. ACF Gallery Carousel
   ========================================================================== */

/* ---- Slide ---------------------------------------------------------------- */

.ap-gallery-slide {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 340px; /* overridden by Elementor slider control */
    display: block;
}

.ap-gallery-img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease;
    pointer-events: none; /* prevent browser drag on image */
}

.ap-gallery-slide:hover .ap-gallery-img {
    transform: scale( 1.05 );
}

/* ---- Hover overlay -------------------------------------------------------- */

.ap-gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ap-gallery-slide:hover .ap-gallery-overlay,
.ap-gallery-slide:focus  .ap-gallery-overlay {
    opacity: 1;
}

.ap-gallery-overlay-inner {
    width: 100%;
}

.ap-gallery-title {
    margin: 0 0 5px;
    font-weight: 600;
    line-height: 1.3;
}

.ap-gallery-caption {
    margin: 0;
    font-size: 0.875em;
    line-height: 1.4;
}

/* ---- Lightbox ------------------------------------------------------------- */

.ap-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.ap-gallery-lightbox.is-open {
    opacity: 1;
    pointer-events: all;
}

.ap-gl-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba( 0, 0, 0, 0.92 );
}

.ap-gl-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 90vw;
    max-height: 90vh;
}

.ap-gl-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 75vh;
}

.ap-gl-img {
    display: block;
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.ap-gl-info {
    text-align: center;
    max-width: 640px;
    padding: 0 16px;
}

.ap-gl-title {
    margin: 0 0 6px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05em;
    line-height: 1.3;
}

.ap-gl-caption {
    margin: 0 0 10px;
    color: rgba( 255, 255, 255, 0.72 );
    font-size: 0.9em;
}

.ap-gl-description {
    margin: 0;
    color: rgba( 255, 255, 255, 0.55 );
    font-size: 0.85em;
    line-height: 1.55;
}

.ap-gl-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: none;
    border: none;
    color: rgba( 255, 255, 255, 0.8 );
    font-size: 38px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.ap-gl-close:hover {
    color: #fff;
}

.ap-gl-prev,
.ap-gl-next {
    position: fixed;
    top: 50%;
    transform: translateY( -50% );
    z-index: 2;
    background: rgba( 255, 255, 255, 0.12 );
    border: none;
    color: #fff;
    font-size: 34px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease;
}

.ap-gl-prev { left:  16px; }
.ap-gl-next { right: 16px; }

.ap-gl-prev:hover,
.ap-gl-next:hover {
    background: rgba( 255, 255, 255, 0.28 );
}

@media ( max-width: 767px ) {
    .ap-gl-prev { left:  6px; }
    .ap-gl-next { right: 6px; }
}

/* ==========================================================================
   10. Editor placeholder (visible only inside Elementor's editor)
   ========================================================================== */

.ap-acf-placeholder {
    padding: 24px 20px;
    text-align: center;
    background-color: #f8f8f8;
    color: #aaa;
    border: 2px dashed #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    line-height: 1.5;
}

/* ==========================================================================
   11. Project Highlights (grid of cards + showcase popup)
   ========================================================================== */

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

.ap-ph-grid {
    display: grid;
    grid-template-columns: repeat( var( --ap-cols, 3 ), 1fr );
    /* column-gap / row-gap come from Elementor's responsive sliders */
}

@media ( max-width: 1024px ) {
    .ap-ph-grid {
        grid-template-columns: repeat( var( --ap-cols-tablet, 2 ), 1fr );
    }
}

@media ( max-width: 767px ) {
    .ap-ph-grid {
        grid-template-columns: repeat( var( --ap-cols-mobile, 1 ), 1fr );
    }
}

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

.ap-ph-card {
    /* reset <button> defaults so it behaves like a block card */
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: default;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ap-ph-card.is-clickable {
    cursor: pointer;
}

.ap-ph-card.is-clickable:hover {
    transform: translateY( -4px );
}

.ap-ph-card.is-clickable:focus-visible {
    outline: 2px solid var( --ap-ph-accent, #11214d );
    outline-offset: 3px;
}

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

.ap-ph-card-image {
    position: relative;
    height: 320px; /* overridden by Elementor slider control */
    overflow: hidden;
    background-color: #eef0f6;
    flex: 0 0 auto;
}

.ap-ph-card-img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease;
}

.ap-ph-card.is-clickable:hover .ap-ph-card-img {
    transform: scale( 1.04 );
}

/* Small media-count badge over the image */
.ap-ph-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 10px;
    border-radius: 100px;
    background-color: rgba( 0, 0, 0, 0.55 );
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ap-ph-card.is-clickable:hover .ap-ph-card-badge {
    opacity: 1;
}

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

.ap-ph-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding-top: 18px;
}

.ap-ph-card-title {
    margin: 0 0 12px;
    line-height: 1.25;
}

.ap-ph-card-location {
    margin: 0;
    font-weight: 700;
    line-height: 1.35;
}

.ap-ph-card-desc {
    margin: 0;
    line-height: 1.6;
}

.ap-ph-card-desc p:last-child {
    margin-bottom: 0;
}

.ap-ph-card-footer {
    margin-top: 18px;
}

.ap-ph-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ap-ph-card-btn-arrow {
    transition: transform 0.25s ease;
}

.ap-ph-card.is-clickable:hover .ap-ph-card-btn-arrow {
    transform: translateX( 4px );
}

/* ---- Showcase modal ------------------------------------------------------ */

.ap-ph-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.ap-ph-modal.is-open {
    opacity: 1;
    pointer-events: all;
}

.ap-ph-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba( 10, 14, 30, 0.9 );
}

.ap-ph-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ap-ph-modal-title {
    margin: 0;
    color: #fff;
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1.3;
    padding-right: 48px;
}

.ap-ph-close {
    position: absolute;
    top: -6px;
    right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba( 255, 255, 255, 0.85 );
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ap-ph-close:hover {
    color: #fff;
}

/* ---- Stage (main viewer + side nav) -------------------------------------- */

.ap-ph-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    flex: 1 1 auto;
}

.ap-ph-viewer {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
}

.ap-ph-viewer-img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 6px;
}

/* Vidyard injects its player into this container */
.ap-ph-viewer .vidyard-player-embed,
.ap-ph-viewer > div {
    width: 100%;
    max-width: 1000px;
}

.ap-ph-nav {
    position: absolute;
    top: 50%;
    transform: translateY( -50% );
    z-index: 2;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba( 255, 255, 255, 0.14 );
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ap-ph-nav:hover {
    background-color: var( --ap-ph-accent, rgba( 255, 255, 255, 0.32 ) );
}

.ap-ph-prev { left:  -8px; }
.ap-ph-next { right: -8px; }

/* ---- Thumbnail strip ----------------------------------------------------- */

.ap-ph-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 0 0 auto;
}

.ap-ph-caption {
    max-width: 900px;
    margin: 0 auto;
    color: #fff;
    font-size: 0.98rem;
    line-height: 1.55;
    text-align: center;
}

.ap-ph-caption p {
    margin: 0 0 0.75em;
}

.ap-ph-caption p:last-child {
    margin-bottom: 0;
}

.ap-ph-thumb {
    position: relative;
    width: 84px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.ap-ph-thumb img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
}

.ap-ph-thumb:hover {
    opacity: 1;
}

.ap-ph-thumb.is-active {
    opacity: 1;
    border-color: var( --ap-ph-accent, #ffffff );
}

/* Play icon over video thumbnails */
.ap-ph-thumb.is-video::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate( -40%, -50% );
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #fff;
    filter: drop-shadow( 0 0 2px rgba( 0, 0, 0, 0.6 ) );
}

.ap-ph-thumb.is-video::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba( 0, 0, 0, 0.25 );
}

@media ( max-width: 767px ) {
    .ap-ph-prev { left:  2px; }
    .ap-ph-next { right: 2px; }

    .ap-ph-thumb {
        width: 64px;
        height: 44px;
    }
}

/* ---- Icon Cards (ap-icon-cards) ----------------------------------------- */
.ap-ic-heading {
    margin: 0 0 40px;
    text-align: center;
    line-height: 1.25;
    color: #11214d;
}
/* Flexbox (not grid) so that a short final row of "orphan" cards centers
   instead of hugging the left edge. Full rows still fill edge to edge. */
.ap-ic-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var( --ic-rowgap, 24px ) var( --ic-colgap, 24px );
}
.ap-ic-card {
    flex: 0 0 auto;
    width: calc( ( 100% - ( var( --ic-cols, 3 ) - 1 ) * var( --ic-colgap, 24px ) ) / var( --ic-cols, 3 ) );
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #E2E4EA;
    border-radius: 15px;
    padding: 32px 24px;
}
.ap-ic-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 130px;
    border-radius: 12px;
    background: #EAF1FC;
    margin-bottom: 18px;
    flex: 0 0 auto;
}
.ap-ic-icon img {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: contain;
}
.ap-ic-title {
    margin: 0 0 8px;
    font-weight: 700;
    line-height: 1.3;
    color: #11214d;
}
.ap-ic-text {
    margin: 0;
    line-height: 1.6;
    color: #5a6270;
}
.ap-ic-text p {
    margin: 0;
}
@media ( max-width: 1024px ) {
    .ap-ic-card { width: calc( ( 100% - ( var( --ic-cols-t, 2 ) - 1 ) * var( --ic-colgap, 24px ) ) / var( --ic-cols-t, 2 ) ); }
}
@media ( max-width: 767px ) {
    .ap-ic-card { width: calc( ( 100% - ( var( --ic-cols-m, 1 ) - 1 ) * var( --ic-colgap, 24px ) ) / var( --ic-cols-m, 1 ) ); }
}

/* ============================================================
   AP Feature Rows  (Posts - Features Grid | Type 6: Three rows)
   Full-width bands, 2-col image + heading/wysiwyg, per-row
   invert + background color, rounded image.
   ============================================================ */
.ap-fr-wrap { width: 100%; border-top: 1px solid #b9b9bd; border-bottom: 1px solid #b9b9bd; }
.ap-fr-row { width: 100%; }
.ap-fr-inner {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    gap: 48px;
    align-items: center;
    padding: 64px 24px;
}
.ap-fr-row.ap-fr-invert .ap-fr-inner { flex-direction: row-reverse; }
.ap-fr-media { flex: 0 0 50%; max-width: 50%; }
.ap-fr-media img { display: block; width: 100%; height: auto; border-radius: 10px; }
.ap-fr-content { flex: 1 1 0; min-width: 0; }
.ap-fr-heading { margin: 0 0 16px; }
.ap-fr-text p { margin: 0 0 1em; }
.ap-fr-text p:last-child { margin-bottom: 0; }
.ap-fr-text ul { margin: 1em 0; padding-left: 1.25em; list-style: disc; }
.ap-fr-text li { margin: .4em 0; }
@media ( max-width: 767px ) {
    .ap-fr-inner,
    .ap-fr-row.ap-fr-invert .ap-fr-inner { flex-direction: column !important; }
    .ap-fr-media { flex: 0 0 auto !important; flex-basis: auto !important; max-width: 100% !important; width: 100% !important; }
}
