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

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

*/
button {
  background-color: var(--button-bg-color);
  color: var(--accent-color);
  border: none;
  cursor: pointer;
}

.button__text {
  font-family: var(--accent-font-family);
  font-size: 0.875rem; /* 14px */
  position: relative;
  z-index: 2;
  mix-blend-mode: difference;
  color: var(--button-text-color);
}

.page {
  min-inline-size: 320px;
  min-block-size: 100dvb;
  font-family: var(--main-font-family);
  font-variation-settings: "wght" var(--main-font-weight);
  background-image: var(--page-background);
  background-size: cover;
  background-attachment: fixed;
}

/* Общий класс для ширины контента */
.content-width {
  inline-size: var(--content-width);
  margin: 0 auto;
}

/* Шапка */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--header-padding);
  margin-block: var(--header-margin-block);
  margin-inline: auto;
  inline-size: var(--content-width);
  background-color: white;
  border: 2px solid black;
}

.logo__group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header__logo {
  font-family: var(--accent-font-family);
  font-size: var(--logo-size);
  line-height: 1;
  text-transform: uppercase;
  margin-block-end: 20px;
}

.header__title {
  font-family: var(--accent-font-family);
  font-size: var(--title-size);
  line-height: 1;
  text-transform: uppercase;
}

/* Основной контент */

/* Карточка */
.card {
  background-color: white;
  border: 2px solid black;
  margin-block-end: 50px;
}

/* Заголовок карточки */
.card__title {
  font-family: var(--main-font-family);
  font-variation-settings: "wght" var(--card-title-weight);
  font-size: var(--card-content-font-size);
  line-height: 1.17;
  inline-size: 100%;
  block-size: auto;
  padding: 4px 10px;
  box-sizing: border-box;
}

/* Контейнер изображения */
.card__image-container {
  position: relative;
  border-block: 2px solid black;
}

/* Изображение */
.card__image {
  inline-size: 100%;
  block-size: auto;
  max-block-size: 43.5rem; /* 696px */
  display: block;
  object-fit: cover;
  object-position: center;
}

/* CSS-фильтры для изображений карточек */
.filter-brightness-contrast {
  filter: brightness(1.1) contrast(1.2);
}

.filter-saturate-hue-rotate {
  filter: saturate(1.3) hue-rotate(15deg);
}

.filter-invert-brightness {
  filter: invert(0.3) brightness(0.9);
}

.filter-sepia-contrast {
  filter: sepia(0.4) contrast(1.1);
}

.filter-blur-brightness {
  filter: blur(0.5px) brightness(1.05);
}

.filter-hue-rotate-saturate {
  filter: hue-rotate(-20deg) saturate(0.8);
}

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

.filter-brightness-saturate-hue-rotate {
  filter: brightness(1.2) saturate(1.4) hue-rotate(10deg);
}

/* Водяной знак */
.card__watermark {
  position: absolute;
  inset-block-start: 25px;
  inset-inline-end: 25px;
  font-family: var(--accent-font-family);
  font-size: var(--watermark-font-size);
  text-transform: uppercase;
  opacity: 0.5;
  mix-blend-mode: hard-light;
  text-shadow: -1px 0 #ffffff, 0 1px #ffffff, 1px 0 #ffffff, 0 -1px #ffffff;
}

@supports (-webkit-text-stroke: 1px #ffffff) {
  .card__watermark {
    -webkit-text-stroke: 1px #ffffff;
    text-shadow: none;
  }
}

/* Контент карточки */
.card__content {
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.card__text {
  margin-block-end: 25px;
  font-family: var(--main-font-family);
  font-variation-settings: "wght" var(--main-font-weight);
  font-size: var(--card-content-font-size);
  line-height: 1.17;
}

.card__text:last-child {
  margin-block-end: 0;
}

/* Контейнер кнопок */
.card__buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.375rem; /* 6px */
}

/* Общие стили для кнопок с текстом */
.button {
  border: 2px solid black;
  transition: box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  inline-size: 100%;
  block-size: 100%;
  background-color: var(--accent-color);
  transition: left 0.5s ease-in-out;
  z-index: 1;
}

.button:hover::before {
  left: 0;
}

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

.button:active {
  box-shadow: none;
}

/* Кнопка Like */
.card__like-button {
  inline-size: 8.125rem; /* 130px */
  block-size: 2.375rem; /* 38px */
}

.card__icon-button {
  border: 2px solid transparent;
  padding: 0;
  transition: border-color 0.3s ease;
  height: 2.375rem; /* 38px */
}

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

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

/* Кнопка сохранения */
.save-memory-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: auto;
  margin-block-end: 3.75rem; /* 60px */
  padding: 8px 16px;
  block-size: 55px;
}

.save-memory-button svg {
  color: var(--floppy-color);
  mix-blend-mode: difference;
  position: relative;
  z-index: 2;
}
/* Модальное окно */
.memory-dialog {
  /* Сброс стандартных браузерных настроек */
  all: unset;
  box-sizing: border-box;

  /* Основные стили */
  border: 2px solid black;
  inline-size: clamp(341px, 80vw, 353px);
  margin: auto;
  padding: 0px;
  overflow: hidden;
  background-color: white;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

/* Показ модального окна когда открыто */
.memory-dialog[open] {
  display: block;
}

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

.dialog-title {
  font-family: var(--accent-font-family);
  font-size: 0.875rem; /* 14px */
  text-transform: uppercase;
  inline-size: clamp(200px, 60vw, 234px);
  line-height: 1.5;
}

/* Размер иконки флоппи в модальном окне */
.memory-dialog svg {
  margin: auto;
}

.dialog-content {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: flex-start;
  margin: 30px;
}

.dialog-ok-button {
  inline-size: 18.3125rem; /* 293px */
  block-size: 2.375rem; /* 38px */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  margin-block-end: 1.875rem; /* 30px */
}

.dialog-ok-button .button__text {
  text-transform: uppercase;
}

/* Адаптивность для мобильных устройств */
@media (width <= 375px) {
  .card__image {
    max-block-size: 23.1875rem; /* 371px */
  }

  .header {
    margin-block: 6.25rem; /* 100px для мобильного */
  }

  .save-memory-button {
    block-size: 5.25rem; /* 84px */
    flex-direction: column;
  }

  .save-memory-button svg {
    inline-size: 1.75rem; /* 28px */
    block-size: 1.75rem; /* 28px */
  }

  .dialog-ok-button {
    inline-size: 16.3125rem; /* 261px */
    margin: 1.875rem 2.5rem;
  }

  .dialog-content {
    margin: 1.875rem 2.5rem; /* 30px сверху и снизу, 40px слева и справа */
  }
}
