/* =============================================================================
   T2S — section rhythm and adaptive bento grids
   Spacing values are tokens from variables.css; nothing here hardcodes them.
   ============================================================================= */

/* ── Section rhythm: vertical spacing only through section padding ───────── */
main section.t2s-section {
  padding-top: var(--section-py);
  padding-bottom: var(--section-py);
  margin-top: 0;
  margin-bottom: 0;
}
main section.t2s-section--first { padding-top: var(--page-top-offset); }
main section.t2s-section--flush-top { padding-top: 0; }

/* Two neighbours on the same background share one gap instead of two.
   Hidden sections are not rendered, so this follows the actual page. */
main section.t2s-bg-white + section.t2s-bg-white,
main section.t2s-bg-mist + section.t2s-bg-mist { padding-top: 0; }
main section.t2s-bg-white + :is(style, script, link) + section.t2s-bg-white,
main section.t2s-bg-mist + :is(style, script, link) + section.t2s-bg-mist { padding-top: 0; }

/* The banner band sits on white like the services below it, so the two share one gap. */
.promo-banner-section-full.t2s-bg-white { background: var(--color-white); }

.t2s-page-main {
  padding-top: var(--page-top-offset);
  padding-bottom: var(--section-py);
  min-height: 60vh;
}
.t2s-section-head { margin-bottom: var(--section-header-gap); }

/* ── Services (home) and candidate cards: bento for 1…6 cards ──────────── */
.bento-grid.bento--services,
.bento-grid.bento--kandydaci {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
}
.bento-grid.bento--services > .bento-card:nth-child(n),
.bento-grid.bento--kandydaci > .bento-card:nth-child(n) { grid-column: auto; grid-row: auto; }

@media (min-width: 1025px) {
  .bento-grid.bento--services.bento--count-1,
  .bento-grid.bento--kandydaci.bento--count-1 { grid-template-columns: minmax(0, 1fr); }
  .bento-grid.bento--services.bento--count-2,
  .bento-grid.bento--kandydaci.bento--count-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

  /* 3–6 cards: wide first card, tall second card */
  .bento-grid.bento--services.bento--count-3 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-4 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-5 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-6 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-3 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-4 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-5 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-6 > .bento-card:nth-child(1) { grid-column: span 2; }

  .bento-grid.bento--services.bento--count-3 > .bento-card:nth-child(2),
  .bento-grid.bento--services.bento--count-4 > .bento-card:nth-child(2),
  .bento-grid.bento--services.bento--count-5 > .bento-card:nth-child(2),
  .bento-grid.bento--services.bento--count-6 > .bento-card:nth-child(2),
  .bento-grid.bento--kandydaci.bento--count-3 > .bento-card:nth-child(2),
  .bento-grid.bento--kandydaci.bento--count-4 > .bento-card:nth-child(2),
  .bento-grid.bento--kandydaci.bento--count-5 > .bento-card:nth-child(2),
  .bento-grid.bento--kandydaci.bento--count-6 > .bento-card:nth-child(2) { grid-row: span 2; }

  /* 3: third card fills the space under the first one */
  .bento-grid.bento--services.bento--count-3 > .bento-card:nth-child(3),
  .bento-grid.bento--kandydaci.bento--count-3 > .bento-card:nth-child(3) { grid-column: span 2; }
  /* 5: last card takes the whole third row; 6: fifth card stretches next to the sixth */
  .bento-grid.bento--services.bento--count-5 > .bento-card:nth-child(5),
  .bento-grid.bento--kandydaci.bento--count-5 > .bento-card:nth-child(5) { grid-column: 1 / -1; }
  .bento-grid.bento--services.bento--count-6 > .bento-card:nth-child(5),
  .bento-grid.bento--kandydaci.bento--count-6 > .bento-card:nth-child(5) { grid-column: span 2; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .bento-grid.bento--services,
  .bento-grid.bento--kandydaci { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-grid.bento--services.bento--count-1,
  .bento-grid.bento--kandydaci.bento--count-1 { grid-template-columns: minmax(0, 1fr); }

  .bento-grid.bento--services.bento--count-3 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-4 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-5 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-6 > .bento-card:nth-child(1),
  .bento-grid.bento--services.bento--count-4 > .bento-card:nth-child(4),
  .bento-grid.bento--services.bento--count-6 > .bento-card:nth-child(6),
  .bento-grid.bento--kandydaci.bento--count-3 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-4 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-5 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-6 > .bento-card:nth-child(1),
  .bento-grid.bento--kandydaci.bento--count-4 > .bento-card:nth-child(4),
  .bento-grid.bento--kandydaci.bento--count-6 > .bento-card:nth-child(6) { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .bento-grid.bento--services,
  .bento-grid.bento--kandydaci { grid-template-columns: minmax(0, 1fr); }
}

/* ── About: no photo → the text card takes the full width ──────────────── */
.about-bento-grid { gap: var(--grid-gap); }
.about-bento-grid.bento--count-0 { grid-template-columns: minmax(0, 1fr); }

/* ── Process: 2 columns; an odd last step stretches ────────────────────── */
.process-bento-grid { gap: var(--grid-gap); }
.process-bento-grid.bento--count-1 { grid-template-columns: minmax(0, 1fr); }
.process-bento-grid.bento--count-3 > .process-bento-card:nth-child(3) { grid-column: 1 / -1; }

/* ── Clients: 1–4 logos stand still and centred, 5+ run as a marquee ────── */
/* Three copies of the logo set: one loop shifts exactly one copy, no jump. */
.marquee-container.bento--clients .marquee-track { animation-name: t2sMarqueeThird; }
@keyframes t2sMarqueeThird {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-100% / 3)); }
}
.marquee-container.bento--clients.is-static {
  -webkit-mask-image: none;
  mask-image: none;
}
.marquee-container.bento--clients.is-static .marquee-track {
  animation: none;
  width: auto;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 40px;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: var(--grid-gap);
}
@media (max-width: 768px) {
  .marquee-container.bento--clients.is-static .marquee-track { padding: 0 20px; }
}

/* ── Team and awards sliders: a short list is centred, not left-aligned ── */
@media (min-width: 1024px) {
  .bento--team.bento--count-1 .swiper-wrapper,
  .bento--team.bento--count-2 .swiper-wrapper,
  .bento--team.bento--count-3 .swiper-wrapper,
  .bento--awards.bento--count-1 .swiper-wrapper,
  .bento--awards.bento--count-2 .swiper-wrapper,
  .bento--awards.bento--count-3 .swiper-wrapper { justify-content: center; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .bento--team.bento--count-1 .swiper-wrapper,
  .bento--team.bento--count-2 .swiper-wrapper,
  .bento--awards.bento--count-1 .swiper-wrapper,
  .bento--awards.bento--count-2 .swiper-wrapper { justify-content: center; }
}
@media (max-width: 767px) {
  .bento--team.bento--count-1 .swiper-wrapper,
  .bento--awards.bento--count-1 .swiper-wrapper { justify-content: center; }
}

/* Team card without a photo: neutral block with initials */
.team-img-placeholder.team-initials {
  background: var(--color-mist);
  color: var(--color-mid);
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 300;
  letter-spacing: 2px;
}

/* ── Blog: rows sized by the real number of posts ───────────────────────── */
@media (min-width: 1025px) {
  .page-blog .uslugi-row.uslugi-row--3.uslugi-row--count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .page-blog .uslugi-row.uslugi-row--3.uslugi-row--count-1 { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ── Outsourcing landing grids ──────────────────────────────────────────── */
.outsourcing-services-grid.bento--count-1,
.outsourcing-cases-grid.bento--count-1 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 769px) {
  .outsourcing-services-grid.bento--count-3 > :last-child { grid-column: 1 / -1; }
  .outsourcing-cases-grid.bento--count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
