:root{
  --ps-primary:#00357d;
  --ps-accent:#dd291b;

  --ps-text:#171718;
  --ps-muted: rgba(23,23,24,.72);

  --ps-axis: rgba(0,0,0,.46);
  --ps-axis-soft: rgba(0,0,0,.26);

  --ps-bg:#ffffff;

  --ps-radius: 10px;
  --ps-max: 1200px;

  /* ozdobne kropki – OFF */
  --ps-tl-dots: 0; /* ustaw na 1 jeśli chcesz je przywrócić */
}

/* =========
   TIMELINE
   ========= */
.ps-timeline{
  background: #ffffff00;
  padding: 110px 24px;
  color: var(--ps-text);
}

.ps-timeline,
.ps-timeline h1,.ps-timeline h2,.ps-timeline h3,.ps-timeline h4,.ps-timeline h5,.ps-timeline h6,
.ps-timeline p,.ps-timeline span,.ps-timeline li,.ps-timeline small,.ps-timeline strong,.ps-timeline em{
  color:#171718 !important;
}

/* data w kółku biała */
.ps-timeline .ps-timeline__dot-date,
.ps-timeline .ps-timeline__dot-date *{
  color:#fff !important;
}

.ps-timeline__container{
  max-width: var(--ps-max);
  margin: 0 auto;
}

/* header */
.ps-timeline__header{
  max-width: 760px;
  margin: 0 0 46px;
}
.ps-timeline__title{
  font-family: "Teko", sans-serif;
  font-size: clamp(44px, 5.5vw, 86px);
  font-weight: 600;
  line-height: .95;
  margin: 0 0 10px;
}
.ps-timeline__lead{
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  color: var(--ps-muted) !important;
}

/* =========
   TRACK – global fade
   ========= */
.ps-timeline__track{
  position: relative;
  display: grid;
  gap: 26px;
  padding-top: 16px;

  --ps-mask-y: 0px;

  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,1) 28%,
    rgba(0,0,0,1) 72%,
    rgba(0,0,0,0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,1) 28%,
    rgba(0,0,0,1) 72%,
    rgba(0,0,0,0) 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100vh;
  mask-size: 100% 100vh;
  -webkit-mask-position: 0 var(--ps-mask-y);
  mask-position: 0 var(--ps-mask-y);
}

/* pionowa oś */
.ps-timeline__track::before{
  content:"";
  position:absolute;
  top:0; bottom:0;
  left:50%;
  width:2px;
  transform: translateX(-1px);
  background: linear-gradient(to bottom, transparent, var(--ps-axis) 10%, var(--ps-axis) 90%, transparent) !important;
  pointer-events:none;
  z-index: 1;
}

/* =========
   ITEM GRID
   ========= */
.ps-timeline__item{
  display:grid;
  grid-template-columns: 1fr 110px 1fr;
  align-items:center;
  position:relative;
  z-index: 2;

  --ps-depth: 0;
  --ps-sdir: 0;

  /* łącznik liczony w JS */
  --ps-conn-y: 50%;
  --ps-conn-x: 0px;
  --ps-conn-w: 0px;
  --ps-dots-x: 0px;
}

/* ✅ ZABEZPIECZENIE: wszystko zawsze w tym samym wierszu siatki */
.ps-timeline__pin,
.ps-timeline__card,
.ps-timeline__sketch{
  grid-row: 1;
}

/* =========
   ŁĄCZNIK: kółko <-> karta (dotyka obu)
   ========= */
.ps-timeline__item::before{
  content:"";
  position:absolute;
  left: var(--ps-conn-x);
  width: var(--ps-conn-w);
  top: var(--ps-conn-y);
  height:1px;
  transform: translateY(-0.5px);
  background: var(--ps-axis-soft);
  z-index: 4;
  pointer-events:none;
  opacity: 0;
}
.ps-timeline__item.has-conn::before{
  opacity: 1;
}

/* 3 kropki (opcjonalne) */
.ps-timeline__item::after{
  content:"";
  position:absolute;
  top: var(--ps-conn-y);
  width:6px;
  height:6px;
  border-radius:999px;
  background: rgba(0,0,0,.38);
  box-shadow: 0 10px 0 rgba(0,0,0,.38), 0 20px 0 rgba(0,0,0,.38);
  transform: translateY(-10px);
  z-index: 4;
  pointer-events:none;
  opacity: var(--ps-tl-dots);
  left: var(--ps-dots-x);
}

/* =========
   PIN
   ========= */
.ps-timeline__pin{
  grid-column:2;
  display:flex;
  justify-content:center;
  align-items:center;
  position:relative;
  z-index: 5;
  padding: 10px 0;
}

.ps-timeline__dot{
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--ps-primary);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  transition: transform .26s ease, filter .26s ease, box-shadow .26s ease;
  will-change: transform;
}

/* ✅ HARD KILL: wywalamy stare krótkie łączniki z kółka */
.ps-timeline__dot::after,
.ps-timeline__dot::before{
  content: none !important;
  display: none !important;
}

/* data w środku koła */
.ps-timeline__dot-date{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  line-height: 0.9;
  font-family: "Teko", sans-serif;
  font-weight: 600;
  letter-spacing: .5px;
  text-align:center;
}
.ps-timeline__dot-date .ps-date-top{ font-size: 26px; }
.ps-timeline__dot-date .ps-date-bottom{ font-size: 26px; }

/* =========
   CARD
   ========= */
.ps-timeline__card{
  position: relative;
  z-index: 3;
  max-width: 520px;

  background: var(--ps-bg);
  border: 1px solid rgba(0,0,0,.14);
  border-radius: var(--ps-radius);
  box-shadow: none;

  padding: 18px 18px 16px;

  transition: transform .22s ease, filter .22s ease, border-color .22s ease;
  will-change: transform, filter;

  filter: grayscale(calc(var(--ps-depth) * 0.30));
  transform:
    translateY(calc(var(--ps-sdir) * 5px * var(--ps-depth)))
    scale(calc(0.92 + ((1 - var(--ps-depth)) * 0.06)));
}
.ps-timeline__card:hover{
  filter:none;
  transform: translateY(0) scale(1.00);
  border-color: rgba(0,0,0,.22);
}

/* ✅ KLUCZ: zamiast nth-child -> nth-of-type (separatory nie psują parzystości) */
.ps-timeline__track > .ps-timeline__item:nth-of-type(odd) .ps-timeline__card{
  grid-column:1;
  justify-self:end;
  margin-right: 12px;
  text-align: right;
}
.ps-timeline__track > .ps-timeline__item:nth-of-type(even) .ps-timeline__card{
  grid-column:3;
  justify-self:start;
  margin-left: 12px;
  text-align: left;
}

/* wyłącz pseudo-elementy z karty */
.ps-timeline__card::before,
.ps-timeline__card::after{
  content:none !important;
}

/* data w karcie ukryta */
.ps-timeline__date{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.ps-timeline__event{
  font-family: "Teko", sans-serif;
  font-size: 28px;
  line-height: 1.05;
  margin: 0 0 6px;
  color:#171718 !important;
}
.ps-timeline__desc{
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
  padding-right: 6px;
  box-sizing: border-box;
color:#171718 !important;
  opacity: .78;
}

/* =========
   SKETCH
   ========= */
.ps-timeline__sketch{
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  max-width: 300px; /* ✅ trochę większe */
  align-self:center;
}
.ps-timeline__sketch img{
  max-width: 420px;  /* ✅ trochę większe */
  max-height: 210px;
  width: auto;
  height: auto;
  display:block;
  opacity: .92;
  filter: grayscale(.15);
}
.ps-timeline__sketch.is-empty{ display:none; }

/* ✅ KLUCZ: zamiast nth-child -> nth-of-type */
.ps-timeline__track > .ps-timeline__item:nth-of-type(odd) .ps-timeline__sketch{
  grid-column:3;
  justify-self:start;
  margin-left: 12px;
}
.ps-timeline__track > .ps-timeline__item:nth-of-type(even) .ps-timeline__sketch{
  grid-column:1;
  justify-self:end;
  margin-right: 12px;
}

/* =========
   DELIKATNE PULSOWANIE (hover + centrum)
   ========= */
@keyframes psSoftPulse{
  0%,100%{ transform: scale(1); }
  50%{ transform: scale(1.06); }
}

.ps-timeline__item:hover .ps-timeline__dot,
.ps-timeline__item.is-center .ps-timeline__dot{
  animation: psSoftPulse 1.35s ease-in-out infinite;
  box-shadow: 0 0 0 6px rgba(0,53,125,.10);
  filter: saturate(1.05);
}

/* =========
   SEPARATOR
   ========= */
.ps-timeline__sep{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap: 12px;
  position: relative;
  z-index: 10;

  --ps-depth:0;
  --ps-sdir:0;

  filter: grayscale(calc(var(--ps-depth) * 0.30));
  transform:
    translateY(calc(var(--ps-sdir) * 5px * var(--ps-depth)))
    scale(calc(0.92 + ((1 - var(--ps-depth)) * 0.06)));
  transition: transform .22s ease, filter .22s ease;
}

.ps-timeline__sep::before{
  content:"";
  position:absolute;
  left:50%;
  top:-18px;
  bottom:-18px;
  width:62px;
  transform: translateX(-50%);
  background: var(--ps-bg);
  z-index: 11;
}

.ps-timeline__sep-line{
  height: 1px;
  background: var(--ps-axis-soft);
  z-index: 12;
}
.ps-timeline__sep-label{
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,.20);
  border-radius: 999px;
  background: var(--ps-bg);
  z-index: 12;
  color:#171718 !important;
}

/* =========
   REDUCED MOTION
   ========= */
@media (prefers-reduced-motion: reduce){
  .ps-timeline__item:hover .ps-timeline__dot,
  .ps-timeline__item.is-center .ps-timeline__dot{
    animation: none !important;
    box-shadow: none !important;
    filter: none !important;
  }
}

/* =========
   MOBILE
   ========= */
@media (max-width: 980px){
  /*
    Na części mobilnych układ potrafił „uciekać” w prawo (overflow/transformy).
    Twardo spinamy szerokości i wyłączamy transformy kart na mobile.
  */
  .ps-timeline{
    padding-left: 16px;
    padding-right: 16px;
  }

  .ps-timeline__container,
  .ps-timeline__track,
  .ps-timeline__item{
    max-width: 100%;
  }

  .ps-timeline__item,
  .ps-timeline__card{
    min-width: 0;
  }

  .ps-timeline__track::before{
    left: 14px;
    transform: none;
  }

  .ps-timeline__item{
    grid-template-columns: 42px 1fr;
    align-items:start;
    gap: 14px;
  }

  .ps-timeline__pin{
    grid-column:1;
    justify-content:flex-start;
  }
  .ps-timeline__dot{
    width: 58px;
    height: 58px;
  }
  .ps-timeline__dot-date .ps-date-top,
  .ps-timeline__dot-date .ps-date-bottom{
    font-size: 22px;
  }

  .ps-timeline__card{
    grid-column:2 !important;
    margin: 0 !important;
    text-align: left !important;
  }

  .ps-timeline__card{
    transform: none !important;
    filter: none !important;
  }

  /* na mobile łączniki wyłączamy */
  .ps-timeline__item::before,
  .ps-timeline__item::after{
    display:none !important;
  }

  .ps-timeline__sketch{
    grid-column: 2 !important;
    justify-content:flex-start;
    margin-top: 10px;
    max-width: 100%;
  }
  .ps-timeline__sketch img{
    max-width: 320px;
    max-height: 190px;
  }

  /* separator epoki na środku */
  .ps-timeline__sep{
    grid-template-columns: 1fr;
    justify-items:center;
    text-align:center;
    gap: 10px;
    padding: 10px 0;
  }
  .ps-timeline__sep-line{
    display:none;
  }
  .ps-timeline__sep::before{
    left: 50%;
    top: 50%;
    bottom: auto;
    width: 100%;
    height: 1px;
    background: var(--ps-axis-soft);
    transform: translate(-50%, -0.5px);
  }
  .ps-timeline__sep-label{
    z-index: 12;
  }

  /* TIMELINE MOBILE FIX v2 */
  .ps-timeline__card{
    max-width: none;
    width: 100%;
    transform: none !important;
    filter: none !important;
  }
  .ps-timeline__desc{
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* twarde zabezpieczenie przed poziomym scrollowaniem */
  .ps-timeline__track{ overflow-x: hidden; }
  .ps-timeline__pin{
    width: 34px;
    height: 34px;
    border-radius: 999px;
    flex: 0 0 34px;
  }
  .ps-timeline__sketch{
    position: relative;
    z-index: 4;
    grid-column: 2 !important;
    grid-row: 3 !important;
    margin-top: 12px;
  }
  .ps-timeline__card{
    grid-column: 2 !important;
    grid-row: 2 !important;
  }
}
