/* pointer-events / fill / text-rendering / mask-* declarations of this file live in the sibling .css3-ext.css (tools/css3-split, GIGW_COMPLIANCE.md section 7). New ones added here are moved there by re-running the script. */
/* Home-page Achievements gallery tab — chips + responsive card grid. */

.achievement-chips .achievement-chip {
    border: 1px solid var(--nav-bg, #095a6f);
    background: transparent;
    color: var(--nav-bg, #095a6f);
    font-weight: 600;
    transition: background-color .2s ease, color .2s ease;
}

.achievement-chips .achievement-chip:hover {
    background: rgba(9, 90, 111, .1);
}

.achievement-chips .achievement-chip.active {
    background: var(--nav-bg, #095a6f);
    color: #fff;
}

/* Horizontal scroll strip — same behaviour as #photoGallery .photo-scroll-container */
#achievementResults.achievement-scroll-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
    justify-content: flex-start;
}

/* Centre the strip when everything fits without scrolling (few / filtered cards) */
#achievementResults.achievement-scroll-container.is-centered {
    justify-content: center;
}

#achievementResults.achievement-scroll-container::-webkit-scrollbar {
    height: 8px;
}

#achievementResults.achievement-scroll-container::-webkit-scrollbar-thumb {
    background: #158081;
    border-radius: 10px;
}

#achievementResults.achievement-scroll-container::-webkit-scrollbar-track {
    background: #e0e0e0;
}

.achievement-item {
    flex: 0 0 auto;
    width: 250px;
}

.achievement-empty {
    flex: 1 1 100%;
}

/* Card + image metrics deliberately mirror #photoGallery .gallery-photo /
   .gallery-img (250px tall, cropped with object-fit:cover, 12px radius) so both
   galleries render every aspect ratio the same way. */
.achievement-card {
    overflow: hidden;
    border: 0;
    box-shadow: 0 0 6px rgba(0, 0, 0, .12);
    border-radius: 12px;
}

.achievement-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
    background: rgba(0, 0, 0, .03);
    text-decoration: none;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

/* Image tile is a <button> so it opens the overlay instead of a new tab */
.achievement-media-btn {
    width: 100%;
    padding: 0;
    border: 0;
    cursor: pointer;
}

.achievement-media-btn:focus-visible {
    outline: 3px solid var(--nav-bg, #095a6f);
    outline-offset: -3px;
}

/* --- Album cards ------------------------------------------------------------
   An achievement can hold many images. The card shows the first one (the cover)
   and this badge says how many more there are; the count is also in the button's
   accessible name via a .visually-hidden span, so the badge is aria-hidden. */
.achievement-media-btn {
    position: relative;
}

.achievement-count {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    /* Solid dark pill over an arbitrary photo — keeps the 4.5:1 ratio whatever
       the image behind it, which a themed colour could not guarantee. */
    background: rgba(0, 0, 0, .72);
}

.achievement-card:hover .achievement-img {
    transform: scale(1.05);
}

.achievement-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    transition: transform .3s ease;
}

/* Marks a card whose album also holds video. Bottom-left so it never collides with
   .achievement-count, which sits top-right. Same solid dark pill for the same
   reason: it has to stay legible over an arbitrary photograph. */
.achievement-play {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: .8rem;
    color: #fff;
    background: rgba(0, 0, 0, .72);
}

.achievement-doc {
    flex-direction: column;
    gap: 6px;
}

/* Card front for an album that holds ONLY videos. Laid out like a PICTURE card, not
   like the PDF/PPT tile: the frame the browser paints is the thumbnail, so it has to
   fill the card the same way .achievement-img does or the strip stops lining up. */
.achievement-video-tile {
    position: relative;
    display: block;
    padding: 0;
    overflow: hidden;
}

.achievement-video-thumb {
    display: block;
    width: 100%;
    height: 250px;              /* same as .achievement-img, so rows stay level */
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    background: #000;           /* letterbox, and what shows if no frame is painted */
    transition: transform .3s ease;     /* matches the hover zoom on .achievement-img */
    /* Clicks must reach the button that wraps this, not the video element. Belt and
       braces with tabindex="-1" in the markup: the video is decoration here, and the
       button is the real control. */
}

/* Play mark centred over the frame. Bigger than .achievement-play (the small corner
   badge on a photo card that merely signals "there is also video here") because on a
   video-only card this is the main affordance. */
.achievement-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.5rem;
    /* Indented a touch: a right-pointing triangle reads as sitting left when its
       bounding box is centred — same optical correction as the hero motion toggle. */
    padding-left: 5px;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    border: 2px solid rgba(255, 255, 255, .85);
}

.achievement-card:hover .achievement-video-thumb {
    transform: scale(1.05);
}

.achievement-file-icon {
    font-size: 3.2rem;
}

.achievement-doc-label {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: #6c757d;
}

/* ---------------------------------------------------------------------------
   Achievements enlarge overlay — mirrors the Photo Gallery overlay (#imageOverlay)
   --------------------------------------------------------------------------- */
#achievementOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* Safety net, added after the department found the title and close button unreachable
       with no way to scroll to them. The script sizes the card to fit, so this should
       never engage — but "should" is not good enough for a control that dismisses a modal.
       If anything ever makes the card taller than the window (a long transcript, a large
       text-zoom setting, a very short landscape phone), the overlay scrolls instead of
       hiding its own close button.

       `align-items: center` would refuse to let a too-tall flex item overflow upwards past
       the container's top edge, which is the other half of why the video ran up behind the
       menu bar; `safe center` keeps the centring but yields to the start edge when there is
       not enough room. Padding gives the card clearance from the window edges. */
    overflow: auto;
    align-items: safe center;
    padding: 12px 0;
}

#achievementOverlay.show {
    display: flex;
}

/* Stop the page behind the overlay from scrolling while it is open */
body.achievement-overlay-open {
    overflow: hidden;
}

/* An album mixes wide banners, portraits, circular avatars and seals. The Photo
   Gallery's rule (max-width/max-height only) reopened the popup at a different
   size for every picture — a 276px seal gave a tiny card. Every image is drawn
   at the SAME HEIGHT instead and its width follows its own aspect ratio, so the
   popup reads as one size, the card still hugs the image (no letterbox bands)
   and nothing is ever cropped. max-width keeps a very wide banner on screen. */
/* A column: category band, then the picture, then the title/description panel. The two
   text bands used to be absolutely positioned ON TOP of the picture, which hid about 10%
   of it at the top and another 9% at the bottom — the department read that as the image
   opening cropped. Stacking them means the whole picture is always visible. */
#achievementOverlay .image-card {
    position: relative;
    display: flex;
    flex-direction: column;
    line-height: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;            /* keeps the stacked bands inside the rounded corners */
    box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
    /* The card had no width cap: the script sizes the PICTURE, but the footer is free to
       make the card as wide as its content wants. A description with no spaces in it (the
       department's test text was one long run of "w") therefore stretched the popup across
       the whole screen. The cap is what the picture is already allowed (92vw) and the
       600px-tall media's widest sensible companion.

       min-width keeps a portrait photo or a narrow clip from collapsing the footer into a
       sliver — without it the card would be only as wide as the media. */
    max-width: min(92vw, 820px);
    min-width: min(92vw, 320px);
    /* ...and never taller than the screen. The script sizes the MEDIA against the space
       the bands leave, but nothing stopped the card itself from exceeding the viewport
       once the title, description, transcript and attachments were added up — the footer
       then sat below the fold and the popup had to be scrolled to be read.
       With this cap the card always fits; the footer below takes whatever is left and
       scrolls inside it. */
    max-height: 92vh;
}

/* The exact width/height are set per image by achievements-gallery.js, which is
   the only way to scale a SMALL image up to the common height while keeping its
   ratio and leaving no letterbox band. These are the bounds it works to, and the
   fallback if the script has not run yet. */
#achievementOverlay .image-card img {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 600px;
    /* The card is now capped at 92vh. Without this the media would be squeezed by the flex
       layout to make room for the footer — and since the script sets width and height
       together to hold the ratio, shrinking only the height would distort the picture.
       The media keeps the size it was given; the footer takes what is left and scrolls. */
    flex-shrink: 0;
    /* The card is a flex column now; without this the picture would be stretched to the
       card's width before the script has set its exact size. */
    align-self: center;
}

/* The video slide of an album. Sized by achievements-gallery.js through the SAME
   sizeMedia() routine as the pictures, from the clip's real videoWidth/videoHeight.

   It used to be pinned here to `aspect-ratio: 16/9` at `width: min(92vw, 1066px)`, which
   caused three of the four faults the department reported in one go:
     - a clip that is not 16:9 was STRETCHED into it (their "video cha UI thoda stretch ahe")
     - 600px of video plus the category band plus the title/transcript panel made the card
       taller than the window, so the top of it ran up behind the sticky menu bar
       ("menu bar madhe thoda video cha part jatoy")
     - and with the card overflowing, expanding the transcript pushed the title and the
       close button off screen ("title ani cut button pn hide hotay")
   The pictures never did any of that, because they go through the measurement.

   No width, no aspect-ratio here on purpose: both would fight the inline size the script
   sets. These are only the ceilings that apply before it has measured, plus the letterbox
   colour for a clip whose shape does not match the card. */
#achievementOverlay .image-card video,
/* The YouTube embed. Same bounds as the uploaded video and sized by the same
   sizeMedia() routine (at a fixed 16:9 — an iframe is cross-origin, so the clip's real
   shape is never knowable). border:0 because a bare <iframe> draws one by default. */
#achievementOverlay .image-card iframe {
    display: block;
    max-width: 92vw;
    max-height: 600px;
    background: #000;
    border: 0;
    align-self: center;
    flex-shrink: 0;         /* same reason as the <img> above */
}

/* The GIGW/STQC transcript block under a video slide. line-height is restored because
   .image-card sets line-height: 0 to kill the inline-image gap, which would otherwise
   collapse this text. */
#achievementOverlayTextAlt {
    line-height: 1.5;
    text-align: left;
}

#achievementOverlay .nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .6);
    color: #fff;
    border: none;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .3s ease;
    z-index: 10;
}

#achievementOverlay .nav:hover {
    background: rgba(0, 0, 0, .8);
}

/* Hidden (not just faded) when the overlay holds a single image */
#achievementOverlay.single-image .nav {
    display: none;
}

#achievementOverlay .nav.prev {
    left: 10px;
}

#achievementOverlay .nav.next {
    right: 10px;
}

#achievementOverlay .close-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .8);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: transform .3s ease, background .3s ease;
}

#achievementOverlay .close-btn:hover {
    background: rgba(0, 0, 0, 1);
    transform: scale(1.1);
}

/* Category band across the top of the image.
   A solid background-color (not just a gradient) is required: a gradient-only
   background computes to transparent, so contrast checkers compare the white
   text against the white card behind it and report a 1:1 failure. The gradient
   is layered on top for depth and only ever darkens the band further.
   --nav-bg is the same surface the header uses for white text, so the pair
   stays AA-compliant in every theme. */
#achievementOverlay .image-desc {
    /* static, not absolute: the band sits ABOVE the picture instead of over it */
    position: static;
    display: none;
    background-color: var(--nav-bg, #095a6f);
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, .45), rgba(0, 0, 0, .15));
    color: #fff;
    padding: 16px 20px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 8px 8px 0 0;
    z-index: 2;
    /* The card's width must come from the MEDIA alone, so the picture or video always
       runs edge to edge. width: 0 takes this band out of the card's width calculation and
       min-width: 100% then stretches it to whatever the media made the card — without
       the pair, a long category name or description widened the card past the media and
       left a white strip down each side of it. border-box so the padding stays inside
       that 100%. */
    width: 0;
    min-width: 100%;
    box-sizing: border-box;
}

#achievementOverlay .image-desc.has-text {
    display: block;
}

/* Position within the album ("Image 3 of 7"). Sits under the close button, top
   right, and is only written by the JS when the overlay holds 2+ images. */
#achievementOverlay .image-position {
    position: absolute;
    /* Top-LEFT: the close button holds the right corner, and with the category band now
       stacked above the picture this pill sits inside that band rather than on the image. */
    top: 6px;
    left: 10px;
    display: none;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: .85rem;
    /* .image-card sets line-height:0 to kill the inline-image gap; without a reset
       here the pill collapses to its padding and the Devanagari text spills out of
       its own background, unreadable over the image. */
    line-height: 1.4;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, .72);
    z-index: 6;
}

#achievementOverlay .image-position.has-text {
    display: block;
}

/* Title + description panel, stacked BELOW the picture (it used to be drawn over the
   bottom of it, hiding about 9% of every image). */
#achievementOverlay .image-footer-desc {
    position: static;
    display: none;
    flex-direction: column;
    max-height: none;
    /* Takes whatever height is left under the media and scrolls inside it, so the card
       as a whole stays within the 92vh cap above.
       min-height: 0 is the part that is easy to miss — a flex item will not shrink below
       its content without it, and the panel would push the card past the cap anyway. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* Same pair as .image-desc above: the panel follows the media's width instead of
       setting the card's, so there is no white strip beside the picture or video. */
    width: 0;
    min-width: 100%;
    padding: 14px 18px;
    background: #fff;
    color: #1a1a1a;
    text-align: left;
    line-height: 1.5;
    border-radius: 0 0 8px 8px;
    box-sizing: border-box;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .18);
    z-index: 6;
}

#achievementOverlay .image-footer-desc.has-text {
    display: flex;
}

#achievementOverlay .image-footer-desc .image-title {
    display: none;
    color: #0b6b3a;
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 700;
}

#achievementOverlay .image-footer-desc .image-title.has-text {
    display: block;
}

/* Description: at most 3 lines, the rest behind Read more — the same treatment as the
   Photo Gallery popup (#imageOverlay in home-index.css), which is what the department
   asked this to match. */
#achievementOverlay .image-footer-desc .ifd-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .9rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    /* The footer is a flex column with min-height: 0, so every child may be shrunk when
       space is tight. This box also has overflow: hidden for the clamp — shrink it and the
       text is simply not drawn, which is how the title stayed visible while the
       description disappeared entirely. It keeps its three lines; the footer scrolls
       instead. (The .expanded rule below deliberately re-enables growth.) */
    flex-shrink: 0;
}

/* Same reason: a one-line title squeezed to zero height would vanish silently. */
#achievementOverlay .image-footer-desc .image-title,
#achievementOverlay .image-footer-desc .ifd-toggle {
    flex-shrink: 0;
}

/* Expanded: grow over the picture and scroll the full text, rather than pushing the
   attachments below it off the bottom of the screen. */
#achievementOverlay .image-footer-desc.expanded {
    max-height: 90%;
    background: #fff;
    z-index: 11;                /* above the prev/next arrows while reading */
}

#achievementOverlay .image-footer-desc.expanded .ifd-text {
    display: block;
    -webkit-line-clamp: unset;
    /* Full height, never shrunk: the footer is the one scroll container. With
       flex: 1 1 auto and min-height: 0 this box was the only shrinkable child, so when
       the transcript and attachments already filled the footer, Read more squeezed the
       description to nothing instead of opening it. */
    flex: 0 0 auto;
    overflow: visible;
}

/* Read more / Read less, aligned right — same as the Photo Gallery's .ifd-toggle. */
#achievementOverlay .image-footer-desc .ifd-toggle {
    align-self: flex-end;
    margin-top: 6px;
    padding: 0;
    background: none;
    border: none;
    color: #0b6b3a;
    font-weight: 700;
    font-size: .85rem;
    line-height: 1.2;
    text-decoration: underline;
    cursor: pointer;
}

#achievementOverlay .image-footer-desc .ifd-toggle:focus-visible {
    outline: 3px solid var(--nav-bg, #095a6f);
    outline-offset: 2px;
}

/* The description is already printed above this block, so the partial's own "Description"
   paragraph repeated it word for word — the department read that as two descriptions.
   The transcript sentence is what this disclosure is for and is kept; the duplicate is
   hidden rather than removed from the partial, which is shared with Awareness and FAQ
   where the description is NOT otherwise on screen. */
#achievementOverlayTextAlt .video-a11y-desc {
    display: none;
}

/* ---- Attachments inside the popup -----------------------------------------
   The department could not find the attached PDF when it was a single small link,
   so the achievement's documents are listed here instead, in the popup itself. */
.achievement-overlay-docs {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid #e9ecef;
}

.achievement-overlay-docs-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: .4rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #51606f;
}

/* A list rather than a grid: the popup is a narrow column, and cards side by side
   would each be too tight for a Marathi file name. Scrolls once there are several,
   so the attachments can never push the close button off the card. */
.achievement-overlay-docs-list {
    display: flex;
    flex-direction: column;
    /* flex-start, not stretch: with width:fit-content on the items this is what actually
       lets them shrink to their content instead of filling the column. */
    align-items: flex-start;
    gap: 4px;
    max-height: 7rem;
    overflow-y: auto;
}

.achievement-overlay-doc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid #e2e8ec;
    border-radius: 8px;
    background: #fbfdfd;
    text-decoration: none;
    color: #1f2d3d;
    /* Hugs its content instead of stretching across the popup. Full width left a wide
       gap between the file name and the download button, which made one attachment look
       like an empty bar. max-width keeps a long CMS file name inside the card. */
    width: fit-content;
    max-width: 100%;
}

.achievement-overlay-doc-item:hover,
.achievement-overlay-doc-item:focus-visible {
    border-color: var(--nav-bg, #095a6f);
    text-decoration: none;
    color: #1f2d3d;
    outline: none;
}

.achievement-overlay-doc-item:focus-visible {
    outline: 3px solid var(--nav-bg, #095a6f);
    outline-offset: 2px;
}

.achievement-overlay-doc-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 13px;
    color: #b1004c;
    background: #fde7e9;
}

.achievement-overlay-doc-meta {
    flex: 1 1 auto;
    min-width: 0;            /* lets a long name wrap instead of pushing the arrow out */
}

.achievement-overlay-doc-name {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.25;
    /* Two lines then an ellipsis, as the News attachment card does — a CMS file name can
       be very long and would otherwise set the height of every card in the list. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* "PDF · 152 KB · Download File" */
.achievement-overlay-doc-sub {
    display: block;
    margin-top: 1px;
    font-size: .68rem;
    color: #677482;
}

.achievement-overlay-doc-dot {
    margin: 0 4px;
}

.achievement-overlay-doc-arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    color: var(--nav-bg, #095a6f);
    background: #e6f4f7;
}

/* Attached PDF/PPT link — only shown when the achievement has a document */
#achievementOverlay .achievement-overlay-doc {
    display: none;
    margin-top: .5rem;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

#achievementOverlay .achievement-overlay-doc.has-text {
    display: inline-block;
}

/* Same breakpoints and heights as #photoGallery .gallery-img */
@media (max-width: 768px) {
    .achievement-media,
    .achievement-img {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .achievement-media,
    .achievement-img {
        height: 180px;
    }

    .achievement-file-icon {
        font-size: 2.6rem;
    }
}
