/* ===================================================================
   Bird Photography — main.css
   Ported from the original PHP site's main.css, preserving the same
   look and feel: dark theme, Raleway, blue/red accents.
   =================================================================== */

/* Google Font — same as original */
@import url('https://fonts.googleapis.com/css?family=Raleway:500,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Indie+Flower&display=swap');
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400&display=swap');

* {
    font-family: 'Raleway', serif;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: #242424;
    color: #eee;
}

/* ------- Layout: same left/right absolute positioning ------- */

.mobile-reveal-btn {
    display: none;
}

.row, .col {
    overflow: hidden;
    position: absolute;
}

.row {
    left: 0;
    right: 0;
}

.col {
    top: 0;
    bottom: 0;
}

/* Left sidebar — 350px */
.left.col {
    width: 350px;
    left: 0;
    top: 0;
    margin: 0;
    padding: 0;
    color: #eee;
    font-size: 13px;
    line-height: 20px;
    background: #242424;
    z-index: 10;
    overflow: visible;
    transition: transform 0.3s ease;
}

/* Right gallery area — same background */
.right.col {
    left: 350px;
    position: absolute;
    right: 0;
    background: #242424;
    display: block;
    margin: 0;
    overflow-y: auto;
    padding: 20px;
    transition: left 0.3s ease;
}

.header-banner {
    width: 100%;
    height: auto;
    border: none;
    max-height: 200px;
    object-fit: contain;
}

.mobile-banner {
    display: none;
}

.desktop-banner {
    display: block;
}

/* ------- Sidebar sections ------- */

.sidebar-section {
    position: relative;
    margin: 0 10px;
    padding: 0 0 5px 0;
}

/* Section headings */
h1 {
    font-size: 15px;
    font-style: italic;
    margin: 8px 0 4px 0;
    color: #09C;
}

/* ------- Pill buttons (group-by / sort-by) ------- */

.pill-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.pill-list li {
    display: inline-block;
}

/* Unselected pills — red */
.pill-list a:link,
.pill-list a:visited {
    display: block;
    padding: 2px 8px;
    background: #C30;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    transition: background 0.2s;
    font-size: 13px;
}

.pill-list a:hover {
    background: #de4816;
}

/* Selected pill — blue */
.pill-list b {
    display: block;
    padding: 2px 8px;
    background: #09C;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    color: #fff;
    font-size: 13px;
}

/* ------- Search input ------- */

.search-section {
    position: relative;
    margin: 0 10px;
    padding: 5px 0;
    z-index: 500;
}

.search-section input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #1a1a1a;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.search-section input:focus {
    border-color: #09C;
}

/* Autocomplete dropdown */
.autocomplete-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #222;
    border: 1px solid #555;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
}

.autocomplete-list div {
    padding: 6px 10px;
    cursor: pointer;
    color: #fff;
    font-size: 13px;
}

.autocomplete-list div:hover,
.autocomplete-list div.active {
    background: #09C;
}

/* ------- Group list (scrollable black box) ------- */

#listofoptions {
    background: #000;
    border-radius: 5px;
    margin: 5px 10px 10px 10px;
    padding: 8px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

#listofoptions::-webkit-scrollbar {
    width: 6px;
}

#listofoptions::-webkit-scrollbar-track {
    background: #111;
}

#listofoptions::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

#listofoptions::-webkit-scrollbar-thumb:hover {
    background: #09C;
}

#listofoptions ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

#listofoptions li {
    display: block;
}

#listofoptions a {
    display: block;
    text-align: right;
    padding: 4px 6px;
    text-decoration: none;
    text-transform: capitalize;
    color: #fff;
    transition: background 0.2s;
    font-size: 13px;
}

#listofoptions a:hover {
    background-color: #09C;
}

#listofoptions a.active-group {
    background-color: #09C;
    font-weight: bold;
}

/* ------- Toggle button ------- */

.togglebutton {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    color: #FFF;
    background: #0070C0;
    border-radius: 4px;
    left: 350px;
    top: 4px;
    z-index: 1001;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    transition: left 0.3s ease;
    user-select: none;
}

/* ------- Gallery ------- */

.lazy-img {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #333; /* Placeholder color before load */
}

.lazy-img.loaded {
    opacity: 1;
}

#Gallery {
    column-count: 1;
    column-gap: 16px;
}

#Gallery img {
    width: 100%;
    height: auto;
    display: block;
    border: none;
    border-radius: 4px;
    transition: transform 0.3s ease, opacity 0.8s ease;
}

#Gallery a {
    display: block;
    margin-bottom: 16px;
    background: #1a1a1a;
    border: 3px solid #333; /* Slightly thinner and darker border */
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    break-inside: avoid;
    transition: border-color 0.2s;
    /* Ensure the anchor doesn't have extra padding that confuses PhotoSwipe */
    padding: 0;
}

#Gallery a:hover {
    border-color: #09C;
}

#Gallery a:hover img {
    transform: scale(1.02);
}

.no-images {
    text-align: center;
    padding: 40px;
    color: #888;
}

.no-images img {
    max-width: 200px;
    margin-bottom: 10px;
}

/* ------- GLightbox overrides (dark theme) ------- */

.gslide-media {
    overflow: visible !important;
}

.gslide-media img {
    max-height: 85vh !important;
}

.gslide-title {
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}

.gslide-desc {
    color: #ccc !important;
    font-size: 14px !important;
}

.gslide-description {
    background: rgba(0, 0, 0, 0.85) !important;
}

.glightbox-clean .gslide-description {
    background: rgba(0, 0, 0, 0.85) !important;
}

.glightbox-clean .gslide-title {
    color: #fff !important;
}

.glightbox-clean .gdesc-inner {
    padding: 12px 16px !important;
}

.pswp-custom-caption-wrapper {
    left: 0 !important;
    right: 0 !important;
}

.pswp-caption-content {
    text-align: center;
    color: #fff;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    pointer-events: none;
    width: auto;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.pswp-caption-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.pswp-caption-location {
    font-size: 14px;
    color: #09C;
    margin-bottom: 2px;
    font-style: italic;
}

.pswp-caption-date {
    font-size: 13px;
    color: #eee;
    margin-bottom: 8px;
    opacity: 0.8;
}

.pswp-caption-link {
    color: inherit;
    text-decoration: none;
    pointer-events: auto;
    transition: all 0.2s ease;
    padding: 4px 8px;
    margin: 0 2px;
    border-radius: 6px;
}

.pswp-caption-link:hover {
    color: #09C !important;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    cursor: pointer;
}

.pswp-caption-desc {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 12px;
}

.pswp-caption-content .flickr-link {
    color: #fff !important;
    text-decoration: none !important;
    font-size: 12px !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 6px 16px;
    border-radius: 20px;
    pointer-events: auto;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
}

.pswp-caption-content .flickr-link:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.pswp-caption-content .flickr-link img {
    opacity: 0.9;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* ------- Custom scrollbar ------- */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* ------- Responsive ------- */

/* ------- Unified Sidebar Toggle Logic ------- */

/* When closed, hide sidebar and shift gallery left */
.sidebar-closed .left.col {
    transform: translateX(-100%) !important;
}

.sidebar-closed .right.col {
    left: 0 !important;
}

.sidebar-closed .togglebutton {
    left: 4px !important;
}

/* Mobile defaults inside media query */
@media (max-width: 768px) {
    body {
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Prevent body scroll, gallery will scroll */
    }

    .left.col {
        position: relative;
        width: 100%;
        height: auto;
        transform: none !important;
        flex-shrink: 0;
        z-index: 1000;
        padding-bottom: 10px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    }

    .header-container {
        background: #242424;
    }

    .desktop-banner {
        display: none !important;
    }

    h1.mobile-banner {
        display: block;
        color: #fff;
        font-family: 'EB Garamond', serif;
        font-size: 28px;
        font-weight: normal;
        font-style: normal;
        margin: 5px 0;
        line-height: 1.2;
        letter-spacing: 0.5px;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
    }
    
    .right.col {
        position: relative;
        left: 0 !important;
        width: 100%;
        flex: 1;
        overflow-y: auto;
    }

    .togglebutton {
        display: none !important;
    }

    /* Auto-hide feature */
    body.mobile-header-hidden .left.col {
        display: none !important;
    }
    
    body.mobile-header-hidden .mobile-reveal-btn {
        display: block;
        position: absolute;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 2000;
        background: #09C;
        color: white;
        border: none;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: bold;
        box-shadow: 0 4px 12px rgba(0,0,0,0.5);
        cursor: pointer;
    }

    /* Horizontal scrolling for pills on mobile */
    .pill-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .pill-list::-webkit-scrollbar {
        height: 4px;
    }
    .pill-list::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 2px;
    }

    /* Make list of options a compact horizontal list too, or limit height */
    #listofoptions {
        max-height: 120px;
        margin-bottom: 0;
    }

    /* Sidebar toggle logic overrides for mobile (disabled essentially) */
    .sidebar-open .left.col,
    .sidebar-closed .left.col {
        transform: none !important;
    }
}

/* ------- Medium screens (1200px+) — 2 columns ------- */

@media (min-width: 1200px) {
    #Gallery {
        column-count: 2;
    }
}

/* ------- Large screens (1600px+) ------- */

@media (min-width: 1600px) {
    .left.col {
        width: 400px;
        font-size: 15px;
        line-height: 24px;
    }

    .right.col {
        left: 400px;
    }

    .togglebutton {
        left: 400px;
    }

    h1 {
        font-size: 17px;
    }

    .pill-list a:link,
    .pill-list a:visited,
    .pill-list b {
        font-size: 15px;
        padding: 3px 10px;
    }

    .search-section input {
        font-size: 15px;
        padding: 8px 10px;
    }

    #listofoptions a {
        font-size: 15px;
        padding: 5px 8px;
    }

    .autocomplete-list div {
        font-size: 15px;
        padding: 6px 10px;
    }

    #Gallery {
        column-count: 2;
    }
}

/* ------- Very large screens / 4K (2400px+) ------- */

@media (min-width: 2400px) {
    .left.col {
        width: 480px;
        font-size: 17px;
        line-height: 28px;
    }

    .right.col {
        left: 480px;
    }

    .togglebutton {
        left: 480px;
        width: 34px;
        height: 34px;
        font-size: 22px;
    }

    h1 {
        font-size: 20px;
    }

    .pill-list a:link,
    .pill-list a:visited,
    .pill-list b {
        font-size: 17px;
        padding: 4px 12px;
    }

    .search-section input {
        font-size: 17px;
        padding: 10px 12px;
    }

    #listofoptions a {
        font-size: 17px;
        padding: 6px 10px;
    }

    .autocomplete-list div {
        font-size: 17px;
        padding: 8px 12px;
    }

    #Gallery {
        column-count: 3;
    }
}
/* ------- Professor Feather (Mascot) ------- */

@keyframes mascot-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes bubble-pop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

#mascot-container {
    position: fixed;
    top: 20px; /* Constrain max height to viewport explicitly and leave space at top */
    bottom: 20px;
    right: 20px;
    z-index: 2000000; /* Extremely high to stay above PhotoSwipe overlay */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Keep everything snug at the bottom */
    align-items: flex-end;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mascot-hidden {
    opacity: 0;
    transform: translateY(100px);
    pointer-events: none !important;
}

#mascot-image {
    width: 120px;
    height: auto;
    pointer-events: auto;
    cursor: pointer;
    animation: mascot-bob 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

#mascot-speech-bubble {
    background: #1a1a1a; /* Solid background for high contrast */
    border: 2px solid #09C; /* Professional blue border */
    border-radius: 16px;
    padding: 15px 20px;
    margin-bottom: 12px;
    max-width: 300px;
    color: #fff;
    font-family: 'Indie Flower', cursive;
    font-size: 18px;
    letter-spacing: 0.5px;
    line-height: 1.4;
    box-shadow: 0 12px 40px rgba(0,0,0,0.8);
    pointer-events: auto;
    animation: bubble-pop 0.4s ease-out;
    position: relative;
    /* Limit height to viewport container boundaries */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Triangle for speech bubble */
#mascot-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 30px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #09C;
}

#mascot-text {
    font-family: 'Indie Flower', cursive !important;
    margin-bottom: 10px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom scrollbar for mascot text */
#mascot-text::-webkit-scrollbar { width: 6px; }
#mascot-text::-webkit-scrollbar-track { background: transparent; }
#mascot-text::-webkit-scrollbar-thumb { background: rgba(0, 153, 204, 0.4); border-radius: 3px; }
#mascot-text::-webkit-scrollbar-thumb:hover { background: rgba(0, 153, 204, 0.8); }

#mascot-controls {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

#mascot-close {
    background: #C30;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

#mascot-close:hover {
    background: #de4816;
}

.pswp-ask-professor {
    background: rgba(0, 153, 204, 0.3) !important;
    border: 1px solid #09C !important;
    margin-top: 8px !important;
    font-weight: bold;
}

.pswp-ask-professor:hover {
    background: rgba(0, 153, 204, 0.5) !important;
}

/* Responsive Mascot Scaling */

/* Small Phones */
@media (max-width: 480px) {
    #mascot-image { width: 70px; }
    #mascot-speech-bubble { max-width: 200px; font-size: 15px; padding: 10px 12px; }
    #mascot-container { right: 5px; bottom: 5px; }
}

/* Tablets / Mobile */
@media (max-width: 768px) {
    #mascot-image { width: 90px; }
    #mascot-speech-bubble { max-width: 260px; font-size: 16px; }
    #mascot-container { right: 10px; bottom: 10px; }
}

/* Large Desktop (1600px+) */
@media (min-width: 1600px) {
    #mascot-image { width: 150px; }
    #mascot-speech-bubble { max-width: 350px; font-size: 22px; padding: 18px 24px; }
    #mascot-container { right: 30px; bottom: 30px; }
}

/* Ultra-wide / 4K (2400px+) */
@media (min-width: 2400px) {
    #mascot-image { width: 220px; }
    #mascot-speech-bubble { max-width: 450px; font-size: 26px; padding: 22px 30px; }
    #mascot-container { right: 40px; bottom: 40px; }
}

/* ------- Landing Page (Scattered Pile) ------- */

.landing-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.landing-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 5;
    opacity: 0;
    transform: translateY(20px);
    animation: bubble-pop 0.6s 0.2s forwards;
}

.photo-pile {
    position: absolute;
    inset: 0;
    pointer-events: none; /* Let clicks pass through to elements behind */
}

.pile-photo {
    position: absolute;
    width: clamp(200px, 22vw, 420px);
    padding: 10px;
    display: inline-block;   /* Shrink-wrap height to the image — fixes oversized bounding boxes */
    height: fit-content;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-radius: 4px;
    transition: transform 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    pointer-events: auto; /* Re-enable clicks on the actual photos */
    text-decoration: none;
}

.pile-photo img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.pile-photo:hover {
    /* Preserve translate(-50%,-50%) centering from JS — only add scale on top */
    transform: translate(-50%, -50%) scale(1.08) rotate(0deg) !important;
    z-index: 100 !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

/* Positions spread evenly across the full gallery area */
.pile-photo:nth-child(1)  { top:  -3%; left:  -2%; transform: rotate(-8deg);  z-index: 1;  }
.pile-photo:nth-child(2)  { top:  -2%; right: -1%; transform: rotate(6deg);   z-index: 2;  }
.pile-photo:nth-child(3)  { bottom: -3%; left:  0%;  transform: rotate(10deg); z-index: 3;  }
.pile-photo:nth-child(4)  { bottom: -2%; right: 1%;  transform: rotate(-6deg); z-index: 4;  }
.pile-photo:nth-child(5)  { top:  25%; left:  3%;  transform: rotate(-12deg); z-index: 5;  }
.pile-photo:nth-child(6)  { bottom: 25%; right: 3%;  transform: rotate(9deg);  z-index: 6;  }
.pile-photo:nth-child(7)  { top:   5%; left:  38%; transform: rotate(4deg);   z-index: 7;  }
.pile-photo:nth-child(8)  { bottom:  5%; left:  38%; transform: rotate(-4deg);  z-index: 8;  }
.pile-photo:nth-child(9)  { top:  35%; right: 4%;  transform: rotate(7deg);   z-index: 9;  }
.pile-photo:nth-child(10) { top:  35%; left:  4%;  transform: rotate(-5deg);  z-index: 10; }

@media (max-width: 768px) {
    .pile-photo { width: clamp(140px, 40vw, 220px); }
}
