/* LE — black & grey editorial theme */
:root {
  --bg: #0d0d0e;
  --bg-2: #111113;
  --surface: #17171a;
  --surface-2: #1f1f23;
  --line: #2a2a2f;
  --line-2: #3a3a40;
  --text: #ececee;
  --text-body: #cfcfd3;
  --text-2: #b0b0b6;
  --muted: #85858c;
  --light: #e9e9ec;
  --radius: 4px;
  --maxw: 1180px;
  --read: 780px;
  --header-h: 76px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#articles, #about, .post-body h2 { scroll-margin-top: calc(var(--header-h) + 16px); }

a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--light); outline-offset: 3px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--light); color: #000; padding: 10px 16px; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: transparent; color: var(--text-2);
  font: 500 14px/1 var(--sans); letter-spacing: .02em; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { border-color: #6a6a72; background: var(--surface-2); color: #fff; }
.btn-solid { background: var(--light); border-color: var(--light); color: #0d0d0e; }
.btn-solid:hover { background: #fff; border-color: #fff; color: #000; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 13, 14, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; min-width: 0; }
.brand-mark {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--surface);
  font: 600 14px/1 var(--sans); letter-spacing: .1em; color: var(--light);
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3; }
.brand-text small { display: block; font-size: 13px; letter-spacing: .02em; color: var(--text-2); line-height: 1.3; }

.nav { display: flex; flex-wrap: wrap; gap: 8px; }

.lang-switch { display: inline-flex; flex: none; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.lang-switch a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px;
  font: 600 13px/1 var(--sans); letter-spacing: .08em; color: var(--muted); text-decoration: none;
  border-left: 1px solid var(--line-2); transition: background-color .2s, color .2s;
}
.lang-switch a:first-child { border-left: 0; }
.lang-switch a:hover { color: #fff; background: var(--surface); }
.lang-switch a[aria-current="true"] { background: var(--light); color: #0d0d0e; }

@media (max-width: 920px) {
  .site-header { position: static; }
  #articles, #about, .post-body h2 { scroll-margin-top: 16px; }
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .brand { flex: 1 1 100%; margin-right: 0; }
}
@media (max-width: 520px) {
  .container { padding: 0 16px; }
  .header-inner .nav { flex: 1 1 100%; }
  .nav .btn { flex: 1 1 auto; padding: 0 10px; font-size: 13.5px; }
}

/* ---------- Post ---------- */
.post-wrap { padding-top: 56px; padding-bottom: 24px; }
.post { max-width: var(--read); margin: 0 auto; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 20px; }
.breadcrumbs a { color: var(--text-2); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.breadcrumbs a:hover { color: #fff; border-color: #fff; }
.kicker {
  display: inline-block; padding: 5px 10px; border: 1px solid var(--line-2);
  font: 600 11.5px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--text-2);
}
.post h1 {
  margin: 20px 0 20px; color: #f5f5f6;
  font: 600 clamp(30px, 4.4vw, 46px)/1.16 var(--serif); letter-spacing: -.01em;
}
.meta {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.meta time { color: var(--text-2); }

.post-body { padding-top: 10px; }
.post-body p { margin: 0 0 1.25em; color: var(--text-body); }
.post-body a { color: #fff; text-decoration-color: #6a6a72; text-underline-offset: 3px; }
.post-body strong { color: #f0f0f2; font-weight: 600; }
.post-body h2 {
  margin: 2.1em 0 .8em; padding-top: .9em; border-top: 1px solid var(--line);
  font: 600 clamp(23px, 2.7vw, 30px)/1.25 var(--serif); color: #f2f2f3;
}
.post-body h3 { margin: 1.8em 0 .6em; font: 600 20px/1.35 var(--serif); color: #ececee; }

.post-body ul, .post-body ol { list-style: none; margin: 0 0 1.6em; padding: 0; }
.post-body ul > li, .post-body ol > li {
  position: relative; margin-bottom: 8px; padding: 14px 18px 14px 46px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-body);
}
.post-body ul > li::before {
  content: ""; position: absolute; left: 19px; top: 1.45em; width: 12px; height: 2px; background: #bdbdc2;
}
.post-body ol { counter-reset: step; }
.post-body ol > li { counter-increment: step; padding-left: 58px; }
.post-body ol > li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 16px; top: 15px;
  font: 600 13px/1.6 var(--sans); letter-spacing: .06em; color: var(--muted);
}

.post-body blockquote {
  margin: 2em 0; padding: 26px 30px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--light);
  font: italic 400 clamp(19px, 2.2vw, 22px)/1.6 var(--serif); color: #efeff1;
}
.post-body blockquote p { margin: 0; color: inherit; }

.table-wrap { margin: 0 0 1.8em; overflow-x: auto; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.post-body table { width: 100%; min-width: 540px; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.post-body th, .post-body td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.post-body th { background: var(--surface-2); color: #f0f0f2; font-weight: 600; }
.post-body td { color: var(--text-2); }
.post-body tr:last-child td { border-bottom: 0; }
.post-body td:first-child { color: var(--text); font-weight: 500; }

.note {
  margin-top: 2.6em !important; padding: 14px 18px;
  border: 1px dashed var(--line-2); font-size: 14px; line-height: 1.6; color: var(--muted) !important;
}

/* ---------- Image frames: fixed 16:9, centered, never stretched ---------- */
.frame {
  display: block; margin: 2.2em 0; padding: 10px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 2px;
}
.frame-inner {
  position: relative; display: block; width: 100%; height: 0; padding-top: 56.25%;
  overflow: hidden; background: #101012; border: 1px solid var(--line);
}
.frame-inner img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center center;
}
.frame figcaption { padding: 10px 4px 2px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

/* ---------- Articles block ---------- */
.articles { margin-top: 48px; padding: 40px 0 48px; background: var(--bg-2); border-top: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 32px; margin-bottom: 20px; }
.section-head h2 { margin: 0; font: 600 clamp(22px, 2.4vw, 28px)/1.2 var(--serif); color: #f4f4f5; }
.section-head p { margin: 0; max-width: 520px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.section-foot { margin: 20px 0 0; text-align: center; }

/* Compact cards: 4 in a row on desktop, 2x2 on tablet, thumbnail rows on phones */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 900px; }

.card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); transition: border-color .2s; }
.card:hover { border-color: #55555c; }
.frame--card { margin: 0; padding: 6px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.frame--card img { transition: transform .5s ease; }
.card:hover .frame--card img { transform: scale(1.025); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 12px 14px 14px; }
.card time { font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.card h3 {
  margin: 4px 0 6px; font: 600 15.5px/1.35 var(--serif); color: #f2f2f3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-color: #6a6a72; text-underline-offset: 4px; }
.card p {
  flex: 1; margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-link { align-self: flex-start; height: 30px; padding: 0 12px; font-size: 13px; }

@media (max-width: 1000px) {
  .cards, .cards--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .articles { padding: 32px 0 36px; }
  .cards, .cards--3 { grid-template-columns: 1fr; gap: 10px; }
  .card { flex-direction: row; align-items: stretch; }
  .frame--card { flex: none; width: 132px; padding: 5px; border-bottom: 0; border-right: 1px solid var(--line); align-self: center; }
  .card-body { padding: 8px 12px; justify-content: center; }
  .card h3 { font-size: 14.5px; margin: 2px 0 0; }
  .card p, .card-link { display: none; }
}

/* ---------- Footer ---------- */
.site-footer { padding-top: 60px; background: #09090a; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.1fr; gap: 44px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr; gap: 36px; } }
.site-footer h2 { margin: 0 0 16px; font: 600 12.5px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #f0f0f2; }
.site-footer p { margin: 0; font-size: 15px; line-height: 1.7; color: var(--muted); }
.contacts { list-style: none; margin: 0; padding: 0; font-size: 15px; color: var(--text-2); }
.contacts li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.contacts li:first-child { padding-top: 0; }
.contacts span { min-width: 64px; color: var(--muted); }
.contacts a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-2); word-break: break-all; }
.contacts a:hover { border-color: #fff; color: #fff; }
.nav--footer { margin-bottom: 16px; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin-top: 52px; padding-top: 20px; padding-bottom: 30px;
  border-top: 1px solid var(--line); font-size: 13px; line-height: 1.6; color: #6c6c73;
}
.footer-bottom span:last-child { max-width: 620px; }
