/* shoenberg.com.ua — editorial light theme: sand paper + terracotta, deep teal secondary */

:root {
  /* palette */
  --bg: #f4efe6;
  --bg-deep: #ebe4d7;
  --paper: #fffdf9;
  --surface: #faf6ef;
  --ink: #2a2420;
  --ink-soft: #3d352f;
  --muted: #675b51;
  --line: #e2d8c9;
  --line-strong: #d2c5b2;
  --accent: #a3401c;
  --accent-hover: #83310f;
  --accent-tint: #f6e6dc;
  --second: #2c5b57;
  --second-tint: #e3eeeb;
  --threat: #a1202c;
  --threat-tint: #f7e1e2;
  --code-bg: #f1ebe0;

  /* typography */
  --f-head: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-body: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --f-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-base: 1.03rem;
  --fs-small: 0.875rem;
  --fs-xs: 0.8rem;
  --lh-body: 1.7;
  --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;
  --s-9: 88px;

  /* radii & shadows */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.05);
  --shadow-md: 0 2px 6px rgba(60, 40, 20, 0.05), 0 12px 32px -12px rgba(60, 40, 20, 0.12);

  /* layout */
  --wrap: 1160px;
  --gutter: 18px;
  --measure: 70ch;
  --header-h: 60px;

  --t-fast: 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: calc(var(--header-h) + 60px);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(120, 90, 60, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
  height: auto;
}

iframe {
  width: 100%;
  border: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

/* ---------- links ---------- */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(163, 64, 28, 0.4);
  transition: color var(--t-fast), text-decoration-color var(--t-fast), background-color var(--t-fast), box-shadow var(--t-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--second);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 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: 0;
}

.skip:focus {
  left: var(--s-3);
  top: var(--s-3);
  z-index: 300;
  padding: var(--s-3) var(--s-4);
  background: var(--paper);
  color: var(--accent);
  font-family: var(--f-head);
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}

/* ---------- header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 253, 249, 0.92);
  -webkit-backdrop-filter: saturate(1.3) blur(10px);
  backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--accent);
}

.topbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  min-height: var(--header-h);
  padding-top: var(--s-2);
}

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

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  color: var(--accent);
}

.menu {
  order: 3;
  display: flex;
  gap: var(--s-1);
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter) var(--s-2);
  width: calc(100% + var(--gutter) * 2);
  font-family: var(--f-head);
  font-size: 0.93rem;
  font-weight: 500;
}

.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-radius: var(--r-pill);
  white-space: nowrap;
}

.menu a:hover {
  color: var(--ink);
  background: var(--bg-deep);
}

.menu a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-tint);
  font-weight: 600;
}

.lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: var(--f-head);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 38px;
  padding: 0 var(--s-2);
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-pill);
}

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

.lang a[aria-current="true"] {
  color: var(--paper);
  background: var(--second);
}

/* ---------- article head ---------- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-2);
  margin: var(--s-5) 0 var(--s-4);
  font-family: var(--f-head);
  font-size: var(--fs-small);
  color: var(--muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
}

.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: 1.3rem;
  line-height: var(--lh-head);
  letter-spacing: -0.012em;
  color: var(--ink);
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}

.post-head h1::before {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-bottom: var(--s-4);
  background: linear-gradient(90deg, var(--accent) 0 60%, var(--second) 60% 100%);
  border-radius: 2px;
}

.post-info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin: var(--s-4) 0 var(--s-6);
  font-family: var(--f-head);
  font-size: var(--fs-small);
  color: var(--muted);
}

.post-info > * + *::before {
  content: "·";
  margin-right: var(--s-4);
  color: var(--line-strong);
}

/* ---------- cover ---------- */
.cover {
  width: 100%;
  max-width: calc(var(--wrap) + 120px);
  margin: 0 auto var(--s-6);
  padding: 0 var(--gutter);
}

.cover img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: var(--bg-deep);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

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

.toc {
  padding: var(--s-4) var(--s-4) var(--s-3);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--f-head);
  font-size: 0.9rem;
}

.toc-title {
  margin-bottom: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--second);
}

.toc ol {
  list-style: none;
  counter-reset: toc;
  display: grid;
  gap: 0;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
  min-height: 44px;
  padding: var(--s-2) var(--s-2);
  line-height: 1.4;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  flex: 0 0 auto;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.toc a:hover {
  color: var(--accent);
  background: var(--accent-tint);
}

/* ---------- article body ---------- */
.post {
  min-width: 0;
  max-width: calc(var(--measure) + 2 * var(--s-7));
  padding: var(--s-5) var(--s-4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.post > * {
  max-width: var(--measure);
}

.post p {
  margin-bottom: 1.2em;
}

.post .intro {
  font-size: 1.1em;
  line-height: 1.65;
  color: var(--ink-soft);
  padding-bottom: var(--s-4);
  margin-bottom: var(--s-5);
  border-bottom: 1px dashed var(--line-strong);
}

.post h2,
.post h3,
.post h4 {
  font-family: var(--f-head);
  color: var(--ink);
  line-height: var(--lh-head);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.post h2 {
  position: relative;
  margin: var(--s-7) 0 var(--s-3);
  padding-top: var(--s-4);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-top: 1px solid var(--line);
}

.post h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
}

.post h3 {
  margin: var(--s-6) 0 var(--s-2);
  font-size: 1.06rem;
  font-weight: 650;
  color: var(--second);
}

.post h4 {
  margin: var(--s-5) 0 var(--s-2);
  font-size: 1rem;
  font-weight: 600;
}

.post a {
  overflow-wrap: anywhere;
}

.post strong,
.post b {
  font-weight: 700;
  color: var(--ink);
}

.post ul,
.post ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}

.post li {
  margin-bottom: 0.45em;
  padding-left: 0.2em;
}

.post li::marker {
  color: var(--accent);
  font-family: var(--f-head);
  font-weight: 600;
}

.post li > ul,
.post li > ol {
  margin: 0.45em 0 0;
}

.post hr {
  height: 0;
  margin: var(--s-7) 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.post figure {
  margin: var(--s-6) 0;
}

.post img {
  border-radius: var(--r-md);
}

.post figcaption {
  margin-top: var(--s-2);
  font-family: var(--f-head);
  font-size: var(--fs-small);
  color: var(--muted);
}

/* code */
code,
kbd,
samp,
pre {
  font-family: var(--f-mono);
  font-size: 0.88em;
}

:not(pre) > code {
  padding: 0.12em 0.4em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--accent-hover);
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  margin: 0 0 1.4em;
  padding: var(--s-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--second);
  border-radius: var(--r-sm);
  line-height: 1.6;
  color: var(--ink-soft);
  tab-size: 2;
}

pre code {
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
}

/* tables */
.post table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.4em;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  font-family: var(--f-head);
  font-size: 0.92rem;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.post th,
.post td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  min-width: 120px;
}

.post th {
  background: var(--surface);
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
}

.post tbody tr:nth-child(even) {
  background: rgba(244, 239, 230, 0.5);
}

.post tbody tr:hover {
  background: var(--second-tint);
}

.post tr:last-child td {
  border-bottom: 0;
}

/* summary */
.summary {
  margin: var(--s-2) 0 var(--s-4);
  padding: var(--s-4) var(--s-4);
  background: var(--second-tint);
  border: 1px solid rgba(44, 91, 87, 0.18);
  border-radius: var(--r-md);
}

.summary-title {
  margin-bottom: var(--s-2) !important;
  font-family: var(--f-head);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--second);
}

.summary p:last-child,
.summary ul:last-child,
.summary ol:last-child {
  margin-bottom: 0;
}

/* definitions */
.terms {
  display: grid;
  gap: var(--s-3);
  margin: 0 0 1.5em;
}

.terms div {
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.terms dt {
  margin-bottom: 2px;
  font-family: var(--f-head);
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.terms dd {
  color: var(--muted);
  line-height: 1.6;
}

/* quotes */
.post blockquote {
  position: relative;
  margin: var(--s-6) 0;
  padding: var(--s-4) var(--s-4) var(--s-4) var(--s-5);
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.post blockquote p {
  margin: 0;
  font-size: 1.06em;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink-soft);
}

.post blockquote p + p {
  margin-top: var(--s-3);
}

.post blockquote cite {
  display: block;
  margin-top: var(--s-3);
  font-family: var(--f-head);
  font-style: normal;
  font-size: var(--fs-small);
  color: var(--muted);
}

/* ---------- read more ---------- */
.more {
  margin-top: var(--s-8);
  padding: var(--s-7) 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.more h2 {
  margin-bottom: var(--s-4);
  font-family: var(--f-head);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: var(--lh-head);
  color: var(--ink);
}

.more-list {
  list-style: none;
  display: grid;
  gap: var(--s-3);
}

.more-list li {
  min-width: 0;
}

.more-list a {
  display: grid;
  gap: var(--s-1);
  height: 100%;
  min-height: 44px;
  padding: var(--s-4);
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.more-list a:hover {
  border-color: var(--line-strong);
  background: var(--paper);
  box-shadow: var(--shadow-md);
}

.more-list a:hover .more-name {
  color: var(--accent);
}

.more-topic {
  justify-self: start;
  padding: 2px var(--s-2);
  font-family: var(--f-head);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--second);
  background: var(--second-tint);
  border-radius: var(--r-pill);
}

.more-topic.is-threat {
  color: var(--threat);
  background: var(--threat-tint);
}

.more-name {
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  transition: color var(--t-fast);
}

.more-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- footer ---------- */
.foot {
  background: var(--bg-deep);
  color: var(--muted);
  font-family: var(--f-head);
  font-size: var(--fs-small);
  border-top: 1px solid var(--line-strong);
}

.foot-row {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-5);
  padding-bottom: var(--s-5);
}

.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(--ink-soft);
  text-decoration: none;
}

.foot a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.foot a.dmca,
.dmca {
  min-height: 36px;
  padding: 0 var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
}

.foot a.dmca:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------- breakpoints ---------- */
@media (min-width: 480px) {
  :root {
    --gutter: 20px;
  }

  .post-head h1 {
    font-size: 1.4rem;
  }

  .post {
    padding: var(--s-6) var(--s-5);
  }

  .summary {
    padding: var(--s-4) var(--s-5);
  }

  .post blockquote {
    padding: var(--s-5) var(--s-5) var(--s-5) var(--s-6);
  }
}

@media (min-width: 768px) {
  :root {
    --fs-base: 1.0625rem;
    --gutter: 28px;
    --header-h: 68px;
  }

  .topbar-row {
    flex-wrap: nowrap;
    padding-top: 0;
  }

  .menu {
    order: 0;
    width: auto;
    margin: 0 auto 0 var(--s-4);
    padding: 0;
    overflow: visible;
  }

  .crumbs {
    margin: var(--s-6) 0 var(--s-4);
  }

  .post-head h1 {
    font-size: 1.65rem;
  }

  .cover {
    margin-bottom: var(--s-7);
  }

  .post {
    padding: var(--s-7) var(--s-7);
  }

  .post h2 {
    font-size: 1.32rem;
  }

  .post h3 {
    font-size: 1.12rem;
  }

  .more-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
  }

  .more h2 {
    font-size: 1.3rem;
  }

  .foot-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }
}

@media (min-width: 1024px) {
  :root {
    --fs-base: 1.1rem;
    --gutter: 32px;
  }

  .post-head h1 {
    font-size: 1.875rem;
    line-height: 1.28;
  }

  .post-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: var(--s-7);
    align-items: start;
  }

  .toc {
    position: sticky;
    top: calc(var(--header-h) + var(--s-5));
    max-height: calc(100vh - var(--header-h) - var(--s-7));
    overflow-y: auto;
    padding: 0 0 0 var(--s-3);
    background: transparent;
    border: 0;
    border-left: 1px solid var(--line-strong);
    border-radius: 0;
  }

  .toc-title {
    padding-left: var(--s-2);
  }

  .toc a {
    min-height: 0;
    padding: 6px var(--s-2);
  }

  .more-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .post-head h1 {
    font-size: 2rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- print ---------- */
@media print {
  body {
    background: #fff;
  }

  .topbar,
  .toc,
  .more,
  .foot,
  .skip {
    display: none;
  }

  .post {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}