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

Будьте внимательны! Для корректной работы скриптов на этом сайте нужно, чтобы в 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-font), "Arial", sans-serif;
  font-variation-settings: "wght" var(--main-font-weight-text);
  background-image: var(--bg-image);
  background-size: cover;
  background-attachment: fixed;
}

.header {
  margin-top: 100px;
  padding: clamp(122px, 119.18px + 0.75vw, 130px) 0;
}

.heading {
  font-family: var(--accent-font, "PressStart2P"), fantasy, sans-serif;
  font-size: clamp(49px, 43.37px + 1.50vw, 65px);
  text-transform: uppercase;
  margin: auto;
  padding-bottom: 20px;
  text-align: center;
}

.small-heading {
  font-size: clamp(14px, 10.83px + 0.85vw, 23px);
  padding-bottom: 0;
}

.card {
  inline-size: var(--section-width, clamp(375px, 260.56px + 30.52vw, 700px));
  background-color: rgb(255 255 255);
  margin: auto;
  border: solid 2px rgb(0 0 0);
  margin-bottom: 50px;
}

.card:first-of-type {
  margin-top: 98px;
}

.card__title {
  font-variation-settings: "wght" var(--main-font-weight-title);
  font-size: 18px;
  margin: 4px 10px;
}

.card__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-top: solid 2px var(--accent-color);
  border-bottom: solid 2px var(--accent-color);
}

.image {
  width: 100%;
  object-fit: cover;
  object-position: center;
}

.filter-sepia {
  filter:sepia(0.7);
}

.filter-brightness {
  filter: brightness(230%);
}

.filter-contrast {
  filter: contrast(70%) hue-rotate(180deg);
}

.filter-blur {
  filter: blur(0.3rem) hue-rotate(270deg) contrast(130%);
}

.filter-opacity {
  filter: opacity(30%);
}

.filter-grayscale {
  filter: grayscale(1);
}

.filter-hue-rotate {
  filter: hue-rotate(120deg);
}

.label {
  position: absolute;
  top: 25px;
  right: 25px;
  font-family: var(--accent-font, "PressStart2P"), fantasy, sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  color: transparent;
  text-shadow:
  -1px 0 #fff,
  0 1px #fff,
  1px 0 #fff,
  0 -1px #fff;
  opacity: 50%;
  mix-blend-mode: hard-light;
}

@supports((text-stroke: 1px #fff) or (-webkit-text-stroke: 1px #fff)) {
  .label {
    -webkit-text-stroke: 1px #fff;
    text-stroke: 1px #fff;
    text-shadow: none;
  }
}

.card__text {
  font-size: 18px;
  line-height: 1.16;
  font-weight: var(--main-font-weight-text);
  padding: 24px 25px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.card__button {
  border: none;
  background-color: inherit;
  align-self: flex-end;
  gap: 3px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;
  border: solid 2px rgb(0 0 0);
  cursor: pointer;
  background-color: var(--bg-color);
  position: relative;
  transition: box-shadow 0.3s ease;
}

.button__text {
  font-family: var(--accent-font, "PressStart2P"), fantasy, sans-serif;
  font-size: 14px;
  line-height: 0.9;
  color: #fff;
  mix-blend-mode: difference;
}

.button::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--accent-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease-in-out;
}

.button:hover::before {
  transform: scaleX(1);
}

.button:hover {
  cursor: pointer;
  
}

.button:focus-visible {
  outline: none;
  box-shadow: 2px 2px 0 var(--accent-color, #000);
}

.card__icon-button {
  block-size: 38px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: inherit;
  border: solid 2px transparent;
  cursor: pointer;
  transition: border 0.3s ease;
  flex-shrink: 0;
}

.heart {
  transform-origin: center;
}

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

.contour {
  transition: fill 0.1s linear;
}

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

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

.like-icon:hover .core {
  fill: var(--accent-color);
  transition: fill 0.3s linear 0s;
}

.like-icon:active .core {
  fill: var(--animation-fill-color);
  transition: fill 0.3s linear 0s;
}

.like-icon.is-liked .core {
  fill: var(--animation-fill-color);
  transition: fill 0.3s linear 0s;
}

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

.sparks {
  opacity: 0;
}

.like-icon:hover .main-body {
  fill: var(--accent-color);
  transition: fill 0.3s linear 0.05s;
}

.like-icon:active .main-body {
  fill: var(--animation-fill-color);
  transition: fill 0.3s linear 0.05s;
}

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

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

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

.card__like-button {
  inline-size: 130px;
  block-size: 38px;
  padding: 12.5px 37px;
  background-color: inherit;
}

.save-button {
  margin-inline: auto;
  margin-top: 50px;
  margin-bottom: 100px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-color);
  padding: 15px;
}

.save-button__icon {
  inline-size: 21px;
  block-size: 21px;
  color: #fff;
  mix-blend-mode: difference;
}

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

.dialog {
  padding: 30px;
  overflow: hidden;
  inline-size: clamp(341px, 336.77px + 1.13vw, 353px);
  border: solid 2px #000;
}

.dialog[open] .insert-floppy {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

.insert-floppy__icon {
  inline-size: 39px;
  block-size: 39px;
  flex-shrink: 0;
}

.insert-floppy__text {
  text-transform: uppercase;
  line-height: 1.5;
}

.ok-button {
  width: 100%;
  block-size: 38px;
  text-transform: uppercase;
}

@media (width <= 375px) {
  .card {
    margin-bottom: 52px;
  }
  
  .save-button {
    flex-direction: column;
  }

  .save-button__icon {
  inline-size: 28px;
  block-size: 28px;
  }
}