/* News section and card modifiers */

/* Section spacing for news/nyheter sections */
.section-nyheter,
.section-news{
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* News grid: 1 column on mobile, 2 columns on desktop */
.section-nyheter .card-grid,
.section-news  .card-grid{
  position: relative;
  --col-gap: 2rem;
  gap: var(--col-gap);
  grid-template-columns: 1fr;          /* mobile: 1 per row */
}
@media (min-width: 992px){
  .section-nyheter .card-grid,
  .section-news  .card-grid{
    grid-template-columns: repeat(2, 1fr);  /* desktop: 2 per row */
  }
}

/* Ensure each grid item stretches equal height and can carry its own lines */
.section-nyheter .card-grid > *,
.section-news  .card-grid > *{
  position: relative;
  align-self: stretch;
}

/* TOP line (row 1): draw 1px line on top of items 1–2 */
@media (min-width: 992px){
  .section-nyheter .card-grid > :nth-child(-n+2)::before,
  .section-news  .card-grid > :nth-child(-n+2)::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;              /* line follows column width → break in the middle */
    right: 0;
    height: 1px;
    background: var(--divider-color);
    pointer-events: none;
  }
}

/* MIDDLE line (between row 1 and 2, i.e. from item 3 onwards) */
@media (min-width: 992px){
  .section-nyheter .card-grid > :nth-child(n+3)::before,
  .section-news  .card-grid > :nth-child(n+3)::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--divider-color);
    pointer-events: none;
  }
}

/* BOTTOM line (last row: last two items) */
@media (min-width: 992px){
  .section-nyheter .card-grid > :nth-last-child(-n+2)::after,
  .section-news  .card-grid > :nth-last-child(-n+2)::after{
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;             /* follows column width → break in the middle */
    right: 0;
    height: 1px;
    background: var(--divider-color);
    pointer-events: none;
  }
}

/* News card: fill cell height and top align content */
.section-nyheter .news-card,
.section-news  .news-card{
  border: 0;                      /* no own border → no double lines */
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  display: flex;
  flex-direction: column;         /* mobile */
  height: 100%;                   /* equal height cards per row */
}
@media (min-width: 768px){
  .section-nyheter .news-card,
  .section-news  .news-card{
    flex-direction: row;          /* desktop: image | text */
    align-items: flex-start;      /* top align */
  }
  .section-nyheter .news-card__media,
  .section-news  .news-card__media{
    flex: 0 0 40%;
    max-width: 40%;
  }
  .section-nyheter .news-card__body,
  .section-news  .news-card__body{
    flex: 1 1 auto;
    padding: 0 0 0 1.25rem;       /* no top padding → title in line with image top */
  }
}

/* News typography + link behaviour (remove underline, also on hover/focus/visited) */
.section-nyheter .news-card__title,
.section-news  .news-card__title{
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 24px;
  color: #611037;
  margin: 0 0 .25rem 0;           /* exact top alignment with image */
  text-decoration: none;
}
.section-nyheter .news-card__title a,
.section-news  .news-card__title a,
.section-nyheter .news-card a.news-card__link,
.section-news  .news-card a.news-card__link,
.section-nyheter .news-card a.stretched-link,
.section-news  .news-card a.stretched-link{
  color: inherit !important;
  text-decoration: none !important;
}
.section-nyheter .news-card__title a:hover,
.section-nyheter .news-card__title a:focus,
.section-nyheter .news-card__title a:active,
.section-nyheter .news-card__title a:visited,
.section-news  .news-card__title a:hover,
.section-news  .news-card__title a:focus,
.section-news  .news-card__title a:active,
.section-news  .news-card__title a:visited,
.section-nyheter .news-card a.news-card__link:hover,
.section-nyheter .news-card a.news-card__link:focus,
.section-nyheter .news-card a.news-card__link:active,
.section-nyheter .news-card a.news-card__link:visited,
.section-news  .news-card a.news-card__link:hover,
.section-news  .news-card a.news-card__link:focus,
.section-news  .news-card a.news-card__link:active,
.section-news  .news-card a.news-card__link:visited,
.section-nyheter .news-card a.stretched-link:hover,
.section-nyheter .news-card a.stretched-link:focus,
.section-nyheter .news-card a.stretched-link:active,
.section-nyheter .news-card a.stretched-link:visited,
.section-news  .news-card a.stretched-link:hover,
.section-news  .news-card a.stretched-link:focus,
.section-news  .news-card a.stretched-link:active,
.section-news  .news-card a.stretched-link:visited{
  color: inherit !important;
  text-decoration: none !important;
}

.section-nyheter .news-card__text p,
.section-news  .news-card__text p{
  font-size: 17px;
  line-height: 24px;
  margin: 0;
}

/* Ensure grid-gap controls vertical spacing between cards */
.section-nyheter .card-grid > *,
.section-news  .card-grid > *{
  margin: 0;
}

/* Horizontal variant on news cards */
.news-card--horizontal{ gap: 0; }
@media (min-width: 768px){
  .news-card--horizontal{ flex-direction: row; }
  .news-card--horizontal .news-card__media{ flex: 0 0 40%; max-width: 40%; }
  .news-card--horizontal .news-card__body{ flex: 1 1 auto; }
}