/* Global Styles in map/static/style.css */
/* Ensure page fills viewport and footer sits at bottom */
html, body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #2b5f47;
    background: linear-gradient(#a1f6f7, #c35ff2);
    min-height: 100vh; /* full viewport height */
    display: flex;
    flex-direction: column; /* header -> main -> footer */
}

/* --- append these global header layout rules --- */
:root {
    /* adjust to match your header visual height */
    --site-header-height: 64px;
    --site-header2-height: 56px; /* height of secondary notebook toolbar */
}

header, footer {
    background-color: #333;
    color: white;
    padding: 0.5rem;
    text-align: center;
}

/* Make main expand to consume available space so footer is pushed down */
main {
    flex: 1 0 auto; /* grow and take remaining space */
    padding-top: calc(var(--site-header-height) + var(--site-header2-height));
    padding: 2rem;
    max-width: 1200px;
    margin: auto;
    background: linear-gradient(#a1f6f7, #c35ff2);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* Push page content below fixed header */
}

main.fullwidth {
    max-width: none;
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}


/* Global site header: make it fixed and on top */
.site-header {
    display: flex;
    align-items: center;
    justify-content: center; /* horizontal centering of children */
    gap: 1rem;
    height: var(--site-header-height);
    flex-shrink: 0; /* never collapse below content size */
    padding: 0px 10px; /* increase vertical height */
    background: #333; /* Dark header background */
    color: #fff;
    line-height: 1; /* prevents extra height from line spacing */
    z-index: 1200; /* higher than any page toolbars */
}
/* Ensure header links remain visible */
.site-header a {
    color: inherit;
    text-decoration: none;
}
/* Notebook toolbars should sit below the main header (use lower z-index) */

/* Authoritative .site-header2 (secondary toolbar used by notebook pages)
   All presentation rules for .site-header2 must live here. */
.site-header2 {
    /*position: fixed;*/
    left: 0;
    right: 0;
    top: calc(var(--site-header-height)); /* placed immediately below global header */
    height: var(--site-header2-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px; /* horizontal padding only to keep it compact */
    background: #333; /* match global header */
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 1100; /* below global header */
}

/* button-group inside the secondary header should stay compact */
.site-header2 .button-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0;
    flex-wrap: nowrap; /* prevent wrapping which increases header height */
}

/* small adjustments to buttons inside secondary header to avoid tall buttons */
.site-header2 .button-group .btn {
    white-space: nowrap;
    padding-top: 6px;
    padding-bottom: 6px;
    line-height: 1;
}


/* Compact footer styling */
.site-footer {
    flex-shrink: 0; /* never collapse below content size */
    padding: 6px 12px; /* reduce vertical height */
    font-size: 0.875rem; /* slightly smaller text */
    line-height: 1; /* prevents extra height from line spacing */
    background: #c35ff2; /* Same as base background at the bottom */
    border-top: 1px solid #e0e0e0;
    color: #333;
}

/* Remove default paragraph margin inside footer */
.site-footer p {
    margin: 0;
}

/* Honeypot anti-spam field — hidden from human users, detectable by bots */
.hidden-field {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

h1 {
    color: green;
    font-size: 2rem;
    margin-top: 0.5rem; /* space before */
    margin-bottom: 0.5rem; /* space after */
}

h2 {
    color: blue;
    font-size: 1.75rem;
    margin-top: 0.5rem; /* space before */
    margin-bottom: 0.5rem; /* space after */
}
h3 {
    color: magenta;
    font-size: 1.5rem;
    margin-top: 0.5rem; /* space before */
    margin-bottom: 0.5rem; /* space after */
}

h4 {
    color: black;
    font-size: 1rem;
    margin-top: 0.5rem; /* space before */
    margin-bottom: 0.5rem; /* space after */
}

a {
    color: #007bff;
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

.zoo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    align-items: start;
    background: linear-gradient(#00fbff, #0473b9);
    margin: 1rem 0;
    padding: 0;
}

.animal-card {
    background: #ffffff;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
}

.animal-card:hover {
        transform: scale(1.03);
    }

    .animal-card img {
        width: 100%;
        height: auto;
        display: block;
        object-fit: cover;
    }

.animal-text {
    font-size: 0.95rem;
    color: #222;
    line-height: 1.3;
}

/* Small screens: tighten spacing if needed */
/* --- Go full width on small screens --- */
@media (max-width: 600px) {
    main {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding-top: 2rem; /* 70px enough room for one row of buttons */
    }
    .site-header2 .button-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    .site-header2 {
        height: auto;        /* let the header grow taller to fit wrapped buttons */
        padding: 8px 16px;   /* add a little vertical breathing room */
    }
    .zoo-grid {
        gap: 0.5rem;
    }

    .animal-card {
        padding: 0.5rem;
    }
}

@media print {
    button {
        display: none;
    }

    .hide-paragraph {
        display: none;
    }

    /* Hide elements with the class "print-hide" */
    .print-hide {
        display: none;
    }

    /* Hide header and footer when printing */
    .site-header,
    .site-footer {
        display: none !important;
        visibility: hidden;
    }

    /* Optional: make printed content use full height */
    main {
        margin: 0;
        padding: 0;
    }
    .page-break {
        break-before: page; /* Modern standard */
    }

    /* ---- Combined map + address list print layout ---- */

    /* Remove max-width constraint so the map can use the full printable page width */
    main {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Show the group header above the map */
    #print-map-header {
        display: block !important;
        font-size: 1.4rem;
        font-weight: bold;
        margin: 6px 0 4px;
        padding: 0;
    }

    /* Map height/width/zoom are now controlled by the dynamically injected
       print-map-scale-style tag in map.html (CSS zoom approach).
       We only prevent a page break inside the map here. */
    #map {
        page-break-after: avoid;
    }

    /* Show the hidden address list and start it on a new page */
    #print-address-list {
        display: block !important;
        break-before: page;
        page-break-before: always; /* legacy fallback */
    }

    /* Address list record styles (mirrors show_addresses.html inline styles) */
    #print-address-list .group-header {
        color: red;
        font-size: 1.6rem;
        margin: 14px 0 4px;
        font-weight: 700;
    }

    #print-address-list .record {
        padding: 6px 8px;
        margin: 6px 0;
        border: 1px solid #ccc;
        border-radius: 4px;
        break-inside: avoid;
        page-break-inside: avoid; /* legacy fallback */
    }

    #print-address-list .field {
        margin: 2px 0;
        font-size: 0.85rem;
        word-break: break-word;
    }
}

/* Context Help dropdown in site-header nav */
.context-help-menu {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.context-help-toggle {
    cursor: pointer;
    padding: 4px 10px;
    background: inherit;
    border: none;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
}

.context-help-toggle:hover {
    background: #777;
}

.context-help-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
    z-index: 1300;
    color: #333; 
    background: white;
    text-align: left;
}

.context-help-content {
    padding: 15px;
}

/* Full-width context help banner (used when help text > 200 chars) */
#context-help-banner {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;    
    background: linear-gradient(#a1f6f7, #c35ff2);
    border-bottom: 2px solid #17df17;
    width: 100%;
    box-sizing: border-box;    
    max-width: 1200px;
    margin: auto;  
}

#context-help-banner.is-open {
    max-height: 2000px; /* large enough for any content */
    overflow: visible;
}

#context-help-banner-content {
    padding: 16px 24px 8px 24px;
    color: #333;
}

#context-help-banner-close {
    display: block;
    margin: 8px 24px 0 auto;
    cursor: pointer;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.9rem;
    font-family: inherit;
}

#context-help-banner-close:hover {
    background: #777;
}

