/* uokmr.com.ua — dark editorial / tech theme: graphite + sage teal, brass secondary */

:root {
  color-scheme: dark;

  /* palette */
  --bg: #101317;
  --bg-deep: #0c0e12;
  --surface: #161a1f;
  --surface-2: #1c2128;
  --surface-3: #232932;
  --line: #2a313b;
  --line-strong: #37404c;

  --text: #dce0e5;
  --text-head: #eef0f3;
  --muted: #a0a9b4;
  --faint: #8a939e;

  --accent: #6cc2ae;
  --accent-strong: #8ad4c2;
  --accent-soft: rgba(108, 194, 174, 0.12);
  --accent-line: rgba(108, 194, 174, 0.38);
  --visited: #a9b9e0;

  --brass: #d2ad6a;
  --brass-soft: rgba(210, 173, 106, 0.12);
  --threat: #e58a8f;

  --selection-bg: rgba(108, 194, 174, 0.3);
  --focus: #9fe3d2;

  /* typography */
  --f-head: "Onest", "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --f-body: "Literata", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono", "Fira Code", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --fs-base: 1.03125rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.8125rem;
  --lh-body: 1.72;
  --lh-head: 1.3;

  /* spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* shape */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --border: 1px solid var(--line);

  /* layout */
  --wrap: 1140px;
  --gutter: 16px;
  --measure: 70ch;

  --t: 0.18s ease;
}

/* reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
  background: var(--bg);
  scrollbar-color: var(--line-strong) var(--bg-deep);
  scrollbar-width: thin;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(108, 194, 174, 0.035), transparent 420px),
    var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: var(--lh-body);
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection-bg); color: var(--text-head); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: #4a5462; }

img, picture, video, canvas, svg, iframe {
  display: block;
  max-width: 100%;
  height: auto;
}
img, video { border-radius: var(--radius); filter: brightness(0.92); }

/* links */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--t), text-decoration-color var(--t), background-color var(--t), border-color var(--t);
}
a:visited { color: var(--visited); text-decoration-color: rgba(169, 185, 224, 0.4); }
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* forms */
input, textarea, select, button {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: var(--border);
  border-radius: var(--radius);
}
input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus-visible, textarea:focus-visible, select:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent-line);
  outline-offset: 0;
}
button, [type="button"], [type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--s-2) var(--s-5);
  font-family: var(--f-head);
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-3);
  border-color: var(--line-strong);
  transition: background-color var(--t), border-color var(--t), color var(--t);
}
button:hover, [type="button"]:hover, [type="submit"]:hover { border-color: var(--accent); color: var(--text-head); }
button:active, [type="submit"]:active { background: var(--accent-soft); }

/* layout */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: var(--s-3);
  z-index: 300;
  padding: var(--s-2) var(--s-4);
  background: var(--surface-3);
  color: var(--text-head);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--f-head);
  text-decoration: none;
}
.skip:focus, .skip:focus-visible { left: var(--s-3); }

/* header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(16, 19, 23, 0.94);
  border-top: 3px solid var(--brass);
  border-bottom: var(--border);
}
@supports (backdrop-filter: blur(8px)) {
  .topbar { background: rgba(16, 19, 23, 0.84); backdrop-filter: blur(8px); }
}

.topbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  min-height: 60px;
  padding-top: var(--s-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  color: var(--text-head);
  text-decoration: none;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}
.brand:visited, .brand:hover { color: var(--text-head); }
.brand-mark { color: var(--accent); }

.menu {
  order: 3;
  width: 100%;
  display: flex;
  gap: var(--s-1);
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter) var(--s-1);
  overflow-x: auto;
  scrollbar-width: none;
  font-family: var(--f-head);
  font-size: 0.9375rem;
  font-weight: 500;
  width: calc(100% + var(--gutter) * 2);
}
.menu::-webkit-scrollbar { display: none; }
.menu a {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 var(--s-3);
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.menu a:visited { color: var(--muted); }
.menu a:hover { color: var(--text-head); border-bottom-color: var(--line-strong); }
.menu a[aria-current="page"] { color: var(--text-head); border-bottom-color: var(--accent); }

.lang {
  display: flex;
  gap: var(--s-1);
  margin-left: auto;
  padding: 3px;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
}
.lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 38px;
  padding: 0 var(--s-2);
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.lang a:visited { color: var(--muted); }
.lang a:hover { color: var(--text-head); background: var(--surface-2); }
.lang a[aria-current="true"] {
  color: var(--bg);
  background: var(--accent);
  font-weight: 700;
}

/* article head */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
  margin: var(--s-6) 0 var(--s-4);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--faint);
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:visited { color: var(--muted); }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

.post-head h1 {
  max-width: 34ch;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: clamp(1.3rem, 1.05rem + 1.3vw, 2rem);
  line-height: var(--lh-head);
  letter-spacing: -0.015em;
  color: var(--text-head);
  overflow-wrap: break-word;
  hyphens: auto;
}

.post-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin: var(--s-4) 0 var(--s-6);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.post-info > * { display: inline-flex; align-items: center; gap: var(--s-2); }
.post-info > * + *::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: var(--s-1);
}

/* cover */
.cover {
  max-width: calc(var(--wrap) + 160px);
  margin: 0 auto var(--s-6);
  padding: 0 var(--gutter);
}
.cover img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: var(--border);
  background: var(--surface);
}

/* grid */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-6);
}

.toc {
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  padding: var(--s-4);
  background: var(--surface);
  border: var(--border);
  border-left: 2px solid var(--brass);
  border-radius: var(--radius);
}
.toc-title {
  margin-bottom: var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}
.toc ol { list-style: none; display: grid; gap: var(--s-1); counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
  min-height: 36px;
  padding: var(--s-1) 0;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--faint);
}
.toc a:visited { color: var(--muted); }
.toc a:hover { color: var(--accent); }
.toc a:hover::before { color: var(--accent); }

/* article */
.post {
  min-width: 0;
  max-width: calc(var(--measure) + 2 * var(--s-5));
  padding: var(--s-5) var(--s-4);
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-lg);
}

.post > * + * { margin-top: 0; }
.post p { margin-bottom: 1.25em; }
.post .intro {
  font-size: 1.1rem;
  line-height: 1.68;
  color: var(--text-head);
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-5);
  border-bottom: var(--border);
}

.post h2, .post h3, .post h4 {
  font-family: var(--f-head);
  color: var(--text-head);
  line-height: var(--lh-head);
  overflow-wrap: break-word;
}
.post h2 {
  font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: var(--s-7) 0 var(--s-4);
  padding-top: var(--s-5);
  border-top: var(--border);
  position: relative;
}
.post h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
}
.post h3 {
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  font-weight: 600;
  margin: var(--s-6) 0 var(--s-3);
}
.post h4 { font-size: 1rem; font-weight: 600; margin: var(--s-5) 0 var(--s-2); }

/* lists */
.post ul, .post ol { margin: 0 0 1.25em; padding-left: var(--s-5); }
.post li { margin-bottom: var(--s-2); padding-left: var(--s-1); }
.post li::marker { color: var(--accent); }
.post ol li::marker { font-family: var(--f-mono); font-size: 0.9em; }
.post li > ul, .post li > ol { margin: var(--s-2) 0 0; }
.post ul ul li::marker { color: var(--brass); }

/* summary */
.summary {
  margin: var(--s-2) 0 var(--s-5);
  padding: var(--s-4) var(--s-5);
  background: var(--surface-2);
  border: var(--border);
  border-radius: var(--radius);
}
.summary-title {
  font-family: var(--f-head);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s-2) !important;
}
.summary p:last-child { margin-bottom: 0; }

/* terms */
.terms { display: grid; gap: var(--s-4); margin: 0 0 var(--s-5); }
.terms div {
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: var(--border);
  border-left: 2px solid var(--accent-line);
  border-radius: var(--radius);
}
.terms dt { font-family: var(--f-head); font-weight: 600; color: var(--text-head); margin-bottom: var(--s-1); }
.terms dd { color: var(--muted); }

/* blockquote */
.post blockquote, blockquote {
  margin: var(--s-6) 0;
  padding: var(--s-4) var(--s-5);
  background: var(--surface-2);
  border: var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}
.post blockquote p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.6;
  font-style: italic;
  color: #c8cdd4;
}
.post blockquote p + p { margin-top: var(--s-3); }
blockquote cite { display: block; margin-top: var(--s-3); font-family: var(--f-head); font-size: var(--fs-sm); font-style: normal; color: var(--faint); }

/* code */
code, kbd, samp, pre { font-family: var(--f-mono); font-size: 0.875em; }
:not(pre) > code {
  padding: 0.12em 0.4em;
  background: var(--surface-3);
  border: var(--border);
  border-radius: var(--radius-sm);
  color: #e6d3ad;
  overflow-wrap: anywhere;
}
pre {
  margin: var(--s-5) 0;
  padding: var(--s-4);
  max-width: 100%;
  overflow-x: auto;
  background: var(--bg-deep);
  border: var(--border);
  border-radius: var(--radius);
  line-height: 1.6;
  color: var(--text);
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-head);
  font-size: 0.8em;
}

/* tables */
.table-wrap, .post .table { max-width: 100%; overflow-x: auto; margin: var(--s-5) 0; }
table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: var(--s-5) 0;
  border-collapse: collapse;
  border: var(--border);
  border-radius: var(--radius);
  font-family: var(--f-head);
  font-size: 0.9375rem;
  -webkit-overflow-scrolling: touch;
}
th, td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  vertical-align: top;
  border-bottom: var(--border);
  min-width: 120px;
}
th {
  background: var(--surface-3);
  color: var(--text-head);
  font-weight: 600;
  white-space: nowrap;
}
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
tbody tr:hover { background: var(--accent-soft); }
tr:last-child td { border-bottom: 0; }

/* misc */
hr {
  height: 1px;
  margin: var(--s-7) 0;
  border: 0;
  background: linear-gradient(90deg, var(--accent-line), var(--line) 30%, transparent);
}
figure { margin: var(--s-6) 0; }
figure img { border: var(--border); }
figcaption {
  margin-top: var(--s-2);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--muted);
}
small { font-size: var(--fs-sm); color: var(--muted); }
mark {
  padding: 0 0.2em;
  background: var(--brass-soft);
  color: #f0d9a8;
  border-bottom: 1px solid rgba(210, 173, 106, 0.5);
  border-radius: 2px;
}
abbr[title] { text-decoration: underline dotted var(--faint); cursor: help; }
strong, b { font-weight: 700; color: var(--text-head); }

/* more */
.more {
  margin-top: var(--s-8);
  padding: var(--s-7) 0;
  background: var(--bg-deep);
  border-top: var(--border);
}
.more h2 {
  margin-bottom: var(--s-5);
  font-family: var(--f-head);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: var(--lh-head);
  color: var(--text-head);
}
.more-list { list-style: none; display: grid; gap: var(--s-3); }
.more-list li { margin: 0; }
.more-list a {
  display: grid;
  gap: var(--s-1) var(--s-5);
  padding: var(--s-4);
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius);
}
.more-list a:visited { color: var(--text); }
.more-list a:hover { border-color: var(--accent-line); background: var(--surface-2); }
.more-list a:hover .more-name { color: var(--accent); }
.more-topic {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.more-topic.is-threat { color: var(--threat); }
.more-name {
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text-head);
  transition: color var(--t);
}
.more-desc { color: var(--muted); font-size: 0.95rem; line-height: 1.6; }

/* footer */
.foot {
  background: var(--bg-deep);
  border-top: var(--border);
  color: var(--muted);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
}
.foot-row {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-top: var(--s-6);
  padding-bottom: var(--s-6);
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-4);
}
.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}
.foot a:visited { color: var(--text); }
.foot a:hover { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); }
.dmca {
  min-height: 32px !important;
  padding: var(--s-1) var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--muted) !important;
}
.dmca:hover { border-color: var(--accent); }

/* ≥480 */
@media (min-width: 480px) {
  :root { --gutter: 20px; }
  .post { padding: var(--s-5); }
  .toc { padding: var(--s-4) var(--s-5); }
}

/* ≥768 */
@media (min-width: 768px) {
  :root { --gutter: 28px; }
  .topbar-row { flex-wrap: nowrap; min-height: 68px; padding-top: 0; gap: var(--s-5); }
  .menu {
    order: 0;
    width: auto;
    margin: 0 auto 0 0;
    padding: 0;
    overflow: visible;
  }
  .menu a { min-height: 68px; margin-bottom: -1px; }
  .lang { margin-left: 0; }
  .crumbs { margin-top: var(--s-7); }
  .post { padding: var(--s-6) var(--s-7); }
  .more-list a {
    grid-template-columns: 110px 220px minmax(0, 1fr);
    align-items: baseline;
    padding: var(--s-4) var(--s-5);
  }
  .foot-row { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
  .cover { margin-bottom: var(--s-7); }
}

/* ≥1024 */
@media (min-width: 1024px) {
  :root { --fs-base: 1.09375rem; --gutter: 32px; }
  html { scroll-padding-top: 96px; }
  .post-layout { grid-template-columns: 230px minmax(0, 1fr); gap: var(--s-7); }
  .toc {
    position: sticky;
    top: 96px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: transparent;
    border: 0;
    border-left: 2px solid var(--brass);
    border-radius: 0;
    padding: 0 0 0 var(--s-4);
  }
  .post .intro { font-size: 1.15rem; }
}

/* ≥1280 */
@media (min-width: 1280px) {
  .post-layout { grid-template-columns: 250px minmax(0, 1fr); gap: var(--s-8); }
}

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

@media print {
  body { background: #fff; color: #000; }
  .topbar, .toc, .more, .foot { display: none; }
  .post { border: 0; background: none; }
}