/* PZP UE: dofinansowanie i aplikacja. Self-contained and namespaced: no theme selector is touched.
   Typography follows the Dinenos theme (Plus Jakarta Sans, #111 ink, 1140 px container, 15 px gutters, 3 px radii);
   the EU marks sit on flat white (Księga wizualizacji PS WPR 2023-2027): never recoloured, cropped or stretched.
   Logo geometry mirrors the app's GrantBar: --h is the EU flag height and the only knob. PS WPR = 1.32 x --h (its
   body then equals the flag), brand = 0.8 x --h (never taller than the symbol UE), clear space A = 0.18 x --h
   (gaps >= 2A, row padding >= A, plate edge = 2A). The PNGs are cut so that align-items: center puts the PS WPR text
   on the EU text line and the stalks on the flag bottom: no offsets, so the alignment survives any theme. */

.pzp-ue,
.pzp-ue-block,
.pzp-embed,
.pzp-app-badge {
  --pzp-ink: #111;
  --pzp-text: #4d4d4d; /* 8.6:1 on white; the theme's #777 is below AA for 15 px text */
  --pzp-line: #e6e6e6;
  --pzp-paper: #f6eed9;
  --pzp-font: "Plus Jakarta Sans", "DM Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  font-family: var(--pzp-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--pzp-text);
}

.pzp-ue *,
.pzp-ue-block *,
.pzp-embed *,
.pzp-app-badge * {
  box-sizing: inherit;
}

@media (prefers-contrast: more) {
  .pzp-ue,
  .pzp-ue-block,
  .pzp-embed,
  .pzp-app-badge {
    --pzp-line: #767676;
    --pzp-text: #222;
  }
}

/* ---------- the logo row (strip + block) ---------- */

.pzp-ue__logos {
  --h: 46px; /* EU flag height (mobile floor 40 px); PS WPR = 0.96 h, brand = 0.8 h, as in the app */
  --a: calc(var(--h) * 0.18);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end; /* bottom-aligned, same rule as the app's GrantBar */
  justify-content: flex-start;
  gap: calc(var(--a) * 2) calc(var(--a) * 2.5);
  margin: 0;
  padding: var(--a) 0;
  background: #fff;
}

/* (0,2,0) beats the theme's `.entry-content img { height: auto }` without !important */
.pzp-ue__logos .pzp-ue__logo {
  display: block;
  flex: none;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.pzp-ue__logos .pzp-ue__logo--eu {
  height: var(--h);
}

.pzp-ue__logos .pzp-ue__logo--ps-wpr {
  height: calc(var(--h) * 0.96);
}

.pzp-ue__logos .pzp-ue__logo--marka {
  height: calc(var(--h) * 0.8);
}

@media (min-width: 768px) {
  .pzp-ue__logos {
    --h: 56px;
  }
}

/* ---------- footer strip, printed under the theme's footer on every page ---------- */

.pzp-ue {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 24px 15px;
  background: #fff;
  border-top: 1px solid var(--pzp-line);
}

.pzp-ue__inner {
  display: grid;
  grid-template-areas:
    "logos"
    "text"
    "app";
  gap: 16px 32px;
  align-items: center;
  max-width: 1140px;
  margin: 0 auto;
}

.pzp-ue .pzp-ue__logos {
  grid-area: logos;
}

.pzp-ue__text {
  grid-area: text;
  margin: 0;
  max-width: 64ch;
  color: var(--pzp-text);
  text-wrap: pretty;
}

.pzp-ue__text strong {
  color: var(--pzp-ink);
  font-weight: 600;
}

.pzp-ue__nowrap {
  white-space: nowrap;
}

/* the link on its own line (as in the app's footer) with a 44 px hit area that keeps the paragraph rhythm; its own
   line also keeps it clear of the theme's floating „do góry” button, which covers the right end of the last line */
.pzp-ue .pzp-ue__more {
  display: block;
  width: fit-content;
  margin: 0 0 -10px; /* no negative top margin: the focus ring must not cross the line above */
  padding: 10px 0; /* 24 px line + 20 = 44 px */
  color: var(--pzp-ink);
  font-weight: 600;
  text-decoration: underline !important; /* Dinenos: a { text-decoration: none !important } */
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.pzp-ue .pzp-ue__more:hover {
  color: var(--pzp-ink);
  text-decoration-thickness: 2px;
}

.pzp-ue .pzp-ue__app {
  grid-area: app;
  justify-self: start;
}

@media (min-width: 768px) {
  .pzp-ue {
    padding: 28px 15px;
  }

  /* logos and the app button in the left column, the text beside them (a 3-column row would squeeze the text below
     1280 px); the button stays away from the bottom-right corner, where the theme's floating „do góry” button sits */
  .pzp-ue__inner {
    grid-template-areas:
      "logos text"
      "app text";
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px 40px;
  }
}

@media (min-width: 1280px) {
  .pzp-ue__inner {
    grid-template-areas: "logos text app";
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px 40px;
    /* the theme's floating „do góry” button (#top-to-bottom: 52 px wide, 40 px from the corner) sits over the page end;
       keep the app button 96 px clear of the right edge until the centred 1140 px container is that far from it */
    padding-right: max(0px, 96px - max(15px, (100vw - 1140px) / 2));
  }

  .pzp-ue .pzp-ue__app {
    justify-self: end;
  }
}

/* ---------- buttons (strip + badge): the theme's dark ink, 3 px radius, 44 px tall ---------- */

.pzp-ue .pzp-btn,
.pzp-app-badge .pzp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 20px;
  border: 1px solid var(--pzp-ink);
  border-radius: 3px;
  background: var(--pzp-ink);
  color: #fff;
  font-family: var(--pzp-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}

.pzp-ue .pzp-btn:hover,
.pzp-app-badge .pzp-btn:hover {
  background: #fff;
  color: var(--pzp-ink);
  text-decoration: none;
}

.pzp-ue .pzp-btn:active,
.pzp-app-badge .pzp-btn:active {
  background: #363636;
  color: #fff;
}

@media (max-width: 767px) {
  /* 268 px wide: clear of the theme's floating „do góry” button on a 375 px phone */
  .pzp-ue .pzp-ue__app {
    padding-inline: 16px;
  }
}

/* !important: the Dinenos theme removes every focus ring with a { outline: none !important } */
.pzp-ue a:focus-visible,
.pzp-ue-block a:focus-visible,
.pzp-embed a:focus-visible,
.pzp-app-badge a:focus-visible {
  outline: 3px solid var(--pzp-ink) !important;
  outline-offset: 3px;
}

/* ---------- [pzp_ue_logos]: the plate on the project page (PS WPR, brand, EU) ---------- */

.pzp-ue-block {
  margin: 0 0 28px;
}

.pzp-ue-block .pzp-ue__logos {
  --h: 40px; /* the app's plate height on phones: PS WPR 53, EU 40, one row down to ~352 px */
  width: fit-content;
  max-width: 100%;
  padding: calc(var(--a) * 2) calc(var(--a) * 2.5);
  border: 1px solid var(--pzp-line);
  border-radius: 4px;
}

@media (max-width: 639px) {
  /* like the app's plate: below 640 px the two mandatory marks only, on one row (PS WPR wraps above EU under ~352 px) */
  .pzp-ue-block .pzp-ue__logo--marka {
    display: none;
  }
}

@media (min-width: 768px) {
  .pzp-ue-block .pzp-ue__logos {
    --h: 64px;
  }
}

/* ---------- app embeds: [pzp_mapa], [pzp_karta], [pzp_gra] ---------- */

.pzp-embed {
  margin: 0 0 28px;
}

/* the label shows while the app loads and stays if it cannot (offline): the link below is the way out */
.pzp-embed__frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--pzp-line);
  border-radius: 4px;
  background: var(--pzp-paper);
}

.pzp-embed__frame::before {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--pzp-text);
  font-size: 15px;
  text-align: center;
}

.pzp-embed__frame iframe {
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pzp-embed--game .pzp-embed__frame {
  max-width: 480px;
}

.pzp-embed__link {
  margin: 4px 0 0;
}

.pzp-embed__link a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--pzp-ink);
  font-weight: 600;
  text-decoration: underline !important; /* Dinenos: a { text-decoration: none !important } */
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.pzp-embed__link a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- [pzp_app_badge]: button + one line of facts ---------- */

.pzp-app-badge {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin: 28px 0;
  padding: 20px 0;
  border-top: 1px solid var(--pzp-line);
  border-bottom: 1px solid var(--pzp-line);
}

.pzp-app-badge p {
  margin: 0;
  max-width: 64ch;
  text-wrap: pretty;
}

.pzp-app-badge p a {
  display: inline-block;
  margin: -10px 0;
  padding: 10px 0;
  color: var(--pzp-ink);
  font-weight: 600;
  text-decoration: underline !important; /* Dinenos: a { text-decoration: none !important } */
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.pzp-app-badge p a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
  .pzp-ue .pzp-btn,
  .pzp-app-badge .pzp-btn {
    transition: none;
  }
}

@media print {
  .pzp-ue {
    border-top: 1px solid #000;
    page-break-inside: avoid;
  }

  .pzp-ue__logos {
    --h: 44px;
  }

  .pzp-ue .pzp-ue__app,
  .pzp-app-badge .pzp-btn,
  .pzp-embed__frame {
    display: none;
  }

  .pzp-embed__link a::after {
    content: " (" attr(href) ")";
    font-weight: 400;
  }
}
