.page {
  min-inline-size: 320px;
  min-block-size: 100vh;
  font-family: var(--main-font-family);
  font-variation-settings: "wght" var(--main-font-weight);
  background-image: var(--gradient);
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 100px;
}

.header {
  background-color: var(--background-color);
  font-family: var(--accent-font-family);
  border: 2px solid var(--border-color);
  margin-block-start: 100px;
  margin-block-end: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(7.5rem, 7.1479rem + 1.5023vw, 8rem) clamp(1.5rem, 1.3462rem + 0.6576vw, 2rem);
  text-transform: uppercase;
  font-weight: 400;
  inline-size: var(--content-width);
}

.header__title {
  font-size: var(--header-title-size);
  margin-bottom: 20px;
}

.header__text {
  font-size: var(--header-text-size);
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 54px;
}

.card {
  font-family: var(--main-font-family);
  background-color: white;
  border: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  inline-size: var(--content-width);
}

.card__title {
  font-weight: var(--title-font-weight);
  font-variation-settings: "wght" var(--title-font-weight);
  font-size: 18px;
  padding: 4px 10px;
  align-self: flex-start; 
  width: 100%;
}

.card__image {
  width: var(--content-width);
  object-fit: cover;
  object-position: center;
  border: 2px solid var(--border-color);
  display: block;
  aspect-ratio: 1 / 1;
  height: auto; 
  max-height: 696px;
}

.card__image-wrapper {
  position: relative;
  overflow: hidden;
  width: var(--content-width);
  height: auto; 
  aspect-ratio: 1 / 1;
  max-height: 696px;
}

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

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

.card__text {
  font-weight: var(--main-font-weight);
  font-variation-settings: "wght" var(--main-font-weight);
  font-size: 18px;
  margin: 25px;
}

.card__text + .card__text {
  margin-top: 0;
}

.button-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 27px;
  margin-right: 25px;
  gap: 5px;
  margin-left: 25px;
  width: calc(100% - 50px); 
}

.card__icon-button {
  background-color: transparent;
  justify-content: flex-end;
  align-items: center;
  border: none;
  transition: transform 0.3s ease; 
  padding: 0;
}

.button {
  display: flex;
  border: 2px solid var(--border-color);
  background-color: var(--background-color);
  justify-content: center;
  align-items: center;
  inline-size: fit-content;
  position: relative;
  overflow: hidden; 
  cursor: pointer;
  transition: box-shadow 0.3s ease;
  transform: translateZ(0); 
}

.card__like-button {
  padding: 12px 37px;
  min-width: 130px;
  width: 130px; 
  display: flex;
  justify-content: center; 
  align-items: center; 
}

.save_content {
  margin: 52px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__save-button {
  background-color: white;
  padding: 17px 20px;
  gap: 8px;
}

.button__text {
  position: relative;
  z-index: 2;
  font-family: var(--accent-font-family);
  font-weight: 400;
  font-size: 14px;
  color: #ffffff;
  text-align: center;
  mix-blend-mode: difference;
}

.card__save-icon {
  position: relative;
  z-index: 2;
  fill: #000000;
}
.card__save-icon use {
  fill: #000000;
}

.dialog__button-text {
  text-transform: uppercase;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--border-color);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s ease-in-out;
  z-index: 1;
  box-sizing: border-box;
}

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

.dialog:not([open]) {
  display: none;
}

.dialog {
  background-color: var(--background-color);
  border: 2px solid var(--border-color);
  padding: 30px;
  max-inline-size: 353px;
  inline-size: 100%;
}

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

.dialog__content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.dialog__content-text {
  display: flex;
  gap: 20px;
  align-items: center;
}

.dialog__text {
  font-family: var(--accent-font-family);
  font-size: 14px;
  max-inline-size: 234px;
  line-height: 150%;
  text-transform: uppercase;
}

.dialog__button {
  width: 100%;
  padding: 12.5px 132.5px;
}

.dialog__button-text {
  line-height: 90%;
}

@media (width < 376px) {
  .cards {
    gap: 52px;
  }

  .card__save-button {
    flex-direction: column;
    padding: 17px 20px;
  }

  .card__save-icon {
    width: 28px;
    height: 28px;
  }

  .dialog {
    padding: 30px 40px;
    max-inline-size: 341px;
  }

  .dialog__text {
    max-inline-size: 234px;
  }

  .dialog__content-text svg {
    width: 39px;
    height: 39px;
    flex-shrink: 0; 
  }

  .card__image {
    max-height: 371px;
    width: 100%;
  }

  .card__image-wrapper {
    max-height: 371px;
    width: 100%;
  }
}

/* Фильтры для изображений */
.card_image_grayscale {
  filter: grayscale(0.8);
}

.card__image_saturate {
  filter: saturate(160%);
}

.card__image_brightness {
  filter: brightness(200%);
}

.card__image_sepia {
  filter: sepia(80%);
}

.card__image_blur {
  filter: blur(0.5rem);
}

.card__image_invert {
  filter: invert(0.3);
}

.card__image_diff {
  filter: brightness(200%) sepia(70%);
}

/* Стили для кнопок */
.button:focus {
  outline: none;
}

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

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

/* Анимации лайков */
.sparks {
  opacity: 0;
}

.contour {
  transition: fill linear 0.1s;
}

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

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

.card__icon-button:hover .core {
  fill: var(--hover-fill-color);
  transition: fill linear 0.3s;
}

.card__icon-button:hover .main-body {
  fill: var(--hover-fill-color);
  transition: fill 0.3s linear 0.05s;
}

.card__icon-button:active .core {
  fill: var(--animation-fill-color);
  transition: fill linear 0.3s;
}

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

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

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

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

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

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

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