/* ECM — czerwień identyfikacyjna */
:root {
  --ecm-red: #d62828;
  --ecm-red-dark: #9b1c1c;
  --ecm-red-soft: rgba(214, 40, 40, 0.12);
  --ink: #141414;
  --ink-muted: #4a4a4a;
  --paper: #f6f4f2;
  --paper-elevated: #ffffff;
  --line: rgba(20, 20, 20, 0.08);
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 18px 50px rgba(20, 20, 20, 0.08);
  --font: "DM Sans", system-ui, sans-serif;
  --header-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /*
   * WordPress / OceanWP / Elementor często zmniejszają bazę na <html> (np. 62.5% → 1rem ≈ 10px).
   * Ten arkusz ładuje się tylko na stronie huba — przywracamy czytelny 1rem (~16px), jak w przeglądarce przy index.html.
   */
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  /* Bez padding-top: w WordPress nagłówek daje OceanWP — prototypowy offset pod .site-header nie jest używany */
  /* Bazowy rozmiar tekstu: .ecm-hub (jak .ecm-custom w klaster/styles) — nie font-size na body, żeby nie walczyć z rem */
}

/* Izolacja typografii huba — ta sama idea co .ecm-custom w klaster/styles (1).css */
.ecm-hub {
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 1.4rem;
  line-height: 1.55;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--ecm-red-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ecm-red);
}

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

/* ——— Header ——— */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--paper-elevated) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  height: 3.25rem;
  padding: 0 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--ecm-red);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(214, 40, 40, 0.35);
}

.brand__mark--sm {
  min-width: 2.5rem;
  height: 2.5rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__title {
  font-weight: 700;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

.brand__subtitle {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.nav {
  display: none;
  gap: 1.75rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a {
  text-decoration: none;
  color: var(--ink);
}

.nav a:hover {
  color: var(--ecm-red);
}

@media (min-width: 768px) {
  .nav {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }
}

.nav-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-elevated);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav-toggle__bar {
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

.mobile-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 1.25rem;
  background: var(--paper-elevated);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.mobile-nav[hidden] {
  display: none;
}

.mobile-nav a {
  padding: 0.65rem 0;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.mobile-nav a:last-child {
  border-bottom: 0;
}

/* ——— Hero ——— */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.35rem, 3.5vw, 2.25rem) clamp(1.25rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(
    135deg,
    var(--paper-elevated) 0%,
    color-mix(in srgb, var(--ecm-red-soft) 100%, white) 55%,
    var(--paper) 100%
  );
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 34rem;
}

.hero__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ecm-red);
}

.hero__heading {
  margin: 0 0 0.55rem;
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero__ecm {
  display: inline-block;
  margin-left: 0.15em;
  padding: 0.08em 0.35em;
  font-size: 0.72em;
  vertical-align: middle;
  color: #fff;
  background: var(--ecm-red);
  border-radius: 8px;
  letter-spacing: 0.06em;
}

.hero__lead {
  margin: 0 0 1rem;
  color: var(--ink-muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero__visual {
  position: absolute;
  right: -6%;
  top: 50%;
  transform: translateY(-50%);
  width: min(38vw, 280px);
  aspect-ratio: 1;
  pointer-events: none;
}

.hero__orb {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 35%,
    rgba(214, 40, 40, 0.2),
    transparent 55%
  ),
    radial-gradient(circle at 70% 60%, rgba(155, 28, 28, 0.15), transparent 50%);
  border: 1px solid var(--line);
}

@media (max-width: 900px) {
  .hero__visual {
    opacity: 0.45;
    right: -20%;
  }
}

/* ——— Pasek promocyjny (kalkulator) ——— */
.hub-promo-strip {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ecm-red-soft) 120%, white) 0%,
    var(--paper-elevated) 55%,
    color-mix(in srgb, var(--ecm-red-soft) 80%, white) 100%
  );
}

.hub-promo-strip__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  max-width: none;
  padding: 0.85rem clamp(1.25rem, 5vw, 3rem);
  margin: 0 auto;
}

.hub-promo-strip__text {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}

.hub-promo-strip__link {
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(214, 40, 40, 0.28);
}

.hub-promo-strip__link:hover {
  color: #fff;
}

.hub-promo-strip__arrow {
  margin-left: 0.35em;
}

@media (max-width: 640px) {
  .hub-promo-strip__inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .hub-promo-strip__link {
    justify-content: center;
  }
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  color: #fff;
  background: var(--ecm-red);
  border-color: var(--ecm-red);
  box-shadow: 0 6px 22px rgba(214, 40, 40, 0.35);
}

.btn--primary:hover {
  background: var(--ecm-red-dark);
  border-color: var(--ecm-red-dark);
  color: #fff;
}

.btn--ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.btn--ghost:hover {
  border-color: var(--ecm-red);
  color: var(--ecm-red);
}

/* ——— Sections ——— */
.section {
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1.25rem, 5vw, 3rem);
}

.section__head {
  max-width: 40rem;
  margin-bottom: 1.75rem;
}

.section__head h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  letter-spacing: -0.02em;
}

.section__head p {
  margin: 0;
  color: var(--ink-muted);
}

.map-section {
  background: var(--paper-elevated);
  padding-top: clamp(1.25rem, 3vw, 2rem);
}

.calculator-section {
  background: var(--paper);
  padding-top: clamp(1.5rem, 3vw, 2.25rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}

.calculator-section__head {
  margin-bottom: 1.25rem;
}

.calculator-section__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ecm-red);
}

.calculator-intro {
  max-width: 52rem;
  margin-bottom: 1.25rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

.calculator-intro p {
  margin: 0 0 1rem;
}

.calculator-intro p:last-child {
  margin-bottom: 0;
}

.calculator-demo-notice {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--ecm-red);
  background: color-mix(in srgb, var(--ecm-red-soft) 140%, white);
  color: var(--ink);
  font-weight: 600;
}

.calculator-howto {
  max-width: 52rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-elevated);
  box-shadow: 0 2px 0 rgba(20, 20, 20, 0.03);
}

.calculator-howto__summary {
  padding: 1rem 1.15rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.calculator-howto__summary::-webkit-details-marker {
  display: none;
}

.calculator-howto__summary::after {
  content: "+";
  float: right;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ecm-red);
  line-height: 1;
}

.calculator-howto[open] .calculator-howto__summary::after {
  content: "−";
}

.calculator-howto__body {
  padding: 0 1.15rem 1.15rem;
  border-top: 1px solid var(--line);
}

.calculator-howto__list {
  margin: 1rem 0 0;
  padding-left: 1.25rem;
  color: var(--ink-muted);
}

.calculator-howto__list li {
  margin-bottom: 1rem;
}

.calculator-howto__list li:last-child {
  margin-bottom: 0;
}

.calculator-howto__list strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.calculator-howto__list p {
  margin: 0;
  line-height: 1.55;
}

.calculator-section__title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ecm-calculator-page .calculator-section {
  padding-top: clamp(1.25rem, 3vw, 2rem);
}

.calculator-frame-wrap {
  width: 100%;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--paper-elevated);
}

.calculator-disclaimer {
  max-width: 52rem;
  margin: 0;
  padding: clamp(1.15rem, 3vw, 1.5rem) clamp(1.25rem, 3vw, 1.75rem);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--ecm-red) 35%, var(--line));
  border-left-width: 4px;
  border-left-color: var(--ecm-red-dark);
  background: linear-gradient(
    125deg,
    var(--paper-elevated),
    color-mix(in srgb, var(--ecm-red-soft) 100%, white)
  );
  box-shadow: var(--shadow);
}

.calculator-disclaimer__title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  font-weight: 700;
  color: var(--ecm-red-dark);
}

.calculator-disclaimer p {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

.calculator-disclaimer p:last-child {
  margin-bottom: 0;
}

.calculator-frame {
  display: block;
  width: 100%;
  height: 1500px;
  max-width: 100%;
  border: 0;
  vertical-align: top;
  background: #fff;
}

@media (max-width: 768px) {
  .calculator-frame {
    height: min(1500px, 120vh);
  }
}

.map {
  position: relative;
  height: min(70vh, 560px);
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Pierwsze dotknięcie na mobile: pełna powierzchnia łapie gest (scroll strony), wizualnie tylko delikatny pasek na dole */
.ecm-map-touch-guard {
  position: absolute;
  inset: 0;
  z-index: 650;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.35rem 0.5rem 0.45rem;
  box-sizing: border-box;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  /* Lekki, niski pasek — reszta mapy bez „mleka” */
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--ink) 14%, transparent) 0%,
    color-mix(in srgb, var(--ink) 5%, transparent) 12%,
    transparent 22%
  );
}

.ecm-map-touch-guard__hint {
  display: block;
  max-width: 16em;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-muted);
  text-shadow: 0 0 0.35rem color-mix(in srgb, var(--paper-elevated) 85%, transparent),
    0 0 0.5rem color-mix(in srgb, var(--paper-elevated) 70%, transparent);
}

/* Leaflet popup — ECM */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md);
  font-family: var(--font);
}

.leaflet-popup-content {
  margin: 0.85rem 1rem;
  min-width: 200px;
}

.popup-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.popup-region {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ecm-red);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.popup-desc {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.popup-link {
  display: inline-block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ecm-red-dark);
}

.cluster-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: stretch;
}

.cluster-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  box-shadow: 0 2px 0 rgba(20, 20, 20, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cluster-card:hover {
  border-color: color-mix(in srgb, var(--ecm-red) 35%, var(--line));
  box-shadow: var(--shadow);
}

.cluster-card__region {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ecm-red);
  margin-bottom: 0.35rem;
  min-height: 2.25em;
  line-height: 1.2;
}

.cluster-card__title {
  flex-shrink: 0;
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  min-height: calc(1.1rem * 1.25 * 2);
}

.cluster-card__desc {
  flex-shrink: 0;
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.45;
  min-height: calc(0.92rem * 1.45 * 4);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.cluster-card__meta {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 0;
  min-height: 1.35em;
  line-height: 1.35;
}

.cluster-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.cluster-card__btn {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ecm-red-dark);
}

.cluster-card__btn:hover {
  color: var(--ecm-red);
}

button.cluster-card__btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.cluster-card__btn--secondary {
  color: var(--ink-muted);
}

.cluster-card__btn--secondary:hover {
  color: var(--ecm-red);
  text-decoration: underline;
}

.cluster-card--empty {
  grid-column: 1 / -1;
  max-width: 36rem;
  margin: 0 auto;
}

.cluster-card--empty .cluster-card__desc {
  margin-bottom: 0;
  min-height: 0;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  display: block;
}

.cluster-card__map-btn--disabled,
.cluster-card__map-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: none !important;
}

.cta-section {
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
  align-items: stretch;
}

@media (max-width: 768px) {
  .cta-grid {
    grid-template-columns: 1fr;
  }
}

.cta {
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: linear-gradient(
    125deg,
    var(--paper-elevated),
    color-mix(in srgb, var(--ecm-red-soft) 120%, white)
  );
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.cta .btn {
  margin-top: auto;
  align-self: flex-start;
}

.cta h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 3vw, 1.65rem);
}

.cta p {
  margin: 0 0 1.25rem;
  color: var(--ink-muted);
}

/* Szablon WordPress template-hub-ecm.php (OceanWP ma własny header — sekcja .site-header z prototypu nie jest używana) */
.ecm-hub-editor {
  background: var(--paper-elevated);
}

.ecm-hub-editor__content {
  max-width: 48rem;
}
