@font-face {
  font-family: 'Source Serif';
  src: url('../fonts/SourceSerif4.ttf') format('truetype');
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/Roboto.ttf') format('truetype');
  font-weight: 100 900;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --paper: #F4F0E6;
  --sheet: #FBF9F3;
  --sheet-2: #ECE6D9;
  --ink: #221B14;
  --ink-2: #4B4238;
  --muted: #6F665A;
  --line: #DCD4C4;
  --line-soft: #E7E0D2;

  --accent: #B04D28;
  --accent-hover: #963F1F;
  --accent-soft: #B04D281A;
  --on-accent: #FFF9F2;
  --ochre: #A87522;
  --marker: #E9C77A73;
  --pen-red: #B04D28;
  --pen-blue: #33628A;

  --terracotta: #B04D28;
  --t-ochre: #A87522;
  --olive: #66702F;
  --slate: #44637D;
  --plum: #7A4660;
  --moss: #53704F;

  --star: #2B241C;
  --star-line: #BDB29F;

  --shadow-sheet: 0 1px 0 rgba(60, 42, 24, .04), 0 1px 3px rgba(60, 42, 24, .07), 0 8px 24px -12px rgba(60, 42, 24, .14);
  --shadow-lift: 0 2px 4px rgba(60, 42, 24, .06), 0 14px 32px -12px rgba(60, 42, 24, .22);

  --serif: 'Source Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Roboto', 'Segoe UI', system-ui, sans-serif;
  --read-size: 20px;
  --radius: 10px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #1B1815;
  --sheet: #23201B;
  --sheet-2: #15130F;
  --ink: #EDE5D6;
  --ink-2: #C9BEAC;
  --muted: #A09584;
  --line: #3A342C;
  --line-soft: #2E2A24;

  --accent: #E07B50;
  --accent-hover: #EB9270;
  --accent-soft: #E07B5022;
  --on-accent: #1B1815;
  --ochre: #D9A553;
  --marker: #D9A55338;
  --pen-red: #E38A62;
  --pen-blue: #86B3D6;

  --terracotta: #E07B50;
  --t-ochre: #D9A553;
  --olive: #A8B36A;
  --slate: #8AAEC9;
  --plum: #C98DAA;
  --moss: #95B78F;

  --star: #EDE5D6;
  --star-line: #4A433A;

  --shadow-sheet: 0 1px 0 rgba(0, 0, 0, .25), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-lift: 0 14px 32px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

:root[data-text='large'] { --read-size: 22px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Едва заметная фактура бумаги */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme='dark'] body::before { opacity: .05; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--marker); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 22px/1 var(--serif); letter-spacing: -.01em; }
.nav { display: flex; gap: 4px; height: 100%; }
.nav a {
  display: flex; align-items: center; padding: 0 12px; height: 100%;
  font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; width: 240px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--muted);
}
.search:focus-within { border-color: var(--muted); }
.search input { border: 0; outline: 0; background: none; width: 100%; color: var(--ink); }
.search input::placeholder, textarea::placeholder, input::placeholder { color: var(--muted); opacity: 1; }
.top-tools .search-icon-link { display: none; }

.avatar-btn { border: 0; background: none; padding: 0; border-radius: 50%; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; padding: 6px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lift);
}
.menu-pop[hidden] { display: none; }
.menu-pop a, .menu-pop button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 6px;
  background: none; text-align: left; color: var(--ink-2);
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--sheet-2); color: var(--ink); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line-soft); margin: 6px 4px; }
.menu-who { padding: 8px 12px 10px; }
.menu-who b { display: block; font-weight: 600; color: var(--ink); }
.menu-who span { color: var(--muted); font-size: 13.5px; }

.tabbar { display: none; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--sheet); color: var(--ink); font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { background: var(--sheet-2); border-color: transparent; color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn[aria-pressed='true'] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.link { color: var(--accent); font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; border-radius: 6px; color: var(--muted);
}
.icon-btn:hover { background: var(--sheet-2); color: var(--ink); }

/* ---------- Аватары и тона ---------- */
.tone-terracotta { --tone: var(--terracotta); }
.tone-ochre { --tone: var(--t-ochre); }
.tone-olive { --tone: var(--olive); }
.tone-slate { --tone: var(--slate); }
.tone-plum { --tone: var(--plum); }
.tone-moss { --tone: var(--moss); }
.av {
  --s: 32px;
  width: var(--s); height: var(--s); flex: 0 0 var(--s); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--tone) 16%, var(--sheet));
  color: var(--tone); font: 600 calc(var(--s) * .38)/1 var(--sans); letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent);
}

/* ---------- Типографика ---------- */
.kicker { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.h1 { font: 600 40px/1.12 var(--serif); letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.h2 { font: 600 26px/1.2 var(--serif); letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.h3 { font: 600 20px/1.25 var(--serif); margin: 0; text-wrap: balance; }
.sub { font: 400 19px/1.5 var(--serif); color: var(--ink-2); margin: 8px 0 0; text-wrap: pretty; }
.meta { font-size: 14px; color: var(--muted); }
.meta a:hover { color: var(--ink); }
.dot::before { content: '·'; margin: 0 7px; }
.section-title { font: 600 15px/1.3 var(--sans); color: var(--ink); margin: 0 0 14px; }

/* ---------- Страницы ---------- */
.page { padding-top: 44px; padding-bottom: 96px; }
.page-head { display: flex; align-items: flex-end; gap: 24px; margin-bottom: 32px; }
.page-head > :first-child { flex: 1; min-width: 0; }

.grid-feed { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 64px; align-items: start; }
.rail { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 36px; }

.sheet {
  background: var(--sheet); border-radius: var(--radius); box-shadow: var(--shadow-sheet);
  border: 1px solid var(--line-soft);
}

/* Поле «написать» */
.composer {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px; margin-bottom: 28px;
  color: var(--muted); font: 400 18px/1.4 var(--serif);
}
.composer:hover { color: var(--ink-2); }
.composer .rule { flex: 1; border-bottom: 1px solid var(--line); height: 1px; margin-top: 12px; }

/* Карточка публикации */
.post { position: relative; padding: 26px 30px 22px; margin-bottom: 20px; }
.post + .post { margin-top: 0; }
.post-by { display: flex; align-items: center; gap: 0 10px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.post-by a { color: var(--ink-2); font-weight: 500; }
.post-by a:hover { color: var(--ink); }
.post-title { font: 600 27px/1.2 var(--serif); letter-spacing: -.01em; margin: 0 0 10px; text-wrap: balance; }
.post-title a:hover { color: var(--accent); }
.post-lede { font: 400 18.5px/1.55 var(--serif); color: var(--ink-2); margin: 0; text-wrap: pretty; }
.post-foot { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.why { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.why svg { flex: 0 0 auto; transform: translateY(2px); }
.post-actions { display: flex; gap: 4px; }
.outside-label { display: inline-block; font-size: 13.5px; font-weight: 500; color: var(--ochre); margin-bottom: 10px; }
.post.outside { background: color-mix(in srgb, var(--sheet) 70%, var(--sheet-2)); }

/* Ленточка-закладка */
.ribbon {
  position: absolute; top: -1px; right: 28px; width: 18px; height: 30px; background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15));
}

.post.compact { padding: 20px 24px 18px; }
.post.compact .post-title { font-size: 22px; }
.post.compact .post-lede { font-size: 16.5px; }

/* Конец выпуска */
.issue-end { text-align: center; padding: 40px 20px 12px; }
.issue-end .asterism { font: 400 26px/1 var(--serif); color: var(--muted); letter-spacing: .3em; margin-bottom: 18px; }
.issue-end p { margin: 8px auto 0; max-width: 420px; color: var(--ink-2); font: 400 18px/1.5 var(--serif); }
.issue-end .actions { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Списки в правой колонке */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.people a { display: flex; align-items: center; gap: 12px; }
.people b { display: block; font-weight: 500; color: var(--ink); }
.people a:hover b { color: var(--accent); }
.people span.meta { display: block; font-size: 13.5px; }
.topics { list-style: none; margin: 0; padding: 0; }
.topics li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); }
.topics li:last-child { border-bottom: 0; }
.rail-note { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0; }

/* ---------- Статья ---------- */
.article-wrap { max-width: 1060px; margin: 0 auto; }
.article-head, .article-end { max-width: 680px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.tags a:hover { color: var(--accent); }
.tags a::before { content: '#'; opacity: .6; margin-right: 1px; }
.article-title { font: 650 46px/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 16px; text-wrap: balance; font-variation-settings: 'opsz' 60; }
.article-lede { font: 400 22px/1.5 var(--serif); color: var(--ink-2); margin: 0 0 28px; text-wrap: pretty; }
.byline { display: flex; align-items: center; gap: 12px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.byline .who { flex: 1; min-width: 0; }
.byline b { font-weight: 500; }
.byline b a:hover { color: var(--accent); }

.margins-ctl { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.seg { display: inline-flex; background: var(--sheet-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 14px; color: var(--ink-2); }
.seg button[aria-pressed='true'] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.body-row { display: grid; grid-template-columns: minmax(0, 680px) 280px; gap: 56px; }
.body-row .text { font: 400 var(--read-size)/1.72 var(--serif); }
.body-row .text p { margin: 0 0 1.1em; text-wrap: pretty; hanging-punctuation: first; }
.body-row .text h2 { font: 600 28px/1.25 var(--serif); margin: 1.4em 0 .6em; }
.body-row .text blockquote {
  margin: 1.2em 0 1.4em; padding: 2px 0 2px 24px; border-left: 3px solid var(--ochre);
  font-size: 1.15em; line-height: 1.5; color: var(--ink-2);
}
mark.hl { background: linear-gradient(transparent 12%, var(--marker) 12%, var(--marker) 88%, transparent 88%); color: inherit; padding: 0 1px; border-radius: 2px; }
.row-margin { position: relative; padding-top: 6px; display: flex; flex-direction: column; gap: 14px; }
.mnote { font: 400 15px/1.5 var(--serif); color: var(--ink-2); padding-left: 14px; border-left: 2px solid var(--pen-red); }
.mnote.reader { border-left-color: var(--pen-blue); }
.mnote.mine { border-left-color: var(--pen-blue); border-left-style: dashed; }
.mnote .by { font: 500 13px/1.4 var(--sans); color: var(--pen-red); margin-bottom: 3px; display: block; }
.mnote.reader .by, .mnote.mine .by { color: var(--pen-blue); }
.add-note {
  align-self: flex-start; border: 0; background: none; color: var(--muted); font-size: 13.5px; padding: 2px 0;
  opacity: 0; transition: opacity .15s;
}
.body-row:hover .add-note, .add-note:focus-visible { opacity: 1; }
.add-note:hover { color: var(--pen-blue); }
.note-form textarea {
  width: 100%; min-height: 80px; resize: vertical; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--sheet); font: 400 15px/1.5 var(--serif); outline: 0;
}
.note-form textarea:focus { border-color: var(--pen-blue); }
.note-form .row { display: flex; gap: 6px; margin-top: 6px; }

.article-end { margin-top: 44px; }
.reactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reactions .btn { height: 40px; font-family: var(--serif); font-size: 16.5px; }
.respond {
  margin-top: 36px; padding: 20px 24px; display: flex; gap: 20px; align-items: center; justify-content: space-between;
}
.responses { list-style: none; padding: 0; margin: 16px 0 0; }
.responses li { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.responses a b { font: 600 18px/1.3 var(--serif); }
.responses p { margin: 6px 0 0; font: 400 16.5px/1.5 var(--serif); color: var(--ink-2); }
.responses a:hover b { color: var(--accent); }

.discussion { margin-top: 52px; }
.comment-form { display: flex; gap: 12px; margin-bottom: 8px; }
.comment-form .field { flex: 1; }
.comment-form textarea, .field-area {
  width: 100%; min-height: 84px; resize: vertical; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--sheet); font: 400 16.5px/1.55 var(--serif); outline: 0;
}
.comment-form textarea:focus, .field-area:focus { border-color: var(--muted); }
.comment-form .row { display: flex; justify-content: flex-end; margin-top: 8px; }
.comments { list-style: none; margin: 0; padding: 0; }
.comment { display: flex; gap: 12px; padding: 18px 0; border-top: 1px solid var(--line-soft); }
.comment .body { flex: 1; min-width: 0; }
.comment .head { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.comment .head b { color: var(--ink); font-weight: 500; }
.comment p { margin: 0; font: 400 17px/1.6 var(--serif); color: var(--ink-2); }
.comment .replies { list-style: none; margin: 4px 0 0; padding: 0 0 0 4px; }
.comment .replies .comment { border-top: 0; padding: 14px 0 0; }
.comment .reply-btn { margin-top: 6px; border: 0; background: none; padding: 0; font-size: 14px; color: var(--muted); }
.comment .reply-btn:hover { color: var(--ink); }

/* ---------- Профиль ---------- */
.hero { background: var(--sheet-2); border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; min-height: 340px; padding-top: 48px; padding-bottom: 48px; }
.hero-name { font: 400 52px/1.05 var(--serif); letter-spacing: -.02em; margin: 0; }
.hero-role { margin: 14px 0 0; font-weight: 500; color: var(--accent); font-size: 15px; }
.hero-bio { font: 400 18.5px/1.6 var(--serif); color: var(--ink-2); margin: 18px 0 0; max-width: 540px; text-wrap: pretty; }
.stats { display: flex; gap: 40px; margin: 30px 0 0; padding: 0; list-style: none; }
.stats b { display: block; font: 300 32px/1 var(--serif); color: var(--ink); font-variant-numeric: lining-nums; }
.stats span { display: block; margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; margin-top: 28px; }
.sky { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 360px; user-select: none; -webkit-user-select: none; }
.sky svg { width: 100%; height: 100%; overflow: visible; touch-action: pan-y; }
.sky.pannable svg { touch-action: none; cursor: grab; overflow: hidden; }
.sky.panning svg, .sky.dragging svg { cursor: grabbing; }
.sky .edge { stroke: var(--star-line); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; transition: opacity .2s, stroke .2s; }
.sky .speck { fill: var(--star); opacity: .22; }
.sky .node { cursor: pointer; touch-action: none; transition: opacity .2s; }
.sky.dragging .node { cursor: grabbing; }
.sky .node .body { fill: var(--star); transition: fill .2s; }
.sky .node.faint .body { opacity: .45; }
.sky .node.bright .body { fill: var(--accent); }
.sky .node .halo { fill: none; stroke: var(--accent); stroke-width: 1; opacity: .55; vector-effect: non-scaling-stroke; }
.sky .node .hit { fill: transparent; }
.sky .node text {
  font: 500 calc(12.5px / var(--k, 1)) var(--sans); fill: var(--ink-2); paint-order: stroke;
  stroke: var(--sheet-2); stroke-width: calc(4px / var(--k, 1)); stroke-linejoin: round;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.sky .node.lbl text { opacity: 1; }
.sky .node:hover text, .sky .node:focus-visible text { opacity: 1; }
.sky .node:focus { outline: none; }
.sky .node:focus-visible .body { stroke: var(--accent); stroke-width: 2; }
.sky.dim .node:not(.hi) { opacity: .25; }
.sky.dim .edge:not(.hi) { opacity: .25; }
.sky .edge.hi { stroke: var(--accent); stroke-width: 1.5; }
.sky .node.tag .body { fill: none; stroke: var(--star); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.sky .node.sel .body { fill: var(--accent); }
.graph-box { position: relative; }
.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; padding: 3px; box-shadow: var(--shadow-sheet); }
.zoom .icon-btn { font-size: 18px; line-height: 1; color: var(--ink-2); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tabs a { padding: 12px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-weight: 500; color: var(--muted); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }

.col-narrow { max-width: 760px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.row-link { display: block; padding: 20px 0; border-bottom: 1px solid var(--line-soft); }
.row-link:first-child { padding-top: 4px; }
.row-link:hover .h3 { color: var(--accent); }
.row-link p { margin: 6px 0 8px; font: 400 17px/1.55 var(--serif); color: var(--ink-2); }

/* ---------- Блокнот, коллекции ---------- */
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 28px; }
.cover {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 3 / 3.6; padding: 18px 16px 18px 30px; border-radius: 4px 10px 10px 4px;
  background: color-mix(in srgb, var(--tone) 78%, #3a2a1c);
  box-shadow: var(--shadow-sheet); transition: transform .2s, box-shadow .2s;
}
:root[data-theme='dark'] .cover { background: color-mix(in srgb, var(--tone) 55%, #15120f); }
.cover::before { /* корешок */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 14px; border-radius: 4px 0 0 4px;
  background: rgba(0, 0, 0, .18); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .12);
}
.cover:hover { transform: translateY(-3px) rotate(-.4deg); box-shadow: var(--shadow-lift); }
.cover .label { background: #FBF8F1; color: #221B14; padding: 12px 14px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.cover .label b { display: block; font: 600 18px/1.25 var(--serif); }
.cover .label span { display: block; margin-top: 4px; font-size: 13px; color: #6F665A; }
.cover-new {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 3.6; border-radius: 10px;
  border: 1.5px dashed var(--line); color: var(--muted); background: none; font-weight: 500;
}
.cover-new:hover { color: var(--accent); border-color: var(--accent); }

.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.card { position: relative; padding: 20px 56px 18px 24px; }
.card .h3 a:hover { color: var(--accent); }
.card .because { margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font: 400 16.5px/1.5 var(--serif); color: var(--pen-blue); }
.card .remove { position: absolute; top: 14px; right: 14px; }

.coll-head { display: flex; align-items: center; gap: 20px; }
.mini-cover { width: 46px; height: 58px; border-radius: 2px 6px 6px 2px; background: color-mix(in srgb, var(--tone) 78%, #3a2a1c); position: relative; flex: 0 0 auto; box-shadow: var(--shadow-sheet); }
.mini-cover::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: rgba(0, 0, 0, .2); }

/* Заметки */
.notes-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; align-items: start; }
.note-tree { position: sticky; top: 96px; }
.note-tree .tools { display: flex; gap: 8px; margin-bottom: 14px; }
.folder { margin-bottom: 6px; }
.folder > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px;
  font-weight: 500; color: var(--ink); cursor: pointer;
}
.folder > summary::-webkit-details-marker { display: none; }
.folder > summary:hover { background: var(--sheet-2); }
.folder > summary .caret { transition: transform .15s; color: var(--muted); }
.folder[open] > summary .caret { transform: rotate(90deg); }
.folder > summary .n { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }
.folder .folder { margin-left: 16px; }
.note-link { display: block; padding: 6px 8px 6px 30px; border-radius: 6px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-link:hover { background: var(--sheet-2); color: var(--ink); }
.note-link[aria-current='page'] { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-sheet); }
.note-editor { padding: 28px 32px; min-height: 460px; }
.note-editor .title-in { width: 100%; border: 0; outline: 0; background: none; font: 600 28px/1.25 var(--serif); padding: 0; }
.note-editor .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 18px; }
.chip { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px; font-size: 14px; color: var(--ink-2); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.note-editor textarea {
  width: 100%; min-height: 300px; border: 0; outline: 0; resize: vertical; background:
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--line-soft) 31px 32px);
  font: 400 18px/32px var(--serif); padding: 0; color: var(--ink);
}
.src-link { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.src-link:hover { color: var(--accent); }

/* Связи */
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.graph-box { background: var(--sheet-2); border-radius: var(--radius); border: 1px solid var(--line-soft); padding: 12px; }
.graph-box .sky { aspect-ratio: var(--ar, 16 / 11); max-height: none; }
.graph-filters { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.graph-side { padding: 22px 24px; }
.graph-side .kind { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.graph-side .h3 { margin-bottom: 8px; }
.graph-side p { margin: 0 0 14px; font: 400 16px/1.55 var(--serif); color: var(--ink-2); }
.graph-side ul { list-style: none; margin: 0 0 16px; padding: 0; }
.graph-side li a { display: block; padding: 7px 0; border-top: 1px solid var(--line-soft); font: 500 15.5px/1.35 var(--serif); }
.graph-side li a:hover { color: var(--accent); }

/* ---------- Сообщества ---------- */
.communities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.community { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 0 22px; padding: 24px 24px 22px 0; overflow: hidden; }
.community .spine { background: var(--tone); border-radius: var(--radius) 0 0 var(--radius); margin: -24px 0 -22px; }
.community .h2 a:hover { color: var(--accent); }
.community p { margin: 8px 0 12px; font: 400 17.5px/1.55 var(--serif); color: var(--ink-2); max-width: 640px; }
.community-head { position: relative; padding: 32px 32px 28px 40px; overflow: hidden; margin-bottom: 36px; }
.community-head::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--tone); }
.rules { margin: 0; padding-left: 20px; color: var(--ink-2); }
.rules li { padding: 4px 0 4px 4px; }

/* ---------- Редактор ---------- */
.editor { max-width: 780px; margin: 0 auto; }
.editor .context { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 16px; font-size: 14.5px; color: var(--muted); }
.editor .context select { border: 1px solid var(--line); background: var(--sheet); border-radius: 6px; padding: 5px 8px; color: var(--ink); }
.editor .context a { color: var(--ink-2); font-weight: 500; }
.editor-sheet { padding: 48px 56px 40px; min-height: 60vh; }
.ta { display: block; width: 100%; border: 0; outline: 0; background: none; resize: none; overflow: hidden; padding: 0; color: var(--ink); }
.ta-title { font: 650 40px/1.15 var(--serif); letter-spacing: -.015em; font-variation-settings: 'opsz' 60; }
.ta-lede { font: 400 21px/1.5 var(--serif); color: var(--ink-2); margin-top: 14px; }
.ta-body { font: 400 var(--read-size)/1.72 var(--serif); margin-top: 28px; min-height: 280px; }
.editor-sheet hr { border: 0; border-top: 1px solid var(--line-soft); margin: 26px 0 0; }
.tag-in { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 14.5px; }
.tag-in input { flex: 1; border: 0; border-bottom: 1px solid var(--line); background: none; outline: 0; padding: 6px 0; font-size: 15px; }
.tag-in input:focus { border-bottom-color: var(--muted); }
.editor-bar {
  position: sticky; bottom: 0; margin-top: 20px; padding: 14px 0; display: flex; align-items: center; gap: 14px;
  background: linear-gradient(to top, var(--paper) 70%, transparent);
}
.editor-bar .progress { flex: 1; min-width: 0; }
.editor-bar .progress .track { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 7px; max-width: 280px; }
.editor-bar .progress .fill { height: 100%; background: var(--ochre); transition: width .2s; }
.editor-bar .progress.ok .fill { background: var(--moss); }
.editor-bar .progress span { font-size: 14px; color: var(--ink-2); }

/* ---------- Настройки ---------- */
.settings { max-width: 720px; }
.set-group { margin-top: 40px; }
.set-group h2 { font: 600 22px/1.3 var(--serif); margin: 0 0 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.set-row .label b { display: block; font-weight: 500; }
.set-row .label span { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; border-radius: 999px; border: 0; background: var(--line); transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--sheet); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch[aria-checked='true'] { background: var(--moss); }
.switch[aria-checked='true']::after { transform: translateX(18px); }

/* ---------- Диалог ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(460px, calc(100vw - 32px));
  background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-lift);
}
dialog::backdrop { background: rgba(30, 22, 14, .35); }
.dlg { padding: 26px 26px 22px; }
.dlg .h3 { margin-bottom: 4px; }
.dlg .meta { margin-bottom: 18px; }
.dlg fieldset { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 2px; }
.dlg legend { font-weight: 500; margin-bottom: 8px; }
.dlg label.opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.dlg label.opt:hover { background: var(--sheet-2); }
.dlg label.opt input { accent-color: var(--accent); }
.dlg .why-label { display: block; font-weight: 500; margin-bottom: 8px; }
.dlg textarea { min-height: 72px; }
.dlg .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.dlg .row .spacer { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 8px; font-size: 14.5px;
  transition: opacity .2s, transform .2s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { padding: 40px 0; color: var(--muted); font: 400 18px/1.5 var(--serif); }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .body-row { grid-template-columns: minmax(0, 680px) 220px; gap: 36px; }
  .graph-layout { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .grid-feed { grid-template-columns: 1fr; gap: 48px; }
  .rail { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 32px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 24px; }
  .sky { max-height: 300px; }
  .body-row { grid-template-columns: 1fr; gap: 0; }
  .row-margin { padding: 0 0 20px; }
  .add-note { opacity: 1; }
  .row-margin:not(:has(.mnote, .note-form)) { padding-bottom: 8px; }
  .notes-layout { grid-template-columns: 1fr; }
  .note-tree { position: static; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .top .wrap { gap: 12px; height: 56px; }
  .nav, .search, .top-tools .btn-primary { display: none; }
  .top-tools .search-icon-link { display: inline-flex; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--sheet); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 12px; color: var(--muted); }
  .tabbar a[aria-current='page'] { color: var(--accent); }
  .page { padding-top: 28px; padding-bottom: 110px; }
  .h1 { font-size: 32px; }
  .post { padding: 20px 18px 16px; }
  .post-title { font-size: 23px; }
  .post-lede { font-size: 17px; }
  .post-foot { flex-direction: column; align-items: flex-start; }
  .article-title { font-size: 34px; }
  .article-lede { font-size: 19.5px; }
  :root { --read-size: 18.5px; }
  :root[data-text='large'] { --read-size: 20.5px; }
  .hero-name { font-size: 40px; }
  .stats { gap: 22px; flex-wrap: wrap; }
  .stats b { font-size: 26px; }
  .editor-sheet { padding: 28px 20px; }
  .ta-title { font-size: 30px; }
  .community { grid-template-columns: 6px minmax(0, 1fr); padding-right: 18px; }
  .community > .btn { grid-column: 2; justify-self: start; margin-top: 12px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .set-row { align-items: flex-start; flex-direction: column; }
  .toast { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.post-by .dot::before { margin: 0 6px 0 0; }
.editor .where { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.margins-row { margin: -16px 0 10px; }

/* ================= Дополнения: виды ленты, закладки, вход, управление ================= */
[hidden] { display: none !important; }
#view[aria-busy='true'] { min-height: 60vh; }

.feed-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }

/* Загнутый уголок — закладка, как в первой версии */
.corner {
  --c: var(--sheet-2);
  position: absolute; top: -1px; right: -1px; width: 34px; height: 34px; padding: 0; border: 0; cursor: pointer;
  border-radius: 0 var(--radius) 0 0;
  background: linear-gradient(225deg, var(--paper) 0 50%, var(--c) 50% 100%);
  filter: drop-shadow(-1px 1px 1px rgba(60, 42, 24, .14));
  transition: width .18s, height .18s;
}
.corner:hover { width: 42px; height: 42px; --c: var(--line); }
.corner[aria-pressed='true'] { --c: var(--accent); }
.corner:focus-visible { outline-offset: -4px; }

.tags.small { font-size: 13.5px; margin: 12px 0 0; }
.post .tags.small + .post-foot { margin-top: 14px; }
.counts { color: var(--muted); font-size: 13.5px; }
.counts.under { margin: 10px 0 0; }
.why.counts { display: block; }

/* Вид «Карточки» */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tile { position: relative; padding: 20px 22px 16px; display: flex; flex-direction: column; }
.tile .post-by { margin-bottom: 10px; font-size: 13.5px; }
.tile-title { font: 600 20px/1.25 var(--serif); margin: 0 0 8px; text-wrap: balance; padding-right: 16px; }
.tile-title a:hover { color: var(--accent); }
.tile-lede { flex: 1; margin: 0 0 14px; font: 400 16px/1.5 var(--serif); color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.tile-foot .tags.small { margin: 0; }
.meta svg { display: inline-block; vertical-align: -3px; margin-right: 3px; width: 14px; height: 14px; }

/* Вид «Дайджест»: ленточка слева, как в первой версии */
.digest { list-style: none; margin: 0; padding: 4px 18px; }
.digest-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.digest-row:last-child { border-bottom: 0; }
.strip {
  flex: 0 0 auto; width: 32px; height: 36px; border: 0; padding: 0; cursor: pointer; border-radius: 2px;
  background: linear-gradient(to right, var(--line) 6px, transparent 6px);
  transition: width .25s ease, background .2s ease;
}
.strip:hover { background: linear-gradient(to right, var(--muted) 6px, transparent 6px); }
.strip[aria-pressed='true'] { width: 30px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 72% 50%, 100% 100%, 0 100%); }
.digest-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 2px 0; }
.digest-title { font: 600 18px/1.3 var(--serif); }
.digest-main:hover .digest-title { color: var(--accent); }
.digest-tag { flex: 0 0 auto; font-size: 13px; color: var(--muted); }
.digest-tag::before { content: '#'; opacity: .6; }
.digest-go { color: var(--muted); flex: 0 0 auto; }

/* Статья */
.byline { flex-wrap: wrap; }
.byline-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.byline .menu-pop { min-width: 210px; }
.reactions .btn .count { margin-left: 8px; color: var(--muted); font: 500 14px var(--sans); }
.reactions .btn[aria-pressed='true'] .count { color: inherit; }
.h-count { margin-left: 10px; font: 400 18px var(--sans); color: var(--muted); }
.discussion .h2 { margin-bottom: 20px; }
.comment-actions { display: flex; gap: 14px; }
.read-progress { position: fixed; top: 64px; left: 0; right: 0; height: 2px; z-index: 49; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* Кнопки и формы */
.btn-danger { background: #A23B2A; border-color: #A23B2A; color: #FFF8F2; }
.btn-danger:hover { background: #8A2F21; border-color: #8A2F21; }
.danger-text { color: #A23B2A; }
:root[data-theme='dark'] .danger-text { color: #EE8A76; }
.field-area.line { min-height: 0; height: 44px; resize: none; margin-bottom: 12px; font: 400 16px var(--sans); }
.form-error { margin: 4px 0 0; color: #A23B2A; font-size: 14.5px; }
:root[data-theme='dark'] .form-error { color: #EE8A76; }
.auth-tabs { display: flex; margin-bottom: 20px; }
.auth-tabs button { flex: 1; }
.dlg fieldset .field-area.line { margin: 6px 0 0 30px; width: calc(100% - 30px); }
.toast-undo { border: 0; background: none; color: inherit; text-decoration: underline; margin-left: 8px; cursor: pointer; }
.link { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.search.wide { width: 100%; height: 44px; margin-bottom: 24px; }
.search.big { height: 48px; margin: 0; }
.search.big input { font-size: 17px; }
.head-actions { display: flex; gap: 8px; }
.community-top { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.need-auth { margin: 40px auto; text-align: center; }
.need-auth .actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }
.grow { flex: 1; }
.chip.select { border-radius: 6px; }

/* Коллекции: «почему» правится по нажатию */
.card .because { display: block; width: 100%; text-align: left; border: 0; border-top: 1px dashed var(--line); background: none; cursor: text; }
.card .because:hover { color: var(--ink); }
.card .because.empty-why { color: var(--muted); }
.why-form { margin-top: 12px; }
.why-form .row { display: flex; gap: 6px; margin-top: 8px; }

/* Папки */
.folder > summary .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder > summary .n { margin-left: 0; }
.folder-tools { display: flex; opacity: 0; transition: opacity .15s; }
.folder > summary:hover .folder-tools, .folder > summary:focus-within .folder-tools { opacity: 1; }
.icon-btn.sm { width: 26px; height: 26px; }
.note-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.back-link { display: none; align-items: center; gap: 6px; color: var(--muted); font-size: 14.5px; margin-bottom: 14px; }
.editor .back-link { display: inline-flex; margin: 0; }
.back-link:hover { color: var(--ink); }

@media (hover: none) {
  .folder-tools { opacity: 1; }
  .corner { width: 40px; height: 40px; }
}

@media (max-width: 960px) {
  .notes-layout.has-note .note-tree { display: none; }
  .notes-layout:not(.has-note) .note-editor { display: none; }
  .back-link { display: inline-flex; }
}

@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr; }
  .feed-head { align-items: flex-start; }
  .feed-head .seg { width: 100%; }
  .feed-head .seg button { flex: 1; }
  .hide-sm { display: none; }
  .byline { gap: 10px 12px; }
  .byline-actions { width: 100%; }
  .byline-actions .btn { height: 40px; min-width: 40px; }
  .read-progress { top: 56px; }
  .digest { padding: 2px 12px; }
  .digest-tag, .digest-go { display: none; }
  .digest-title { font-size: 17px; }
  .reactions .btn { flex: 1 1 auto; }
  .respond { flex-wrap: wrap; }
  .margins-ctl { flex-wrap: wrap; }
  .margins-ctl .seg { overflow-x: auto; max-width: 100%; }
  .tabs.scroll-x { overflow-x: auto; scrollbar-width: none; }
  .tabs.scroll-x a { white-space: nowrap; }
  .icon-btn { width: 40px; height: 40px; }
  .note-editor { padding: 20px 18px; }
  .note-editor .title-in { font-size: 24px; }
  .note-editor .row .grow { flex-basis: 100%; height: 0; }
  .editor-bar { bottom: calc(60px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .editor-bar .progress { flex-basis: 100%; }
  .editor-bar .btn-primary { margin-left: auto; }
  .editor .context .where { margin-left: 0; white-space: normal; flex-wrap: wrap; }
  .head-actions { width: 100%; }
  .graph-side { padding: 18px; }
  .settings .seg { max-width: 100%; overflow-x: auto; }
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .dlg { padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); }
  .dlg .row { flex-wrap: wrap; }
  .page-head .head-actions .btn { flex: 1; }
  .hero .wrap { padding-top: 32px; padding-bottom: 28px; }
  .hero-actions .btn { height: 40px; }
  .community-head { padding: 22px 18px 20px 26px; }
  .post-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}

/* ================= Изображения: аватары, обложки, иллюстрации ================= */
img.av-img { object-fit: cover; padding: 0; background: var(--sheet-2); box-shadow: inset 0 0 0 1px var(--line-soft); }
.me-av { display: inline-flex; }

/* Обложка в карточке ленты — на всю ширину карточки */
.post-cover { display: block; margin: -26px -30px 20px; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--sheet-2); }
.post-cover img, .tile-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .4s ease; }
.post-cover:hover img, .tile-cover:hover img { transform: scale(1.015); }
.post.has-cover .corner, .tile.has-cover .corner { z-index: 2; }
.tile-cover { display: block; margin: -20px -22px 14px; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--sheet-2); }
.digest-thumb { flex: 0 0 auto; width: 72px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--sheet-2); }
.digest-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-link.has-thumb::after { content: ''; display: block; clear: both; }
.row-thumb { float: right; width: 148px; margin: 4px 0 8px 20px; border-radius: 8px; overflow: hidden; background: var(--sheet-2); }
.row-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

/* Статья */
.article-cover { margin: 0 0 40px; border-radius: var(--radius); overflow: hidden; background: var(--sheet-2); box-shadow: var(--shadow-sheet); }
.article-cover img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; }
.fig { margin: .4em 0 1.6em; }
.fig img { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--sheet-2); box-shadow: var(--shadow-sheet); }
.fig figcaption { margin-top: 10px; font: 400 14.5px/1.5 var(--sans); color: var(--muted); }

/* Профиль: место под аватар */
.hero-id { display: flex; align-items: center; gap: 22px; }
.hero-titles { min-width: 0; }
.hero-titles .hero-role { margin-top: 10px; }
.hero-av { position: relative; flex: 0 0 auto; display: inline-flex; padding: 0; border: 0; background: none; border-radius: 50%; }
button.hero-av { cursor: pointer; }
.hero-av .av { box-shadow: 0 0 0 4px var(--sheet-2), 0 0 0 5px var(--line); }
.hero-av-edit {
  position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--sheet); color: var(--ink-2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18); transition: color .15s, background .15s;
}
button.hero-av:hover .hero-av-edit { background: var(--accent); color: var(--on-accent); }
.set-photo { display: flex; align-items: center; gap: 14px; }

/* Редактор: обложка и картинки внутри текста */
.ed-cover-add {
  display: inline-flex; align-items: center; gap: 8px; margin: -12px 0 22px; padding: 8px 14px; border-radius: 8px;
  border: 1.5px dashed var(--line); background: none; color: var(--muted); font-weight: 500; cursor: pointer;
}
.ed-cover-add:hover { color: var(--accent); border-color: var(--accent); }
.ed-cover { position: relative; margin: -48px -56px 32px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--sheet-2); }
.ed-cover img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; }
.ed-cover-tools { position: absolute; right: 14px; top: 14px; display: flex; gap: 6px; }
.ed-cover-tools .btn { background: color-mix(in srgb, var(--sheet) 92%, transparent); backdrop-filter: blur(6px); }
.ed-body { margin-top: 28px; }
.ed-body .ta-body { margin-top: 0; min-height: 3.4em; }
.ed-body .ta-body:last-of-type { min-height: 200px; }
.ed-fig { position: relative; margin: 10px 0 18px; }
.ed-fig img { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--sheet-2); }
.ed-cap { width: 100%; margin-top: 8px; padding: 6px 0; border: 0; border-bottom: 1px dashed var(--line); background: none; outline: 0; font: 400 14.5px var(--sans); color: var(--ink-2); }
.ed-cap:focus { border-bottom-color: var(--muted); }
.ed-fig-x { position: absolute; top: 10px; right: 10px; background: color-mix(in srgb, var(--sheet) 92%, transparent); box-shadow: var(--shadow-sheet); }
.ed-tools { margin-top: 6px; }

@media (max-width: 760px) {
  .post-cover { margin: -20px -18px 16px; }
  .hero-id { gap: 16px; }
  .hero-av .av { --s: 68px !important; }
  .row-thumb { width: 96px; margin-left: 14px; }
  .digest-thumb { width: 56px; height: 40px; }
  .ed-cover { margin: -28px -20px 24px; }
  .article-cover { margin: 0 -16px 28px; border-radius: 0; }
}

.byline .meta { white-space: nowrap; }
.byline-actions { margin-left: auto; }
@media (max-width: 760px) { .byline-actions { margin-left: 0; } }
