/* ==============================
   M3 HEADER — /assets/m3-header.css
   Zawiera: globalne resety, header,
   nawigacja, drawer, scroll-top,
   wpisy blogowe, archiwum
============================== */


/* ==============================
   1. GLOBALNE RESETY
============================== */

html {
  width: 100%;
  /* NIE dodawać overflow-x: hidden — niszczy position:fixed i hero full-width */
}

body {
  max-width: 100% !important;
  width: 100% !important;
  padding-top: 0;
  box-sizing: border-box;
  margin: 0;
  overflow-x: hidden; /* Tu OK — body nie wpływa na fixed header */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* WordPress — eliminacja domyślnych ograniczeń szerokości */
.entry-content,
.page-content,
.post-content,
main.site-main,
#primary,
#content,
.wp-site-blocks,
.site-content {
  max-width: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Hero — zapobiega przypadkowemu ograniczeniu przez WP wrappery */
.hero-section,
.m3-hero,
.home-hero {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* Ukryj natywny header motywu — zastąpiony przez #m3-header */
#site-header,
.site-header,
header.site-header,
.ast-site-header-wrap { /* Astra wrapper */
  display: none !important;
}


/* ==============================
   2. FIXED HEADER
============================== */

#m3-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  z-index: 99999 !important;
  background: #fff !important;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  font-family: 'Poppins', sans-serif;
}

/* Offset pod fixed header — wysokość ustawiana dynamicznie przez JS */
.m3-body-offset {
  height: 122px; /* fallback przed wykonaniem JS */
}

@media (max-width: 1024px) {
  .m3-body-offset {
    height: 65px; /* fallback mobile */
  }
}


/* ==============================
   3. TOPBAR
============================== */

.m3-topbar {
  background: #fff;
  border-bottom: 1px solid #eef3fb;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.m3-topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 40px;
  box-sizing: border-box;
}

.m3-topbar-logo a {
  display: block;
  text-decoration: none;
  flex-shrink: 0;
}
.m3-topbar-logo a:focus-visible {
  outline: 2px solid #275aab;
  border-radius: 4px;
}
.m3-topbar-logo img {
  height: 52px;
  width: auto;
  display: block;
}

.m3-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}


/* ==============================
   4. PRZYCISKI TELEFONÓW
============================== */

.m3-phone-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #275aab;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 50px;
  text-decoration: none !important;
  transition: all 0.3s;
  white-space: nowrap;
}
.m3-phone-btn:hover {
  background: #1e4080;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(39,90,171,0.3);
  color: #fff !important;
}
.m3-phone-btn:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 3px;
}

/* Telefon mobile — ikona z etykietą PL/UK */
.m3-phone-mobile {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none !important;
  flex-shrink: 0;
}
.m3-phone-mobile-icon {
  width: 34px;
  height: 34px;
  background: #275aab;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.m3-phone-mobile:hover .m3-phone-mobile-icon { background: #1e4080; }
.m3-phone-mobile:focus-visible .m3-phone-mobile-icon {
  outline: 2px solid #275aab;
  outline-offset: 2px;
}
.m3-phone-mobile span {
  color: #275aab;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}


/* ==============================
   5. SOCIAL IKONY W HEADERZE
============================== */

.m3-social-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.m3-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef3fb;
  color: #275aab !important;
  transition: all 0.3s;
  text-decoration: none !important;
  flex-shrink: 0;
}
.m3-social-link:hover {
  background: #275aab;
  color: #fff !important;
}
.m3-social-link:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 3px;
}


/* ==============================
   6. NAVBAR DESKTOP
============================== */

.m3-navbar {
  background: #275aab;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.m3-navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 40px;
  box-sizing: border-box;
}

.m3-nav {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.m3-nav > li { position: relative; }

.m3-nav > li > a,
.m3-nav > li > span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.9) !important;
  font-size: 15px;
  font-weight: 500;
  padding: 18px 16px;
  text-decoration: none !important;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  box-sizing: border-box;
  line-height: 1;
}
.m3-nav > li > a:hover,
.m3-nav > li > span:hover {
  color: #fff !important;
  border-bottom-color: rgba(255,255,255,0.7);
}
.m3-nav > li.current > a {
  color: #fff !important;
  border-bottom-color: #fff;
  font-weight: 600;
}
.m3-nav > li > a:focus-visible,
.m3-nav > li > span:focus-visible {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: -4px;
  border-radius: 4px;
}

.m3-arrow {
  display: inline-block;
  width: 14px;
  height: 14px;
  transition: transform 0.3s;
  opacity: 0.8;
  flex-shrink: 0;
}
.m3-nav > li.open > span .m3-arrow,
.m3-nav > li.open > a .m3-arrow { transform: rotate(180deg); }


/* ==============================
   7. DROPDOWN DESKTOP
============================== */

.m3-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  min-width: 260px;
  z-index: 10000;
  padding: 8px 0;
  border-top: 3px solid #275aab;
}

.m3-nav > li.open .m3-dropdown {
  display: block;
  animation: m3dropFade 0.2s ease;
}

@keyframes m3dropFade {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.m3-dropdown li { list-style: none; }

.m3-dropdown a {
  display: block;
  padding: 11px 22px;
  font-size: 14px;
  color: #2c3e50 !important;
  text-decoration: none !important;
  transition: all 0.2s;
  font-weight: 500;
}
.m3-dropdown a:hover {
  background: #eef3fb;
  color: #275aab !important;
  padding-left: 28px;
}
.m3-dropdown a:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: -3px;
  background: #eef3fb;
}


/* ==============================
   8. HAMBURGER
============================== */

.m3-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
  padding: 0;
}
.m3-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.m3-topbar-hamburger { background: #275aab; }
.m3-topbar-hamburger:hover { background: #1e4080; }
.m3-topbar-hamburger:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 3px;
}

/* Animacja hamburger → X gdy drawer otwarty */
.m3-topbar-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.m3-topbar-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.m3-topbar-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* ==============================
   9. MOBILE OVERLAY + DRAWER
============================== */

.m3-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.3s;
}
.m3-mobile-overlay.open {
  display: block;
  opacity: 1;
}

.m3-mobile-drawer {
  position: fixed;
  top: 0;
  left: -70%;
  width: 68%;
  max-width: 320px;
  height: 100%;
  background: #fff;
  z-index: 99999;
  box-shadow: 4px 0 30px rgba(0,0,0,0.15);
  transition: left 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.m3-mobile-drawer.open { left: 0; }

.m3-drawer-header {
  background: #fff;
  border-bottom: 2px solid #eef3fb;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.m3-drawer-header img {
  height: 40px;
  width: auto;
}

.m3-drawer-close {
  background: #eef3fb;
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #275aab;
  font-size: 18px;
  font-weight: 700;
  transition: background 0.2s;
  line-height: 1;
}
.m3-drawer-close:hover { background: #275aab; color: #fff; }
.m3-drawer-close:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 2px;
}

.m3-drawer-cta {
  padding: 16px 20px;
  border-bottom: 1px solid #eef3fb;
  flex-shrink: 0;
}
.m3-drawer-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #275aab 0%, #1e4080 100%);
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 50px;
  text-decoration: none !important;
  box-shadow: 0 4px 15px rgba(39,90,171,0.3);
  transition: opacity 0.2s;
}
.m3-drawer-cta a:hover { opacity: 0.9; }
.m3-drawer-cta a:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 3px;
}

/* === Mobile Nav Lista === */
.m3-mobile-nav {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1;
}

.m3-mobile-nav li a,
.m3-mobile-nav li span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50 !important;
  text-decoration: none !important;
  border-bottom: 1px solid #f0f4fb;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}
.m3-mobile-nav li a:hover,
.m3-mobile-nav li span:hover {
  background: #eef3fb;
  color: #275aab !important;
}
.m3-mobile-nav li.current > a {
  color: #275aab !important;
  font-weight: 700;
  background: #f5f8ff;
}
.m3-mobile-nav li a:focus-visible,
.m3-mobile-nav li span:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: -3px;
  background: #eef3fb;
}

.m3-mobile-arrow {
  transition: transform 0.3s;
  opacity: 0.5;
  flex-shrink: 0;
}
.m3-mobile-nav li.open .m3-mobile-arrow { transform: rotate(180deg); }

/* Submenu mobile */
.m3-mobile-sub {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f8fbff;
}
.m3-mobile-nav li.open .m3-mobile-sub { display: block; }

.m3-mobile-sub li { list-style: none; }
.m3-mobile-sub li a {
  padding: 11px 20px 11px 36px;
  font-size: 13px;
  color: #555 !important;
  border-bottom: 1px solid #eef3fb;
  justify-content: flex-start;
}
.m3-mobile-sub li a:hover {
  color: #275aab !important;
  background: #eef3fb;
}

/* Stopka drawera */
.m3-drawer-footer {
  padding: 20px;
  border-top: 1px solid #eef3fb;
  flex-shrink: 0;
}

.m3-drawer-phones {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.m3-drawer-phone {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eef3fb;
  color: #275aab !important;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none !important;
  transition: background 0.2s;
}
.m3-drawer-phone:hover { background: #dce8f7; }

.m3-drawer-socials {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.m3-drawer-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #275aab;
  color: #fff !important;
  border-radius: 50%;
  text-decoration: none !important;
  transition: all 0.3s;
}
.m3-drawer-socials a:hover {
  background: #1e4080;
  transform: translateY(-2px);
}
.m3-drawer-socials a:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 3px;
}


/* ==============================
   10. SCROLL TO TOP
============================== */

.m3-scroll-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 46px;
  height: 46px;
  background: #275aab;
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9000;
  box-shadow: 0 4px 16px rgba(39,90,171,0.35);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease, box-shadow 0.2s ease;
  pointer-events: none;
}
.m3-scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.m3-scroll-top:hover {
  background: #1e4080;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(39,90,171,0.4);
}
.m3-scroll-top:focus-visible {
  outline: 2px solid #275aab;
  outline-offset: 3px;
}


/* ==============================
   11. WPISY BLOGOWE I ARCHIWUM
============================== */

.m3-post-container,
.m3-archive-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 60px 20px;
  box-sizing: border-box;
}

.m3-post-title {
  font-size: 32px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 16px;
  line-height: 1.3;
}

.m3-post-meta {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #eef3fb;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.m3-post-content {
  font-size: 16px;
  line-height: 1.8;
  color: #2c3e50;
}
.m3-post-content h2 { font-size: 26px; margin: 40px 0 16px; color: #2c3e50; }
.m3-post-content h3 { font-size: 22px; margin: 32px 0 14px; color: #2c3e50; }
.m3-post-content h4 { font-size: 18px; margin: 24px 0 12px; color: #2c3e50; }
.m3-post-content p  { margin: 0 0 20px; }
.m3-post-content ul,
.m3-post-content ol { margin: 0 0 20px; padding-left: 24px; }
.m3-post-content li { margin-bottom: 8px; }
.m3-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 24px 0;
}
.m3-post-content a {
  color: #275aab;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.m3-post-content a:hover { color: #1e4080; }
.m3-post-content blockquote {
  border-left: 4px solid #275aab;
  margin: 24px 0;
  padding: 16px 24px;
  background: #eef3fb;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: #6c757d;
}

/* Archiwum — lista wpisów */
.m3-archive-item {
  border-bottom: 1px solid #eef3fb;
  padding-bottom: 32px;
  margin-bottom: 32px;
}
.m3-archive-item:last-child {
  border-bottom: none;
}
.m3-archive-item h2 {
  font-size: 20px;
  margin: 0 0 10px;
  line-height: 1.4;
}
.m3-archive-item h2 a {
  color: #2c3e50;
  text-decoration: none;
  transition: color 0.2s;
}
.m3-archive-item h2 a:hover { color: #275aab; }
.m3-archive-item .entry-summary,
.m3-archive-item p {
  color: #6c757d;
  font-size: 15px;
  line-height: 1.7;
  margin: 0;
}

/* Nawigacja między stronami archiwum */
.m3-posts-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #eef3fb;
  gap: 16px;
}
.m3-posts-nav a {
  color: #275aab;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s;
}
.m3-posts-nav a:hover { color: #1e4080; }

@media (max-width: 600px) {
  .m3-post-title { font-size: 24px; }
  .m3-post-container,
  .m3-archive-container { padding: 40px 16px; }
  .m3-post-content h2 { font-size: 22px; }
  .m3-post-content h3 { font-size: 18px; }
}


/* ==============================
   12. RESPONSIVE HEADER
============================== */

@media (max-width: 1024px) {
  .m3-nav    { display: none; }
  .m3-navbar { display: none; }
  .m3-hamburger { display: flex; }
  .m3-topbar-inner { padding: 10px 16px; }
  .m3-topbar-right .m3-phone-btn   { display: none; }
  .m3-topbar-right .m3-social-links { display: none; }
  .m3-phone-mobile { display: flex; }
}

@media (min-width: 1025px) {
  .m3-topbar-hamburger { display: none !important; }
  .m3-phone-mobile     { display: none !important; }
}


/* ==============================
   13. PRINT
============================== */

@media print {
  #m3-header,
  .m3-body-offset,
  .m3-scroll-top,
  .m3-mobile-overlay,
  .m3-mobile-drawer { display: none !important; }
}
