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

Будьте внимательны! Для корректной работы скриптов на этом сайте нужно, чтобы в 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;
  background-image: var(--bg-image, 
    repeating-linear-gradient(to right, #d3d3d3 0 2px, transparent 2px 4px),
    repeating-linear-gradient(#d3d3d3 0 2px, transparent 2px 4px),
    linear-gradient(#e7e7e7, #e7e7e7 0.01%, #1a1a1a));
  background-attachment: fixed;
  background-size: cover;
  font-family: var(--main-font-family, 'Inter-Variable'), sans-serif;
  font-variation-settings: 'wght' var(--text-font-weight);
}

.block-layout {
  margin-inline: auto;
  inline-size: var(--block-width, clamp(23.4375rem, 16.2852rem + 30.5164vw, 43.75rem));
}

/* Стили для шапки сайта */

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  font-family: var(--accent-font-family, 'PressStart2P'), sans-serif;
  line-height: 1;
  text-transform: uppercase;
  margin-block-start: var(--block-margin);
  margin-block-end: 98px;
  background-color: var(--bg-color, #fff);
  border: var(--element-border);
  padding-block: clamp(7.5rem, 7.2799rem + 0.939vw, 8.125rem);
}

.header__logo {
  font-size: clamp(3.0625rem, 2.7104rem + 1.5023vw, 4.0625rem);
  font-weight: 400;
}

.header__title {
  font-size: clamp(0.875rem, 0.6769rem + 0.8451vw, 1.4375rem);
  font-weight: 400;
}

/* Стили для основной секции */

.main-content {
  display: flex;
  flex-direction: column;
  gap: var(--article-gap);
  margin-block-end: var(--block-margin);
}

/* Стили для карточек */

.card {
  background-color: var(--bg-color, #fff);
  border: var(--element-border);
}

.card__title {
  font-size: var(--text-font-size);
  line-height: 1.2;
  font-variation-settings: 'wght' var(--title-font-weight);
  padding: 5px 10px;
}

.card__description {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  padding: var(--card-padding);
  font-size: var(--text-font-size);
  line-height: 1.17;
}

.card__image-wrapper {
  position: relative;
  border-block: var(--element-border);
}

.card__image {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center;
  aspect-ratio: 1/1;
}

.card__image_wrongness {
  filter: saturate(110%);
}

.card__image_whiteness {
  filter: grayscale(1);
}

.card__image_readiness {
  filter: invert(0.9);
}

.card__image_perfectness {
  filter: saturate(140%);
}

.card__image_thankfulness {
  filter: hue-rotate(-30deg) sepia(20%);
}

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

.card__image_accurateness {
  filter: contrast(120%);
}

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

.card__label {
  position: absolute;
  inset-block-start: 25px;
  inset-inline-end: 25px;
  font-family: var(--accent-font-family), sans-serif;
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
  text-transform: uppercase;
  text-shadow: 0 0 1px var(--shadow-color);
  mix-blend-mode: hard-light;
}

@supports((text-stroke: 1px rgba(255 255 255 / 0.5)) or (-webkit-text-stroke: 1px rgba(255 255 255 / 0.5))) {
  .card__label {
    -webkit-text-stroke: 1px var(--shadow-color);
    text-stroke: 1px var(--shadow-color);
    text-shadow: none;
  }
}

.card__button-group {
  display: flex;
  gap: 5px;
  align-self: flex-end;
}

.button {
  position: relative;
  font-family: var(--accent-font-family);
  font-size: var(--button-font-size, 14px);
  line-height: 0.9;
  font-weight: 400;
  background-color: transparent;
  border: var(--element-border, 2px solid #000);
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.button:focus {
  outline: none;
}

.button:focus-visible {
  box-shadow: 2px 2px 0 0 currentColor;
}

.button::before {
  position: absolute;
  content: "";
  inline-size: 100%;
  block-size: 100%;
  inset: 0;
  background-color: var(--border-color, #000);
  transform: translateX(-100%);
  transition: 0.5s ease-in-out;
}

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

.button .button__text {
  position: relative;
  mix-blend-mode: difference;
  color: var(--diff-button-color, #fff);
}

.card__like-button {
  inline-size: 130px;
  padding: 10px;
}

/* Кнопка с сердцем */

.like-icon {
  display: block;
}

.card__icon-button {
  background-color: transparent;
  border: 2px solid rgba(0 0 0 / 0);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.card__icon-button:focus {
  outline: none;
}

.card__icon-button:focus-visible {
  border-color: rgba(0 0 0 / 1);
}

.contour {
  transition: fill 0.1s linear;
}

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

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

.sparks {
  opacity: 0;
}

/* Переходы и анимация при взаимодействии с иконкой сердца */

.like-icon:hover .core {
  fill: var(--heart-contour-color, #000);
  transition: fill 0.3s linear;
}

.like-icon:hover .main-body {
  fill: var(--heart-contour-color, #000);
  transition: fill 0.3s linear 0.05s;
}

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

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

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

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

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

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

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

/* Стили для кнопки сохранения */

.main-content__save-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  inline-size: clamp(19.125rem, 18.4868rem + 2.723vw, 20.9375rem);
  background-color: var(--bg-color, #fff);
  margin-inline: auto;
  padding-block: 16px;
  padding-inline: 10px;
}

.main-content__icon-floppy {
  display: block;
  inline-size: 21px;
  block-size: 21px;
}

.button .icon-floppy {
  position: relative;
  mix-blend-mode: difference;
  fill: var(--diff-button-color, #fff);
}

/* Стили для модального окна */

.dialog[open] {
  display: grid;
  grid-template-columns: min-content 1fr;
  align-items: center;
  column-gap: 18px;
  row-gap: 30px;
  inline-size: clamp(21.3125rem, 21.0484rem + 1.1268vw, 22.0625rem);
  border: var(--element-border);
  padding: var(--dialog-padding);
}

.dialog::backdrop {
  background-color: var(--backdrop-color);
}

.dialog__icon-floppy {
  display: block;
  inline-size: 39px;
  block-size: 39px;
}

.dialog__text {
  grid-column: 2;
  font-family: var(--accent-font-family), sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  text-transform: uppercase;
}

.dialog__button {
  grid-column: 1 / 3;
  padding: 10px;
}

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

@media (width <= 375px) {
  .header {
    margin-block-end: var(--block-margin);
  }

  .main-content__save-button {
    flex-direction: column;
    align-items: center;
  }

  .main-content__icon-floppy {
    inline-size: 28px;
    block-size: 28px;
  }

  .dialog[open] {
    padding-inline: 40px;
  }
}