/* ============================================================
   Школа Великих Книг — курс для пар
   Art direction: мягкий фиолетовый, светлая бумага и живая рукопись.
   Выбранный пользователем знак пары-книги и исходная надпись № 2.
   ============================================================ */

:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.5vw, 3.5rem);

  /* Spacing (4px system) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Approved identity: soft purple + ivory + pale lavender */
  --color-bg: #fbf8f3;
  --color-surface: #fbf8f3;
  --color-surface-offset: #f1edf7;
  --color-divider: #dfd9eb;
  --color-border: oklch(from #2d2937 l c h / 0.16);
  --color-text: #2d2937;
  --color-text-muted: #655f70;
  --color-text-faint: #746c7c;
  --color-text-inverse: #fff9f3;
  --color-primary: #6e61a5;
  --color-primary-hover: #574b89;
  --color-primary-soft: #ebe5f5;

  /* Fonts */
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-display: var(--font-body);

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-md: 0 4px 12px rgb(55 44 78 / 8%);
  --shadow-lg: 0 12px 32px rgb(55 44 78 / 12%);

  /* Content widths */
  --content-narrow: 680px;
  --content-default: 960px;
}

.container {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--content-narrow);
}

/* ---------- Header ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding-block: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--text-base);
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
}

.brand__wordmark {
  width: 182px;
  height: auto;
}

.header__nav {
  display: flex;
  gap: var(--space-4);
  margin-inline-start: auto;
}

.header__nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.header__nav a:hover {
  color: var(--color-primary);
}

@media (max-width: 1099px) {
  .header__nav {
    display: none;
  }
  .header__inner {
    justify-content: space-between;
    gap: var(--space-3);
  }
  .brand {
    font-size: var(--text-sm);
  }
  .brand__mark {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 420px) {
  .header .container {
    padding-inline: var(--space-4);
  }
  .brand__wordmark {
    width: 146px;
  }
  .brand__mark {
    width: 30px;
    height: 30px;
  }
  .header .btn--small {
    padding-inline: 0.75em;
    font-size: 12px;
  }
}

@media (max-width: 350px) {
  .brand__wordmark { width: 122px; }
  .brand { gap: 5px; }
  .header__inner { gap: 8px; }
  .header .container { padding-inline: 12px; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.7em 1.6em;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: var(--color-primary-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn--small {
  padding: 0.5em 1.2em;
  min-height: 40px;
  white-space: nowrap;
}

.btn--large {
  font-size: var(--text-base);
  padding: 0.9em 2em;
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(var(--space-12), 7vw, var(--space-20));
}

.hero__grid {
  display: grid;
  gap: var(--space-10);
  align-items: center;
}

@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: var(--space-16);
  }
}

.kicker {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-2xl);
  line-height: 1.18;
  margin-bottom: var(--space-5);
}

.hero__mark {
  width: 100px;
  height: auto;
  margin-block: var(--space-6) var(--space-5);
}

.hero__wordmark {
  display: block;
  width: 100%;
  max-width: 540px;
  height: auto;
}

.hero__lead {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 34ch;
  margin-bottom: var(--space-8);
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}

.hero__note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.hero__figure {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero__figure img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(var(--space-12), 7vw, var(--space-20));
}

.section--offset {
  background: var(--color-surface-offset);
}

.section__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  margin-bottom: var(--space-8);
}

.section__intro {
  color: var(--color-text-muted);
  margin: calc(-1 * var(--space-4)) 0 var(--space-8);
  max-width: 52ch;
}

.note {
  margin-top: var(--space-8);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-left: none;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  max-width: 60ch;
}

/* ---------- Motives (numbered rows) ---------- */

.motives {
  display: grid;
  gap: var(--space-8);
}

.motive {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-5);
  align-items: start;
}

.motive__num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary);
  opacity: 0.55;
  line-height: 1;
  padding-top: var(--space-1);
}

.motive__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.motive__body p {
  color: var(--color-text-muted);
}

@media (min-width: 900px) {
  .motives {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-10);
  }
}

/* ---------- Steps ---------- */

.steps {
  display: grid;
  gap: var(--space-8);
  counter-reset: steps;
  list-style: none;
}

.step {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-5);
  min-width: 0;
  counter-increment: steps;
}

.step__photo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: var(--space-6) 0 0;
  flex-shrink: 0;
}

.step__photo img {
  position: absolute;
  inset: 0;
  margin: auto;
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-xl);
}

.step__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.step__title::before {
  content: counter(steps) ". ";
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 500;
}

.step p {
  flex-grow: 1;
  color: var(--color-text-muted);
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-10);
  }
}

/* ---------- Wide quote ---------- */

.wide-quote {
  position: relative;
  height: clamp(360px, 60vh, 560px);
}

.wide-quote img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wide-quote__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(0.2 0.03 30 / 0.55);
  padding: var(--space-6);
}

.wide-quote blockquote {
  max-width: 30ch;
  color: var(--color-text-inverse);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.35;
  text-align: center;
}

/* ---------- Themes (definition rows) ---------- */

.themes {
  display: grid;
  gap: 0;
}

.theme {
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.theme:last-child {
  border-bottom: none;
}

.theme__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-lg);
}

.theme__desc {
  color: var(--color-text-muted);
}

@media (min-width: 800px) {
  .theme {
    grid-template-columns: minmax(220px, 0.9fr) 1.4fr;
    gap: var(--space-6);
    align-items: baseline;
  }
}

/* ---------- Two-column block ---------- */

.two-col {
  display: grid;
  gap: var(--space-12);
}

@media (min-width: 800px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
  }
}

.plain-list {
  list-style: none;
  display: grid;
  gap: var(--space-4);
}

.plain-list li {
  padding-left: var(--space-5);
  position: relative;
  color: var(--color-text-muted);
}

.plain-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  opacity: 0.6;
}

/* ---------- FAQ ---------- */

.faq {
  display: grid;
  gap: var(--space-3);
}

.faq__item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-5);
}

.faq__item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  min-height: 44px;
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

.faq__item summary::after {
  content: '+';
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-primary);
  flex-shrink: 0;
}

.faq__item[open] summary::after {
  content: '–';
}

.faq__item p {
  margin-top: var(--space-3);
  color: var(--color-text-muted);
}

/* ---------- Footer ---------- */

.reading-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-primary);
  font-size: var(--text-sm);
  text-underline-offset: 0.25em;
}

.reading-link:hover,
.book__citation:hover {
  color: var(--color-primary-hover);
}

.library__heading {
  max-width: 62ch;
  margin-bottom: var(--space-10);
}

.library__heading .section__title {
  margin-bottom: var(--space-5);
}

.library__intro,
.library__note {
  color: var(--color-text-muted);
}

.book-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--space-12);
}

.book {
  display: grid;
  grid-template-columns: var(--space-8) minmax(0, 1fr);
  gap: var(--space-4);
  padding-block: var(--space-8);
  border-top: 1px solid var(--color-divider);
  min-width: 0;
  max-width: none;
}

.book__number {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  padding-top: var(--space-1);
}

.book__author {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.book__covers {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  min-height: 168px;
  margin-bottom: var(--space-5);
}

.book__covers a {
  display: block;
  max-width: calc((100% - var(--space-3)) / 2);
}

.book__covers img {
  display: block;
  width: auto;
  height: 168px;
  max-width: 100%;
  object-fit: contain;
  object-position: left bottom;
  filter: drop-shadow(2px 5px 6px rgb(45 35 30 / 14%));
}

.book__covers a:hover img {
  filter: drop-shadow(2px 6px 8px rgb(45 35 30 / 23%));
}

.book__title {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: var(--space-4);
}

.book__about,
.book__purpose {
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

.book__about {
  margin-bottom: var(--space-3);
}

.book strong {
  font-weight: 600;
  color: var(--color-text);
}

.book__citation {
  display: inline;
  color: var(--color-primary);
  font-size: var(--text-sm);
  text-underline-offset: 0.2em;
}

.library__note {
  font-size: var(--text-sm);
  max-width: 74ch;
  margin-top: var(--space-6);
}

@media (min-width: 800px) {
  .book-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.footer {
  background: var(--color-primary);
  color: #fff;
}

.faq__item p + p {
  margin-top: var(--space-3);
}

.moderator {
  display: grid;
  gap: var(--space-8);
  align-items: center;
  margin: 0;
}

.moderator__portrait {
  width: min(100%, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  justify-self: center;
}

.moderator__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.moderator figcaption {
  min-width: 0;
}

.moderator__caption {
  max-width: 42ch;
  margin-bottom: var(--space-6);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--color-text);
}

.moderator__caption strong {
  font-weight: 600;
}

@media (min-width: 800px) {
  .moderator {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: var(--space-12);
  }
}

.contacts__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
}

.contacts__links a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding-block: var(--space-2);
  color: var(--color-primary);
  font-weight: 600;
  text-underline-offset: 0.3em;
}

.contacts__links a:hover {
  color: var(--color-primary-hover);
}

.footer__inner {
  display: grid;
  justify-items: center;
  padding: clamp(var(--space-6), 5vw, var(--space-12));
  color: #fff;
  text-align: center;
}

.footer__brand {
  font-size: var(--text-lg);
  color: #fff;
  max-width: 52ch;
  margin: 0;
}

.application-open {
  overflow: hidden;
}

.application-dialog {
  width: min(760px, calc(100% - 24px));
  height: min(820px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-divider);
  border-radius: 16px;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
}

.application-dialog[open] {
  display: flex;
  flex-direction: column;
}

.application-dialog::backdrop {
  background: rgb(24 19 40 / 0.65);
}

.application-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 12px 24px;
  border-bottom: 1px solid var(--color-divider);
}

.application-dialog__header h2 {
  font-size: var(--text-lg);
  margin: 0;
}

.application-dialog__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-primary);
  font-size: 30px;
  cursor: pointer;
}

.application-dialog__close:hover {
  background: rgb(110 97 165 / 0.1);
}

.application-dialog__frame {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: #fff;
}

.application-dialog__fallback {
  margin: 0;
  padding: 12px 20px;
  font-size: var(--text-sm);
  border-top: 1px solid var(--color-divider);
}

.application-dialog__fallback a {
  color: var(--color-primary);
  text-underline-offset: 3px;
}

.footer__asterisk {
  color: #fff;
}

.footer__note {
  font-size: calc(var(--text-xs) * 0.5);
  color: oklch(from #fff l c h / 0.92);
  max-width: 100%;
  margin: 0;
  text-align: right;
  justify-self: stretch;
}

.footer__source {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: oklch(from #fff l c h / 0.6);
  text-underline-offset: 3px;
}

.footer__source:hover,
.footer__source:focus-visible {
  text-decoration-color: #fff;
}

.footer__identity {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.footer__logo {
  width: 420px;
  max-width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
}
