/* ===== Токены ===== */
:root {
  --paper: #f6f2ea;
  --paper-2: #efe9dd;
  --ink: #26221e;
  --ink-soft: #4a433c;
  --muted: #7a7066;
  --line: #ddd4c5;
  --accent: #3e5a4c;        /* приглушённый зелёный */
  --accent-ink: #f6f2ea;
  --accent-soft: #e3e8e2;

  --serif: "PT Serif", Georgia, "Times New Roman", serif;
  --sans: "PT Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --col: 44rem;             /* ширина текстовой колонки */
  --wide: 68rem;
  --gutter: clamp(1rem, 4vw, 2rem);
}

/* Тёмная тема: по настройке системы, если посетитель не выбрал светлую,
   или по явному выбору кнопкой (data-theme="dark" на <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1b19;
    --paper-2: #252220;
    --ink: #ebe5da;
    --ink-soft: #cfc7ba;
    --muted: #9a9084;
    --line: #3a3531;
    --accent: #9dbaa8;
    --accent-ink: #1d1b19;
    --accent-soft: #2a302c;
    --todo-bg: #5a4b10;
    --todo-ink: #fff2b3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1d1b19;
  --paper-2: #252220;
  --ink: #ebe5da;
  --ink-soft: #cfc7ba;
  --muted: #9a9084;
  --line: #3a3531;
  --accent: #9dbaa8;
  --accent-ink: #1d1b19;
  --accent-soft: #2a302c;
  --todo-bg: #5a4b10;
  --todo-ink: #fff2b3;
  color-scheme: dark;
}

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; }
/* Базовый размер: все размеры в rem масштабируются от него */
html { font-size: 106.25%; scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
@media (min-width: 52rem) { html { font-size: 112.5%; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-weight: 400; line-height: 1.25; margin: 0 0 0.6em; letter-spacing: -0.005em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.col  { max-width: var(--col); }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

/* ===== Шапка ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 4rem;
}
.brand { font-size: 1.1rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--muted); font-family: var(--sans); font-size: 0.85rem; margin-left: 0.5rem; }
.nav { display: flex; gap: 1.5rem; font-family: var(--sans); font-size: 0.95rem; }
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover { color: var(--accent); }

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: opacity .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--accent); }

/* Кнопка «Показать почту»: после нажатия заменяется ссылкой (js/mail.js) */
.mail-reveal { line-height: inherit; cursor: pointer; }
.mail-reveal[hidden] { display: none; }
.link-btn {
  padding: 0; border: 0; background: none;
  font: inherit; color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em;
}
.link-btn:hover { text-decoration-thickness: 2px; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Переключатель темы */
.theme-toggle {
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.btn--sm { padding: 0.45rem 1rem; font-size: 0.9rem; }

/* ===== Первый экран ===== */
.hero { padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem); }
.hero .wrap { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { margin-bottom: 0.4em; }
.hero .lead { font-size: 1.25rem; color: var(--ink-soft); max-width: 34rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero .note { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); margin-top: 1rem; }

.portrait {
  width: min(100%, 20rem);
  aspect-ratio: 4 / 5;
  border-radius: 10rem 10rem 0.5rem 0.5rem;   /* арка */
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
  position: relative;
  justify-self: center;
}
/* верх кадра: лицо в арке, водяной знак b17 внизу обрезается */
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.portrait .initials {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 4rem; color: var(--muted);
}
.portrait img + .initials { display: none; }

@media (min-width: 52rem) {
  .hero .wrap { grid-template-columns: 1.4fr 1fr; gap: 4rem; }
  .portrait { justify-self: end; }
}

/* ===== Секции ===== */
.section { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--line); }
.section--tint { background: var(--paper-2); }

.requests {
  list-style: none; margin: 1.5rem 0 0; padding: 0;
  display: grid; grid-template-columns: 1fr; gap: 0 2.5rem;
}
.requests li { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 44rem) { .requests { grid-template-columns: 1fr 1fr; } }

.quote {
  margin: 2rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--accent);
  font-size: 1.3rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* условия */
.terms { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 0.5rem; overflow: hidden; margin: 2rem 0; }
.terms > div { background: var(--paper); padding: 1.25rem 1.5rem; }
.section--tint .terms > div { background: var(--paper-2); }
.terms dt { font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.terms dd { margin: 0.25rem 0 0; font-size: 1.2rem; }
@media (min-width: 44rem) { .terms { grid-template-columns: repeat(2, 1fr); } }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.steps li { position: relative; padding: 0 0 1.5rem 3rem; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0.1rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent);
  display: grid; place-items: center;
  font-family: var(--sans); font-size: 0.9rem;
}
.steps h3 { margin-bottom: 0.2em; }

/* образование */
.edu { list-style: none; padding: 0; margin: 1.5rem 0; }
.edu li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.edu .where { display: block; font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }
.edu .now { font-family: var(--sans); font-size: 0.75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0.05rem 0.55rem; margin-left: 0.4rem; vertical-align: 0.15em; white-space: nowrap; }

.callout {
  background: var(--accent-soft);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0 0;
}
.callout p:last-child { margin-bottom: 0; }

/* цифры */
.stats {
  list-style: none; padding: 0; margin: 2.5rem 0 3rem;
  display: grid; grid-template-columns: 1fr; gap: 1.5rem;
}
.stats li { border-top: 1px solid var(--accent); padding-top: 1rem; }
.stat-num {
  display: block;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: 0.35rem; font-family: var(--sans); font-size: 0.95rem; color: var(--ink-soft); }
@media (min-width: 30rem) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 2rem; max-width: var(--col); }
}

/* документы: ровная сетка, карточки в ряду выровнены по верху */
.docs {
  list-style: none; padding: 0; margin: 1.25rem 0 2rem;
  display: grid; grid-template-columns: 1fr; gap: 2.25rem;
  align-items: start;
}
@media (min-width: 36rem) {
  .docs { grid-template-columns: repeat(2, 1fr); gap: 2.5rem 2rem; }
}
@media (min-width: 60rem) {
  .docs { grid-template-columns: repeat(3, 1fr); }
}

/* Рамка одной высоты (пропорция листа A4): широкие сертификаты стоят по нижнему краю,
   поэтому подписи во всех карточках ряда начинаются на одной линии */
.doc-img {
  display: flex; align-items: flex-end; justify-content: center;
  width: 100%; aspect-ratio: 1800 / 1273;
  padding: 0; border: 0; background: none; cursor: zoom-in;
}
.doc-img img {
  width: 100%; height: auto; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(40, 30, 20, .10), 0 10px 28px -8px rgba(40, 30, 20, .28);
  transition: transform .25s ease, box-shadow .25s ease;
}
.doc-img:hover img { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(40, 30, 20, .10), 0 18px 36px -10px rgba(40, 30, 20, .35); }
.doc-img:focus-visible { outline-offset: 6px; }

.doc-meta { margin-top: 1rem; }
.doc-meta h4 { margin: 0.5rem 0 0.25rem; font-size: 1rem; font-weight: 400; line-height: 1.4; }
.doc-meta p { margin: 0; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.doc-meta a { color: var(--ink-soft); }
.doc-meta h4 a { color: inherit; text-decoration-color: var(--line); }
.doc-meta a:hover, .doc-meta h4 a:hover { color: var(--accent); text-decoration-color: currentColor; }
.doc-meta .doc-thesis { margin-top: 0.4rem; font-family: var(--serif); font-size: 0.9rem; font-style: italic; color: var(--ink-soft); }

/* спойлеры с группами документов */
.docs-group { border-top: 1px solid var(--line); }
.docs-group:last-of-type { border-bottom: 1px solid var(--line); }
.docs-group summary {
  display: flex; align-items: baseline; gap: 1rem;
  padding: 1.1rem 0;
  cursor: pointer; list-style: none;
  font-size: 1.25rem;
}
.docs-group summary::-webkit-details-marker { display: none; }
.docs-group summary::before {
  content: "+";
  flex: none; width: 1.2rem;
  font-family: var(--sans); font-size: 1.4rem; line-height: 1; color: var(--accent);
  transition: transform .2s;
}
.docs-group[open] summary::before { transform: rotate(45deg); }
.docs-group summary:hover .docs-group-title { color: var(--accent); }
.docs-group-hours {
  margin-left: auto;
  font-family: var(--sans); font-size: 0.9rem; white-space: nowrap;
  padding: 0.15rem 0.75rem;
  border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent);
}
.docs-group .docs { margin-top: 0.5rem; }

.doc-badge {
  display: inline-block;
  font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.04em;
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
}

/* просмотр документа */
.lightbox {
  max-width: min(96vw, 75rem); max-height: 94vh;
  padding: 0; border: 0; border-radius: 6px;
  background: var(--paper); color: var(--ink);
  overflow: visible;
}
.lightbox::backdrop { background: rgba(20, 16, 12, .78); }
.lightbox img { display: block; max-width: 100%; max-height: calc(94vh - 4rem); width: auto; height: auto; margin: 0 auto; border-radius: 6px 6px 0 0; }
.lightbox-caption { margin: 0; padding: 0.75rem 1rem; font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); }
.lightbox-close {
  position: absolute; top: -0.9rem; right: -0.9rem;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--paper); color: var(--ink);
  font-size: 1.5rem; line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
@media (max-width: 36rem) { .lightbox-close { top: 0.4rem; right: 0.4rem; } }

/* вопросы */
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 1.1rem 2rem 1.1rem 0; position: relative;
  font-size: 1.15rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0.25rem; top: 0.95rem;
  font-family: var(--sans); font-size: 1.4rem; color: var(--accent); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 0 1.25rem; color: var(--ink-soft); }

/* контакты */
.contact-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 2.5rem; }
.crisis {
  font-family: var(--sans); font-size: 0.95rem; line-height: 1.6;
  color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
}
.crisis strong { color: var(--ink); }
.crisis ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

/* подвал */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  font-family: var(--sans); font-size: 0.9rem; color: var(--muted);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.site-footer a { color: var(--muted); }

/* ===== Мобильные ===== */
@media (max-width: 52rem) {
  .nav { display: none; }
  .brand span { display: none; }
  .hero .wrap { gap: 1.75rem; }
  .portrait { order: -1; width: 9rem; justify-self: start; }
  .portrait .initials { font-size: 2.25rem; }
}

/* ===== Текстовые страницы ===== */
.page { padding: clamp(2.5rem, 6vw, 4rem) 0 4rem; }
.page h2 { font-size: 1.4rem; margin-top: 2rem; }
.page .col ul { padding-left: 1.25rem; }
.page .col li { margin: 0.3rem 0; }

/* ===== Выравнивание по ширине ===== */
/* Только на широких экранах: в узкой колонке телефона между словами
   появляются большие пробелы (браузеры не везде переносят русские слова) */
@media (min-width: 44rem) {
  .hero .lead,
  .col > p,
  .faq .answer p,
  .page .col p {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
  }
}

/* Пометки прототипа: что нужно уточнить */
.todo { background: var(--todo-bg, #fff2b3); color: var(--todo-ink, #4a3b00); border-radius: 3px; padding: 0 0.25em; font-style: normal; }
