/* 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;
}

.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;
}

.achievement-doc {
    flex-direction: column;
    gap: 6px;
}

.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;
}

#achievementOverlay.show {
    display: flex;
}

/* Stop the page behind the overlay from scrolling while it is open */
body.achievement-overlay-open {
    overflow: hidden;
}

#achievementOverlay .image-card {
    position: relative;
    display: inline-block;
    line-height: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
}

#achievementOverlay .image-card img {
    display: block;
    width: auto;
    height: auto;
    max-width: 95vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

#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 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    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;
}

#achievementOverlay .image-desc.has-text {
    display: block;
}

/* Title + description panel drawn over the bottom of the image */
#achievementOverlay .image-footer-desc {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    max-height: 45%;
    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;
}

#achievementOverlay .image-footer-desc .ifd-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .9rem;
    overflow-y: auto;
}

/* 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;
    }
}
