/* Showcase components – shared by the Creator Hub (At a Glance) and the
   changelog version pages (visual highlights). Built for the Creator Hub, hence the ch- prefix.
   Image sets: .ch-cycle[data-cycle] · before/after sliders: .ba · enlarge on click: [data-zoom]
   · feature rows: .ch-feature (.ch-duo, .ch-grid, .ch-bonus). Script: /assets/js/showcase.js */

.ch-img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: #1b1c1c;
}

.ch-img--cover {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.ch-img--contain {
    object-fit: contain;
    background: #c6c6c6;
}

/* ── At a glance ── */
/* At a Glance: one endless row of cards – 3 visible on desktop, 2 on tablets, 1 + a peek on phones.
   The script turns it into a track that glides along on its own (stops while pointed at), with arrows
   at both ends and drag / swipe. Without the script it is a plain sideways-scrolling row. */
.ch-glance-wrap {
    position: relative;
}

.ch-glance {
    --gap: 1.1rem;
    display: flex;
    gap: var(--gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.ch-glance::-webkit-scrollbar {
    display: none;
}

.ch-glance.is-track {
    display: block;
    overflow: hidden;
    scroll-snap-type: none;
    cursor: grab;
    touch-action: pan-y;
    /* cards fade in and out at the ends instead of being cut off hard */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
}

.ch-glance-track {
    display: flex;
    gap: var(--gap);
    will-change: transform;
}

.ch-glance:focus-visible {
    outline: 2px solid #e8bf62;
    outline-offset: 4px;
    border-radius: 12px;
}

.ch-glance.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.ch-glance img {
    -webkit-user-drag: none;
}

/* Arrows at both ends, level with the pictures – outside the row on wide screens, on its edges below */
.ch-glance-arrow {
    position: absolute;
    top: var(--arrow-top, 30%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(200, 154, 74, 0.4);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    color: #f5d370;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.ch-glance-arrow--prev { left: -64px; }
.ch-glance-arrow--next { right: -64px; }

.ch-glance-arrow svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ch-glance-arrow:focus-visible {
    outline: 2px solid #f5d370;
    outline-offset: 2px;
}

@media (hover: hover) {
    .ch-glance-arrow:hover {
        background: rgba(200, 154, 74, 0.14);
        border-color: #c89a4a;
        box-shadow: 0 0 22px rgba(200, 154, 74, 0.22);
    }
}

/* Narrower screens: in the page margin, clear of the arrows inside the pictures */
@media (max-width: 1240px) {
    .ch-glance-arrow {
        width: 38px;
        height: 38px;
        background: rgba(19, 21, 21, 0.85);
    }

    .ch-glance-arrow--prev { left: -30px; }
    .ch-glance-arrow--next { right: -30px; }
}

/* Phones: a small pair centred under the row */
@media (max-width: 640px) {
    .ch-glance-wrap {
        padding-bottom: 54px;
    }

    .ch-glance-arrow {
        top: auto;
        bottom: 0;
        transform: none;
    }

    .ch-glance-arrow--prev { left: calc(50% - 44px); }
    .ch-glance-arrow--next { right: calc(50% - 44px); }
}

.ch-glance-card {
    flex: 0 0 calc((100% - 2 * var(--gap)) / 3);
    scroll-snap-align: start;
    --card-surface: #222222;
    --card-edge: rgba(255, 255, 255, 0.08);
    padding: 0.75rem 0.75rem 1.2rem;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: --spot 0.35s ease;
}

.ch-glance-card .ch-img {
    margin-bottom: 0.9rem;
}

.ch-glance-card h3 {
    margin: 0 0.4rem 0.35rem;
    font-size: 1.05rem;
}

.ch-glance-card p {
    margin: 0 0.4rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Feature blocks: text and image side by side, alternating */
.ch-feature {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 2rem;
    padding: 1.6rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.ch-feature:nth-of-type(even) .ch-feature-text {
    order: 2;
}

.ch-feature--wide {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
}

.ch-feature--wide .ch-feature-text {
    order: 0 !important;
    max-width: 760px;
}

.ch-feature h3 {
    margin-bottom: 0.6rem;
    color: var(--text);
    font-size: 1.2rem;
}

.ch-feature p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.75;
}

.ch-feature p + p {
    margin-top: 0.7rem;
}

.ch-duo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.6rem;
    align-items: stretch;
}

.ch-duo .ch-img {
    height: 100%;
    object-fit: cover;
}

.ch-duo:not(.ch-duo--items) .ch-img {
    aspect-ratio: 4 / 3;
}

/* Columns in the images' own proportions (880×830 and 16:9), so both are shown whole at the same height */
.ch-duo--items {
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 1.78fr);
    align-items: start;
}

.ch-duo--items .ch-img {
    height: auto;
}

.ch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.ch-bonus {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.6rem;
    padding: 0.7rem;
    border: 1px dashed rgba(200, 154, 74, 0.35);
    border-radius: 12px;
}

.ch-bonus-img {
    width: 150px;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
}

.ch-bonus p {
    color: var(--text);
    font-weight: 600;
}

/* Before / after comparison: drag the divider (mouse, finger, arrow keys) */
.ba {
    --pos: 50%;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: #1b1c1c;
    cursor: ew-resize;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.ba-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
    pointer-events: none;
}

.ba-img--before {
    clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.ba-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 2px;
    transform: translateX(-1px);
    background: var(--accent-gradient);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.ba-handle {
    position: absolute;
    top: 50%;
    left: var(--pos);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    border: 2px solid #e8bf62;
    border-radius: 50%;
    background: rgba(19, 21, 21, 0.8);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.ba.is-dragging .ba-handle,
.ba-handle:focus-visible {
    transform: translate(-50%, -50%) scale(1.1);
    outline: none;
}

.ba-handle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: #f5d370;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ba-tag {
    position: absolute;
    top: 10px;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.72);
    color: #f5d370;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    pointer-events: none;
}

.ba-tag--before { left: 10px; }
.ba-tag--after { right: 10px; }

/* Image sets that crossfade (glance cards, 1.2 flowers) – one image per few seconds, only while on screen */
.ch-cycle {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: #1b1c1c;
}

.ch-glance-card .ch-cycle {
    margin-bottom: 0.9rem;
}

.ch-cycle-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
}

.ch-cycle-img.is-active {
    opacity: 1;
}

.ch-cycle-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    display: flex;
    gap: 5px;
    padding: 4px 6px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.45);
}

/* The dots are buttons (made by the script): click one to jump to that image */
.ch-cycle-dots button {
    position: relative;
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: width 0.3s ease, background 0.3s ease;
}

.ch-cycle-dots button::before {
    content: '';
    position: absolute;
    inset: -8px -4px;
}

.ch-cycle-dots button.is-active {
    width: 14px;
    background: #f5d370;
}

.ch-cycle-dots button:focus-visible {
    outline: 2px solid #f5d370;
    outline-offset: 2px;
}

/* Arrows on the image: appear on hover (always shown, a bit fainter, on touch screens) */
.ch-cycle-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(200, 154, 74, 0.5);
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.6);
    color: #f5d370;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.ch-cycle-arrow--prev { left: 8px; }
.ch-cycle-arrow--next { right: 8px; }

.ch-cycle-arrow svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ch-cycle:hover .ch-cycle-arrow,
.ch-cycle-arrow:focus-visible {
    opacity: 1;
}

.ch-cycle-arrow:hover {
    background: rgba(10, 10, 10, 0.8);
    border-color: #e8bf62;
}

.ch-cycle-arrow:focus-visible {
    outline: 2px solid #f5d370;
    outline-offset: 2px;
}

@media (hover: none) {
    .ch-cycle-arrow {
        opacity: 0.8;
    }
}

/* Clicking an image in a set shows the next one (Creator Hub) … */
.ch-cycle.is-clickable .ch-cycle-img {
    cursor: pointer;
}

/* … or, inside [data-zoom] (changelog Highlights), opens it large */
[data-zoom] .ch-zoomable {
    cursor: zoom-in;
}

[data-zoom] .ch-zoomable:focus-visible {
    outline: 2px solid #f5d370;
    outline-offset: 2px;
}

/* Enlarged view – same look as the homepage / Guide lightbox */
.ch-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    cursor: zoom-out;
}

.ch-lightbox.active {
    display: flex;
}

.ch-lightbox img {
    max-width: 95%;
    max-height: 92%;
    object-fit: contain;
    border-radius: 6px;
}

.ch-lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: none;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #000;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.ch-lightbox-close:hover {
    box-shadow: 0 4px 20px rgba(200, 154, 74, 0.5);
}

@media (max-width: 968px) {
    .ch-glance-card {
        flex-basis: calc((100% - var(--gap)) / 2);
    }

    .ch-feature {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .ch-feature:nth-of-type(even) .ch-feature-text {
        order: 0;
    }
}

@media (max-width: 640px) {
    .ch-glance {
        --gap: 0.8rem;
    }

    .ch-glance-card {
        flex-basis: 86%;
    }

    .ch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ch-duo:not(.ch-duo--items) {
        grid-template-columns: minmax(0, 1fr);
    }

    .ch-bonus-img {
        width: 110px;
    }
}
