:root {
  --bg: #fff;
  --surface: #fff;
  --text: #202020;
  --muted: #666;
  --primary: #67459b;
  --primary-soft: #f3eff8;
  --border: #e6e6e6;
  --header: #202020;
  --content-top-gap: 64px;
  --shadow-soft: 0 18px 50px rgba(32, 32, 32, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--brand-font, Prompt, system-ui, sans-serif);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease; }
main { flex: 1; }

main.container {
  padding-top: var(--content-top-gap);
  padding-bottom: 88px;
}

.container,
.foen-header-inner,
.foen-footer-inner {
  width: min(1320px, calc(100vw - 60px));
  margin: 0 auto;
}

.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;
}

/* Nagłówek zgodny z foen.pl */
.site-header {
  position: relative;
  z-index: 50;
  flex: 0 0 auto;
  background: var(--header);
}

.foen-header-inner {
  min-height: 110px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  width: max-content;
  color: #fff;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 130px;
  height: auto;
}

.foen-main-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(16px, 1.55vw, 30px);
}

.foen-main-nav a {
  position: relative;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.foen-main-nav a::after {
  position: absolute;
  right: 0;
  bottom: -10px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.foen-main-nav a:hover,
.foen-main-nav a:focus-visible,
.foen-main-nav a.is-current { color: var(--primary); }

.foen-main-nav a:hover::after,
.foen-main-nav a:focus-visible::after,
.foen-main-nav a.is-current::after { transform: scaleX(1); }

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
}

.header-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 34px;
  color: #fff;
}

.header-icon-link:hover { color: var(--primary); }

.header-icon-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.language-dropdown {
  position: relative;
  color: #fff;
  font: 500 12px/1 Prompt, sans-serif;
}

.language-dropdown summary {
  min-width: 58px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  list-style: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.language-dropdown summary::-webkit-details-marker { display: none; }

.language-dropdown summary:hover,
.language-dropdown summary:focus-visible,
.language-dropdown[open] summary {
  border-color: var(--primary);
  background: rgba(103, 69, 155, 0.16);
  outline: none;
}

.language-dropdown summary svg {
  width: 10px;
  height: 7px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 0.2s ease;
}

.language-dropdown[open] summary svg { transform: rotate(180deg); }

.language-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  min-width: 150px;
  padding: 6px;
  border: 1px solid #353535;
  background: #181818;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
}

.language-dropdown-menu a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
}

.language-dropdown-menu a:hover,
.language-dropdown-menu a:focus-visible,
.language-dropdown-menu a.is-active {
  color: #fff;
  background: var(--primary);
  outline: none;
}

.language-dropdown-menu strong {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.mobile-menu-toggle {
  display: none;
  width: 36px;
  padding: 4px;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.mobile-menu-toggle > span:not(.visually-hidden) {
  display: block;
  width: 25px;
  height: 2px;
  margin: 5px 0;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Treść bloga */
.page-intro {
  position: relative;
  max-width: 920px;
  padding: 24px 0 46px;
}

.page-intro::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 58px;
  height: 3px;
  content: "";
  background: var(--primary);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-intro h1,
.post-full h1,
.related-posts h2,
.empty-state h2,
.error-page h1 {
  margin: 0;
  color: var(--text);
  font-family: Poppins, Prompt, sans-serif;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.page-intro h1 {
  font-size: clamp(44px, 6.2vw, 82px);
  line-height: 1.05;
}

.page-intro p:last-child {
  max-width: 710px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.filters {
  margin: 0 0 36px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
}

a.tag:hover,
.tag.active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.posts-section { margin-bottom: 36px; }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 42px 28px;
  align-items: stretch;
}

.post-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.post-card-media-link {
  position: relative;
  display: block;
  overflow: hidden;
  background: #f3f3f3;
  text-decoration: none;
}

.post-card-media-link::after {
  position: absolute;
  inset: 0;
  content: "";
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.post-card:hover .post-card-media-link::after { opacity: 0.1; }

.post-cover,
.post-cover-large {
  width: 100%;
  display: block;
  object-fit: cover;
}

.post-cover {
  aspect-ratio: 16 / 10;
  transition: transform 0.45s ease;
}

.post-card:hover .post-cover { transform: scale(1.025); }

.post-card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 23px 0 0;
}

.post-card h2,
.post-card h3 {
  margin: 0;
  font-family: Poppins, Prompt, sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
}

.post-title-link {
  color: var(--text);
  text-decoration: none;
}

.post-title-link:hover { color: var(--primary); }

.post-date,
.post-meta {
  margin: 0;
  color: #999;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.post-card-content .tags {
  margin-top: auto;
  padding-top: 7px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin: 0 0 30px;
  color: #999;
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
}

.breadcrumbs a:hover { color: var(--primary); }

.post-full {
  max-width: 1080px;
  margin: 0 auto;
}

.post-cover-large { max-height: 620px; }

.post-article-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 46px 0 0;
}

.post-full h1 {
  margin: 10px 0 18px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.12;
}

.post-meta-inline {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  line-height: 1.8;
}

.post-content {
  margin-top: 38px;
  color: #383838;
  font-family: Poppins, Prompt, sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.85;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 1.75em 0 0.65em;
  color: var(--text);
  font-family: Prompt, Poppins, sans-serif;
  font-weight: 600;
  line-height: 1.25;
}

.post-content h2 { font-size: 31px; }
.post-content h3 { font-size: 25px; }

.post-content p,
.post-content ul,
.post-content ol,
.post-content table,
.post-content figure { margin: 0 0 1.25rem; }

.post-content ul,
.post-content ol { padding-left: 1.6rem; }
.post-content li + li { margin-top: 0.45rem; }

.post-content a {
  color: var(--primary);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.post-content > *:first-child { margin-top: 0; }
.post-content > *:last-child { margin-bottom: 0; }

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

.post-content iframe,
.post-content table,
.post-content pre { max-width: 100%; }

.post-content table {
  display: table;
  width: 100%;
  table-layout: auto;
  border: 1px solid var(--border);
  border-spacing: 0;
  border-collapse: separate;
  background: var(--surface);
}

.post-content th,
.post-content td {
  min-width: 8rem;
  padding: 11px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: var(--primary-soft);
  font-weight: 600;
}

.post-content tr > :last-child { border-right: 0; }
.post-content tbody tr:last-child > td { border-bottom: 0; }

.post-content code {
  padding: 0.12em 0.35em;
  color: var(--code-text);
  background: var(--code-bg);
  font-size: 0.9em;
}

.post-content pre {
  overflow-x: auto;
  padding: 20px;
  color: var(--code-text);
  background: var(--code-bg);
}

.post-content pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.post-content blockquote {
  margin: 30px 0;
  padding: 9px 0 9px 25px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
  font-size: 19px;
}

.post-content hr {
  margin: 38px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.post-content figcaption {
  margin-top: 8px;
  color: #999;
  font-size: 12px;
  text-align: center;
}

.related-posts {
  margin-top: 82px;
  padding-top: 44px;
  border-top: 1px solid var(--border);
}

.related-posts > h2 {
  margin-bottom: 30px;
  font-size: 32px;
}

.empty-state,
.error-page {
  padding: 58px;
  border: 1px solid var(--border);
  text-align: center;
}

.empty-state p:last-child,
.error-page p:last-child { margin-bottom: 0; }

button,
.button {
  display: inline-block;
  padding: 12px 22px;
  border: 0;
  border-radius: 0;
  color: var(--on-primary);
  background: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 48px 0 0;
}

.page-link {
  min-width: 39px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  text-align: center;
  text-decoration: none;
}

.page-link:hover,
.page-link.active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

/* Stopka zgodna z foen.pl */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  color: #000;
  background: #fff;
  font-family: Prompt, sans-serif;
}

.foen-footer-inner { padding: 55px 100px 35px; }

.footer-grid {
  display: grid;
  grid-template-columns: 33% 17% 23% 27%;
}

.footer-grid section { min-width: 0; }

.footer-logo-link {
  display: block;
  width: max-content;
  margin-bottom: 20px;
}

.footer-logo {
  display: block;
  width: 130px;
  max-width: 100%;
  height: auto;
}

.footer-phone {
  display: flex;
  gap: 9px;
  align-items: center;
  width: max-content;
  margin-bottom: 15px;
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.footer-phone svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.footer-brand address {
  color: #000;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.55;
}

.footer-column { padding: 5px 15px 0; }
.footer-column-secondary { padding-top: 50px; }

.footer-column h2 {
  margin: 0 0 23px;
  color: #999;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
}

.footer-column ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-column li + li { margin-top: 8px; }

.footer-column a {
  color: #000;
  font-size: 16px;
  font-weight: 400;
  text-decoration: none;
}

.footer-column a:hover { color: var(--primary); }

.footer-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.footer-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 47px;
  height: 47px;
  border-radius: 50%;
  color: #000;
  background: #e7e7e7;
}

.footer-socials a:hover {
  color: #e7e7e7;
  background: var(--primary);
}

.footer-socials svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.footer-socials svg rect,
.footer-socials svg circle:not(.solid-dot) {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.footer-divider {
  height: 1px;
  margin-top: 100px;
  margin-bottom: 35px;
  background: #e6e6e6;
}

.footer-divider-bottom { margin-top: 35px; }

.footer-copyright {
  margin: 0;
  color: #666;
  font-size: 14px;
  text-align: center;
}

.footer-copyright a {
  color: #000;
  text-decoration: none;
}

.eu-project {
  color: #666;
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.eu-project a { display: inline-block; }

.eu-project img {
  display: block;
  width: min(815px, 100%);
  height: auto;
  margin: 0 auto 20px;
}

.eu-project p {
  max-width: 930px;
  margin: 0 auto 9px;
}

@media (max-width: 1180px) {
  .foen-header-inner {
    grid-template-columns: 135px minmax(0, 1fr) auto;
    gap: 18px;
  }

  .foen-main-nav { gap: 14px; }
  .foen-main-nav a { font-size: 12px; }
  .account-link { display: none; }

  .foen-footer-inner {
    padding-right: 30px;
    padding-left: 30px;
  }
}

@media (max-width: 880px) {
  :root { --content-top-gap: 44px; }

  .container,
  .foen-header-inner,
  .foen-footer-inner { width: min(100% - 30px, 1320px); }

  .foen-header-inner {
    position: relative;
    min-height: 80px;
    grid-template-columns: 42px 1fr auto;
    gap: 12px;
  }

  .mobile-menu-toggle { display: block; }

  .mobile-menu-toggle[aria-expanded="true"] > span:nth-of-type(2) { transform: translateY(7px) rotate(45deg); }
  .mobile-menu-toggle[aria-expanded="true"] > span:nth-of-type(3) { opacity: 0; }
  .mobile-menu-toggle[aria-expanded="true"] > span:nth-of-type(4) { transform: translateY(-7px) rotate(-45deg); }

  .brand { justify-self: center; }
  .brand img { width: 118px; }

  .foen-main-nav {
    position: absolute;
    top: 100%;
    right: -15px;
    left: -15px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 24px 24px;
    background: var(--header);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.25);
  }

  .foen-main-nav.is-open { display: flex; }

  .foen-main-nav a {
    padding: 13px 0;
    border-bottom: 1px solid #353535;
    font-size: 14px;
  }

  .foen-main-nav a::after { display: none; }
  .language-dropdown summary {
    min-width: 54px;
    padding: 0 8px;
  }
  .header-icon-link { display: none; }
  main.container { padding-bottom: 62px; }
  .posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .footer-grid {
    grid-template-columns: 50% 25% 25%;
    row-gap: 38px;
  }

  .footer-social-column {
    grid-column: 1 / -1;
    text-align: center;
  }

  .footer-socials { justify-content: center; }
  .footer-divider { margin-top: 50px; }
}

@media (max-width: 620px) {
  .post-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  main.container { padding-bottom: 48px; }
  .page-intro { padding-bottom: 34px; }
  .page-intro h1 { font-size: 43px; }

  .page-intro p:last-child {
    margin-top: 16px;
    font-size: 16px;
  }

  .posts-grid { grid-template-columns: 1fr; }
  .post-card h2,
  .post-card h3 { font-size: 21px; }
  .post-article-body { padding-top: 28px; }
  .post-full h1 { font-size: 34px; }
  .related-posts { margin-top: 54px; }

  .empty-state,
  .error-page { padding: 34px 20px; }

  .foen-footer-inner { padding: 40px 15px 25px; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 0;
    text-align: center;
  }

  .footer-logo-link,
  .footer-phone {
    margin-right: auto;
    margin-left: auto;
  }

  .footer-brand { padding-bottom: 30px; }

  .footer-column,
  .footer-column-secondary { padding: 22px 0 0; }
  .footer-column h2 { margin-bottom: 15px; }
  .footer-social-column { padding-top: 32px; }

  .footer-divider,
  .footer-divider-bottom {
    margin-top: 40px;
    margin-bottom: 30px;
  }

  .footer-copyright { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
