/* Здесь вы напишете основную часть стилей страницы.

Будьте внимательны! Для корректной работы скриптов на этом сайте нужно, чтобы в HTML некоторые классы были названы особым образом:
✦ like-icon — для svg-иконки анимированного сердца
✦ card__like-button — для кнопки Like рядом с иконкой
✦ card__icon-button — для кнопки, оборачивающей иконку
✦ is-liked — для обозначения состояния лайкнутой иконки в виде сердца
✦ button__text — для обозначения текстового элемента внутри кнопки

*/

.page {
  min-inline-size: 320px;
  min-block-size: 100dvb;
  font-family: var(--main-font);
  font-variation-settings: 'wght' var(--text-main-font-weight);
  background-color: #fff;
  background-image: var(--complex-grid-gradient);
  background-attachment: fixed;
  background-size: cover;
}

.header {
  margin: 99px auto 96px;
  padding: var(--header-padding-vertical) var(--header-padding-horizontal);
  border: 2px solid #000;
  font-family: var(--accent-font);
  text-transform: uppercase;
  text-align: center;
  background-color: #fff;
}

.responsive-width {
  width: var(--block-width);
  margin-left: auto;
  margin-right: auto;
}

.header__title {
  font-size: var(--logo-font-size);
  /* тут не понимаю в чем проблема:
  по макету в мобильной размер - 49px, а в дектопной - 65px
  у меня в расчете так и сделано;
  сейчас я изменила значение переменной на более точное при расчете:
  визуально я как раньше при наложении не видела различий,
  так и сейчас не вижу - все совпадает;
  
  (на скриншоте с яндекс.диска различия мне видны,
  но у меня же точные значения из макета
  и мне искренне совершенно не понятно откуда несостыковки возникают
  + subtitle выполнен аналогично, но с ним проблемы нет на скрине)
  
  а момент с тем, что блок становился выше я у себя увидела,
  с новой формулой теперь нормально отображается */
  margin-bottom: 20px;
  font-weight: 400;
}

.header__subtitle {
  font-size: var(--subtitle-font-size);
}

.card {
  margin-bottom: 49px;
  border: 2px solid #000;
  background-color: #fff;
}

.last_card {
  margin-bottom: 0;
}

.card__title {
  margin: 3px 11px;
  font-variation-settings: 'wght' var(--title-main-font-weight);
  font-size: 18px;
  line-height: 22px;
}

.card__image-container {
  position: relative;
  overflow: hidden;
  border: 2px solid #000;
  border-left: none;
  border-right: none;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.image-photo {
  height: 100%;
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.image-label {
  position: absolute;
  top: 25px;
  right: 13px;
  padding: 4px 12px;
  color: var(--label-text-color);
  background-color: var(--label-background);
  font-family: var(--accent-font);
  font-size: 14px;
  font-weight: 400;
  text-transform: uppercase;
  mix-blend-mode: hard-light;
  opacity: 0.5;
  z-index: 1;
  text-shadow: 
    -0.7px -0.7px 0 var(--label-stroke-color),
    0.7px -0.7px 0 var(--label-stroke-color),
    -0.7px 0.7px 0 var(--label-stroke-color),
    0.7px 0.7px 0 var(--label-stroke-color);
}

@supports ((text-stroke: 0.5px var(--label-stroke-color)) or (-webkit-text-stroke: 0.5px var(--label-stroke-color))) {
  .image-label {
    -webkit-text-stroke: 0.5px var(--label-stroke-color);
    text-stroke: 0.5px var(--label-stroke-color);
    text-shadow: none;
  }
}

.content {
  padding: 22px 25px 24px;
}

.content__text {
  padding-bottom: 25px;
  font-weight: 410;
  font-size: 18px;
  line-height: 21px;
}

.content__box {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

/* Общие стили для всех кнопок */
.button {
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
  cursor: pointer;
  font-family: var(--accent-font);
  font-size: 14px;
  font-weight: 400;
  background-color: #fff;
  border: 2px solid #000;
}

.button:not(.card__icon-button):focus {
  outline: none;
  box-shadow: 2px 2px 0 var(--accent-color);
}

.button:not(.card__icon-button)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--accent-color);
  transform: translateX(-100%);
  transition: transform 0.5s ease-in-out;
  z-index: 0;
}

.button:not(.card__icon-button):hover::before {
  transform: translateX(0);
}

.button__text {
  position: relative;
  z-index: 1;
  color: var(--text-color, #fff);
  mix-blend-mode: difference;
  transition: color 0.3s ease;
}

/* Специфические стили для разных типов кнопок */
.card__icon-button {
  border: 2px solid transparent;
  padding: 0;
  height: 39px;
}

.card__icon-button:focus-visible {
  outline: none;
  border-color: var(--accent-color);
}

.card__like-button {
  padding: 10px 35px;
  width: 130px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.save__button {
  padding: 11px 16px;
}

.save__button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
}

.button__primary {
  padding: 12.5px 132.5px;
  line-height: 90%;
  height: 38px;
}

/* Стили для иконки дискеты */
.save__button-photo {
  width: 25px;
  height: 25px;
  position: relative;
  z-index: 1;
  mix-blend-mode: difference;
  filter: invert(1);
  transition: fill 0.3s ease;
}

/* Фильтры */
.filter-grayscale {
  filter: grayscale(0.8);
}

.filter-saturate {
  filter: saturate(3) contrast(1.2);
}

.filter-hue-rotate {
  filter: hue-rotate(180deg) saturate(1.3);
}

.filter-contrast {
  filter: contrast(1.5);
}

.filter-sepia {
  filter: sepia(0.9) brightness(1.1);
}

.filter-blur {
  filter: blur(5px);
}

.filter-invert {
  filter: invert(0.3);
}

.filter-multiple {
  filter: sepia(0.5) hue-rotate(120deg) saturate(2) contrast(1.3) brightness(1.1);
}

.save {
  padding: 50px 34.5px 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Всплывающее окно */
.modal {
  padding: 30px;
  border: 2px solid #000;
  max-width: 353px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.modal[open] {
  display: block;
}

.modal__content {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.modal__image {
  width: 39px;
  height: 39px;
  min-width: 39px;
  min-height: 39px;
}

.modal__description {
  font-family: var(--accent-font);
  font-size: 14px;
  font-weight: 400;
  line-height: 150%;
  text-transform: uppercase;
}

.modal form {
  display: flex;
  justify-content: center;
}

/* Анимация иконки сердца */
.sparks {
  opacity: 0;
}

.contour,
.main-body,
.core {
  transition: fill 0.3s linear;
}

.contour {
  transition: fill 0.1s linear;
  fill: var(--outline-color);
}

.core {
  fill: transparent;
  transition: fill 0.3s linear 0.03s;
}

.main-body {
  fill: transparent;
  transition: fill 0.3s linear 0s;
}

.like-icon:hover .core {
  fill: var(--animation-fill-color);
  transition-delay: 0s;
}

.like-icon:hover .main-body {
  fill: var(--animation-fill-color);
  transition-delay: 0.05s;
}

.like-icon:active .core {
  fill: var(--contour-color);
  transition-delay: 0s;
}

.like-icon:active .main-body {
  fill: var(--contour-color);
  transition-delay: 0.05s;
}

.like-icon.is-liked .core {
  fill: var(--contour-color);
  transition-delay: 0s;
}

.like-icon.is-liked .main-body {
  fill: var(--contour-color);
  transition-delay: 0.05s;
}

.like-icon.is-liked .contour {
  fill: var(--contour-color);
  transition: fill 0.3s linear 0.06s;
}

.like-icon {
  transform-origin: center;
}

.like-icon.is-liked .heart {
  animation: scale-heart 0.3s ease-in 0.1s 1;
  transform-origin: center;
}

.like-icon.is-liked .sparks {
  animation: show-sparks 0.3s ease-in 0.3s 1;
}

/* Адаптивность */
@media (width <= 375px) {
  .header {
    margin: 100px 0;
  }

  .card__title {
    margin: 4px 11px;
  }

  .button__primary {
    padding: 12.5px 116.5px;
  }

  .save__button-container {
    flex-direction: column;
    gap: 8px;
  }

  .save__button-photo {
    margin-top: 5px;
    width: 28px;
    height: 28px;
  }

  .modal {
    padding: 30px 40px;
    max-width: 341px;
  }
}