/*
 * Открытые чтения Лампы (/lampa-open/).
 * Спокойная версия в стиле lampa-book-club: бумага, чернила, оранжевые кнопки,
 * без теней. Мобильная вёрстка по умолчанию, десктоп — от 900px.
 */

:root {
  --orange: #FFAB38;
  --orange-hover: #F59A1C;
  --green: #5AA052;
  --green-hover: #4E9047;
  --blue: #0C89DA;
  --coral: #FF5457;
  --night: #1F3366;
  --cream: #F8F4EC;
  --paper-2: #EFE8DA;
  --ink: #122A33;
  --muted: #3D5058;
  --white: #FFFFFF;
  --black: #000000;

  --font-display: 'Dela Gothic One', 'Arial Black', sans-serif;
  --font-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 14px;
  --container: 1200px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 400; line-height: 1.2; }
p, figure { margin: 0; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 24px;
  border: 0; border-radius: var(--radius);
  font: 700 17px/1.2 var(--font-body); color: var(--ink);
  text-decoration: none; text-align: center; cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.btn--primary { background: var(--orange); }
.btn--primary:hover { background: var(--orange-hover); }
.btn--whatsapp { background: var(--green); }
.btn--whatsapp:hover { background: var(--green-hover); }
.btn:active { transform: scale(.98); }
.btn--block { display: flex; width: 100%; }

/* Оранжевая подпись поверх фото и видео */
.plaque {
  position: absolute; left: 12px; bottom: 12px;
  padding: 6px 12px; border-radius: 10px;
  background: var(--orange); color: var(--ink);
  font-size: 13px; font-weight: 700; line-height: 1.3;
}

/* ---------- Шапка ---------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--cream); border-bottom: 1px solid var(--ink);
}
.site-header__inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo__icon { width: 32px; height: 32px; }
.logo__word { width: auto; height: 16px; }
.site-header__link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.site-header__link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Первый экран ---------- */

.hero { padding: 36px 0 48px; }
.hero__grid { display: grid; gap: 28px; }
.hero__text { display: flex; flex-direction: column; gap: 20px; }
.hero__title { font-size: 36px; line-height: 1.15; }
.hero__lead { font-size: 17px; line-height: 1.55; color: var(--muted); }
.hero__cta { display: flex; flex-direction: column; gap: 10px; }
.hero__free { font-size: 14px; font-weight: 600; text-align: center; }

.media-frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 16px; background: var(--paper-2);
}
.media-frame video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Секции ---------- */

.section { padding: 48px 0; }
.section--tone { background: var(--paper-2); }
.section__title { font-size: 26px; }
.section__lead { margin-top: 10px; font-size: 16px; line-height: 1.55; color: var(--muted); }

/* ---------- Группы ---------- */

.groups { display: grid; gap: 14px; margin-top: 24px; }
.group {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 16px; padding: 18px;
}
.group__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.group__age { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.group__time { font-size: 14px; color: var(--muted); text-align: right; line-height: 1.5; }
.group__time b { color: var(--ink); font-weight: 600; }
.group__book { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.group__book strong { font-size: 22px; line-height: 1.25; }
.group__book span { font-size: 15px; color: var(--muted); }
.group .btn { min-height: 48px; font-size: 16px; border-radius: 12px; }

/* ---------- Как проходят чтения ---------- */

.host { display: flex; flex-direction: column; gap: 20px; }
.host__photo { position: relative; width: 200px; }
.host__photo img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; background: var(--paper-2); }
.plaque--name { display: none; }
.plaque--name strong, .host__name strong { display: block; }
.host__name { display: flex; flex-direction: column; gap: 2px; }
.host__name strong { font-size: 18px; }
.host__name span { font-size: 15px; color: var(--muted); }
.host__text { display: flex; flex-direction: column; gap: 20px; }
.host__text p { font-size: 16px; line-height: 1.6; }
.host__text .btn { width: 100%; }

/* ---------- Подвал ---------- */

.site-footer { background: var(--black); color: var(--cream); padding: 40px 0 32px; }
.site-footer a { color: var(--cream); }
.site-footer__top { display: flex; flex-direction: column; gap: 24px; }
.site-footer__logo { display: flex; align-items: center; gap: 12px; align-self: flex-start; text-decoration: none; }
.site-footer__logo img:first-child { width: 40px; height: 40px; }
.site-footer__logo img:last-child { width: auto; height: 20px; }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; font-size: 15px; }
.footer-nav a { padding: 10px 0; text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.social { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.social__links { display: flex; flex-wrap: wrap; gap: 8px; }
.social__links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--cream); border-radius: 12px;
  font-weight: 600; text-decoration: none;
}
.social__links a:hover { background: rgba(248, 244, 236, .12); }
.site-footer__bottom {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--cream); font-size: 13px;
}
.site-footer__bottom a { padding: 6px 0; }

/* ---------- Форма заявки (диалог) ---------- */

.lead-dialog {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%;
  max-height: 100dvh; background: transparent; color: var(--ink);
}
.lead-dialog::backdrop { background: rgba(18, 42, 51, .55); }
.lead-dialog[open] { animation: sheet-in .25s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.lead {
  position: relative; background: var(--cream);
  border-radius: 20px 20px 0 0; overflow: hidden auto; max-height: 100dvh;
}
.lead__close {
  position: absolute; top: 10px; right: 8px; z-index: 1;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--cream); cursor: pointer;
}

.lead__group {
  background: var(--night); color: var(--cream);
  padding: 14px 16px 22px; display: flex; flex-direction: column; gap: 14px;
}
.lead__grip { width: 40px; height: 4px; border-radius: 2px; background: var(--cream); opacity: .5; margin: 0 auto; }
.lead__eyebrow {
  padding-right: 44px;
  font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--orange);
}
.lead__eyebrow br { display: none; }
.lead__title { font-size: 26px; line-height: 1.15; }
.lead__info {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: 14px; background: rgba(248, 244, 236, .1); font-size: 15px;
}
.lead__info > div { display: flex; align-items: flex-start; gap: 10px; }
.lead__info svg { flex: 0 0 20px; margin-top: 1px; color: var(--orange); }

.lead__body { padding: 22px 16px 28px; }

.lead-form { display: flex; flex-direction: column; gap: 14px; }
.lead-form__row { display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input {
  width: 100%; min-height: 50px; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 12px; background: var(--white);
  font: 500 16px var(--font-body); color: var(--ink);
}
.field input::placeholder { color: #6B7C84; }
.field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field input[aria-invalid="true"] { border-color: var(--coral); border-width: 2px; }

.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 4px; font-size: 13px; line-height: 1.5; cursor: pointer; }
.consent input { width: 20px; height: 20px; margin: 0; flex: 0 0 20px; accent-color: var(--night); }

.lead-form__error {
  font-size: 13px; line-height: 1.4; color: var(--ink);
  background: #FFE3E3; border: 1.5px solid var(--coral); border-radius: 10px; padding: 10px 12px;
}
.lead-form .btn { min-height: 54px; margin-top: 4px; }

.lead-done { display: flex; flex-direction: column; gap: 12px; }
.lead-done__badge {
  align-self: flex-start; background: var(--paper-2);
  border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 700;
}
.lead-done strong { font-size: 18px; line-height: 1.3; }
.lead-done p { font-size: 15px; color: var(--muted); }
.lead-done__back {
  align-self: center; min-height: 44px; padding: 0 8px; display: flex; align-items: center;
  font: 600 14px var(--font-body); color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer;
}

/* ---------- Согласие на cookie ---------- */

.cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--ink); color: var(--cream);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px;
  font-size: 13px; line-height: 1.4;
}
.cookie p { flex: 1 1 260px; }
.cookie a { color: var(--cream); }
.cookie__actions { display: flex; gap: 8px; }
.cookie__actions button {
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px;
  font: 700 14px var(--font-body); cursor: pointer;
}
.cookie__accept { background: var(--orange); color: var(--ink); }
.cookie__accept:hover { background: var(--orange-hover); }
.cookie__decline { background: transparent; color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Десктоп
   ========================================================================== */

@media (min-width: 900px) {
  :root { --gutter: 24px; }

  .site-header__inner { min-height: 72px; }
  .logo { gap: 12px; }
  .logo__icon { width: 40px; height: 40px; }
  .logo__word { height: 20px; }
  .site-header__link { font-size: 16px; }

  .hero { padding: 72px 0 80px; }
  .hero__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; align-items: center; }
  .hero__text { gap: 24px; }
  .hero__title { font-size: 56px; line-height: 1.12; }
  .hero__lead { font-size: 19px; max-width: 520px; }
  .hero__cta { align-items: flex-start; gap: 12px; }
  .hero__free { font-size: 19px; font-weight: 400; line-height: 1.55; color: var(--muted); text-align: left; }
  .hero .btn { padding: 0 36px; }
  .plaque { left: 16px; bottom: 16px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }

  .section { padding: 72px 0; }
  .section__title { font-size: 36px; }
  .section__lead { margin-top: 12px; font-size: 18px; }

  .groups { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 32px; }
  .group { padding: 24px; gap: 18px; }
  .group__age { font-size: 26px; }
  .group__time { font-size: 15px; }
  .group__book strong { font-size: 24px; }
  .group__book span { font-size: 16px; }
  .group .btn { min-height: 52px; }

  .host {
    display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    grid-template-areas: "photo title" "photo text"; grid-template-rows: auto 1fr;
    column-gap: 48px; row-gap: 20px; align-items: start;
  }
  .host__title { grid-area: title; align-self: end; }
  .host__photo { grid-area: photo; width: auto; }
  .host__text { grid-area: text; }
  .host__name { display: none; }
  .plaque--name { display: flex; flex-direction: column; position: static; margin-top: 12px; padding: 10px 16px; background: var(--white); }
  .plaque--name span { color: var(--muted); }
  .plaque--name strong { font-size: 18px; }
  .plaque--name span { font-size: 14px; font-weight: 500; }
  .host__text p { font-size: 18px; }
  .host__text .btn { width: auto; align-self: flex-start; padding: 0 32px; }

  .site-footer { padding: 48px 0 36px; }
  .site-footer__top { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 40px; }
  .site-footer__logo { align-self: center; }
  .site-footer__logo img:first-child { width: 44px; height: 44px; }
  .site-footer__logo img:last-child { height: 22px; }
  .footer-nav { display: flex; flex-wrap: wrap; gap: 0 28px; font-size: 16px; }
  .social { flex-direction: row; align-items: center; gap: 12px; }
  .site-footer__bottom { flex-direction: row; gap: 28px; margin-top: 32px; padding-top: 20px; }

  .lead-dialog { margin: auto; width: calc(100% - 48px); max-width: 820px; }
  .lead-dialog[open] { animation-name: dialog-in; }
  @keyframes dialog-in { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
  .lead {
    display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    border-radius: 20px; max-height: calc(100dvh - 48px);
  }
  .lead__close { top: 8px; color: var(--ink); }
  .lead__close:hover { background: var(--paper-2); }
  .lead__grip { display: none; }
  .lead__group { padding: 36px 32px; }
  .lead__eyebrow { padding-right: 0; }
  .lead__eyebrow br { display: inline; }
  .lead__title { font-size: 32px; }
  .lead__body { padding: 40px 32px 32px; }
  .lead-form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-done { padding-top: 12px; }
  .lead-done strong { font-size: 20px; }
  .lead-done p { font-size: 16px; }

  .cookie { padding-top: 12px; padding-bottom: 12px; font-size: 14px; }
  .cookie p { flex: 0 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Пока content.js грузит дату, тему и книги — прячем запасной текст (см. index.html). */
.oc-loading [data-oc] { visibility: hidden; }

/* Заголовок и подзаголовок блока групп пустые в админке — карточки без лишнего отступа сверху. */
[data-oc="heading"][hidden] + [data-oc="subheading"][hidden] + .groups { margin-top: 0; }
