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

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

.header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  background-color: white;
  font-family: var(--accent-font);
  text-transform: uppercase;
  border: 2px solid;

  inline-size: var(--container-inline-size);
  margin-inline: auto;
  margin-block-start: 100px;
  margin-block-end: 96px;
  /* padding-block: clamp(122px, 10vw, 130px); 
  Заметила, что border прибавляется к высоте, решила исправить */
  padding-block: clamp(120px, 10vw, 130px);
}

.header-logo {
  font-size: clamp(3.0625rem, 2.7104rem + 1.5023vw, 4.0625rem);
  line-height: 100%;
  /* line-height: clamp(3.0625rem, 2.7104rem + 1.5023vw, 4.0625rem); */
}

.header-title {
  font-size: clamp(0.875rem, 0.6769rem + 0.8451vw, 1.4375rem);
  line-height: 100%;

  /* line-height: clamp(0.875rem, 0.6769rem + 0.8451vw, 1.4375rem); */
}

.main {
  inline-size: var(--container-inline-size);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 50px;
}

.card {
  border: 2px solid black;
  background-color: white;
}

.card-title {
  font-variation-settings: "wght" var(--title-weight);
  font-size: 18px;
  line-height: 22px;
  padding: 4px 10px;
}

.image-box {
  position: relative;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
}

.image-label {
  position: absolute;
  z-index: 1;
  top: 25px;
  right: 25px;
  text-align: right;
  /* max-inline-size: clamp(120px, 100%, 700px);
  height: 100%;
  white-space: normal;
  overflow-wrap: break-word; */
  font-family: var(--accent-font);
  font-size: 14px;
  line-height: 14px;
  text-transform: uppercase;
  mix-blend-mode: hard-light;
  opacity: 0.5;
  text-shadow:
    1px -1px var(--shadow),
    1px 1px var(--shadow),
    -1px 1px var(--shadow),
    -1px -1px var(--shadow);
}

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

.card-image {
  display: block;
  width: 100%;
}
/* Потом исправлю? про card-image

"Можно лучше:"
Для сохранения пропорций изображений(img) рекомендуется 
использовать CSS-свойства object-fit и object-position. 
Это поможет корректно масштабировать изображения и 
контролировать их позицию внутри контейнера. 
Дополнительную информацию и примеры вы найдете 
в документации: object-fit и object-position. */

.filter-brightness-contrast {
  filter: brightness(50%) contrast(150%);
}

.filter-brightness-sepia {
  filter: brightness(200%) sepia(60%);
}

.filter-grayscale-invert {
  filter: grayscale(80%) invert(30%)
    drop-shadow(5px 15px 3px rgba(0, 0, 0, 0.8));
}

.filter-invert-hue-rotate-saturate {
  filter: invert(90%) hue-rotate(30deg) saturate(80%);
}

.filter-grayscale-invert-brightness {
  filter: grayscale(80%) invert(100%) brightness(50%);
}

.filter-blur-hue-rotate {
  filter: blur(5px) hue-rotate(300deg);
}

.filter-invert-blur {
  filter: invert(90%) blur(20px);
}

.card-text {
  padding: 25px;
  display: grid;
  row-gap: 25px;
  font-weight: var(--text-weight);
  font-size: 18px;
  line-height: 21px;
}

.button {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background-color: white;
  height: 38px;
  outline: none;
  border: 2px solid black;
  cursor: pointer;
}

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

.like-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

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

.card__icon-button {
  height: 38px;
  width: 38px;
  padding: 0;
  background-color: white;
  outline: none;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
  cursor: pointer;
}

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

.card__icon-button:focus-visible {
  border-color: black;
}

.like-icon {
  display: block;
  height: 38px;
  width: 38px;
}

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

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

.like-icon__third-contour {
  transition: fill 0.1s linear;
}

.like-icon__fourth-sparks {
  opacity: 0;
}

.card__icon-button:hover .like-icon__first-core {
  fill: var(--heart-countour-color);
  transition-delay: 0s;
}

.card__icon-button:hover .like-icon__second-main-body {
  fill: var(--heart-countour-color);
  transition-delay: 0.05s;
}

.card__icon-button:active .like-icon__first-core {
  fill: var(--animation-fill-color);
  transition-delay: 0s;
}

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

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

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

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

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

.like-icon.is-liked .like-icon__fourth-sparks {
  fill: var(--animation-fill-color);
  animation: sparks-flash 0.3s ease-in 0.3s 1;
}

.card__like-button {
  width: 130px;
  transition: box-shadow 0.3s ease;
}

/* Комментарий ревьюера (можно лучше, не критическая ошибка)
Относится к card__like-button
Исправить позже (после сдачи проекта, либо до)

Комментарий рекомендация:
Использование фиксированной высоты/ширины для текстовых блоков 
может привести к проблемам с масштабируемостью. 
Например, если количество текста/элементов окажется больше 
чем текущая ширина/высота элемента сможет вместить, 
то верстка просто сломается. 
*/

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

.button__text {
  /* Сохранить на память */
  font-family: var(--accent-font);
  font-size: 14px;
  line-height: 90%;
  position: relative;
  z-index: 1;
  color: var(--button-color);
  mix-blend-mode: difference;
}

.button-save {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  inline-size: clamp(306px, 80vw, 335px);
  margin-inline: auto;
  padding-block: 15px;
  height: auto;
}

.button__floppy-icon {
  display: block;
  width: 21px;
  height: 21px;

  color: white;
  mix-blend-mode: difference;
}

.save-block {
  padding: 30px 30px;
  inline-size: clamp(320px, 90vw, 353px);
  margin: auto;
  display: grid;
  grid-template-columns: min-content 1fr;
  grid-template-rows: 1fr auto;
  gap: 30px 20px;
  background-color: white;
  position: fixed;
  outline: none;
  border: 2px;
}

.save-block:not([open]) {
  pointer-events: none;
  opacity: 0;
}

.save-block::backdrop {
  background-color: rgb(0 0 0 / 75%);
}

.save-block__floppy-icon {
  width: 39px;
  height: 39px;
  align-self: center;
}

.save-block__instruction {
  font-family: var(--accent-font);
  font-size: 14px;
  line-height: 150%;
  text-transform: uppercase;
}

/* Комментарий ревьюера. Не критический.
Относится к .save-block__button
Исправить до или после сдачи проекта

Комментарий рекомендация:
Использование фиксированной высоты/ширины для 
текстовых блоков может привести к проблемам с 
масштабируемостью. Например, если количество текста/элементов 
окажется больше чем текущая ширина/высота элемента сможет вместить, 
то верстка просто сломается.  */

.save-block__button {
  grid-column-start: 1;
  grid-column-end: 3;
  text-transform: uppercase;
}

/* Медиа писала сразу, начиная с mobile-first, 
поэтому поменяла медиазапрос */
@media (width < 376px) {
  .header {
    margin-block-end: 100px;
  }

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

  .save-block {
    padding-inline: 40px;
    /* margin-inline: 17px; */
  }
}
