/*
 * Nezab stories component — Tilda-compatible adaptive geometry layer.
 *
 * Runtime stays ours: JS replaces the unstable Tilda feed lifecycle/preloader
 * with a static local component. Visual geometry mirrors Tilda's grid slot
 * model, but the implementation is deterministic CSS Grid, not flex-wrap.
 *
 * Desktop Tilda grid truth:
 * - .t-container: 1200px;
 * - .t-col: margin-left/right 20px;
 * - .t-col_4: max-width 360px;
 * - 3 cards = 3 slots × 400px = 1200px;
 * - imageRatio 75 = 4:3;
 * - title: 20px / 900 / #9d60df;
 * - descr: 14px / 300 / #4b443f;
 * - row gap follows t-feed__grid-col margin-top: 90px.
 *
 * Important: desktop/tablet rows must not use flex-wrap. Flex can wrap the
 * third card because of scrollbar/zoom/sub-pixel rounding. Use explicit grid
 * slots instead: slot width = Tilda column + left/right gutter.
 */

.nz-stories-record {
  overflow: visible;
}

.nz-stories,
.nz-stories * {
  box-sizing: border-box;
}

.nz-stories {
  width: 100%;
  font-family: 'Onest', Arial, sans-serif;
}

.nz-stories-grid {
  --nz-stories-slot: 400px;
  --nz-stories-card: 360px;
  --nz-stories-row-gap: 90px;
  --nz-stories-rail: calc(var(--nz-stories-slot) * 3);
  --nz-stories-top-offset: 10px;
  --nz-stories-desktop-rail-x: -8px;

  display: grid;
  grid-template-columns: repeat(3, var(--nz-stories-slot));
  justify-content: center;
  align-items: start;
  width: min(100%, var(--nz-stories-rail));
  margin: var(--nz-stories-top-offset) auto 0;
  padding: 0;
  list-style: none;
  row-gap: var(--nz-stories-row-gap);
}


@media screen and (min-width: 1200px) {
  .nz-stories-grid {
    /*
     * Tilda/Annexx desktop rail is rendered a few CSS px left of a plain
     * centered 1200px block. Keep this as a named compatibility token rather
     * than a transform/magic margin on individual cards.
     */
    width: var(--nz-stories-rail);
    margin-left: max(0px, calc(50% - 600px + var(--nz-stories-desktop-rail-x)));
    margin-right: auto;
  }
}

.nz-story-card {
  display: block;
  width: var(--nz-stories-card);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 0;
}

.nz-story-card__image-link {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 20px;
  background: #f5f1ed;
  color: inherit;
  text-decoration: none;
}

.nz-story-card__image {
  display: block;
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.nz-story-card__content {
  padding-top: 20px;
}

.nz-story-card__title {
  margin: 0;
  color: #9d60df;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 900;
  letter-spacing: 0;
}

.nz-story-card__title a,
.nz-story-card__title a:visited,
.nz-story-card__title a:hover {
  color: inherit;
  text-decoration: none;
}

.nz-story-card__descr {
  margin: 8px 0 0;
  color: #4b443f;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 300;
}

@media screen and (max-width: 1199px) {
  .nz-stories-grid {
    --nz-stories-slot: 320px;
    --nz-stories-card: 300px;
    --nz-stories-row-gap: 72px;
    --nz-stories-rail: calc(var(--nz-stories-slot) * 3);
    --nz-stories-top-offset: 10px;
  }

  .nz-story-card__descr {
    font-size: 13px;
  }
}

@media screen and (max-width: 959px) {
  .nz-stories-grid {
    --nz-stories-slot: 320px;
    --nz-stories-card: 300px;
    --nz-stories-row-gap: 56px;
    --nz-stories-rail: calc(var(--nz-stories-slot) * 2);
    --nz-stories-top-offset: 0px;

    grid-template-columns: repeat(2, var(--nz-stories-slot));
    width: min(100%, var(--nz-stories-rail));
  }

  .nz-story-card__image-link {
    border-radius: 18px;
  }

  .nz-story-card__content {
    padding-top: 16px;
  }

  .nz-story-card__title {
    font-size: 18px;
    line-height: 1.32;
  }

  .nz-story-card__descr {
    margin-top: 7px;
    font-size: 13px;
    line-height: 1.45;
  }
}

@media screen and (max-width: 639px) {
  .nz-stories-grid {
    --nz-stories-card: min(360px, calc(100vw - 36px));
    --nz-stories-row-gap: 40px;
    --nz-stories-rail: var(--nz-stories-card);
    --nz-stories-top-offset: 0px;

    grid-template-columns: minmax(0, var(--nz-stories-card));
    width: 100%;
    padding: 0 18px;
  }

  .nz-story-card {
    width: 100%;
  }

  .nz-story-card__title {
    font-size: 20px;
    line-height: 1.25;
  }

  .nz-story-card__descr {
    font-size: 14px;
    line-height: 1.45;
  }
}

/*
 * Scoped ownership for the custom stories component.
 * Tilda page-level styles may target links by #rec-specific selectors. These
 * selectors keep the component tied to the measured Tilda block tokens without
 * using !important or one-off visual offsets.
 */
#rec729463492 .nz-story-card__title,
#rec732640012 .nz-story-card__title,
#rec738505825 .nz-story-card__title,
#rec729463492 .nz-story-card__title a,
#rec729463492 .nz-story-card__title a:visited,
#rec729463492 .nz-story-card__title a:hover,
#rec732640012 .nz-story-card__title a,
#rec732640012 .nz-story-card__title a:visited,
#rec732640012 .nz-story-card__title a:hover,
#rec738505825 .nz-story-card__title a,
#rec738505825 .nz-story-card__title a:visited,
#rec738505825 .nz-story-card__title a:hover {
  color: #9d60df;
}

#rec729463492 .nz-story-card__descr,
#rec732640012 .nz-story-card__descr,
#rec738505825 .nz-story-card__descr {
  color: #4b443f;
}
