/* Universal Box-Sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- Header Styles --- */
header {
    background-color: #06327D;
    color: #F1F1E6;
    padding: 15px 75px; /* Adjust left/right padding for larger screens */
    width: 100%;
    position: fixed;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

header.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.title {
    display: flex;
    align-items: center;
}

.title img {
    margin-right: 10px;
    height: 55px;
}

header h1 {
    font-size: 35px;
    padding: 10px; /* This padding might be inherited later by links, watch out */
    border-radius: 5px;
    margin: 0;
}

.links {
    display: flex;
    align-items: center;
}

.links a {
    color: #F1F1E6;
    text-decoration: none;
    margin-left: 45px;
    font-size: 20px;
}

.links a:hover {
    text-decoration: underline;
}

/* Hamburger menu icon (hidden by default on desktop) */
.hamburger-icon {
    display: none; /* Hide on larger screens */
    flex-direction: column;
    cursor: pointer;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    z-index: 1001; /* Ensure it's above other content when open */
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #F1F1E6;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

/* Hide the checkbox visually */
.menu-toggle {
    display: none;
}

/* --- Base Body and Layout Styles --- */
body {
    font-family: 'Roboto', Arial, sans-serif; /* Use Roboto from Google Fonts */
    line-height: 1.6;
    color: #111111;
    background-color: #F1F1E6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: var(--header-height, 85px); /* Fallback padding for initial load */
}

/* Utility classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.gradient-line {
    border: 0;
    height: 10px;
    background-image: linear-gradient(to right, #06327D, rgba(6, 50, 125, 0.4), #06327D);
    margin: 0;
}

/* Main content */
main {
    display: flex;
    padding: 2rem 0;
    flex: 1 0 auto;
    flex-direction: column;
}

main h1 {
    font-size: 2.5rem;
    color: #06327D;
    margin-bottom: 1rem;
    text-align: center;
}

main > p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
    text-align: center;
}

/* Article list */
.article-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    padding: 5vh;
}

.article-card {
    background: #FFFFFF;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 2px 5px 5px #818181;
    width: 100%; /* Take full width by default in smaller screens */
    max-width: 500px; /* Max width for larger screens */
    text-align: left;
    display: flex; /* Flexbox for content within the card */
    flex-direction: column;
}

.article-card h2 {
    font-size: 1.8rem;
    color: #06327D;
    margin-bottom: 0.5rem;
}

.article-card p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
    flex-grow: 1; /* Allow paragraph to grow and push button to bottom */
}

/* Button styling (general and for article cards) */
.hbtn {
    display: inline-flex;
    background: #f4a261;
    color: #06327D !important;
    padding: 0.4rem 1rem;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    align-self: flex-start; /* Align button to start in flex column */
}

.hbtn:hover {
    background: #DB8C4A;
    text-decoration: none !important;
}

a.btn { 
    display: inline-block;
    background: #f4a261;
    color: #06327D;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
     width: 25%; /* Set button width to 25% of its parent (.article-card) */
    min-width: fit-content; /* Ensure the button is at least as wide as its content */
    text-align: center; /* Center the text horizontally within the button */
    white-space: nowrap; /* Prevent text from wrapping inside the button */
    overflow: hidden; /* Hide overflow if text is too long and cannot wrap */
    text-overflow: ellipsis;
}

a.btn:hover {
    background: #DB8C4A;
    text-decoration: none;
}

/* --- Footer (unchanged from your original) --- */
footer {
    background: #06327D;
    color: #F1F1E6;
    padding: 2rem 0;
    text-align: center;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

footer ul {
    list-style: none;
    display: flex;
    margin-top: 1rem;
    padding: 0; /* Ensure no default padding from ul */
}

footer ul li {
    margin: 0 1rem;
}

footer ul li a {
    color: #F1F1E6;
    text-decoration: none;
}

footer ul li a:hover {
    text-decoration: underline;
}

/* --- Responsive Design Media Queries --- */
@media (max-width: 1024px) {
    /* Adjust header padding for slightly smaller desktops/large tablets */
    header {
        padding: 15px 30px;
    }
    .links a {
        margin-left: 30px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 15px 20px; /* More consistent padding for mobile */
    }

    nav {
        flex-wrap: wrap; /* Allow items to wrap if needed */
    }

    .hamburger-icon {
        display: flex; /* Show hamburger icon on small screens */
    }

    .links {
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: var(--header-height, 85px); /* Position below header */
        left: 0;
        background-color: #06327D; /* Background for dropdown menu */
        padding: 20px;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        transform: translateY(-100%); /* Start off-screen */
        opacity: 0;
        pointer-events: none; /* Disable interaction when hidden */
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
        align-items: center; /* Center links in dropdown */
    }

    /* When checkbox is checked, show the menu */
    .menu-toggle:checked ~ .links {
        transform: translateY(0); /* Slide in */
        opacity: 1;
        pointer-events: all; /* Enable interaction */
    }

    /* Hamburger icon animation when menu is open */
    .menu-toggle:checked ~ .hamburger-icon span:nth-child(1) {
        transform: translateY(11px) rotate(45deg);
    }
    .menu-toggle:checked ~ .hamburger-icon span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle:checked ~ .hamburger-icon span:nth-child(3) {
        transform: translateY(-11px) rotate(-45deg);
    }

    .links a {
        margin: 10px 0; /* Adjust spacing for stacked links */
        width: 100%; /* Make links take full width in menu */
        text-align: center;
        padding: 10px 0;
    }
  .links .hbtn { /* Target .hbtn specifically when it's inside .links on mobile */
        max-width: 5rem; /* Set the max-width for the button */
        width: auto; /* Allow it to shrink if needed, but respect max-width */
        padding: 0.4rem 0.5rem; /* Adjust padding for a smaller button */
        font-size: 18px; /* Maybe slightly smaller font */
        display: inline-flex; /* Keep it inline-flex to center text */
        justify-content: center; /* Center the content inside the flex button */
        align-self: center;

    }

    /* Adjust main content heading/paragraph */
    main h1, main > p {
        font-size: 1.8rem; /* Smaller font size for mobile heading */
        padding: 0 10px; /* Add some horizontal padding */
    }

    main > p {
        font-size: 1rem;
    }

    .article-list {
        padding: 3vh 15px; /* Adjust padding for mobile list */
        gap: 1.5rem; /* Slightly smaller gap between cards */
    }

    .article-card {
        max-width: 100%; /* Ensure cards always take full width */
        padding: 1rem; /* Slightly less padding for cards */
    }

    /* Footer adjustments for mobile */
    footer .container {
        padding: 0 15px;
    }
    footer ul {
        flex-direction: column;
        align-items: center;
    }
    footer ul li {
        margin: 5px 0;
    }
}

/* Optional: Even smaller devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 28px;
    }
    .title img {
        height: 45px;
    }
    .links a {
        font-size: 18px;
    }
    main h1 {
        font-size: 2rem;
    }
}