/*
 * Photo Gallery styles: the main Gallery page (page-gallery.php) and a
 * gallery category (taxonomy-td_gallery_cat.php). Theme 1.33: moved out of
 * the two templates, where they were printed inside each page, so the
 * browser downloads them once and caches them.
 */

/* ════ Main Gallery page ════ */
/* ── Gallery Main Page Styles ── */

/* Prevent right-click save on all gallery images */
.td-gallery-no-save { -webkit-user-select: none; user-select: none; pointer-events: none; }
.td-gallery-hero-img,
.td-cat-cover-img,
.td-grid-photo { -webkit-user-drag: none; }

/* Hero */
.td-gallery-hero {
    position: relative;
    width: 100%;
    max-height: 364px;
    overflow: hidden;
    background: #1a1a1a;
}
.td-gallery-hero img {
    width: 100%;
    height: 364px;
    object-fit: cover;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}
.td-gallery-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%);
    display: flex;
    align-items: flex-end;
    padding: 32px 40px;
}
.td-gallery-hero-title {
    color: #fff;
    font-size: 2.4em;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    letter-spacing: 0.01em;
}

/* Category Slider */
.td-cat-slider-section {
    background: #f4f4f4;
    border-top: 3px solid #c0392b;
    padding: 28px 0 32px;
}
.td-cat-slider-heading {
    text-align: center;
    font-size: 1.1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #004c97;
    margin: 0 0 20px;
}
.td-slider-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 48px;
}
.td-slider-track-outer {
    overflow: hidden;
}
.td-slider-track {
    display: flex;
    gap: 20px;
    transition: transform 0.4s cubic-bezier(.4,0,.2,1);
    will-change: transform;
}
/* Each category card */
.td-cat-card {
    flex: 0 0 calc(25% - 15px);
    min-width: 180px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}
@media (max-width: 900px) {
    .td-cat-card { flex: 0 0 calc(50% - 10px); }
}
@media (max-width: 560px) {
    .td-cat-card { flex: 0 0 calc(100% - 0px); }
}
.td-cat-card-inner {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.13);
    background: #fff;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.td-cat-card:hover .td-cat-card-inner {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.td-cat-cover-wrap {
    position: relative;
    width: 100%;
    padding-top: 66%;   /* 3:2 aspect ratio */
    background: #ddd;
    overflow: hidden;
}
.td-cat-cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
    transition: transform 0.35s ease;
}
.td-cat-card:hover .td-cat-cover-img {
    transform: scale(1.04);
}
.td-cat-cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #004c97;
    color: #fff;
    font-size: 2.5em;
}
.td-cat-card-label {
    padding: 10px 14px 12px;
    font-size: 0.92em;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    text-align: center;
    border-top: 3px solid #c0392b;
}
.td-cat-count {
    display: block;
    font-size: 0.8em;
    font-weight: 400;
    color: #666;
    margin-top: 2px;
}

/* Slider nav arrows */
.td-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.td-slider-btn:hover { background: #a93226; }
.td-slider-btn.td-prev { left: 4px; }
.td-slider-btn.td-next { right: 4px; }
.td-slider-btn:disabled { background: #ccc; cursor: default; }

/* Slider dots */
.td-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.td-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}
.td-dot.active { background: #c0392b; }

/* No categories message */
.td-no-cats {
    text-align: center;
    color: #666;
    padding: 40px 0;
    font-size: 1em;
}

/* ════ Gallery category page ════ */
/* ── Gallery Category Page Styles ── */

.td-cat-page-header {
    background: #004c97;
    color: #fff;
    padding: 24px 0 20px;
}
.td-cat-page-header .container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.td-back-link {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.td-back-link:hover { opacity: 1; text-decoration: underline; color: #fff; }
.td-cat-page-title {
    margin: 0;
    font-size: 1.7em;
    font-weight: 700;
    color: #fff;
    flex: 1;
}
.td-photo-count-badge {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 0.82em;
    padding: 3px 12px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

/* Grid */
.td-photo-grid-wrap {
    padding: 36px 0 48px;
}
.td-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
@media (max-width: 1000px) {
    .td-photo-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
    .td-photo-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .td-photo-grid { grid-template-columns: 1fr; }
}

.td-grid-item {
    cursor: pointer;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.td-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.td-grid-thumb-wrap {
    position: relative;
    width: 100%;
    padding-top: 66.6%; /* 3:2 */
    overflow: hidden;
    background: #2a2a2a;
}
.td-grid-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
    transition: transform 0.35s ease;
}
.td-grid-item:hover .td-grid-photo {
    transform: scale(1.04);
}
.td-grid-caption {
    padding: 8px 10px 9px;
    font-size: 0.82em;
    color: #444;
    line-height: 1.4;
    border-top: 2px solid #c0392b;
    background: #fff;
}
.td-no-photos {
    text-align: center;
    color: #888;
    padding: 60px 0;
    font-size: 1em;
}

/* ── Lightbox ── */
#td-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.92);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
#td-lightbox.open { display: flex; }
#td-lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#td-lightbox-img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    border-radius: 3px;
    pointer-events: none;
    -webkit-user-drag: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
#td-lightbox-caption {
    color: #ddd;
    font-size: 0.92em;
    text-align: center;
    margin-top: 12px;
    max-width: 700px;
    line-height: 1.5;
    min-height: 20px;
    padding: 0 16px;
}
#td-lightbox-counter {
    color: #999;
    font-size: 0.8em;
    margin-top: 6px;
}
/* Nav arrows */
.td-lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    font-size: 2em;
    width: 52px;
    height: 72px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 100000;
}
.td-lb-nav:hover { background: rgba(192,57,43,0.7); }
#td-lb-prev { left: 12px; }
#td-lb-next { right: 12px; }
/* Close */
#td-lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
    z-index: 100001;
    line-height: 1;
    opacity: 0.75;
    transition: opacity 0.2s;
}
#td-lb-close:hover { opacity: 1; }
