/* === Bezobrazov — paper / sepia / serif === */

:root {
  --paper:        #f3ead7;
  --paper-deep:   #ebdfc4;
  --ink:          #2c241b;
  --ink-soft:     #5a4d3e;
  --burgundy:     #7a3a3a;
  --rule:         #8a7a63;
  --max:          720px;
  --gap:          clamp(28px, 4vw, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Cormorant Garamond', 'Iowan Old Style', 'Charter', Georgia, serif;
  font-size: 19px;
  line-height: 1.62;
  font-feature-settings: "liga", "dlig", "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(122, 58, 58, 0.025), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(44, 36, 27, 0.04), transparent 50%);
  background-attachment: fixed;
  padding: 0 var(--gap) 60px;
  overflow-x: hidden;
}

/* paper grain */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.14 0 0 0 0 0.10 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.55;
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 1;
}
main, section, header, footer, nav { position: relative; z-index: 2; }

/* === Lang switcher === */
.langs {
  position: fixed;
  top: 22px; right: 24px;
  z-index: 10;
  font-family: 'GFS Didot', 'Cormorant Garamond', serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  background: var(--paper);
  padding: 6px 12px;
  border: 0.5px solid var(--rule);
}
.langs button {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  padding: 0 4px;
  letter-spacing: inherit;
  text-transform: uppercase;
}
.langs button.active {
  color: var(--burgundy);
  font-weight: 500;
}
.langs .sep { color: var(--rule); margin: 0 2px; }

/* === Lang visibility === */
[data-tr] { display: none; }
html[data-lang="ru"] [data-tr$="_ru"] { display: inline; }
html[data-lang="fr"] [data-tr$="_fr"] { display: inline; }
html[data-lang="en"] [data-tr$="_en"] { display: inline; }

html[data-lang="ru"] .title-ru,
html[data-lang="fr"] .title-fr,
html[data-lang="en"] .title-en { display: block; }
.title-ru, .title-fr, .title-en { display: none; }

/* === Preface (header) === */
.preface {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
  padding: 14vh 0 6vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  position: relative;
}
.preface .frame {
  border-top: 0.5px solid var(--rule);
  border-bottom: 0.5px solid var(--rule);
  padding: 28px 0;
  margin-bottom: 60px;
}
.opener-poplavski {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
}
.opener-attribution {
  margin-top: 12px;
  text-align: right;
  font-size: 13.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.title {
  font-family: 'GFS Didot', 'Cormorant Garamond', serif;
  font-size: clamp(56px, 10vw, 120px);
  font-weight: 400;
  letter-spacing: -0.01em;
  text-align: center;
  line-height: 0.95;
  color: var(--ink);
  margin: 32px 0 18px;
}
.subtitle {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15px;
  letter-spacing: 0.04em;
  margin-bottom: 60px;
}
.epigraph {
  text-align: center;
  font-size: 19px;
  font-style: italic;
  max-width: 540px;
  margin: 0 auto;
  color: var(--ink);
}
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--rule);
  font-size: 22px;
  animation: float 2.6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.5; }
  50%      { transform: translate(-50%, 6px); opacity: 1; }
}

/* === Chapters === */
.chapter {
  max-width: var(--max);
  margin: 14vh auto 0;
  padding-bottom: 8vh;
  position: relative;
}
.chapter-num {
  display: block;
  font-family: 'GFS Didot', serif;
  font-size: 96px;
  color: var(--burgundy);
  opacity: 0.18;
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: -28px;
}
.chapter h2 {
  font-family: 'GFS Didot', serif;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  letter-spacing: -0.005em;
  margin-bottom: 36px;
  color: var(--ink);
}
.chapter h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 0.5px;
  background: var(--rule);
  margin-top: 16px;
}

.prose p {
  margin: 0 0 22px;
  text-align: justify;
  hyphens: auto;
}
.prose p:first-letter {
  font-family: 'GFS Didot', serif;
  font-size: 1.2em;
  font-weight: 500;
}

/* === Extrait blockquote === */
.placeholder-note {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15px;
  margin-bottom: 28px;
  padding: 14px 18px;
  background: var(--paper-deep);
  border-left: 2px solid var(--burgundy);
}
.extrait {
  border-left: 0.5px solid var(--rule);
  padding: 18px 0 18px 28px;
  margin: 30px 0;
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
}
.extrait p { margin-bottom: 18px; }
.extrait cite {
  display: block;
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin-top: 14px;
}

/* link */
.lien {
  margin-top: 30px;
  text-align: center;
}
.lien a {
  color: var(--burgundy);
  text-decoration: none;
  font-style: italic;
  letter-spacing: 0.03em;
  border-bottom: 0.5px solid var(--burgundy);
  padding-bottom: 2px;
  transition: color 0.2s;
}
.lien a:hover { color: var(--ink); border-color: var(--ink); }

/* === Timeline === */
.timeline {
  list-style: none;
  margin-top: 18px;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 0.5px;
  background: var(--rule);
}
.timeline li {
  position: relative;
  padding: 14px 0 14px 36px;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 20px;
  align-items: baseline;
}
.timeline .dot {
  position: absolute;
  left: 1px;
  top: 22px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--burgundy);
}
.timeline .when {
  font-family: 'GFS Didot', serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--burgundy);
}
.timeline .what {
  font-size: 17px;
  font-style: italic;
  color: var(--ink);
}
@media (max-width: 600px) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* === Footer === */
footer {
  max-width: var(--max);
  margin: 14vh auto 0;
  padding: 32px 0 20px;
  border-top: 0.5px solid var(--rule);
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
}
footer p { margin-bottom: 10px; }
footer a {
  color: var(--burgundy);
  text-decoration: none;
  border-bottom: 0.5px solid transparent;
}
footer a:hover { border-color: var(--burgundy); }
footer .sep { color: var(--rule); margin: 0 8px; }
footer .meta { font-size: 12.5px; color: var(--rule); margin-top: 18px; }

/* === Spectacle (drawings) === */
.spectacle .spectacle-meta {
  text-align: center;
  font-family: 'GFS Didot', serif;
  font-size: 16px;
  letter-spacing: 0.18em;
  color: var(--burgundy);
  margin: -12px 0 32px;
  text-transform: uppercase;
}

.drawing {
  margin: 28px 0;
  text-align: center;
}
.drawing img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  filter: sepia(0.18) saturate(0.96) brightness(0.99);
  mix-blend-mode: multiply;
  background: var(--paper);
  box-shadow: 0 0 0 0.5px var(--rule), 0 12px 32px -16px rgba(44, 36, 27, 0.35);
  cursor: zoom-in;
  transition: transform 0.4s ease;
}
.drawing img:hover { transform: translateY(-2px); }

.drawing figcaption {
  margin-top: 14px;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.title-drawing img { max-width: 460px; }
.structure-drawing img { max-width: 580px; }

.actes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px 36px;
  margin: 50px 0 30px;
}
@media (max-width: 720px) {
  .actes { grid-template-columns: 1fr; }
}

.actes .acte { margin: 0; }
.actes .acte .drawing { margin: 0 0 14px; }
.actes .acte .drawing img {
  max-width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top center;
}
.actes .acte h3 {
  font-family: 'GFS Didot', serif;
  font-size: 21px;
  font-weight: 400;
  margin: 8px 0 4px;
  color: var(--burgundy);
  letter-spacing: 0.01em;
}
.actes .acte p {
  font-size: 15.5px;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* === Lightbox === */
.drawing img:active { transform: scale(0.99); }
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 11, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 4vh 4vw;
  cursor: zoom-out;
  animation: fadein 0.25s ease;
}
.lightbox img {
  max-width: 100%;
  max-height: 92vh;
  width: auto;
  height: auto;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7);
  background: var(--paper);
}
.lightbox-close {
  position: fixed;
  top: 22px;
  right: 32px;
  background: transparent;
  color: var(--paper);
  border: 0.5px solid rgba(243, 234, 215, 0.4);
  width: 38px;
  height: 38px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  font-family: 'GFS Didot', serif;
}
.lightbox-close:hover {
  background: rgba(243, 234, 215, 0.1);
  border-color: var(--paper);
}
@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* === Reveal animation (no GSAP, pure CSS) === */
.preface .frame,
.preface .title,
.preface .subtitle,
.preface .epigraph,
.chapter,
footer {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.is-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}
.preface .frame { transition-delay: 0.05s; }
.preface .title { transition-delay: 0.45s; }
.preface .subtitle { transition-delay: 0.95s; }
.preface .epigraph { transition-delay: 1.4s; }
