/* === Сброс и базовые стили */
* {
  margin: 0; padding: 0; box-sizing: border-box;
}
body {
  font-family: 'Georgia', serif;
  min-height: 100vh;
  background-color: #d4c8a8; /* светло-бежевый теплый фон */
  background-image: url('https://www.transparenttextures.com/patterns/asfalt-light.png');
  background-repeat: repeat;
  background-blend-mode: multiply;
  color: #443d2e;
  user-select: none;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}
/* Мраморный полупрозрачный фон */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
  background-image: url('https://cdn.pixabay.com/photo/2017/08/30/12/45/marble-2698112_960_720.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  opacity: 0.15;
  pointer-events: none;
  filter: brightness(1) contrast(0.85);
  animation: slowPulse 20s ease-in-out infinite;
}
@keyframes slowPulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.22; }
}
/* Плавающие книги на фоне */
#backgroundWrapper {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.floating-book {
  position: absolute;
  background-image: url('https://cdn-icons-png.flaticon.com/512/29/29302.png');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.65;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
  animation-name: floatBooks;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  will-change: transform, opacity;
  transition: filter 0.3s ease;
}
.floating-book:hover {
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  opacity: 0.9;
}
@keyframes floatBooks {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.65; }
  50% { transform: translateY(-18px) translateX(12px) rotate(8deg); opacity: 1; }
  100% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.65; }
}
/* Художественные иконки кисточек, книг и красок */
#artToolsWrapper {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.art-tool-icon {
  position: absolute;
  width: 48px;
  height: 48px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.3;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.35));
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  will-change: transform, opacity;
  user-select: none;
  transition: filter 0.3s ease, opacity 0.3s ease;
}
.art-tool-icon:hover {
  opacity: 0.6;
  filter: drop-shadow(0 0 14px rgba(0,0,0,0.6));
}
@keyframes floatRotate {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.3; }
  50% { transform: translateY(-14px) translateX(12px) rotate(10deg); opacity: 0.6; }
  100% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.3; }
}
/* === Навигация и header === */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(70, 58, 37, 0.95);
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  gap: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.38);
  user-select: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'Georgia', serif;
}
header button {
  background: #a98c53;
  border: 2.5px solid transparent;
  padding: 14px 36px;
  border-radius: 14px;
  color: #3b2f10;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.38);
  transition: background-color 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease, transform 0.3s ease;
  user-select: none;
}
header button:hover {
  background-color: #dfc97b;
  color: #4d411e;
  box-shadow: 0 12px 28px rgba(0,0,0,0.65);
  border-color: #c1a854;
  transform: translateY(-3px);
  outline-offset: 3px;
}
header button.active {
  background-color: #e8d382;
  border-color: #ac9b5a;
  color: #3d2f0f;
  box-shadow: 0 16px 36px rgba(0,0,0,0.7);
  animation: jump 0.6s ease forwards;
}
@keyframes jump {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
/* === Общие стили страниц === */
main {
  max-width: 1140px;
  margin: 50px auto 100px auto;
  padding: 0 24px;
  position: relative;
  z-index: 10;
  min-height: 760px;
  user-select: text;
}
.page {
  background: rgba(255 255 255 / 0.96);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  padding: 50px 60px 70px;
  color: #4a412f;
  font-size: 1.2rem;
  line-height: 1.58;
  display: none;
  min-height: 740px;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.page.active {
  display: block;
  animation: fadeSlideIn 0.62s forwards cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
/* === Главная (welcome) страница === */
#home img {
  max-width: 370px;
  width: 300%;
  display: block;
  margin: 0 auto 50px;
  border-radius: 26px;
  box-shadow: 0 0 44px rgba(210 180 130 / 0.45);
  transition: transform 0.45s ease, filter 0.35s ease;
  cursor: default;
  user-select: none;
}
#home img:hover {
  transform: scale(1.06) translateY(-6px);
  filter: drop-shadow(0 0 36px #d9c67c);
}
#home p {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.017em;
  color: #5e5432;
}
/* === Иллюстрации контейнер с лесенкой === */
.illustrations-container {
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 36px 34px;
  padding-left: 60px; /* Отступ слева под лесенку */
  user-select: none;
  justify-content: start;
}
/* Обёртка для каждой иллюстрации + описания */
.illustration-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 240px;
}
/* Описание под иллюстрацией */
.illustration-desc {
  margin-top: 12px;
  font-size: 1rem;
  font-family: 'Georgia', serif;
  color: #5e5432;
  text-align: center;
  user-select: text;
  line-height: 1.3;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}
/* Автор под иллюстрацией */
.illustration-author {
  font-size: 0.9rem;
  color: #7a6f3a;
  margin-top: 4px;
  font-style: italic;
  font-family: 'Georgia', serif;
  user-select: text;
}
/* Иллюстрации стили с багетом */
.illustration {
  width: 240px;
  height: 165px;
  border-radius: 26px;
  border: 6px solid #bfa94a;
  box-shadow:
    0 14px 32px rgba(0,0,0,0.38),
    inset 0 0 18px #fff8cc;
  background: white;
  transition:
    transform 0.44s ease,
    box-shadow 0.44s ease,
    border-color 0.44s ease,
    filter 0.34s ease;
  cursor: pointer;
  position: relative;
  z-index: 15;
  filter: drop-shadow(0 5px 14px rgba(0,0,0,0.2));
}
/* === Модальное окно === */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(27, 27, 27, 0.88);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  padding: 48px;
  z-index: 3000;
  user-select: text;
  animation: fadeInBg 0.36s ease forwards;
}
.modal.active {
  display: flex;
}
@keyframes fadeInBg {
  from {opacity: 0;}
  to {opacity: 1;}
}
.modal-content {
  background: #f9f6ec;
  border-radius: 28px;
  max-width: 90vw;
  max-height: 90vh;
  padding: 52px 56px 64px 56px;
  box-shadow: 0 0 72px rgb(180 161 71 / 0.65);
  overflow-y: auto;
  color: #554a29;
  font-family: 'Georgia', serif;
  text-align: center;
  position: relative;
  user-select: text;
  border: 8px solid #bbad59;
  filter: drop-shadow(0 0 26px #c7ba6c);
  transition: transform 0.35s ease;
}
.modal-content img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 26px;
  box-shadow: 0 0 56px rgba(0,0,0,0.42);
  margin-bottom: 32px;
  transition: transform 0.3s ease;
  user-select: none;
}
.modal-content .description {
  font-size: 1.38rem;
  line-height: 1.65;
  padding: 0 16px;
  user-select: text;
  color: #433c27;
}
.modal-close {
  position: absolute;
  right: 38px;
  top: 34px;
  background: none;
  border: none;
  font-size: 42px;
  font-weight: 900;
  color: #bdad59cc;
  cursor: pointer;
  user-select: none;
  transition: color 0.4s ease, filter 0.4s ease;
  filter: drop-shadow(0 0 3px rgba(0,0,0,0.35));
  padding: 0;
  line-height: 1;
  border-radius: 6px;
}
.modal-close:hover,
.modal-close:focus {
  color: #d2c168;
  filter: drop-shadow(0 0 9px rgba(0,0,0,0.7));
  outline-offset: 6px;
  outline: 3px solid #c7ba6c;
}
/* === Заполнение пустоты внизу === */
main::after {
  content: "Искусство в деталях: наслаждайтесь каждой иллюстрацией! ✦";
  display: block;
  margin-top: 58px;
  color: #9e925b;
  font-style: italic;
  font-weight: 500;
  text-align: center;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  user-select: none;
  opacity: 0.7;
}
/* === Адаптивность === */
@media (max-width: 1160px) {
  .illustration:nth-child(4n + 2),
  .illustration:nth-child(4n + 3),
  .illustration:nth-child(4n + 4) {
    transform: none !important;
  }
  .illustrations-container {
    padding-left: 12px;
    gap: 28px 22px;
    justify-content: center;
    flex-wrap: wrap;
  }
}
@media (max-width: 700px) {
  header {
    flex-wrap: wrap;
    gap: 12px;
  }
  header button {
    flex-grow: 1;
    padding: 12px 24px;
    font-size: 1.05rem;
  }
  main {
    padding: 0 16px;
  }
  .page {
    padding: 38px 28px 48px;
    font-size: 1.1rem;
    min-height: auto;
  }
  #home p {
    font-size: 1.15rem;
  }
  .illustration {
    width: 140px;
    height: 100px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.21);
  }
  /* Убираем лесенку на маленьких экранах */
  .illustration:nth-child(4n + 2),
  .illustration:nth-child(4n + 3),
  .illustration:nth-child(4n + 4) {
    transform: none !important;
  }
  .illustrations-container {
    max-width: 100%;
    padding-left: 6px;
    gap: 22px 18px;
    justify-content: center;
  }
  .modal-content {
    max-width: 95vw;
    max-height: 85vh;
    padding: 26px 26px 38px;
  }
  .modal-content img {
    max-height: 56vh;
  }
}
