/* ==========================================================================
   «Дворжики в интернете» — семейный архив
   Основной файл стилей
   Тёплая «архивная» палитра, акцент на читаемость длинных текстов
   ========================================================================== */

/* --- Переменные ---------------------------------------------------------- */
:root {
  /* Палитра: тёплая, «бумажная» */
  --bg:            #faf6f0;   /* кремовый фон */
  --bg-alt:        #f3ece1;   /* фон чередующихся секций */
  --surface:       #ffffff;   /* карточки */
  --text:          #2e2620;   /* основной текст (тёмно-коричневый) */
  --text-soft:     #6b5d50;   /* второстепенный текст */
  --accent:        #9c4a2f;   /* терракотовый акцент */
  --accent-dark:   #7a3822;   /* акцент при наведении */
  --accent-soft:   #c98a6b;   /* мягкий акцент */
  --border:        #e2d7c7;   /* границы */
  --shadow:        0 2px 12px rgba(46, 38, 32, 0.08);
  --shadow-lg:     0 8px 32px rgba(46, 38, 32, 0.14);

  /* Типографика */
  --font-head: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', 'PT Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Размеры */
  --maxw: 1140px;
  --maxw-text: 720px;
  --radius: 10px;
  --radius-lg: 16px;

  /* Анимации */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Сброс --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }

p { margin: 0 0 1.2em; }

/* --- Утилиты ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.text-col {
  max-width: var(--maxw-text);
  margin: 0 auto;
}

.section { padding: 72px 0; }
.section--alt { background: var(--bg-alt); }

.section__title {
  text-align: center;
  margin-bottom: 12px;
}
.section__subtitle {
  text-align: center;
  color: var(--text-soft);
  max-width: 640px;
  margin: 0 auto 48px;
  font-size: 1.05rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* --- Шапка и навигация --------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 16px rgba(46, 38, 32, 0.06);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}
.nav__brand:hover { color: var(--accent); }
.nav__brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.nav__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav__link:hover { background: var(--bg-alt); color: var(--accent); }
.nav__link.is-active { color: var(--accent); font-weight: 600; }

.nav__toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  position: relative;
}
.nav__toggle span,
.nav__toggle span::before,
.nav__toggle span::after {
  position: absolute;
  left: 50%; top: 50%;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transform: translate(-50%, -50%);
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.nav__toggle span::before { content: ''; transform: translate(-50%, -8px); }
.nav__toggle span::after  { content: ''; transform: translate(-50%, 8px); }
.nav__toggle[aria-expanded="true"] span { background: transparent; }
.nav__toggle[aria-expanded="true"] span::before { transform: translate(-50%, 0) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span::after  { transform: translate(-50%, 0) rotate(-45deg); }

/* --- Герой (главная) ----------------------------------------------------- */
.hero {
  position: relative;
  padding: 96px 0 88px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(250,246,240,0.6), rgba(250,246,240,0.95)),
    url('../img/d_fon_2.jpg') center/cover no-repeat;
  background-color: var(--bg-alt);
}
.hero__title {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}
.hero__lead {
  max-width: 680px;
  margin: 0 auto 32px;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-soft);
}
.hero__actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Кнопки -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
              color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(156, 74, 47, 0.28);
}
.btn--primary:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(156, 74, 47, 0.34);
}
.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-soft);
}
.btn--ghost:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* --- Сетка карточек ------------------------------------------------------ */
.grid {
  display: grid;
  gap: 28px;
}
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* --- Карточка раздела ---------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-alt);
}
.card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.card:hover .card__media img { transform: scale(1.05); }
/* Обложки журналов — портретная ориентация, заполняем карточку без полей */
.card__media--cover {
  aspect-ratio: 3 / 4;
  background: var(--bg-alt, #f4f1ec);
}
.card__media--cover img { object-fit: cover; padding: 0; }
.card__body { padding: 22px 24px 26px; flex: 1; display: flex; flex-direction: column; }
.card__title { font-size: 1.3rem; margin-bottom: 8px; }
.card__text { color: var(--text-soft); font-size: 0.96rem; margin-bottom: 16px; flex: 1; }
.card__meta {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-soft);
  font-weight: 600;
  margin-bottom: 10px;
}
.card__link {
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card__link::after {
  content: '→';
  transition: transform 0.25s var(--ease);
}
.card:hover .card__link::after { transform: translateX(4px); }

/* Карточка-история (без фото) */
.card--text .card__body { padding: 26px 26px 28px; }

/* --- Хлебные крошки ------------------------------------------------------ */
.breadcrumbs {
  padding: 20px 0 0;
  font-size: 0.88rem;
  color: var(--text-soft);
}
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span { margin: 0 8px; opacity: 0.5; }

/* --- Страница истории ---------------------------------------------------- */
.article {
  padding: 32px 0 80px;
}
.article__header {
  max-width: var(--maxw-text);
  margin: 0 auto 40px;
  text-align: center;
}
.article__title { margin-bottom: 14px; }
.article__meta {
  color: var(--text-soft);
  font-size: 0.95rem;
  font-style: italic;
}
.article__body {
  max-width: var(--maxw-text);
  margin: 0 auto;
  font-size: 1.08rem;
  line-height: 1.85;
}
.article__body p { margin-bottom: 1.4em; }

/* Стихи / цитаты */
.article__body blockquote,
.verse {
  margin: 1.8em 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--accent-soft);
  font-style: italic;
  color: var(--text-soft);
  white-space: pre-line;
}
.article__body blockquote p:last-child { margin-bottom: 0; }

/* Эпиграф в начале статьи */
.epigraph {
  max-width: 620px;
  margin: 0 auto 44px;
  padding: 0 0 0 24px;
  border-left: 3px solid var(--accent-soft);
  font-style: italic;
  color: var(--text-soft);
  text-align: left;
}
.epigraph p {
  margin-bottom: 0.6em;
  font-size: 1.02rem;
  line-height: 1.7;
}
.epigraph p:last-child { margin-bottom: 0; }
.epigraph__source {
  display: block;
  margin-top: 10px;
  font-size: 0.92rem;
  font-style: normal;
  text-align: right;
  color: var(--text-soft);
}
.epigraph__source::before { content: "— "; }

/* Фото внутри текста статьи */
.article__figure {
  margin: 28px 0 32px;
  text-align: center;
}
.article__figure img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(46, 38, 32, 0.12);
}
.article__figure figcaption {
  margin-top: 10px;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-soft);
}

/* Подпись автора */
.article__sign {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-style: italic;
  color: var(--text-soft);
  text-align: right;
}

/* Навигация в конце статьи */
.article__nav {
  max-width: var(--maxw-text);
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* --- Галерея ------------------------------------------------------------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 40px 0;
}
.gallery__item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: zoom-in;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.gallery__item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease), filter 0.3s var(--ease);
}
.gallery__item:hover img { transform: scale(1.06); filter: brightness(1.05); }

/* --- Лайтбокс ------------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(30, 24, 20, 0.94);
  padding: 40px 20px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.lightbox.is-open { display: flex; opacity: 1; }
.lightbox__img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 52px; height: 52px;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease);
}
.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255,255,255,0.25); }
.lightbox__close { top: 24px; right: 24px; }
.lightbox__nav--prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox__caption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  text-align: center;
  max-width: 80vw;
}

/* --- Журналы ------------------------------------------------------------- */
.journal-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.journal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.journal-card__cover {
  width: 96px;
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.journal-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}
.journal-card:hover .journal-card__cover img {
  transform: scale(1.04);
}
.journal-card__body { flex: 1; }
.journal-card__title { font-size: 1.1rem; margin-bottom: 4px; }
.journal-card__date { color: var(--text-soft); font-size: 0.88rem; margin-bottom: 12px; }

/* --- Видео --------------------------------------------------------------- */
.video-list {
  display: flex;
  flex-direction: column;
}
.video-row {
  display: grid;
  grid-template-columns: minmax(320px, 500px) 1fr;
  gap: 36px;
  align-items: start;
  padding: 36px 0;
}
.video-row__player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.video-row__player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-row__desc {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}
.video-row__text {
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--text);
}
.video-row__text p {
  margin-bottom: 12px;
}
.video-row__text p:last-child {
  margin-bottom: 0;
}
.video-row__date {
  text-align: right;
  font-size: 0.95rem;
  color: var(--text-soft);
  margin-top: 24px;
}
.video-divider {
  border: 0;
  border-bottom: 2px solid #5c7887;
  opacity: 0.75;
  margin: 0;
}
@media (max-width: 820px) {
  .video-row {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px 0;
  }
  .video-row__desc {
    min-height: auto;
  }
  .video-row__date {
    text-align: left;
    margin-top: 12px;
  }
}

/* --- Карточка Google Photos (Shared Album) ------------------------------- */
.gphotos-card-wrapper {
  display: flex;
  justify-content: center;
  margin: 36px 0;
}
.gphotos-card {
  display: block;
  width: 100%;
  max-width: 760px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60,64,67,0.12), 0 4px 8px rgba(60,64,67,0.06);
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.gphotos-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(60,64,67,0.18), 0 8px 24px rgba(60,64,67,0.1);
}
.gphotos-card__thumb {
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: #f1f3f4;
}
.gphotos-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.gphotos-card:hover .gphotos-card__thumb img {
  transform: scale(1.03);
}
.gphotos-card__info {
  padding: 16px 20px 20px;
}
.gphotos-card__title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  color: #0b57d0;
  margin-bottom: 6px;
}
.gphotos-card:hover .gphotos-card__title {
  text-decoration: underline;
}
.gphotos-card__subtitle {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  color: #5f6368;
}

/* --- Контакты ------------------------------------------------------------ */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 560px;
}
.contact-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.contact-list li:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.contact-list__icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-head);
}
.contact-list__label { font-weight: 600; }
.contact-list__value { color: var(--text-soft); font-size: 0.92rem; }

/* --- Подвал -------------------------------------------------------------- */
.site-footer {
  background: #2e2620;
  color: #d8cec2;
  padding: 48px 0 32px;
  margin-top: 0;
}
.site-footer a { color: #e8b89a; }
.site-footer a:hover { color: #fff; }
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}
.footer__title {
  font-family: var(--font-head);
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 12px;
}
.footer__text { font-size: 0.92rem; line-height: 1.7; opacity: 0.85; }
.footer__list { list-style: none; padding: 0; margin: 0; }
.footer__list li { margin-bottom: 8px; font-size: 0.92rem; }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- Анимации появления -------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- Адаптивность -------------------------------------------------------- */
@media (max-width: 900px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  /* 7 пунктов меню не помещаются в одну строку — уменьшаем отступы */
  .nav { gap: 16px; }
  .nav__link { padding: 8px 10px; font-size: 0.9rem; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .section { padding: 52px 0; }

  .nav__toggle { display: block; }
  .nav__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease), padding 0.35s var(--ease);
  }
  .nav__list.is-open { max-height: 420px; padding: 12px 8px; }
  .nav__link { padding: 12px 16px; font-size: 1rem; }

  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .hero { padding: 64px 0 56px; }
  .footer__grid { grid-template-columns: 1fr; gap: 28px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .lightbox__nav { width: 44px; height: 44px; }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
}

@media (max-width: 420px) {
  .gallery { grid-template-columns: 1fr; }
  .journal-card { flex-direction: column; }
  .journal-card__cover { width: 100%; aspect-ratio: 16/9; }
}

/* --- Печать -------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .hero__actions, .lightbox { display: none; }
  body { background: #fff; color: #000; }
  .article__body { max-width: none; }
}
