/* ===== ПЕРЕМЕННЫЕ ТЕМ ===== */
:root {
  --cream: #FFF8E7;
  --choco: #2C1810;
  --accent: #E63946;
  --gold: #C9A84C;
  --gold-soft: #d8c286;

  --bg: var(--cream);
  --bg-alt: #fdf3d8;
  --text: var(--choco);
  --text-soft: #6a5445;
  --card-bg: #fffdf7;
  --card-shadow: rgba(44, 24, 16, 0.10);
  --card-shadow-hover: rgba(44, 24, 16, 0.20);
  --border: rgba(44, 24, 16, 0.08);

  --transition: 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  --radius: 20px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #1a120c;
  --bg-alt: #221812;
  --text: #f3e6d0;
  --text-soft: #b9a591;
  --card-bg: #251a12;
  --card-shadow: rgba(0, 0, 0, 0.35);
  --card-shadow-hover: rgba(0, 0, 0, 0.55);
  --border: rgba(243, 230, 208, 0.10);
  --gold: #d8bd6a;
}

/* ===== БАЗА ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 18px;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Playfair Display', Georgia, serif; line-height: 1.2; font-weight: 600; }

img { display: block; max-width: 100%; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 24px; }

.section-title {
  font-size: clamp(1.9rem, 5vw, 3rem);
  color: var(--text);
  margin-bottom: 0.4em;
}
.section-title--center { text-align: center; }
.section-lead {
  text-align: center;
  color: var(--text-soft);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}

/* ===== КНОПКИ ===== */
.btn {
  display: inline-block;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 30px;
  border-radius: 100px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition), border-color var(--transition);
  text-align: center;
}
.btn--sm { padding: 10px 22px; font-size: 0.95rem; }
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(230, 57, 70, 0.28);
}
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(230, 57, 70, 0.4); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--gold);
}
.btn--ghost:hover { background: var(--gold); color: #2C1810; transform: translateY(-3px); }

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ===== */
.theme-toggle {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 100;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px var(--card-shadow);
  transition: transform var(--transition), background var(--transition), color var(--transition);
}
.theme-toggle:hover { transform: scale(1.08) rotate(12deg); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 24px;
}
.hero__bg {
  position: absolute;
  inset: -8%;
  background-image: url('../img/hero.jpg');
  background-size: cover;
  background-position: center 40%;
  will-change: transform;
  z-index: 0;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,8,20,0.35) 0%, rgba(10,8,20,0.45) 55%, rgba(10,8,20,0.75) 100%);
  z-index: 1;
}
.hero__content { position: relative; z-index: 2; max-width: 780px; color: #fff; }
.hero__eyebrow {
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--gold-soft);
  margin-bottom: 1rem;
}
.hero__title {
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 30px rgba(0,0,0,0.5);
  margin-bottom: 1.2rem;
}
.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: rgba(255,255,255,0.9);
  max-width: 540px;
  margin: 0 auto 2rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.hero__cta { font-size: 1.1rem; padding: 16px 40px; }
.hero__scroll {
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.8);
  animation: bounce 2.2s infinite ease-in-out;
}
@keyframes bounce { 0%,100%{ transform: translate(-50%,0);} 50%{ transform: translate(-50%,10px);} }

/* ===== ЗНАКОМСТВО ===== */
.about { padding: 100px 0; background: var(--bg); }
.about__inner {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 60px;
  align-items: center;
}
.about__portrait img {
  width: 260px; height: 260px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 14px 40px var(--card-shadow-hover);
  border: 5px solid var(--card-bg);
}
.about__text p { color: var(--text-soft); margin-bottom: 1rem; font-size: 1.12rem; }
.about__text p:first-of-type { color: var(--text); }

/* ===== КНИГИ ===== */
.books { padding: 100px 0; background: var(--bg-alt); transition: background var(--transition); }
.books__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 36px;
}
.book-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.book-card:hover { transform: translateY(-10px); box-shadow: 0 22px 50px var(--card-shadow-hover); }
.book-card__cover { aspect-ratio: 1 / 1; overflow: hidden; background: var(--bg-alt); }
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.22,0.61,0.36,1); }
.book-card:hover .book-card__cover img { transform: scale(1.05); }
.book-card__body { padding: 28px; display: flex; flex-direction: column; flex: 1; }
.book-card__label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.book-card__title { font-size: 1.7rem; color: var(--text); margin-bottom: 0.7rem; }
.book-card__desc { color: var(--text-soft); font-size: 1.02rem; flex: 1; margin-bottom: 1.5rem; }
.book-card__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.audio-player {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  animation: fadeSlide var(--transition);
}
.audio-player audio { width: 100%; height: 42px; }
.audio-player__meta { display: block; margin-top: 8px; font-size: 0.85rem; color: var(--text-soft); }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; transform: translateY(0);} }

/* ===== ГАЛЕРЕЯ ===== */
.gallery { padding: 100px 0; background: var(--bg); }
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.gallery__item {
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--bg-alt);
  box-shadow: 0 6px 18px var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.22,0.61,0.36,1); }
.gallery__item:hover { transform: translateY(-5px); box-shadow: 0 14px 32px var(--card-shadow-hover); }
.gallery__item:hover img { transform: scale(1.08); }

/* ===== ГЕРОИ ===== */
.heroes { padding: 100px 0; background: var(--bg-alt); transition: background var(--transition); }
.heroes__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.hero-card {
  text-align: center;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: 0 8px 24px var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.hero-card:hover { transform: translateY(-8px); box-shadow: 0 18px 40px var(--card-shadow-hover); }
.hero-card__img {
  width: 130px; height: 130px;
  margin: 0 auto 18px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--gold-soft);
  box-shadow: 0 6px 18px var(--card-shadow);
}
.hero-card__img img { width: 100%; height: 100%; object-fit: cover; }
.hero-card h3 { font-size: 1.3rem; color: var(--text); margin-bottom: 0.4rem; }
.hero-card p { font-size: 0.95rem; color: var(--text-soft); line-height: 1.5; }

/* ===== ПОДВАЛ ===== */
.footer { padding: 70px 0 60px; background: var(--bg); text-align: center; border-top: 1px solid var(--border); }
.footer__mark { margin-bottom: 18px; display: flex; justify-content: center; }
.footer__text { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--text); font-style: italic; }
.footer__year { color: var(--text-soft); margin-top: 6px; font-size: 0.95rem; }

/* ===== LIGHTBOX ===== */
.lightbox[hidden] { display: none; }
.audio-player[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 8, 6, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: zoomIn 0.35s cubic-bezier(0.22,0.61,0.36,1);
}
@keyframes zoomIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.lightbox__close {
  position: absolute;
  top: 22px; right: 30px;
  background: none; border: none;
  color: #fff; font-size: 2.6rem;
  cursor: pointer; line-height: 1;
  transition: transform var(--transition);
}
.lightbox__close:hover { transform: scale(1.15) rotate(90deg); }
.lightbox__nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 54px; height: 54px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--transition), transform var(--transition);
}
.lightbox__nav:hover { background: rgba(255,255,255,0.25); }
.lightbox__nav--prev { left: 24px; }
.lightbox__nav--next { right: 24px; }

/* ===== АНИМАЦИЯ ПОЯВЛЕНИЯ ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22,0.61,0.36,1), transform 0.7s cubic-bezier(0.22,0.61,0.36,1);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ===== АДАПТИВ ===== */
@media (max-width: 860px) {
  .about__inner { grid-template-columns: 1fr; text-align: center; gap: 32px; justify-items: center; }
  .heroes__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .about, .books, .gallery, .heroes { padding: 70px 0; }
  .books__grid { grid-template-columns: 1fr; gap: 28px; }
  .gallery__grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .theme-toggle { top: 14px; right: 14px; width: 42px; height: 42px; }
  .lightbox__nav { width: 44px; height: 44px; font-size: 1.6rem; }
  .lightbox__nav--prev { left: 10px; }
  .lightbox__nav--next { right: 10px; }
  .lightbox { padding: 20px; }
}

/* Уважение к настройкам доступности */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
