/* =====================================================================
   Личный сайт — общие стили. Дизайн-система «sweep»:
   тёплая тёмная база, кремовый текст, латунный акцент, сериф Fraunces
   в заголовках, IBM Plex Mono в цифрах/подписях, острые углы, hairline-
   разделители.
   ===================================================================== */

:root {
  /* палитра sweep */
  --bg: #12151b;
  --panel: #191e26;
  --panel-2: #1d232c;
  --border: #2a313d;
  --text: #e9e5da;
  --text-dim: #8a93a3;
  --accent: #c9a24b;
  --accent-soft: rgba(201, 162, 75, 0.14);
  --teal: #5c9494;
  --copper: #c1653a;
  --danger: #c1653a;

  --radius: 3px;
  --maxw: 1180px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;

  /* алиасы для более старого кода / admin.html */
  --ink: var(--text);
  --line: var(--border);
  --muted: var(--text-dim);
  --dim: var(--text-dim);
  --bg-soft: var(--panel);
  --accent-2: var(--teal);
  --card: var(--panel);
  --green: var(--accent);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 40px; }
@media (max-width: 640px) { .container { padding: 0 20px; } }

.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.muted { color: var(--text-dim); }
.small { font-size: 13px; }

/* ---------------- typography ---------------- */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 16px;
}
h1 { font-size: clamp(30px, 4.6vw, 44px); line-height: 1.18; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; }
p { margin: 0 0 16px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow.mono { color: var(--text-dim); }
.eyebrow.mono b { color: var(--accent); font-weight: 500; }

.lead-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
  max-width: 46ch;
}

/* ---------------- header ---------------- */

.site-header {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}
.logo {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.01em;
  color: var(--text);
}
.logo:hover { text-decoration: none; color: var(--text); }
.logo b { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 26px; }
.nav a { color: var(--text-dim); font-size: 13.5px; }
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11px;
}
.lang-toggle button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 6px 9px;
  cursor: pointer;
  font-family: inherit;
}
.lang-toggle button.active { background: var(--accent); color: #16130a; font-weight: 600; }

.burger { display: none; background: none; border: 0; color: var(--text); font-size: 22px; cursor: pointer; }

@media (max-width: 820px) {
  .nav {
    position: absolute;
    top: 72px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 8px 40px 16px;
    display: none;
    z-index: 50;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav .lang-toggle { margin-top: 12px; align-self: flex-start; }
  .burger { display: block; }
}
@media (max-width: 640px) { .nav { padding: 8px 20px 16px; } }

/* ---------------- sections ---------------- */

main { display: block; }

.section { padding-top: 72px; padding-bottom: 72px; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.hero { padding-top: 60px; padding-bottom: 72px; }
.hero h1 { max-width: 22ch; }
.hero .lead-text { margin-bottom: 28px; }

/* два блока в шапке: слева — сайты, справа — трейдинг */
.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.hero-col { position: relative; display: flex; flex-direction: column; }
.hero-col + .hero-col::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: var(--border);
}
.hero-col h1,
.hero-col h2 { font-size: clamp(22px, 2.7vw, 30px); line-height: 1.22; margin: 0 0 14px; max-width: 20ch; }
.hero-col .lead-text { font-size: 15px; line-height: 1.65; margin-bottom: 20px; max-width: 42ch; }
.hero-col .btn-row { margin-bottom: 30px; }
.hero-col .btn-row .btn { padding: 11px 18px; font-size: 13.5px; }
@media (max-width: 860px) {
  .hero-split { grid-template-columns: 1fr; gap: 34px; }
  .hero-col + .hero-col::before { left: 0; right: 0; top: -17px; bottom: auto; width: auto; height: 1px; }
}

/* editorial section header: заголовок слева + пояснение справа */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 0; font-size: 13.5px; color: var(--text-dim); max-width: 34ch; text-align: right; }
@media (max-width: 720px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-head p { text-align: left; }
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: box-shadow 0.25s ease, transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #16130a; }
.btn-primary:hover { box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(201, 162, 75, 0.4); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------------- stats: единый блок под каждой колонкой шапки ---------------- */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px 22px;
  margin-top: 28px;
}
.hero-col .stats { margin-top: auto; }
.stat { flex: 0 1 auto; }
.stat .v { font-family: var(--mono); font-size: 19px; font-weight: 500; color: var(--accent); }
.stat .l { margin-top: 4px; font-size: 12px; color: var(--text-dim); line-height: 1.45; }
@media (max-width: 640px) {
  .stats { gap: 14px 24px; }
}

/* ---------------- cards ---------------- */

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--panel);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.card:hover { border-color: var(--accent); background: var(--panel-2); }
.card h3 { font-family: var(--serif); font-weight: 500; margin-bottom: 8px; }
.card p { color: var(--text-dim); font-size: 14px; margin-bottom: 0; }
.card .price {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 13px;
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
}
.card .price .eta { color: var(--text-dim); }
a.card:hover { text-decoration: none; }
a.card h3 { color: var(--text); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 7px;
}

.result-line {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--teal);
  margin-top: 12px;
}

/* ---------------- steps ---------------- */

.steps { border-top: 1px solid var(--border); list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.65;
}
.steps li:before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}
@media (max-width: 620px) { .steps li { grid-template-columns: 36px 1fr; gap: 16px; } }

.check-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.check-list li {
  padding: 12px 0 12px 22px;
  position: relative;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.check-list li:before { content: "\2192"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); }

/* ---------------- book ---------------- */

.book-hero { display: grid; grid-template-columns: 240px 1fr; gap: 40px; align-items: start; }
.book-cover {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
  font-family: var(--mono);
  color: var(--text-dim);
}
.book-cover span { padding: 20px; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 680px) { .book-hero { grid-template-columns: 1fr; } .book-cover { max-width: 220px; } }

/* ---------------- forms ---------------- */

.form-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px;
  max-width: 560px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.form-status { font-size: 14px; margin-top: 12px; min-height: 20px; }
.form-status.ok { color: var(--teal); }
.form-status.err { color: var(--copper); }

/* ---------------- blog ---------------- */

.post-card { display: flex; flex-direction: column; }
.post-card .date { font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em; color: var(--text-dim); }
.post-card h3 { font-family: var(--serif); font-weight: 500; margin: 8px 0; }
.post-card p { flex: 1; color: var(--text-dim); font-size: 14px; }

.article { max-width: 680px; }
.article .date { font-family: var(--mono); color: var(--text-dim); font-size: 12.5px; }
.article h1 { margin: 10px 0 28px; }
.article h2 { margin-top: 38px; }
.article h3 { margin-top: 28px; }
.article p { color: var(--text); }
.article ul, .article ol { color: var(--text); padding-left: 22px; }
.article li { margin: 6px 0; }
.article code {
  font-family: var(--mono);
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: var(--radius);
  font-size: 0.9em;
}
.article pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
}
.article pre code { background: none; padding: 0; }
.article blockquote {
  border-left: 2px solid var(--accent);
  margin: 20px 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-style: italic;
}
.article hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------------- footer ---------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 44px 0;
  color: var(--text-dim);
  font-size: 13px;
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.foot-links { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.foot-social { display: inline-flex; align-items: center; gap: 12px; }
.foot-social a.soc { display: inline-flex; }
.foot-social a.soc svg { display: block; }

/* строка «анонсы статей» на странице блога */
.blog-follow { margin-top: 10px; font-size: 14px; color: var(--text-dim); }
.blog-follow a { color: var(--accent); }
.blog-follow a:hover { text-decoration: underline; }

/* покупка книги + страница оплаты */
.buy-box {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  max-width: 380px;
}
.buy-email { display: block; margin-bottom: 12px; }
.buy-email span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
.buy-email input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.buy-email input:focus { outline: none; border-color: var(--accent); }
.buy-box .btn { width: 100%; justify-content: center; }
.buy-box #buyStatus:empty, .buy-box #bookBuyNote:empty { display: none; }
.buy-box #buyStatus { margin-top: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.pay-box {
  margin-top: 20px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  max-width: 460px;
}
.pay-box .btn-row { margin-top: 16px; }

/* карточки магазина */
.shop-card { display: flex; flex-direction: column; }
.shop-card .badge { align-self: flex-start; margin-bottom: 10px; }
.shop-card h3 { margin: 0 0 8px; }
.shop-card p { color: var(--text-dim); font-size: 14px; line-height: 1.6; flex: 1; }
.shop-buy { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.shop-price { font-family: var(--mono); font-size: 20px; color: var(--accent); }
.shop-buy .btn { padding: 10px 18px; font-size: 13.5px; }
.shop-stat:empty { display: none; }
.shop-stat { margin-top: 8px; }

/* ---------------- reveal ---------------- */

.reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------------- misc ---------------- */

.divider { height: 1px; background: var(--border); margin: 32px 0; }

/* ---------------- плавающие кнопки: наверх / на главную ---------------- */
.scroll-tools {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}
.st-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #16130a;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.18s ease, filter 0.18s ease, opacity 0.2s ease;
}
.st-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px rgba(201, 162, 75, 0.4);
  transform: translateY(-2px);
  text-decoration: none;
}
/* «наверх» появляется только после прокрутки */
.scroll-tools .st-top { opacity: 0; pointer-events: none; transform: translateY(6px); }
.scroll-tools.scrolled .st-top { opacity: 1; pointer-events: auto; transform: none; }
@media (max-width: 640px) {
  .scroll-tools { right: 12px; bottom: 12px; }
  .st-btn { width: 38px; height: 38px; }
}

/* ---------------- about: фото + текст ---------------- */
.about-grid.has-photo {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 28px;
  align-items: start;
}
.about-grid.has-photo .lead-text { max-width: 58ch; }
.about-text .lead-text + .lead-text { margin-top: 14px; }
.about-text .lead-text:last-child { margin-bottom: 0; }
.about-photo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-2);
}
.about-photo img { width: 100%; height: auto; display: block; aspect-ratio: 4 / 5; object-fit: cover; }
@media (max-width: 680px) {
  .about-grid.has-photo { grid-template-columns: 120px 1fr; gap: 18px; }
}

.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text-dim);
}
.badge.accent { color: var(--accent); border-color: var(--accent); }

.quote {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--panel);
}
.quote p { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--text); margin: 0; }
.quote .who { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-top: 10px; }

/* ---------------- portfolio: карточки-работы + схемы ---------------- */

.work-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.work-card .card-body { padding: 22px; }
.card-chart {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 6px;
}
.card-chart svg.pd { width: 100%; height: auto; display: block; }

.work-chart {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 20px 22px 12px;
  margin: 4px 0 28px;
}
.work-chart svg.pd { width: 100%; height: auto; display: block; max-height: 320px; }

/* элементы SVG-схем (палитра sweep) */
svg.pd text { font-family: var(--mono); }
.pd-price { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pd-price.warn { stroke: var(--copper); }
.pd-price.flow { stroke-width: 1.6; }
.pd-ma { fill: none; stroke: var(--accent); stroke-width: 1.4; opacity: 0.5; }
.pd-zone, .pd-ob { fill: var(--accent-soft); stroke: var(--accent); stroke-opacity: 0.55; stroke-width: 1; }
.pd-guide { fill: none; stroke: var(--text-dim); stroke-width: 1; opacity: 0.3; stroke-dasharray: 2 4; }
.pd-proj { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0.65; stroke-dasharray: 4 4; }
.pd-poc { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.pd-pivot, .pd-pt, .pd-gdot { fill: var(--accent); }
.pd-gdot { fill: var(--text-dim); }
.pd-dot { fill: var(--accent); }
.pd-dot.sweep { fill: var(--copper); }
.pd-bar.buy { fill: var(--teal); }
.pd-bar.sell { fill: var(--copper); }
.pd-node { fill: var(--bg); stroke: var(--text-dim); stroke-width: 1; stroke-opacity: 0.4; }
.pd-step { fill: var(--accent); opacity: 0.7; }
.pd-lbl { font-size: 10px; fill: var(--text-dim); }
.pd-lbl.hi { fill: var(--accent); }
.pd-lbl.buy-t { fill: var(--teal); }
.pd-lbl.sell-t { fill: var(--copper); }
