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

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

*/

.page {
  color: var(--text-color);
  font-family: var(--font), sans-serif;
  background-image: var(--gradient);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  min-inline-size: 320px;
  min-block-size: 100dvb;
  font-variation-settings: 'wght' var(--font-weight-text);
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-block: 100px;
}

.header-logo-group-container {
  border: var(--border);
  padding-inline: clamp(16px, 16px + (122.5 - 16) * ((100vw - 375px) / (1440 - 375)), 122.5px);
  padding-block: clamp(120px, 120px + (130 - 120) * ((100vw - 375px) / (1440 - 375)), 130px);
  background-color: var(--bg-color);
}

.inline-size {
  inline-size: var(--inline-size);
}

.header-logo-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 21px;
  font-family: var(--accent-font), fantasy;
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  text-transform: uppercase;
}

.header-logo-group__title {
  font-size: clamp(3.0625rem, 2.7104rem + 1.5023vw, 4.0625rem);
}

.header-logo-group__subtitle {
  font-size: clamp(0.875rem, 0.6769rem + 0.8451vw, 1.4375rem);
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
}

.card {
  border: var(--border);
  background-color: var(--bg-color);
}

.card-title {
  padding-inline: 10px;
  padding-block: 4px;
  font-size: 18px;
  font-style: normal;
  line-height: 122%;
  font-variation-settings: 'wght' var(--font-weight-title);
}

.card-image-container {
  position: relative;
}

.card-image {
  inline-size: 100%;
  block-size: clamp(
    371px,
    371px + ((100vw - 375px) / (1440 - 375)) * (696 - 371),
    696px
  );
}

.saturate {
   filter: saturate(170%);
}

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

.grayscale {
  filter: grayscale(0.5);
}

.sepia {
  filter: sepia(50%);
}

.invert {
  filter: invert(0.7);
}

.filters {
  filter: sepia(40%) contrast(130%) brightness(130%);
}

.brightness {
  filter: brightness(80%);
}

.card-image__label {
  position: absolute;
  top: 27px;
  right: 25px;
  opacity: 0.5;
  font-family: var(--accent-font), fantasy;
  font-weight: 400;
  font-size: 14px;
  font-style: normal;
  line-height: 100%;
  text-transform: uppercase;
  text-shadow: 
  -1px 0 var(--shadow-color),
  1px 0 var(--shadow-color),
  0 -1px var(--shadow-color),
  0 1px var(--shadow-color);
  mix-blend-mode: hard-light;
}

.card-info {
  display: grid;
  gap: 25px;
  padding:25px;
  font-size: 18px;
  font-style: normal;
  line-height: 117%;
}

.card-button {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 4px;
}

.card__like-button {
  padding-block: 6px;
  min-inline-size: 130px;
}

.button__text {
  position: relative;
  z-index: 2;
  overflow: hidden;
  color: var(--color-button);
  font-family: var(--accent-font), fantasy;
  font-weight: 400;
  font-size: 14px;
  font-style: normal;
  line-height: 90%;
  text-align: center;
  mix-blend-mode: difference;
  white-space: nowrap;
}

.button {
  position: relative;
  border: var(--border);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.like-icon {
  display: block;
}

.contour {
  transition: fill 0.1s linear;
}

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

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

.like-icon:hover .core {
  --core-color: #000;

  transition: fill 0.3s linear 0s;
}

.like-icon:hover .main-body {
  --main-body-color: #000;

  transition: fill 0.3s linear 0.05s;
}

.like-icon:active .core {
  --core-color: #FF0000;

  transition: fill 0.3s linear 0s;
}

.like-icon:active .main-body {
  --main-body-color: #FF0000;

  transition: fill 0.3s linear 0.05s;
}

.like-icon.is-liked .core {
  --core-color: #FF0000;
}

.like-icon.is-liked .main-body {
  --main-body-color: #FF0000;

  transition: fill 0.3s linear 0.05s;
}

.like-icon.is-liked .contour {
  --contour-color: #FF0000;

  transition: fill 0.3s linear 0.06s;
}

.like-icon.is-liked .sparks {
  --sparks-color: #FF0000;
  
  opacity: 0;
  animation: sparks-flash 0.3s ease-in 0.3s 1;
}

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

.card__icon-button {
  border: 2px solid transparent;
  padding: 0;
  transition: border 0.3s ease;
}

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

.card__icon-button:focus-visible {
  border: var(--border);
}

.button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-color: var(--accent-color);
  transition: transform 0.5s ease-in-out;
  transform: translateX(-100%) scaleX(0);
}

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

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

.button svg {
  position: relative;
  z-index: 2;
  color: var(--color-button);
  filter: invert(1);
  mix-blend-mode: difference;
}

.save {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin-inline: auto;
  margin-block-start: 50px;
  margin-block-end: 100px;
  padding: 15px 19px;
  background-color: var(--bg-color);
}

.save__svg {
  width: 21px;
  height: 21px;
}

.modal {
  display: none;
  padding: 27px;
  max-inline-size: 353px;
}

.modal[open] {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 30px;
  background-color: var(--bg-color);
}

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

.page:has(.modal[open]) {
  overflow: hidden;
}

.modal__content {
  display: flex;
  align-items: center;
  gap: 20px;
  block-size: 63px;
}

.modal__content svg {
  flex-shrink: 0;
  inline-size: 39px;
  block-size: 39px;
}

.modal__text-wrapper {
  font-family: var(--accent-font), fantasy;
  font-weight: 400;
  font-size: 14px;
  font-style: normal;
  line-height: 150%;
  text-transform: uppercase;
}

.modal__btn-ok {
  padding-block-start: 9px;
  padding-block-end: 5px;
  inline-size: 100%;
}

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

@media (min-width: 376px) {
  .header {
    margin-block-start: 98px;
    margin-block-end: 96px;
  }

  .header-logo-group {
    gap: 20px;
  }

  .save {
    flex-direction: row;
    padding-block: 15px;
  }
}

@media (width <= 375px) {
  .save {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

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

  .modal {
    padding-inline: 37px;
    max-inline-size: 341px;
  }
}