/* ScribeWise — «Чернила и бумага».
   Layout: тетрадный лист — слева поле с красной линией, где живут рукописные пометки,
   справа основной текст; на узких экранах поле складывается над текстом. */
:root {
  --paper: #F6F1E7;
  --paper-deep: #EDE5D5;
  --card: #FFFDF8;
  --ink: #1E2638;
  --ink-soft: #4A5368;
  --ink-blue: #2B4AA0;
  --ink-blue-deep: #1F3A85;
  --ink-blue-wash: #E2E7F3;
  --margin-red: #B3432E;
  --margin-red-wash: #F5E1D9;
  --approve: #2F6E46;
  --rule: #D9CFBC;

  --font-display: "Literata", "PT Serif", Georgia, serif;
  --font-body: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --step-3: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  --step-4: clamp(2.3rem, 1.6rem + 2.6vw, 3.6rem);

  --margin-w: 168px;
  --gap: 56px;
  --max: 1200px;
  --radius: 14px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--ink-blue); text-underline-offset: 3px; }
a:hover { color: var(--ink-blue-deep); }
:focus-visible { outline: 3px solid var(--ink-blue); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; line-height: 1.12; letter-spacing: -0.015em; text-wrap: balance; margin: 0; }
p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- Sheet & margin line ---------- */
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: 24px; }
.sheet { position: relative; }
.sheet::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: max(24px, calc((100% - var(--max)) / 2 + 24px + var(--margin-w) + var(--gap) / 2));
  width: 1.5px; background: var(--margin-red); opacity: .45; pointer-events: none;
}
.row { display: grid; grid-template-columns: var(--margin-w) minmax(0, 1fr); column-gap: var(--gap); }
.row > .body { grid-column: 2; min-width: 0; }
.note {
  font-family: var(--font-hand); color: var(--ink-blue); font-size: 1.6rem; line-height: 1.1;
  transform: rotate(-3deg); transform-origin: left top; padding-top: .35rem;
}
.note small { display: block; font-size: 1.15rem; color: var(--ink-soft); margin-top: .2rem; }
.section { padding-block: clamp(64px, 8vw, 112px); }
.section + .section { border-top: 1px solid var(--rule); }
.section h2 { font-size: var(--step-3); max-width: 22ch; }
.lead { font-size: var(--step-1); color: var(--ink-soft); max-width: 58ch; margin-top: 1rem; line-height: 1.55; }
.tinted { background: var(--paper-deep); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 30px; color: var(--ink-blue); flex: none; }
.brand:hover { color: var(--ink); }
.brand i { font-style: italic; font-weight: 600; color: var(--ink-blue); }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.lang { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; font-size: .85rem; font-weight: 600; }
.lang a, .lang span { padding: 4px 10px; border-radius: 999px; text-decoration: none; color: var(--ink-soft); }
.lang [aria-current] { background: var(--ink); color: var(--paper); }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--rule); border-radius: 10px; width: 42px; height: 42px; color: var(--ink); cursor: pointer; }
.menu-btn svg { width: 20px; height: 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 1rem/1 var(--font-body); padding: 16px 24px; border-radius: 12px;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--ink-blue); color: var(--card); box-shadow: 0 2px 0 var(--ink-blue-deep); }
.btn-primary:hover { background: var(--ink-blue-deep); color: var(--card); transform: translateY(-1px); }
.btn-ghost { color: var(--ink); border-color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-sm { padding: 10px 16px; font-size: .9rem; border-radius: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(48px, 7vw, 96px) clamp(56px, 8vw, 104px); }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 35px 36px);
  opacity: .55;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
          mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.hero .sheet { isolation: isolate; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 56px); align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--approve); }
.hero h1 { font-size: var(--step-4); margin-top: 18px; max-width: 15ch; }
.ink-word { position: relative; white-space: nowrap; font-style: italic; color: var(--ink-blue); }
.ink-word svg { position: absolute; left: -2%; bottom: -0.2em; width: 104%; height: .42em; overflow: visible; }
.ink-word path { fill: none; stroke: var(--ink-blue); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 420; stroke-dashoffset: 0; animation: draw 1.1s .35s cubic-bezier(.6,.1,.3,1) backwards; }
@keyframes draw { from { stroke-dashoffset: 420; } }
.hero .lead { margin-top: 22px; }
.hero .actions { margin-top: 32px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 28px 0 0; padding: 0; list-style: none; font-size: .92rem; color: var(--ink-soft); }
.trust li { display: inline-flex; align-items: center; gap: 8px; }
.trust svg { width: 16px; height: 16px; color: var(--approve); flex: none; }

/* ---------- Telegram mock ---------- */
.demo { position: relative; display: grid; gap: 18px; padding: 8px 0 8px 8px; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 1px 0 var(--rule), 0 18px 40px -24px rgba(30, 38, 56, .35); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule); font-size: .88rem; }
.panel-head b { font-weight: 600; }
.panel-head span { color: var(--ink-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: var(--card); background: #8C6A4F; flex: none; }
.avatar.bot { background: var(--ink-blue); }
.avatar.bot svg { width: 18px; height: 18px; color: var(--card); }
.msgs { display: grid; gap: 8px; padding: 14px 16px 16px; }
.bubble { max-width: 88%; padding: 9px 13px 7px; border-radius: 14px; font-size: .95rem; line-height: 1.45; background: var(--paper-deep); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.out { justify-self: end; background: var(--ink-blue-wash); border-radius: 14px; border-bottom-right-radius: 4px; }
.bubble time { display: block; text-align: right; font-size: .72rem; color: var(--ink-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }
.bubble .who { display: block; font-size: .78rem; font-weight: 600; color: #8C6A4F; margin-bottom: 1px; }
.draft { padding: 14px 16px 16px; display: grid; gap: 10px; }
.draft-label { font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.draft-text { font-size: .98rem; line-height: 1.5; border-left: 3px solid var(--ink-blue); padding: 2px 0 2px 12px; }
.draft-meta { font-size: .8rem; color: var(--ink-soft); }
.kbd { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 2px; }
.kbd span { display: block; text-align: center; padding: 8px 6px; border-radius: 9px; background: var(--paper); border: 1px solid var(--rule); font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd span.go { background: var(--ink-blue); border-color: var(--ink-blue); color: var(--card); }
.flag { display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; line-height: 1.4; padding: 8px 10px; border-radius: 9px; background: var(--margin-red-wash); color: #7A2A1A; }
.flag svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.flag.info { background: var(--ink-blue-wash); color: var(--ink-blue-deep); }

.hand { position: absolute; font-family: var(--font-hand); font-size: 1.45rem; line-height: 1; color: var(--margin-red); display: flex; align-items: center; gap: 4px; white-space: nowrap; pointer-events: none; }
.hand svg { width: 46px; height: 30px; flex: none; }
.hand path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hand-1 { right: -12px; top: 40%; transform: rotate(4deg); }
.hand-2 { left: 24px; bottom: -34px; transform: rotate(-3deg); }
.demo { margin-bottom: 28px; }

.demo .panel { animation: rise .6s cubic-bezier(.2,.7,.2,1) backwards; }
.demo .panel:nth-of-type(2) { animation-delay: .5s; }
.demo .hand { animation: fade .6s 1.1s backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Pain ---------- */
.pains { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin-top: 44px; }
.pain { display: grid; gap: 10px; align-content: start; }
.pain .big { font-family: var(--font-display); font-size: var(--step-2); font-weight: 650; line-height: 1.15; color: var(--ink); }
.pain p { color: var(--ink-soft); }
.pain .strike { position: relative; display: inline; background: linear-gradient(var(--margin-red), var(--margin-red)) no-repeat 0 58% / 100% 2px; }

/* ---------- Steps ---------- */
.steps { list-style: none; padding: 0; margin: 44px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; counter-reset: step; }
.steps li { counter-increment: step; display: grid; gap: 8px; align-content: start; padding-top: 18px; border-top: 2px solid var(--ink); }
.steps li::before { content: counter(step); font-family: var(--font-hand); font-size: 2.6rem; line-height: .8; color: var(--ink-blue); }
.steps h3 { font-size: var(--step-1); }
.steps p { color: var(--ink-soft); font-size: .98rem; }

/* ---------- Features ---------- */
.features { display: grid; gap: clamp(56px, 7vw, 96px); margin-top: 52px; }
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: center; }
.feature:nth-child(even) .feature-art { order: -1; }
.feature h3 { font-size: var(--step-2); max-width: 20ch; }
.feature p { margin-top: 14px; color: var(--ink-soft); max-width: 50ch; }
.feature ul { margin: 14px 0 0; padding-left: 1.1em; color: var(--ink-soft); display: grid; gap: 4px; }
.soon { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--margin-red); border: 1.5px solid var(--margin-red); border-radius: 999px; padding: 3px 10px; vertical-align: middle; white-space: nowrap; }
.feature .soon { margin-bottom: 14px; }
.feature-art { min-width: 0; }
.pair { display: grid; gap: 14px; }
.pair .panel { padding: 14px 16px; }
.pair .to { font-size: .8rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.pair .bubble { max-width: 100%; }

.timeline { position: relative; padding: 22px 18px 18px; }
.tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tl li { display: grid; grid-template-columns: 64px 18px minmax(0, 1fr); gap: 12px; align-items: start; padding-bottom: 18px; position: relative; }
.tl li:last-child { padding-bottom: 0; }
.tl time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .95rem; text-align: right; }
.tl .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink-soft); background: var(--card); margin-top: 6px; position: relative; z-index: 1; }
.tl li:not(:last-child)::after { content: ""; position: absolute; left: calc(64px + 12px + 5px); top: 20px; bottom: 0; width: 2px; background: var(--rule); }
.tl .dot.ok { border-color: var(--approve); background: var(--approve); }
.tl .dot.wait { border-style: dashed; }
.tl span { font-size: .95rem; }
.tl span em { display: block; font-style: normal; color: var(--ink-soft); font-size: .85rem; }

/* ---------- Compare ---------- */
.table-scroll { position: relative; overflow-x: auto; margin-top: 40px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.compare { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 820px; font-size: .95rem; }
.compare th, .compare td { padding: 14px 16px; text-align: center; border-bottom: 1px solid var(--rule); vertical-align: middle; background: var(--card); }
.compare tbody tr:last-child > * { border-bottom: 0; }
.compare tbody th { text-align: left; font-weight: 600; width: 26%; line-height: 1.35; }
.compare thead th { font-size: .82rem; font-weight: 700; letter-spacing: .02em; color: var(--ink); line-height: 1.25; vertical-align: bottom; }
.compare thead th small { display: block; font-size: .74rem; font-weight: 400; letter-spacing: 0; color: var(--ink-soft); margin-top: 4px; }
.compare .us { background: var(--ink-blue-wash); width: 17%; }
.compare thead th.us { color: var(--ink-blue); font-family: var(--font-display); font-size: 1.1rem; letter-spacing: 0; }
.compare thead th.us small { color: var(--ink-blue-deep); font-family: var(--font-body); }
.compare tbody tr:last-child .us { border-bottom-left-radius: 0; }
.yes, .no, .part { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .84rem; line-height: 1.3; }
.yes svg, .no svg { width: 22px; height: 22px; }
.yes { color: var(--approve); font-weight: 600; }
.no { color: var(--ink-soft); }
.part { color: var(--ink-soft); }
.price-cell { font-size: .9rem; color: var(--ink-blue-deep); }
.compare .soon { font-size: .68rem; padding: 2px 8px; }
.table-note { margin-top: 12px; font-size: .85rem; color: var(--ink-soft); }

/* ---------- Privacy ---------- */
.facts { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.facts li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding: 20px 0; border-top: 1px solid var(--rule); }
.facts svg { width: 26px; height: 26px; color: var(--ink-blue); }
.facts b { display: block; font-weight: 600; margin-bottom: 4px; }
.facts p { color: var(--ink-soft); font-size: .97rem; }
.facts code { font-family: var(--font-body); font-weight: 600; color: var(--ink); background: var(--paper-deep); padding: 1px 6px; border-radius: 5px; font-size: .92em; }

/* ---------- Pricing ---------- */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 40px; max-width: 880px; }
.plan { display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; padding: 28px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--card); }
.plan.featured { border: 2px solid var(--ink-blue); }
.plan h3 { font-size: var(--step-1); }
.plan .price { font-family: var(--font-display); font-size: var(--step-2); font-weight: 650; line-height: 1.1; }
.plan .price small { display: block; font-family: var(--font-body); font-size: .9rem; font-weight: 400; color: var(--ink-soft); margin-top: 6px; }
.plan ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; color: var(--ink-soft); font-size: .97rem; }
.plan li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; }
.plan li svg { width: 18px; height: 18px; color: var(--approve); margin-top: 4px; }
.plan .btn { width: 100%; margin-top: 8px; }

/* ---------- Next ---------- */
.next { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; padding: 0; list-style: none; }
.next li { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1.5px dashed var(--ink-soft); border-radius: 999px; font-weight: 500; }
.next svg { width: 18px; height: 18px; color: var(--ink-blue); }

/* ---------- FAQ ---------- */
.faq { margin-top: 36px; border-top: 1px solid var(--rule); max-width: 820px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 20px 0; font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; line-height: 1.3; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-body); font-weight: 400; font-size: 1.7rem; line-height: 1; color: var(--ink-blue); transition: transform .2s ease; flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 0 22px; color: var(--ink-soft); max-width: 66ch; display: grid; gap: 10px; }

/* ---------- Final CTA ---------- */
.final { text-align: left; }
.final h2 { font-size: var(--step-4); max-width: 16ch; }
.final h2 .ink-word svg { height: .35em; }
.final .lead { margin-top: 18px; }
.final .actions { margin-top: 30px; }
.final .fine { margin-top: 16px; font-size: .92rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: 28px; font-size: .9rem; color: var(--ink-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.site-footer .brand { font-size: 1.05rem; }
.site-footer .brand svg { width: 24px; height: 24px; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; margin-left: auto; }
.site-footer a { color: var(--ink-soft); }

[data-repo-link][hidden] { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  :root { --margin-w: 120px; --gap: 40px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: 16ch; }
  .demo { max-width: 560px; }
  .hand-1 { right: -8px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }
}
@media (max-width: 860px) {
  .sheet::before { display: none; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row > .body { grid-column: 1; }
  .note { margin-bottom: 14px; font-size: 1.45rem; }
  .note small { display: inline; margin-left: 6px; }
  .nav { display: none; }
  .menu-btn { display: inline-grid; place-items: center; }
  .site-header .lang { margin-left: 0; }
  .header-cta { display: none; }
  .nav.open { display: grid; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 8px 16px 16px; gap: 0; }
  .nav.open a { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 1.05rem; color: var(--ink); }
  .pains { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .feature { grid-template-columns: minmax(0, 1fr); }
  .feature:nth-child(even) .feature-art { order: 0; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .plans { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding-inline: 16px; }
  .site-header .wrap { gap: 12px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .hand-1 { display: none; }
  .demo { padding-left: 0; }
  .actions .btn { width: 100%; }
  .plan { padding: 22px; }
  .ink-word { white-space: normal; }
  .hero .note { display: none; }
  .compare { min-width: 640px; font-size: .84rem; }
  .compare th, .compare td { padding: 12px 8px; }
  .compare thead th { font-size: .72rem; }
  .compare tbody th, .compare thead th:first-child { position: sticky; left: 0; z-index: 2; width: 120px; min-width: 120px; box-shadow: 1px 0 0 var(--rule); }
  .compare .us { position: sticky; left: 120px; z-index: 2; width: 104px; min-width: 104px; box-shadow: 2px 0 6px -2px rgba(30, 38, 56, .18); }
  .compare .soon { font-size: .6rem; padding: 2px 5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
