@import url(./assets/variables.css);

*,
*::before,
*::after {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

body {
    background-color: var(--Grey-200);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

main {
    background-color: var(--White);
    width: 90%;
    border-radius: .75em;
    overflow: hidden;
    min-width: 18.75rem;
    max-width: 25rem;
    display: grid;
    grid-template-columns: 1fr;

    & .header {
        & .header__img {
            display: block;
            width: 100%;
            height: 13.75rem;
            object-fit:cover;
            object-position: top;
            
        }
    }
    

    & .article__container{
        display: flex;
        flex-direction: column;
        gap: 1.875em;
        & .article {
            display: flex;
            flex-direction: column;
            gap: 1.5em;
            font-family: var(--Manrope);
            padding: 1.25em;
            padding-bottom: 0em;
            & .article__title {
                font-weight: 800;
                font-size: clamp(1.25rem, 3vw, 1.5781rem);
                color: var(--Grey-900);
                text-wrap: balance;
            }

            & .article__description {
                font-weight: 600;
                font-size: clamp(.8125rem, 3vw, 1.125rem);
                color: var(--Grey-500);
                line-height: 1.6;
                text-wrap: pretty;
            }
        }

        & .personal__information {
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
            padding: 1.25em; 

            & .profile__data {
                display: flex;
                gap: 1em;
                font-family: var(--Manrope);
                align-items: center;
                

                & .user__photo {
                    width: 40px;
                    height: 40px;
                    border-radius: 50%;
                }

                & .name {
                    color: var(--Grey-900);
                    font-size: clamp(.8125rem, 3vw, 1.125rem);
                    font-weight: 800;
                    display: flex;
                    flex-direction: column;

                    & .date{
                        font-weight: 600;
                        color: var(--Grey-400);
                        font-size: clamp(.8125rem, 3vw, 1rem);
                    }
                }
            }

            & .button__share {
                display: block;
                width: 2rem;
                height: 2rem;
                border: none;
                border-radius: 50%;
                z-index: 10;

                &.active {
                    background-color: var(--Grey-500);
                }

                &.active #iconShare path{
                    fill: var(--White);
                }
            }

            & #buttonShare {
                cursor: pointer;
                transition: background-color 0.4s ease;

                & #iconShare path{
                    transition: fill 0.4s ease;
                }
            }

            & .popover {
                position: absolute;
                background-color: var(--Grey-900);
                width: 100%;
                height: 100%;
                bottom: 0;
                left: 0;
                display: flex;
                align-items: center;
                gap: 1.5em;
                padding: 1.25em;
                opacity: 0;
                visibility: hidden;

                &.active{
                    background-color: var(--Grey-900);
                    opacity: 1;
                    visibility: visible;

                }

                & span {
                    color: var(--Grey-400);
                    font-family: var(--Manrope);
                    font-weight: 600;
                    font-size: .8125em;
                    font-size: clamp(.8125rem, 3vw, 1.0625rem);
                    letter-spacing: .25em;
                }

                & .popover__icons {
                    display: flex;
                    gap: 16px;
                    align-items: center;
                }
            }

            & #popover {
                transition: all 0.6s ease;
            }
        }

        
    }

    @media screen and (min-width:46.25rem) {
        & {
            grid-template-columns: 36% 1fr;
            max-width: 47.5rem;
            overflow: visible;

            & .header{
                & .header__img{
                    height: 100%;
                    object-fit: fill;
                    overflow-x: hidden;
                    object-position: 50px;
                    transform: translateX(-50px);
                }
            }

            & .article__container {
                padding: 2.05em 2.25em;
                margin-left: -2.5em;

                & .article {
                    padding: 0;
                }
                & .personal__information {
                    padding: 0;
                    & .popover {
                        width: 14.0625rem;
                        height: 3.125rem;
                        justify-content: center;
                        border-radius: 12px;
                        padding: 8px 12px;
                        transform: translateX(clamp(15rem, 
                        35vw, 20.3125rem)), translateY(0);
                        transition: transform 0.25s ease;

                        &.active{
                            transform: translateX(clamp(15rem, 35vw, 20.3125rem)) translateY(-5rem);

                            &::after{
                                opacity: 1;
                                transform: translateY(0);
                            }
                        }

                        &::after{
                            content: '';
                            opacity: 0; 
                            transform: translateY(10px);
                            position: absolute;
                            bottom: -28px;
                            border-top: 15px solid var(--Grey-900) ;
                            border-right: 15px solid transparent;
                            border-bottom: 15px solid transparent;
                            border-left: 15px solid transparent;
                            transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
                        }
                    }
                }
            }
        }
    }
}