/* ==========================================================
   LEAN UA — ctrgroup.com.ua
   Дизайн-система: «інженерна дошка Kaizen»
   ========================================================== */
:root {
  --navy: #13294b;
  --navy-2: #1d3a66;
  --navy-3: #2c5591;
  --ink: #1a2230;
  --muted: #5a6576;
  --paper: #f6f4ef;
  --surface: #ffffff;
  --line: #e2ddd2;
  --grid: rgba(19, 41, 75, .055);
  --amber: #f2a900;
  --amber-soft: #fff4d6;
  --red: #c8412e;
  --red-soft: #fbe9e5;
  --green: #2f7d4f;
  --green-soft: #e4f2e9;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --content: 1180px;
  --text: 760px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(19,41,75,.06), 0 6px 20px rgba(19,41,75,.06);

  --s1: .5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2rem; --s5: 3rem; --s6: 4.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *{transition:none!important} }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--navy-3); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--navy); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.22; color: var(--navy); margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 1.15rem + 1.2vw, 2rem); font-weight: 750; margin-top: 1.8em; }
h3 { font-size: 1.22rem; font-weight: 700; margin-top: 1.5em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; margin: 0 0 1.1em; }
li { margin-bottom: .35em; }
strong { color: var(--navy); }
.skip { position: absolute; left: -999px; top: 0; background: var(--amber); color: var(--ink); padding: .6rem 1rem; z-index: 100; font-weight: 700; }
.skip:focus { left: 1rem; top: 1rem; }
.wrap { width: min(100% - 2.5rem, var(--content)); margin-inline: auto; }
.visually-hidden { position:absolute!important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 244, 239, .94);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.logo { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--navy); }
.logo img { width: 112px; height: auto; }
.logo span { font-size: .78rem; line-height: 1.25; color: var(--muted); border-left: 1px solid var(--line); padding-left: .65rem; max-width: 9.5rem; }
.nav-toggle {
  display: none; align-items: center; gap: .5rem;
  font: inherit; font-weight: 650; font-size: .95rem; color: var(--navy);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display:block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; content: ""; }
.nav-toggle-bars::before { position: absolute; top: -6px; } .nav-toggle-bars::after { position: absolute; top: 6px; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem; }
.main-nav li { margin: 0; }
.main-nav a {
  display: block; padding: .5rem .7rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: .95rem; font-weight: 560;
}
.main-nav a:hover { background: rgba(19,41,75,.07); color: var(--navy); }
.main-nav a[aria-current="page"] { color: var(--navy); background: var(--amber-soft); box-shadow: inset 0 -2px 0 var(--amber); }

@media (max-width: 1280px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(19,41,75,.1); }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; padding: .5rem 1.25rem 1rem; }
  .main-nav a { padding: .8rem .6rem; font-size: 1.02rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .no-js .main-nav { display: block; position: static; box-shadow: none; }
  .no-js .nav-toggle { display: none; }
  .no-js .site-header .wrap { flex-wrap: wrap; }
}
@media (max-width: 420px) { .logo span { display: none; } }

/* ---------- Hero (головна) ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  border-bottom: 1px solid var(--line);
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem);
}
.hero-grid { display: grid; gap: 2.5rem; grid-template-columns: 1.15fr .85fr; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--navy); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: .3rem .8rem; margin-bottom: 1.1rem;
}
.eyebrow::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.hero .lead { font-size: clamp(1.08rem, 1rem + .4vw, 1.25rem); color: #364154; max-width: 40rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
  padding: .85rem 1.3rem; border-radius: 10px; border: 2px solid var(--navy);
  background: var(--navy); color: #fff; transition: transform .15s, background .15s;
}
.btn:hover { background: var(--navy-2); color: #fff; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--surface); color: var(--navy); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn-amber:hover { background: #ffbb1a; color: var(--ink); }

/* Потік створення цінності — схема на головній */
.flow-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem; box-shadow: var(--shadow); }
.flow-card h2 { font-size: 1rem; margin: 0 0 1rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.flow li { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; margin: 0; padding: .55rem .75rem; border-radius: 8px; font-size: .95rem; border-left: 4px solid; }
.flow .v { background: var(--green-soft); border-color: var(--green); }
.flow .w { background: var(--red-soft); border-color: var(--red); }
.flow .tag { font-family: var(--mono); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .45rem; border-radius: 4px; }
.flow .v .tag { color: var(--green); background: #fff; } .flow .w .tag { color: var(--red); background: #fff; }
.flow .t { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.flow-note { margin: 1rem 0 0; font-size: .88rem; color: var(--muted); }

/* ---------- Внутрішній hero ---------- */
.page-hero {
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 1.4rem 0 clamp(2rem, 4vw, 3rem);
}
.page-hero .lead { font-size: 1.15rem; color: #364154; max-width: 48rem; margin: 0; }
.crumbs ol { list-style: none; padding: 0; margin: 0 0 1.4rem; display: flex; flex-wrap: wrap; gap: .3rem; font-size: .88rem; color: var(--muted); }
.crumbs li { margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: .3rem; color: #a7aebb; }
.crumbs a { color: var(--muted); }

/* ---------- Розкладка контенту ---------- */
.content { padding: clamp(2rem, 5vw, 3.5rem) 0 1rem; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 3rem; align-items: start; }
.layout > article { max-width: var(--text); }
.layout > article > :first-child { margin-top: 0; }
@media (max-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr) !important; } .toc { order: -1; } }
.toc { position: sticky; top: 92px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; font-size: .92rem; }
@media (max-width: 980px) { .toc { position: static; } }
.toc h2 { font-size: .8rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .6rem; }
.toc ol { margin: 0; padding-left: 1.1em; }
.toc li { margin-bottom: .3rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--navy-3); text-decoration: underline; }
.prose h2 { scroll-margin-top: 90px; }
.prose h3 { scroll-margin-top: 90px; }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 46rem; margin-bottom: 2rem; }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--muted); font-size: 1.08rem; }

/* ---------- Блоки ---------- */
.callout { border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: 0 var(--r) var(--r) 0; padding: 1rem 1.2rem; margin: 1.5rem 0; }
.callout p:last-child { margin: 0; }
.callout-title { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: #7a5600; margin-bottom: .3rem; display: block; }
.answer { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 0 var(--r) var(--r) 0; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.answer p:last-child { margin: 0; }
.example { background: var(--surface); border: 1px dashed #c9c2b3; border-radius: var(--r); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.example p:last-child, .example ul:last-child { margin-bottom: 0; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.25rem 1.25rem 1.1rem; box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: transform .15s, border-color .15s;
}
a.card:hover { transform: translateY(-2px); border-color: var(--navy-3); color: var(--ink); }
.card h3 { margin: 0; font-size: 1.1rem; }
.card p { margin: 0; font-size: .95rem; color: var(--muted); }
.card .more { margin-top: auto; padding-top: .5rem; font-weight: 650; font-size: .92rem; color: var(--navy-3); }
.card .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); margin-bottom: .3rem; }
.card .ico svg { width: 26px; height: 26px; }
.card .num { position: absolute; top: 1rem; right: 1.1rem; font-family: var(--mono); font-weight: 700; color: #c9c2b3; font-size: .9rem; }
.card.is-value .ico { background: var(--green-soft); color: var(--green); }
.card.is-navy .ico { background: #e6ecf5; color: var(--navy); }

/* Ланцюг принципів */
.steps { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; counter-reset: s; }
.steps li { counter-increment: s; margin: 0; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 2.4rem .9rem .9rem; font-size: .93rem; }
.steps li::before { content: counter(s); position: absolute; top: .7rem; left: .9rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 700; font-size: .85rem; }
.steps li:not(:last-child)::after { content: ""; position: absolute; right: -.55rem; top: 1.15rem; width: .5rem; height: 2px; background: var(--amber); }
.steps strong { display: block; margin-bottom: .2rem; }
.steps span { color: var(--muted); font-size: .88rem; }

.steps.s4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .steps, .steps.s4 { grid-template-columns: 1fr; } .steps li:not(:last-child)::after { right: auto; left: 1.65rem; top: auto; bottom: -.6rem; width: 2px; height: .6rem; } }

/* Таймлайн */
.timeline { list-style: none; margin: 1.5rem 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; margin: 0 0 1.2rem; padding-left: 1.4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .45rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--amber); }
.timeline .yr { font-family: var(--mono); font-weight: 700; color: var(--navy); margin-right: .4rem; }

/* Статистика / факти */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 2rem; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; }
.fact b { display: block; font-size: 1.7rem; line-height: 1.1; color: var(--navy); font-weight: 800; }
.fact span { display: block; font-size: .86rem; line-height: 1.4; color: var(--muted); margin-top: .25rem; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr 1fr; } .facts .fact:last-child { grid-column: 1 / -1; } }

/* Порівняння */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.compare > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.compare h3 { margin-top: 0; }
@media (max-width: 680px) { .compare { grid-template-columns: 1fr; } }

/* Таблиці */
.table-wrap { overflow-x: auto; margin: 1.2rem 0 1.6rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; min-width: 520px; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0ede6; color: var(--navy); font-weight: 700; }
tr:last-child td { border-bottom: 0; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .6rem; }
.faq summary { cursor: pointer; padding: 1rem 1.2rem; font-weight: 650; color: var(--navy); list-style: none; position: relative; padding-right: 3rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 1.2rem; top: .85rem; font-size: 1.3rem; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq .a { padding: 0 1.2rem 1rem; }
.faq .a p:last-child { margin: 0; }
.qa-group { margin-bottom: 2.4rem; }

/* Глосарій */
.gloss-index { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.gloss-index li { margin: 0; }
.gloss-index a { display: inline-block; padding: .3rem .65rem; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: .9rem; color: var(--navy); }
.gloss dl { margin: 0; }
.gloss dt { font-weight: 750; color: var(--navy); font-size: 1.08rem; margin-top: 1.4rem; scroll-margin-top: 90px; }
.gloss dt small { font-weight: 500; color: var(--muted); font-size: .9rem; }
.gloss dd { margin: .3rem 0 0; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }

/* TIMWOODS */
.acronym { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 1.4rem; padding: 0; list-style: none; }
.acronym li { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; font-size: .88rem; }
.acronym b { font-family: var(--mono); color: var(--red); font-size: 1rem; margin-right: .2rem; }

/* Пов'язані */
.related { margin: 2.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.related h2 { font-size: 1.15rem; margin: 0 0 1rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.pager a { flex: 1 1 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--navy-3); }
.pager small { display: block; color: var(--muted); font-size: .8rem; }
.pager .next { text-align: right; }

/* ---------- CTA / форма ---------- */
.cta {
  background: var(--navy); color: #e8edf5;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 28px 28px;
  padding: clamp(2.5rem, 6vw, 4rem) 0; margin-top: clamp(2.5rem, 6vw, 4rem);
}
.cta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 860px) { .cta-grid { grid-template-columns: 1fr; } }
.cta h2 { color: #fff; margin-top: 0; }
.cta p { color: #c9d3e3; }
.cta ul { color: #c9d3e3; padding-left: 0; list-style: none; }
.cta li { padding-left: 1.6rem; position: relative; }
.cta li::before { content: ""; position: absolute; left: 0; top: .55em; width: .75rem; height: .75rem; border-radius: 50%; background: var(--amber); }
.form { background: var(--surface); color: var(--ink); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.form .row { margin-bottom: .95rem; }
.form label { display: block; font-weight: 650; font-size: .92rem; margin-bottom: .3rem; color: var(--navy); }
.form label small { font-weight: 400; color: var(--muted); }
.form input, .form textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: .7rem .8rem; border: 1px solid #cfc8b9; border-radius: 8px; background: #fffdf9;
}
.form input:focus, .form textarea:focus { border-color: var(--navy-3); outline: 3px solid rgba(242,169,0,.45); outline-offset: 0; }
.form textarea { min-height: 110px; resize: vertical; }
.form .btn { width: 100%; }
.form .hp { position: absolute; left: -5000px; }
.form .form-note, .cta .form .form-note { font-size: .82rem; color: var(--muted); margin: .7rem 0 0; }

/* ---------- Footer ---------- */
.site-footer { background: #0e1f3a; color: #aab6c9; font-size: .93rem; padding: 2.5rem 0 1.5rem; }
.cta + .site-footer { border-top: 1px solid rgba(255,255,255,.08); }
.footer-grid { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); gap: 2rem; }
@media (max-width: 1100px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2 { color: #fff; font-size: .82rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .07em; margin: 0 0 .8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .4rem; }
.site-footer a { color: #d5deeb; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.footer-logo { background: #fff; border-radius: 8px; padding: .4rem .6rem; display: inline-block; margin-bottom: .8rem; }
.footer-logo img { width: 96px; }

/* 404 / подяка */
.center-page { text-align: center; padding: clamp(3rem, 10vw, 6rem) 0; }
.center-page .code { font-family: var(--mono); font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; color: var(--amber); line-height: 1; margin-bottom: 1rem; }
.center-page .btn-row { justify-content: center; }

@media print {
  .site-header, .cta, .site-footer, .toc, .nav-toggle { display: none !important; }
  body { background: #fff; }
}

/* Меню з 9 пунктів: компактніше на середніх екранах */
@media (min-width: 1281px) {
  .logo span { display: none; }
  .main-nav a { padding: .5rem .5rem; font-size: .93rem; }
}
