/*
  THESIS: Статья объясняет механику автоакций через последовательный текст и реальные экраны продукта.
  OWN-WORLD: Onest, холодная бумага, светлые поверхности, графит и один синий акцент из блога EcomFlow.
  STORY: Читатель понимает риск скидки, задает ценовой коридор и выбирает стратегию автоматизации.
  FIRST VIEWPORT: Компактная навигация, возврат в блог, метаданные, заголовок и спокойный лид без декоративного hero.
  FORM: Узкая editorial-колонка с более широкими product-figure и функциональным lightbox.
*/

@font-face {
  font-family: "Onest";
  src: url("../assets/fonts/Onest-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #111a22;
  --ink-2: #293744;
  --muted: #586775;
  --line: #d2dae2;
  --paper: #f3f5f7;
  --surface: #fbfcfd;
  --surface-blue: #e4ebf8;
  --panel: #172530;
  --panel-2: #223441;
  --blue: #2456c8;
  --blue-dark: #1c46a7;
  --radius: 14px;
  --container: 1240px;
  --reading: 780px;
  --figure: 768px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Onest", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  font-weight: 450;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:has(dialog[open]) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, figure { margin-top: 0; }
:focus-visible { outline: 3px solid rgba(36, 86, 200, .32); outline-offset: 3px; }

.container {
  width: min(100% - 48px, var(--container));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  transform: translateY(-160%);
  transition: transform 160ms var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: 10px;
  color: #eef3f7;
  background: linear-gradient(to bottom, rgba(243, 245, 247, .96), rgba(243, 245, 247, 0));
}

.nav__inner {
  position: relative;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 7px 8px 7px 12px;
  border-radius: var(--radius);
  background: rgba(20, 33, 44, .97);
  box-shadow: 0 16px 40px rgba(21, 35, 47, .16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.logo {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.logo__mark {
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 50%;
  background: #f2f5f8;
}

.logo__mark img { width: 100%; height: 100%; object-fit: contain; }
.logo__name { color: #f7f9fb; font-size: 15px; font-weight: 680; letter-spacing: -.03em; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
  color: #c4ced7;
  font-size: 12px;
  font-weight: 570;
}

.nav__links a {
  padding: 9px 10px;
  border-radius: 7px;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav__links a[aria-current="page"] { color: #fff; background: #263744; }

.nav__actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 180ms ease;
}

.button:hover { background: var(--blue-dark); box-shadow: 0 10px 24px rgba(17, 26, 34, .18); }
.button:active { transform: scale(.97); }

.button--ghost {
  color: #dbe3e9;
  border: 1px solid #465967;
  background: transparent;
}

.button--ghost:hover { color: #fff; background: #263744; box-shadow: none; }

.nav__menu-toggle {
  display: none;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #dce4eb;
  background: #263744;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.article-hero { padding: 64px 0 54px; }

.back-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
  transition: color 160ms ease, transform 160ms var(--ease-out);
}

.back-link::before { content: "←"; color: var(--blue-dark); }
.back-link:hover { color: var(--ink); transform: translateX(-2px); }

.article-hero__inner {
  width: min(100%, 980px);
  margin-inline: auto;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px 14px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 570;
}

.article-meta__type {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #e0e9fa;
  font-weight: 700;
}

.article-meta__author { color: var(--ink-2); }

.article-hero h1 {
  max-width: 1020px;
  margin-bottom: 24px;
  font-size: clamp(42px, 5.2vw, 66px);
  font-weight: 680;
  line-height: 1.02;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.article-hero__lead {
  max-width: 780px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.55;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.article-tag {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(251, 252, 253, .7);
  font-size: 11px;
  font-weight: 610;
}

.article-shell {
  position: relative;
  padding: 18px 0 96px;
}

.article-body {
  width: min(100%, var(--reading));
  margin-inline: auto;
  font-size: 18px;
  line-height: 1.72;
}

.article-body > p { margin-bottom: 24px; }

.article-body h2 {
  margin: 72px 0 22px;
  font-size: clamp(30px, 3.3vw, 42px);
  font-weight: 670;
  line-height: 1.1;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.article-body h3 {
  margin: 42px 0 14px;
  font-size: 24px;
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.article-body ul,
.article-body ol {
  margin: 0 0 28px;
  padding-left: 1.35em;
}

.article-body li { margin-bottom: 8px; padding-left: 5px; }
.article-body li::marker { color: var(--blue-dark); font-weight: 700; }
.article-body strong { color: var(--ink); font-weight: 680; }

.article-note {
  margin: 30px 0;
  padding: 22px 24px;
  border: 1px solid #cbd8ef;
  border-radius: 12px;
  color: var(--ink-2);
  background: var(--surface-blue);
}

.article-note p { margin: 0; }

.article-figure {
  width: min(calc(100vw - 48px), var(--figure));
  margin: 48px 50%;
  transform: translateX(-50%);
}

.article-figure--compact {
  width: min(calc(100vw - 48px), 544px);
}

.article-figure--portrait {
  width: min(calc(100vw - 48px), 448px);
}

.article-figure__button {
  width: 100%;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 22px 52px rgba(23, 37, 48, .1);
  cursor: zoom-in;
  transition: transform 180ms var(--ease-out), box-shadow 180ms ease, border-color 180ms ease;
}

.article-figure__button img {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fff;
}

.article-figure figcaption {
  max-width: 760px;
  margin: 13px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.article-summary {
  margin-top: 76px;
  padding: 30px;
  border-radius: var(--radius);
  color: #eaf0f4;
  background: var(--panel);
}

.article-summary h2 {
  margin: 0 0 16px;
  color: #fff;
  font-size: 30px;
}

.article-summary p { margin-bottom: 16px; color: #c5d0d8; }
.article-summary p:last-child { margin-bottom: 0; }

.article-cta { padding: 0 0 72px; }

.article-cta__panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: center;
  padding: 38px 40px;
  border-radius: var(--radius);
  background: var(--surface-blue);
}

.article-cta h2 {
  max-width: 700px;
  margin-bottom: 12px;
  font-size: clamp(30px, 3.5vw, 44px);
  font-weight: 680;
  line-height: 1.05;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.article-cta p { max-width: 68ch; margin-bottom: 0; color: var(--muted); }

.footer {
  padding-block: 28px;
  color: #aebbc6;
  background: var(--panel);
  border-top: 1px solid #324657;
  font-size: 13px;
}

.footer .container { padding-inline: 28px; }
.footer__inner { display: grid; gap: 16px; }

.footer__top {
  display: grid;
  grid-template-columns: .8fr 1fr 1.2fr;
  align-items: center;
  gap: 20px;
}

.footer__brand {
  color: #f5f8fb;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.footer__links { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px 18px; }
.footer__links a { transition: color 160ms ease; }
.footer__links a:hover { color: #fff; }

.footer__legal {
  padding-top: 14px;
  border-top: 1px solid #324657;
  color: #8fa0ac;
  font-size: 11px;
}

.footer__legal p { margin: 0; }

.lightbox {
  width: auto;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(10, 18, 24, .88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox__stage {
  position: relative;
  width: min(94vw, 1500px);
  max-height: 92dvh;
  display: grid;
  place-items: center;
  padding: 44px;
}

.lightbox__image {
  width: auto;
  max-width: 100%;
  max-height: calc(92dvh - 88px);
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .42);
}

.lightbox__close {
  position: absolute;
  top: 0;
  right: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 10px;
  color: #fff;
  background: rgba(23, 37, 48, .78);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, transform 140ms var(--ease-out);
}

.lightbox__close:hover { background: var(--blue); }
.lightbox__close:active { transform: scale(.96); }

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #334754;
  border-radius: 12px;
  color: #f5f8fb;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(17, 26, 34, .2);
  font-size: 20px;
  font-weight: 660;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.96);
  cursor: pointer;
  transition:
    opacity 160ms ease,
    transform 180ms var(--ease-out),
    background-color 160ms ease,
    border-color 160ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-to-top:active { transform: scale(.96); }

@media (hover: hover) and (pointer: fine) {
  .article-figure__button:hover {
    border-color: #a9b6c2;
    box-shadow: 0 30px 70px rgba(23, 37, 48, .15);
    transform: translateY(-3px);
  }

  .back-to-top:hover {
    border-color: var(--blue);
    background: var(--blue);
    transform: translateY(-2px) scale(1);
  }

  .back-to-top:active { transform: scale(.96); }
}

@media (max-width: 980px) {
  .nav__links { gap: 0; }
  .nav__links a { padding-inline: 7px; }
  .footer__top { grid-template-columns: 1fr; text-align: center; }
  .footer__links { justify-content: center; }
  .article-cta__panel { grid-template-columns: 1fr; gap: 24px; }
  .article-cta__panel .button { width: fit-content; }
}

@media (max-width: 760px) {
  .container { width: min(100% - 28px, var(--container)); }
  .nav { padding-top: 7px; }
  .nav__inner { min-height: 54px; padding: 6px 7px 6px 10px; }
  .nav__menu-toggle { display: inline-flex; align-items: center; margin-left: auto; }
  .nav__links {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    align-items: stretch;
    flex-direction: column;
    margin: 0;
    padding: 8px;
    border: 1px solid #334754;
    border-radius: 12px;
    background: rgba(20, 33, 44, .99);
    box-shadow: 0 22px 48px rgba(20, 33, 44, .28);
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 11px; }
  .nav__actions .button--ghost { display: none; }
  .nav__actions .button { min-height: 38px; padding-inline: 12px; }

  .article-hero { padding: 42px 0 36px; }
  .back-link { margin-bottom: 28px; }
  .article-hero h1 { margin-bottom: 20px; font-size: clamp(34px, 10vw, 46px); line-height: 1.04; }
  .article-hero__lead { font-size: 17px; }
  .article-shell { padding-top: 10px; padding-bottom: 72px; }
  .article-body { font-size: 17px; line-height: 1.68; }
  .article-body h2 { margin-top: 56px; font-size: 30px; }
  .article-body h3 { margin-top: 36px; font-size: 22px; }
  .article-body > p,
  .article-body > h2,
  .article-body > h3,
  .article-body > ul,
  .article-body > ol { margin-right: 46px; }
  .article-figure,
  .article-figure--compact,
  .article-figure--portrait { width: calc(100vw - 28px); margin-block: 38px; }
  .article-figure figcaption { padding-inline: 8px; text-align: left; }
  .article-note { padding: 18px 19px; }
  .article-summary { margin-top: 58px; padding: 24px; }
  .article-summary h2 { font-size: 27px; }
  .article-cta { padding-bottom: 48px; }
  .article-cta__panel { padding: 28px 24px; }
  .article-cta__panel .button { width: 100%; }
  .footer .container { padding-inline: 0; }
  .lightbox__stage { width: 100vw; min-height: 100dvh; padding: 56px 14px 20px; }
  .lightbox__image { max-height: calc(100dvh - 76px); border-radius: 8px; }
  .lightbox__close { top: 10px; right: 14px; }
  .back-to-top {
    right: 8px;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
