/* feed-publications-shell.css — admin-hub frame: 1180px shell, left column (not centered island) */

body.feed-publications-shell.feed-v2-surface {
  --dc-shell-max: min(100%, 1180px);
  --feed-pub-frame-max: min(100%, 1180px);
  --feed-pub-frame-pad: max(12px, env(safe-area-inset-left, 0px));
  --feed-pub-frame-pad-end: max(12px, env(safe-area-inset-right, 0px));
  --feed-pub-header-reserve: var(--dc-header-h, var(--feed-v2-mobile-header-reserve, 52px));
  /* Reserve the nav from STABLE components (bar + legal + gap + its own safe-area
     padding) instead of --dc-bottom-nav-shell-h, which is a JS-measured value that
     goes stale (e.g. measured when the nav had 5 tabs / wrapped to 2 rows) and then
     leaves a dark navy strip above the docked nav when scrolling in iOS PWA. */
  --feed-pub-nav-reserve: calc(var(--dc-bottom-nav-bar-h, 50px) + var(--dc-bottom-nav-legal-h, 16px) + 6px + var(--dc-bottom-nav-padding-bottom, 0px));
  --feed-pub-scroll-chrome: var(--feed-pub-nav-reserve);
  --feed-pub-col-text: min(100%, var(--feed-v4-col-text-post, 520px));
  --feed-pub-col-voice: min(100%, var(--feed-v4-col-voice, 360px));
  --feed-pub-col-circle: min(100%, var(--feed-v4-col-circle, 280px));
  --dc-bottom-nav-max-width: min(100%, 1180px);
  --feed-v2-frame-max: min(100%, 1180px);
}

/* Admin-frame .wrap — beats tablet 720px / phone centered column */
html body.feed-publications-shell.feed-v2-surface .wrap {
  width: 100% !important;
  max-width: var(--feed-pub-frame-max) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

html body.feed-publications-shell.feed-v2-surface .dc-shell-main {
  padding-left: var(--feed-pub-frame-pad) !important;
  padding-right: var(--feed-pub-frame-pad-end) !important;
  box-sizing: border-box !important;
}

/* Admin feed shares this shell, but its admin-chrome path leaves the 1180 publications frame on
   the .wrap (centered), while the user feed wrap is full-width with the column at the far left.
   Match the user feed exactly: full-width wrap so the admin column sits at the left edge too. */
html body.feed-publications-shell.feed-v2-surface.site-feed-admin-page .wrap {
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

@media (min-width: 900px) {
  html body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active) .wrap {
    max-width: min(100%, 1180px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  html body.feed-publications-shell.feed-v2-surface {
    --dc-bottom-nav-max-width: min(100%, 1180px);
    --feed-v2-frame-max: min(100%, 1180px);
  }
}

/* === Viewport chain (mobile / PWA) === */
@supports (height: 100dvh) {
  html:has(body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active)),
  html body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active) {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  html body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active) .wrap {
    height: 100dvh;
    max-height: 100dvh;
  }
}

html:has(body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active)),
html body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active) {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active) .wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

html body.feed-publications-shell.feed-v2-surface:not(.feed-v2-desktop-active) .dc-shell-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

html body.feed-publications-shell.feed-v2-surface .feed-publications-page,
html body.feed-publications-shell.feed-v2-surface .feed-publications-workspace,
html body.feed-publications-shell.feed-v2-surface .feed-publications-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  align-items: stretch;
}

/* Pinned chrome — full pane width, admin breadcrumb / adx-dock */
html body.feed-publications-shell.feed-v2-surface .feed-publications-chrome {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  margin: 0 0 10px;
  box-sizing: border-box;
}

html body.feed-publications-shell.feed-v2-surface .feed-publications-chrome .feed-v2-pinned-bar,
html body.feed-publications-shell.feed-v2-surface .feed-v2-pane-feed > .feed-publications-chrome .feed-v2-pinned-bar {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

html body.feed-publications-shell.feed-v2-surface .feed-publications-chrome .feed-v2-pinned-bar__main,
html body.feed-publications-shell.feed-v2-surface .feed-v2-pane-feed > .feed-publications-chrome .feed-v2-pinned-bar__main {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  min-height: var(--dc-hub-pinned-bar-h, 40px);
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(12, 14, 20, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: left;
}

html body.feed-publications-shell.feed-v2-surface .feed-publications-chrome .feed-v2-pinned-bar__title {
  font-size: 11px;
  font-weight: 560;
  color: rgba(255, 176, 88, 0.92);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

html body.feed-publications-shell.feed-v2-surface .feed-publications-chrome .feed-v2-pinned-bar__text {
  font-size: 13px;
  line-height: 1.25;
  color: rgba(246, 247, 250, 0.88);
}

/* Posts scroller — beat feed-v2-shell/responsive workspace:not(.feed-v2-workspace--desktop-split) center */
html body.feed-publications-shell.feed-v2-surface.feed-publications-open .feed-v2-workspace.feed-publications-workspace:not(.feed-v2-workspace--desktop-split) .feed-v2-pane-feed > #feedPosts,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active .feed-v2-workspace.feed-publications-workspace:not(.feed-v2-workspace--desktop-split) .feed-v2-pane-feed > #feedPosts,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open .feed-v2-pane-feed > #feedPosts,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active .feed-v2-pane-feed > #feedPosts,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open #feedPosts[data-feed-publications] {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  align-items: flex-start !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding-bottom: var(--feed-pub-scroll-chrome, var(--dc-bottom-nav-shell-h, 76px)) !important;
  box-sizing: border-box !important;
  gap: var(--feed-v4-card-gap, 14px) !important;
}

/* LEFT column — beat feed-v2-responsive center at 900px+ and phone-landscape center */
html body.feed-publications-shell.feed-v2-surface.feed-publications-open #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open #feedPosts > .feed-publication.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active #feedPosts > .feed-publication.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open .feed-v2-workspace.feed-publications-workspace:not(.feed-v2-workspace--desktop-split) .feed-v2-pane-feed > #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open .feed-v2-workspace.feed-publications-workspace:not(.feed-v2-workspace--desktop-split) .feed-v2-pane-feed > #feedPosts > .feed-publication.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active .feed-v2-workspace.feed-publications-workspace:not(.feed-v2-workspace--desktop-split) .feed-v2-pane-feed > #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active .feed-v2-workspace.feed-publications-workspace:not(.feed-v2-workspace--desktop-split) .feed-v2-pane-feed > #feedPosts > .feed-publication.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open .feed-v2-pane-feed > #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open .feed-v2-pane-feed > #feedPosts > .feed-publication.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active .feed-v2-pane-feed > #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-desktop-active .feed-v2-pane-feed > #feedPosts > .feed-publication.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open #feedPosts > .tg-channel-empty,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open #feedPosts > #feedEmptyState,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-phone-landscape-active #feedPosts > .feed-post.tg-channel-post,
html body.feed-publications-shell.feed-v2-surface.feed-publications-open.feed-v2-phone-landscape-active .feed-v2-pane-feed > #feedPosts > .feed-post.tg-channel-post {
  align-self: flex-start !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-inline: 0 !important;
  width: var(--feed-pub-col-text) !important;
  max-width: var(--feed-pub-col-text) !important;
}

html body.feed-publications-shell.feed-v2-surface #feedPosts > .feed-post.tg-channel-post-voice,
html body.feed-publications-shell.feed-v2-surface #feedPosts > .feed-publication.tg-channel-post-voice {
  align-self: flex-start !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: var(--feed-pub-col-voice) !important;
  max-width: var(--feed-pub-col-voice) !important;
}

html body.feed-publications-shell.feed-v2-surface #feedPosts > .feed-post.feed-post--video-circle,
html body.feed-publications-shell.feed-v2-surface #feedPosts > .feed-post.tg-channel-post-circle {
  align-self: flex-start !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: var(--feed-pub-col-circle) !important;
  max-width: var(--feed-pub-col-circle) !important;
}

@media (min-width: 900px) and (min-height: 560px) {
  html body.feed-publications-shell.feed-v2-surface.feed-v2-desktop-active .wrap {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  html body.feed-publications-shell.feed-v2-surface.feed-v2-desktop-active .dc-shell-main {
    overflow: visible;
  }

  html body.feed-publications-shell.feed-v2-surface.feed-v2-desktop-active .feed-v2-pane-feed > #feedPosts {
    align-items: flex-start !important;
    padding-bottom: 16px !important;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  body.feed-publications-shell.feed-v2-surface {
    --feed-v4-body-size: 12px;
    --feed-v4-caption-size: 12px;
    --feed-v4-meta-size: 9px;
    --feed-pub-col-text: min(100%, clamp(280px, 62vw, 480px));
  }

  html body.feed-publications-shell.feed-v2-surface .feed-publications-chrome .feed-v2-pinned-bar__main {
    min-height: 34px;
    padding: 5px 10px;
  }

  html body.feed-publications-shell.feed-v2-surface.feed-v2-phone-landscape-active .feed-v2-pane-feed > #feedPosts,
  html body.feed-publications-shell.feed-v2-surface.feed-v2-phone-landscape-active #feedPosts {
    align-items: flex-start !important;
  }
}

body.feed-publications-shell.feed-v2-surface #feedPosts {
  font-size: var(--feed-v4-body-size, 13px);
  line-height: var(--feed-v4-body-line, 1.35);
}

html body.feed-publications-shell.feed-v2-surface,
html body.feed-publications-shell.feed-v2-surface .wrap,
html body.feed-publications-shell.feed-v2-surface .dc-shell-main,
html body.feed-publications-shell.feed-v2-surface .feed-publications-page,
html body.feed-publications-shell.feed-v2-surface .feed-publications-workspace {
  background-color: transparent;
  background-image: none;
}

/* First-entry FOUC guard (2026-06-26): on iOS the feed surface paints ONCE in a pre-layout state
   (system-font header, pre-device-class column, before the boot scroll) BEFORE the inline layout
   pass adds .feed-v2-active — that flash reads as "a different/old feed on first entry". Fade the
   surface in only once .feed-v2-active is set. The animation is self-healing (always ends at
   opacity:1), so a JS hiccup can never leave the page blank. Reveal is instant once the class is
   present (rule stops matching), so there is no added delay on a normal load. */
@keyframes dc-feed-fouc-in { from { opacity: 0; } to { opacity: 1; } }
html body.feed-v2-surface.feed-publications-shell:not(.feed-v2-active) > .wrap,
html body.feed-v2-surface.feed-publications-shell:not(.feed-v2-active) > .dc-safe-top-chrome,
html body.feed-v2-surface.feed-publications-shell:not(.feed-v2-active) > header.dc-app-header {
  animation: dc-feed-fouc-in 0.5s ease-out both;
}

/* PWA boot cloak: in standalone, hold the whole feed (content + header + nav) hidden until the iOS
   cold-start viewport has settled (html.dc-nav-shown — set by the detector script, fallback 1.5s),
   then fade everything in at once. This hides the nav descent AND the content pin/jerk entirely.
   Supersedes the early FOUC here (animation:none) so they don't fight. Desktop/browser untouched. */
@media (display-mode: standalone) {
  html body.feed-v2-surface.feed-publications-shell > .wrap,
  html body.feed-v2-surface.feed-publications-shell > .dc-safe-top-chrome,
  html body.feed-v2-surface.feed-publications-shell > header.dc-app-header,
  html body.feed-v2-surface.feed-publications-shell nav.user-bottom-nav.dc-bottom-nav {
    animation: none !important;
    transition: opacity 0.2s ease !important;
  }
  html:not(.dc-nav-shown) body.feed-v2-surface.feed-publications-shell > .wrap,
  html:not(.dc-nav-shown) body.feed-v2-surface.feed-publications-shell > .dc-safe-top-chrome,
  html:not(.dc-nav-shown) body.feed-v2-surface.feed-publications-shell > header.dc-app-header,
  html:not(.dc-nav-shown) body.feed-v2-surface.feed-publications-shell nav.user-bottom-nav.dc-bottom-nav {
    opacity: 0 !important;
  }
}

/* Branded loading splash shown during the PWA cloak (dedicated element created by the detector script —
   a real element, not a body pseudo, so it can't be clobbered by the feed's own ::before/::after).
   Soft dark backdrop + the pulsing clike brand mark. Fades out the instant the feed reveals. */
.dc-feed-cloak {
  position: fixed; inset: 0; z-index: 2147483600;
  display: flex; align-items: center; justify-content: center;
  background: #000;
  opacity: 1; transition: opacity 0.18s ease;
  /* Purely visual — must NEVER intercept taps. Without this the cloak (inset:0,
     opacity:0 but still in the DOM during the fade) ate the first tap after reveal,
     so a nav button needed a second press. */
  pointer-events: none;
}
.dc-feed-cloak__mark {
  display: block;
  font-family: -apple-system, system-ui, "Segoe UI", Arial, sans-serif;
  font-weight: 800; font-size: 36px; line-height: 1; letter-spacing: .3px;
  color: #ff8a00; /* "clike" — brand orange */
  animation: dc-cloak-pulse 0.95s cubic-bezier(.22,1,.36,1) infinite;
}
.dc-feed-cloak__mark > span { color: #ffffff; } /* ".ru" — white, like the header */
@keyframes dc-cloak-pulse {
  0%, 100% { transform: scale(.78); opacity: .45; text-shadow: 0 0 0 rgba(255,138,0,0); }
  42% { transform: scale(1.18); opacity: 1; text-shadow: 0 8px 34px rgba(255,138,0,.65); }
}

/* ===== Опросы / квизы ===== */
.feed-poll { margin: 6px 0 2px; display: flex; flex-direction: column; gap: 8px; }
.feed-poll__q { font-weight: 600; font-size: 15px; color: #fff; line-height: 1.3; }
.feed-poll__meta { font-size: 11px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .03em; }
.feed-poll__form { display: flex; flex-direction: column; gap: 6px; }
.feed-poll__opt { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); overflow: hidden; font-size: 14px; color: rgba(246,247,250,.92); }
.feed-poll__opt.is-vote { cursor: pointer; }
.feed-poll__opt.is-vote input { accent-color: #FF8A12; }
.feed-poll__bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; z-index: 0; background: linear-gradient(90deg, rgba(255,138,18,.28), rgba(255,194,77,.18)); transition: width .4s ease; }
.feed-poll__opt.is-chosen .feed-poll__bar { background: linear-gradient(90deg, rgba(255,138,18,.45), rgba(255,194,77,.3)); }
.feed-poll__opt.is-correct { border-color: rgba(80,200,120,.5); }
.feed-poll__opt-text { position: relative; z-index: 1; flex: 1; }
.feed-poll__pct { position: relative; z-index: 1; font-variant-numeric: tabular-nums; font-weight: 600; color: #fff; }
.feed-poll__total { font-size: 12px; color: rgba(255,255,255,.5); }
.feed-poll__vote-btn { align-self: flex-start; margin-top: 2px; padding: 8px 18px; border: 0; border-radius: 9px; background: linear-gradient(135deg, #FF8A12, #FFC24D); color: #1a1205; font-weight: 600; font-size: 13px; cursor: pointer; }
.feed-poll__comments { display: inline-flex; margin-top: 6px; color: #FF8A12; font-size: 13px; }
.feed-poll__caption { color: rgba(246,247,250,.92); margin-bottom: 2px; }

/* ===== Файл-вложения ===== */
.feed-file-card { display: flex; align-items: center; gap: 12px; margin: 6px 0 2px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); text-decoration: none; color: inherit; }
.feed-file-card:hover { background: rgba(255,255,255,.08); }
.feed-file-card__icon { flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: linear-gradient(135deg, #FF8A12, #FFC24D); color: #1a1205; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.feed-file-card__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feed-file-card__name { color: #fff; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-file-card__size { color: rgba(255,255,255,.5); font-size: 12px; }
.feed-file-card__dl { flex: 0 0 auto; color: #FF8A12; font-size: 20px; }
.feed-file-caption { margin-top: 6px; color: rgba(246,247,250,.92); }

/* ===== Форматирование текста поста ===== */
.tg-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: rgba(255,255,255,.09); padding: 1px 5px; border-radius: 5px; }
.tg-quote { display: block; border-left: 3px solid #FF8A12; padding: 1px 0 1px 10px; margin: 3px 0; color: rgba(246,247,250,.86); }
.tg-spoiler { border-radius: 4px; padding: 0 2px; background: rgba(255,255,255,.16); color: transparent; cursor: pointer; text-shadow: 0 0 9px rgba(255,255,255,.55); transition: color .15s ease, background .15s ease, text-shadow .15s ease; }
.tg-spoiler.is-revealed { color: inherit; background: rgba(255,255,255,.04); text-shadow: none; cursor: text; }

/* ===== Тулбар форматирования композера ===== */
#mobileAdminComposer { position: relative; }
.dc-fmt-bar { position: absolute; left: 10px; bottom: 100%; margin-bottom: 8px; display: none; gap: 5px; z-index: 60; padding: 5px; border-radius: 12px; background: #1f2b38; border: 1px solid rgba(255,255,255,.1); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.dc-fmt-bar.is-on { display: flex; }
.dc-fmt-btn { min-width: 34px; height: 32px; padding: 0 9px; border: 0; border-radius: 8px; background: rgba(255,255,255,.07); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.dc-fmt-btn:hover { background: rgba(255,255,255,.14); }

/* ===== Комментарии отключены (баннер) ===== */
.feed-comments-disabled { text-align: center; padding: 14px 16px; color: rgba(255,255,255,.55); font-size: 13px; }

/* Mask the initial pin-to-bottom on SPA re-entry to the feed (Акции->Лента): keep the
   scroll area transparent until the boot script pins it (it removes data-feed-boot), then
   fade in already-pinned — so the top-then-bottom flash is never visible. On cold start the
   boot cloak already holds the whole shell hidden, so this is a no-op there. */
html body.feed-publications-shell.feed-v2-surface #feedPosts{
  transition:opacity .18s ease;
}
html body.feed-publications-shell.feed-v2-surface #feedPosts[data-feed-boot]{
  opacity:0!important;
}
