@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
:root {
    --Soft-orange: hsl(35, 77%, 62%);
    --Soft-red: hsl(5, 85%, 63%);
    --Off-white: hsl(36, 100%, 99%);
    --Grayish-blue: hsl(233, 8%, 79%);
    --Dark-grayish-blue: hsl(236, 13%, 42%);
    --Very-dark-blue: hsl(240, 100%, 5%);
    /*   Weights: 400, 700, 800 */
}
html {
    font-size: 15px;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: "Inter", sans-serif;
    color: var(--Very-dark-blue);
    overflow-x: hidden; /* evita scroll lateral */
}
.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.8rem 1rem; 
    display: grid;
    gap: 1.9rem;
    grid-template-areas:"header"
                        "main"
                        "sidebar"
                        "most-viewed-articles";
}
.header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
}
.logo__img {
    height: 1.8rem;
}
.btnMenu {
    cursor: pointer;
    &:hover {
        g{
            fill: var(--Soft-red);
        }
    }
}
.nav {
    position:absolute;
    right: 0;
    top: 0;
    background: #fff;
    width: 68%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    transform: translateX(100%);
    padding: 17vh 1.5rem; 
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px); /* desenfoque del fondo */
    z-index: 2; /* se superpone por encima del backdrop */
}
.nav__link {
    color: var(--Very-dark-blue);
    text-decoration: none;
    font-size: 1.2rem;
    &:hover{
        color: var(--Soft-red);
    }
}
.nav.active {
    transform: translateX(0);
}
.btnCloseMenu{
    position: absolute;
    top: 1.8rem; 
    right: 1.33rem; 
    cursor: pointer;

    &:hover {
        g{
            fill: var(--Soft-red);
        }
    }
}
.backdrop {               /* se crea en el DOM*/
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.main {
    grid-area: main;
    display: grid;
    gap: 1.1rem;  
    grid-template-areas:"main__img"
                        "main__title"
                        "main__description"
                        "main__button";
    margin-bottom: 2.5rem; 
}
.main__img {
    grid-area: main__img;
    img {
        width: 100%;
    }
}
.main__title {
    grid-area: main__title;
    font-weight: 800;
    /* font-size: 2.8rem; */
    font-size: clamp(2.8rem, 1.8rem + 1vw , 4rem);
    line-height: 1; 
}
.main__description {
    grid-area: main__description;
    color: var(--Dark-grayish-blue);
    line-height: 1.75;   
}
.main__button {
    grid-area: main__button;
    text-decoration: none;
    background: var(--Soft-red);
    color: var(--Very-dark-blue);
    text-transform: uppercase;
    letter-spacing: 0.25rem;
    font-weight: 800;
    padding: 1rem 2rem;
    justify-self: self-start;
    align-self: self-start;
    transition: all 0.3s ease;
    
    &:hover {
        color: var(--Off-white);
        background: var(--Very-dark-blue);
    }
}

.sidebar {
    grid-area: sidebar;
    background: var(--Very-dark-blue);
    padding: 1.4rem;
    margin-bottom: 2.5rem; 
}
.title-sidebar {
    color: var(--Soft-orange);
    font-size: 2.3rem; 
}
.sidebar-article {
    padding: 2rem 0;
    border-bottom: 1px solid var(--Dark-grayish-blue);
    cursor: pointer;

    &:hover .sidebar__title {
        color: var(--Soft-orange);
    }
}
.sidebar-article:last-child {
    padding-bottom: 0.2rem;
    border-bottom: none;
}
.sidebar__title {
    color: var(--Off-white);
    font-weight: 700;
    font-size: 1.38rem;
    margin-bottom: 0.4rem;  
}
.sidebar__description {
    color: var(--Grayish-blue);
    line-height: 1.75;   
}

.most-viewed-articles {
    grid-area: most-viewed-articles;
    display: grid;
    gap: 2.3rem;
    margin-bottom: 2rem;
}
.top-article {
    display: grid;
    grid-template-areas:"top__img top__number"
                        "top__img top__title"
                        "top__img top__description";
    gap: 0.5rem 1rem;  
    grid-template-columns: 1fr 2fr;
    cursor: pointer;

    &:hover .top__title {
        color: var(--Soft-red);
    }
}
.top__img {
    grid-area: top__img;
    display: block;
    width: 90%;
}
.top__number {
    grid-area: top__number;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--Soft-red);
    line-height: 1;
}
.top__title {
    grid-area: top__title;
    font-weight: 800;
    font-size: 1.21rem;
}
.top__description {
    grid-area: top__description;
    line-height: 1.75;   
}
@media screen and (min-width: 800px) {
    .btnMenu,
    .btnCloseMenu {
        display: none;
    }
    .nav {
        position: static;
        flex-direction: row;
        background: none;
        height: auto;
        width: auto;
        padding: 0;
        transform: none;
    }
    .nav__link {
        color: var(--Very-dark-blue);
    }
    .most-viewed-articles {
        grid-template-columns: repeat(3, 1fr);
    }
    .main {
        grid-template-areas:"main__img main__img"
                            "main__title main__description"
                            "main__title main__button";
    }
    .main__title {
        align-self: center;
    }
}

@media screen and (min-width: 1024px) {
    .container {
        margin-top: 4.2rem; 
        grid-template-areas:"header header header"
                            "main main sidebar"
                            "most-viewed-articles most-viewed-articles most-viewed-articles"
        ;
    }
    .header {
        margin-bottom: 1.6rem;  
    }
    .logo__img {
        height: 2.5rem;
    }
    .nav {
        gap: 2.6rem;    
    }
    .nav__link {
        font-size: 1rem;
    }
    .main {
        gap: 2rem;
    }
    .main__title {
        font-size: 3.8rem;
    }
}