/*
 * Telegram-channel styling for /tech-blog.
 *
 * The tech-director's blog reads like a Telegram channel — short, chatty,
 * emoji-heavy posts — so we render it as one: a channel header, then each post
 * as an incoming message bubble on a subtle chat "wallpaper", with a
 * views/date footer and floating month separators. Warm variant: Telegram's
 * blue accent is swapped for the site's gold (--rl-accent) so the section
 * blends with the dark-gold header/footer chrome.
 *
 * Everything is scoped under `.tgc` and this file is loaded only on the
 * /tech-blog page (pushed via @push('head')), so nothing here leaks elsewhere.
 */
.tgc {
    --tg-accent: var(--rl-accent, #E3C083);
    --tg-accent-ink: #1a1c20;                 /* text on the gold button */
    --tg-wall: #14161b;                        /* chat background */
    --tg-bubble: #21262f;                      /* incoming message surface */
    --tg-bubble-hover: #262c37;
    --tg-border: #2b313b;
    --tg-heading: var(--rl-heading, #fff);
    --tg-text: #eef1f6;
    --tg-meta: rgba(220, 228, 238, .85);

    /* The page wrapper matches the site width (1240px) so /tech-blog lines up
       with every other page. The chat feed and the channel header below are
       capped to a comfortable reading measure and centered — see .tgc__inner. */
    max-width: var(--rl-container, 1240px);
    margin: 0 auto;
    padding: 40px 20px 48px;
    box-sizing: border-box;
    font-family: var(--uicore-secondary-font-family, "TildaSans-"), -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Inner reading column --------------------------------------------------
 * The Telegram-channel look reads best in a narrow column, so even though the
 * page is now the full site width, the channel header, the chat feed and the
 * single-post body all live in a centered ~860px column (the same long-form
 * measure .rl-doc--narrow uses elsewhere). Navigating feed -> post -> feed
 * therefore never changes the reading width, and the section still lines up
 * with the site's content edge. */
.tgc__channel,
.tgc__about,
.tgc__feed,
.tgc__post-foot,
.tgc--post > .tgc__msg {
    max-width: 860px;
    margin-inline: auto;
}

/* ---- Channel header card --------------------------------------------------- */
.tgc__channel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--tg-bubble);
    border: 1px solid var(--tg-border);
    border-radius: 16px;
}

.tgc__ava {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    overflow: hidden;
    background: #0f1115;
    box-shadow: 0 0 0 2px rgba(227, 192, 131, .35);
    flex: none;
}
.tgc__ava img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tgc__name {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--tg-heading);
}
.tgc__check { width: 16px; height: 16px; flex: none; color: var(--tg-accent); }
.tgc__sub { margin: 3px 0 0; font-size: 13.5px; color: var(--tg-meta); }
.tgc__sub b { color: var(--tg-text); font-weight: 600; }
.tgc__handle { color: var(--tg-accent); text-decoration: none; font-weight: 600; }
.tgc__handle:hover { text-decoration: underline; }

.tgc__subscribe {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 22px;
    background: var(--tg-accent);
    color: var(--tg-accent-ink);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .15s ease, transform .15s ease;
}
.tgc__subscribe svg { width: 16px; height: 16px; }
.tgc__subscribe:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* Channel "about" — the pinned description under the header. */
.tgc__about {
    margin: 10px 2px 0;
    padding: 0 4px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--tg-meta);
}

/* ---- Chat feed / wallpaper ------------------------------------------------- */
.tgc__feed {
    margin-top: 16px;
    padding: 18px 16px 22px;
    border: 1px solid var(--tg-border);
    border-radius: 16px;
    background-color: var(--tg-wall);
    /* Subtle dotted "wallpaper" — self-contained, no external asset. */
    background-image: radial-gradient(rgba(227, 192, 131, .04) 1px, transparent 1.4px);
    background-size: 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tgc__empty {
    text-align: center;
    color: var(--tg-meta);
    padding: 28px 0;
    font-size: 14px;
}

/* Floating month separator. */
.tgc__daysep {
    align-self: center;
    margin: 6px 0 2px;
    padding: 3px 13px;
    border-radius: 13px;
    background: rgba(0, 0, 0, .38);
    color: #d3dae2;
    font-size: 12.5px;
    font-weight: 600;
}

/* ---- Message bubble -------------------------------------------------------- */
.tgc__msg { position: relative; max-width: 92%; align-self: flex-start; }

.tgc__msg-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 14px;
}

.tgc__bubble {
    position: relative;
    padding: 12px 15px 10px;
    background: var(--tg-bubble);
    border: 1px solid var(--tg-border);
    /* Squared bottom-left corner is the "incoming message" cue. */
    border-radius: 14px 14px 14px 4px;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.tgc__msg:hover .tgc__bubble {
    background: var(--tg-bubble-hover);
    border-color: rgba(227, 192, 131, .45);
    transform: translateY(-1px);
}

.tgc__title {
    margin: 0 0 5px;
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.32;
    color: var(--tg-heading);
}
.tgc__body {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--tg-text);
}

/* Meta footer: read hint on the left, views + date on the right. */
.tgc__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 9px;
}
.tgc__more {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-meta);
    transition: color .16s ease;
}
.tgc__msg:hover .tgc__more { color: var(--tg-accent); }

.tgc__stats {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--tg-meta);
    white-space: nowrap;
}
.tgc__views { display: inline-flex; align-items: center; gap: 4px; }
.tgc__views svg { width: 15px; height: 15px; opacity: .8; }
.tgc__dot { opacity: .5; }

/* ---- Detail page (.tgc--post) ----------------------------------------------
 * A single post renders like the channel it came from: the title is an
 * "outgoing" message bubble (sent by the author), the body is an "incoming"
 * message on the wallpaper. Both sit in the centered 860px reading column
 * (see .tgc__channel above), so moving between /tech-blog and /tech-blog/{slug}
 * never changes the reading width. */
.tgc--post { padding-top: 32px; }

/* Outgoing message: the squared corner flips to top-right (a Telegram
   "sent by me" tail). A touch warmer than the incoming surface so the title
   reads as the author's own voice, distinct from the body below. */
.tgc--post .tgc__msg--out {
    max-width: 92%;
    margin-inline: auto auto 0;   /* hug the right edge of the reading column, like an outgoing chat message */
}
.tgc--post .tgc__bubble--out {
    padding: 16px 18px 14px;
    background: linear-gradient(180deg, rgba(227, 192, 131, .12), rgba(227, 192, 131, .06)), var(--tg-bubble);
    border-color: rgba(227, 192, 131, .35);
    border-radius: 14px 4px 14px 14px;   /* outgoing tail: squared top-right */
}

.tgc__post-title {
    margin: 0 0 8px;
    font-family: var(--uicore-primary-font-family, "TildaSans-"), sans-serif;
    font-size: clamp(20px, 3.4vw, 26px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--tg-heading);
    text-wrap: balance;
}
.tgc__meta--post {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--tg-meta);
    gap: 10px;
}
.tgc__meta--post time { color: var(--tg-meta); }

/* Body bubble on the chat wallpaper. */
.tgc__entry {
    /* The body uses the same long-form typography the rest of the site gets via
       .rl-doc .entry-content (content.css), re-homed here under .tgc__entry so it
       applies inside the Telegram bubble without pulling the 1240px shell with it. */
    color: var(--tg-text);
    font-size: 16.5px;
    line-height: 1.72;
}
.tgc__entry > :first-child { margin-top: 0; }
.tgc__entry > :last-child { margin-bottom: 0; }

.tgc__entry h1,
.tgc__entry h2,
.tgc__entry h3,
.tgc__entry h4 {
    color: var(--tg-heading);
    font-family: var(--uicore-primary-font-family, "TildaSans-"), sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin: 1.5em 0 .5em;
}
.tgc__entry h1 { font-size: clamp(22px, 3.4vw, 28px); }
.tgc__entry h2 { font-size: clamp(20px, 2.8vw, 24px); }
.tgc__entry h3 { font-size: 19px; }
.tgc__entry h4 { font-size: 17px; }

.tgc__entry p { margin: 0 0 1.05em; text-wrap: pretty; }
.tgc__entry a { color: var(--tg-accent); text-decoration: none; }
.tgc__entry a:hover { text-decoration: underline; }

.tgc__entry ul,
.tgc__entry ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.tgc__entry li { margin: .35em 0; }
.tgc__entry ul { list-style: none; padding-left: 1.6em; }
.tgc__entry ul > li { position: relative; }
.tgc__entry ul > li::before {
    content: '';
    position: absolute;
    left: -1.15em; top: .65em;
    width: 6px; height: 6px;
    border-radius: 6px;
    background: var(--tg-accent);
}
.tgc__entry strong { color: var(--tg-heading); font-weight: 700; }

.tgc__entry img,
.tgc__entry video,
.tgc__entry iframe {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: .5em 0 1.1em;
}
/* Portrait phone screenshots (Telegram-post images) blow up to the full column
   width otherwise — capped and centered like an inline illustration. Mirrors the
   .rl-doc .entry-content img.rl-shot rule from content.css. */
.tgc__entry img.rl-shot {
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.tgc__entry blockquote {
    margin: 1.3em 0;
    padding: 2px 0 2px 16px;
    border-left: 3px solid var(--tg-accent);
    color: var(--tg-heading);
    font-size: 18px;
}
.tgc__entry blockquote p { margin: 0; }

.tgc__entry code {
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--tg-border);
    border-radius: 6px;
    padding: .12em .4em;
    font-size: .88em;
}
.tgc__entry pre {
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--tg-border);
    border-radius: 6px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 1.1em;
}
.tgc__entry pre code { background: none; border: 0; padding: 0; }

.tgc__entry hr { border: 0; border-top: 1px solid var(--tg-border); margin: 1.8em 0; }

.tgc__entry table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.3em;
    font-size: 14.5px;
    display: block;
    overflow-x: auto;
}
.tgc__entry th,
.tgc__entry td { border: 1px solid var(--tg-border); padding: 9px 12px; text-align: left; }
.tgc__entry th { background: rgba(0, 0, 0, .25); color: var(--tg-heading); }

/* Subscribe pill row under the body. */
.tgc__post-foot {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

/* ---- Elementor-built posts inside .tgc -------------------------------------
 * The "Новые задачи Битрикс24" post (and any future Elementor body) carries its
 * own boxed containers that content.css pins to the site's 1240px width. Inside
 * the reading column (860px) they would overflow, so re-pin them to the column
 * and let the section stretch. Matches the global override in content.css, just
 * scoped tighter here. */
.tgc .elementor-section.elementor-section-boxed > .elementor-container,
.tgc .elementor > .e-con.e-con-boxed > .e-con-inner {
    max-width: 100%;
}

/* ---- Mobile ---------------------------------------------------------------- */
@media (max-width: 600px) {
    .tgc { padding: 24px 10px 36px; }
    .tgc__channel { gap: 12px; padding: 14px; }
    .tgc__ava { width: 48px; height: 48px; }
    .tgc__name { font-size: 17px; }
    .tgc__subscribe { padding: 8px 14px; font-size: 13px; }
    .tgc__msg { max-width: 100%; }
    .tgc__title { font-size: 15.5px; }
    .tgc--post .tgc__msg--out { max-width: 100%; }
    .tgc__post-title { font-size: 20px; }
    .tgc__entry { font-size: 16px; }
    .tgc__entry img.rl-shot { max-width: 280px; }
}
/* On the narrowest screens, drop the subscribe label to an icon so the header
   never wraps awkwardly. */
@media (max-width: 380px) {
    .tgc__subscribe span { display: none; }
    .tgc__subscribe { padding: 9px; border-radius: 50%; }
}
