/*
Дизайн-система «протокольная бумага».
Светлая тема — бумага при дневном свете. Тёмная — кабинет ночью:
графит, тёплый бумажный текст, сургучная печать чуть ярче.
Темы переключаются автоматически по теме устройства (prefers-color-scheme).
*/

:root {
  color-scheme: light dark;

  --paper: #f5f6f4;
  --paper-alt: #ebeae5;
  --card: #ffffff;
  --ink: #14181c;
  --muted: #5c6268;
  --line: #d9dad5;
  --accent: #9e2b25;
  --accent-strong: #84231e;
  --accent-soft: rgba(158, 43, 37, 0.08);

  --serif: "PT Serif", Georgia, serif;
  --sans: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;

  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181d;
    --paper-alt: #1b1f25;
    --card: #20242b;
    --ink: #e8e6e0;
    --muted: #9aa0a8;
    --line: #2c313a;
    --accent: #c8544c;
    --accent-strong: #d96860;
    --accent-soft: rgba(200, 84, 76, 0.12);
  }
}

/* ---------- База ---------- */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.5rem); }
h2 { font-size: clamp(1.55rem, 1.15rem + 1.7vw, 2.35rem); }
h3 { font-size: 1.15rem; }
p { margin: 0; }

.wrap { max-width: var(--container); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
.muted { color: var(--muted); }
section { padding-block: clamp(3.5rem, 7vw, 6.5rem); }
.section-alt { background: var(--paper-alt); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 0.9rem;
}
.mono-label {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { font-size: 1.12rem; color: var(--muted); max-width: 58ch; }

/* Линованная бумага для первого экрана */
.ruled {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent 2.3rem,
    var(--line) 2.31rem, var(--line) calc(2.31rem + 1px)
  );
}
@media (prefers-color-scheme: dark) {
  .ruled {
    background-image: repeating-linear-gradient(
      to bottom,
      transparent 0, transparent 2.3rem,
      rgba(255,255,255,0.04) 2.31rem, rgba(255,255,255,0.04) calc(2.31rem + 1px)
    );
  }
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--sans); font-weight: 600; font-size: 0.98rem;
  padding: 0.95rem 1.8rem; border-radius: 3px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--accent-strong); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-strong); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.link-arrow {
  font-weight: 600; text-decoration: none;
  border-bottom: 1px solid var(--ink); padding-bottom: 2px;
  transition: color .18s ease, border-color .18s ease;
}
.link-arrow:hover { color: var(--accent); border-color: var(--accent); }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease;
}
.site-header.scrolled { border-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1rem; }
.brand { text-decoration: none; }
.brand b { font-family: var(--serif); font-size: 1.05rem; display: block; line-height: 1.2; }
.brand small { display: block; margin-top: 2px; }
.main-nav { display: flex; gap: 1.6rem; }
.main-nav a { font-size: 0.92rem; text-decoration: none; padding-block: 0.25rem; }
.main-nav a:hover { color: var(--accent); }
.main-nav a[aria-current="page"] { border-bottom: 2px solid var(--accent); }
.header-phone { font-family: var(--mono); font-size: .92rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 3px; padding: .5rem .7rem; color: var(--ink); font-family: var(--mono); font-size: .8rem; cursor: pointer; }

@media (max-width: 920px) {
  .main-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0 1rem;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 0.8rem clamp(1.25rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); }
  .main-nav a[aria-current="page"] { border-bottom: 1px solid var(--line); color: var(--accent); }
  .nav-toggle { display: inline-flex; }
  .header-phone { display: none; }
}

/* ---------- Портрет на главной и карусель ---------- */

.hero-grid { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1.15fr) 360px; align-items: end; }
@media (max-width: 920px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-portrait { margin: 0; align-self: end; justify-self: end; width: 100%; max-width: 420px; }
.hero-portrait img { width: 100%; height: auto; max-height: min(72vh, 560px); object-fit: contain; border: 1px solid var(--line); border-radius: 3px; background: var(--paper-alt); }
.hero-portrait figcaption { margin-top: .7rem; }

.about-grid { display: grid; gap: 3rem; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }
.photo-rail { position: sticky; top: 6rem; }
@media (max-width: 860px) { .photo-rail { position: static; } }

.carousel { border: 1px solid var(--line); border-radius: 3px; background: var(--paper-alt); padding: .6rem; overflow: hidden; }
.carousel-track { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: flex-start; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; gap: .6rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide { margin: 0; min-width: 100%; width: 100%; flex: 0 0 100%; scroll-snap-align: start; }
.carousel-slide img { width: 100%; height: clamp(320px, 58vh, 560px); object-fit: cover; object-position: 50% 30%; border-radius: 3px; display: block; background: var(--paper); }
.carousel-nav { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .6rem .2rem .1rem; }
.carousel-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 3px; width: 2.1rem; height: 2.1rem; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.carousel-btn:hover { border-color: var(--ink); }

/* ---------- Таймлайн ---------- */

.timeline { max-width: 640px; }
.timeline-item { display: grid; grid-template-columns: 1.75rem 1fr; gap: 1.4rem; position: relative; padding-bottom: 2.6rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker { position: relative; display: flex; justify-content: center; }
.timeline-marker::before {
  content: ""; position: absolute; top: .3rem; bottom: -2.6rem; left: 50%;
  width: 1px; background: var(--line); transform: translateX(-50%);
}
.timeline-item:last-child .timeline-marker::before { display: none; }
.timeline-dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--accent); margin-top: .35rem; }
.timeline-hour { font-family: var(--mono); font-weight: 600; font-size: .85rem; color: var(--accent); }
.timeline-cite { display: block; font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-top: .45rem; }

/* ---------- Карточки и сетки ---------- */

.grid-2 { display: grid; gap: 1.5rem; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; gap: 1.5rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

.card-line { border-top: 2px solid var(--ink); padding-top: 1.2rem; }
.card-box { background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 1.6rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem 2rem; border-top: 1px solid var(--line); padding-top: 2rem; margin-top: 3.5rem; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat-value { font-family: var(--serif); font-weight: 700; font-size: 1.55rem; line-height: 1.1; }

.price-anchor { border-block: 1px solid var(--line); padding-block: 2rem; margin-block: 2.5rem; }
.price-figure { font-family: var(--serif); font-weight: 700; font-size: clamp(2rem, 1.4rem + 2.4vw, 3.1rem); line-height: 1; }
.price-figure small { font-size: .45em; font-weight: 400; color: var(--muted); }

blockquote.review {
  margin: 0; border-top: 2px solid var(--ink); padding-top: 1.2rem;
  display: flex; flex-direction: column; height: 100%;
}
blockquote.review p { flex: 1; }
blockquote.review footer {
  margin-top: 1.2rem; padding-top: .9rem; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
}

/* ---------- Форма ---------- */

.form-grid { display: grid; gap: 1.25rem; }
.form-row { display: grid; gap: 1.25rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .45rem; }
.field input, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 1rem;
  padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 3px;
  background: var(--card); color: var(--ink);
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field.error input, .field.error textarea { border-color: var(--accent); }
.field-error { color: var(--accent); font-size: .82rem; margin-top: .4rem; }
.char-note { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin-top: .4rem; text-align: right; }
.char-note.short { color: var(--accent); }
.consent { display: flex; gap: .65rem; align-items: flex-start; font-size: .86rem; color: var(--muted); padding: .7rem; margin: -.7rem; border: 2px solid transparent; border-radius: 3px; transition: border-color .2s ease, background-color .2s ease; }
.consent.error { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.consent input { margin-top: .28rem; }
.notice-ok { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 3px; padding: 1rem 1.2rem; }
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

.file-drop {
  border: 1px dashed var(--line); border-radius: 3px; padding: 1.4rem;
  text-align: center; font-size: .9rem; color: var(--muted); cursor: pointer;
  transition: border-color .2s ease;
}
.file-drop:hover { border-color: var(--accent); }
.file-list { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; gap: .4rem; }
.file-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: var(--mono); font-size: .82rem;
  background: var(--paper-alt); border-radius: 3px; padding: .5rem .75rem;
}

/* ---------- Админка: фотографии в редакторе ---------- */

.photo-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.photo-cell { width: 130px; display: flex; flex-direction: column; gap: .45rem; }
.photo-cell img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }
.photo-cell label { font-size: .78rem; display: flex; gap: .4rem; align-items: center; color: var(--muted); }

/* ---------- Админка: заявки ---------- */

.filter-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.6rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.filter-link { font-family: var(--mono); font-size: .82rem; text-decoration: none; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 3px; }
.filter-link.current { border-color: var(--accent); color: var(--accent); }

.status-badge { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: .3rem .7rem; border-radius: 3px; border: 1px solid var(--line); }
.status-new { border-color: var(--accent); color: var(--accent); }
.status-progress { border-color: var(--ink); color: var(--ink); }
.status-done { color: var(--muted); }

.admin-files { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.1rem; }
.admin-file-card { border: 1px solid var(--line); border-radius: 3px; padding: .75rem; display: flex; flex-direction: column; gap: .6rem; width: 180px; background: var(--paper-alt); }
.file-thumb { width: 100%; height: 110px; object-fit: cover; border-radius: 3px; display: block; }
.file-thumb-doc { display: flex; align-items: center; justify-content: center; background: var(--card); border: 1px dashed var(--line); }
.admin-file-meta { display: flex; flex-direction: column; gap: .2rem; }
.admin-file-name { font-size: .82rem; word-break: break-all; }
.admin-file-actions { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.admin-file-actions .link-arrow { font-size: .82rem; }

.admin-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.btn-mini { font-family: var(--sans); font-size: .8rem; font-weight: 600; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 3px; background: var(--card); color: var(--ink); cursor: pointer; margin-right: .4rem; }
.btn-mini:hover { border-color: var(--ink); }
.btn-mini.current { border-color: var(--accent); color: var(--accent); cursor: default; }
.btn-mini[disabled] { opacity: 1; }
.btn-mini-danger { border-color: transparent; color: var(--accent); background: transparent; }
.btn-mini-danger:hover { border-color: var(--accent); }

/* ---------- Памятка (страница-документ) ---------- */

.memo-doc {
  background: var(--card); border: 1px solid var(--line); border-radius: 3px;
  padding: clamp(1.5rem, 4vw, 3rem); max-width: 800px;
}
.memo-doc h2 { font-size: 1.3rem; margin-top: 2.2rem; }
.memo-doc h2:first-of-type { margin-top: 0; }
.memo-doc ol { padding-left: 1.3rem; display: grid; gap: .75rem; margin: 1rem 0 0; }
.memo-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1.6rem; }

/* ---------- Бейджи рейтингов (светлый/тёмный вариант по теме) ---------- */

.rating-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; max-width: 640px; }
@media (max-width: 600px) { .rating-strip { grid-template-columns: 1fr; } }
.rating-item { border-top: 2px solid var(--ink); padding-top: 1.1rem; display: flex; flex-direction: column; gap: .85rem; align-items: flex-start; }
.rating-item iframe { border: 0; border-radius: 3px; }
.rating-item .link-arrow { font-size: .88rem; }
.rating-compact { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; align-items: center; margin-top: 1.8rem; }
.rating-compact iframe { border: 0; border-radius: 3px; }
.only-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .only-light { display: none; }
  .only-dark { display: block; }
}

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

.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem; font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; justify-content: space-between; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Мобильная панель действий ---------- */

.mobile-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; gap: .5rem;
  padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom, 0));
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  border-top: 1px solid var(--line);
}
.mobile-bar .btn { flex: 1; padding: .75rem .5rem; font-size: .92rem; }
@media (min-width: 921px) { .mobile-bar { display: none; } }
@media (max-width: 920px) { body { padding-bottom: 4.2rem; } }

/* ---------- Появление при прокрутке ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- Печать памятки ---------- */

@media print {
  .site-header, .site-footer, .mobile-bar, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; padding: 0; }
  .memo-doc { border: none; padding: 0; max-width: none; }
  a { text-decoration: none; color: #000; }
  section { padding-block: 0; }
}
