::-webkit-scrollbar {
    display: none;
}

/* ── MOVED HERE from index.css to avoid load-order conflicts ── */
.news-item-image {
    border: 3px solid #2e8b3a;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(33, 108, 42, 0.18);
    overflow: hidden;
}

.news-item:hover .news-item-image {
    border-color: #1a5c24;
    box-shadow: 0 6px 20px rgba(33, 108, 42, 0.30);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* REMOVED: max-width: 100% — this breaks flex/grid children */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Poppins', sans-serif;
    padding-top: 140px;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

.hide-header {
    transform: translateY(-100%);
}

.nav-header.top-position {
    top: 0;
}

.top-header {
    height: auto;
    min-height: 80px;
    background-color: #216c2a;
    padding: .8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    max-width: 100vw;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    box-sizing: border-box;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    color: white;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    gap: 0.8rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.logo h1 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to right, #ffffff, #e6e6e6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
    margin: 0;
    line-height: 1.2;
}

.tagline {
    font-family: "Brush Script MT";
    font-size: clamp(1rem, 1.5vw, 1rem);
    font-weight: 400;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.3px;
    margin: 0;
    line-height: 1.2;
    white-space: normal;
    overflow: visible;
}

.logo img {
    width: clamp(40px, 8vw, 60px);
    height: clamp(40px, 8vw, 60px);
    flex-shrink: 0;
    background-color: white;
    border-radius: 50%;
}

.dropdown-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.center-datetime {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    flex: 1;
    gap: 0.75rem;
    font-size: 1.05rem;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    min-width: 420px;
}

.datetime-label    { font-weight: 600; }
.datetime-separator { font-weight: 400; opacity: 0.7; font-size: 0.9rem; }
.datetime-date     { font-weight: 500; }

.datetime-full {
    font-family: 'Montserrat', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    color: #ffffff;
    padding: 0.55rem 1.3rem;
    white-space: nowrap;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding-right: 1rem;
    transition: all 0.3s ease-in-out;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.library-info-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin: 0;
    box-shadow: none;
    min-width: 0;
    max-width: 400px;
    gap: 1rem;
    flex-shrink: 1;
}

.clock-container,
.library-hours {
    flex: 1;
}

.clock-container {
    text-align: center;
    margin-bottom: 0;
}

#digital-clock {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    font-family: 'Arial', sans-serif;
    margin: 0;
}

.library-hours {
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    padding-left: 1rem;
}

.library-hours p {
    color: white;
    line-height: 1.2;
    font-size: 0.9rem;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.site-visits {
    background: transparent;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    margin-left: 0.5rem;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.site-visits .counter {
    color: #216c2a;
    background-color: #ffffff;
    border-radius: 999px;
    padding: 0.3em 0.9em;
    font-size: 1em;
    font-weight: bold;
    margin-left: 0.5em;
    letter-spacing: 1px;
    transition: background 0.2s, color 0.2s;
}

.btn {
    background-color: transparent;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    color: #ffffff;
    border-radius: 999px;
    white-space: nowrap;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.7);
    font-weight: 600;
    box-shadow: none;
}

.btn:hover {
    background-color: #ffffff;
    color: #216c2a;
    border-color: #ffffff;
    box-shadow: none;
}

.nav-header {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: top 0.3s ease-in-out;
}

.nav-toggle {
    display: none;
}

.main-nav {
    display: flex;
    justify-content: center !important;
    gap: 1rem;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-btn {
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.nav-btn:hover { color: #216c2a; }

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: #216c2a;
    transition: width 0.3s ease;
}

.nav-btn:hover::after { width: 80%; }

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.dropdown-trigger i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu a {
    display: flex;
    padding: 0.8rem 1rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.dropdown-menu a:hover {
    background: #216c2a;
    color: white;
}

.nav-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown.active .dropdown-trigger i {
    transform: rotate(180deg);
}

.scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 40px;
    z-index: 999;
    background: none;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    opacity: 0.35;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.scrollToTopBtn:hover {
    opacity: 1;
    transform: scale(1.05);
}

.welcome-banner {
    background: linear-gradient(135deg, #216c2a 0%, #2d8f3a 100%);
    padding: 0.75rem 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-banner p {
    color: white;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.3px;
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%   { opacity: 0.3; }
    50%  { opacity: 0.9; }
    100% { opacity: 0.3; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media screen and (max-width: 1400px) {
    .center-datetime { font-size: clamp(0.7rem, 1.5vw, 1.05rem); }
    .logo h1         { font-size: clamp(0.9rem, 2vw, 1.5rem); }
    #digital-clock   { font-size: clamp(0.9rem, 2vw, 1.3rem); }
    .library-hours p { font-size: clamp(0.65rem, 1.2vw, 0.9rem); }
}

@media screen and (max-width: 1024px) {
    .library-info-card { max-width: 300px; padding: 0.5rem 0.7rem; gap: 0.7rem; }
    .site-visits       { font-size: clamp(0.75rem, 1.5vw, 1rem); }
}

@media screen and (max-width: 900px) {
    .datetime-full { font-size: 0.95rem; padding: 0.45rem 1rem; }
}

@media screen and (max-width: 768px) {
    /* Header collapses to ~60px on mobile, reduce body padding-top */
    body { padding-top: 110px; }

    .dropdown-toggle { display: block; }

    .tagline {
        font-size: clamp(0.6rem, 1.5vw, 0.75rem);
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .logo { gap: 0.5rem; }

    .center-datetime { display: none !important; }

    .top-header {
        padding: 0.6rem 0.8rem;
        flex-direction: row;  /* keep logo + buttons on one row */
        align-items: center;
        min-height: 60px;
    }

    .header-buttons {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #216c2a;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
    }

    .header-buttons.show {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        animation: slideDown 0.3s ease-in-out forwards;
    }

    .btn { width: 100%; text-align: center; }

    .library-info-card {
        background: transparent;
        width: 100%;
        justify-content: center;
        padding: 0.5rem;
    }

    .site-visits {
        width: 100%;
        text-align: center;
        justify-content: center;
        margin-left: 0;
    }

    .site-visits .counter { margin-left: 0; padding: 0.4em 0.8em; font-size: .8em; }

    .nav-header { top: 60px; } /* match collapsed header height */

    .nav-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #333;
        cursor: pointer;
        padding: 1rem;
    }

    .main-nav { display: none; flex-direction: column; padding: 0; }

    .main-nav.show {
        display: flex;
        animation: slideDown 0.3s ease-in-out forwards;
    }

    .nav-btn { padding: 1rem 2rem; }

    .dropdown-menu {
        position: static;
        background: rgb(230, 230, 230);
        opacity: 1;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transform: none;
        box-shadow: none;
        transition: all 0.3s ease;
    }

    .nav-dropdown.active .dropdown-menu { visibility: visible; max-height: 500px; }

    .dropdown-menu a { padding: 0.8rem 2rem; }

    .welcome-banner  { padding: 0.6rem 1rem; }
    .welcome-banner p { font-size: 0.85rem; line-height: 1.4; }

    .scrollToTopBtn { right: 10px; }

    .logo img { width: clamp(35px, 6vw, 60px); height: clamp(35px, 6vw, 60px); }
    .library-info-card { max-width: 250px; padding: 0.4rem 0.6rem; gap: 0.5rem; }
    .header-buttons { padding-right: 0.5rem; gap: 0.3rem; }

    /* ── News item mobile fix (overrides index.css baseline) ── */
    .news-item {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        min-height: auto !important;
        padding: 0 !important;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        overflow: hidden;
    }

    .news-item-image {
        width: 100% !important;
        min-width: 100% !important;
        height: 200px !important;
        border-radius: 0 !important;
        border: none !important;
        border-bottom: 3px solid #2e8b3a !important;
        box-shadow: none !important;
    }

    .news-item-content {
        width: 100% !important;
        min-width: 0 !important;
        padding: 1rem !important;
        flex: unset !important;
    }
}

@media screen and (max-width: 576px) {
    body { padding-top: 100px; }
    .top-header     { padding: 0.5rem 0.4rem; }
    .center-datetime { gap: 0.4rem; }
    .library-info-card { max-width: 200px; padding: 0.3rem 0.5rem; }
    .logo img       { margin-right: 0.4rem; }
    .nav-header     { top: 55px; }
}

@media screen and (max-width: 480px) {
    body { padding-top: 95px; }
    .tagline        { font-size: 0.55rem; white-space: normal; overflow: visible; text-overflow: unset; }
    .logo h1        { font-size: clamp(1rem, 3vw, 1.2rem); }
    .welcome-banner p { font-size: 0.75rem; }
    .top-header     { padding: 0.4rem 0.3rem; }
    .center-datetime { gap: 0.3rem; }
    .library-info-card { max-width: 180px; padding: 0.3rem 0.4rem; gap: 0.4rem; }
    .header-buttons { gap: 0.2rem; }
    .nav-header     { top: 50px; }

    .news-item-image { height: 160px !important; }
}
