/* ============================================================
   dervlad.com — нарративная версия (RU)
   Палитра и типографика унаследованы с продакшн-сайта,
   структура переписана под арку «Троянский конь × SCQA».
   ============================================================ */

:root {
  --cream:    #FAFAF7;
  --ink:      #111111;
  --accent:   #1E3A5F;
  --muted:    #6E6E6E;
  --hairline: #E8E4DC;
  --paper:    #F3F1EA;   /* чуть темнее фона — для карточек-улик */
  --accent-lt:#8FB4DC;   /* акцент на тёмном фоне */
  --maxw:     72rem;
  --readw:    44rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------- натяжение: полоса прогресса чтения ---------- */
#tension {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 90; transition: width .1s linear;
}

/* ---------- шапка ---------- */
.bar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.bar-in {
  max-width: var(--maxw); margin: 0 auto; padding: .85rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
}
.bar-name { font-weight: 600; letter-spacing: -.01em; color: var(--ink); flex-shrink: 0; }
.bar-name:hover { text-decoration: none; }
.bar-links { min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; }
.bar-links::-webkit-scrollbar { display: none; }
.bar-links ul {
  display: flex; gap: 1.35rem; margin: 0; padding: 0; list-style: none;
  white-space: nowrap; font-size: .875rem; color: var(--muted);
  justify-content: flex-end;
}
.bar-links a { color: var(--muted); }
.bar-links a:hover, .bar-links a.on { color: var(--accent); text-decoration: none; }
.bar-cta {
  flex-shrink: 0; font-size: .8125rem; font-weight: 500;
  border: 1px solid var(--hairline); border-radius: 2px; padding: .45rem .85rem;
}
.bar-cta:hover { text-decoration: none; border-color: var(--accent); }

/* ---------- нарративный хребет (левая рейка) ---------- */
.spine {
  position: fixed; left: 1.75rem; top: 50%; transform: translateY(-50%);
  z-index: 50; display: none;
}
@media (min-width: 1280px) { .spine { display: block; } }
.spine ol { list-style: none; margin: 0; padding: 0; }
.spine li { position: relative; padding: .32rem 0 .32rem 1.35rem; }
.spine li::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--hairline); transition: background .25s, transform .25s;
}
.spine li.on::before { background: var(--accent); transform: translateY(-50%) scale(1.5); }
.spine li.turn::before { background: var(--ink); }
.spine a {
  font-size: .6875rem; letter-spacing: .09em; text-transform: uppercase;
  color: transparent; transition: color .25s;
}
.spine li.on a { color: var(--muted); }
.spine:hover a { color: var(--muted); }
.spine::after {
  content: ""; position: absolute; left: 2.5px; top: .5rem; bottom: .5rem;
  width: 1px; background: var(--hairline); z-index: -1;
}

/* ---------- сетка секций ---------- */
section { scroll-margin-top: 4.5rem; }
.wrap  { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }
.read  { max-width: var(--readw); margin: 0 auto; padding: 0 1.5rem; }
.beat  { padding: 6rem 0; }
@media (min-width: 768px) { .beat { padding: 8.5rem 0; } }

/* ---------- маркер такта ---------- */
.tag {
  display: flex; align-items: baseline; gap: .7rem;
  font-size: .6875rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 1.5rem;
}
.tag b { color: var(--accent); font-weight: 600; letter-spacing: .2em; }
.tag .rule { flex: 1; height: 1px; background: var(--hairline); }

/* ---------- типографика ---------- */
h1, h2, h3 { letter-spacing: -.025em; line-height: 1.1; margin: 0 0 1rem; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.7vw, 2.5rem); }
h3 { font-size: 1.3rem; line-height: 1.25; }
p  { margin: 0 0 1.15rem; }
.lede { font-size: clamp(1.15rem, 2.1vw, 1.35rem); line-height: 1.55; }
.dim  { color: var(--muted); }
.sm   { font-size: .875rem; }
.xs   { font-size: .8125rem; }
strong { font-weight: 600; }

/* ---------- 01 сцена ---------- */
.hero { display: grid; gap: 3rem; align-items: center; padding: 4.5rem 0 3.5rem; }
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.25fr .85fr; gap: 4.5rem; padding: 6.5rem 0 4.5rem; }
}
.hero-portrait { border-radius: 2px; filter: grayscale(.15); }
.stakes {
  border-left: 2px solid var(--accent); padding: .1rem 0 .1rem 1.15rem;
  margin: 2rem 0; color: var(--ink);
}
.ask { font-size: .95rem; color: var(--muted); margin-top: 2rem; max-width: 34rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; border-radius: 2px;
  padding: .8rem 1.35rem; font-size: .9375rem; font-weight: 500;
  background: var(--accent); color: var(--cream); border: 1px solid var(--accent);
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* ---------- полоса цифр ---------- */
.band { border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.band-in {
  max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.5rem;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.75rem 1.5rem;
}
@media (min-width: 768px) { .band-in { grid-template-columns: repeat(4, 1fr); padding: 3rem 1.5rem; } }
.stat-v { font-size: 1.6rem; font-weight: 600; color: var(--accent); line-height: 1.1; }
@media (min-width: 768px) { .stat-v { font-size: 1.9rem; } }
.stat-l { font-size: .8125rem; color: var(--muted); line-height: 1.4; margin-top: .45rem; }
.stat-s { font-size: .6875rem; color: var(--muted); margin-top: .35rem; }
.stat-s a { color: var(--accent); }

/* ---------- карточки ---------- */
.cards { display: grid; gap: 1.25rem; }
@media (min-width: 860px) { .cards.c3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .cards.c4 { grid-template-columns: repeat(4, 1fr); } }
.card {
  border: 1px solid var(--hairline); border-radius: 2px; padding: 1.5rem;
  background: var(--cream); display: flex; flex-direction: column;
}
.card h3 { font-size: 1.05rem; margin-bottom: .55rem; }
.card p { font-size: .875rem; color: var(--muted); margin: 0; line-height: 1.55; }
.live {
  display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .8rem;
  font-size: .625rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); font-style: normal; }

/* ---------- раскадровка (6 кадров) ---------- */
.frames { display: grid; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 2px; overflow: hidden; }
@media (min-width: 640px) { .frames { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .frames { grid-template-columns: repeat(3, 1fr); } }
.frame { background: var(--cream); padding: 1.5rem; }
.frame-n {
  font-size: .6875rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .7rem; display: flex; align-items: center; gap: .5rem;
}
.frame-n span { color: var(--muted); font-weight: 500; letter-spacing: .1em; }
.frame h4 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.frame p { margin: 0; font-size: .875rem; line-height: 1.6; color: var(--muted); }

/* ---------- итог кейса ---------- */
.tally { border-top: 1px solid var(--hairline); margin-top: 2rem; padding-top: 1.15rem; }
.tally-l { font-size: .6875rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.tally-v { font-size: .875rem; line-height: 1.7; }

/* ---------- билды ---------- */
.build { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .build { grid-template-columns: 1fr 300px; gap: 3.5rem; } }
@media (min-width: 900px) { .build.flip { grid-template-columns: 300px 1fr; } }
/* галерея билдов — порт BuildGallery с dervlad.com */
.gallery { width: 100%; max-width: 240px; margin: 0 auto; }
@media (min-width: 900px) { .gallery { max-width: none; margin: 0; } }
.gallery-viewport {
  position: relative; aspect-ratio: 860 / 1864; overflow: hidden;
  border: 1px solid var(--hairline); border-radius: 1.75rem;
  touch-action: pan-y; background: var(--paper);
}
.gallery-panel {
  position: absolute; inset: 0; opacity: 0; visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease;
}
.gallery-panel[data-active] { opacity: 1; visibility: visible; }
.gallery-panel img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.gallery-tabs { display: flex; gap: .5rem; margin-top: 1rem; }
.gallery-tab {
  flex: 1; text-align: left; padding: .5rem 0 0; background: none; cursor: pointer;
  border: 0; border-top: 1px solid var(--hairline);
  font-family: inherit; font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); transition: color 150ms ease, border-color 150ms ease;
  font-variant-numeric: tabular-nums;
}
.gallery-tab:hover { color: var(--ink); }
.gallery-tab[aria-selected="true"] { border-top-color: var(--accent); color: var(--ink); }
.gallery-caption { margin: .75rem 0 0; font-size: .75rem; line-height: 1.6; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .gallery-panel { transition: none; } }

/* стор-чипы — порт StoreLinks с dervlad.com */
.storechips { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem; list-style: none; margin: 0 0 1.5rem; padding: 0; }
.storechip {
  display: inline-flex; align-items: center; gap: .5rem; border-radius: 2px;
  padding: .5rem .875rem; font-size: .75rem; font-weight: 500;
  background: var(--accent); color: var(--cream); border: 1px solid transparent;
  transition: opacity 150ms ease;
}
.storechip:hover { text-decoration: none; opacity: .9; }
.storechip svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.store {
  font-size: .75rem; border: 1px solid var(--hairline); border-radius: 2px;
  padding: .38rem .7rem; color: var(--ink);
}
.store:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- ПЕРЕЛОМ (инверсия) ---------- */
.turn { background: var(--ink); color: var(--cream); padding: 7rem 0; }
@media (min-width: 768px) { .turn { padding: 9rem 0; } }
.turn .tag { color: #8a8a8a; }
.turn .tag b { color: var(--accent-lt); }
.turn .tag .rule { background: #2c2c2c; }
.turn h2 { font-size: clamp(2rem, 5.5vw, 3.4rem); margin-bottom: 2rem; }
.turn p { color: #C9C7C1; font-size: 1.05rem; }
.turn strong { color: var(--cream); font-weight: 600; }
.turn .final { color: var(--cream); font-size: 1.2rem; font-weight: 500; margin-top: 2rem; }
.turn-grid { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .turn-grid { grid-template-columns: 1.1fr .9fr; gap: 4rem; align-items: start; } }
.turn-portrait { border-radius: 2px; filter: grayscale(1) contrast(1.05); opacity: .9; }

/* ---------- проверка ---------- */
.checks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.checks li {
  border-bottom: 1px solid var(--hairline); padding: 1.15rem 0;
  display: grid; gap: .35rem 1.25rem; align-items: baseline;
}
@media (min-width: 700px) { .checks li { grid-template-columns: 2.2rem 1fr auto; } }
.chk-n { font-size: .8125rem; color: var(--accent); font-weight: 600; }
.chk-t { font-size: .9375rem; }
.chk-t em { font-style: normal; color: var(--muted); display: block; font-size: .8125rem; margin-top: .2rem; }
.chk-a { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- свидетели ---------- */
.quote { border-left: 2px solid var(--hairline); padding-left: 1.35rem; margin: 0 0 2.25rem; }
.quote blockquote { margin: 0; font-size: 1.1rem; line-height: 1.55; }
.quote figcaption { margin-top: .65rem; font-size: .875rem; color: var(--muted); }
.quote figcaption b { color: var(--ink); font-weight: 600; }

/* ---------- списки строк ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.rows li {
  border-bottom: 1px solid var(--hairline); padding: .9rem 0;
  display: grid; gap: .15rem 1.5rem;
}
@media (min-width: 700px) { .rows li { grid-template-columns: 1fr auto; align-items: baseline; } }
.rows .co { font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; }
.rows .ro { font-size: .8125rem; color: var(--muted); }
.rows .sc { font-size: .8125rem; color: var(--accent); }
.rows .dt { font-size: .8125rem; color: var(--muted); }
@media (min-width: 700px) { .rows .dt { text-align: right; } }

/* ---------- оговорки ---------- */
.caveats { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.15rem; }
.caveats li { display: grid; grid-template-columns: 1.5rem 1fr; gap: .35rem; align-items: baseline; }
.caveats li::before { content: "—"; color: var(--accent); }
.caveats p { margin: 0; font-size: .9375rem; }

/* ---------- цена ---------- */
.price { margin-top: auto; padding-top: 1.35rem; font-size: .9375rem; font-weight: 600; color: var(--accent); }
.dur { font-size: .625rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: .8rem; font-weight: 500; }

/* ---------- контакт / подвал ---------- */
.contact-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.contact-rows li {
  border-bottom: 1px solid var(--hairline); padding: .95rem 0;
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; align-items: baseline;
}
.contact-rows .k { font-size: .8125rem; color: var(--muted); }
footer { border-top: 1px solid var(--hairline); }
footer .wrap { padding-top: 2.5rem; padding-bottom: 2.5rem; font-size: .75rem; color: var(--muted); }

/* ---------- появление ---------- */
.rise { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.rise.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { opacity: 1; transform: none; transition: none; }
  #tension { transition: none; }
}

/* ---------- метод (три идеи) ---------- */
.idea {
  display: grid; gap: 1.25rem;
  border-top: 1px solid var(--hairline); padding: 2.75rem 0;
}
@media (min-width: 860px) { .idea { grid-template-columns: 13rem 1fr; gap: 3rem; } }
.idea:last-of-type { border-bottom: 1px solid var(--hairline); }
.idea .role b {
  display: block; font-size: .6875rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  margin-bottom: .5rem;
}
.idea .role p { margin: 0; font-size: .8125rem; color: var(--muted); line-height: 1.5; }
.idea h3 { font-size: 1.3rem; margin-bottom: 1rem; }
.idea .body p { font-size: .9375rem; color: var(--ink); }
.idea .limit {
  border-left: 2px solid var(--hairline); padding-left: 1.15rem;
  margin-top: 1.5rem; font-size: .875rem; color: var(--muted); line-height: 1.6;
}
.idea .limit b { color: var(--ink); font-weight: 600; }

/* ---------- переключатель языка ---------- */
.lang { display: flex; gap: .1rem; flex-shrink: 0; }
.lang a {
  font-size: .75rem; font-weight: 500; color: var(--muted);
  padding: .3rem .45rem; border-radius: 2px; letter-spacing: .04em;
}
.lang a:hover { text-decoration: none; color: var(--accent); }
.lang a.on { color: var(--accent); font-weight: 600; border: 1px solid var(--hairline); }
