/*
Theme Name: Фотогалерея
Theme URI:
Description: Минималистичная тема-фотогалерея для фотографа/путешественника.
Version: 1.0
Author: Arthur
Text Domain: photogallery
*/

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #0a0a0a;
    color: #ccc;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* === Layout === */
.site-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.site-header {
    padding: 18px 30px;
    text-align: center;
    flex-shrink: 0;
}

.site-header h1 {
    font-size: 22px;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fff;
}

/* Main gallery area */
.gallery-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    padding: 0 20px;
    gap: 20px;
}

/* === Left Column: Countries === */
.col-countries {
    width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.countries-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding-right: 6px;
}

.countries-list li {
    margin-bottom: 2px;
}

.countries-list a {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: #888;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    cursor: pointer;
}

.countries-list a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.countries-list a.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-left: 2px solid #fff;
    padding-left: 10px;
}

/* Sort control */
.sort-control {
    padding: 10px 0;
    flex-shrink: 0;
    border-top: 1px solid #222;
    margin-top: 10px;
}

.sort-control select {
    width: 100%;
    padding: 6px 8px;
    background: #0f0f0f;
    color: #aaa;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.sort-control select:focus {
    border-color: #555;
}

/* === Center Column: Main Photo === */
.col-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 10px 0;
}

.main-photo-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    position: relative;
}

.main-photo-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}

.main-photo-wrap img.fade-out {
    opacity: 0;
}

.main-photo-caption {
    flex-shrink: 0;
    padding: 12px 0 4px;
    font-size: 13px;
    color: #999;
    text-align: center;
    letter-spacing: 0.5px;
    min-height: 34px;
}

.empty-state {
    color: #555;
    font-size: 14px;
    text-align: center;
}

/* === Right Column: Thumbnails === */
.col-thumbs {
    width: 200px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 0 4px;
}

.thumbs-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thumb-item {
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s, opacity 0.2s;
    opacity: 0.6;
}

.thumb-item:hover {
    opacity: 0.9;
}

.thumb-item.active {
    border-color: rgba(255,255,255,0.8);
    opacity: 1;
    box-shadow: 0 0 8px rgba(255,255,255,0.15);
}

.thumb-item img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
}

/* === Footer === */
.site-footer {
    flex-shrink: 0;
    padding: 16px 30px;
    border-top: 1px solid #1a1a1a;
    text-align: center;
    font-size: 13px;
    color: #555;
}

.site-footer a {
    color: #888;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #fff;
}

/* === Scrollbar styling === */
.countries-list::-webkit-scrollbar,
.col-thumbs::-webkit-scrollbar {
    width: 4px;
}

.countries-list::-webkit-scrollbar-track,
.col-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.countries-list::-webkit-scrollbar-thumb,
.col-thumbs::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .col-countries {
        width: 150px;
    }
    .col-thumbs {
        width: 160px;
    }
}

@media (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    .site-wrapper {
        height: auto;
        min-height: 100vh;
    }

    .gallery-layout {
        flex-direction: column;
        padding: 0 12px;
        gap: 12px;
    }

    .col-countries {
        width: 100%;
        max-height: none;
        overflow: visible;
    }

    .countries-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        overflow: visible;
        padding-right: 0;
    }

    .countries-list li {
        margin-bottom: 0;
    }

    .countries-list a {
        padding: 6px 10px;
        font-size: 13px;
    }

    .sort-control {
        border-top: none;
        margin-top: 4px;
        padding: 4px 0;
    }

    .sort-control select {
        width: auto;
    }

    .col-main {
        min-height: 50vh;
    }

    .col-thumbs {
        width: 100%;
        max-height: none;
        overflow: visible;
    }

    .thumbs-grid {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .thumb-item {
        width: calc(33.33% - 4px);
    }

    .thumb-item img {
        height: 80px;
    }
}
