/* Bazowe style BIP – prosty, kontrastowy, responsywny */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #555555;
  --accent: #c40000;
  --accent-2: #004b8d;
  --border: #e3e3e3;
  --focus: #ffaa00;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --leading: 1.7;
  --h1: 1.8rem;
  --h2: 1.4rem;
  --h3: 1.2rem;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica,
    Arial, sans-serif;
  line-height: var(--leading);
  color: var(--text);
  background: #f4f6f8;
  /* Sticky footer layout */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-2);
}

/* Typografia */
h1 {
  font-size: var(--h1);
  margin: 0 0 var(--space-1) 0;
}
h2 {
  font-size: var(--h2);
  margin: var(--space-2) 0 var(--space-1);
}
h3 {
  font-size: var(--h3);
  margin: var(--space-2) 0 var(--space-1);
}
p {
  margin: 0 0 var(--space-2);
}
ul,
ol {
  margin: 0 0 var(--space-2) var(--space-3);
}

/* Skipper */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  background: #fff;
  border: 2px solid var(--focus);
  padding: 0.5rem;
  z-index: 1000;
}

/* WCAG-compliant color classes */
/* WCAG AA wymaga min. 4.5:1 dla tekstu zwykłego, 3:1 dla dużego tekstu */
.text-muted {
  color: #555555; /* Kontrast 7:1 na białym tle - WCAG AAA */
}
.text-secondary {
  color: #333333; /* Kontrast 12.6:1 na białym tle - WCAG AAA */
}
.text-error {
  color: #cc0000; /* Kontrast 5.2:1 na białym tle - WCAG AA */
}
.text-link {
  color: #0056b3; /* Kontrast 7:1 na białym tle - WCAG AAA */
}
.text-small {
  font-size: 0.9em;
  color: #555555; /* Kontrast 7:1 na białym tle - WCAG AAA */
}
.text-very-small {
  font-size: 0.85em;
  color: #555555; /* Kontrast 7:1 na białym tle - WCAG AAA */
}

/* Additional WCAG-compliant utility classes */
.section-spacing {
  margin-top: var(--space-2);
}
.small-text {
  font-size: 0.9rem;
  color: var(--muted);
}
.cookie-settings-box {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: #f8f9fa;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.cookie-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-2);
  background: #ffffff;
  border-radius: calc(var(--radius) / 2);
  border: 1px solid var(--border);
}
.cookie-checkbox-input {
  margin-top: 0.25rem;
}
.cookie-checkbox-disabled {
  cursor: not-allowed;
}
.cookie-checkbox-enabled {
  cursor: pointer;
}
.cookie-description {
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.cookie-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.cookie-button {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
}
.margin-top-0 {
  margin-top: 0;
}

/* Header */
.site-header {
  background: linear-gradient(0deg, #ffffff, #f8f9fb);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.site-header .wrap {
  position: relative;
  padding-top: var(--space-2);
  padding-bottom: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
/* Pierwsza linia: godło + logo BIP + kafelki dostępności */
.branding {
  display: contents; /* Pozwól na wyodrębnienie elementów */
}
.branding .marks {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  order: 1;
}
.branding .marks img {
  display: block;
}
.branding .titles {
  display: contents; /* Pozwól na wyodrębnienie logo BIP i tytułu */
}
.branding .bip-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  order: 1;
  margin-left: 1rem;
}
.utility-bar {
  order: 1;
  margin-left: auto; /* Wypchnij na prawo */
}
/* Druga linia: tytuł wycentrowany */
.site-title {
  text-align: center;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  order: 2;
  flex-basis: 100%;
}
/* Wyszukiwarka w trzeciej linii */
.search {
  order: 3;
  width: 100%;
  flex-basis: 100%;
}
.brand-mark {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}
img {
  max-width: 100%;
  height: auto;
}
.bip-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  margin: 0;
  flex-shrink: 0;
}
.site-title {
  margin: 0;
  font-size: 1.4rem;
  white-space: nowrap;
}

/* Utility bar w pierwszej linii z logo */
.utility-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto; /* Wypchnij na prawo */
  grid-row: 1;
}
.utility-bar .tool-btn {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 0.35rem;
  cursor: pointer;
}
.utility-bar .tool-btn:focus {
  outline: 3px solid var(--focus);
}

/* Search */
.search {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  position: relative;
}
.search input {
  flex: 1;
  min-width: 260px;
  max-width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 16px; /* Zapobiega zoomowaniu na iOS */
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
}
.search button {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--accent-2);
  background: var(--accent-2);
  color: #fff;
  border-radius: 0.5rem;
  cursor: pointer;
}
.search button:focus {
  outline: 3px solid var(--focus);
}

/* Search dropdown results */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}
.search-dropdown[hidden] {
  display: none !important;
}
.search-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f8f9fb;
  font-weight: 600;
}
.search-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.search-close:hover {
  color: var(--text);
}
.search-close:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.search-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 320px;
}
.search-dropdown-list li {
  border-bottom: 1px solid var(--border);
}
.search-dropdown-list li:last-child {
  border-bottom: none;
}
.search-dropdown-list a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--accent-2);
  text-decoration: none;
}
.search-dropdown-list a:hover {
  background: #f8f9fb;
}
.search-dropdown-list a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
  background: #f8f9fb;
}
.search-dropdown-list small {
  display: block;
  color: var(--muted);
  font-size: 0.9em;
  margin-top: 0.25rem;
}

/* Nav */
.main-nav {
  border-top: 1px solid var(--border);
  background: #ffffff;
}
.main-nav .nav-toggle {
  display: none;
}
.main-nav .nav-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.main-nav ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.main-nav a {
  color: var(--accent-2);
  text-decoration: none;
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  font-weight: 600;
}
.main-nav a:hover {
  background: #eef5fb;
}
.main-nav a:focus-visible {
  background: #eef5fb;
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Breadcrumbs */
.breadcrumbs {
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.breadcrumbs ol {
  margin: 0;
  padding: 0.5rem 1rem;
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.breadcrumbs a {
  color: var(--accent-2);
  text-decoration: underline;
}
.breadcrumbs a:hover {
  text-decoration: none;
}
.breadcrumbs a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.breadcrumbs li::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--muted);
}
.breadcrumbs li:last-child::after {
  content: "";
}

/* Content layout */
.content {
  padding: var(--space-3) 0 var(--space-4) 0; /* Dodaj padding-bottom zamiast margin-top w stopce */
  /* Tło z godłem przeniesione tu, aby nie wychodziło pod stopkę */
  background-image: url("../logo/biały orzeł godło.svg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 1200px 1200px;
  /* Wypełnia przestrzeń, by stopka była na dole */
  flex: 1 0 auto;
  position: relative;
}
article {
  display: grid;
  gap: var(--space-3);
}
.page-meta .meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  background: #fff;
  border: 1px solid var(--border);
  padding: 0.9rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Cards / lists */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
  box-shadow: var(--shadow);
}
.section {
  display: block;
}
.news-list,
.quick-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.news-list li,
.quick-links li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed var(--border);
  padding: 0.75rem 0;
}
.news-list li:last-child,
.quick-links li:last-child {
  border-bottom: 0;
}
.news-list a,
.quick-links a {
  color: var(--accent-2);
  text-decoration: underline;
}
.news-list a:hover,
.quick-links a:hover {
  text-decoration: none;
}
.news-list a:focus-visible,
.quick-links a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Footer */
.site-footer {
  border-top: 2px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8f9fb);
  flex-shrink: 0; /* Zapobiega kurczeniu się stopki */
}
.site-footer .wrap {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
.site-footer p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}
.site-footer p:first-child {
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-1);
}
.site-footer p:nth-child(2) {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.site-footer p:nth-child(2)::before {
  content: "";
  display: none;
}
.site-footer a {
  color: var(--accent-2);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 0.4rem;
  background: rgba(0, 75, 141, 0.08);
  border: 1px solid rgba(0, 75, 141, 0.15);
  transition: all 0.2s ease;
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
}
.site-footer a:hover {
  background: rgba(0, 75, 141, 0.15);
  border-color: rgba(0, 75, 141, 0.25);
  color: var(--accent-2);
  text-decoration: none;
  transform: translateY(-1px);
}
.site-footer a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  background: rgba(0, 75, 141, 0.15);
}
.site-footer p:nth-child(2) a::after {
  content: "";
}
.site-footer address {
  margin-top: 0;
  font-style: normal;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--muted);
  padding-top: 0;
}
.site-footer address strong {
  color: var(--text);
  font-weight: 600;
  display: block;
  margin-bottom: var(--space-1);
}
.site-footer p:last-child {
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  margin-top: var(--space-2);
}

/* Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Themes: high contrast */
body.high-contrast {
  --bg: #121212;
  --text: #ffffff;
  --muted: #ffffff;
  --accent: #ff2a2a;
  --accent-2: #5ab2ff;
  --border: #555555;
  background: var(--bg);
  color: var(--text);
  position: relative;
}
/* Wszystkie teksty w trybie wysokiego kontrastu są białe */
body.high-contrast,
body.high-contrast * {
  color: #ffffff !important;
}
/* Wyjątki - linki i przyciski mają swoje kolory */
body.high-contrast a,
body.high-contrast .main-nav a,
body.high-contrast .search-dropdown-list a {
  color: var(--accent-2) !important;
}
body.high-contrast .search button {
  color: #000 !important;
  background: #fff !important;
}
body.high-contrast input,
body.high-contrast textarea,
body.high-contrast select {
  color: #ffffff !important;
  background: var(--bg) !important;
}
/* Tło w trybie wysokiego kontrastu – szare godło jako tło, ale nie na treści */
.high-contrast .content {
  position: relative;
}
.high-contrast .content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("../logo/biały orzeł godło.svg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 1200px 1200px;
  filter: grayscale(1) brightness(0.55) contrast(1.25);
  z-index: 0;
  pointer-events: none;
}
.high-contrast .content > * {
  position: relative;
  z-index: 1;
}
body.high-contrast a {
  color: var(--accent-2);
  text-decoration: underline;
}
body.high-contrast .site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
body.high-contrast .main-nav {
  background: var(--bg);
  border-top: 1px solid var(--border);
}
body.high-contrast .main-nav a {
  color: var(--accent-2);
}
body.high-contrast .main-nav a:hover,
body.high-contrast .main-nav a:focus {
  background: #1a1a1a;
  outline: 2px solid var(--accent-2);
}
body.high-contrast .breadcrumbs {
  background: var(--bg);
  border-top: 1px solid var(--border);
}
body.high-contrast .card {
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: none;
}
body.high-contrast .page-meta .meta {
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: none;
}
body.high-contrast .search input {
  background: var(--bg);
  color: #fff;
  border: 1px solid var(--border);
}
body.high-contrast .search button {
  background: #fff;
  color: #000;
  border-color: #fff;
}
body.high-contrast .search button:focus {
  outline: 3px solid #fff;
}
body.high-contrast .search-dropdown {
  background: var(--bg);
  border: 1px solid var(--border);
}
body.high-contrast .search-dropdown-header {
  background: #111;
  border-bottom: 1px solid var(--border);
  color: #fff;
}
body.high-contrast .search-dropdown-list a {
  color: var(--accent-2);
}
body.high-contrast .search-dropdown-list a:hover {
  background: #111;
}
body.high-contrast .site-footer {
  background: var(--bg);
  border-top: 2px solid var(--border);
}
body.high-contrast .site-footer p:first-child {
  color: #fff;
}
body.high-contrast .site-footer p:nth-child(2) {
  color: #ffffff;
}
body.high-contrast .site-footer address {
  color: #ffffff;
}
body.high-contrast .site-footer p:last-child {
  border-top: 1px solid var(--border);
}
body.high-contrast .site-footer address strong {
  color: #fff;
}
body.high-contrast .site-footer a {
  color: var(--accent-2);
  background: rgba(90, 178, 255, 0.15);
  border-color: rgba(90, 178, 255, 0.3);
}
body.high-contrast .site-footer a:hover {
  color: var(--accent-2);
  background: rgba(90, 178, 255, 0.25);
  border-color: rgba(90, 178, 255, 0.4);
  text-decoration: none;
}
body.high-contrast .utility-bar .tool-btn {
  background: var(--bg);
  color: #fff;
  border: 1px solid var(--border);
}

/* High contrast logos - custom color transformation:
   - Biały → czarny, czarny → biały (invert)
   - Żółty pozostaje (przez niskie nasycenie i zachowanie kanału G)
   - Czerwony → biały (przez invert)
*/
body.high-contrast .brand-mark,
body.high-contrast .bip-logo {
  filter: invert(1) brightness(1.1) saturate(0.6);
}

/* Strong focus for accessibility */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
body.high-contrast :focus-visible {
  outline: 3px solid #ffffff;
}

body.font-lg {
  font-size: 18px;
}
body.font-xl {
  font-size: 20px;
}

/* Responsive - Tablet i mniejsze */
@media (max-width: 992px) {
  .wrap {
    padding: var(--space-2);
  }
  .site-header .wrap {
    padding-top: var(--space-3); /* Mniej paddingu na tabletach */
  }
  .branding {
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
  }
  .branding .marks {
    padding-right: 0; /* Usuń spacer na tabletach dla lepszej responsywności */
  }
  .branding .titles {
    flex-wrap: wrap; /* Pozwól na zawijanie na tabletach */
  }
  .site-title {
    font-size: 1.2rem;
    white-space: normal; /* Pozwól na zawijanie na tabletach */
  }
  .search {
    width: 100%;
    margin-top: var(--space-2);
    max-width: 100%;
  }
  .search input {
    min-width: 0;
    flex: 1;
  }
}

/* Responsive - Mobile (max-width: 768px) */
@media (max-width: 768px) {
  :root {
    --h1: 1.5rem;
    --h2: 1.3rem;
    --h3: 1.1rem;
    --space-2: 0.75rem;
    --space-3: 1rem;
  }

  .wrap {
    padding: var(--space-2);
  }

  .site-header .wrap {
    padding-top: var(--space-2); /* Mniej paddingu na mobile */
  }

  /* Header adjustments */
  .branding {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    order: 1; /* Po utility-bar */
  }
  .branding .marks {
    padding-right: 0; /* Usuń spacer na mobile */
  }
  .brand-mark {
    width: 48px;
    height: 48px;
  }
  .site-title {
    font-size: 1.1rem;
    line-height: 1.3;
    white-space: normal; /* Pozwól na zawijanie na mobile */
  }

  /* Search adjustments on mobile */
  .search {
    width: 100%;
    gap: var(--space-1);
    margin-top: var(--space-2);
    position: relative;
  }
  .search input {
    width: 100%;
    min-width: 0;
  }
  .search-dropdown {
    position: fixed;
    top: 120px;
    left: 1rem;
    right: 1rem;
    max-width: calc(100% - 2rem);
    max-height: 60vh;
  }
  .search-dropdown-list {
    max-height: calc(60vh - 60px);
  }

  /* Form inputs - prevent zoom on iOS */
  input[type="text"],
  input[type="email"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Utility bar adjustments */
  .utility-bar {
    order: 0; /* Na samej górze na mobile */
    margin-left: 0;
    margin-top: 0;
    width: 100%;
    justify-content: flex-start;
    margin-bottom: var(--space-1);
  }
  .utility-bar .tool-btn {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    padding: 0.4rem 0.5rem;
  }

  /* Navigation mobile menu */
  .main-nav .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.5rem var(--space-2);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 0.25rem;
    width: calc(100% - 2rem);
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
  }
  .main-nav .nav-toggle .nav-toggle-text {
    flex: 1;
    text-align: left;
  }
  .main-nav .nav-toggle .nav-toggle-icon {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.3s ease;
    display: inline-block;
  }
  .main-nav[aria-expanded="true"] .nav-toggle .nav-toggle-icon {
    transform: rotate(90deg);
  }
  .main-nav ul {
    display: none;
    padding: 0;
    margin: 0;
    flex-direction: column;
    width: 100%;
  }
  .main-nav[aria-expanded="true"] ul {
    display: flex;
  }
  .main-nav ul li {
    width: 100%;
  }
  .main-nav a {
    display: block;
    padding: 0.75rem var(--space-2);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .main-nav a:last-child {
    border-bottom: none;
  }

  /* Breadcrumbs */
  .breadcrumbs ol {
    padding: 0.5rem var(--space-2);
    font-size: 0.9rem;
    justify-content: flex-start;
    max-width: 100%;
  }

  /* Content spacing */
  .content {
    padding: var(--space-2) 0;
  }

  /* Cards */
  .card {
    padding: var(--space-2);
  }
  .page-meta .meta {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: var(--space-2);
    font-size: 0.9rem;
  }
  .page-meta .meta dt {
    font-weight: 600;
  }

  /* News list and quick links */
  .news-list li,
  .quick-links li {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  .news-list li a {
    display: block;
    width: 100%;
  }
  .news-list li time,
  .quick-links li time {
    font-size: 0.85rem;
    color: var(--muted);
  }

  /* Footer */
  .site-footer .wrap {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    gap: var(--space-2);
  }
  .site-footer p {
    font-size: 0.9rem;
  }
  .site-footer p:nth-child(2) {
    font-size: 0.85rem;
  }
  .site-footer address {
    margin-top: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    padding-top: 0;
  }
  .site-footer p:last-child {
    padding-top: var(--space-2);
    margin-top: var(--space-2);
  }

  /* Typography adjustments */
  h1 {
    font-size: var(--h1);
  }
}

/* Popup overlays */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  backdrop-filter: blur(4px);
}

.popup-overlay[hidden] {
  display: none;
}

.popup-content {
  background: var(--bg);
  border-radius: var(--radius);
  padding: var(--space-3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
}

.popup-content-large {
  max-width: 800px;
}

.popup-content h2 {
  margin-top: 0;
  margin-bottom: var(--space-2);
  font-size: var(--h2);
  color: var(--text);
}

.popup-text {
  margin-bottom: var(--space-3);
  color: var(--text);
  line-height: var(--leading);
}

.popup-text p {
  margin-bottom: var(--space-2);
}

.popup-text p:last-child {
  margin-bottom: 0;
}

.popup-text ol,
.popup-text ul {
  margin: var(--space-2) 0;
  padding-left: var(--space-3);
}

.popup-text li {
  margin-bottom: var(--space-1);
  line-height: var(--leading);
}

.popup-text a {
  color: var(--accent-2);
  text-decoration: underline;
}

.popup-text a:hover {
  color: var(--accent);
  text-decoration: none;
}

.popup-text a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.popup-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.popup-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: calc(var(--radius) / 2);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.popup-btn-primary {
  background: var(--accent-2);
  color: #ffffff;
}

.popup-btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.popup-btn-primary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.popup-btn-secondary {
  background: #f0f0f0;
  color: var(--text);
  border: 1px solid var(--border);
}

.popup-btn-secondary:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
}

.popup-btn-secondary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.popup-btn-tertiary {
  background: transparent;
  color: var(--accent-2);
  border: 2px solid var(--accent-2);
}

.popup-btn-tertiary:hover {
  background: rgba(0, 75, 141, 0.1);
  transform: translateY(-1px);
}

.popup-btn-tertiary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* High contrast mode for popups */
body.high-contrast .popup-overlay {
  background: rgba(0, 0, 0, 0.9);
}

body.high-contrast .popup-content {
  background: var(--bg);
  border: 2px solid var(--border);
}

body.high-contrast .popup-content h2 {
  color: #fff;
}

body.high-contrast .popup-text {
  color: #fff;
}

body.high-contrast .popup-text a {
  color: var(--accent-2);
}

body.high-contrast .popup-text a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

body.high-contrast .popup-btn-primary {
  background: var(--accent-2);
  color: #fff;
  border: 2px solid var(--accent-2);
}

body.high-contrast .popup-btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

body.high-contrast .popup-btn-secondary {
  background: var(--bg);
  color: #fff;
  border: 2px solid var(--border);
}

body.high-contrast .popup-btn-secondary:hover {
  background: var(--bg);
  border-color: var(--accent-2);
}

body.high-contrast .popup-btn-tertiary {
  background: transparent;
  color: var(--accent-2);
  border: 2px solid var(--accent-2);
}

body.high-contrast .popup-btn-tertiary:hover {
  background: rgba(90, 178, 255, 0.15);
  border-color: var(--accent-2);
}

/* Cookie settings checkboxes */
#cookie-necessary,
#cookie-analytics,
#cookie-marketing {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent-2);
  flex-shrink: 0;
}

#cookie-necessary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Cookie settings labels */
label[for^="cookie-"] {
  transition: all 0.2s ease;
}

label[for^="cookie-"]:hover {
  background: #f0f4f8 !important;
  border-color: var(--accent-2) !important;
}

label[for="cookie-necessary"] {
  opacity: 0.85;
}

label[for="cookie-necessary"]:hover {
  opacity: 1;
}

/* High contrast mode for cookie settings */
body.high-contrast label[for^="cookie-"] {
  background: var(--bg) !important;
  border-color: var(--border) !important;
}

body.high-contrast label[for^="cookie-"]:hover {
  background: rgba(90, 178, 255, 0.1) !important;
  border-color: var(--accent-2) !important;
}

/* Responsive popups */
@media (max-width: 768px) {
  .popup-content {
    padding: var(--space-2);
    max-height: 95vh;
  }

  .popup-content h2 {
    font-size: 1.3rem;
  }

  .popup-actions {
    flex-direction: column;
  }

  .popup-btn {
    width: 100%;
  }
}

/* Additional responsive styles */
@media (max-width: 480px) {
  p,
  ul,
  ol {
    font-size: 0.95rem;
  }

  .bip-logo {
    height: 36px;
  }
  .branding .titles {
    gap: 0.5rem;
  }
}

/* Responsive - Small mobile (max-width: 480px) */
@media (max-width: 480px) {
  :root {
    --h1: 1.3rem;
    --h2: 1.2rem;
    --h3: 1.05rem;
    --space-2: 0.625rem;
    --space-3: 0.875rem;
  }

  .wrap {
    padding: var(--space-2);
  }

  .site-title {
    font-size: 1rem;
  }

  .bip-logo {
    height: 32px;
  }

  .search {
    flex-direction: column;
  }
  .search button {
    width: 100%;
  }

  .utility-bar .tool-btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.4rem;
  }

  .card {
    padding: var(--space-2);
  }

  .breadcrumbs ol {
    font-size: 0.85rem;
    gap: 0.25rem;
  }

  .main-nav a {
    font-size: 0.95rem;
  }
}
