/*
 * Base styles for mod_jrprism
 *
 * Colour + surface tokens map to Bootstrap 5 CSS variables so the module
 * inherits the buyer's template out of the box (no module-specific brand
 * palette baked in). Override any --jrp-* token in the template's user.css
 * to re-skin a single site.
 */
.mod-jrprism {
    --jrp-accent: var(--bs-primary, #0d6efd);
    --jrp-accent-emphasis: var(--bs-link-hover-color, #0a58ca);
    --jrp-surface: var(--bs-body-bg, #fff);
    --jrp-surface-muted: var(--bs-tertiary-bg, #f8f9fa);
    --jrp-border: var(--bs-border-color, #dee2e6);
    --jrp-text: var(--bs-body-color, #212529);
    --jrp-text-muted: var(--bs-secondary-color, #6c757d);
}

.mod-jrprism .jrp-card img {
    object-fit: cover;
    height: 200px;
}

/* ---- Shared image ratio + fit (Pro: image_ratio / image_fit) ----
   A layout applies these classes directly to its <img>. The 'native' ratio
   emits no class, so default rendering is unchanged — and because the options
   are Pro-only, Lite never emits the classes at all. A ratio class forces the
   image box to a fixed aspect; the fit class controls crop vs letterbox. The
   ratio rules win over a layout's own fixed height (cover-cropping inside the
   ratio box), so layouts that set a height still line up evenly when a ratio
   is chosen. */
.mod-jrprism .jrp-media--16x9 { aspect-ratio: 16 / 9 !important; height: auto !important; }
.mod-jrprism .jrp-media--4x3  { aspect-ratio: 4 / 3  !important; height: auto !important; }
.mod-jrprism .jrp-media--1x1  { aspect-ratio: 1 / 1  !important; height: auto !important; }
.mod-jrprism .jrp-media--fit-cover   { width: 100%; max-height: none !important; object-fit: cover !important; }
.mod-jrprism .jrp-media--fit-contain { width: 100%; max-height: none !important; object-fit: contain !important; }

.mod-jrprism.layout-accordion .accordion-button {
    font-weight: bold;
}

/* Native-path accordion thumbnail cap. Scoped to images WITHOUT a ratio class
   so that choosing an image_ratio (which sets its own aspect box) is not
   clipped by this height limit. Replaces the former inline max-height. */
.mod-jrprism.layout-accordion .accordion-body img:not([class*="jrp-media--"]) {
    max-height: 250px;
}

/* ── Showcase (Features) Layout ─────────────────────────── */
.layout-showcase {
    overflow: hidden;
}

.jrp-showcase-row {
    background-color: var(--jrp-surface-muted);
    min-height: 420px;
}

.jrp-showcase-image-col {
    padding: 15px 0 15px 15px;
}

@media (max-width: 767.98px) {
    .jrp-showcase-image-col { padding: 15px; }
}

.jrp-showcase-img {
    width: 100%;
    height: 100%;
    min-height: 280px;
    object-fit: cover;
    display: block;
}

.jrp-showcase-placeholder {
    background-color: var(--jrp-border);
    min-height: 280px;
}

.jrp-showcase-content-col {
    position: relative;
    /* padding-bottom: 60px !important; room for dots */
}

.jrp-showcase-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-family: inherit;
}

.jrp-showcase-title a {
    color: var(--jrp-text);
    text-decoration: none;
    font-size: 1.9rem;
    line-height: 1.25;
    transition: color 0.2s ease;
}

.jrp-showcase-title a:hover { color: var(--jrp-accent); }

.jrp-showcase-desc {
    color: var(--jrp-text);
    font-size: 0.95rem;
    line-height: 1.7;
}

.jrp-showcase-readon {
    color: var(--jrp-accent);
    font-weight: 700;
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--jrp-border);
    padding-bottom: 2px;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.jrp-showcase-readon:hover {
    color: var(--jrp-accent-emphasis);
    border-bottom-color: var(--jrp-accent);
}

/* Dot indicators — bottom-right of the right panel.
   Dark fill + light ring + shadow so the dots stay visible on light AND dark
   backgrounds regardless of the host template. */
.jrp-showcase-indicators {
    position: absolute;
    bottom: 20px;
    left: auto;
    right: 20px;
    margin: 0;
    justify-content: flex-start;
}

.jrp-showcase-indicators button {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.4) !important;
    border: 2px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.55);
    margin: 0 4px !important;
    opacity: 1 !important;
    padding: 0;
    box-sizing: content-box;
    transition: background-color 0.2s ease;
}

.jrp-showcase-indicators button.active {
    background-color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.6) !important;
}

/* Loading indicator for infinite scroll */
.jrp-showcase-loader {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

/* Mosaic Layout */
.jrp-mosaic-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Honour items_per_row (via --jrp-mosaic-cols) on tablet/desktop; single column on
   mobile. Explicit column count (not auto-fill) so the grid matches the configured
   value with no empty trailing tracks. Mirrors default.php's row-cols-1 row-cols-md-N. */
@media (min-width: 768px) {
    .jrp-mosaic-grid {
        grid-template-columns: repeat(var(--jrp-mosaic-cols, 3), minmax(0, 1fr));
    }
}

.jrp-mosaic-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.jrp-mosaic-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 200px;
}

/* Mosaic's image zoom is now driven by the shared hover_effect option
   (hover_effect=zoom) rather than being hardcoded always-on. See the
   "Image hover effects" block below. */

.jrp-mosaic-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
    padding: 1.5rem 1rem 1rem;
    transition: opacity 0.3s ease;
}

.jrp-mosaic-title {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.jrp-mosaic-desc {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.85;
}

/* ── Tabs Layout ────────────────────────────────────────── */
.jrp-tabs-nav {
    border-bottom: 2px solid var(--jrp-accent);
    flex-wrap: wrap;
}

.jrp-tabs-nav .jrp-tabs-link {
    color: var(--jrp-text);
    font-weight: 600;
    border: 1px solid transparent;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.jrp-tabs-nav .jrp-tabs-link:hover {
    color: var(--jrp-accent);
    border-color: var(--jrp-border) var(--jrp-border) var(--jrp-accent);
    background-color: var(--jrp-surface-muted);
}

.jrp-tabs-nav .jrp-tabs-link.active {
    color: var(--jrp-accent);
    background-color: var(--jrp-surface);
    border-color: var(--jrp-accent) var(--jrp-accent) var(--jrp-surface);
}

/* Visible keyboard-focus ring (accessibility — arrow-key tab navigation). */
.jrp-tabs-nav .jrp-tabs-link:focus-visible {
    outline: 2px solid var(--jrp-accent);
    outline-offset: 2px;
}

.jrp-tabs-content {
    padding: 1.5rem 0.25rem;
}

.jrp-tabs-img {
    width: 100%;
    object-fit: cover;
}

.jrp-tabs-title {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-family: inherit;
}

.jrp-tabs-title a {
    color: var(--jrp-text);
    transition: color 0.2s ease;
}

.jrp-tabs-title a:hover { color: var(--jrp-accent); }

.jrp-tabs-desc {
    line-height: 1.7;
}

/* ---- Image hover effects (Pro: hover_effect) ──────────────────────────────
   Applied to a layout's image container in default, mosaic, and zigzag. The
   'none' choice emits no class (unchanged rendering), and the options are
   Pro-only so Lite never emits them. ALL motion is gated behind
   prefers-reduced-motion so visitors who opt out of motion get a static image —
   only the static overlay-fade gradient remains for them. */
/* display:block ensures the hover container (an inline <a> in the card grid) is
   block-level so its overflow:hidden clip and transforms apply correctly.
   Harmless on the layouts where the container is already block. */
.mod-jrprism .jrp-hover { display: block; }

@media (prefers-reduced-motion: no-preference) {
    /* Zoom — image scales up within a clipped container. */
    .mod-jrprism .jrp-hover--zoom { overflow: hidden; }
    .mod-jrprism .jrp-hover--zoom img { transition: transform 0.35s ease; }
    .mod-jrprism .jrp-hover--zoom:hover img { transform: scale(1.06); }

    /* Lift — the image raises with a soft shadow. */
    .mod-jrprism .jrp-hover--lift { transition: transform 0.25s ease, box-shadow 0.25s ease; }
    .mod-jrprism .jrp-hover--lift:hover { transform: translateY(-5px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
}

/* Overlay-fade — a gradient veil fades in over the image. The transition is
   motion-gated above (it fades for no-preference users); for reduce users the
   veil simply appears on hover without animating, which is acceptable. */
.mod-jrprism .jrp-hover--overlay-fade { position: relative; }
.mod-jrprism .jrp-hover--overlay-fade::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 45%, rgba(0, 0, 0, 0.55));
    opacity: 0;
    pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
    .mod-jrprism .jrp-hover--overlay-fade::after { transition: opacity 0.3s ease; }
}
.mod-jrprism .jrp-hover--overlay-fade:hover::after { opacity: 1; }

/* Preserve each layout's rounded corners during the effect. The zoom container
   clips the scaled image to its own box, so it must carry the image's radius —
   otherwise the corners are clipped square. The overlay veil inherits it too. */
.mod-jrprism .jrp-hover--overlay-fade::after { border-radius: inherit; }
.mod-jrprism.layout-default .card-img-link.jrp-hover {
    overflow: hidden;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
.mod-jrprism.layout-zigzag .jrp-zigzag-media.jrp-hover {
    overflow: hidden;
    border-radius: var(--jrp-zigzag-radius, 0.5rem);
}
