/*
Theme Name: KRR
Theme URI: https://ratujmyrzeki.pl/
Author: Koalicja Ratujmy Rzeki
Description: Własny motyw migracyjny KRR, odtwarzający układ szablonu Merri.
Version: 0.1.0
Text Domain: krr
*/

:root {
  --krr-blue: #0098db;
  --krr-blue-dark: #0584de;
  --krr-text: #343434;
  --krr-muted: #696969;
  --krr-bg: #f5f5f5;
  --krr-white: #fff;
  --krr-content: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--krr-bg);
  color: #444;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}
img { max-width: 100%; height: auto; }
a { color: #057fc0; }
a:hover { color: #034f78; }
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
  width: auto; height: auto; clip: auto; margin: 8px; padding: 12px 18px;
  background: #fff; color: #111; z-index: 10000;
}

.site-header { background: #fff; }

.hero { position: relative; overflow: hidden; background: #1b3949; }
.hero-slide { display: none; position: relative; margin: 0; }
.hero-slide.is-active { display: block; }
.hero-slide img { display: block; width: 100%; height: clamp(210px, 32vw, 500px); object-fit: cover; }
.hero-caption {
  position: absolute; left: 50%; bottom: 32px; width: min(92%, 760px);
  transform: translateX(-50%); padding: 18px 24px; text-align: center;
  color: #fff; background: rgb(0 0 0 / 58%);
}
.hero-caption h2 { margin: 0 0 12px; color: inherit; font-size: clamp(1.3rem, 3vw, 2rem); }
.hero-caption a { display: inline-block; padding: 8px 16px; color: #fff; background: var(--krr-blue); text-decoration: none; }
.hero-logo-panel {
  position: absolute; top: 28px; left: 50%; z-index: 3; display: block;
  padding: 16px; transform: translateX(-50%); line-height: 0;
  background: rgb(255 255 255 / 82%); box-shadow: 0 3px 18px rgb(0 0 0 / 14%);
}
.hero-logo-panel img { display: block; width: 250px; max-width: 50vw; height: auto; }
.hero-control {
  position: absolute; top: 50%; z-index: 4; width: 44px; height: 54px;
  border: 0; transform: translateY(-50%); color: #fff; background: rgb(0 0 0 / 45%);
  cursor: pointer; font-size: 28px;
}
.hero-control:hover, .hero-control:focus { background: rgb(0 0 0 / 72%); }
.hero-control--previous { left: 10px; }
.hero-control--next { right: 10px; }

.primary-navigation { position: relative; z-index: 50; min-height: 70px; background: var(--krr-blue); }
.primary-navigation__inner { display: flex; align-items: center; width: min(1400px, 100%); min-height: 70px; margin: 0 auto; padding: 0 14px; }
.menu-logo { flex: 0 0 auto; display: grid; place-items: center; margin-right: 10px; line-height: 0; }
.menu-logo img {
  display: block; width: 104px; max-height: 48px; object-fit: contain;
  filter: brightness(0) invert(1); opacity: .96;
}
.menu-logo:hover img, .menu-logo:focus img { opacity: .78; }
.menu-toggle {
  display: none; width: 100%; min-height: 48px; padding: 8px 20px; border: 0;
  color: #fff; background: #343434; text-align: left; font: inherit; cursor: pointer;
}
.primary-menu-container { flex: 1 1 auto; min-width: 0; }
.primary-navigation .menu { display: flex; justify-content: center; margin: 0; padding: 0; list-style: none; }
.primary-navigation .menu-item { position: relative; margin: 0; list-style: none; }
.primary-navigation .menu > .menu-item > a,
.primary-navigation .menu > .menu-item > button {
  display: flex; align-items: center; min-height: 70px; padding: 0 20px; border: 0;
  color: #222; background: transparent; font: inherit; font-size: 15px;
  text-decoration: none; text-transform: uppercase; cursor: pointer;
}
.primary-navigation .menu > .menu-item:hover > a,
.primary-navigation .menu > .menu-item:hover > button,
.primary-navigation .menu > .menu-item:focus-within > a,
.primary-navigation .menu > .menu-item:focus-within > button,
.primary-navigation .current-menu-item > a,
.primary-navigation .current-menu-ancestor > a { color: #fff; background: var(--krr-blue-dark); }
.primary-navigation .menu-item-has-children > a::after,
.primary-navigation .menu-item-has-children > button::after { content: "▾"; margin-left: 8px; font-size: 12px; }
.primary-navigation .sub-menu {
  position: absolute; top: 100%; left: -999em; width: 260px; margin: 0; padding: 0;
  background: #fff; box-shadow: 0 9px 25px rgb(0 0 0 / 16%); list-style: none;
}
.primary-navigation .menu-item:hover > .sub-menu,
.primary-navigation .menu-item:focus-within > .sub-menu,
.primary-navigation .menu-item.is-open > .sub-menu { left: 0; }
.primary-navigation .sub-menu a {
  display: block; padding: 10px 18px; color: #333; background: #fff;
  font-size: 15px; line-height: 1.35; text-decoration: none;
}
.primary-navigation .sub-menu a:hover,
.primary-navigation .sub-menu a:focus { background: #eee; }

.site-main { width: min(var(--krr-content), calc(100% - 32px)); margin: 0 auto; padding: 0 0 56px; }
.news-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; align-items: stretch; }
.news-grid .content-card { position: relative; min-height: 500px; height: 500px; margin: 0; padding-bottom: 64px; overflow: hidden; transition: height .25s ease; }
.news-grid .content-card.is-expanded { height: auto; }
.news-card-content { overflow: hidden; }
.news-grid .content-card:not(.is-expanded)::after {
  position: absolute; right: 0; bottom: 0; left: 0; height: 115px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0%), #fff 58%);
  pointer-events: none; content: "";
}
.news-card-toggle {
  position: absolute; right: 24px; bottom: 17px; left: 24px; z-index: 2;
  min-height: 36px; padding: 6px 14px; border: 1px solid var(--krr-blue);
  color: #057fc0; background: #fff; font: inherit; font-size: 14px;
  cursor: pointer; text-transform: uppercase; letter-spacing: .05em;
}
.news-card-toggle:hover, .news-card-toggle:focus { color: #fff; background: var(--krr-blue); }
.is-expanded .news-card-toggle,
.is-expanded .news-card-toggle:hover,
.is-expanded .news-card-toggle:focus { color: #666; background: #fff; border-color: #ccc; }
.news-card-toggle__collapse { display: none; }
.is-expanded .news-card-toggle__expand { display: none; }
.is-expanded .news-card-toggle__collapse { display: inline; }
.content-card { margin: 0 0 34px; padding: clamp(24px, 5vw, 54px); background: #fff; overflow-wrap: anywhere; }
.entry-title { margin: 0 0 24px; color: var(--krr-text); font-size: clamp(1.35rem, 3vw, 1.85rem); line-height: 1.25; text-align: center; }
.entry-title a { color: inherit; text-decoration: none; }
.entry-title a:hover, .entry-title a:focus { color: var(--krr-blue-dark); }
.entry-thumbnail { display: block; margin: -20px auto 28px; text-align: center; }
.entry-thumbnail img { max-height: 620px; object-fit: contain; }
.entry-content::after, .entry-summary::after { display: table; clear: both; content: ""; }
.entry-content iframe { max-width: 100%; }
.entry-content table { display: block; max-width: 100%; overflow-x: auto; }
.entry-content .gallery {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin: 20px 0 42px;
}
.entry-content .gallery-item { position: relative; aspect-ratio: 1; margin: 0; overflow: hidden; background: #e9e9e9; }
.entry-content .gallery-icon, .entry-content .gallery-icon a { display: block; width: 100%; height: 100%; }
.entry-content .gallery img {
  display: block; width: 100%; height: 100%; border: 0 !important;
  object-fit: cover; transition: transform .2s ease, filter .2s ease;
}
.entry-content .gallery a:hover img, .entry-content .gallery a:focus img { transform: scale(1.035); filter: brightness(.86); }
.entry-content .gallery a:focus-visible { outline: 4px solid var(--krr-blue); outline-offset: -4px; }

.krr-lightbox {
  width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0;
  border: 0; color: #fff; background: rgb(0 0 0 / 94%);
}
.krr-lightbox::backdrop { background: rgb(0 0 0 / 72%); }
.krr-lightbox[open] { display: grid; grid-template: "image image image" 1fr "caption caption caption" auto / 72px 1fr 72px; align-items: center; }
.krr-lightbox__figure { grid-area: image; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; height: 100%; margin: 0; padding: 64px 82px 20px; }
.krr-lightbox__image { display: block; max-width: 100%; max-height: calc(100vh - 130px); width: auto; height: auto; object-fit: contain; }
.krr-lightbox__caption { grid-area: caption; min-height: 46px; margin: 0; padding: 8px 90px 18px; color: #fff; text-align: center; font-size: 15px; }
.krr-lightbox__button {
  position: absolute; z-index: 3; display: grid; place-items: center; width: 48px; height: 48px;
  padding: 0; border: 1px solid rgb(255 255 255 / 35%); border-radius: 50%;
  color: #fff; background: rgb(0 0 0 / 45%); cursor: pointer; font: inherit; font-size: 32px;
}
.krr-lightbox__button:hover, .krr-lightbox__button:focus { background: var(--krr-blue); border-color: var(--krr-blue); }
.krr-lightbox__close { top: 16px; right: 18px; font-size: 28px; }
.krr-lightbox__previous { top: 50%; left: 16px; transform: translateY(-50%); }
.krr-lightbox__next { top: 50%; right: 16px; transform: translateY(-50%); }
.krr-lightbox__counter { position: absolute; top: 22px; left: 22px; color: #fff; font-size: 14px; }
body.krr-lightbox-open { overflow: hidden; }
.gallery-pagination {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  margin: 0 0 34px; padding-bottom: 24px; border-bottom: 1px solid #ddd;
}
.gallery-pagination a, .gallery-pagination__current {
  display: inline-grid; min-width: 40px; min-height: 40px; place-items: center;
  padding: 6px 12px; text-decoration: none;
}
.gallery-pagination a { color: #057fc0; border: 1px solid #b8dff2; }
.gallery-pagination a:hover, .gallery-pagination a:focus { color: #fff; background: var(--krr-blue); border-color: var(--krr-blue); }
.gallery-pagination__current { color: #fff; background: var(--krr-blue); }
.gallery-pagination__pages { display: flex; gap: 8px; }
.gallery-pagination__previous { justify-self: start; }
.gallery-pagination__next { justify-self: end; }
.gallery-pagination--bottom { margin: 34px 0 0; padding: 24px 0 0; border-top: 1px solid #ddd; border-bottom: 0; }
.krr-gallery-page .content-card { padding-top: 8px; }
.krr-gallery-page .entry-title { margin-bottom: 8px; }
.krr-gallery-page .gallery-pagination { margin-bottom: 8px; padding-bottom: 8px; }
.krr-gallery-page .entry-content > p { margin-top: 8px; margin-bottom: 8px; }
.krr-gallery-page .entry-content .gallery { margin-top: 8px; margin-bottom: 8px; }
.read-more {
  display: block; width: 100%; margin-top: 28px; padding: 11px 18px;
  color: #fff; background: var(--krr-blue); text-align: center; text-decoration: none;
  text-transform: uppercase; font-size: 13px; letter-spacing: .08em;
}
.read-more:hover, .read-more:focus { color: #fff; background: #676767; }
.pagination { margin: 30px 0; text-align: center; }

.site-directory { padding: 48px 20px; background: #fff; border-top: 1px solid #e5e5e5; }
.site-directory__inner { width: min(var(--krr-content), 100%); margin: 0 auto; }
.site-directory h2 { margin: 0 0 24px; text-align: center; font-size: 1.35rem; }
.page-directory {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px;
  margin: 0; padding: 0; list-style: none;
}
.page-directory li { margin: 0; }
.page-directory a { color: #333; text-decoration: none; }
.page-directory a:hover, .page-directory a:focus { color: var(--krr-blue-dark); text-decoration: underline; }
.site-footer { padding: 38px 20px; color: #555; background: #fff; text-align: center; border-top: 1px solid #eee; }
.site-footer p { margin: 0; }

@media (max-width: 1080px) {
  .primary-navigation .menu > .menu-item > a,
  .primary-navigation .menu > .menu-item > button { padding-inline: 12px; font-size: 13px; }
}
@media (max-width: 820px) {
  .news-grid { grid-template-columns: 1fr; }
  .primary-navigation__inner { display: grid; grid-template-columns: auto 1fr; padding: 0; }
  .menu-logo { min-height: 48px; margin: 0; padding: 4px 14px; }
  .menu-logo img { width: 86px; max-height: 38px; }
  .menu-toggle { display: block; text-align: right; }
  .primary-menu-container { display: none; grid-column: 1 / -1; }
  .primary-navigation.is-open .primary-menu-container { display: block; }
  .primary-navigation .menu { display: block; }
  .primary-navigation .menu > .menu-item > a,
  .primary-navigation .menu > .menu-item > button { width: 100%; min-height: 48px; justify-content: center; color: #fff; background: #343434; }
  .primary-navigation .sub-menu { position: static; display: none; width: 100%; box-shadow: none; }
  .primary-navigation .menu-item:hover > .sub-menu { display: none; }
  .primary-navigation .menu-item.is-open > .sub-menu,
  .primary-navigation .menu-item:focus-within > .sub-menu { display: block; }
  .primary-navigation .sub-menu a { text-align: center; }
  .hero-slide img { height: 320px; }
  .hero-logo-panel { top: 12px; padding: 10px; }
  .hero-logo-panel img { width: 180px; max-width: 60vw; }
  .hero-caption { bottom: 16px; padding: 12px 16px; }
  .entry-content .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .krr-lightbox__figure { padding: 58px 12px 78px; }
  .krr-lightbox__image { max-height: calc(100vh - 145px); }
  .krr-lightbox__caption { padding: 8px 58px 18px; }
  .krr-lightbox__previous { top: auto; bottom: 16px; left: 16px; transform: none; }
  .krr-lightbox__next { top: auto; right: 16px; bottom: 16px; transform: none; }
  .gallery-pagination { grid-template-columns: 1fr 1fr; }
  .gallery-pagination__pages { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .news-grid .content-card { transition: none; }
}
