@layer animation {
    .avatar,
    #hero,
    #about,
    #work,
    #writing,
    #gallery,
    #music,
    #social {
        animation: fadeInUp 0.6s ease forwards;
        opacity: 0;
        animation-delay: var(--delay, 0.1s);
    }

    #avatar  { --delay: 0.2s }
    #hero    { --delay: 0.3s }
    #about   { --delay: 0.4s }
    #work    { --delay: 0.5s }
    #writing { --delay: 0.6s }
    #gallery { --delay: 0.7s }
    #music   { --delay: 0.8s }
    #social  { --delay: 0.9s }
}

@layer ryhthm {
    #hero,
    #about,
    #work,
    #writing,
    #gallery,
    #music,
    #social {
        margin-top: 188px;
    }

    #social {
        margin-bottom: 188px;
    }
}

.avatar > img:hover {
    transform: scale(1.5);
}
.avatar > img {
    width: 28px;
    border-radius: 100%;
    transition-duration: 0.3s;
}

#hero h1,
#hero h2 {
    font-size: 17px;
    font-weight: 400;
}

#about {
    border-top: 1px solid var(--border);
    font-size: 15px;
    color: rgba(255,255,255,0.4);
    padding-top: 12px;
    line-height: 1.4;
    transition: color 0.3s ease-in-out;
}

#about:hover {
    color: white;
}

#about a {
    color: rgba(255,255,255,0.7);
    text-decoration: underline;
}

#gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border);
}

#gallery figure {
    margin: 0;
    height: 374px;
    overflow: hidden;
}

#gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#gallery figure:last-child {
    grid-column: span 2;
}

/* Mueve el grid al párrafo que contiene los links */
#music p {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin: 0;
}

/* El <a> ahora hace la función del antiguo 'figure' */
#music p a {
    display: block;
    height: 374px;
    overflow: hidden;
}

#music img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease-in-out;
}

#music img:hover {
    opacity: 0.5;
}

@layer components {
    .ui-list {
        display: flex;
        border-top: 1px solid var(--border);
        align-items: baseline;
        gap: 0rem;
    }

    .ui-list > *:first-child {
        flex: 1;
        margin: 0;
        color: rgba(255,255,255,0.7)
    }

    .ui-list ul {
        flex: 2;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .ui-list ul li {
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 0;
        position: relative;
    }

    .ui-list ul > li:last-child {
        border-bottom: none;
    }

    .ui-list ul li a {
        color: rgba(255,255,255,0.5);
        transition: color 0.3s ease-in-out;
    }

    .ui-list.internal ul li::after,
    .ui-list.external ul li::after {
        position: absolute;
        font-weight: 100;
        top: 10px;
        right: 0;
        width: 15px;
        height: 26px;
        color: rgba(255,255,255,0.5);
        font-family: var(--system-fonts)
    }

    .ui-list.external ul li::after {
        content: '\2197';
    }
    .ui-list.internal ul li::after {
        content: '\2198';
    }

    .ui-list:has(li:hover) li a {
        opacity: 0.4;
    }

    .ui-list:has(li:hover) li:hover a {
        opacity: 1;
        color: white;
    }
}
