/* /assets/css/article-layout.css */
/* Pełne aktualności D11. Wartości bazowe porównane z widokiem D7. */
@media (min-width: 901px) {
  #newsDetail.news-article-layout {
    /* Dotychczas: 2.25fr / .8fr, odstęp 34px, minimum prawej 285px.
       Przenosimy dokładnie 40px z prawej kolumny do lewej. */
    grid-template-columns: minmax(0, 1fr) max(245px, calc((100% - 34px) * .262295081967 - 40px));
    gap: 34px;
  }
  #newsDetail > .news-article-sidebar {
    margin-top: var(--kb-article-sidebar-offset, 0px);
  }
  #newsDetail .news-detail-head {
    /* Nagłówek biegnie od lewej do prawej krawędzi całego układu. */
    width: var(--kb-article-full-width, 100%);
    max-width: none;
  }
}

#newsDetail .news-detail-head h1 {
  width: 100%;
  max-width: none;
  margin: 0 0 28px;
  text-align: left;
  text-wrap: wrap;
  overflow-wrap: anywhere;
  font-size: 48.5px;
  line-height: 1.1;
}

#newsDetail #newsDetailBody {
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4285714286;
}
#newsDetailBody :where(p, li, td, th, blockquote) {
  font-size: 15px;
  line-height: 1.4285714286;
}
#newsDetailBody p { margin: 0 0 10.5px; }
#newsDetailBody :is(ul, ol) { margin-block: 0 10.5px; }
#newsDetailBody :is(h1, h2, h3) {
  margin: 21px 0 10.5px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
#newsDetailBody h1 { font-size: 48.5px; }
#newsDetailBody h2 { font-size: 32px; }
#newsDetailBody h3 { font-size: 23px; }

/* Jedno istniejące łącze obejmuje zarówno fotografię, jak i tytuł. */
#newsDetail #newsArticleLatest {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
#newsDetail #newsArticleLatest > .news-side-item {
  display: block;
  position: relative;
  isolation: isolate;
  aspect-ratio: 290 / 190;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  background: #24211f;
  color: #fff;
  text-decoration: none;
}
#newsDetail #newsArticleLatest > .news-side-item::after {
  content: "";
  position: absolute;
  inset: 28% 0 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(0, 0, 0, .92));
}
#newsDetail #newsArticleLatest > .news-side-item img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  object-position: center;
  transform: scale(1);
  transition: transform 600ms ease-in-out;
}
#newsDetail #newsArticleLatest > .news-side-item > span {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 17px;
  z-index: 2;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .65);
}
#newsDetail #newsArticleLatest > .news-side-item:is(:hover, :focus-visible) img {
  transform: scale(1.05);
}
#newsDetail #newsArticleLatest > .news-side-item:focus-visible {
  outline: 3px solid #c42424;
  outline-offset: -3px;
}

@media (max-width: 900px) {
  #newsDetail > .news-article-sidebar { margin-top: 0; }
  #newsDetail > .news-article-sidebar > section:first-child { grid-column: 1 / -1; }
  #newsDetail #newsArticleLatest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  #newsDetail .news-detail-head h1 { font-size: 32px; margin-bottom: 22px; }
  #newsDetailBody h1 { font-size: 32px; }
  #newsDetailBody h2 { font-size: 26px; }
  #newsDetailBody h3 { font-size: 22px; }
  #newsDetail #newsArticleLatest { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  #newsDetail #newsArticleLatest > .news-side-item img { transition: none; }
  #newsDetail #newsArticleLatest > .news-side-item:is(:hover, :focus-visible) img { transform: none; }
}

/* Małe zdjęcia list i tagów: stała ramka zapobiega nachodzeniu na tekst. */
.news-page :is(.news-latest, .news-side-item, .news-tag-item) > .kb-news-thumbnail {
  display: block;
  min-width: 0;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
}
.news-page .news-latest > .kb-news-thumbnail { width: 95px; height: 58px; }
.news-page .news-side-item > .kb-news-thumbnail { width: 96px; height: 64px; }
.news-page #newsTags .news-tag-item > .kb-news-thumbnail { width: 96px; height: 56px; }
.news-page .kb-news-thumbnail > img,
.news-page #newsTags .kb-news-thumbnail > img {
  display: block;
  position: static;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  object-fit: contain;
  transform: scale(1);
  transition: transform 600ms ease-in-out;
}
@media (hover: hover) {
  .news-page :is(.news-latest, .news-side-item, .news-tag-item):hover .kb-news-thumbnail > img {
    transform: scale(1.05);
  }
}
.news-page :is(.news-latest, .news-side-item, .news-tag-item):focus-visible .kb-news-thumbnail > img {
  transform: scale(1.05);
}
@media (max-width: 620px) {
  .news-page .news-side-item > .kb-news-thumbnail { width: 82px; height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  .news-page .kb-news-thumbnail > img,
  .news-page #newsTags .kb-news-thumbnail > img { transition: none; transform: none !important; }
}

/* Szpaler: trzy pełne linie; JS dodaje ... na granicy słowa. */
.news-page #newsLatest .news-latest > span:not(.kb-news-thumbnail),
.news-page #newsArticleRelated .news-side-item > span:not(.kb-news-thumbnail) {
  display: block;
  min-width: 0;
  max-height: 4.05em;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
}
@media (min-width: 901px) {
  #newsDetail > .news-article-sidebar > section { padding: 14px; }
  .news-page .news-sidebar > section { padding: 14px; }
  .news-page #newsLatest .news-latest,
  .news-page #newsArticleRelated .news-side-item { grid-template-columns: 108px minmax(0, 1fr); gap: 10px; }
  .news-page #newsLatest .kb-news-thumbnail,
  .news-page #newsArticleRelated .kb-news-thumbnail { width: 108px; height: 74px; }
  .news-page #newsTags .news-tag-item.has-image { grid-template-columns: 108px minmax(0, 1fr); }
  .news-page #newsTags .news-tag-item > .kb-news-thumbnail { width: 108px; height: 66px; }
}
#newsDetailBody .kb-inline-toc {
  width: fit-content;
  max-width: 100%;
  margin: 28px 0 32px;
  padding: 14px 16px;
  border: 1px solid #cbc6c0;
  border-radius: 10px;
  background: #fff;
  color: #211f1d;
}
#newsDetailBody .kb-inline-toc > strong { display: block; margin-bottom: 7px; font-size: 15px; }
#newsDetailBody .kb-inline-toc ul { list-style: none; margin: 0; padding: 0; }
#newsDetailBody .kb-inline-toc li { margin: 0; padding: 0; }
#newsDetailBody .kb-inline-toc a { display: block; padding: 3px 0; color: inherit; text-decoration: none; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
#newsDetailBody .kb-inline-toc a:is(:hover, :focus-visible) { color: #9b5e26; text-decoration: underline; }
#newsDetailBody :is([id], [name]) { scroll-margin-top: 100px; }
@media (max-width: 620px) {
  #newsDetailBody .kb-inline-toc { width: 100%; padding: 12px; }
}

/* KB_LATEST_THREE_LINES_V1 — only the first two latest cards on article pages. */
#newsDetail #newsArticleLatest > .news-side-item:nth-child(-n+2) > span:not(.kb-news-thumbnail) {
  display: block;
  max-height: 3.3em;
  max-height: 3lh;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

/* KB NEWS MOBILE FIX v1 START */
@media (max-width: 900px) {
  /* Show the complete banner, using the image's original proportions. */
  .news-subpage-banner {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 0 !important;
    margin: 0;
  }
  .news-subpage-banner picture {
    display: block;
    width: 100%;
  }
  .news-subpage-banner img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center;
  }

  /* Center both the closed tab and the expanded contents in the viewport. */
  .news-toc {
    position: fixed;
    top: 50% !important;
    top: 50dvh !important;
    bottom: auto !important;
    left: 0;
    transform: translateY(-50%) !important;
    align-items: center;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .news-toc summary {
    flex: 0 0 42px;
    min-height: 116px;
    min-height: min(116px, 40dvh);
  }
  .news-toc nav {
    max-height: 60vh;
    max-height: 60dvh;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
}
/* KB NEWS MOBILE FIX v1 END */

/* KB NEWS BREADCRUMB MOBILE v1 START */
@media (max-width: 900px) {
  /* Keep both links complete; the current article occupies its own short row. */
  .news-detail .news-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    min-width: 0;
    padding: 14px 0 16px;
    line-height: 1.5;
  }
  .news-detail .news-breadcrumb > a,
  .news-detail .news-breadcrumb > span:not(#newsCrumb) {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .news-detail .news-breadcrumb > #newsCrumb {
    display: block;
    flex: 0 1 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    line-height: 1.5;
    color: #71695f;
  }
  /* The editor-only action must not cover the breadcrumb on small screens. */
  .news-detail .news-edit-button:not([hidden]) {
    position: static;
    display: inline-flex;
    align-items: center;
    top: auto;
    left: auto;
    margin: 0 0 12px;
  }
}
/* KB NEWS BREADCRUMB MOBILE v1 END */

/* KB NEWS MOBILE RATINGS v1 START */
@media (max-width: 900px) {
  #newsArticleFooter #newsDetailRating .news-rating-copy,
  #newsDetailRating.news-detail-rating .news-rating-copy {
    display: block !important;
    flex: 0 0 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.5;
  }
  #newsArticleFooter #newsDetailRating .news-stars,
  #newsDetailRating.news-detail-rating .news-stars {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  #newsDetailRating .news-star-buttons {
    display: inline-flex;
    gap: 2px;
    max-width: 100%;
  }
  #newsDetailRating .news-star-buttons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
    border: 0;
    touch-action: manipulation;
    cursor: pointer;
  }
  #newsDetailRating .news-star-buttons button:focus-visible {
    outline: 2px solid #9b642f;
    outline-offset: 2px;
  }
}
/* KB NEWS MOBILE RATINGS v1 END */

/* /assets/css/news-speed.css */
/* Reserve the full-width article heading before the layout script measures it. */
@supports (width: 100cqw) {
  @media (min-width: 901px) {
    #newsDetail.news-article-layout { container-type: inline-size; }
    #newsDetail .news-detail-head { width: 100cqw; }
  }
}

