/* AZ Lepidoptera — main stylesheet */

:root {
    --line-color: #404040;
    --dull-color: #999999;
    --bright-color: #BBBBBB;
    --pink-color: #FF8080;
    --very-bright-color: #F0F0F0;
    --light-bgr: #303030;
    --dark-bgr: #202020;
    --tile-bgr: #000000;
    --normal-bgr: #101010;
    --standard-para-width: 1200px;
}

/* ============================================================ */
/* Scrollbars                                                    */
/* ============================================================ */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-color) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--line-color);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--dull-color);
}

/* ============================================================ */
/* Global layout                                                 */
/* ============================================================ */

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--light-bgr);
    color: var(--dull-color);
    padding-top: 50px;
    padding-bottom: 30px;
    box-sizing: border-box;
}

#content {
    padding: 10px;
    height: calc( 100svh - 100px );
    border: 1px solid var(--line-color);
    background-color: var(--dark-bgr);
    box-sizing: border-box;
    overflow: scroll;
    clear: both;
}

#footer {
    text-align: center;
    padding-top: 0px;
    padding-bottom: 5px;
    width: 100%;
    height: 30px;
    position: fixed;
    bottom: 0;
    box-sizing: border-box;
}

#masthead {
    width: 100%;
    padding: 10px;
    height: 50px;
    top: 0;
    position: fixed;
    box-sizing: border-box;
    z-index: 2000;
}

/* ============================================================ */
/* Generic elements                                              */
/* ============================================================ */

.figure {
    display: inline-block;
    text-align: center;
    vertical-align: top;
}

.webpara {
    max-width: var(--standard-para-width);
    text-align: justify;
}

span.zoom { }

span.zoom:hover img {
    transform: scale(1.05);
    filter: contrast(120%) brightness(110%);
}

hr {
    border: 1px solid var(--line-color);
}

a {
    color: var(--bright-color);
    text-decoration: none;
}

a:visited {
    color: var(--bright-color);
    text-decoration: none;
}

a:active {
    color: var(--dull-color);
    text-decoration: none;
}

a:hover {
    color: var(--very-bright-color);
    text-decoration: none;
}

/* ============================================================ */
/* Navigation buttons in masthead                                */
/* ============================================================ */

.linkbox {
    box-sizing: border-box;
    display: inline-block;
    border: 1px solid var(--line-color);
    padding: 10px;
    border-radius: 10px;
    color: var(--dull-color);
    background-color: #282828;
    margin-right: 5px;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.linkbox:hover {
    background-color: var(--dull-color);
    color: var(--very-bright-color);
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ============================================================ */
/* Side panel                                                    */
/* ============================================================ */

#sidebar_panel {
    position: fixed;
    display: block;
    top: 40px;
    left: 10px;
    box-sizing: border-box;
    height: calc( 100svh - 120px );
    width: 350px;
    overflow-y: auto;
    overflow-x: auto;
    padding: 10px;
    transition: width .5s;
}

#main_content {
    padding-left: 370px;
    transition: padding-left .5s;
}

#sidebar_panel a.toc-active {
    color: var(--very-bright-color);
    font-weight: bold;
}

#close_btn {
    position: absolute;
    top: 65px;
    left: 330px;
    font-size: 36px;
    margin-left: 0px;
}

#open_btn {
    position: absolute;
    top: 65px;
    left: 20px;
    font-size: 25px;
    display: none;
}

/* ============================================================ */
/* Collection-specific                                           */
/* ============================================================ */

.specimen {
    display: inline-block;
    border: 1px solid var(--line-color);
    padding: 10px;
    border-radius: 10px;
    background-color: var(--tile-bgr);
    font-size: 0.9em;
    vertical-align: top;
    width: 340px;
    margin: 0 4px 8px 4px;
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.specimen:hover {
    border-color: var(--dull-color);
    box-shadow: 0 0 6px rgba(100,100,100,0.3);
}

.specimen:target {
    animation: highlight-fade 6s ease-out forwards;
}

@keyframes highlight-fade {
    0%   { border-color: var(--bright-color); box-shadow: 0 0 10px rgba(200,200,200,0.4); }
    100% { border-color: var(--line-color);   box-shadow: none; }
}

.drawer {
    display: inline-block;
    border: 1px solid var(--line-color);
    padding: 10px;
    border-radius: 10px;
    background-color: var(--tile-bgr);
    font-size: 0.9em;
    vertical-align: top;
    width: 320px;
    margin-bottom: 15px;
    text-align: left;
}

.smallspacer {
    display: block;
    width: 20px;
    height: 20px;
}

/* This one is used for formatting field reports */
.vbigtile {
    display: inline-block;
    border: 1px solid var(--line-color);
    padding: 10px;
    border-radius: 10px;
    background-color: var(--tile-bgr);
    font-size: 1em;
    vertical-align: top;
    text-align: center;
    box-sizing: border-box;
    margin: 5px 5px 5px 5px;
}

/* ============================================================ */
/* Specimen popup                                                */
/* ============================================================ */

.popup {
    position: fixed;
    z-index: 3000;
    padding: 0px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(48,48,48,0.85);
    border-radius: 0px;
}

.popup_contents {
    margin: 100px;
    padding: 50px;
    background-color: var(--tile-bgr);
    border: 1px solid var(--line-color);
    border-radius: 10px;
}

.popup_contents img {
    transition: filter 0.2s, transform 0.2s;
}

.popup_contents a:hover img {
    filter: contrast(120%) brightness(110%);
    transform: scale(1.05);
}

.popup_contents a:hover #specimen-left,
.popup_contents a:hover #specimen-right {
    transform: scale(1.02);
}

.popup_close_button {
    position: absolute;
    top: 20px;
    right: 35px;
    font-size: 50px;
    user-select: none;
}

.popup_nav {
    cursor: pointer;
    display: inline-block;
    height: 70px;
    width: 70px;
    color: var(--very-bright-color);
    background-color: var(--dark-bgr);
    font-weight: bold;
    font-size: 50px;
    padding: 5px;
    text-align: center;
    border-radius: 5px;
    user-select: none;
}

.popup_nav:hover {
    background-color: var(--light-bgr);
}

/* ============================================================ */
/* Hamburger menu (hidden on desktop, visible on phone)          */
/* ============================================================ */

#menu-toggle {
    display: none;
    font-size: 24px;
    color: var(--bright-color);
    vertical-align: middle;
    margin-right: 10px;
    cursor: pointer;
    text-decoration: none;
}

#nav-links {
    display: inline;
}

/* ============================================================ */
/* Responsive: Tablet (768px – 1024px)                           */
/* ============================================================ */

@media screen and (max-width: 1024px) {
    /* Sidebar starts closed (handled by JS), main content full width */
    #main_content {
        padding-left: 35px;
    }

    /* Slightly smaller popup margins */
    .popup_contents {
        margin: 60px;
        padding: 30px;
    }
}

/* ============================================================ */
/* Responsive: Phone (< 768px)                                   */
/* ============================================================ */

@media screen and (max-width: 768px) {
    /* Hamburger menu */
    #menu-toggle {
        display: inline-block;
    }

    #nav-links {
        display: none;
        position: absolute;
        top: 50px;
        left: 0;
        width: 100%;
        background-color: var(--dark-bgr);
        border-bottom: 1px solid var(--line-color);
        padding: 10px;
        z-index: 50;
    }

    #nav-links.nav-open {
        display: block;
    }

    #nav-links .linkbox {
        display: block;
        margin: 5px 10px;
    }

    #nav-links #search-container {
        display: block;
        margin: 10px;
    }

    #nav-links #search-input {
        width: calc(100% - 20px);
    }

    /* Masthead: smaller height */
    #masthead {
        height: 45px;
        padding: 8px;
    }

    body {
        padding-top: 45px;
    }

    #content {
        height: calc(100svh - 95px);
    }

    /* Sidebar overlays content on phone */
    #sidebar_panel {
        z-index: 10;
        background-color: var(--dark-bgr);
        width: 280px;
    }

    #main_content {
        padding-left: 10px;
    }

    /* Specimen tiles: full width */
    .specimen {
        width: 100%;
        max-width: 340px;
    }

    /* Drawer tiles: full width */
    .drawer {
        width: 100%;
        max-width: 320px;
    }

    /* Popup: minimal margins, images stacked */
    .popup_contents {
        margin: 10px;
        padding: 15px;
    }

    #specimen-left, #specimen-right {
        width: 100% !important;
        float: none !important;
    }

    .popup_close_button {
        top: 5px;
        right: 10px;
        font-size: 35px;
    }

    .popup_nav {
        height: 50px;
        width: 50px;
        font-size: 35px;
    }

    /* Hide minimap on phone */
    #leaflet_map {
        display: none !important;
    }

    /* Footer smaller */
    #footer {
        font-size: 0.8em;
    }
}
