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

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

*/

.page {
  min-inline-size: 320px;
  min-block-size: 100dvb;
  font-family: var(--main-text), "Helvetica", sans-serif;
  font-variation-settings: "wght", var(--main-text-weight);
  background-image: var(--background-image);
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

.header {
  width: var(--width);
  height: 368px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 100px auto;
  border: 2px solid rgba(0, 0, 0, 1);
  background: #fff;
}

.header__logo {
  font-family: var(--accent-text);
  font-size: 65px;
  line-height: 100%;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.header__title {
  font-family: var(--accent-text);
  font-size: 23px;
  line-height: 100%;
  text-transform: uppercase;
}

.main {
  width: var(--width);
  margin: 0 auto;
}

.cards-container {
  display: grid;
  gap: 50px;
  margin: 0 auto;
  width: var(--width);
}

.card {
  border: 2px solid rgba(0, 0, 0, 1);
  display: flex;
  flex-direction: column;
  background: #fff;
}

.card__title {
  font-size: 18px;
  line-height: 100%;
  padding-left: 10px;
  padding-bottom: 3px;
  padding-top: 3px;
}

.card__image-wrapper {
  position: relative;
  display: block;
}

.card__image {
  width: 100%;
}

.sprint_1_1 .card__image {
  filter: sepia(80%);
}

.sprint_1_2 .card__image {
  filter: hue-rotate(-70deg);
}

.sprint_2_1 .card__image {
  filter: brightness(5);
}

.sprint_2_2 .card__image {
  filter: contrast(10);
}

.sprint_3_1 .card__image {
  filter: grayscale(1.25);
}

.sprint_3_2 .card__image {
  filter: blur(12px);
}

.sprint_4 .card__image {
  filter: hue-rotate(120deg) brightness(1.2);
}

.card__label {
  position: absolute;
  z-index: 3;
  top: 25px;
  right: 25px;
  mix-blend-mode: hard-light;
  font-family: var(--accent-text);
  font-weight: var(--main-text-weight);
  font-size: 14px;
  text-shadow:
    0 0 var(--stroke-width) var(--stroke-color),
    0 0 var(--stroke-width) var(--stroke-color),
    0 0 var(--stroke-width) var(--stroke-color),
    0 0 var(--stroke-width) var(--stroke-color);
}

@supports (-webkit-text-stroke: var(--stroke-width) var(--stroke-color)) {
  .label {
    text-shadow: none;
    -webkit-text-stroke: var(--stroke-width) var(--stroke-color);
  }
}

.card__text {
  font-family: var(--main-text);
  font-weight: var(--main-text-weight);
  font-size: 18px;
  line-height: 21px;
  margin: 25px;
}

.card__icon-button {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  border: none;
  background-color: rgba(255, 255, 255, 0);
}

.like-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.card__like-button {
  font-family: var(--accent-text);
  font-weight: var(--main-text-weight);
  font-size: 14px;
  line-height: 90%;
  width: 130px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(0, 0, 0, 1);
  transition: box-shadow 0.3s ease;
  position: relative;
  color: #fff;
  background: #fff;
}

.card__like-button span {
  position: relative;
  z-index: 1;
  mix-blend-mode: difference;
}

.save-button {
  background-color: #fff;
  width: 335px;
  height: 51px;
  padding: 0;
  margin-bottom: 5px;
  display: flex;
  gap: 3.5px;
  justify-self: center;
  justify-content: center;
  align-items: center;
  transition: box-shadow 0.3s ease;
  position: relative;
  border: 2px solid rgba(0, 0, 0, 1);
}

.save-button__text {
  font-family: var(--accent-text);
  font-weight: var(--main-text-weight);
  font-size: 14px;
  line-height: 90%;
  width: 266px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #fff;
  position: relative;
  z-index: 2;
  mix-blend-mode: difference;
}

.card__button-wrapper {
  display: flex;
  margin: 0 25px 25px 0;
  max-block-size: 38px;
  justify-content: end;
}

.dialog {
  width: 357px;
  height: 192px;
}

.dialog[open] {
  display: grid;
  grid-template-columns: min-content minmax(min-content, 1fr);
  grid-auto-rows: min-content;
  column-gap: 20px;
  row-gap: 30px;
  align-items: center;
  padding: 27px;
  border: 2px solid #000;
}

.dialog__image {
  width: 39px;
  height: 39px;
  grid-column: 1;
  grid-row: 1;
  position: relative;
  mix-blend-mode: difference;
  z-index: 1;
}

.dialog__text {
  width: 212px;
  height: 60px;
  grid-column: 2;
  grid-row: 1;
  font-family: Press Start 2P;
  line-height: 150%;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  mix-blend-mode: difference;
}

.dialog__button {
  width: 293px;
  height: 38px;
  grid-column: 1 / 3;
  grid-row: 2;
  justify-self: center;
  position: relative;
  overflow: hidden;
  background: #fff;
  color: #fff;
}

dialog::backdrop {
  background-color: rgba(0 0 0 / 0.75);
}

.card__like-button:focus,
.save-button:focus,
.dialog__button:focus {
  outline: none;
}

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

.card__like-button:focus {
  box-shadow: none;
}

.card__like-button::before,
.save-button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease-in-out;
  z-index: 0;
}

.card__like-button:hover::before,
.save-button:hover::before {
  transform: scaleX(1);
}

.card__like-button:hover,
.save-button {
  cursor: pointer;
}

.diskette {
  position: relative;
  mix-blend-mode: difference;
  z-index: 1;
  fill: #fff;
}

.save-button span {
  position: relative;
  z-index: 2;
  mix-blend-mode: difference;
}

.card__icon-button .core {
  --core__color: #fff;
  transition: fill 0.3s linear;
}

.card__icon-button .main-body {
  --main__body__color: #fff;
  transition: fill 0.3s linear 0.05s;
}

.heart {
  transform-origin: center;
}

.sparks {
  transform-origin: center;
  fill: #fff;
  opacity: 0;
}

.like-icon:hover .core {
  fill: var(--accent-color);
}

.like-icon:hover .main-body {
  fill: var(--accent-color);
}

.like-icon:not(:hover) .core {
  transition: fill 0.3s linear 0.03s;
}

.like-icon:not(:hover) .main-body {
  transition: fill 0.3s linear;
}

.like-icon:active .main-body {
  fill: #f00;
}

.like-icon:active .core {
  fill: #f00;
}

.like-icon.is-liked .main-body {
  fill: #f00;
}

.like-icon.is-liked .core {
  fill: #f00;
}

.like-icon.is-liked .contour {
  fill: #f00;
  transition: fill 0.3s linear 0.06s;
}

.like-icon.is-liked .sparks {
  fill: #f00;
}

.is-liked .heart,
.is-liked .sparks {
  animation: like-animation 0.3s ease-in 0.1s 1; /*анимация, время, скорость, задержка, повторения*/
}

.is-liked .sparks {
  animation: spark-animation 0.3s ease-in 0.3s 1;
}

.like-icon:not(.is-liked) .contour {
  fill: #000;
  transition: fill 0.1s linear;
}

@media (width <= 375px) {
  .header {
    height: 327px;
  }

  .header__logo {
    font-size: 49px;
  }

  .header__title {
    font-size: 14px;
  }

  .main {
    width: 100%;
  }
  .card__image {
    width: 100%;
  }

  .label {
    right: 11px;
  }

  .card__text {
    margin: 25px 27px;
  }

  .save-button {
    width: 306px;
    height: 80px;
    margin-bottom: 102px;
    gap: 8px;
    flex-direction: column;
  }

  .diskette {
    width: 28px;
    height: 28px;
  }

  .dialog {
    width: 341px;
    height: 195px;
  }

  .dialog[open] {
    padding: 30px 42px;
    width: 341px;
    height: 195px;
  }

  .dialog__image {
    width: 39px;
    height: 39px;
  }

  .dialog__text {
    width: 198px;
    height: 63px;
  }

  .dialog__button {
    width: 257px;
    height: 38px;
  }
}
