/* ==========================================================================
   Gallery page (view_gallery.php)
   All selectors are prefixed with "gp-" so they cannot clash with global
   styles or other pages.
   ========================================================================== */

.gp-page {
    --gp-ink: #1f2430;
    --gp-muted: #6b7280;
    --gp-line: #e8e9ee;
    --gp-bg: #f7f7f9;
    --gp-accent: #FFC53A;
    --gp-accent-dark: #e0a200;
    --gp-radius: 14px;

    background: var(--gp-bg);
    padding: 56px 0 72px;
    color: var(--gp-ink);
}

.gp-page *,
.gp-page *::before,
.gp-page *::after {
    box-sizing: border-box;
}

.gp-container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Heading ---------- */
.gp-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gp-line);
}

.gp-head__title {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--gp-ink);
}

.gp-head__count {
    font-size: 14px;
    color: var(--gp-muted);
    white-space: nowrap;
}

/* ---------- Grid ---------- */
.gp-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

/* ---------- Card ---------- */
.gp-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--gp-line);
    border-radius: var(--gp-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.gp-card:hover,
.gp-card:focus-visible {
    transform: translateY(-4px);
    border-color: transparent;
    box-shadow: 0 14px 32px rgba(31, 36, 48, 0.12);
    text-decoration: none;
    color: inherit;
}

.gp-card:focus-visible {
    outline: 2px solid var(--gp-accent-dark);
    outline-offset: 2px;
}

.gp-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eceef2;
}

.gp-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gp-card:hover .gp-card__img,
.gp-card:focus-visible .gp-card__img {
    transform: scale(1.06);
}

.gp-card__badge {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gp-accent);
    color: var(--gp-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gp-card:hover .gp-card__badge,
.gp-card:focus-visible .gp-card__badge {
    opacity: 1;
    transform: translateY(0);
}

.gp-card__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px 18px;
}

.gp-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gp-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gp-card__link {
    font-size: 13px;
    color: var(--gp-muted);
    transition: color 0.3s ease;
}

.gp-card:hover .gp-card__link {
    color: var(--gp-accent-dark);
}

/* ---------- Gallery details ---------- */
.gp-head--det {
    align-items: flex-end;
}

.gp-head__main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.gp-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gp-muted);
    text-decoration: none;
    transition: color 0.3s ease, gap 0.3s ease;
}

.gp-back:hover,
.gp-back:focus-visible {
    color: var(--gp-accent-dark);
    gap: 12px;
    text-decoration: none;
}

.gp-back--solid {
    margin-top: 22px;
    padding: 11px 26px;
    color: var(--gp-ink);
    background: var(--gp-accent);
    border-radius: 999px;
    font-weight: 600;
}

.gp-back--solid:hover,
.gp-back--solid:focus-visible {
    color: var(--gp-ink);
    background: var(--gp-accent-dark);
}

.gp-photo {
    margin: 0;
}

.gp-photo__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.gp-photo__caption {
    padding: 12px 16px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gp-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gp-photo .gp-card__media {
    aspect-ratio: 1 / 1;
}

/* ---------- Load more ---------- */
.gp-card--hidden {
    display: none;
}

.gp-card--reveal {
    animation: gp-fade-up 0.5s ease both;
}

@keyframes gp-fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gp-more {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.gp-more[hidden] {
    display: none;
}

.gp-more__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 34px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gp-ink);
    background: #fff;
    border: 1px solid var(--gp-ink);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.gp-more__btn:hover,
.gp-more__btn:focus-visible {
    background: var(--gp-accent);
    border-color: var(--gp-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(31, 36, 48, 0.12);
}

.gp-more__btn:focus-visible {
    outline: 2px solid var(--gp-accent-dark);
    outline-offset: 3px;
}

.gp-more__btn:active {
    transform: translateY(0);
}

/* ---------- Empty state ---------- */
.gp-empty {
    text-align: center;
    padding: 72px 20px;
    background: #fff;
    border: 1px dashed var(--gp-line);
    border-radius: var(--gp-radius);
}

.gp-empty__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--gp-bg);
    color: var(--gp-muted);
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gp-empty__title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 600;
}

.gp-empty__text {
    margin: 0;
    color: var(--gp-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
    .gp-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width: 767px) {
    .gp-page {
        padding: 36px 0 52px;
    }

    .gp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .gp-head__title {
        font-size: 22px;
    }

    .gp-card__body {
        padding: 12px 14px 14px;
    }

    .gp-card__title {
        font-size: 14px;
    }

    /* No hover on touch devices: keep the arrow visible */
    .gp-card__badge {
        opacity: 1;
        transform: none;
        width: 32px;
        height: 32px;
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 420px) {
    .gp-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .gp-more {
        margin-top: 28px;
    }

    .gp-more__btn {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gp-card--reveal {
        animation: none;
    }

    .gp-card,
    .gp-card__img,
    .gp-card__badge {
        transition: none;
    }
}
