/* ==========================================================================
   TenderMitra — Gallery
   Loads on top of modern.css. Only gallery-specific components live here.
   Scoped to .tm-gallery or prefixed .gl-*.

   The library is 42 images (7 certificates, 35 photos) in mixed orientations
   — 21 portrait, 19 landscape, 2 square. Certificates are documents and must
   never be cropped; photos are candid and crop safely.
   ========================================================================== */

/* ==========================================================================
   HERO
   ========================================================================== */

/* Shell and atmosphere come from modern.css; only the padding is local */
.gl-hero {
    padding-top: clamp(3rem, 2rem + 4vw, 5rem);
    padding-bottom: clamp(2.5rem, 2rem + 3vw, 4rem);
}

.gl-hero > .hm-wrap { position: relative; z-index: 1; }

.gl-crumbs {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .45rem;
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    font-size: .8125rem;
    /* Sits on the coloured field, so one step darker than body muted */
    color: var(--s-ink-2);
}

.gl-crumbs a { color: var(--s-ink-2); text-decoration: none; transition: color .2s var(--tm-ease); }
.gl-crumbs a:hover { color: var(--s-ink); }
.gl-crumbs li + li::before { content: "/"; margin-right: .45rem; color: var(--s-line-2); }
.gl-crumbs [aria-current="page"] { color: var(--s-ink); }

/* Anchor chips — plain links, so no items are ever hidden from the lightbox */
.gl-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 2rem; }

.gl-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1.1rem;
    font-size: .8438rem;
    font-weight: 500;
    color: var(--s-ink-2);
    background: rgb(255 255 255 / .78);
    border: 1px solid rgb(255 255 255 / .9);
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 2px 10px rgb(11 18 32 / .05);
    transition: background-color .2s var(--tm-ease), transform .2s var(--tm-ease), color .2s var(--tm-ease);
}

.gl-chip:hover { background: #fff; color: var(--s-ink); transform: translateY(-2px); }
.gl-chip i { color: var(--s-orange); }
.gl-chip b { font-weight: 600; color: var(--s-ink); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   SECTION HEAD
   ========================================================================== */

.gl-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.gl-head .hm-sub { margin-top: .6rem; max-width: 46ch; }

/* Offsets the sticky header when jumping to an anchor */
.gl-anchor { scroll-margin-top: calc(var(--tm-header-h) + 2rem); }

/* ==========================================================================
   CERTIFICATES — documents, contained on a tinted plate, never cropped
   ========================================================================== */

.gl-certs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.15rem;
}

@media (max-width: 991.98px) { .gl-certs { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767.98px) { .gl-certs { grid-template-columns: repeat(2, 1fr); } }

.gl-cert {
    display: block;
    padding: .75rem;
    background: #fff;
    border: 1px solid var(--s-line);
    border-radius: 18px;
    text-decoration: none;
    transition: transform .3s var(--tm-ease), box-shadow .3s var(--tm-ease), border-color .3s var(--tm-ease);
}

.gl-cert:hover {
    transform: translateY(-5px);
    border-color: transparent;
    box-shadow: 0 2px 4px rgb(11 18 32 / .04),
                0 12px 24px -10px rgb(11 18 32 / .12),
                0 28px 56px -24px rgb(11 18 32 / .24);
}

.gl-cert-plate {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    padding: .85rem;
    border-radius: 13px;
    background: var(--_t, var(--t-cream));
    overflow: hidden;
}

.gl-cert:nth-child(4n+1) .gl-cert-plate { --_t: var(--t-cream); }
.gl-cert:nth-child(4n+2) .gl-cert-plate { --_t: var(--t-lilac); }
.gl-cert:nth-child(4n+3) .gl-cert-plate { --_t: var(--t-mint); }
.gl-cert:nth-child(4n+4) .gl-cert-plate { --_t: var(--t-blush); }

.gl-cert-plate img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    transition: transform .45s var(--tm-ease-out);
}

.gl-cert:hover .gl-cert-plate img { transform: scale(1.04); }

.gl-cert-cap {
    display: block;
    padding: .8rem .4rem .25rem;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--s-ink-2);
    text-align: center;
}

/* ==========================================================================
   PHOTOS — fixed-height rows with cover, so there is no layout shift
   ========================================================================== */

.gl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    grid-auto-rows: 195px;
    grid-auto-flow: dense;
    gap: .9rem;
}

.gl-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 16px;
    background: var(--s-off);
    text-decoration: none;
    transition: transform .35s var(--tm-ease), box-shadow .35s var(--tm-ease);
}

/* Magazine rhythm — a large feature tile and a tall tile per run of nine */
.gl-item:nth-child(9n+1) { grid-column: span 2; grid-row: span 2; }
.gl-item:nth-child(9n+5) { grid-row: span 2; }

@media (max-width: 575.98px) {
    .gl-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; gap: .6rem; }
    .gl-item:nth-child(9n+1) { grid-column: span 2; grid-row: span 2; }
    .gl-item:nth-child(9n+5) { grid-row: span 1; }
}

.gl-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .55s var(--tm-ease-out);
}

.gl-item:hover { box-shadow: 0 18px 40px -18px rgb(11 18 32 / .35); }
.gl-item:hover img { transform: scale(1.06); }

/* Hover veil + zoom affordance */
.gl-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgb(11 18 32 / .5));
    opacity: 0;
    transition: opacity .35s var(--tm-ease);
    pointer-events: none;
}

.gl-item:hover::after,
.gl-item:focus-visible::after { opacity: 1; }

.gl-zoom {
    position: absolute;
    right: .7rem;
    bottom: .7rem;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--s-ink);
    background: rgb(255 255 255 / .92);
    font-size: .85rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .3s var(--tm-ease), transform .3s var(--tm-ease);
    pointer-events: none;
}

.gl-item:hover .gl-zoom,
.gl-item:focus-visible .gl-zoom { opacity: 1; transform: translateY(0); }

.gl-cap {
    position: absolute;
    left: .9rem;
    right: 3rem;
    bottom: .85rem;
    z-index: 2;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.35;
    color: #fff;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .3s var(--tm-ease), transform .3s var(--tm-ease);
    pointer-events: none;
}

.gl-item:hover .gl-cap,
.gl-item:focus-visible .gl-cap { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.gl-empty {
    max-width: 34rem;
    margin-inline: auto;
    padding: 2.5rem 2rem;
    text-align: center;
    border-radius: 20px;
    background: var(--t-cream);
}

.gl-empty i { font-size: 1.75rem; color: var(--s-orange); }
.gl-empty p { margin: .85rem 0 0; font-size: .9063rem; color: var(--s-ink-2); line-height: 1.6; }

/* ==========================================================================
   CTA
   ========================================================================== */

.gl-cta { padding-block: clamp(4rem, 3rem + 5vw, 7rem); }

.gl-cta > .hm-wrap { position: relative; z-index: 1; }

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .gl-item img,
    .gl-cert-plate img { transition: none !important; }

    .gl-item:hover img,
    .gl-cert:hover .gl-cert-plate img { transform: none !important; }
}
