/* ============================================================
   GALLERY / FACTORY / CERTIFICATE — Shared styles
   gallery.css  v1
   ============================================================ */

/* ---- Page body ---- */
.gallery-page {
    padding: 4rem 0 5.5rem;
    background: var(--color-bg-light);
    min-height: 60vh;
}

/* ================================================================
   FACTORY — photo masonry grid
   ================================================================ */
.factory-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* ---- Category sidebar ---- */
.gallery-sidebar {
    position: sticky;
    top: 100px;
    background: #fff;
    border-radius: 10px;
    padding: 1.35rem 1.5rem;
    box-shadow: 0 2px 14px rgba(0,31,71,.06);
    border: 1px solid var(--color-border);
}

.gallery-sidebar-title {
    font-family: var(--font-heading);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--color-primary);
    margin: 0 0 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--color-accent);
    display: inline-block;
}

.gallery-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.gallery-sidebar-list a {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .6rem;
    font-size: .875rem;
    color: var(--color-text-muted);
    font-weight: 500;
    border-radius: 5px;
    text-decoration: none;
    transition: background .18s, color .18s, padding-left .18s;
}

.gallery-sidebar-list a:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
    padding-left: .9rem;
}

.gallery-sidebar-list li.active a {
    background: var(--color-accent-light);
    color: var(--color-primary);
    font-weight: 700;
    padding-left: .9rem;
    border-left: 3px solid var(--color-accent);
}

/* ---- Photo grid (masonry-like) ---- */
.photo-grid {
    columns: 3;
    column-gap: 1.25rem;
}

.photo-item {
    break-inside: avoid;
    margin-bottom: 1.25rem;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,31,71,.08);
    transition: transform .3s ease, box-shadow .3s ease;
}

.photo-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0,31,71,.18);
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .5s ease;
}

.photo-item:hover img {
    transform: scale(1.04);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,31,71,.88) 0%, rgba(0,31,71,.4) 45%, transparent 70%);
    opacity: 0;
    transition: opacity .3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.1rem;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay-title {
    font-family: var(--font-heading);
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-bottom: .25rem;
}

.photo-overlay-desc {
    font-size: .75rem;
    color: rgba(255,255,255,.78);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.photo-zoom-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 36px;
    height: 36px;
    background: rgba(0,31,71,.65);
    backdrop-filter: blur(6px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transform: scale(.85);
    transition: opacity .25s, transform .25s, background .2s;
}

.photo-item:hover .photo-zoom-btn {
    opacity: 1;
    transform: scale(1);
}

.photo-zoom-btn:hover {
    background: var(--color-accent);
    color: var(--color-primary);
}

.photo-zoom-btn svg { width: 16px; height: 16px; }

/* ----------------------------------------------------------------
   LIGHTBOX (shared by factory & certificate)
   ---------------------------------------------------------------- */
.glb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,10,22,.94);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .28s ease;
}

.glb-overlay.open {
    display: flex;
    opacity: 1;
}

.glb-box {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}

.glb-img {
    max-width: 92vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
    transition: transform .2s ease;
    cursor: zoom-in;
    display: block;
}

.glb-img.zoomed { cursor: zoom-out; }

.glb-caption {
    text-align: center;
    color: rgba(255,255,255,.85);
    font-size: .875rem;
    font-weight: 500;
    max-width: 600px;
}

.glb-counter {
    font-size: .72rem;
    color: rgba(255,255,255,.5);
    letter-spacing: .08em;
}

.glb-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: background .2s;
}

.glb-close:hover { background: var(--color-accent); color: var(--color-primary); }

.glb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .2s;
    z-index: 10000;
}

.glb-nav:hover { background: var(--color-accent); color: var(--color-primary); transform: translateY(-50%) scale(1.1); }
.glb-nav svg { width: 20px; height: 20px; }
.glb-nav.prev { left: 1.5rem; }
.glb-nav.next { right: 1.5rem; }

/* ================================================================
   CERTIFICATE — grid layout
   ================================================================ */
.cert-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: start;
}

.cert-main { min-width: 0; }

/* Certificate cards grid */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.cert-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(0,31,71,.07);
    border: 1px solid var(--color-border);
    transition: transform .3s, box-shadow .3s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.cert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 40px rgba(0,31,71,.14);
}

.cert-card-img {
    position: relative;
    background: #f8fafd;
    aspect-ratio: 3/4;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: .75rem;
    display: block;
    transition: transform .4s ease;
}

.cert-card:hover .cert-card-img img { transform: scale(1.05); }

.cert-card-zoom {
    position: absolute;
    inset: 0;
    background: rgba(0,31,71,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
}

.cert-card:hover .cert-card-zoom { opacity: 1; }

.cert-card-zoom svg {
    width: 32px;
    height: 32px;
    color: #fff;
}

.cert-card-body {
    padding: .9rem 1.1rem 1.1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.cert-card-title {
    font-family: var(--font-heading);
    font-size: .875rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cert-card-desc {
    font-size: .75rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================================================================
   DETAIL PAGE — show_factory / show_certificate
   ================================================================ */
.gallery-detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2.5rem;
    align-items: start;
}

.gallery-detail-hero {
    border-radius: 12px;
    overflow: hidden;
    background: #f0f3f8;
    text-align: center;
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(0,31,71,.1);
    margin-bottom: 1.5rem;
}

.gallery-detail-hero img {
    max-width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: contain;
    border-radius: 6px;
    cursor: zoom-in;
}

.gallery-detail-hero-hint {
    margin-top: .6rem;
    font-size: .75rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.gallery-detail-hero-hint svg { width: 14px; height: 14px; }

.gallery-detail-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: .85rem 1.1rem;
    background: var(--color-bg-light);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: .82rem;
    color: var(--color-text-muted);
}

.gallery-detail-meta-item {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.gallery-detail-meta-item svg { width: 15px; height: 15px; color: var(--color-accent); }

.gallery-detail-summary {
    background: var(--color-accent-light);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 8px 8px 0;
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.5rem;
}

.gallery-detail-summary h4 {
    font-family: var(--font-heading);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--color-primary);
    margin: 0 0 .4rem;
}

.gallery-detail-summary p {
    font-size: .9rem;
    color: var(--color-primary);
    line-height: 1.65;
    margin: 0;
    font-weight: 500;
}

.gallery-detail-prose {
    background: #fff;
    border-radius: 10px;
    padding: 2rem 2.25rem;
    box-shadow: 0 2px 12px rgba(0,31,71,.05);
    border: 1px solid var(--color-border);
    font-size: .975rem;
    line-height: 1.8;
    color: var(--color-text-muted);
}

.gallery-detail-prose h2,
.gallery-detail-prose h3 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: .6rem;
}

.gallery-detail-prose p { margin-bottom: .9rem; }
.gallery-detail-prose img { max-width: 100%; border-radius: 6px; margin: .75rem 0; }

/* Prev/Next */
.gallery-prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.75rem;
}

.gallery-prev-next-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1.1rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    text-decoration: none;
    transition: border-color .2s, box-shadow .2s;
}

.gallery-prev-next-link:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 14px rgba(0,31,71,.1);
}

.gallery-prev-next-link.next { justify-content: flex-end; text-align: right; }

.gallery-pn-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: background .2s, color .2s;
}

.gallery-prev-next-link:hover .gallery-pn-icon {
    background: var(--color-accent);
}

.gallery-pn-icon svg { width: 15px; height: 15px; }

.gallery-pn-dir { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--color-text-muted); margin-bottom: .15rem; }
.gallery-pn-title { font-size: .82rem; font-weight: 600; color: var(--color-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Detail Sidebar */
.gallery-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 100px;
}

.gd-sidebar-box {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 2px 12px rgba(0,31,71,.06);
    border: 1px solid var(--color-border);
}

.gd-sidebar-title {
    font-family: var(--font-heading);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--color-primary);
    margin: 0 0 .9rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--color-accent);
    display: inline-block;
}

/* Thumbnail list in sidebar */
.gd-thumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.gd-thumb-item a {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    text-decoration: none;
    transition: opacity .2s;
}

.gd-thumb-item a:hover { opacity: .8; }

.gd-thumb-img {
    flex-shrink: 0;
    width: 60px;
    height: 46px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--color-bg-light);
}

.gd-thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gd-thumb-text { flex: 1; }

.gd-thumb-title {
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CTA box in sidebar */
.gd-cta-box {
    background: var(--color-primary);
    border: none;
    text-align: center;
}

.gd-cta-icon {
    width: 50px;
    height: 50px;
    background: rgba(174,218,31,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .85rem;
    color: var(--color-accent);
}

.gd-cta-icon svg { width: 22px; height: 22px; }
.gd-cta-box h4 { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: #fff; margin: 0 0 .35rem; }
.gd-cta-box p { font-size: .78rem; color: rgba(255,255,255,.65); margin: 0 0 .9rem; }
.gd-cta-box .btn { width: 100%; justify-content: center; font-size: .8rem; padding: .55rem 1rem; }

/* CTA strip at bottom of list pages */
.gallery-cta-strip {
    background: var(--color-primary);
    padding: 3.5rem 0;
    text-align: center;
    margin-top: 2rem;
}

.gallery-cta-strip h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 700;
    color: #fff;
    margin-bottom: .75rem;
}

.gallery-cta-strip p {
    font-size: .95rem;
    color: rgba(255,255,255,.75);
    margin-bottom: 1.75rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-cta-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .factory-layout,
    .cert-layout {
        grid-template-columns: 190px 1fr;
        gap: 2rem;
    }

    .photo-grid { columns: 2; }
    .cert-grid  { grid-template-columns: repeat(2, 1fr); }

    .gallery-detail-layout { grid-template-columns: 1fr 240px; gap: 2rem; }
}

@media (max-width: 768px) {
    .factory-layout,
    .cert-layout,
    .gallery-detail-layout {
        grid-template-columns: 1fr;
    }

    .gallery-sidebar,
    .gallery-detail-sidebar {
        position: static;
    }

    .photo-grid { columns: 2; }
    .cert-grid  { grid-template-columns: repeat(2, 1fr); }

    .gallery-prev-next { grid-template-columns: 1fr; }

    .gallery-page { padding: 3rem 0 4rem; }
}

@media (max-width: 480px) {
    .photo-grid { columns: 1; }
    .cert-grid  { grid-template-columns: 1fr; }
    .gallery-detail-prose { padding: 1.25rem; }

    .glb-nav { display: none; }
}
