/* =========================================================
   Тихие страницы — лендинг-дневник
   Тёплая бумага · узкая колонка · пометки на полях
   ========================================================= */

:root {
  /* палитра тёплой бумаги */
  --paper:        #ece3d6;   /* песочно-глиняный фон */
  --paper-deep:   #e3d8c7;   /* тень бумаги / второй план */
  --paper-card:   #f4ecdf;   /* светлый лист поверх бумаги */
  --ink:          #332c26;   /* мягкий тёмно-коричневый текст */
  --ink-soft:     #5c5047;   /* приглушённый текст */
  --ink-faint:    #8a7d70;   /* подписи, служебное */
  --terra:        #c0744f;   /* терракота — акцент */
  --terra-deep:   #a85d3b;   /* терракота для фокуса/hover */
  --terra-wash:   #e8d3c3;   /* мягкая терракотовая заливка */
  --rule:         #cdbfad;   /* линии */
  --hair:         rgba(51, 44, 38, 0.14);

  /* типографика */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand:  "Caveat", "Segoe Script", cursive;

  /* ритм */
  --col: 620px;            /* ширина страницы-колонки */
  --gutter: clamp(20px, 5vw, 56px);
  --flow: clamp(2.4rem, 6vw, 4.2rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- базовое ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--paper);
  /* очень мягкая «бумажная» неоднородность, без картинок */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(255,250,242,0.55), transparent 60%),
    radial-gradient(100% 60% at 50% 120%, rgba(203,191,173,0.35), transparent 55%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.06rem, 0.6vw + 1rem, 1.2rem);
  line-height: 1.72;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

h1, h2, h3 { font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }

p { margin: 0 0 1.15em; }

a { color: var(--terra-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }

em { font-style: italic; color: var(--terra-deep); }
strong { font-weight: 600; color: var(--ink); }

/* фокус — тёплый, заметный */
:focus-visible {
  outline: 2.5px solid var(--terra-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

#main:focus { outline: none; }

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

.skip-link {
  position: absolute; left: 16px; top: -60px;
  background: var(--ink); color: var(--paper-card);
  padding: 10px 18px; border-radius: 0 0 10px 10px;
  font-family: var(--sans); font-size: 0.95rem; text-decoration: none;
  z-index: 50; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0; color: var(--paper-card); }

/* ---------- раскладка: узкая колонка + поля для пометок ---------- */
.spread {
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sheet {
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin-inline: auto;
}

section { padding-block: var(--flow); }

/* ---------- шапка-подпись (не кнопка справа) ---------- */
.masthead {
  padding: clamp(22px, 4vw, 40px) var(--gutter) 0;
  text-align: center;
}
.masthead__inner {
  display: inline-block;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hair);
}
.masthead__mark {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.masthead__sub {
  margin: 2px 0 0;
  font-family: var(--hand);
  font-size: 1.35rem;
  color: var(--terra-deep);
  line-height: 1;
}

/* ---------- пометки на полях ---------- */
.margin-note {
  font-family: var(--hand);
  font-size: 1.5rem;
  line-height: 1.12;
  color: var(--terra-deep);
  position: absolute;
  top: var(--note-top, 2.4rem);
  width: 160px;
  opacity: 0.92;
  transform: rotate(-2.5deg);
  pointer-events: none;
}
.margin-note--right {
  left: calc(50% + var(--col) / 2 - var(--gutter) + 30px);
  text-align: left;
}
.margin-note--left {
  right: calc(50% + var(--col) / 2 - var(--gutter) + 30px);
  text-align: right;
  transform: rotate(2deg);
}
/* тонкая «скрепка»-штрих у пометки */
.margin-note::before {
  content: "";
  position: absolute;
  top: -14px;
  width: 26px; height: 2px;
  background: var(--terra);
  opacity: 0.6;
  border-radius: 2px;
}
.margin-note--right::before { left: 4px; transform: rotate(6deg); }
.margin-note--left::before  { right: 4px; transform: rotate(-6deg); }

/* ---------- заголовки секций и текст ---------- */
.section-title {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  margin-bottom: 0.9em;
  position: relative;
  padding-top: 0.5em;
}
.section-title::before {
  content: "";
  display: block;
  width: 46px; height: 2px;
  background: var(--terra);
  margin-bottom: 0.7em;
  border-radius: 2px;
}

.prose p { color: var(--ink-soft); }
.prose p:last-child { margin-bottom: 0; }
.section-intro { color: var(--ink-soft); margin-bottom: 2.2em; }

/* ---------- ЭКРАН 1 — открытие ---------- */
.opening { position: relative; padding-top: clamp(2.6rem, 7vw, 5rem); }
.sheet--opening { text-align: left; }

.dateline {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink-faint);
  margin-bottom: 1.6rem;
}
.dateline__day {
  color: var(--terra-deep);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.dateline--center { text-align: center; }

.hand--greeting {
  font-family: var(--hand);
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  color: var(--terra-deep);
  line-height: 1;
  margin-bottom: 0.5rem;
  transform: rotate(-1deg);
}

.opening__title {
  font-size: clamp(2.2rem, 6.5vw, 3.6rem);
  line-height: 1.08;
  font-weight: 500;
  margin-bottom: 0.7em;
  letter-spacing: -0.02em;
}

.opening__lead {
  font-size: clamp(1.08rem, 1.4vw, 1.24rem);
  color: var(--ink-soft);
  max-width: 54ch;
  margin-bottom: 1.8em;
}

.opening__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-bottom: 1.4rem;
}

.opening__whisper {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-faint);
  margin: 0;
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), box-shadow 0.25s var(--ease), color 0.25s var(--ease);
}
.btn--primary {
  background: var(--terra);
  color: #fff7ef;
  padding: 15px 30px;
  border-radius: 999px;
  box-shadow: 0 10px 24px -14px rgba(168, 93, 59, 0.9);
}
.btn--primary:hover { background: var(--terra-deep); color: #fff7ef; transform: translateY(-2px); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  padding: 15px 6px;
  border-radius: 8px;
}
.btn--ghost:hover { color: var(--terra-deep); }

.btn--full { width: 100%; padding: 17px 30px; margin-top: 0.4rem; }

/* ---------- ЭКРАН 2 — письмо ---------- */
.letter .prose p {
  font-size: clamp(1.08rem, 1.2vw, 1.22rem);
}
.letter .prose p:first-of-type {
  font-style: italic;
  color: var(--ink);
}

/* ---------- ЭКРАН 3 — записи дневника ---------- */
.chapters { background: var(--paper-deep); }
.chapters .section-title::before { background: var(--terra); }

.entries {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  counter-reset: entry;
}
.entry { margin-bottom: clamp(1.4rem, 3vw, 2.2rem); }
.entry:last-child { margin-bottom: 0; }

.entry__card {
  background: var(--paper-card);
  border: 1px solid var(--hair);
  border-radius: 22px 22px 22px 6px;
  padding: clamp(1.5rem, 4vw, 2.2rem) clamp(1.4rem, 4vw, 2.3rem);
  box-shadow: 0 18px 40px -30px rgba(51, 44, 38, 0.55);
  max-width: var(--col);
}
/* тонкая «нить сшивки» слева */
.entry__card::before {
  content: "";
  position: absolute;
  left: 14px; top: 20px; bottom: 20px;
  width: 1px;
  background: repeating-linear-gradient(to bottom, var(--rule) 0 5px, transparent 5px 11px);
  opacity: 0.8;
}
.entry__card { padding-left: clamp(2rem, 6vw, 3rem); }

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  font-family: var(--sans);
  margin: 0 0 0.6rem;
}
.entry__no {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--terra-deep);
}
.entry__mood {
  font-family: var(--hand);
  font-size: 1.2rem;
  color: var(--ink-faint);
}
.entry__title {
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  margin-bottom: 0.4em;
}
.entry__text { margin: 0; color: var(--ink-soft); }

/* ---------- ЭКРАН 4 — как устроены занятия ---------- */
.how__list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.6rem;
}
.how__item {
  padding-top: 1.4rem;
  border-top: 1px solid var(--hair);
}
.how__item:first-child { border-top: 0; padding-top: 0; }
.how__word {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--terra-deep);
  margin-bottom: 0.3em;
}
.how__item p { margin: 0; color: var(--ink-soft); }

/* ---------- ЭКРАН 5 — дисклеймер / забота ---------- */
.careline { padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.care {
  background: var(--terra-wash);
  border: 1.5px solid rgba(168, 93, 59, 0.4);
  border-left: 5px solid var(--terra);
  border-radius: 16px;
  padding: clamp(1.6rem, 4vw, 2.4rem) clamp(1.5rem, 4vw, 2.4rem);
  box-shadow: 0 16px 38px -28px rgba(168, 93, 59, 0.7);
}
.care__kicker {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--terra-deep);
  margin-bottom: 0.5rem;
}
.care__title {
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  margin-bottom: 0.7em;
}
.care__text { color: var(--ink); margin-bottom: 1em; }
.care__text:last-of-type { }
.care__line {
  font-family: var(--sans);
  font-size: 1.02rem;
  color: var(--ink);
  margin: 1.2em 0 0;
  padding-top: 1.1em;
  border-top: 1px solid rgba(168, 93, 59, 0.3);
}
.care__phone {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--terra-deep);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.care__phone:hover { color: var(--ink); text-decoration: underline; }

/* ---------- ЭКРАН 6 — аккордеон тревог ---------- */
.accordion { margin-top: 2rem; }
.worry {
  border-bottom: 1px solid var(--hair);
}
.worry:first-child { border-top: 1px solid var(--hair); }

.worry__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 1.15rem 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 500;
  color: var(--ink);
}
.worry__q::-webkit-details-marker { display: none; }
.worry__q:hover { color: var(--terra-deep); }

/* знак + / − рисуем сами, чтобы работал и без JS */
.worry__sign {
  position: relative;
  flex: 0 0 auto;
  width: 22px; height: 22px;
}
.worry__sign::before,
.worry__sign::after {
  content: "";
  position: absolute;
  background: var(--terra-deep);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.worry__sign::before { top: 10px; left: 2px; width: 18px; height: 2px; }
.worry__sign::after  { left: 10px; top: 2px; width: 2px; height: 18px; }
.worry[open] .worry__sign::after { transform: rotate(90deg); opacity: 0; }

.worry__a {
  padding: 0 0 1.3rem;
  color: var(--ink-soft);
  max-width: 60ch;
}
.worry__a p { margin: 0; }

/* мягкое раскрытие ответа (отключается в reduced-motion) */
.worry[open] .worry__a { animation: unfold 0.45s var(--ease); }
@keyframes unfold {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .worry[open] .worry__a { animation: none; }
}

/* ---------- ЭКРАН 7 — запись / форма ---------- */
.enroll { padding-block: clamp(3rem, 8vw, 5.5rem); }
.sheet--enroll {
  background: var(--paper-card);
  border: 1px solid var(--hair);
  border-radius: 26px;
  padding: clamp(1.8rem, 5vw, 3rem) clamp(1.5rem, 5vw, 3rem);
  box-shadow: 0 26px 60px -36px rgba(51, 44, 38, 0.6);
  text-align: center;
}
.enroll__title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  margin: 0.6rem auto 0.6em;
  max-width: 24ch;
}
.enroll__lead {
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 auto 1.8em;
}

.price {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 8px 14px;
  margin-bottom: 2rem;
  padding: 0.8rem 1.4rem;
  background: var(--terra-wash);
  border-radius: 16px;
}
.price__old {
  font-size: 1.1rem;
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: var(--terra);
}
.price__now {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 600;
  color: var(--terra-deep);
  line-height: 1;
}
.price__note {
  flex-basis: 100%;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* форма */
.form { text-align: left; max-width: 420px; margin: 0 auto; }
.field { margin-bottom: 1.1rem; }
.field__label {
  display: block;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.field__opt { font-weight: 400; color: var(--ink-faint); }
.field__input {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  padding: 13px 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
.field__input::placeholder { color: var(--ink-faint); opacity: 0.7; }
.field__input:focus {
  outline: none;
  border-color: var(--terra-deep);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(192, 116, 79, 0.2);
}
.field__input[aria-invalid="true"] {
  border-color: #b44a2e;
  background: #f7e7df;
}
.field__error {
  font-family: var(--sans);
  font-size: 0.86rem;
  color: #a33c22;
  margin: 0.4rem 0 0;
}

/* чекбокс */
.field--check { margin-top: 1.4rem; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--rule);
  border-radius: 7px;
  background: var(--paper);
  position: relative;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.check__box::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 6px; height: 11px;
  border: solid #fff7ef;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.2s var(--ease);
}
.check input:checked + .check__box {
  background: var(--terra);
  border-color: var(--terra);
}
.check input:checked + .check__box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check__box {
  outline: 2.5px solid var(--terra-deep);
  outline-offset: 3px;
}
.check a { font-weight: 600; }

.form__reassure {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-faint);
  text-align: center;
  margin: 1rem 0 0;
}

.form__status {
  margin: 1.6rem auto 0;
  max-width: 440px;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  padding: 1rem 1.3rem;
  border-radius: 14px;
  background: var(--terra-wash);
  border: 1px solid rgba(168, 93, 59, 0.35);
  color: var(--ink);
}
.form__status--error {
  background: #f3e2da;
  border-color: rgba(163, 60, 34, 0.4);
}

/* ---------- футер ---------- */
.colophon {
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--hair);
  text-align: center;
}
.colophon__mark {
  font-family: var(--serif);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 1rem;
  margin: 0 0 0.6rem;
}
.colophon__text {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-faint);
  max-width: 48ch;
  margin: 0 auto 1.3rem;
}
.colophon__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  justify-content: center;
  margin-bottom: 1.3rem;
}
.colophon__nav a {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 2px;
}
.colophon__nav a:hover { color: var(--terra-deep); border-color: var(--terra); }
.colophon__fine {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin: 0;
}

/* =========================================================
   Появление при скролле (прогрессивное улучшение)
   Контент виден всегда; классы-гейты добавляет JS только
   при поддержке и без prefers-reduced-motion.
   ========================================================= */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

.js .reveal-note {
  opacity: 0;
  transform: translateY(10px) rotate(-2.5deg);
  transition: opacity 0.9s var(--ease) 0.15s, transform 0.9s var(--ease) 0.15s;
}
.js .margin-note--left.reveal-note { transform: translateY(10px) rotate(2deg); }
.js .reveal-note.is-in { opacity: 0.92; }
.js .margin-note--right.reveal-note.is-in { transform: rotate(-2.5deg); }
.js .margin-note--left.reveal-note.is-in  { transform: rotate(2deg); }

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal-note {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* =========================================================
   Адаптив
   ========================================================= */

/* до ~1080px поля не вмещают пометки — убираем абсолют и
   показываем их как подписи под текстом */
@media (max-width: 1080px) {
  .margin-note {
    position: static;
    width: auto;
    display: block;
    margin: 1.4rem 0 0;
    transform: rotate(-1deg);
    font-size: 1.4rem;
    opacity: 0.95;
  }
  .margin-note--left { text-align: left; transform: rotate(-1deg); }
  .margin-note--right { text-align: left; }
  .margin-note::before {
    position: static;
    display: block;
    margin-bottom: 8px;
    transform: none !important;
  }
  .margin-note--left::before,
  .margin-note--right::before { margin-left: 0; }

  .js .reveal-note,
  .js .reveal-note.is-in {
    transform: rotate(-1deg) !important;
  }
}

@media (max-width: 560px) {
  :root { --gutter: 22px; }
  body { line-height: 1.68; }
  .opening__actions { gap: 12px; }
  .opening__actions .btn { width: 100%; }
  .btn--ghost { justify-content: flex-start; padding-left: 2px; }
  .masthead { text-align: left; }
  .masthead { padding-top: 20px; }
  .entry__card { border-radius: 18px 18px 18px 6px; }
  .price { width: 100%; }
}

/* на совсем маленьких — пометки чуть компактнее */
@media (max-width: 380px) {
  .margin-note { font-size: 1.25rem; }
  .hand--greeting { font-size: 1.8rem; }
}

/* печать */
@media print {
  body { background: #fff; color: #000; }
  .margin-note, .skip-link { display: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
