/* ---------------------------------------------------------------
   SPES Finanse — breakpointy
   Ładowany ZAWSZE jako ostatni, żeby wygrywał kaskadę.
   --------------------------------------------------------------- */

@media (max-width: 1680px) {
  .site-header {
    grid-template-columns: 250px minmax(400px, 1fr) auto;
    padding-inline: 28px;
  }

  .brand {
    width: 235px;
  }

  .desktop-nav {
    gap: 24px;
    padding-inline: 10px;
  }

  .header-contact-link span {
    display: none;
  }

  .header-contact-link {
    padding-inline: 2px;
  }
}

@media (max-width: 1200px) {
  /* Nagłówek musi zmieścić logo, 5 pozycji menu, ikony kontaktu i przycisk —
     przy tej szerokości wszystko schodzi o stopień, żeby nic się nie łamało. */
  .site-header {
    grid-template-columns: 190px 1fr auto;
    padding-inline: 24px;
  }

  .brand {
    width: 180px;
    height: 66px;
  }

  .desktop-nav {
    gap: 18px;
    padding-inline: 8px;
  }

  .desktop-nav a {
    font-size: 14px;
    white-space: nowrap;
  }

  .header-actions {
    gap: 10px;
  }

  .header-actions .consultation-button {
    margin-left: 10px;
    min-height: 46px;
    padding-inline: 18px;
    font-size: 14px;
  }

  .hero-slices-ornament {
    left: calc(35% - 72px);
  }

  .hero-white-bands {
    left: calc(35% - 165px);
  }

  .hero-edge-fade {
    left: calc(50% - 70px);
  }

  .hero-copy {
    width: 55%;
    padding-left: 46px;
  }

  .hero h1 {
    font-size: 61px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .service-card.is-featured:last-child:nth-child(2n + 1) {
    grid-column: 1 / -1;
  }

  .services-intro {
    grid-template-columns: 1fr 1fr;
    row-gap: 26px;
  }

  .review-badge {
    grid-column: 2;
    justify-self: center;
  }

  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .site-shell {
    width: 100%;
    margin: 0;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    width: 100%;
    margin-left: 0;
    min-height: 88px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    width: 168px;
    height: 62px;
  }

  .desktop-nav,
  .header-contact-link,
  .consultation-button {
    display: none;
  }

  .menu-button {
    display: inline-flex;
  }

  /* Menu mobilne zajmuje cały ekran pod paskiem nagłówka —
     panel na pół ekranu zostawiał widoczną treść i rozpraszał. */
  .mobile-menu {
    position: fixed;
    z-index: 30;
    top: 88px;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--paper);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      opacity 200ms ease,
      visibility 200ms ease,
      transform 200ms ease;
  }

  .mobile-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  body.menu-open {
    overflow: hidden;
  }

  .mobile-menu nav {
    display: grid;
    align-content: start;
    min-height: 100%;
    padding: 16px 24px 32px;
  }

  .mobile-contact-list {
    display: grid;
    margin-top: 14px;
  }

  .mobile-menu a,
  .mobile-menu button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    text-align: left;
  }

  .mobile-menu button {
    margin-top: 12px;
    padding-inline: 18px;
    background: var(--gold);
    border: 0;
    color: var(--white);
    cursor: pointer;
  }

  .mobile-contact-list a {
    justify-content: flex-start;
    gap: 10px;
    min-height: 46px;
    font-size: 13px;
  }

  .services {
    width: 100%;
    margin-left: 0;
    padding: 58px 9vw 64px;
  }

  .services-intro {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .hero {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-slices-ornament,
  .hero-white-bands,
  .hero-edge-fade {
    display: none;
  }

  .hero-copy {
    width: auto;
    min-height: 570px;
    padding: 72px 9vw 64px;
  }

  .hero h1 {
    max-width: 680px;
    font-size: clamp(56px, 9.5vw, 78px);
  }

  .hero-media {
    position: relative;
    inset: auto;
    min-height: 510px;
  }

  .review-badge {
    grid-column: auto;
    justify-self: start;
  }

  .services-description {
    text-align: left;
  }

  .about {
    width: 100%;
    min-height: auto;
    margin-left: 0;
  }

  .about-inner {
    grid-template-columns: 1fr;
    gap: 36px;
    width: auto;
    padding: 82px 9vw 88px;
  }

  .about-story {
    max-width: 720px;
    padding-top: 0;
  }

  .about-ornament {
    top: auto;
    right: -140px;
    bottom: -230px;
    left: auto;
    width: 470px;
    opacity: 0.32;
    transform: rotate(180deg);
  }

  .gallery {
    width: 100%;
    margin-left: 0;
    padding: 82px 9vw 88px;
  }

  .gallery-intro {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 38px;
  }

  .gallery-intro > p {
    max-width: 680px;
  }

  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .gallery-item--large,
  .gallery-item--wide,
  .gallery-item--third {
    grid-column: span 6;
  }

  .gallery-item--square {
    grid-column: span 3;
  }

  .gallery-item--large {
    grid-row: auto;
  }

  .gallery-item--large .gallery-image {
    min-height: 520px;
  }

  .gallery-item--wide .gallery-image,
  .gallery-item--third .gallery-image {
    min-height: 260px;
  }

  .closing-zone {
    width: 100%;
    margin-left: 0;
  }

  .closing-cta {
    grid-template-columns: 1fr;
    gap: 38px;
    padding: 78px 9vw;
  }

  .closing-cta::before {
    background-position: 58% center;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 38%, #000 80%);
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.35) 38%, #000 80%);
    opacity: 0.3;
  }

  .closing-cta-button {
    justify-self: start;
  }

  .site-footer {
    padding: 64px 9vw 26px;
  }

  /* Marka na całą szerokość, pod nią dwie równe kolumny w jednym rzędzie. */
  .footer-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 44px 32px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: start;
    gap: 18px 24px;
  }

  .footer-copy {
    grid-column: 1 / -1;
  }

  .footer-credits {
    justify-self: start;
    text-align: left;
  }

  .footer-top {
    justify-self: end;
  }

  /* Podstrony */
  .page-hero {
    width: 100%;
    margin-left: 0;
    padding: 68px 9vw 56px;
  }

  .page-hero::after {
    background-position:
      100% 32px,
      58% 62%,
      0 70px;
  }

  .listing {
    padding: 58px 9vw 76px;
  }

  .entry {
    padding: 56px 9vw 76px;
  }

  .entry--offer {
    padding: 48px 9vw 4px;
  }

  .page-layout {
    grid-template-columns: 1fr;
    gap: 56px;
    padding: 56px 9vw 76px;
  }

  /* Typografia treści schodzi o stopień — 17 px na telefonie robi
     zbyt szerokie wiersze i rozpycha bloki. */
  .entry-content,
  .content-benefits li {
    font-size: 15px;
  }

  .entry-content {
    line-height: 1.7;
  }

  .content-highlight {
    padding: 26px 24px;
    font-size: 16px;
  }

  .content-cta p,
  .page-hero-lead {
    font-size: 15px;
  }

  .content-steps li span {
    font-size: 13px;
  }

  .page-layout > .entry {
    max-width: 100%;
  }

  .page-aside {
    position: static;
    width: auto;
  }

  .aside-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aside-more {
    width: auto;
  }

  .related-posts {
    width: 100%;
    margin-left: 0;
  }

  .related-posts-inner {
    padding-inline: 9vw;
  }

}

@media (max-width: 991px) {
  .content-contact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-contact div:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

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

  .content-media,
  .content-media--reverse {
    grid-template-columns: 1fr;
  }

  .content-media--reverse .content-media-figure {
    order: 0;
  }

  .content-steps,
  .content-benefits,
  .content-columns,
  .content-contact {
    grid-template-columns: 1fr;
  }

  .content-steps li:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .content-steps li:nth-child(n + 2) {
    border-top: 0;
  }

  .content-contact div + div {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .aside-cards {
    grid-template-columns: 1fr;
  }

  .error-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
}

@media (max-width: 576px) {
  .site-header {
    padding-inline: 18px 12px;
  }

  .brand {
    width: 153px;
  }

  .hero-copy {
    min-height: auto;
    padding: 64px 22px 52px;
  }

  .eyebrow {
    margin-bottom: 20px;
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  .hero h1 {
    font-size: 50px;
    line-height: 1;
  }

  .hero-description {
    max-width: 100%;
    margin-top: 25px;
    font-size: 16px;
    line-height: 1.55;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
    margin-top: 30px;
  }

  .primary-button {
    min-height: 57px;
  }

  .text-link {
    align-self: flex-start;
  }

  .hero-media {
    min-height: 390px;
  }

  .hero-media img {
    object-position: 58% center;
    transform: none;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    min-height: 132px;
    padding: 25px 28px;
  }

  .service-copy > span {
    max-width: 300px;
  }

  .about-inner {
    padding: 70px 22px 76px;
  }

  .about-heading h2 {
    font-size: 50px;
  }

  .about-summary,
  .about-closing {
    max-width: 100%;
    font-size: 17px;
  }

  .about-service-list,
  .about-benefits {
    grid-template-columns: 1fr;
  }

  .about-benefit {
    min-height: 132px;
  }

  .about-benefit:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .about-benefit:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  .gallery {
    padding: 70px 22px 76px;
  }

  .gallery-intro h2,
  .closing-cta h2 {
    font-size: 48px;
  }

  .gallery-intro > p {
    max-width: 100%;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .gallery-item--large,
  .gallery-item--wide,
  .gallery-item--third,
  .gallery-item--square {
    grid-column: span 1;
  }

  .gallery-item--large .gallery-image,
  .gallery-item--wide .gallery-image,
  .gallery-item--third .gallery-image {
    min-height: 330px;
  }

  .gallery-item--square .gallery-image {
    aspect-ratio: 4 / 3;
  }

  .gallery-item figcaption {
    min-height: 110px;
    padding: 46px 22px 21px;
  }

  .gallery-item figcaption > span {
    font-size: 38px;
  }

  .closing-cta {
    gap: 32px;
    padding: 68px 22px 72px;
  }

  .closing-cta-button {
    width: 100%;
    min-height: 62px;
    padding-inline: 22px;
  }

  .site-footer {
    padding: 56px 22px 24px;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 46px;
    padding-bottom: 48px;
  }

  .footer-brand p {
    max-width: 100%;
  }

  .footer-brand,
  .footer-contact {
    grid-column: auto;
  }

  .footer-bottom {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 14px;
  }

  .footer-credits,
  .footer-top {
    justify-self: start;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .consultation-dialog {
    padding: 46px 24px 28px;
  }

  .consultation-dialog h2 {
    padding-right: 20px;
    font-size: 40px;
  }

  /* Podstrony */
  .page-hero {
    padding: 56px 22px 46px;
  }

  .page-hero-title {
    font-size: 40px;
  }

  .listing,
  .entry,
  .page-layout,
  .entry--offer {
    padding-inline: 22px;
  }

  .post-card-body {
    padding: 22px 22px 26px;
  }
}

@media (max-width: 360px) {
  .hero h1 {
    font-size: 42px;
  }

  .about-heading h2,
  .gallery-intro h2,
  .closing-cta h2 {
    font-size: 40px;
  }

  .consultation-dialog h2 {
    font-size: 34px;
  }
}
