
/*
|--------------------------------------------------------------------------
| PAGE / BODY
|--------------------------------------------------------------------------
*/
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: #111;
    color: #fff;
    overflow: hidden;
}

/*
|--------------------------------------------------------------------------
| MAIN PAGE LAYOUT
|--------------------------------------------------------------------------
| 1) Main viewer
| 2) Controls
| 3) Thumbnail strip
|--------------------------------------------------------------------------
*/
.slideshow-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

/*
|--------------------------------------------------------------------------
| MAIN VIEW AREA
|--------------------------------------------------------------------------
*/
.main-view {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    overflow: hidden;
    min-height: 0;
    touch-action: pan-y; /* allows vertical page gestures while we detect horizontal swipes */
}

/*
|--------------------------------------------------------------------------
| IMAGE WRAPPER
|--------------------------------------------------------------------------
| We use an extra wrapper so we can animate opacity smoothly for fade
| transitions without disturbing the rest of the layout.
|--------------------------------------------------------------------------
*/
.image-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/*
|--------------------------------------------------------------------------
| MAIN IMAGE
|--------------------------------------------------------------------------
| Max size is 80% of browser width and 80% of browser height.
|--------------------------------------------------------------------------
*/
.main-view img {
    display: block;
    max-height: 60vh;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.45s ease-in-out;
    border: 2px solid #fff;
}

/*
|--------------------------------------------------------------------------
| When changing slides, we briefly add a class to fade image out, swap
| the source, then fade back in.
|--------------------------------------------------------------------------
*/
.main-view img.fade-out {
    opacity: 0;
}

/*
|--------------------------------------------------------------------------
| OVERLAY TITLE
|--------------------------------------------------------------------------
*/
.overlay-top {
    position: absolute;
    top: 5px;
    left: 20px;
    right: 20px;
    z-index: 20;
    pointer-events: none;
    text-align: center;
}

.slide-title {
    display: inline-block;
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.55);
    padding: 8px 12px;
    border-radius: 6px;
    max-width: calc(100% - 40px);
    box-sizing: border-box;
    text-align: center;
}

/*
|--------------------------------------------------------------------------
| OVERLAY CAPTION / COUNTER
|--------------------------------------------------------------------------
*/
.overlay-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
    z-index: 20;

    display: flex;
    flex-direction: column;
    align-items: center;   /* centers horizontally */
    justify-content: center;

    gap: 10px;
    pointer-events: none;
    text-align: center;
}

.caption-box {
    background: rgba(0, 0, 0, 0.55);
    padding: 10px 14px;
    border-radius: 6px;

    max-width: 80vw;        /* allow wider centering */
    width: fit-content;     /* shrink to text */

    font-size: 16px;
    line-height: 1.4;

    text-align: center;
    margin: 0 auto;         /* force true centering */
}

.counter {
    background: rgba(0, 0, 0, 0.55);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
}

/*
|--------------------------------------------------------------------------
| CONTROLS
|--------------------------------------------------------------------------
*/
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background: #1b1b1b;
    border-top: 1px solid #2a2a2a;
}

.controls button {
    padding: 10px 16px;
    font-size: 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.controls button:hover {
    opacity: 0.9;
}

/*
|--------------------------------------------------------------------------
| THUMBNAILS
|--------------------------------------------------------------------------
*/
.thumbnails {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    background: #222;
    align-items: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    border-top: 1px solid #333;
}

.thumbnails img {
    height: 70px;
    width: auto;
    cursor: pointer;
    opacity: 0.65;
    border: 2px solid transparent;
    border-radius: 4px;
    flex: 0 0 auto;
    box-sizing: border-box;
    transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.thumbnails img:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

.thumbnails img.active {
    opacity: 1;
    border-color: #fff;
}

.thumbnails::-webkit-scrollbar {
    height: 10px;
}

.thumbnails::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 5px;
}

/*
|--------------------------------------------------------------------------
| OPTIONAL SWIPE HINT
|--------------------------------------------------------------------------
| Small, subtle text to show on touch devices.
|--------------------------------------------------------------------------
*/
.swipe-hint {
    position: absolute;
    right: 20px;
    top: 18px;
    z-index: 25;
    font-size: 12px;
    background: rgba(0,0,0,0.45);
    padding: 6px 8px;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0.85;
}

/*
|--------------------------------------------------------------------------
| EMPTY MESSAGE
|--------------------------------------------------------------------------
*/
.empty-message {
    padding: 40px;
    text-align: center;
    font-size: 22px;
}

/*
|--------------------------------------------------------------------------
| RESPONSIVE ADJUSTMENTS
|--------------------------------------------------------------------------
*/
@media (max-width: 700px) {
    .slide-title {
        font-size: 20px;
    }

    .caption-box {
        font-size: 14px;
        max-width: 100%;
    }

    .overlay-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .thumbnails img {
        height: 55px;
    }

    .main-view img {
        max-width: 92vw;
        max-height: 72vh;
    }

    .swipe-hint {
        font-size: 11px;
        top: 14px;
        right: 14px;
    }
}
