body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: #191A20; /* Updated background color */
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent scrolling */
    font-size: 16px; /* Base font size for better scaling */
}

h1 {
    margin-bottom: 20px;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden; /* Prevent scrolling */
    padding: 20px; /* Reduced padding for smaller screens */
    box-sizing: border-box; /* Include padding in width calculation */
    height: 100vh; /* Use full viewport height */
}

.daily-post-container {
    text-align: center;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden; /* Prevent scrolling */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%; /* Use full height of container */
}

#postImage {
    max-width: 90%; /* Reduce the size of the image */
    max-height: 70vh; /* Ensure the image fits within the viewport height */
    height: auto;
    border-radius: 15px; /* Rounded corners */
    display: block; /* Ensure the image is a block element */
    margin: 0 auto; /* Center the image horizontally */
    object-fit: contain; /* Ensure the image maintains its aspect ratio */
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1em;
    color: #ffffff;
}

.bottom-left, .bottom-right, .bottom-center {
    position: fixed; /* Change to fixed positioning */
    background-color: rgba(25, 26, 32, 0.7); /* Semi-transparent background */
    z-index: 10; /* Ensure they're above other content */
    color: rgba(255, 255, 255, 0.2); /* White color with 20% opacity */
}

.bottom-left {
    bottom: 28px; /* Position the element 28px from the bottom */
    left: 42px; /* Padding from left */
    font-size: 1em; /* Slightly smaller font */
}

.bottom-right {
    bottom: 28px; /* Position the element 28px from the bottom */
    right: 42px; /* Padding from right */
    text-align: right;
    font-size: 1em; /* Slightly smaller font */
}

.bottom-center {
    bottom: 20px; /* So that it comes in line with the other 2 items on its left and right */
    left: 10px;
    right: 10px;
    transform: none;
    text-align: center; /* Center the text */
}

.featured-link {
    font-size: 1em;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.5); /* White color with 50% opacity for centered description text */
    text-decoration: none;
    display: inline-block;
    overflow: hidden; /* Hide any overflow */
    word-wrap: break-word; /* Ensure the text wraps */
    text-align: center; /* Ensure text is centered */
}

.featured-link:hover {
    color: #ffffff; /* Change color to white */
    text-decoration: none;
}

.author-link {
    color: rgba(255, 255, 255, 0.2); /* Grey color for author links */
    transition: color 0.3s ease; /* Smooth transition for color change */
    text-decoration: none;
}

.author-link:hover {
    color: #ffffff; /* Change color to white */
    text-decoration: none; /* Ensure no underline on hover */
}

/* Styles for the social media popup */
.social-popup {
    display: none; /* Hide the popup by default */
    position: absolute; /* Position the popup absolutely */
    bottom: 100%; /* Position above the "Connect with us" text */
    left: 0;
    background-color: #333; /* Dark background color for the popup */
    padding: 20px 10px 10px 15px; /* Padding inside the popup */
    border-radius: 5px; /* Rounded corners for the popup */
    z-index: 10; /* Ensure it appears above other elements */
    min-width: 120px; /* Minimum width to prevent text wrapping */
    font-size: 1em;
}

/* Show popup on hover for non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .bottom-left:hover .social-popup {
        display: block;
    }
}

/* Styles for the links inside the social media popup */
.social-popup a {
    display: flex; /* Use flexbox to align items */
    align-items: center; /* Center items vertically */
    color: rgba(255, 255, 255, 0.5); /* Default color of links */
    text-decoration: none; /* Remove underline from links */
    margin-bottom: 8px; /* Space between links */
    transition: color 0.3s ease; /* Smooth transition for color change */
    white-space: nowrap; /* Prevent text wrapping */
    padding: 2px;
}

.social-popup a:hover {
    color: #ffffff; /* Change color to white */
    text-decoration: none; /* Ensure no underline on hover */
}

/* Margin for the icons inside the social media popup */
.social-popup a i {
    margin-right: 5px; /* Space between icon and text */
    font-size: 1.2em; /* Adjust icon size */
    vertical-align: middle;
    color: inherit; /* Ensure icon inherits color from the link */
}

/* Styles for the SVG icon */
.social-popup a img.social-icon {
    margin-right: 4px; /* Space between icon and text */
    width: 20px; /* Set a fixed width */
    height: 20px; /* Set a fixed height */
    vertical-align: middle; /* Align vertically */
    filter: brightness(1) invert(0); /* Change to original color initially */
    transition: filter 0.3s ease; /* Smooth transition for filter change */
}

/* Change color on hover */
.social-popup a:hover img.social-icon {
     filter: brightness(0) invert(1); /* Make icon white on hover */
}

/* Media query for smaller screens */
@media screen and (max-width: 600px) {
    body, html {
        font-size: 14px; /* Smaller base font size for mobile */
    }

    .container {
        padding: 10px;
        justify-content: flex-start; /* Align content to the top on mobile */
    }

    .daily-post-container {
        justify-content: flex-start; /* Align content to the top on mobile */
        padding-top: 20vh; /* Add some top padding to push content down */
    }

    #postImage {
        max-height: 60vh; /* Further reduce image height on small screens */
    }

    .bottom-left, .bottom-right {
        font-size: 0.8em; /* Even smaller font on mobile */
    }

    .bottom-center {
        bottom: 60px; /* Adjust position for mobile */
    }

    .bottom-left, .bottom-right {
        bottom: 20px; /* Adjust position for mobile */
    }

    .bottom-left {
        left: 20px; /* Adjust position for mobile */
    }

    .bottom-right {
        right: 20px; /* Adjust position for mobile */
    }

    .social-popup {
        position: fixed; /* Change to fixed positioning on mobile */
        bottom: 50px;
        left: 10px;
        min-width: 100px;
        padding: 5px; /* Adjust padding for mobile */
    }

    .social-popup a {
        margin: 8px;
    }

    .social-popup a i {
        font-size: 1em; /* Reduce icon size on mobile */
    }

    .social-popup a img.social-icon {
        width: 12px; /* Smaller width for Threads icon on mobile */
        height: 12px; /* Smaller height for Threads icon on mobile */
    }
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    padding: 20px;
    contain: content; /* Optimize browser rendering */
    will-change: opacity; /* Hint to browser about animation */
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    animation: pulse 1.4s ease-in-out infinite;
    contain: strict; /* Further optimize rendering */
    transform: translateZ(0); /* Force GPU acceleration */
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.8;
    }
}
