/* Единая сетка: все превью имеют одинаковые размеры и ровные края. */
.hero-strip {
  min-height: 0 !important;
  gap: 12px;
  padding: 12px;
  background: #efe7da !important;
}

.hero-strip button,
.case-preview button,
.visual-grid button {
  aspect-ratio: 3 / 4 !important;
  min-height: 0 !important;
  background: #fffdf9 !important;
}

.hero-strip img,
.visual-grid img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  background: #fffdf9 !important;
}

.case-study {
  align-items: stretch !important;
}

.case-preview {
  height: 100% !important;
  min-height: 0 !important;
  align-content: stretch !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
}

/* В кейсе с часами верхний и нижний ряды стоят вровень с краями карточки. */
.case-study:first-child .case-preview {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* В кейсе с гипсовыми фигурками: исходники сверху, готовые слайды снизу. */
.case-study:nth-child(2) .case-preview {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.case-study:nth-child(2) .case-preview button:nth-child(1) {
  grid-column: 1 !important;
  grid-row: 2 !important;
}

.case-study:nth-child(2) .case-preview button:nth-child(2) {
  grid-column: 2 !important;
  grid-row: 2 !important;
}

.case-study:nth-child(2) .case-preview button:nth-child(3) {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.case-study:nth-child(2) .case-preview button:nth-child(4) {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

/* В кейсе сумки два верхних и два нижних кадра стоят вровень с краями. */
.case-study:nth-child(3) .case-preview {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* В кейсе панно верхняя и нижняя пары также стоят вровень с краями. */
.case-study:nth-child(4) .case-preview {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.case-preview button {
  aspect-ratio: auto !important;
  min-height: 0 !important;
  width: 100% !important;
  height: 100% !important;
  align-self: stretch !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
  background: #e9e2d7 !important;
}

/* Все четыре кадра заполняют одинаковые ячейки без белых полос. */
.case-preview img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: fill !important;
  object-position: center !important;
  background: #e9e2d7 !important;
}

.case-preview.slides-3 button:last-child {
  grid-column: auto !important;
  justify-self: stretch !important;
  width: auto !important;
}

.video-card video {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  object-fit: contain !important;
}

/* Убираем тяжёлые чёрные подписи поверх каждой работы. */
.hero-strip span,
.visual-grid span,
.book-cover span {
  display: none !important;
}

/* Светлое окно просмотра вместо чёрного оформления. */
.gallery-backdrop {
  background: rgba(36, 31, 25, 0.72) !important;
}

.gallery-modal,
.gallery-main {
  background: #e9e2d7 !important;
}

.gallery-modal {
  width: min(820px, calc(100vw - 20px)) !important;
}

/* Показываем каждый слайд в окне просмотра целиком, без обрезки. */
.gallery-main {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: 18px 64px 10px !important;
  overflow: hidden !important;
}

.gallery-modal .gallery-main > img {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

@media (max-width: 540px) {
  .gallery-modal {
    width: 100% !important;
  }

  .gallery-main {
    padding: 58px 12px 8px !important;
  }

  .gallery-modal .gallery-main > img {
    width: auto !important;
    height: auto !important;
  }
}

.gallery-footer {
  color: #14243a !important;
  background: #fffdf9 !important;
  border-top: 1px solid rgba(20, 36, 58, 0.12);
}

.gallery-footer span {
  color: #687487 !important;
}

.gallery-close,
.gallery-arrow {
  color: #14243a !important;
  background: rgba(255, 253, 249, 0.94) !important;
  box-shadow: 0 8px 24px rgba(20, 36, 58, 0.18);
}

.gallery-thumbs button.active {
  border-color: #b98b45 !important;
}

body.flipbook-open {
  overflow: hidden;
}

.flipbook-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(36, 31, 25, 0.78);
  backdrop-filter: blur(8px);
}

.flipbook-dialog {
  width: min(1040px, 100%);
  height: min(900px, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border-radius: 16px;
  background: #f4eee5;
  box-shadow: 0 32px 90px rgba(20, 18, 15, 0.36);
}

.flipbook-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  color: #14243a;
  background: #fffdf9;
  border-bottom: 1px solid rgba(20, 36, 58, 0.1);
}

.flipbook-head > div {
  display: grid;
  line-height: 1.35;
}

.flipbook-head span {
  color: #687487;
  font-size: 12px;
}

.flipbook-close,
.flipbook-arrow {
  border: 0;
  cursor: pointer;
  color: #14243a;
  background: #fffdf9;
  box-shadow: 0 8px 22px rgba(20, 36, 58, 0.14);
}

.flipbook-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
}

.flipbook-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 18px;
  padding: 24px;
  perspective: 1800px;
}

.flipbook-book {
  position: relative;
  width: min(100%, 490px);
  max-height: 100%;
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  cursor: pointer;
  filter: drop-shadow(0 24px 28px rgba(57, 43, 27, 0.24));
}

.flipbook-book::before {
  content: "";
  position: absolute;
  inset: 8px -8px -8px 8px;
  border-radius: 4px 10px 10px 4px;
  background: #d8c5a7;
  box-shadow: inset 5px 0 10px rgba(87, 65, 39, 0.18);
}

.flipbook-sheet {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: 4px 10px 10px 4px;
  background: #fff;
  transform: rotateY(0deg);
  transform-style: preserve-3d;
  transition: transform 0.23s ease-in;
  backface-visibility: hidden;
  box-shadow: inset 8px 0 16px rgba(70, 50, 30, 0.12);
}

.flipbook-sheet::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 22px;
  background: linear-gradient(90deg, rgba(52, 37, 23, 0.18), transparent);
  pointer-events: none;
}

.flipbook-sheet img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.flipbook-sheet.turn-next {
  transform-origin: left center;
  transform: rotateY(-88deg);
}

.flipbook-sheet.turn-prev {
  transform-origin: right center;
  transform: rotateY(88deg);
}

.flipbook-sheet.enter-next {
  transform-origin: right center;
  transform: rotateY(88deg);
  transition: none;
}

.flipbook-sheet.enter-prev {
  transform-origin: left center;
  transform: rotateY(-88deg);
  transition: none;
}

.flipbook-arrow {
  width: 50px;
  height: 76px;
  border-radius: 28px;
  font-size: 42px;
}

.flipbook-arrow:disabled {
  cursor: default;
  opacity: 0.25;
}

.flipbook-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 54px;
  padding: 10px 18px;
  color: #687487;
  background: #fffdf9;
  border-top: 1px solid rgba(20, 36, 58, 0.1);
  font-size: 12px;
}

.flipbook-dots {
  display: flex;
  gap: 8px;
}

.flipbook-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: #c7b89f;
}

.flipbook-dot.active {
  background: #b98b45;
  transform: scale(1.25);
}

/* Все работы в AI-галерее имеют одинаковый визуальный размер. */
.visual-grid button {
  aspect-ratio: 3 / 4 !important;
}

.visual-grid img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* В рекламном слайде сохраняем заголовок в верхней части кадра. */
.visual-grid button:nth-child(2) img {
  object-position: center top !important;
}

@media (max-width: 780px) {
  .hero-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .flipbook-backdrop {
    padding: 0;
  }

  .flipbook-dialog {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .flipbook-stage {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 6px;
    padding: 14px 8px;
  }

  .flipbook-arrow {
    width: 40px;
    height: 62px;
    font-size: 34px;
  }
}

@media (max-width: 540px) {
  .hero-strip {
    grid-template-columns: 1fr !important;
  }
}


/* Финальное выравнивание карточек: без полос и с единым нижним краем. */
.case-study {
  align-items: stretch !important;
}

.case-study > * {
  min-height: 0 !important;
  align-self: stretch !important;
}

.case-preview,
.hero-strip,
.visual-grid {
  align-items: stretch !important;
}

.case-preview {
  box-sizing: border-box !important;
  align-self: stretch !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
}

.case-preview button,
.hero-strip button,
.visual-grid button,
.gallery-thumbs button {
  box-sizing: border-box !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  line-height: 0 !important;
  overflow: hidden !important;
}

.case-preview img,
.hero-strip img,
.visual-grid img,
.gallery-thumbs img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  object-fit: cover !important;
  object-position: center !important;
  vertical-align: bottom !important;
}

/* Окно просмотра: кадр стоит по нижнему краю, а свободное поле сливается с фоном. */
.gallery-main {
  align-items: end !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  background: #fffdf9 !important;
}

.gallery-modal .gallery-main > img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  object-fit: contain !important;
  object-position: center bottom !important;
  background: #fffdf9 !important;
  vertical-align: bottom !important;
}

.gallery-footer,
.gallery-thumbs {
  margin-top: 0 !important;
}

@media (max-width: 540px) {
  .gallery-main {
    padding: 52px 0 0 !important;
  }
}
.education-grid .qualification-certificate {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(174, 137, 85, 0.35);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.education-grid .qualification-certificate:hover,
.education-grid .qualification-certificate:focus-visible {
  border-color: #cba968;
  transform: translateY(-2px);
}

.education-grid .qualification-certificate img {
  width: 6rem;
  height: 5rem;
  object-fit: cover;
  object-position: top;
  border-radius: 0.35rem;
}

.education-grid .qualification-certificate span {
  display: grid;
  gap: 0.4rem;
  line-height: 1.4;
}

.education-grid .qualification-certificate strong {
  display: block;
}
