/*
 * Layoutändringar ovanpå style.css.
 * style.css är redigerad direkt efter att SCSS-källorna senast ändrades,
 * så ändringar läggs här i stället för att kompilera om SCSS.
 */

/* Högerspalt: widgetytan "Högerspalt" (t.ex. E-postnotiser) */
.right-column-widgets {
  margin-bottom: 20px;
}

/*
 * Under 1070 px döljs högerspalten i style.css. Här visas den i stället
 * under artikellistan, men bara widgetytan "Högerspalt".
 * !important behövs eftersom ni.sidebars.js sätter position/width/top inline.
 */
@media (max-width: 1070px) {
  .sidebar-outer {
    display: block;
    position: static !important;
    width: auto !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    padding: 0 15px;
  }

  .sidebar-outer > :not(.right-column-widgets) {
    display: none;
  }
}

@media (max-width: 767px) {
  .sidebar-outer {
    padding: 0 10px;
  }
}

@media (max-width: 480px) {
  .sidebar-outer {
    padding: 0 5px;
  }
}

/*
 * Artikelsida utan mittenkolumn (single.php).
 * Rubrik och toppbild/video/galleri går i full bredd. Allt annat (delningsrad,
 * brödtext, byline, taggar, kommentarer, annonser) behåller exakt samma bredd
 * som när artikeln låg i en 8/12-kolumn, och centreras.
 */
@media (min-width: 768px) {
  .article-single-column .article-container > :not(article),
  .article-single-column .article-container > article > :not(h1):not(figure):not(.videoWrapper):not(.topgallery) {
    /* Gamla 8/12-kolumnen: 2/3 av raden minus 30 px padding = 2/3 av den här ytan minus 10 px */
    width: calc(66.6666666667% - 10px);
    margin-left: auto;
    margin-right: auto;
  }
}

/* 768–1070 px: kolumnerna har 10 px padding i stället för 15 px (2/3 av 20 px = 6,67 px) */
@media (min-width: 768px) and (max-width: 1070px) {
  .article-single-column .article-container > :not(article),
  .article-single-column .article-container > article > :not(h1):not(figure):not(.videoWrapper):not(.topgallery) {
    width: calc(66.6666666667% - 6.6666666667px);
  }
}

/*
 * Toppbild på artikelsidan: alltid en yta i full bredd, högst 560 px hög
 * (16:9 vid 990 px). Bilden beskärs aldrig: höga bilder visas hela och
 * centrerade, och fälten vid sidorna fylls med en suddig, mörkare kopia av
 * samma bild. article-head.php sätter --hero-bg till bildens adress.
 */
.article-single-column article > figure.article-hero {
  overflow: hidden;
  background-color: #222;
}

.article-single-column article > figure.article-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  bottom: -40px;
  left: -40px;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.7);
}

.article-single-column article > figure.article-hero img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.article-single-column article > figure.article-hero .wp-caption-text {
  z-index: 2;
}

@media (min-width: 768px) {
  .article-single-column article > figure.article-hero img {
    max-height: 560px;
  }
}

/* ==========================================================================
 * Artikellistan (Arlima "Löpet", ni_base/include/page-articles.php)
 * .list-front = förstasidan, .list-related = under artiklar m.m.
 * ========================================================================== */

/* Artikeln man just läser (listan under en artikel) */
.articles-full-width .is-current-post {
  display: none !important;
}

/*
 * Bildyta: bilden beskärs aldrig. Där den inte fyller ytan syns en suddig,
 * mörkare kopia av samma bild (--hero-bg sätts i ni_template_object).
 */
.articles-full-width article.teaser figure > a.s-image-resp {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: #222;
}

.articles-full-width article.teaser figure > a.s-image-resp::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  bottom: -40px;
  left: -40px;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.7);
}

.articles-full-width article.teaser figure > a.s-image-resp img {
  position: relative;
  z-index: 1;
  width: 100%;
  object-fit: contain;
}

@media (min-width: 768px) {
  /* Förstasidans första artikel: stor, högst 560 px hög bild (som artikelsidan) */
  .list-front article.first-in-list figure > a.s-image-resp img {
    height: auto;
    max-height: 560px;
  }

  /* Övriga artiklar: liggande teaser, bild 2/5 till vänster, text till höger */
  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) > .article-inner,
  .list-related article.teaser.img-full:not(.teaser-child) > .article-inner {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    column-gap: 25px;
    align-items: start;
  }

  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) > .article-inner > figure,
  .list-related article.teaser.img-full:not(.teaser-child) > .article-inner > figure {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) > .article-inner > .streamer,
  .list-related article.teaser.img-full:not(.teaser-child) > .article-inner > .streamer {
    grid-column: 2;
    grid-row: 1;
    overflow: hidden;
    text-align: left;
    padding-bottom: 6px;
  }

  /* Vinjetten: bara linjen till höger när den står vänsterställd */
  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) > .article-inner > .streamer span:before,
  .list-related article.teaser.img-full:not(.teaser-child) > .article-inner > .streamer span:before {
    display: none;
  }

  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) > .article-inner > .content,
  .list-related article.teaser.img-full:not(.teaser-child) > .article-inner > .content {
    grid-column: 2;
    grid-row: 2;
  }

  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) figure > a.s-image-resp,
  .list-related article.teaser.img-full:not(.teaser-child) figure > a.s-image-resp {
    aspect-ratio: 16 / 9;
  }

  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) figure > a.s-image-resp img,
  .list-related article.teaser.img-full:not(.teaser-child) figure > a.s-image-resp img {
    height: 100%;
  }

  .list-front article.teaser.img-full:not(.teaser-child):not(.first-in-list) > .article-inner h1.fsize-44,
  .list-related article.teaser.img-full:not(.teaser-child) > .article-inner h1.fsize-44 {
    font-size: 30px;
    line-height: 1.15;
  }

  /* Underlänkar: kompakt lista med bara rubriker, i textkolumnen */
  .list-front article.teaser.img-full:not(.first-in-list) > .teaser-children,
  .list-related article.teaser.img-full > .teaser-children {
    margin-left: calc((100% - 25px) * 0.4 + 25px);
    margin-top: 12px;
    background: none;
    border-top: 1px solid #ddd;
  }

  .list-front article.teaser.img-full:not(.first-in-list) > .teaser-children .article,
  .list-related article.teaser.img-full > .teaser-children .article {
    margin-top: 0 !important;
    border-bottom: 1px solid #ddd;
  }

  .list-front article.teaser.img-full:not(.first-in-list) > .teaser-children .article .content,
  .list-related article.teaser.img-full > .teaser-children .article .content {
    padding: 8px 0;
  }

  .list-front article.teaser.img-full:not(.first-in-list) > .teaser-children h1,
  .list-related article.teaser.img-full > .teaser-children h1 {
    font-size: 18px;
    line-height: 1.25;
    margin: 0;
  }

  .list-front article.teaser.img-full:not(.first-in-list) > .teaser-children h1 a::before,
  .list-related article.teaser.img-full > .teaser-children h1 a::before {
    content: '\25B8\00a0';
    color: #b12937;
  }

  .list-front article.teaser.img-full:not(.first-in-list) > .teaser-children p,
  .list-related article.teaser.img-full > .teaser-children p {
    display: none;
  }

}

/* "Visa fler artiklar" */
.load-more {
  text-align: center;
  margin: 10px 0 40px;
}

.load-more-button {
  padding: 12px 32px;
  font-size: 16px;
  cursor: pointer;
}

/* ==========================================================================
 * Plus- och teasersidor (plus.php, teaser.php) utan mittenkolumn.
 * De saknar toppbild i full bredd, så hela artikeln inklusive rubriken
 * står i den gamla 8/12-bredden, centrerad. Annars hamnar rubriken på en
 * annan axel än texten.
 * ========================================================================== */
@media (min-width: 768px) {
  .article-centered .article-container > article {
    width: calc(66.6666666667% - 10px);
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 768px) and (max-width: 1070px) {
  .article-centered .article-container > article {
    width: calc(66.6666666667% - 6.6666666667px);
  }
}

/* ==========================================================================
 * Arkiv- och söklistan (ni_base/include/archive-item.php)
 * Samma liggande form som teasrarna på förstasidan.
 * ========================================================================== */
.archive-list .archive-item {
  overflow: hidden;
}

.archive-list .archive-item .archive-item-image {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
  background-color: #222;
}

.archive-list .archive-item .archive-item-image::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  bottom: -40px;
  left: -40px;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.7);
}

/* Nollställer style.css regler för arkivbilder (float höger, 45 %) */
.archive-list .archive-item .archive-item-image img {
  position: relative;
  z-index: 1;
  float: none;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: contain;
}

.archive-list .archive-item-meta {
  margin: 0 0 6px;
  font-size: 14px;
  color: #666;
}

.archive-list .archive-item h1 {
  margin: 0 0 8px;
}

.archive-list .archive-item-excerpt {
  margin: 0;
}

@media (min-width: 768px) {
  .archive-list .archive-item:not(.no-img) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    column-gap: 25px;
    align-items: start;
  }

  .archive-list .archive-item .archive-item-image {
    margin-bottom: 0;
  }

  .archive-list .archive-item.no-img .archive-item-text {
    margin-left: calc((100% - 25px) * 0.4 + 25px);
  }

  .archive-list .archive-item h1 {
    font-size: 26px;
    line-height: 1.2;
  }
}

/* Rubrik på arkiv- och söksidor (ni_base/include/archive-header.php) */
.archive-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 4px solid #b12937;
}

.archive-header .archive-title {
  margin: 0 0 6px;
}

.archive-header .archive-count {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.archive-header .archive-description {
  margin-top: 10px;
}

/* Sidnavigering (ni_base/include/archive-pagination.php) */
.archive-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 40px;
}

.archive-pagination .page-numbers {
  display: inline-block;
  min-width: 40px;
  padding: 9px 12px;
  border: 1px solid #ccc;
  text-align: center;
  line-height: 1.2;
  color: #000;
  text-decoration: none;
}

.archive-pagination a.page-numbers:hover,
.archive-pagination a.page-numbers:focus {
  border-color: #b12937;
  color: #b12937;
}

.archive-pagination .page-numbers.current {
  background: #b12937;
  border-color: #b12937;
  color: #fff;
  font-weight: 700;
}

.archive-pagination .page-numbers.dots {
  border-color: transparent;
  min-width: 0;
  padding-left: 2px;
  padding-right: 2px;
}

@media (max-width: 480px) {
  .archive-pagination .page-numbers {
    min-width: 34px;
    padding: 8px 9px;
  }
}
