﻿/* ADD THIS TO THE VERY TOP OF gallery0.css */

html {
      overflow-x: hidden !important;
    width: 100%;
}


         body.modal-open {
            overflow: hidden;

         }

         /* --- 3. TYPOGRAPHY & LOGOS --- */


         .photo-item {
            position: relative;
            aspect-ratio: 3 / 2;
            overflow: hidden;
            cursor: pointer;
            background: #333;
         }

         .photo-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            transition:
               transform 0.3s ease,
               opacity 0.3s ease;
         }

         .photo-item:hover img {
            transform: scale(1.1);
            opacity: 0.8;
         }

         .photo-item::after {
            content: "";
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 2;
            background: linear-gradient(
                  to bottom,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 13%
               ),
               linear-gradient(
                  to top,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 13%
               ),
               linear-gradient(
                  to right,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 9%
               ),
               linear-gradient(
                  to left,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 9%
               );
            background-repeat: no-repeat;
            background-size:
               100% 12%,
               100% 12%,
               12% 100%,
               12% 100%;
            background-position: top, bottom, left, right;
         }

         /* Modal Specifics */
         .modal {
            display: none;
            position: fixed;
            inset: 0;
            background: #000;
            z-index: 10000;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            overscroll-behavior: none;
            touch-action: none;
         }

         .modal-header {
            position: absolute;
            top: 0;
            width: 100%;
            display: flex;
            justify-content: space-between;
            padding: 20px;
            box-sizing: border-box;
   background: rgba(0, 0, 0, 0.0); /* 0% transparent black */
border-bottom: none !important;

            z-index: 10020;

            /* --- FIX: Allow clicks to pass through empty areas --- */
            pointer-events: none;
         }

         .modal-controls {
            display: flex;
            align-items: center;
            gap: 20px;
            pointer-events: auto;
            /* --- FIX: Re-enable clicks for the buttons --- */
         }

         .close-modal-text svg {
            display: block; /* Removes the "text-like" behavior of the SVG */
         }

         .close-modal-text:hover {
            opacity: 1;
         }

         .modal-content-wrapper {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
         }

         .modal-photo-container {
            position: relative;
            display: inline-block;
            max-width: 98%;
            max-height: 95vh;
            overflow: visible;
         }

         .modal-photo-container::after {
            content: "";
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 10;
            background: linear-gradient(
                  to bottom,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 13%
               ),
               linear-gradient(
                  to top,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 13%
               ),
               linear-gradient(
                  to right,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 9%
               ),
               linear-gradient(
                  to left,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 9%
               );
            background-size:
               100% 10%,
               100% 10%,
               8% 100%,
               8% 100%;
            background-repeat: no-repeat;
            background-position: top, bottom, left, right;
            /* Reduced percentages */
            transition: opacity 0.3s ease;
         }

         .modal.is-zoomed .modal-photo-container::after {
            opacity: 0;
         }

         /* Added will-change for performance optimization */
         #modalImg {
            display: block;
            max-width: 100%;
            max-height: 95vh;
            object-fit: contain;
            cursor: zoom-in;
            user-select: none;
            transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
            transform-origin: center center;
            will-change: transform;
         }

         #modalImg.dragging {
            transition: none;
            cursor: grabbing;
         }

         .arrow {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            font-size: 3rem;
            cursor: pointer;
            padding: 50px 30px;
            color: rgba(
               255,
               255,
               255,
               0.5
            ); /* CHANGE THIS: Lower the alpha (the 0.3) for more transparency */
            z-index: 10020;
            transition: all 0.3s ease; /* Smooth transition when hovering */
         }

         .arrow:hover {
            color: rgba(255, 255, 255, 0.8);
            background: rgba(255, 255, 255, 0.05);
         }

         .prev {
            left: 0;
         }

         .next {
            right: 0;
         }

         /* --- 6. ANIMATIONS & UTILITIES --- */
         @keyframes fadeIn {
            from {
               opacity: 0;
               transform: translateY(20px);
            }
            to {
               opacity: 1;
               transform: translateY(0);
            }
         }

         .fade-in {
            animation: fadeIn 0.3s ease forwards;
         }

         @keyframes slideInRight {
            from {
               transform: translateX(100%);
            }

            to {
               transform: translateX(0);
            }
         }

         @keyframes slideInLeft {
            from {
               transform: translateX(-100%);
            }

            to {
               transform: translateX(0);
            }
         }

         .slide-in-right {
            animation: slideInRight 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
         }

         .slide-in-left {
            animation: slideInLeft 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
         }

         .spinner {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 50px;
            height: 50px;
            border: 6px solid rgba(255, 255, 255, 0.1);
            border-left-color: #ff0000;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
         }

         @keyframes spin {
            to {
               transform: translate(-50%, -50%) rotate(360deg);
            }
         }

         #imageCounter {
            font-size: 1.1rem;
            /* Adjust this to make it larger or smaller */
            font-family: var(--font-sans);
            font-weight: 700;
            color: rgba(255, 255, 255, 0.9);
            letter-spacing: 0px;

            /* Optional: Modern "Pill" background */
            background: rgba(255, 255, 255, 0.1);
            padding: 0px 15px;
            border-radius: 30px;
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255, 255, 255, 0.1);
         }


         /* --- 7. RESPONSIVE DESIGN --- */

 
         /* Container for photos inside the gallery description text ===========================*/
         .desc-photo-wrap {
            position: relative;
               width: 100% !important;
            /* Fixed width to prevent full-size display */
            margin: 0 0 15px 15px;
            cursor: pointer;
            overflow: hidden;
            line-height: 0;
            z-index: 5;
    flex: 1 1 0;      /* Force equal growth and shrink from a 0 base */
    width: calc(100% / 7); 
    display: block;
    margin: 0;
    padding: 0;
    border: none;

      box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);

         }

         /* Gap options */
         .section-photo {
            margin-top: 31px;
            margin-bottom: -50px;
         }

         /* Float options */
         .desc-photo-wrap.right {
            float: right;
         }

         .desc-photo-wrap.left {
            float: left;
         }

         .desc-photo-wrap img {
            width: 100% !important;
            /* Forces image to fit the 280px container */
            height: auto;
            display: block;
            transition:
               transform 0.4s ease,
               opacity 0.4s ease;
    margin: 0;
    padding: 0;
    border: none;
    vertical-align: bottom; /* Extra insurance for vertical gaps */

         }

         .desc-photo-wrap:hover img {
            transform: scale(1.1);
            opacity: 0.8;
         }

         /* Replicating the White Inner Glow from your gallery-grid */

         .desc-photo-wrap::after {
            content: "";
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 2;
            background: linear-gradient(
                  to bottom,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 13%
               ),
               linear-gradient(
                  to top,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 13%
               ),
               linear-gradient(
                  to right,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 9%
               ),
               linear-gradient(
                  to left,
                  rgba(255, 255, 255, 1) 0px,
                  rgba(255, 255, 255, 0) 9%
               );
            background-repeat: no-repeat;
            background-size:
               100% 12%,
               100% 12%,
               12% 100%,
               12% 100%;
            background-position: top, bottom, left, right;
         }

         /* Responsive adjustment: on mobile, center the description image */

         @media (max-width: 768px) {
            .desc-photo-wrap.right {
               float: none;
               display: block;
               margin: 20px auto;
               width: 100% !important;
            }

.gallery-title {
      max-width: 100%; /* Allows it to go edge-to-edge on phones */
      padding: 20px 10px 10px; /* Reduces left/right gaps to just 10px on mobile */
      margin: 20px auto 10px; /* Optional: slightly reduces top/bottom margins to save screen space */
   }

.gallery-grid {
        width: 100%; /* Expands back to full width on phones */
        max-width: 100%;
    }

         /* Gap options */

         .desc-photo-wrap.left {
            float: left;
            margin-top: -3px;
            margin-bottom: 12px;

         }

         .desc-photo-wrap.right {
            float: right;
            margin-top: -3px;
            margin-bottom: 12px;

         }


 }

         /* Container for photos inside the gallery description text ===========================*/

         /* --- Link on the last photo in popup --- */
         /* Update the main container */
         .modal-page-nav {
            display: none;
            position: absolute;
            bottom: 30px;
            z-index: 10050;

            /* Layout */
            align-items: center;
            gap: 3px; /* Space between arrow and text */

            /* Font settings (Keep text normal size) */
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
            font-size: 1rem; /* Adjust text size here if needed */
            font-family: var(--font-sans);
            font-weight: bold;

            /* Button Shape & Size (Make the button itself bigger) */
            background: linear-gradient(to bottom, #444, #222);
            padding: 0px 8px; /* Increased padding for a larger button */
            border-radius: 10px; /* Pill shape */
            border: 1px solid #555;
            transition: all 0.3s ease;
         }

         .modal-page-nav:hover {
            background: rgba(255, 255, 255, 0.25);
            color: #fff;
            transform: scale(1.05);
            border-color: rgba(255, 255, 255, 0.8);
         }

         /* --- NEW: SVG Arrow Styling --- */
         .nav-arrow-svg {
            width: 18px; /* Make arrow wider */
            height: 18px; /* Make arrow taller */
            fill: currentColor; /* Matches the text color */
            transition: transform 0.3s ease;
         }

         /* Animate arrows on hover */
         #modalPrevPage:hover .nav-arrow-svg {
            transform: translateX(-4px); /* Move arrow left */
         }

         #modalNextPage:hover .nav-arrow-svg {
            transform: translateX(4px); /* Move arrow right */
         }

         .nav-bottom-left {
            left: 20px;
         }

         .nav-bottom-right {
            right: 20px;
         }

         /* Ensure they appear correctly on mobile */
         @media (max-width: 768px) {
            .modal-page-nav {
               bottom: 20px;
               font-size: 0.9rem;
               padding: 8px 15px;
            }
         }

         /* --- 8. NEW CONTROLS (Counter & Slideshow) --- */
         .gallery-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            margin-top: 15px;
            padding: 0 10px;
            box-sizing: border-box;
         }

         /* 1. Photo Counter (Left) */
         .photo-count-box, .slideshow-btn {
            font-family: var(--font-sans);
            font-size: 0.9rem;
            font-weight: bold;
            color: #fff;
            background: linear-gradient(to bottom, #444, #222);
            padding: 8px 10px;
            border-radius: 10px; /* Button-like box shape */
            border: 1px solid rgba(255, 255, 255, 0.15);

            user-select: none;
         }

         /* 2. Slide Show Button (Right) */
         .slideshow-btn {
            cursor: pointer;
            transition: all 0.3s ease;
            text-transform: none;
         }

         .slideshow-btn:hover {
            background: rgba(255, 255, 255, 0.25);
            color: #fff;
            transform: scale(1.05);
            border-color: rgba(255, 255, 255, 0.8);
         }

         /* --- SLIDESHOW MODE STYLES --- */
         /* Hide specific interface elements, but KEEP the modal-header and Close button visible */
         body.slideshow-active .arrow,
         body.slideshow-active .modal-page-nav,
         body.slideshow-active #downloadBtn,
         body.slideshow-active [onclick="toggleFullScreen()"] {
            /* Hide the full-screen toggle icon during slideshow */
            display: none !important;
         }

         /* Ensure the modal background area shows a pointer to indicate it is clickable */
         body.slideshow-active .modal {
            cursor: pointer;
         }

         /* --- UPDATED SLIDESHOW & CURSOR STYLES --- */

         /* Desktop: Magnifying glass on the photo */
         body.slideshow-active #modalImg {
            cursor: zoom-in !important;
         }

         /* If the image is already zoomed in (assuming you add an 'is-zoomed' class on click) */
         body.slideshow-active.is-zoomed #modalImg {
            cursor: zoom-out !important;
         }

         /* Style the Close Button to match the Page Counter button */
         body.slideshow-active .close-modal-text {
            cursor: pointer;
            display: flex !important;
            align-items: center;
            justify-content: center;
            width: 35px;
            height: 35px;
            border: 1px solid rgba(255, 255, 255, 0.4); /* Slightly visible boundary */
            border-radius: 50%; /* Makes it a circle */
            background-color: rgba(0, 0, 0, 0.2); /* Subtle dark fill */
            transition: background-color 0.3s ease;
            padding: 0;
            line-height: 1;
         }

         body.slideshow-active .close-modal-text:hover {
            background-color: rgba(255, 255, 255, 0.2);
         }
