/* Base Reset and Fonts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Focus outlines for accessibility - Moved to top for specificity order */
a:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #2980B9;
    outline-offset: 2px;
}

body {
    font-family: "Lato", "Open Sans", Arial, Helvetica, sans-serif;
    background: linear-gradient(to bottom, #1D3557, #13243B);
    color: #fff;
    line-height: 1.6;
    min-height: 100vh;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    left: 0;
    top: -40px;
    background: #2980B9;
    color: #fff;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
    border-radius: 0 0 5px 5px;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
}

/* Header */
header {
    padding: 40px 0 20px; /* Shorthand fix */
    text-align: center;
    background: none;
}

header h1 {
    font-family: "Roboto", sans-serif; /* Quotes fix */
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

header p {
    font-family: "Lato", "Open Sans", Arial, Helvetica, sans-serif; /* Quotes fix */
    font-size: 1.3rem;
    font-weight: 300;
    letter-spacing: 1px;
}

/* Divider */
.divider {
    width: 100%;
    max-width: 900px;
    border: none;
    border-top: 2px solid #a3b6d9;
    margin: 60px auto;
}

/* Main Content */
main {
    display: block;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Profile Section */
.profile {
    background: #fff;
    color: #222f3e;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgb(0 0 0 / 7%); /* Color notation fix */
    padding: 40px 30px;
    max-width: 1000px;
    margin: 60px auto;
}

.profile h2 {
    font-family: "Montserrat", sans-serif; /* Quotes fix */
    font-size: 1.7rem;
    margin-bottom: 15px;
    text-align: center;
    color: #1D3557;
}

.profile p {
    font-family: "Lato", "Open Sans", Arial, Helvetica, sans-serif; /* Quotes fix */
    font-size: 1.05rem;
    margin-bottom: 20px;
    text-align: center;
}

/* Repo List Section & Medium Articles List (Shared Styles) */
.repo-list,
.medium-articles-list {
    max-width: 1200px;
    margin: 60px auto;
    padding: 20px;
}

.repo-list h2,
.medium-articles-list h2 {
    font-family: "Montserrat", sans-serif; /* Quotes fix */
    text-align: center;
    margin-bottom: 40px;
    font-size: 1.7rem;
    color: #fff;
}

/* Repo Cards & Article Cards (Shared Container & Card Styles) */
.repo-list .repo-list,
.medium-articles-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.repo-card,
.article-card {
    background: #fff;
    color: #222f3e;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgb(0 0 0 / 9%); /* Color notation fix */
    padding: 25px;
    width: 300px;
    margin-bottom: 15px;
    transition: transform 0.3s;
}

.repo-card:hover,
.repo-card:focus-within,
.article-card:hover,
.article-card:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgb(41 128 185 / 13%);
}

.repo-card h3,
.article-card h3 {
    font-family: "Montserrat", sans-serif;
    font-size: 1.2rem;
    margin-bottom: 0;
}

.repo-card p {
    font-family: "Lato", "Open Sans", Arial, Helvetica, sans-serif;
    font-size: 0.98rem;
    margin-bottom: 10px;
    color: #666;
    flex-grow: 1;
    overflow-wrap: break-word;
}

.repo-card a,
.article-card a {
    color: #2980B9;
    text-decoration: none;
    overflow-wrap: break-word;
}

.repo-card a:focus,
.repo-card a:hover,
.article-card a:focus,
.article-card a:hover {
    text-decoration: underline;
    outline: 2px solid #2980B9;
    border-radius: 3px;
}

/* Specific styles for Medium article cards */
.article-card .article-thumbnail {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 15px;
}

.article-card .article-date {
    font-size: 0.85rem;
    color: #999;
    margin-top: auto;
    display: block;
    text-align: right;
}

/* Load More Button (Shared Styles) */
.load-more-button {
    display: block;
    margin: 40px auto 20px;
    padding: 15px 30px;
    background-color: #2980B9;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-family: "Lato", sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    outline: none;
}

.load-more-button:hover,
.load-more-button:focus {
    background-color: #3498DB;
    transform: translateY(-2px);
}

/* Hide the button when all items are loaded */
.load-more-button.hidden {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    font-size: 1rem;
    color: #b5c6e0;
    padding: 40px 0 20px;
    background: none;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-content a {
    display: inline-block;
    width: 36px;
    height: 36px;
    position: relative;
    transition: transform 0.25s, background-color 0.25s;
    outline: none;
    border-radius: 5px;
    justify-content: center;
    align-items: center;
}

/* Removed duplicate 'display: flex;' as it's already on .footer-content */
.footer-content a img {
    width: 30px;
    height: 30px;
    filter: invert(1);
    display: block;
}

.footer-content a:focus,
.footer-content a:hover {
    transform: scale(1.1);
    background-color: rgb(255 255 255 / 8%);
    outline: 2px solid #2980B9;
}

/* Tooltip Styles */
.tooltip {
    visibility: hidden;
    opacity: 0;
    width: max-content;
    background-color: #222f3e;
    color: #fff;
    text-align: center;
    border-radius: 5px;
    padding: 6px 14px;
    position: absolute;
    z-index: 10;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.2s, visibility 0.2s;
    font-size: 0.95rem;
    pointer-events: none;
    white-space: nowrap;
}

.footer-content a:hover .tooltip,
.footer-content a:focus .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Responsive Design */
@media screen and (width <= 900px) {
    .profile {
        max-width: 98vw;
        padding: 30px 20px;
    }

    .repo-card,
    .article-card {
        width: 90vw;
        padding: 20px;
    }
}

@media screen and (width <= 600px) {
    header h1 {
        font-size: 2rem;
    }

    .profile h2,
    .repo-list h2,
    .medium-articles-list h2 {
        font-size: 1.2rem;
    }

    .repo-card,
    .article-card {
        width: 98vw;
        padding: 15px 10px;
    }

    /* Adjustments for overall spacing on small screens */
    .divider,
    .profile,
    .repo-list,
    .medium-articles-list {
        margin: 40px auto;
    }

    header {
        padding: 30px 0 15px;
    }

    footer {
        padding: 30px 0 15px;
    }

    /* Responsive adjustments for Load More button */
    .load-more-button {
        width: 90%;
        font-size: 1rem;
        padding: 12px 20px;
    }
}