/* =========================================================
   Project Grid Plugin – Stylesheet
   Matches City & Regional aesthetic: clean, professional,
   gold accent, responsive grid, smooth popup gallery.
   ========================================================= */

/* ---------- CSS custom properties ---------- */
:root {
    --pg-gold:        #c9a84c;
    --pg-dark:        #1a1a1a;
    --pg-mid:         #444;
    --pg-light:       #f5f5f5;
    --pg-white:       #ffffff;
    --pg-radius:      4px;
    --pg-transition:  0.3s ease;
    --pg-shadow:      0 8px 32px rgba(0,0,0,0.22);
    --pg-font-body:   inherit;
    --pg-font-ui:     inherit;
}

/* ---------- Grid ---------- */
.pg-grid {
    display: grid;
    grid-template-columns: repeat(var(--pg-columns, 3), 1fr);
    gap: 6px;
    width: 100%;
}

@media (max-width: 900px) {
    .pg-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    .pg-grid { grid-template-columns: 1fr; }
}

/* ---------- Grid item ---------- */
.pg-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: var(--pg-dark);
    outline: none;
}

.pg-item:focus-visible {
    outline: 3px solid var(--pg-gold);
    outline-offset: -3px;
}

.pg-item-thumb {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.pg-item:hover .pg-item-thumb,
.pg-item:focus-visible .pg-item-thumb {
    transform: scale(1.06);
}

/* Overlay */
.pg-item-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--pg-transition);
}

.pg-item:hover .pg-item-overlay,
.pg-item:focus-visible .pg-item-overlay {
    opacity: 1;
}

.pg-item-title {
    font-family: var(--pg-font-ui);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pg-white);
    line-height: 1.3;
}

/* ---------- Modal / Popup ---------- */
.pg-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pg-modal[hidden] {
    display: none !important;
}

/* Backdrop */
.pg-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

/* Box */
.pg-modal-box {
    position: relative;
    z-index: 1;
    background: var(--pg-white);
    border-radius: var(--pg-radius);
    box-shadow: var(--pg-shadow);
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    animation: pg-slide-in 0.28s ease;
}

@keyframes pg-slide-in {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Close button */
.pg-modal-close {
    position: sticky;
    top: 0;
    float: right;
    margin: 12px 12px 0 0;
    z-index: 10;
    background: var(--pg-dark);
    color: var(--pg-white);
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--pg-transition);
}

.pg-modal-close:hover {
    background: var(--pg-gold);
}

/* Inner padding */
.pg-modal-inner {
    padding: 0 28px 28px;
    clear: both;
}

/* Title */
.pg-modal-title {
    font-family: var(--pg-font-ui);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--pg-dark);
    margin: 0 0 18px;
    padding-top: 4px;
}

/* ---------- Gallery ---------- */
.pg-gallery {
    margin-bottom: 22px;
}

.pg-gallery-stage {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-gallery-viewport {
    flex: 1;
    overflow: hidden;
    border-radius: var(--pg-radius);
    background: var(--pg-dark);
}

.pg-gallery-track {
    display: flex;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.pg-gallery-track img {
    flex: 0 0 100%;
    width: 100%;
    height: 420px;
    object-fit: contain;
    background: var(--pg-dark);
    display: block;
}

@media (max-width: 600px) {
    .pg-gallery-track img { height: 220px; }
}

/* Prev / Next buttons */
.pg-gallery-prev,
.pg-gallery-next {
    flex: 0 0 auto;
    background: var(--pg-dark);
    color: var(--pg-white);
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--pg-transition);
    user-select: none;
}

.pg-gallery-prev:hover,
.pg-gallery-next:hover {
    background: var(--pg-gold);
}

.pg-gallery-prev:disabled,
.pg-gallery-next:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Dots */
.pg-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-top: 12px;
}

.pg-gallery-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background var(--pg-transition);
}

.pg-gallery-dot.is-active,
.pg-gallery-dot:hover {
    background: var(--pg-gold);
}

/* Hide nav when only one image */
.pg-gallery[data-count="1"] .pg-gallery-prev,
.pg-gallery[data-count="1"] .pg-gallery-next,
.pg-gallery[data-count="1"] .pg-gallery-dots {
    display: none;
}

/* ---------- Description ---------- */
.pg-modal-description {
    font-family: var(--pg-font-body);
    font-size: 0.97rem;
    line-height: 1.75;
    color: var(--pg-mid);
}

.pg-modal-description p {
    margin: 0 0 1em;
}

.pg-modal-description p:last-child {
    margin-bottom: 0;
}

/* ---------- No projects message ---------- */
.pg-no-projects {
    font-family: var(--pg-font-ui);
    color: var(--pg-mid);
}
