/* Reset and Basic Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Antonio', sans-serif;
    background-color: white;
    color: black;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header Styles */
header {
    padding: .2%;
    margin-bottom: .2%;
}

.header-container {
    max-width: 96%;
    margin: 0 auto;
    padding: 2%;
    text-align: center;
}

.logo img {
    margin: auto;
    width: 42%;
    margin-top: -2.4%;
    margin-bottom: .2%;
}

.nav-list {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 4.2%;
}

.nav-list .category-btn {
    background: transparent;
    color: black;
    border: none;
    padding: 2%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bolder;
}

.nav-list .category-btn:hover,
.nav-list .category-btn.active {
    background: transparent;
}

/* Main Content Styles */
main {
    max-width: 69%;
    font-weight: bolder;
    margin: 0 auto;
    padding: 2%;
}

#latest-news-heading {
    font-size: 24px;
    margin-top: -4.2%;
    margin-bottom: 2.4%;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: black;
}

.articles-container {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 2%;
}

/* Article Preview Styles */
.article-preview {
    background: white;
    border-radius: 2%;
    padding: 1.2%;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.article-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.article-preview h3 {
    font-size: 24px;
    font-weight: bolder;
    margin-bottom: .2%;
    color: black;
}

.article-preview p.description {
    font-size: 16px;
    font-weight: lighter;
    margin-bottom: .2%;
    color: grey;
}

.article-meta {
    font-size: 12px;
    color: darkgray;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid whitesmoke;
    padding-top: .2%;
    margin-top: auto;
}

.article-meta .author {
    font-style: normal;
    font-weight: bold;
}

.article-meta .date-time {
    text-align: right;
    font-weight: 420;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 96%;
    max-width: 800px;
    max-height: 100%;
    background: rgba(248, 248, 248, .96);
    justify-content: center;
    align-items: center;
    padding: 6%;
    padding-bottom: 6.6%;
    margin-bottom: 18%;
    z-index: 1000;
    overflow-y: hidden; /* Prevent vertical scrolling */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    scrollbar-color: whitesmoke;
    scrollbar-width: none;
    border-radius: 2%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.69);
}

/* Adjust modal content to fit within the screen */
.modal-content {
    max-height: calc(100vh - 40px); /* Adjust to ensure the modal fits the screen */
    overflow-y: auto;
    scrollbar-color: whitesmoke;
    scrollbar-width: none;
    width: 100%;
    box-sizing: border-box;
}

/* Existing Close Button Style */
.close {
    position: absolute;
    top: 2%;
    right: 2%;
    font-size: 42px;
    color: black;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

/* Adjust the Share Button Style */
.share {
    position: absolute;
    top: 12%; /* Align with the close button at the top */
    right: 2.4%; /* Position it on the left side */
    font-size: 16px;
    font-weight: bolder;
    color: fuchsia;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    writing-mode: vertical-rl; /* Makes the text vertical */
    text-orientation: sideways-right; /* Ensures the letters are upright */
}

.share:hover {
    color: black;
}

.close:hover {
    color: black;
}

.modal-body {
    max-height: 69%;
    overflow-y: auto;
}

.author-link {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.author-link:hover {
    color: blue;
    text-decoration: none;
}

/* Footer Styles */
footer {
    background: white;
    color: black;
    text-align: center;
    padding: 6%;
    position: initial;
    bottom: 0;
    width: 96%;
    margin-top: 12%;
    font-size: 12px;
}

/* Divider */
.divider {
    margin: 2% auto;
    border: none;
    border-top: 2px solid whitesmoke;
}

/* Ensure images and videos are responsive and centered */
.article-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2% auto;
}

/* Video Embed Styles */
.video-embed {
    position: relative;
    max-width: 100%;
    padding: 24%;
    overflow: hidden;
    margin: 2% auto;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Prevent background scrolling when modal is open */
body.modal-open {
    overflow: hidden;
}
