/* ==========================================================
   Pakiet szablonu projektów ZMiGDP – zmigdp_projekty
   Paleta: „rzeka + bursztyn”
   ========================================================== */
:root {
  --zm-primary: #0b4f6c;       /* głęboki błękit rzeki   – białe tło tekstu 8,9:1 */
  --zm-primary-dark: #083a50;
  --zm-secondary: #127a6e;     /* turkus                 – biały tekst 5,2:1      */
  --zm-accent: #f2a541;        /* bursztyn / „korona”    – ciemny tekst 7,2:1     */
  --zm-bg: #f4f8fa;
  --zm-surface: #ffffff;
  --zm-text: #1b2a33;          /* 13,8:1 na tle strony */
  --zm-muted: #50626c;         /* 6,3:1 na bieli       */
  --zm-link: #0b6a8f;          /* 6,0:1 na bieli       */
  --zm-border: #d5e1e7;
  --zm-radius: 10px;
  --zm-shadow: 0 1px 2px rgb(11 79 108 / .08), 0 4px 14px rgb(11 79 108 / .08);
  --zm-max: 1200px;
  --zm-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --zm-duration: 450ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; scroll-padding-bottom: 1rem; }
body {
  margin: 0;
  font-family: var(--zm-font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--zm-text);
  background: var(--zm-bg);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--zm-link); text-underline-offset: .18em; }
a:hover { color: var(--zm-primary-dark); }
:focus-visible { outline: 3px solid var(--zm-primary); outline-offset: 3px; box-shadow: 0 0 0 6px #fff; border-radius: 2px; }
/* ciemne tła: jasny pierścień (kontrast ≥ 3:1 – WCAG 1.4.11) */
.site-header :focus-visible, .site-footer :focus-visible, .skip-link:focus-visible {
  outline-color: #fff; box-shadow: 0 0 0 6px var(--zm-primary-dark);
}

.container { width: min(100% - 2rem, var(--zm-max)); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--zm-accent); color: var(--zm-text);
  padding: .6rem 1rem; border-radius: 0 0 var(--zm-radius) var(--zm-radius); font-weight: 600;
}
.skip-link:focus { top: 0; }

/* ---------- Pasek + menu (u góry) ---------- */
.site-header {
  position: relative;
  background: var(--zm-primary);
  color: #fff;
}
.site-header__inner {
  width: min(100% - 2rem, var(--zm-max)); margin-inline: auto;
  display: flex; align-items: center; justify-content: flex-start; gap: 1rem;
  min-height: 56px; flex-wrap: wrap;
}
.main-nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.main-nav__link {
  display: block; padding: .9rem 1rem; min-height: 44px; color: #fff; text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent; transition: background-color .15s, border-color .15s;
}
.main-nav__link:hover { background: var(--zm-primary-dark); color: #fff; }
.main-nav__link.is-active, .main-nav__link[aria-current="page"] {
  border-bottom-color: var(--zm-accent); font-weight: 700;
}
.nav-toggle {
  display: none; align-items: center; gap: .5rem; background: transparent; color: #fff;
  border: 2px solid #fff; border-radius: 8px; padding: .6rem .9rem; min-height: 44px; font: inherit; cursor: pointer;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; content: ""; position: relative;
}
.nav-toggle__bars::before { position: absolute; top: -6px; }
.nav-toggle__bars::after { position: absolute; top: 6px; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { display: none; flex-basis: 100%; }
  .main-nav.is-open { display: block; padding-bottom: .75rem; }
  .main-nav__list { flex-direction: column; }
  .main-nav__link { border-bottom: 0; border-left: 4px solid transparent; }
  .main-nav__link.is-active, .main-nav__link[aria-current="page"] { border-left-color: var(--zm-accent); background: var(--zm-primary-dark); }
}

/* ---------- Karuzela ---------- */
.carousel { position: relative; outline: none; }
.carousel__viewport { position: relative; overflow: hidden; }
.carousel__slide { width: 100%; }
.carousel.is-animating .carousel__viewport { overflow: hidden; }
.carousel.is-animating .carousel__slide { position: absolute; inset: 0 auto auto 0; will-change: transform; }
.carousel.is-animating .carousel__slide.is-incoming { position: relative; }


.project-bar { padding: clamp(1.5rem, 4vw, 2.5rem) 0 0; }
/* ---------- Pasek logotypów unijnych ---------- */
.eu-bar { background: #fff; border-bottom: 1px solid var(--zm-border); padding: .75rem 0; }
.eu-img { display: block; height: 48px; width: auto; max-width: 100%; object-fit: contain; }
.eu-link { display: inline-flex; max-width: 100%; }

/* ---------- Biały pasek tytułowy: tytuł strony głównej + logotypy ---------- */
.site-titlebar {
  background: #fff;
  color: var(--zm-primary);
  padding: clamp(.75rem, 2vw, 1.25rem) 0;
  border-top: 4px solid var(--zm-accent); /* ta sama barwa co podkreślenie aktywnej pozycji menu */
  border-bottom: 1px solid var(--zm-border);
}
.site-titlebar__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.site-titlebar__text { margin: 0; flex: 1 1 18rem; font-size: clamp(1.2rem, 2.6vw, 1.75rem); line-height: 1.25; font-weight: 800; letter-spacing: -.005em; }
.site-titlebar__logo { flex: none; }
/* Wąskie ekrany: logo „pływa” z lewej, a tytuł je opływa (zamiast przechodzić do nowej linii) */
@media (max-width: 720px) {
  .site-titlebar__inner { display: block; }
  .site-titlebar__inner::after { content: ""; display: table; clear: both; }
  .site-titlebar__logo { float: left; margin: 0 1rem .25rem 0; }
  .site-titlebar__text { flex: none; }
}
.logo-link { display: inline-flex; }
.logo-img { display: block; height: 64px; width: auto; max-width: 100%; }

/* ---------- Tytuł strony = nazwa projektu (H1) ---------- */
.page-heading { margin: 0 0 1.75rem; padding-left: 1rem; border-left: 6px solid var(--zm-accent); }
.page-heading__text { margin: 0; font-size: clamp(1.6rem, 3.6vw, 2.5rem); line-height: 1.2; font-weight: 800; color: var(--zm-primary); max-width: 32ch; outline: none; box-shadow: none; }
.page-heading__subtitle { margin: .5rem 0 0; font-size: 1.15rem; color: var(--zm-muted); max-width: 60ch; }

/* ---------- Treść ---------- */
.page-body { padding: 0 0 clamp(2rem, 5vw, 4rem); }
.content > *:first-child { margin-top: 0; }
.content h2 { font-size: 1.6rem; line-height: 1.3; color: var(--zm-primary); margin: 2rem 0 .75rem; }
.content h3 { font-size: 1.25rem; color: var(--zm-primary-dark); margin: 1.5rem 0 .5rem; }
.content--lead { font-size: 1.2rem; margin-bottom: 2rem; }
.content table { border-collapse: collapse; width: 100%; background: var(--zm-surface); }
.content th, .content td { border: 1px solid var(--zm-border); padding: .6rem .8rem; text-align: left; }
.content th { background: var(--zm-primary); color: #fff; }
.frame { margin-bottom: 2rem; }

/* Aktualności (EXT:news) – karty */
.content--news .news-list-view .article,
.content--news .news .article {
  display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem;
  background: var(--zm-surface); border: 1px solid var(--zm-border); border-radius: var(--zm-radius);
  box-shadow: var(--zm-shadow); padding: 1rem; margin-bottom: 1.25rem;
}
.content--news .news-img-wrap img { border-radius: 6px; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.content--news .header h3, .content--news .article h3 { margin: 0 0 .35rem; font-size: 1.3rem; }
.content--news .news-list-date, .content--news time { color: var(--zm-muted); font-size: .95rem; }
.content--news .page-navigation ul { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; }
.content--news .page-navigation a, .content--news .page-navigation .current a {
  display: inline-block; min-width: 2.5rem; text-align: center; padding: .4rem .7rem;
  border: 1px solid var(--zm-border); border-radius: 6px; background: var(--zm-surface); text-decoration: none;
}
.content--news .page-navigation .current a { background: var(--zm-primary); border-color: var(--zm-primary); color: #fff; font-weight: 700; }
@media (max-width: 640px) {
  .content--news .news-list-view .article, .content--news .news .article { grid-template-columns: 1fr; }
}

/* Galeria – siatka miniatur */
.content--gallery .ce-gallery,
.content--gallery .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.content--gallery .ce-row { display: contents; }
.content--gallery .ce-column { width: auto !important; }
.content--gallery .ce-gallery figure, .content--gallery .gallery figure { margin: 0; }
.content--gallery .ce-gallery img, .content--gallery .gallery img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--zm-radius); box-shadow: var(--zm-shadow);
  transition: transform .2s;
}
.content--gallery a:hover img { transform: translateY(-2px); }
.content--gallery figcaption { font-size: .95rem; color: var(--zm-muted); margin-top: .35rem; }

/* ---------- Stopka ---------- */
.site-footer { background: var(--zm-primary-dark); color: #fff; padding: 1.5rem 0; font-size: .95rem; }
.site-footer p { margin: 0; }

/* ---------- Ruch ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ---------- Tryb wysokiego kontrastu (Windows) ---------- */
@media (forced-colors: active) {
  .main-nav__link.is-active, .main-nav__link[aria-current="page"] { border-bottom: 3px solid Highlight; text-decoration: underline; }
  .nav-toggle { border: 2px solid ButtonText; }
  .page-heading { border-left-color: Highlight; }
  .site-titlebar { border-top: 4px solid Highlight; border-bottom: 1px solid CanvasText; }
}
