/*
 * Poprawki dostępności (WCAG 2.2 AA) nakładane na motyw creative.css.
 * Plik musi być ładowany po creative.css.
 */

:root {
  --green: #007a00;        /* kontrast z białym 5,55:1 */
  --green-dark: #005c00;
  --text-muted: #555b61;   /* kontrast z #f8f9fa 6,5:1 */
}

/* Kotwice nie chowają się pod przyklejonym menu (2.4.11) */
html {
  scroll-padding-top: 80px;
}

/* Link „Przejdź do treści” (2.4.1) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 2000;
  padding: .75rem 1.25rem;
  background: #fff;
  color: #000;
  font-weight: 700;
  border: 3px solid #000;
  border-radius: .25rem;
}

.skip-link:focus {
  top: 1rem;
  color: #000;
}

/* Widoczny fokus na każdym tle (2.4.7) */
a:focus-visible,
button:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #fff;
}

.btn:focus,
.btn.focus,
.navbar-toggler:focus {
  box-shadow: none;
}

.btn:focus-visible,
.navbar-toggler:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #fff;
}

[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

/* Kontrast kolorów (1.4.3) */
a {
  color: var(--green);
}

a:hover {
  color: var(--green-dark);
}

.bg-primary {
  background-color: var(--green) !important;
}

.btn-primary,
.btn-primary:not(:disabled):not(.disabled):active {
  background-color: var(--green);
  border-color: var(--green);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-white-75 {
  color: rgba(255, 255, 255, .9);
}

#mainNav .navbar-nav .nav-item .nav-link:hover,
#mainNav .navbar-nav .nav-item .nav-link:active,
#mainNav .navbar-nav .nav-item .nav-link.active,
#mainNav .navbar-nav .nav-item .nav-link[aria-current="page"] {
  color: var(--green) !important;
}

@media (min-width: 992px) {
  #mainNav .navbar-brand,
  #mainNav .navbar-nav .nav-item .nav-link {
    color: rgba(255, 255, 255, .9);
  }
  #mainNav:not(.navbar-scrolled) .navbar-nav .nav-item .nav-link:hover,
  #mainNav:not(.navbar-scrolled) .navbar-nav .nav-item .nav-link.active,
  #mainNav:not(.navbar-scrolled) .navbar-nav .nav-item .nav-link[aria-current="page"] {
    color: #fff !important;
    text-decoration: underline;
    text-underline-offset: .3em;
  }
  #mainNav.navbar-scrolled .navbar-brand:hover {
    color: var(--green);
  }
}

/* Linki w treści odróżnione nie tylko kolorem (1.4.1) */
.text-link {
  text-decoration: underline;
}

/* Minimalny rozmiar celu 24×24 px (2.5.8) */
.footer-links a {
  display: inline-block;
  min-height: 24px;
  padding: .25rem .5rem;
  text-decoration: underline;
}

/* Brak przewijania w poziomie przy 320 px (1.4.10) */
header.masthead h1,
.page-header h1 {
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (max-width: 400px) {
  header.masthead h1 {
    font-size: 1.75rem;
  }
}

.funds-section .hashtag {
  overflow-wrap: anywhere;
}

/* Ikony list: czytniki ekranu pomijają znak ikony */
#oferta ul li::before,
#wyposazenie ul li::before {
  content: "\f00c" / "";
}

/* Baner z logotypami UE w sekcji hero */
.eu-hero-banner {
  display: block;
  max-width: 640px;
  margin: 2.5rem auto 2rem;
  padding: .5rem 1rem;
  background: #fff;
  border-radius: .5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  transition: transform .2s ease, box-shadow .2s ease;
}

.eu-hero-banner:hover,
.eu-hero-banner:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.eu-hero-banner:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.eu-hero-banner img {
  display: block;
  width: 100%;
  height: auto;
}

/* Ciemniejsza nakładka na zdjęciu – tekst min. 4,5:1 nawet na najjaśniejszym fragmencie */
header.masthead {
  background: linear-gradient(to bottom, rgba(92, 77, 66, .85) 0%, rgba(92, 77, 66, .85) 100%), url("../img/bg-masthead.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Nagłówek podstrony */
.page-header {
  padding: 9rem 0 4rem;
  background: linear-gradient(to bottom, rgba(92, 77, 66, .85) 0%, rgba(92, 77, 66, .85) 100%), url("../img/bg-masthead.jpg");
  background-position: center;
  background-size: cover;
}

.page-header h1 {
  font-size: 2rem;
}

@media (min-width: 992px) {
  .page-header h1 {
    font-size: 2.75rem;
  }
}

.funds-section h2 {
  margin-top: 2rem;
}

.funds-section h2:first-child {
  margin-top: 0;
}

/* Ograniczenie ruchu (2.3.3) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  .eu-hero-banner:hover,
  .eu-hero-banner:focus-visible {
    transform: none;
  }
}

/* ------------------------------------------------------------------
 * Panel dostępności: rozmiar tekstu i tryby kontrastu
 * ------------------------------------------------------------------ */

.a11y-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1031;
  height: 44px;
  background: #1a1a1a;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1;
}

.a11y-toolbar .container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}

.a11y-group {
  display: flex;
  align-items: center;
  margin-left: 16px;
}

.a11y-label {
  margin-right: 6px;
}

.a11y-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  margin-left: 4px;
  padding: 0 6px;
  font: 700 14px/1 Arial, Helvetica, sans-serif;
  color: #fff;
  background: #1a1a1a;
  border: 2px solid #fff;
  border-radius: 4px;
  cursor: pointer;
}

.a11y-btn[data-font="1"] { font-size: 16px; }
.a11y-btn[data-font="2"] { font-size: 18px; }

.a11y-btn[aria-pressed="true"] {
  outline: 3px solid #4da3ff;
  outline-offset: 1px;
}

.a11y-btn:focus-visible {
  outline: 3px solid #ffeb00;
  outline-offset: 2px;
  box-shadow: none;
}

.a11y-btn.sample-default { color: #212529; background: #fff; }
.a11y-btn.sample-wb      { color: #fff;    background: #000; }
.a11y-btn.sample-yb      { color: #ff0;    background: #000; }
.a11y-btn.sample-by      { color: #000;    background: #ff0; }

@media (max-width: 575.98px) {
  .a11y-label-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .a11y-group {
    margin-left: 10px;
  }
  .a11y-btn {
    margin-left: 3px;
  }
}

/* Menu zjeżdża pod panel, a po przewinięciu przykleja się do góry */
#mainNav {
  top: 44px;
  transition: top .2s ease, background-color .2s ease;
}

#mainNav.navbar-scrolled {
  top: 0;
}

/* Rozmiar tekstu */
html.font-1 { font-size: 125%; }
html.font-2 { font-size: 150%; }

/* Tryby kontrastu */
html.hc-wb { --hc-fg: #fff; --hc-bg: #000; }
html.hc-yb { --hc-fg: #ff0; --hc-bg: #000; }
html.hc-by { --hc-fg: #000; --hc-bg: #ff0; }

html[class*="hc-"] body,
html[class*="hc-"] body *:not(.a11y-btn):not(img) {
  color: var(--hc-fg) !important;
  background-color: var(--hc-bg) !important;
  background-image: none !important;
  border-color: var(--hc-fg) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html[class*="hc-"] a,
html[class*="hc-"] .btn {
  text-decoration: underline !important;
}

html[class*="hc-"] .btn,
html[class*="hc-"] .eu-hero-banner,
html[class*="hc-"] .navbar-toggler,
html[class*="hc-"] .a11y-toolbar {
  border: 2px solid var(--hc-fg) !important;
}

html[class*="hc-"] #mainNav,
html[class*="hc-"] .a11y-toolbar {
  border-width: 0 0 2px !important;
  border-style: solid !important;
}

/* Logotypy UE muszą zostać na białym tle */
html[class*="hc-"] .eu-hero-banner img,
html[class*="hc-"] .eu-logos-wrapper img {
  background: #fff !important;
  padding: 4px;
}

html[class*="hc-"] :focus-visible {
  outline: 3px solid var(--hc-fg) !important;
  outline-offset: 3px !important;
}

html.hc-wb body .navbar .navbar-toggler-icon.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='%23fff' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

html.hc-yb body .navbar .navbar-toggler-icon.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='%23ff0' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

html.hc-by body .navbar .navbar-toggler-icon.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='%23000' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

html[class*="hc-"] .a11y-btn[aria-pressed="true"] {
  outline: 3px solid var(--hc-fg) !important;
}

/* Długie słowa i przyciski łamią się przy powiększonym tekście na wąskim ekranie */
h1, h2, h3, p, li, dt, dd, address {
  overflow-wrap: break-word;
  hyphens: auto;
}

.btn {
  white-space: normal;
  max-width: 100%;
}

html[class*="hc-"] #mainNav .navbar-brand,
html[class*="hc-"] #mainNav .navbar-nav .nav-item .nav-link,
html[class*="hc-"] #mainNav .navbar-nav .nav-item .nav-link:hover,
html[class*="hc-"] #mainNav .navbar-nav .nav-item .nav-link.active,
html[class*="hc-"] #mainNav .navbar-nav .nav-item .nav-link[aria-current="page"] {
  color: var(--hc-fg) !important;
}

html[class*="hc-"] #mainNav .navbar-nav .nav-item .nav-link.active,
html[class*="hc-"] #mainNav .navbar-nav .nav-item .nav-link[aria-current="page"] {
  font-weight: 900;
  text-decoration-thickness: 3px !important;
}

/* Hero nie wchodzi pod panel i menu, także przy powiększonym tekście */
header.masthead {
  padding-top: calc(44px + 8rem);
}

@media (min-width: 992px) {
  header.masthead {
    height: auto;
    min-height: 100vh;
    padding-top: calc(44px + 7rem);
    padding-bottom: 4rem;
  }
}

.page-header {
  padding-top: calc(44px + 7rem);
}

@media (min-width: 992px) {
  header.masthead {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  header.masthead > .container {
    height: auto !important;
  }
}

/* Panel na wąskich ekranach: bez ikon, mniejsze przyciski (nadal min. 24×24 px) */
@media (max-width: 575.98px) {
  .a11y-toolbar .container {
    justify-content: center;
    padding: 0 8px;
  }
  .a11y-label {
    display: none;
  }
  .a11y-group + .a11y-group {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid #777;
  }
  .a11y-group:first-child {
    margin-left: 0;
  }
  .a11y-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 4px;
  }
}
