/* Лендінг єДоказу — напрям «Аркуш акта» у світі «Опис справи» (DESIGN.md).
   Власна копія токенів розширення, як у verify.html: сайт не тягне стилі розширення.
   Волосяні лінійки замість карток і тіней, одна залита кнопка на екран,
   «нитка» лише в номерах документів і порожніх полях акта. */

:root {
  --ground: #e6e8e3;
  --paper: #ffffff;
  --ink: #1a1c1e;
  --ink-2: #4c544e;
  --rule: #cdd2ca;
  --field: #767f76;
  --board: #3f4a3c;
  --board-deep: #343f31;
  --board-ink: #f2f4ef;
  --board-muted: #c6cec2;
  --board-line: #5b6857;
  --thread: #a8342a;
  --thread-bg: #f7e9e6;
  --primary-bg: #1a1c1e;
  --primary-ink: #ffffff;
  --primary-hover: #34383b;
  --focus: #1a1c1e;
  --ok: #1d6b3f;
  --ok-bg: #e2efe5;
  --warn: #6f4a00;
  --warn-bg: #f6ecd0;
  --bad: #a61047;
  --bad-bg: #ffe6eb;

  --sans: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-ui: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --radius: 3px;

  --page: 68rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #141713;
    --paper: #1c201b;
    --ink: #e8eae5;
    --ink-2: #aab3a8;
    --rule: #333b32;
    --field: #7c867a;
    --board: #263022;
    --board-deep: #1f281c;
    --board-ink: #eef1eb;
    --board-muted: #b9c3b5;
    --board-line: #3e4a3a;
    --thread: #ec8b78;
    --thread-bg: #3a2420;
    --primary-bg: #e8eae5;
    --primary-ink: #141713;
    --primary-hover: #cdd2ca;
    --focus: #e8eae5;
    --ok: #86d3a2;
    --ok-bg: #16301f;
    --warn: #f0c56a;
    --warn-bg: #33290f;
    --bad: #f891a5;
    --bad-bg: #401722;
    color-scheme: dark;
  }
}

/* ---------- основа ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--fs-ui) / 1.5 var(--sans);
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--board);
  color: var(--board-ink);
}

a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-xl);
}

h2 {
  font-size: var(--fs-lg);
}

p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Скрол до якоря не ховає заголовок під липким меню. */
[id] {
  scroll-margin-top: 4.5rem;
}

.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--s5);
}

.skip {
  position: absolute;
  left: var(--s2);
  top: -3rem;
  z-index: 10;
  padding: var(--s2) var(--s4);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

.skip:focus {
  top: var(--s2);
}

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

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 2.5rem;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover,
button:hover {
  border-color: var(--ink);
}

/* Одна залита кнопка на екрані — головна дія. */
.btn-primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--primary-ink);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---------- меню ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.bar-inner {
  display: flex;
  align-items: center;
  gap: var(--s4);
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-lg);
  font-weight: 600;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--s5);
  margin-left: auto;
}

.nav a:not(.btn) {
  color: var(--ink-2);
  text-decoration: none;
}

.nav a:not(.btn):hover {
  color: var(--ink);
  text-decoration: underline;
}

.nav .btn {
  min-height: 2.25rem;
}

/* На вузькому екрані лишаються знак і кнопка: розділи видно прокручуванням. */
@media (max-width: 799px) {
  .nav a:not(.btn) {
    display: none;
  }
}

/* ---------- перший екран ---------- */

.hero {
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--s7);
  align-items: center;
  padding-top: var(--s7);
  padding-bottom: var(--s7);
}

.hero-text {
  display: grid;
  gap: var(--s4);
  max-width: 34rem;
}

.lead {
  font-size: var(--fs-md);
  color: var(--ink-2);
  max-width: 68ch;
}

.hero-note {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.hero-act figcaption {
  margin-top: var(--s2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

@media (max-width: 879px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s6);
    padding-top: var(--s6);
    padding-bottom: var(--s6);
  }
}

/* ---------- аркуш акта ---------- */

.sheet {
  padding: var(--s6) var(--s7);
  background: var(--paper);
  border: 1px solid var(--rule);
  font: var(--fs-md) / 1.62 var(--serif);
  font-variant-numeric: normal;
  hyphens: auto;
}

.act-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.act-subtitle {
  text-align: center;
  font-weight: 600;
  margin-bottom: var(--s4);
}

.act-split {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}

.act-heading {
  margin: var(--s4) 0 var(--s1);
  font-weight: 600;
}

.act-para {
  text-indent: 2.2em;
  margin-bottom: var(--s2);
}

.act-url {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Порожнє поле акта — нитка: тло, підкреслення й курсив. */
.act-empty {
  padding: 0 2px;
  background: var(--thread-bg);
  border-bottom: 2px solid var(--thread);
  color: var(--thread);
  font-style: italic;
}

@media (max-width: 560px) {
  .sheet {
    padding: var(--s5) var(--s4);
  }

  .act-para {
    text-indent: 0;
  }
}

/* ---------- розділи ---------- */

.section {
  padding: var(--s7) 0;
  border-bottom: 1px solid var(--rule);
}

/* Заголовок розділу ліворуч, зміст праворуч — як графа в описі справи. */
.split {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: var(--s6);
  align-items: start;
}

.section > .wrap > h2 {
  margin-bottom: var(--s5);
}

@media (max-width: 799px) {
  .section {
    padding: var(--s6) 0;
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s4);
  }
}

.note {
  margin-top: var(--s4);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  max-width: 75ch;
}

/* ---------- знімки ---------- */

/* Ширини колонок — у пропорції знімків (380×560 і 1280×900), тож popup і результат однакової висоти. */
.shots {
  display: grid;
  grid-template-columns: minmax(0, 0.68fr) minmax(0, 1.42fr);
  gap: var(--s6) var(--s5);
  align-items: start;
}

.shots-note {
  display: grid;
  gap: var(--s2);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
}

.shots-note h3 {
  font-size: var(--fs-md);
}

.shots-note p {
  color: var(--ink-2);
}

.shot img {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--ground);
}

.shot figcaption {
  margin-top: var(--s2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

@media (max-width: 799px) {
  .shots {
    grid-template-columns: minmax(0, 1fr);
  }

  .shot-popup {
    max-width: 380px;
  }
}

/* ---------- пакет доказів ---------- */

.docs {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: var(--s6);
  counter-reset: doc;
}

.docs li {
  break-inside: avoid;
  position: relative;
  padding: var(--s3) 0 var(--s3) var(--s6);
  border-top: 1px solid var(--rule);
  counter-increment: doc;
}

/* Номер документа в пакеті — нитка (The Thread Rule). */
.docs li::before {
  content: counter(doc);
  position: absolute;
  left: 0;
  top: var(--s3);
  color: var(--thread);
  font-weight: 600;
}

.docs b,
.who dt,
.prices b {
  font-weight: 600;
}

.docs-video {
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  max-width: 75ch;
}

@media (max-width: 799px) {
  .docs {
    columns: 1;
  }
}

/* ---------- лінія станцій ---------- */

.stations {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s5);
}

.stations > li {
  position: relative;
  padding-top: var(--s6);
}

/* Лінія від кружка до наступної станції. */
.stations > li::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 20px;
  right: calc(-1 * var(--s5));
  height: 2px;
  background: var(--rule);
}

.stations > li:last-child::before {
  display: none;
}

.station-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--field);
  background: var(--paper);
}

.stations > li.now .station-mark {
  border-color: var(--ink);
  background: var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.station-title {
  font-weight: 600;
}

.station-body {
  margin-top: var(--s1);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

@media (max-width: 799px) {
  .stations {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .stations > li {
    padding: 0 0 var(--s5) var(--s6);
  }

  .stations > li::before {
    top: 14px;
    left: 9px;
    right: auto;
    bottom: -4px;
    width: 2px;
    height: auto;
  }

  .station-mark {
    top: 2px;
  }
}

/* ---------- для кого ---------- */

.who {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s6);
}

.who > div {
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
}

.who dd {
  margin-top: var(--s1);
  color: var(--ink-2);
}

@media (max-width: 799px) {
  .who {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s4);
  }
}

/* ---------- ціни ---------- */

.prices {
  width: 100%;
  border-collapse: collapse;
}

.prices th,
.prices td {
  padding: var(--s3) 10px;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.prices th:first-child,
.prices td:first-child {
  padding-left: 0;
}

.prices thead th {
  border-top: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
}

.prices tbody th {
  font-weight: 400;
}

.prices tbody th span {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.prices .num {
  text-align: right;
  white-space: nowrap;
}

.prices tbody .num {
  font-size: var(--fs-md);
  font-weight: 600;
}

.prices tr > :last-child {
  padding-right: 0;
}

/* ---------- смуга оформлення ---------- */

.band {
  padding: var(--s7) 0;
  background: var(--board);
  color: var(--board-ink);
}

.band-intro {
  display: grid;
  gap: var(--s3);
  align-content: start;
}

.band-intro p {
  color: var(--board-muted);
  max-width: 40ch;
}

.band a {
  color: var(--board-ink);
}

.band :focus-visible {
  outline-color: var(--board-ink);
}

@media (max-width: 799px) {
  .band {
    padding: var(--s6) 0;
  }
}

/* ---------- форма ---------- */

.buy {
  display: grid;
  gap: var(--s4);
  max-width: 30rem;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend,
.field > label {
  display: block;
  margin-bottom: var(--s1);
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
}

.hint {
  font-weight: 400;
  color: var(--board-muted);
}

input[type='text'],
input[type='email'] {
  width: 100%;
  min-height: 2.5rem;
  padding: var(--s2) 10px;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

input:focus-visible {
  outline-offset: 0;
}

input[aria-invalid='true'] {
  border-color: var(--bad);
}

/* Назва АО: JavaScript знімає hidden і робить поле обов'язковим; без нього поле показує CSS. */
.buy:has(input[name='plan'][value='firm']:checked) [data-org][hidden] {
  display: block;
}

/* Сума й період у згоді: з :has речення вибирає CSS (і без JavaScript), у старіших браузерах — hidden із form.js. */
@supports selector(:has(*)) {
  .buy [data-consent] {
    display: none;
  }

  .buy:has(input[name='plan'][value='personal']:checked):has(input[name='interval'][value='1m']:checked) [data-consent='personal-1m'],
  .buy:has(input[name='plan'][value='personal']:checked):has(input[name='interval'][value='1y']:checked) [data-consent='personal-1y'],
  .buy:has(input[name='plan'][value='firm']:checked):has(input[name='interval'][value='1m']:checked) [data-consent='firm-1m'],
  .buy:has(input[name='plan'][value='firm']:checked):has(input[name='interval'][value='1y']:checked) [data-consent='firm-1y'] {
    display: inline;
  }
}

.field-error {
  margin-top: var(--s1);
  font-size: var(--fs-sm);
  color: var(--bad);
}

.field-error:empty {
  display: none;
}

/* Сегменти рівної ширини; вибраний — рамкою, без заливки. */
.segmented {
  display: flex;
}

.segmented label {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 6px var(--s2);
  margin-left: -1px;
  text-align: center;
  border: 1px solid var(--field);
  background: var(--paper);
  color: var(--ink);
}

.segmented label:first-child span {
  margin-left: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.segmented label:last-child span {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.segmented input:checked + span {
  position: relative;
  z-index: 1;
  border-color: var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -2px;
  font-weight: 600;
}

.segmented input:focus-visible + span {
  position: relative;
  z-index: 2;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (forced-colors: active) {
  .segmented input:checked + span {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
}

.consent {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.consent input {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 1px 0 0;
  accent-color: var(--ink);
}

/* На картоні поля й сегменти — тло board-deep, межа board-muted (DESIGN.md, Inputs). */
.band input[type='text'],
.band input[type='email'],
.band .segmented span {
  background: var(--board-deep);
  border-color: var(--board-muted);
  color: var(--board-ink);
}

.band input:focus-visible {
  border-color: var(--board-ink);
}

.band .segmented input:checked + span {
  border-color: var(--board-ink);
  outline-color: var(--board-ink);
}

.band .segmented input:focus-visible + span {
  outline-color: var(--board-ink);
}

.band .consent input {
  accent-color: var(--board-ink);
}

/* Помилки на картоні — пара bad / bad-bg, щоб кармін читався на оливковому тлі. */
.band .field-error {
  justify-self: start;
  padding: 2px var(--s2);
  border-radius: var(--radius);
  background: var(--bad-bg);
  color: var(--bad);
}

/* Головна кнопка на картоні — світла заливка: чорнило на темній смузі не читається. */
.band .btn-primary {
  justify-self: start;
  background: var(--board-ink);
  border-color: var(--board-ink);
  color: var(--board);
}

.band .btn-primary:hover {
  background: var(--board-muted);
  border-color: var(--board-muted);
}

.band button:disabled:hover {
  background: var(--board-ink);
  border-color: var(--board-ink);
}

/* ---------- повідомлення ---------- */

.notice {
  padding: 10px var(--s3);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}

.notice-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

/* ---------- питання ---------- */

.faq details {
  border-top: 1px solid var(--rule);
}

.faq details:last-child {
  border-bottom: 1px solid var(--rule);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

/* Знак «+/−» малюють дві лінійки, без символів-замінників іконок. */
.faq summary::after {
  content: '';
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 0.4em;
  background:
    linear-gradient(var(--ink-2), var(--ink-2)) center / 12px 2px no-repeat,
    linear-gradient(var(--ink-2), var(--ink-2)) center / 2px 12px no-repeat;
}

.faq details[open] summary::after {
  background: linear-gradient(var(--ink-2), var(--ink-2)) center / 12px 2px no-repeat;
}

.faq details p {
  padding: 0 0 var(--s4);
  color: var(--ink-2);
  max-width: 75ch;
}

/* ---------- окремі сторінки: оферта, політика, «Дякуємо», 404 ---------- */

.doc {
  background: var(--ground);
  padding: var(--s7) 0;
}

.doc-wrap {
  max-width: 48rem;
}

.doc-wrap > * + * {
  margin-top: var(--s3);
}

.doc-wrap h1 + * {
  margin-top: var(--s2);
}

.doc-wrap h2 {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-md);
}

.doc-wrap p,
.doc-wrap li {
  max-width: 75ch;
}

.doc-wrap ul {
  padding-left: 1.25em;
}

.doc-wrap ul > li + li {
  margin-top: var(--s1);
}

.doc-meta {
  color: var(--ink-2);
}

.doc .stations {
  margin-top: var(--s4);
}

.doc .stations .station-mark {
  background: var(--ground);
}

.doc .stations > li.now .station-mark {
  background: var(--ink);
}

.doc .prices {
  margin-top: var(--s3);
  max-width: 36rem;
}

.owner p + p {
  margin-top: 2px;
}

@media (max-width: 799px) {
  .doc {
    padding: var(--s6) 0;
  }
}

/* ---------- підвал ---------- */

.foot {
  padding: var(--s6) 0;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s3) var(--s6);
}

.foot a {
  color: var(--ink);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  align-content: start;
}

.foot-note {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .wrap {
    padding: 0 var(--s4);
  }

  .foot-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .band .btn-primary {
    justify-self: stretch;
  }
}
