/* index.css – auto.pub /en/css/ */

/* ===== ÜLDISED STIILID ===== */
body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f8f8f8;
}

.page-wrapper {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

main {
    padding: 0 20px 30px;
    margin-top: 5px;
}

/* ===== KATEGOORIA PEALKIRI ===== */
.news-category {
    margin-bottom: 28px;
}

.news-category h2 {
    border-bottom: 2px solid red;
    padding-bottom: 5px;
    margin-bottom: 14px;
    font-family: Arial, sans-serif;
    font-size: 1.15em;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.news-category h2 a {
    color: black;
    text-decoration: none;
}

.news-category h2 a:hover {
    color: red;
}

/* ===== NEWS GRID ===== */
.news-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

/* ===== ÜKSIK KAART ===== */
.news-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.news-item a,
.news-item a:visited,
.news-link,
.news-link:visited {
    text-decoration: none;
    color: inherit;
    display: block;
}

.news-item a:hover .news-title span {
    text-decoration: underline;
}

/* Esimene suur kaart */
.news-item.first-large {
    grid-column: span 2;
    height: 280px;
}

.news-item.first-large img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

/* Tavalised kaardid */
.news-item:not(.first-large) img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 5px 5px 0 0;
    display: block;
}

/* ===== PEALKIRJAD ===== */
.news-title {
    font-family: Arial, sans-serif;
    font-size: 1em;
    font-weight: normal;
    line-height: 1.4;
    color: #111;
    padding: 8px 10px 10px;
    margin: 0;
    box-sizing: border-box;
    background-color: transparent;
}

/* NB: line-clamp on eraldi span'i peal, sest padding samal elemendil laseb
   mõnes brauseris neljanda rea ellipsi alt läbi. Jah, CSS oskab ka huumorit teha. */
.news-title span {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1em * 1.4 * 3);
}

/* Esimese suure kaardi pealkiri (overlay) */
.news-item.first-large .news-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: white;
    background-color: rgba(128, 128, 128, 0.7);
    padding: 10px;
    border-radius: 0 0 5px 5px;
}

.news-item.first-large .news-title span {
    -webkit-line-clamp: 2;
    max-height: calc(1em * 1.4 * 2);
}

/* ===== FOOTER ===== */
footer {
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
    color: #555;
    text-align: center;
    padding: 14px 20px;
    font-size: 0.88em;
    font-family: Arial, sans-serif;
    margin-top: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .news-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1000px) {
    .news-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 800px) {
    .news-container {
        grid-template-columns: repeat(3, 1fr);
    }
    .news-item.first-large {
        height: 220px;
    }
    .news-item.first-large img {
        height: 220px;
    }
}

@media (max-width: 600px) {
    main {
        padding: 0 10px 20px;
    }
    .news-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .news-item:not(.first-large) img {
        height: 110px;
    }
    .news-title {
        font-size: 0.88em;
        padding: 6px 8px 8px;
    }
    .news-title span {
        max-height: calc(1em * 1.4 * 3);
    }
    .news-item.first-large {
        height: 200px;
        grid-column: span 2;
    }
    .news-item.first-large img {
        height: 200px;
    }
}

@media (max-width: 400px) {
    .news-container {
        grid-template-columns: 1fr;
    }
    .news-item.first-large {
        grid-column: span 1;
        height: 180px;
    }
    .news-item.first-large img {
        height: 180px;
    }
    /* Overlay kaob väiksel mobiilil, pealkiri läheb alla */
    .news-item.first-large .news-title {
        position: static;
        background-color: transparent;
        color: #111;
        border-radius: 0;
    }
    .news-item.first-large .news-title span {
        -webkit-line-clamp: 3;
        max-height: calc(1em * 1.4 * 3);
    }
}
