/* InfoGrunt design system — final responsive/a11y layer, 2026-07-15. */
:root {
  --ig-ink: #10251a;
  --ig-muted: #536457;
  --ig-green: #0f7a39;
  --ig-green-strong: #0b6530;
  --ig-dark: #103221;
  --ig-lime: #a7ff45;
  --ig-paper: #fffef8;
  --ig-line: rgba(16, 50, 33, .16);
  --ig-focus: #1769aa;
}

html { overflow-x: hidden; }
body { min-width: 0; }
img, svg, canvas, video { max-width: 100%; }
button, a, input, select, textarea { min-width: 0; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--ig-focus) !important;
  outline-offset: 3px;
}
:where(p, li, td, th, dd, blockquote, figcaption, .menu-item-label) {
  overflow-wrap: anywhere;
}

/* Jeden nagłówek na mapie, stronach danych i stronach treściowych. */
.topbar.ig-topbar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #f5fff1;
  background: linear-gradient(135deg, #0d2f1d, #174a30);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 12px 32px rgba(4, 26, 14, .22);
}
.topbar.ig-topbar .brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}
.topbar.ig-topbar .brand .logo {
  display: block;
  flex: 0 0 44px;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  margin: 0;
  padding: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
}
.topbar.ig-topbar .brand .logo svg { display: block; width: 100%; height: 100%; }
.topbar.ig-topbar .brand-text { display: block; min-width: 0; }
.topbar.ig-topbar .brand-text strong {
  display: block;
  color: #fff;
  font-size: clamp(18px, 1.65vw, 24px);
  line-height: 1.05;
  letter-spacing: -.4px;
  white-space: nowrap;
}
.topbar.ig-topbar .brand-text > span {
  display: block;
  margin-top: 3px;
  color: #d8eddc;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}
.ig-primary-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex: 1 1 auto;
  gap: 5px;
  min-width: 0;
}
.ig-primary-nav .nav-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #edf8ef;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}
.ig-primary-nav .nav-tile:hover,
.ig-primary-nav .nav-tile.is-active {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.15);
}
.topbar.ig-topbar .topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 7px;
  margin-left: auto;
}
.topbar.ig-topbar :is(.lang-toggle, .menu-toggle, .account-toggle) {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.09);
}
.topbar.ig-topbar :is(.lang-toggle, .menu-toggle, .account-toggle):hover {
  background: rgba(255,255,255,.18);
}
.topbar.ig-topbar .lang-code { color: #fff; margin: 0; font-size: 13px; font-weight: 850; }
.ig-header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 15px;
  border-radius: 12px;
  color: #10251a;
  background: var(--ig-lime);
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}
.ig-header-cta.is-active { display: none; }

/* Strony bez mapy: nagłówek jest częścią przepływu, nigdy nie znika ani nie ma 0 px. */
body:not(.has-map-shell) .topbar.ig-topbar,
.topbar.ig-topbar--content {
  position: sticky !important;
  inset: auto !important;
  top: 0 !important;
  z-index: 90;
  width: 100% !important;
  max-width: none !important;
  min-height: 72px;
  height: auto !important;
  margin: 0 !important;
  padding: 10px clamp(14px, 3vw, 42px) !important;
  border-width: 0 0 1px;
  border-radius: 0 !important;
  transform: none !important;
}
body:not(.has-map-shell) :is(.gm-wrap, .rk-wrap) { padding-top: 28px !important; }

/* Mapy zachowują własną geometrię, ale korzystają z jednego markupu. */
body.has-map-shell .topbar.ig-topbar--search .ig-primary-nav,
body.has-map-shell .topbar.ig-topbar--search .ig-header-cta { display: none !important; }
body.has-map-shell .topbar.ig-topbar--search .top-search { flex: 1 1 500px; min-width: 260px; }
body.has-map-shell .topbar.ig-topbar--search .search-wrap { min-width: 0; }
body.has-map-shell .topbar.ig-topbar--search .top-search input { width: 100%; min-width: 0; }

/* Dropdowny są identyczne również na stronach, które nie ładują app.css. */
.app-menu, .lang-picker {
  position: fixed;
  z-index: 120;
  box-sizing: border-box;
  max-width: calc(100vw - 16px);
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid var(--ig-line);
  border-radius: 16px;
  color: var(--ig-ink);
  background: var(--ig-paper);
  box-shadow: 0 18px 48px rgba(4, 26, 14, .25);
}
.app-menu[aria-hidden="true"], .lang-picker[aria-hidden="true"] { display: none !important; }
.app-menu:not([aria-hidden="true"]) { display: grid; width: min(300px, calc(100vw - 16px)); padding: 8px; gap: 2px; }
.lang-picker:not([aria-hidden="true"]) { display: grid; width: min(190px, calc(100vw - 16px)); padding: 7px; gap: 3px; }
.app-menu .menu-item, .lang-picker .lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  color: var(--ig-ink);
  background: transparent;
  text-decoration: none;
  text-align: left;
  font-size: 14px;
  font-weight: 750;
}
.app-menu .menu-item:hover, .lang-picker .lang-option:hover,
.lang-picker .lang-option.active { background: #edf7ec; color: #0b6530; }
.menu-item-icon { flex: 0 0 24px; text-align: center; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--ig-line); }

/* Czytelność, kontrast i bezpieczne szerokości treści. */
:where(.gm-none, .gm-sub, .gm-meta, .rk-meta, .rk-gloc, .rk-note, .rk-empty,
  .art-meta, .article-card .meta, .site-footer, .source-note, .footer-note) {
  color: var(--ig-muted) !important;
}
:where(.article-card .read-more, .poradnik-index a, .blog-article a, .static-site main a) {
  color: var(--ig-green-strong);
}
.article-card .read-more { font-weight: 800; }
.static-site main, .blog-article main, .poradnik-index main,
.gm-wrap, .rk-wrap { min-width: 0; }
.blog-article .article-body,
.blog-article article { font-size: 16px; line-height: 1.68; }
.blog-article .article-body :is(p, ul, ol, blockquote),
.blog-article article :is(p, ul, ol, blockquote) { max-width: 76ch; }
.blog-article :is(table, pre, code), .static-site :is(table, pre, code) { max-width: 100%; }
.blog-article .table-wrap, .static-site .table-wrap { max-width: 100%; overflow-x: auto; }

/* Raport: żadna karta ani długi identyfikator nie może rozpychać panelu. */
body.has-map-shell :is(.parcel-drawer, .report-content, .report-accordion,
  .report-acc-section, .report-acc-body, .report-acc-body > *, .tab-content,
  .card, .notice, .ig-main-card, .ig-metric, .ig-action-panel, .ig-parcel-c) {
  min-width: 0 !important;
  max-width: 100% !important;
}
body.has-map-shell :is(.report-content, .report-accordion, .report-acc-body, .tab-content) {
  width: 100% !important;
  box-sizing: border-box;
}
body.has-map-shell .report-content :is(p, li, td, th, dd) {
  font-size: max(14px, .92rem);
  line-height: 1.55;
}
body.has-map-shell .report-content :is(p, ul, ol) { max-width: 76ch; }
body.has-map-shell .report-content :is(table, pre) { max-width: 100%; }
body.has-map-shell .report-content table { width: 100%; }
body.has-map-shell .report-content :is(.table-wrap, .ig-table-wrap, .rcn-table-wrap) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
body.has-map-shell :is(.drawer-close, .report-actions a, .report-actions button,
  .report-acc-summary, summary, .ig-explore-tile) { min-height: 44px; }

/* Poradniki i karty — stabilny układ od 320 px. */
.poradnik-index .articles-grid { align-items: stretch; }
.poradnik-index .article-card { min-width: 0; height: 100%; }
.poradnik-index .por-search :is(input, button) { min-height: 44px; }
.poradnik-index .por-search .clear { color: #35483b; }

@media (max-width: 1180px) {
  .topbar.ig-topbar--content .ig-primary-nav .nav-tile-label { display: none; }
  .topbar.ig-topbar--content .ig-primary-nav .nav-tile { min-width: 44px; padding: 8px; }
}

@media (max-width: 760px) {
  .topbar.ig-topbar--content,
  body:not(.has-map-shell) .topbar.ig-topbar {
    gap: 8px;
    min-height: 64px;
    padding: 8px 10px !important;
  }
  .topbar.ig-topbar--content .brand .logo,
  body:not(.has-map-shell) .topbar.ig-topbar .brand .logo {
    flex-basis: 40px;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
  }
  .topbar.ig-topbar--content .brand-text strong,
  body:not(.has-map-shell) .topbar.ig-topbar .brand-text strong { font-size: 18px; }
  .topbar.ig-topbar--content .brand-text > span,
  body:not(.has-map-shell) .topbar.ig-topbar .brand-text > span { display: none; }
  .topbar.ig-topbar--content .ig-primary-nav,
  body:not(.has-map-shell) .topbar.ig-topbar .ig-primary-nav,
  .topbar.ig-topbar--content .ig-header-cta { display: none; }
  .topbar.ig-topbar :is(.lang-toggle, .menu-toggle, .account-toggle) {
    flex-basis: 44px;
  }

  body.has-map-shell .topbar.ig-topbar--search {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: 48px 54px !important;
    gap: 6px 8px !important;
    width: 100% !important;
    min-height: 116px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 7px 9px !important;
    border-radius: 0 !important;
    transform: none !important;
  }
  body.has-map-shell .topbar.ig-topbar--search .brand { grid-column: 1; grid-row: 1; }
  body.has-map-shell .topbar.ig-topbar--search .brand .logo {
    flex-basis: 38px;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
  }
  body.has-map-shell .topbar.ig-topbar--search .brand-text strong { font-size: 17px; }
  body.has-map-shell .topbar.ig-topbar--search .brand-text > span { display: none !important; }
  body.has-map-shell .topbar.ig-topbar--search .topbar-right { grid-column: 2; grid-row: 1; }
  body.has-map-shell .topbar.ig-topbar--search .top-search {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) 46px !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  body.has-map-shell .topbar.ig-topbar--search .top-search:not(.has-search-tabs) {
    grid-template-columns: minmax(0, 1fr) 46px !important;
  }
  body.has-map-shell .topbar.ig-topbar--search .top-search .tabs { min-width: 0; }
  body.has-map-shell .topbar.ig-topbar--search .top-search .tab {
    min-height: 44px;
    padding: 8px 9px;
    font-size: 12px;
  }
  body.has-map-shell .topbar.ig-topbar--search .top-search :is(input, .primary) {
    height: 46px !important;
    min-height: 46px;
  }
  body.has-map-shell .topbar.ig-topbar--search .top-search input { padding-inline: 11px; font-size: 14px; }

  body.has-map-shell .parcel-drawer {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    padding-inline: 12px !important;
  }
  body.has-map-shell .parcel-drawer .report-content {
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 2px !important;
  }
  body.has-map-shell .report-acc-summary { padding-inline: 11px !important; }
  body.has-map-shell .report-acc-body { padding-inline: 0 !important; }
  body.has-map-shell .report-content :is(.kv, .ig-inline-kv) {
    grid-template-columns: minmax(92px, .42fr) minmax(0, 1fr) !important;
  }
  body.has-map-shell .report-content :is(.ig-feature-grid, .ig-steps, .ig-posts-grid) {
    grid-template-columns: 1fr !important;
  }

  .poradnik-index .articles-grid { grid-template-columns: 1fr !important; }
  .poradnik-index .por-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .poradnik-index .por-search input { width: 100%; }
  .blog-article .article-body,
  .blog-article article { font-size: 15.5px; line-height: 1.65; }
}

@media (max-width: 390px) {
  .topbar.ig-topbar--content .brand-text,
  body:not(.has-map-shell) .topbar.ig-topbar .brand-text { display: none; }
  body.has-map-shell .topbar.ig-topbar--search .top-search.has-search-tabs {
    grid-template-columns: 106px minmax(0, 1fr) 44px !important;
  }
  body.has-map-shell .topbar.ig-topbar--search .top-search .tab {
    padding-inline: 6px;
    font-size: 11px;
  }
}

@media print {
  .topbar.ig-topbar, .app-menu, .lang-picker { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
