/* ============================================================
   media.php — Photo Gallery

   Follows the live globexinfotech.com/gallery.aspx shape: a dark hero, a
   filter strip, then one titled section per collection with captioned cards,
   and a call band at the foot.

   Colours come from css/tokens.css where a token exists, so the page follows the
   site if the palette changes.
   ============================================================ */

.gal-wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.gal-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Hero ─────────────────────────────────────────────────── */
.gal-hero {
    position: relative;
    padding: 68px 0 56px;
    /* Gradient overlay + background image */
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.88) 0%, rgba(30, 42, 90, 0.88) 55%, rgba(49, 46, 129, 0.88) 100%),
        url('https://images.unsplash.com/photo-1523050854058-8df90110c7f1?w=1600&q=80') center/cover no-repeat;
    color: #fff;
    text-align: center;
    overflow: hidden;
}

/* A soft glow so the flat gradient does not read as a solid block. */
.gal-hero::after {
    content: '';
    position: absolute;
    inset: auto -10% -60% -10%;
    height: 220px;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.35), transparent 70%);
    pointer-events: none;
}

.gal-hero > * { position: relative; z-index: 1; }

.gal-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.gal-hero h1 {
    margin: 18px 0 12px;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.gal-hero__lead {
    max-width: 620px;
    margin: 0 auto;
    font-size: 15.5px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.8);
}

.gal-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

.gal-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
}

.gal-stat i { color: #a5b4fc; }
.gal-stat strong { font-size: 16px; font-weight: 800; color: #fff; }

/* ── Toolbar ──────────────────────────────────────────────── */
.gal-toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e9edf4;
}

.gal-toolbar__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    flex-wrap: wrap;
}

.gal-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;
    min-width: 220px;
    padding: 0 14px;
    background: #fff;
    border: 1.5px solid #e9edf4;
    border-radius: 999px;
}

.gal-search:focus-within { border-color: #818cf8; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.12); }
.gal-search i { color: #94a3b8; font-size: 13px; }

.gal-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 0;
    font: inherit;
    font-size: 14px;
    color: #0f172a;
}

/* Chrome draws its own clear cross on search inputs; there is one below. */
.gal-search input::-webkit-search-cancel-button { display: none; }

.gal-search__clear {
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
    visibility: hidden;
}

.gal-search__clear:hover { color: #475569; }

/* One row that scrolls sideways rather than wrapping into a tall block. */
.gal-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -ms-overflow-style: none;
}

@supports (scrollbar-width: none) {
    .gal-chips { scrollbar-width: none; }
}
.gal-chips::-webkit-scrollbar { display: none; }

.gal-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 15px;
    border: 1.5px solid #e9edf4;
    border-radius: 999px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.gal-chip:hover { background: #f6f8fc; }

.gal-chip__n {
    padding: 1px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.gal-chip.is-active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-color: transparent;
    color: #fff;
}

.gal-chip.is-active .gal-chip__n { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* ── Sections ─────────────────────────────────────────────── */
.gal-body { padding: 34px 0 10px; background: var(--gx-bg, #f7f9fc); }

.gal-count {
    margin: 0 0 20px;
    font-size: 13.5px;
    color: #64748b;
}

.gal-section { margin-bottom: 44px; }
.gal-section[hidden] { display: none; }

.gal-section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e6eaf3;
}

.gal-section__head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 5px;
    font-size: clamp(1.15rem, 2.4vw, 1.45rem);
    font-weight: 800;
    color: #0f172a;
}

.gal-section__head h2 i { color: #6366f1; font-size: 0.95em; }

.gal-section__head p {
    margin: 0;
    font-size: 13.5px;
    color: #64748b;
    line-height: 1.6;
}

.gal-section__n {
    flex: 0 0 auto;
    min-width: 34px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

/* auto-fill, not auto-fit: with auto-fit a section holding one photo would
   stretch that card across the whole row, so a small collection looked like a
   different page from a large one. */
.gal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    gap: 20px;
}

/* ── Card ─────────────────────────────────────────────────── */
.gal-card {
    margin: 0;
    background: #fff;
    border: 1px solid #e9edf4;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.12);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.gal-card[hidden] { display: none; }

.gal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 34px -18px rgba(15, 23, 42, 0.28);
}

/* A ratio rather than a fixed height, so a photo keeps its shape whatever the
   column count works out to. */
.gal-card__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border: none;
    padding: 0;
    background: linear-gradient(135deg, #eef2f8, #e2e8f0);
    overflow: hidden;
    cursor: zoom-in;
}

.gal-card__media img,
.gal-card__media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s ease;
}

.gal-card:hover .gal-card__media img { transform: scale(1.06); }

.gal-card__zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.38);
    color: #fff;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.gal-card:hover .gal-card__zoom,
.gal-card__media:focus-visible .gal-card__zoom { opacity: 1; }

.gal-card--video .gal-card__media { cursor: default; }

.gal-card__doc {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #b91c1c;
    text-decoration: none;
    cursor: pointer;
}

.gal-card__doc i { font-size: 34px; }
.gal-card__doc span { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; }

.gal-card__cap {
    padding: 13px 15px 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gal-card__cap strong {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}

.gal-card__cap span {
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.55;
    /* Two lines, then ellipsis — captions vary a lot and would otherwise make
       the rows ragged. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Empty states ─────────────────────────────────────────── */
.gal-empty {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border: 1px dashed #d8dfea;
    border-radius: 18px;
    margin-bottom: 40px;
}

.gal-empty[hidden] { display: none; }
.gal-empty i { font-size: 34px; color: #c7d2fe; }
.gal-empty h2 { margin: 14px 0 8px; font-size: 1.15rem; font-weight: 800; color: #0f172a; }
.gal-empty p { margin: 0; font-size: 14px; color: #64748b; line-height: 1.65; }
.gal-empty a { color: #4f46e5; font-weight: 600; }

/* ── Call band ────────────────────────────────────────────── */
.gal-cta {
    padding: 44px 0;
    background: linear-gradient(135deg, #1e2a5a, #4f46e5);
    color: #fff;
}

.gal-cta__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    flex-wrap: wrap;
}

.gal-cta h2 { margin: 0 0 6px; font-size: clamp(1.2rem, 2.6vw, 1.6rem); font-weight: 800; }
.gal-cta p { margin: 0; font-size: 14px; color: rgba(255, 255, 255, 0.82); line-height: 1.6; }

.gal-cta__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.gal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.gal-btn--solid { background: #ffc107; color: #1e2a5a; }
.gal-btn--solid:hover { background: #ffcd39; }
.gal-btn--ghost { background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.28); }
.gal-btn--ghost:hover { background: rgba(255, 255, 255, 0.2); }

.gal-cta__meta {
    flex: 1 1 100%;
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
}

.gal-cta__meta span { display: inline-flex; align-items: center; gap: 7px; }

/* ── Lightbox ─────────────────────────────────────────────── */
.gal-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: rgba(8, 12, 24, 0.93);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.gal-lightbox[hidden] { display: none; }

.gal-lb__stage {
    margin: 0;
    max-width: 1000px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.gal-lb__stage img {
    max-width: 100%;
    /* Room is left for the caption below, so a tall photo does not push it off. */
    max-height: calc(100vh - 190px);
    object-fit: contain;
    border-radius: 12px;
    background: #0f172a;
}

.gal-lb__stage figcaption { color: #e2e8f0; display: flex; flex-direction: column; gap: 4px; }
.gal-lb__stage strong { font-size: 15px; font-weight: 700; }
.gal-lb__stage span { font-size: 13px; color: #94a3b8; line-height: 1.6; }
.gal-lb__stage em { font-style: normal; font-size: 12px; color: #64748b; letter-spacing: 0.06em; }

.gal-lb__close,
.gal-lb__nav {
    position: absolute;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.18s ease;
}

.gal-lb__close:hover,
.gal-lb__nav:hover { background: rgba(255, 255, 255, 0.22); }

.gal-lb__close {
    top: 18px; right: 20px;
    width: 42px; height: 42px;
    font-size: 26px;
    line-height: 1;
}

.gal-lb__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 46px; height: 46px;
    font-size: 18px;
}

.gal-lb__prev { left: 18px; }
.gal-lb__next { right: 18px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .gal-hero { padding: 48px 0 40px; }
    .gal-toolbar__row { padding: 10px 16px; }
    .gal-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
    .gal-section__head { flex-direction: column; align-items: flex-start; }
    .gal-cta__row { flex-direction: column; align-items: flex-start; }
    .gal-lb__nav { width: 38px; height: 38px; }
    .gal-lb__prev { left: 8px; }
    .gal-lb__next { right: 8px; }
    .gal-lb__stage img { max-height: calc(100vh - 230px); }
}

@media (max-width: 460px) {
    .gal-grid { grid-template-columns: 1fr; }
}