/*=============== GOOGLE FONTS ===============*/
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;900&display=swap');

/*=============== VARIÁVEIS ===============*/
:root {
    --header-height: 3.5rem;
    --body-font: 'Poppins', sans-serif;

    /* Cores */
    --first-color: #0a9396;
    --first-color-alt: #005f73;
    --accent-color: #ee9b00;
    --bg-dark: #1a2d3c;
    --title-color: #1a2d3c;
    --text-color: #4a4a4a;
    --body-color: #f4f7fa;
    --container-color: #ffffff;
    --shadow: hsla(0, 0%, 15%, 0.1);

    /* Tipografia */
    --biggest-font-size: 2.8rem;
    --h1-font-size: 2rem;
    --h2-font-size: 1.5rem;
    --h3-font-size: 1.25rem;
    --normal-font-size: 1rem;
    --small-font-size: 0.875rem;
    --smaller-font-size: 0.813rem;

    --font-medium: 500;
    --font-bold: 600;
    --z-tooltip: 10;
    --z-fixed: 100;
}

/* Responsive typography */
@media screen and (max-width: 992px) {
    :root {
        --biggest-font-size: 2rem;
        --h1-font-size: 1.5rem;
        --h2-font-size: 1.25rem;
        --h3-font-size: 1rem;
        --normal-font-size: 0.938rem;
    }
}

/*=============== BASE ===============*/
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body,
button,
input {
    font-family: var(--body-font);
    font-size: var(--normal-font-size);
}
body {
    background-color: var(--body-color);
    color: var(--text-color);
}
h1, h2, h3, h4 {
    color: var(--title-color);
    font-weight: var(--font-medium);
}
ul {
    list-style: none;
}
a {
    text-decoration: none;
}
img {
    max-width: 100%;
    height: auto;
}
button {
    cursor: pointer;
    border: none;
    outline: none;
}

/*=============== LAYOUT ===============*/
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0.5rem; /* padding fixo e mínimo em todos os ecrãs */
}
.grid {
    display: grid;
}
.section {
    padding: 1rem 0;
}

/*=============== BOTÕES ===============*/
.button {
    display: inline-block;
    background: var(--first-color);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: var(--font-medium);
    transition: 0.3s;
}
.button:hover {
    background: var(--first-color-alt);
}

/* ============== HEADER ============== */
/* --- Linha superior (Logo + Pesquisa) --- */
.header__top {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.2rem 0;
    position: relative;
}
.header__logo {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--title-color);
    letter-spacing: -1px;
    text-align: center;
    flex: 1;
}
.header__search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--small-font-size);
    position: absolute;
    right: 0;
}
.header__search input {
    border: 1px solid hsl(250, 12%, 80%);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    outline: none;
    width: 120px;
    font-size: var(--small-font-size);
}
.header__search span {
    font-size: var(--small-font-size);
}

/* --- Linha inferior (Menu) --- */
.nav__menu {
    background-color: var(--bg-dark);
    padding: 0.8rem 0;
    width: 100%;
}
.nav__list {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.nav__link {
    color: #fff;
    font-size: var(--small-font-size);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    transition: 0.3s;
}
.nav__link:hover {
    color: var(--accent-color);
}

/*=============== 1. PUBLICIDADE SLIDE ===============*/
.ad-slide__item {
    position: relative;
    overflow: hidden;          /* garante que a imagem não vaze */
    border-radius: 0.5rem;
}

.ad-slide__item img {
    width: 100%;
    height: 250px;             /* altura fixa reduzida (ajuste conforme desejar) */
    object-fit: cover;         /* mantém a proporção e corta o excesso */
    display: block;
    border-radius: 0.5rem;
}

.ad-slide__overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
}

.ad-slide__overlay h3 {
    color: #fff;
    font-size: var(--h3-font-size);
}
/* ============== 3. NOTÍCIA PRINCIPAL (Hero) ============== */

/* --- Grelha principal (2 colunas: 90% / 10%) --- */
.hero-news__grid {
    display: grid;
    grid-template-columns: 4fr 1fr;  /* 90% para a coluna principal, 10% para as thumbs */
    gap: 1.5rem;
    align-items: start;
    width: 100%;
}

/* --- Coluna principal: texto + imagem lado a lado --- */
.hero-news__main {
    display: grid;
    grid-template-columns: 1fr 2fr;  /* texto ocupa 1 parte, imagem 2 partes */
    gap: 1.5rem;
    align-items: start;
}

/* --- Texto --- */
.hero-news__text {
    padding-left: 0.5rem;
}

.hero-news__title {
    font-size: var(--h1-font-size);
    margin-bottom: 0.5rem;
}

.hero-news__excerpt {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* --- Imagem principal --- */
.hero-news__image-main {
    position: relative;
}

.hero-news__image-main img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
}

/* Legenda sobre a imagem */
.hero-news__image-caption {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    color: #fff;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-news__caption-tag {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    font-size: var(--smaller-font-size);
    font-weight: var(--font-bold);
    padding: 0.1rem 0.6rem;
    border-radius: 0.2rem;
    text-transform: uppercase;
}

.hero-news__image-caption h4 {
    display: inline;
    color: #fff;
    font-size: var(--normal-font-size);
    margin: 0;
}

/* --- Thumbnails (coluna direita, 10%) --- */
.hero-news__thumbnails {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.hero-news__thumb {
    display: flex;
    flex-direction: row;
    align-items: stretch;     /* estica o texto para a mesma altura da imagem */
    gap: 0.5rem;
    transition: 0.3s;
    cursor: pointer;
}

.hero-news__thumb:hover {
    opacity: 0.8;
}

.hero-news__thumb img {
    width: 65%;
    height: 8rem;             /* altura fixa da imagem (pode ajustar) */
    object-fit: cover;
    border-radius: 0.3rem;
    flex-shrink: 0;
    transition: 0.3s;
}

.hero-news__thumb img:hover {
    transform: scale(1.05);
}

.hero-news__thumb-label {
    font-size: var(--small-font-size);
    color: var(--title-color);
    font-weight: var(--font-medium);
    line-height: 1.4;
    word-wrap: break-word;    /* quebra palavras longas */
    overflow-wrap: break-word;
    display: flex;
    align-items: top and center;      /* centraliza verticalmente o texto (opcional) */
    flex: 1;                  /* ocupa o espaço restante */
    /* removido white-space, overflow, text-overflow */
}
/*=============== 4. COMUNIDADES SLIDE ===============*/
.community-slide__item {
    position: relative;
}
.community-slide__item img {
    width: 100%;
    border-radius: 0.5rem;
}
.community-slide__caption {
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 0.5rem 1rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* ============== GRELHA DE 4 NOTÍCIAS (3 normais + 1 opinião) ============== */

/* --- Grelha principal (2 colunas: 90% / 10%) --- */
.grid-news__grid {
    display: grid;
    grid-template-columns: 4fr 1fr;  /* 90% para os 3 normais, 10% para o especial */
    gap: 1.5rem;
    align-items: start;
    width: 100%;
}

/* --- Coluna principal: 3 cards normais lado a lado --- */
.grid-news__main {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 colunas iguais */
    gap: 1.5rem;
    align-items: start;
}

/* --- Coluna do card especial (opinião) --- */
.grid-news__featured-col {
    display: flex;
    flex-direction: column;
    height: 100%;   /* para ocupar toda a altura disponível */
}

/* --- Cards base --- */
.grid-news__card {
    background: var(--container-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    overflow: hidden;
    transition: 0.3s;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.grid-news__card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow);
}

/* --- Imagem --- */
.grid-news__img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: 0.5s;
}

.grid-news__card:hover .grid-news__img {
    transform: scale(1.05);
}

/* --- Texto --- */
.grid-news__card h4 {
    font-size: var(--h3-font-size);
    margin: 1rem 1rem 0.3rem 1rem;
}

.grid-news__sub {
    font-size: var(--small-font-size);
    color: var(--text-color);
    opacity: 0.7;
    margin: 0 1rem 1rem 1rem;
}

/* --- Card especial de opinião (último) --- */
.grid-news__card--featured {
    background: var(--first-color-alt);
    color: #fff;
    flex: 1;                 /* cresce para ocupar toda a altura da coluna */
    max-height: 320px;       /* altura extra para destacar */
    max-width:95% ;
}

.grid-news__card--featured h4,
.grid-news__card--featured .grid-news__sub {
    color: #fff;
}

.grid-news__card--featured .grid-news__sub {
    opacity: 0.8;
}

.grid-news__card--featured .grid-news__img {
    height: 140px;           /* imagem maior */
}

/* --- Badge "Opinião" --- */
.opinion-badge {
    background: var(--accent-color);
    color: #fff;
    padding: 0.2rem 0.8rem;
    border-radius: 0.2rem;
    font-size: var(--smaller-font-size);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    align-self: flex-start;
    margin: 1rem 1rem 0 1rem;
}

/* --- Botão do especial --- */
.button--small {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    padding: 0.4rem 1.2rem;
    border-radius: 0.3rem;
    font-size: var(--small-font-size);
    font-weight: var(--font-bold);
    margin: 0 1rem 1rem 1rem;
    transition: 0.3s;
    align-self: flex-start;
}

.button--small:hover {
    background: #d48900;
    transform: scale(1.05);
}

/* --- Remover o wrapper antigo (já não é necessário) --- */
/* .grid-news__wrapper { ... }  pode ser removido */


/* ============== 6. PUBLICIDADE FIXA ============== */

/* --- Grelha principal (90% / 10%) --- */
.ad-fixed__grid {
    display: grid;
    grid-template-columns: 4fr 1fr;  /* 40% para o conteúdo, 10% para a imagem */
    gap: 1.5rem;
    align-items:  center;
    width: 100%;
}

/* --- Conteúdo da publicidade --- */
.ad-fixed__box {
    background: #e9ecef;
    padding: 2rem;
    text-align: center;
    border-radius: 0.5rem;
    border: 2px dashed #adb5bd;
}

.ad-fixed__label {
    display: block;
    font-size: var(--small-font-size);
    font-weight: var(--font-bold);
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.ad-fixed__box h3 {
    font-size: var(--h2-font-size);
    color: var(--title-color);
}

/* --- Imagem lateral (10%) --- */
.ad-fixed__image img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
}

/*=============== 7. GRELHA 4 NOTÍCIAS ===============*/
.grid-news-secondary__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.grid-news-secondary__card {
    background: var(--container-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
}
.grid-news-secondary__card h4 {
    font-size: var(--h3-font-size);
}

/*=============== 8. ARTIGO OPINIÃO ===============*/
.opinion-article__wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: center;
    background: var(--container-color);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
}
.opinion-article__author {
    font-weight: var(--font-bold);
    color: var(--first-color);
    margin-bottom: 0.5rem;
}
.opinion-article__excerpt {
    margin-bottom: 1rem;
}
.opinion-article__image img {
    width: 100%;
    border-radius: 50%;
    max-width: 200px;
    margin: 0 auto;
    display: block;
}

/*=============== 9. COLUNAS ===============*/
.columns__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.columns__card {
    background: var(--container-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
}
.columns__author {
    color: var(--first-color);
    font-weight: var(--font-medium);
}

/*=============== FOOTER ===============*/
.footer {
    padding-top: 3rem;
}
.footer__container {
    grid-template-columns: repeat(4, 1fr);
    justify-items: center;
    gap: 1.5rem;
}
.footer__title {
    font-size: var(--h3-font-size);
    margin-bottom: 1rem;
}
.footer__link {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}
.footer__copy {
    display: block;
    text-align: center;
    margin-top: 2rem;
    font-size: var(--small-font-size);
    color: var(--text-color);
}

/* ============== RESPONSIVIDADE ============== */

/* Tablets e telemóveis grandes */
@media screen and (max-width: 992px) {
    .hero-news__grid {
        grid-template-columns: 1fr;
    }
    .hero-news__main {
        grid-template-columns: 1fr;
    }
    .hero-news__thumbnails {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }
    .hero-news__thumb {
        flex: 1 1 30%;
        max-width: 30%;
        flex-direction: column;  /* em mobile, imagem em cima, texto em baixo */
        align-items: center;
        text-align: center;
        background: var(--container-color);
        padding: 0.5rem;
        border-radius: 0.3rem;
        box-shadow: 0 2px 6px var(--shadow);
    }
    .hero-news__thumb img {
        width: 100%;
        height: auto;
        max-height: 80px;
    }
    .hero-news__thumb-label {
        white-space: normal;
        word-wrap: break-word;
        text-align: center;
        font-size: var(--smaller-font-size);
    }

    .grid-news__grid {
        grid-template-columns: 1fr;
    }
    .grid-news__main {
        grid-template-columns: 1fr;
    }
    .grid-news__featured-col {
        height: auto;
    }
    .grid-news__card--featured {
        max-height: none;
        max-width: 100%;
    }

    .ad-fixed__grid {
        grid-template-columns: 1fr;
    }
    .ad-fixed__image {
        display: none;
    }

    .opinion-article__wrapper {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .opinion-article__image img {
        max-width: 150px;
    }

    .columns__grid {
        grid-template-columns: 1fr;
    }
    .footer__container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Telemóveis pequenos */
@media screen and (max-width: 480px) {
    .header__top {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.2rem 0;
    }
    .header__logo {
        font-size: 1.8rem;
    }
    .header__search {
        position: static;
        width: 100%;
        justify-content: center;
        gap: 0.3rem;
        padding: 0 0.5rem; /* dá algum respiro lateral */
    }
    .header__search input {
        width: 100%;
        max-width: 220px;      /* largura máxima para não esticar demasiado */
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        border-radius: 0.3rem;
        flex: 0 1 auto;       /* não força o crescimento */
    }
    .header__search span {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Nav com scroll horizontal */
    .nav__menu {
        padding: 0.4rem 0;
    }
    .nav__list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding: 0 0.2rem;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .nav__list::-webkit-scrollbar {
        display: none;
    }
    .nav__link {
        font-size: 0.65rem;
        white-space: nowrap;
        padding: 0.2rem 0.4rem;
    }

    /* resto dos ajustes (já existentes) */
    .ad-slide__item img {
        height: 150px;
    }
    .hero-news__thumb {
        flex: 1 1 45%;
        max-width: 45%;
    }
    .grid-news__img {
        height: 150px;
    }
    .grid-news__card--featured .grid-news__img {
        height: 180px;
    }
    .ad-fixed__box {
        padding: 1rem;
    }
    .ad-fixed__box h3 {
        font-size: var(--h3-font-size);
    }
    .opinion-article__wrapper {
        padding: 1rem;
    }
    .opinion-article__image img {
        max-width: 120px;
    }
    .footer__container {
        grid-template-columns: 1fr;
        text-align: center;
    }
}



/* ============== TABLET (768px - 992px) ============== */
@media screen and (min-width: 768px) and (max-width: 992px) {

    /* --- Header --- */
    .header__top {
        flex-direction: row;
        justify-content: space-between;
        padding: 0.5rem 0;
    }
    .header__logo {
        font-size: 2rem;
        flex: 0 1 auto;
    }
    .header__search {
        position: static;
        gap: 0.5rem;
    }
    .header__search input {
        width: 140px;
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
    }

    /* --- Nav --- */
    .nav__list {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        gap: 1rem;
        scrollbar-width: none;
    }
    .nav__list::-webkit-scrollbar {
        display: none;
    }
    .nav__link {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    /* --- Hero (Notícia Principal) --- */
    .hero-news__grid {
        grid-template-columns: 4fr 1fr; /* mantém 90%/10% */
        gap: 1rem;
    }
    .hero-news__main {
        grid-template-columns: 1fr 1.5fr; /* texto ligeiramente mais estreito */
        gap: 1rem;
    }
    .hero-news__text {
        padding-left: 0;
    }
    .hero-news__thumbnails {
        gap: 0.6rem;
    }
    .hero-news__thumb {
        flex-direction: row; /* imagem e texto lado a lado novamente */
        align-items: center;
        gap: 0.5rem;
        background: none;
        padding: 0;
        box-shadow: none;
    }
    .hero-news__thumb img {
        width: 50%;
        height: 5rem;
        max-height: 80px;
    }
    .hero-news__thumb-label {
        font-size: 0.7rem;
        text-align: left;
        white-space: normal;
        word-wrap: break-word;
    }

    /* --- Grelha de 4 notícias --- */
    .grid-news__grid {
        grid-template-columns: 4fr 1fr;
        gap: 1rem;
    }
    .grid-news__main {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    .grid-news__card--featured {
        max-height: none;
        max-width: 100%;
    }
    .grid-news__img {
        height: 150px;
    }
    .grid-news__card--featured .grid-news__img {
        height: 180px;
    }

    /* --- Publicidade Fixa --- */
    .ad-fixed__grid {
        grid-template-columns: 4fr 1fr;
        gap: 1rem;
    }
    .ad-fixed__image {
        display: block;
    }
    .ad-fixed__image img {
        max-height: 120px;
        object-fit: cover;
    }

    /* --- Artigo Opinião --- */
    .opinion-article__wrapper {
        grid-template-columns: 1.5fr 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    .opinion-article__image img {
        max-width: 150px;
    }

    /* --- Colunas --- */
    .columns__grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    /* --- Footer --- */
    .footer__container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        justify-items: start;
    }
}