/* Mobile-first styles */
body {
    background: #1c1e1f;
    color: #e8e6e3;
}

header {
    background: #181a1b;
}

nav {
    position: relative;
    z-index: 10;
}

nav ul {
    position: relative;
    z-index: 10;
    background: rgba(28, 30, 31, 0.9);
    border-radius: 0.5rem;
    padding: 1rem;
}

nav ul li {
    margin: 0.5em 0;
    opacity: 0;
    animation: fadeInExpand 0.5s ease-in-out forwards;
}

nav ul li:nth-child(1) { animation-delay: 0.2s; }
nav ul li:nth-child(2) { animation-delay: 0.4s; }
nav ul li:nth-child(3) { animation-delay: 0.6s; }
nav ul li:nth-child(4) { animation-delay: 0.8s; }

nav ul li a {
    text-decoration: none;
    color: #e8e6e3;
    font-size: 1.2em;
    display: flex;
    align-items: center;
}

nav ul li a:hover {
    text-decoration: none;
    color: #c3c4c4;
}

nav ul li a .material-symbols-outlined {
    margin-right: 0.5em;
}

article {
    position: relative;
    padding: 1em;
    animation: fadeInExpand 1s ease-in-out;
    background: #1c1e1f;
    color: #e8e6e3;
    z-index: 1; /* Ensure article is behind the nav */
}

article:nth-of-type(1) {
    margin-top: 2em;
    padding-top: 2em;
    background: #1c1e1f url('images/codesnap-small.png') no-repeat top right;
    background-size: cover;
    box-shadow: inset 0 0 10em rgba(0, 0, 0, 1);
    border-radius: 0.5rem;
    filter: grayscale(50%) contrast(1.5);
    border: 1px solid #333;
    z-index: 0; /* Ensure article background is behind everything */
}

blockquote {
    border-left: 4px solid #ccc;
    padding-left: 1em;
    color: #666;
    font-style: italic;
    background: rgba(28, 30, 31, 0.9);
    padding: 1em;
    border-radius: 0.5rem;
}

ul {
    padding-left: 1.5em;
}

ul li {
    margin: 0.5em 0;
}

ol li {
    list-style: decimal;
}

a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease-in-out;
}

a:hover {
    text-decoration: underline;
    color: #2980b9;
}

abbr[title] {
    cursor: help;
    position: relative;
}

/* Tooltip styles */
abbr[title]::after {
    content: attr(title);
    position: absolute;
    background: #333;
    color: #fff;
    border-radius: 0.5em;
    white-space: nowrap;
    display: none;
    left: 50%; /* Center the tooltip */
    transform: translateX(-50%) scale(0.5) translateY(50%);
    bottom: 1.5em; /* Position above the element */
}

abbr[title]:hover::after {
    display: block;
    z-index: 10;
}

/* Animations */
@keyframes fadeInExpand {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10%);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%) scaleY(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scaleY(1);
        opacity: 1;
    }
}

/* Respecting prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none;
        transition: none;
    }
}

/* Tablet styles */
@media (min-width: 600px) {
    nav ul {
        flex-direction: row;
        justify-content: center;
    }

    nav ul li {
        margin: 0 1em;
    }

    article {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Desktop styles */
@media (min-width: 992px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1em 2em;
    }

    header h1, header h2 {
        margin: 0.5em 0;
    }

    nav ul {
        flex-direction: row;
        justify-content: space-between;
        max-width: 800px;
        margin: 0 auto;
    }

    article {
        max-width: 800px;
        margin: 0 auto; /* Center the article on desktop */
    }
}
