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

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

*/

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

/* Шапка */

.header {
  margin-inline: auto;
  margin-block-start: 100px;
  border: 2px solid #000;
  padding-inline: 14px;
  padding-block: clamp(120px, 7.6923rem + 1.0989vw, 130px);
  font-family: var(--accent-font, fantasy);
  text-align: center;
  text-transform: uppercase;
  background-color: #fff;
  inline-size: var(--container-width);
}

.header__logo {
  display: block;
  color: inherit;
  font-weight: 400;
  font-size: clamp(3.0625rem, 2.7104rem + 1.5023vw, 4.0625rem);
  font-variation-settings: normal;
  text-decoration: none;
}

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

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

.content {
  margin-inline: auto;
  margin-block-start: 96px;
  inline-size: var(--container-width);
}

.card-list {
  display: grid;
  gap: 50px;
}

.card {
  border: 2px solid #000;
  font-size: 18px;
  line-height: 21px; /* ~1.17 — как на макете */
  background-color: #fff;
}

.card__title {
  border-block-end: 2px solid #000;
  padding-inline: 10px;
  padding-block: 5px 6px;
  font-size: 18px;
  line-height: normal;
  font-variation-settings: 'wght' var(--accent-font-weight);
}

.card__image-wrapper {
  position: relative;
  border-block-end: 2px solid #000;
  overflow: hidden;
  inline-size: 100%;
  aspect-ratio: 1 / 1;
}

.card__image {
  display: block;
  object-fit: cover;
  inline-size: 100%;
  block-size: 100%;
}

/* Фильтры на изображениях карточек */
 
.filter-saturate {
  filter: saturate(150%);
}

.filter-brightness {
  filter: contrast(75%) brightness(110%);
}

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

.filter-saturate-contrast {
  filter: saturate(150%) contrast(110%);
}

.filter-sepia {
  filter: sepia(100%);
}

.filter-invert {
  filter: invert(100%) hue-rotate(180deg);
}

.filter-grayscale {
  filter: grayscale(50%);
}

.filter-blur {
  filter: blur(2px);
}

/* Лейбл </HTML> в правом верхнем углу картинки. */
.card__label {
  position: absolute;
  opacity: 0.5;
  color: #000;
  font-family: var(--accent-font, fantasy);
  font-weight: 400;
  font-size: 14px;
  line-height: 1;
  inset-block-start: clamp(20px, 1.0625rem + 1.5023vw, 25px);
  inset-inline-end: clamp(11px, 0.6875rem + 0.4225vw, 25px);
  mix-blend-mode: hard-light;
}

@supports (-webkit-text-stroke: 1px #fff) {
  .card__label {
    -webkit-text-stroke: 1px var(--label-stroke-color);
  }
}

/* Контентная часть карточки (текст + лайки) */
.card__content {
  display: grid;
  gap: 24px;
  padding: 25px;
}

.card__text {
  margin: 0;
}

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

.card__icon-button {
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  padding: 0;
  background-color: transparent;
  transition: border-color 0.3s ease;
  cursor: pointer;
  block-size: 41px;
  inline-size: 41px;
}

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

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

/* svg-иконка сердца */
.like-icon {
  transform-origin: center;
  inline-size: 100%;
  block-size: 100%;
}

.sparks {
  opacity: 0;
}

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

.button::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #000;
  transition: translate 0.5s ease-in-out;
  translate: -100% 0;
}

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

.button:focus {
  box-shadow: 2px 2px 0 #000;
  outline: none;
}

.card__like-button {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-inline: 35px;
  inline-size: 130px;
  block-size: 38px;
}

/* Кнопка «Сохранить на память» */

.content__save-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-inline: auto;
  margin-block: 50px 100px;
  padding-inline: 19px;
  padding-block: 15px;
}

.button__text {
  position: relative;
  z-index: 1;
  color: var(--button-text-color);
  mix-blend-mode: difference;
}

.save-button__icon {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  color: var(--button-text-color);
  inline-size: 21px;
  block-size: 21px;
  mix-blend-mode: difference;
}

/* Адаптив для узких экранов */

@media (width <= 375px) {
  .header {
    padding-block-end: clamp(110px, 6.875rem + 1.0989vw, 120px);
  }

  .content__save-button {
    flex-direction: column;
    gap: 8px;
  }

  .save-button__icon {
    inline-size: 28px;
    block-size: 28px;
  }
}

/* Диалоговое окно «Вставьте дискету» */
.content__dialog {
  display: none;
}

.content__dialog[open] {
  display: grid;
  border: 2px solid #000;
  padding-inline: 30px;
  padding-block: 30px;
  color: #000;
  font-family: var(--accent-font, fantasy);
  text-transform: uppercase;
  background-color: #fff;
  inline-size: clamp(341px, 21.3125rem + 0vw, 357px);
}

.dialog__form {
  display: grid;
  gap: 30px;
}

.dialog__top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
}

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

.dialog__text {
  font-size: 14px;
  line-height: 1.5;
}

.dialog__button {
  padding-block: 9px;
  text-transform: uppercase;
  inline-size: 100%;
}

.card__like-area:focus {
  box-shadow: 2px 2px 0 #000;
  outline: none;
}

.content__dialog::backdrop {
  opacity: 0.75;
  background-color: #000;
}
