/* ============================================================
   Collection Tiles – Custom Responsive Carousel v1.2.2
   Cards are sized via aspect-ratio (not fixed px height) so
   they scale naturally at any column count or screen width.
   ============================================================ */

/* ── CSS Custom Properties (set per-instance via PHP inline) ── */
/* --tiles-aspect   : e.g. 2/3  (portrait), 3/4, 1/1, 4/3, 16/9 */
/* --tiles-gap      : gap between cards in px                     */
/* --tiles-radius   : border-radius in px                         */
/* --tiles-overlay  : rgba overlay colour                         */
/* --tiles-title-color, --tiles-title-size, --tiles-title-weight  */
/* --tiles-arrow-color, --tiles-arrow-bg                          */

/* ── Wrapper ──────────────────────────────────────────────────── */
.crc-tiles-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.crc-tiles-contained {
    max-width: 100%;
}

.crc-tiles-fullwidth {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
}

/* ── Swiper ────────────────────────────────────────────────────── */
.crc-tiles-wrapper .crc-tiles-swiper {
    width: 100%;
    overflow: hidden;
}

.crc-tiles-wrapper .swiper-wrapper {
    align-items: stretch;
}

.crc-tile-slide {
    /* Let the card's aspect-ratio drive the height */
    height: auto;
    box-sizing: border-box;
}

/* ── Card – aspect-ratio based, NO fixed height ─────────────── */
.crc-tile {
    display: block;
    position: relative;
    width: 100%;
    /* aspect-ratio drives the card height — set per instance */
    aspect-ratio: var(--tiles-aspect, 2/3);
    border-radius: var(--tiles-radius, 12px);
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

a.crc-tile:focus-visible {
    outline: 3px solid var(--tiles-arrow-bg, #000);
    outline-offset: 2px;
}

/* ── Image – fills the whole card perfectly ──────────────────── */
.crc-tile-img-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: var(--tiles-radius, 12px);
}

.crc-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* always fills the card, no squishing */
    object-position: center;    /* centre the crop */
    display: block;
    transition: transform 0.5s ease;
    will-change: transform;
}

/* ── Overlay ─────────────────────────────────────────────────── */
.crc-tile-overlay {
    position: absolute;
    inset: 0;
    background: var(--tiles-overlay, rgba(0,0,0,0.35));
    transition: background 0.3s ease;
    border-radius: var(--tiles-radius, 12px);
}

/* ── Hover effects ───────────────────────────────────────────── */
.crc-tile-hover-zoom:hover .crc-tile-img {
    transform: scale(1.06);
}
.crc-tile-hover-brighten:hover .crc-tile-overlay {
    background: rgba(255,255,255,0.12);
}
.crc-tile-hover-darken:hover .crc-tile-overlay {
    background: rgba(0,0,0,0.65);
}
.crc-tile-hover-none:hover .crc-tile-img {
    transform: none;
}

/* ── Title overlay ───────────────────────────────────────────── */
.crc-tile-title-wrap {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 18px 20px;
    pointer-events: none;
}

.crc-tile-title-bottom {
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 60%);
}
.crc-tile-title-center {
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    padding: 12px 20px;
}
.crc-tile-title-top {
    top: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 60%);
}

.crc-tile-title {
    display: block;
    /* Color, size, weight driven by per-instance CSS vars — no theme override */
    color: var(--tiles-title-color, #ffffff);
    font-size: var(--tiles-title-size, 20px);
    font-weight: var(--tiles-title-weight, 700);
    /* line-height / letter-spacing: intentionally omitted — let theme decide */
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ── Navigation Arrows ───────────────────────────────────────── */
.crc-tiles-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    cursor: pointer;
    border: none;
    padding: 0;
    /* line-height omitted — arrow buttons contain only icon glyphs;
       flex centering handles alignment without needing line-height */
    color: var(--tiles-arrow-color, #ffffff);
    background: var(--tiles-arrow-bg, rgba(0,0,0,0.7));
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crc-tiles-arrow:disabled {
    opacity: 0.25 !important;
    pointer-events: none;
}

.crc-tiles-arrow-rounded {
    width: 48px; height: 48px;
    border-radius: 50%; font-size: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.crc-tiles-arrow-rounded:hover {
    opacity: 0.9;
    transform: translateY(-50%) scale(1.08);
}

.crc-tiles-arrow-classic {
    width: 42px; height: 42px;
    border-radius: 4px; font-size: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.crc-tiles-arrow-classic:hover { opacity: 0.85; }

.crc-tiles-arrow-minimal {
    width: 36px; height: 36px;
    border-radius: 50%; font-size: 32px;
    background: transparent; opacity: 0.8;
}
.crc-tiles-arrow-minimal:hover {
    opacity: 1;
    background: rgba(0,0,0,0.15);
}

/* ── Arrow Positions ─────────────────────────────────────────── */
.crc-tiles-arrowpos-sides .crc-tiles-prev { left: -24px; }
.crc-tiles-arrowpos-sides .crc-tiles-next { right: -24px; }

@media (max-width: 900px) {
    .crc-tiles-arrowpos-sides .crc-tiles-prev { left: 4px; }
    .crc-tiles-arrowpos-sides .crc-tiles-next { right: 4px; }
}

.crc-tiles-controls {
    display: flex; gap: 10px; align-items: center;
}
.crc-tiles-controls .crc-tiles-arrow {
    position: static; transform: none; flex-shrink: 0;
}
.crc-tiles-controls .crc-tiles-arrow:hover { transform: scale(1.08); }

.crc-tiles-controls-topright {
    position: absolute; top: -56px; right: 0; z-index: 10;
}
.crc-tiles-controls-bottom-center {
    justify-content: center; margin-top: 14px;
}
.crc-tiles-controls-bottom-right {
    justify-content: flex-end; margin-top: 14px;
}
.crc-tiles-arrowpos-top-right { padding-top: 60px; }

/* ── Swipe hint ──────────────────────────────────────────────── */
.crc-tiles-wrapper .crc-swipe-hint {
    display: none;
    align-items: center; justify-content: center; gap: 8px;
    position: absolute; bottom: 12px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.52); color: #fff;
    padding: 5px 16px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    pointer-events: none; z-index: 30;
    transition: opacity 0.5s ease;
}
.crc-tiles-wrapper .crc-swipe-hint.crc-hint-visible { display: flex; }
.crc-tiles-wrapper .crc-swipe-hint.crc-hint-fade    { opacity: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
/* aspect-ratio scales naturally — only the arrows need tweaks */
@media (max-width: 768px) {
    .crc-tiles-arrow-rounded,
    .crc-tiles-arrow-classic {
        width: 36px; height: 36px; font-size: 14px;
    }
}

@media (max-width: 480px) {
    /* font-size intentionally omitted — the CSS var (--tiles-title-size) already
       controls size; scaling it here would fight the theme's responsive typography */
}
