/* Home page — extends case-v2 patterns (palette from variables-blue.css) */

.page-home {
  overflow-x: clip;
}

.page-home .section {
  padding-block: clamp(3rem, 6vw, 5.5rem);
}

.page-home .case-v2-hero .container,
.page-home .section > .container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
}

.home-hero__grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.home-hero__grid > * {
  min-width: 0;
}

.home-hero__media {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

/* Мобильный hero: компактное квадратное фото */
.page-home .home-hero__media .hero__photo-wrap {
  position: relative;
  width: min(100%, 15.5rem);
  margin-inline: auto;
  aspect-ratio: 1;
  overflow: visible;
}

.page-home .home-hero__media .hero__photo-glow {
  inset: -0.625rem;
}

.page-home .home-hero__media .hero__photo-frame {
  inset: 0;
  border: 2px solid rgb(var(--color-accent-rgb) / 0.18);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
}

.page-home .home-hero__media .hero__photo {
  position: absolute;
  inset: 0.3125rem;
  width: calc(100% - 0.625rem);
  height: calc(100% - 0.625rem);
  object-fit: cover;
  object-position: center 12%;
  border-radius: calc(var(--radius-2xl) - 4px);
}

/* Статистика под фото — три равные колонки */
.page-home .home-hero__media .hero__stats {
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.5rem;
  width: auto;
  max-width: none;
  transform: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem 0.375rem;
  padding: 0.5rem 0.375rem;
  align-items: start;
}

.page-home .home-hero__media .hero__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.125rem;
  min-width: 0;
  text-align: center;
}

.page-home .home-hero__media .hero__stat-divider {
  display: none;
}

.page-home .home-hero__media .hero__stat-value {
  font-size: 1.0625rem;
  line-height: 1.15;
}

.page-home .home-hero__media .hero__stat-label {
  font-size: 0.625rem;
  line-height: 1.25;
  max-width: 100%;
}

.home-cases {
  display: grid;
  gap: 1.25rem;
  align-items: stretch;
}

.home-case {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  height: 100%;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background-color: var(--color-card);
  box-shadow: var(--shadow-sm);
}

.home-case .case-v2-bento__title {
  flex: none;
}

.home-case .case-v2-bento__text {
  flex: none;
  margin-top: 0;
}

.home-case .case-v2-bento__text + .case-v2-bento__text {
  margin-top: 0.75rem;
}

.home-case__tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  margin-top: auto;
  padding-top: 0.75rem;
}

.home-case__tags .case-v2-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.375rem;
  padding: 0.5rem 0.625rem;
  text-align: center;
  line-height: 1.3;
}

.home-case__footer {
  margin-top: 0.25rem;
}

/* Блок «После запуска» — без растягивания pipeline по высоте колонки */
.page-home .case-v2-aside--support {
  align-self: start;
}

.page-home .case-v2-aside--support .case-v2-aside__note--compact {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.page-home .case-v2-aside--support .case-v2-pipeline {
  flex: none;
  margin-top: 1rem;
}

.page-home .case-v2-aside--support .case-v2-pipeline__step {
  flex: none;
  padding-bottom: 1rem;
}

.page-home .case-v2-aside--support .case-v2-pipeline__step:last-child {
  padding-bottom: 0;
}

.case-v2-pipeline--detailed .case-v2-pipeline__body {
  display: grid;
  gap: 0.25rem;
  padding-top: 0.05rem;
}

.case-v2-pipeline--detailed .case-v2-pipeline__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-foreground);
}

.case-v2-pipeline--detailed .case-v2-pipeline__detail {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-muted-foreground);
}

@media (min-width: 768px) {
  .page-home .case-v2-aside--support .case-v2-pipeline {
    display: grid;
    justify-content: unset;
  }
}

@media (min-width: 768px) {
  .home-cases {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .home-hero__grid {
    grid-template-columns: 1.15fr minmax(0, 0.85fr);
    gap: 2.5rem;
    align-items: stretch;
  }

  .home-hero__media {
    align-self: stretch;
    align-items: stretch;
    justify-content: center;
    min-height: 0;
  }

  /* Квадрат по высоте текстового блока, по центру правой колонки */
  .page-home .home-hero__media .hero__photo-wrap {
    flex-shrink: 0;
    width: auto;
    height: 100%;
    max-width: 100%;
    margin-inline: 0;
    aspect-ratio: 1;
  }

  .page-home .home-hero__media .hero__photo-wrap picture {
    display: block;
    width: 100%;
    height: 100%;
  }
}

@media (min-width: 1024px) {
  .page-home .hero__media {
    max-width: none;
  }
}

@media (max-width: 767px) {
  .page-home .section {
    padding-block: 2.75rem;
  }

  .page-home .section__header {
    margin-bottom: 2rem;
  }

  .page-home .case-v2-hero {
    padding-top: calc(var(--header-height) + 1.25rem);
    padding-bottom: 2.5rem;
  }

  .page-home .case-v2-hero__title {
    font-size: clamp(1.4375rem, 6.5vw, 1.875rem);
    line-height: 1.2;
  }

  .page-home .case-v2-hero__lead {
    font-size: 0.9375rem;
  }

  .page-home .case-v2-hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .page-home .case-v2-hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .page-home .case-v2-checklist li {
    font-size: 0.875rem;
  }

  .home-hero__grid {
    gap: 1.75rem;
  }

  .home-hero__media {
    order: -1;
    width: 100%;
    padding-inline: 0.25rem;
    overflow: hidden;
  }

  .page-home .home-hero__media .hero__photo-wrap {
    width: min(100%, 13.75rem);
    margin-inline: auto;
  }

  .page-home .home-hero__media .hero__photo-glow {
    inset: -0.5rem;
  }

  .page-home .home-hero__media .hero__stats {
    left: 0.375rem;
    right: 0.375rem;
    bottom: 0.375rem;
    padding: 0.4375rem 0.25rem;
  }

  .page-home .home-hero__media .hero__stat-value {
    font-size: 0.875rem;
  }

  .page-home .home-hero__media .hero__stat-label {
    font-size: 0.5625rem;
    line-height: 1.2;
  }

  .page-home .case-v2-goals-card {
    padding: 1.25rem;
  }

  .page-home .case-v2-goals-list li {
    font-size: 0.875rem;
  }

  .page-home .case-v2-aside {
    border-left: none;
    border-top: 3px solid var(--color-accent);
    border-radius: var(--radius-lg);
    background: rgb(var(--color-accent-rgb) / 0.06);
    padding: 1.25rem;
  }

  .page-home .case-v2-story__grid {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
  }

  .page-home #problem .case-v2-story__grid .case-v2-prose {
    order: -1;
  }

  .home-case {
    padding: 1.25rem;
  }

  .home-case__footer .btn {
    width: 100%;
    justify-content: center;
  }

  .page-home .case-v2-cta__grid {
    gap: 1.5rem;
    padding: 1.375rem;
  }

  .page-home .case-v2-cta__content .section__title {
    font-size: clamp(1.375rem, 5.5vw, 1.75rem);
  }

  .page-home .case-v2-cta__actions {
    flex-direction: column;
  }

  .page-home .case-v2-cta__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .page-home .case-v2-cta .form-card {
    padding: 1.25rem;
  }
}
