/* Нововолинськ інфо — design tokens + components. See style.md for the
   architecture and the (planned) dark theme. All colours go through the
   tokens below so a future [data-theme="dark"] only re-declares :root. */

:root {
    /* Surfaces */
    --bg: #ffffff;
    --surface: #ffffff;
    --soft: #f7f7f8;

    /* Ink (text) */
    --ink: #111418;
    --ink-2: #3a3f47;
    --ink-3: #6b7280;
    --ink-4: #9aa1ab;

    /* Lines (newspaper hairlines) */
    --line: #e7e7ea;
    --line-2: #d5d7dc;

    /* Neutral surfaces (hover/active states, chips) */
    --surface-hover: #eef0f3;
    --surface-active: #e9ebef;
    --surface-2: #e5e7eb;
    --chip-bg: #efefef;

    /* Alias of --ink-3 — many components reference var(--muted). */
    --muted: var(--ink-3);

    /* Brand accent (used sparingly) */
    --accent: #0f766e;
    --accent-soft: #ecfdf5;

    /* Danger family (single source — was split between #b91c1c / #e11d48) */
    --danger: #e11d48;
    --danger-dark: #991b1b;
    --danger-soft: #fee2e2;

    /* Type */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;

    /* Layout — rock-solid geometry. The shell width and column positions
       NEVER change between layouts (3-col vs 2-col); a 2-col page just
       leaves the right rail empty, the left nav and the centre column stay
       exactly where they were. */
    --radius: 8px;
    --radius-pill: 999px;
    --shell-w: 1280px;
    --content-w: 720px;
    --content-2col: 744px;
    --left-w: 200px;
    --right-w: 300px;
    --gutter: 32px;
}

/* Dark theme (planned) — flip the tokens here, components stay untouched.
   Enable by adding data-theme="dark" on <html>. Kept commented until the
   palette is finalised; see style.md.
:root[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #161a20;
    --soft: #1c2128;
    --ink: #e8eaed;
    --ink-2: #c2c7cf;
    --ink-3: #8b93a1;
    --ink-4: #6b7280;
    --line: #2a2f37;
    --line-2: #3a4049;
    --surface-hover: #1f2530;
    --surface-active: #252c38;
    --surface-2: #2a313c;
    --chip-bg: #222831;
}
*/

/* Reset / base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* ------------------------------------------------------------------
   iOS Safari auto-zoom guard. Safari forcibly zooms the page in when
   the user taps an input/textarea/select whose computed font-size is
   under 16px. That feels like the site is "jumping" on every search
   click or reply tap. Pinning textual fields to >=16px on mobile
   suppresses that zoom entirely (without locking pinch-zoom for
   accessibility — we keep the default viewport meta).

   `!important` is intentional here: this rule must beat every
   per-component override (search-form, comment-form, etc.). Treat it
   as an accessibility/UX safeguard, not styling. */
@media (max-width: 760px) {
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="url"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    input:not([type]),
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* overflow-x: clip (not "hidden") — clip does NOT create a scroll
   container, so position:sticky on descendants still anchors to the
   viewport and the sidebars track the scroll. "hidden" silently
   breaks sticky. */
html, body {
    overflow-x: clip;
    max-width: 100%;
}

body {
    margin: 0;
    background: var(--soft);           /* soft canvas — white cards float on top */
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Anti-overflow safety net — nothing escapes the viewport on mobile.
   Long URLs in comments / posts wrap. Media never overflows its column. */
img, video, iframe, embed, object, audio, table, pre {
    max-width: 100%;
}

img, video { height: auto; }

pre, code, kbd, samp {
    overflow-x: auto;
    word-wrap: break-word;
}

.card-title, .feed-title, .card-excerpt, .grid-card-title,
.comment-body, .post-body, .post-lead {
    overflow-wrap: anywhere;
    word-break: break-word;
}

table { display: block; overflow-x: auto; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

button { font: inherit; cursor: pointer; }

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

/* ============================================================
   Каркас: шапка + основна сітка (ліве меню + центр + права) + футер
   ============================================================ */

.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header --------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: var(--shell-w);
    margin: 0 auto;
    padding: 8px 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.brand img {
    height: 40px;
    width: auto;
}

/* Two-line brand: name (black) + optional subtitle (grey, smaller) */
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-name { font-weight: 800; font-size: 16px; color: var(--ink); }
.brand-sub { font-weight: 500; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* Header nav (меню2) */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: start;
}

.header-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
}
.header-nav a svg { flex: none; width: 16px; height: 16px; }

.header-nav a:hover { background: var(--soft); color: var(--ink); }
.header-nav a.is-active { color: var(--ink); background: var(--soft); }

/* Uploaded (custom) menu icon — match the line-icon footprint */
.menu-ico-img { flex: none; object-fit: contain; vertical-align: middle; }

/* Header user (праворуч) */
.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink-2);
}

.icon-btn:hover { background: var(--soft); color: var(--ink); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    background: var(--ink);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover { background: #000; color: #fff; }

.btn-outline {
    background: transparent;
    border-color: var(--line-2);
    color: var(--ink);
}

/* Keep text readable on hover — without an explicit color it inherited the
   white from .btn:hover over a light background and disappeared. */
.btn-outline:hover { border-color: var(--ink); background: var(--soft); color: var(--ink); }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--ink-2);
    font-weight: 700;
    font-size: 13px;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Main grid ------------------------------------------------ */
/* Rock-solid shell. The outer container is ALWAYS exactly the same width
   (--shell-w / 1280). The left nav sits at the same x-pixel on every
   page. Only the centre column's *right edge* shifts a bit between
   3-col and 2-col layouts — same start, slightly more reading width
   when there's no right rail. No more jarring "site became narrower"
   moment when you click into a post or the cabinet. */
.site-main {
    flex: 1;
    display: grid;
    grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
    column-gap: var(--gutter);
    max-width: var(--shell-w);
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px 64px;
}

/* 2-column pages (account, static, post w/o right panel): centre fills
   ALL remaining width to the right edge of the shell. Same left rail,
   same start pixel — only the right edge of the centre stretches out. */
.site-main.is-wide,
.site-main.no-right-panel {
    grid-template-columns: var(--left-w) minmax(0, 1fr);
}

.site-main.is-wide > .col-right,
.site-main.no-right-panel > .col-right { display: none; }

.col-left, .col-right {
    align-self: start;
    position: sticky;
    top: 72px;
}

/* Allow the centre grid column to shrink below its content so horizontal
   carousels (in-feed ads) scroll instead of widening the page. */
.col-center { min-width: 0; }

/* Left nav (меню1, компактне) */
.nav1 {
    display: grid;
    gap: 2px;
}

.nav1 a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: 16px;
    font-weight: 600;
}

/* Hover/active have to stand out against the new soft body bg, so we
   pick a slightly cooler shade than --soft itself. */
.nav1 a:hover { background: var(--surface-hover); color: var(--ink); }
.nav1 a.is-active { background: var(--surface-active); color: var(--ink); }

.nav1 .ico { flex: none; width: 18px; height: 18px; }

/* The <hr> separators in nav1 (after public links, before admin link)
   add visual noise on a soft bg — drop them. Spacing is enough. */
.nav1 hr { display: none; }

/* Header-nav items duplicated into the drawer: desktop hides them
   (they live in the top header), mobile shows them at the top. */
.nav1-from-header { display: none; }
@media (max-width: 760px) {
    .nav1-from-header { display: block; }
    .nav1-from-header hr {
        display: block;
        border: 0;
        border-top: 1px solid var(--line);
        margin: 10px 0;
    }
}

/* Right column */
.col-right h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    margin-bottom: 10px;
}

.widget + .widget { margin-top: 28px; }

/* Footer --------------------------------------------------- */
.site-footer {
    margin-top: 32px;
    background: var(--soft);
    border-top: 1px solid var(--line);
}

.site-footer-inner {
    max-width: var(--shell-w);
    margin: 0 auto;
    padding: 32px 24px 40px;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 32px;
}

.footer-brand {
    display: grid;
    gap: 10px;
    color: var(--ink-3);
    font-size: 13px;
}

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

.footer-socials {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.footer-socials a {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--line);
}

.footer-socials a:hover { color: var(--ink); border-color: var(--line-2); }

.footer-col h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    margin-bottom: 12px;
}

.footer-col ul { display: grid; gap: 8px; }

.footer-col a { color: var(--ink-2); font-size: 14px; }
.footer-col a:hover { color: var(--ink); }

.footer-bottom {
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 12px;
}

.footer-bottom-inner {
    max-width: var(--shell-w);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   Стрічка (центр)
   ============================================================ */

.feed-tabs-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
}

.feed-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;          /* horizontal scroll on mobile */
    scrollbar-width: none;     /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
}
.feed-tabs::-webkit-scrollbar { display: none; }

.feed-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
    white-space: nowrap;
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    color: var(--ink-3);
    font-size: 15px;
    font-weight: 600;
}
/* These are the main home buttons — slightly larger icons. */
.feed-tabs a svg { width: 19px; height: 19px; }
.feed-tabs a .ui-ico-img { width: 19px; height: 19px; }

.feed-tabs a:hover { background: var(--soft); color: var(--ink); }

.feed-tabs a.is-active {
    background: var(--ink);
    color: #fff;
}

.feed {
    display: flex;
    flex-direction: column;
}

.feed-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--ink-3);
}

.feed-empty h2 { font-size: 18px; margin-bottom: 6px; color: var(--ink-2); }

/* News card — white tile floating on soft body. Soft, almost-invisible
   shadow (газетна стриманість) instead of the old hairline divider. */
.card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 10px 0;
    padding: 20px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.04);
}

.card:first-child { margin-top: 0; }
.card:last-child { margin-bottom: 0; }

.card-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--soft);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-media img { transform: scale(1.02); }

.card-body { display: grid; gap: 8px; }

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-3);
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--chip-bg);        /* slightly cooler than --soft so chips read against soft body */
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.chip:hover { background: var(--ink); color: #fff; }

.card-title {
    font-size: 22px;
    line-height: 1.22;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--ink);
}

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

.card-excerpt {
    color: var(--ink-3);
    font-size: 15px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Feed card formats (placement + card_format) ----------------- */
/* Small badges in the meta row. */
.post-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; line-height: 1.7;
}
.post-badge-promo { background: #9aa1ab; color: #fff; }       /* greyed (expired) */
.post-badge-promo.is-active { background: #f7d33a; color: #3a2f00; }  /* yellow (active) */
.post-badge-media { background: #eef1f4; color: var(--ink-3); padding: 2px 7px; }

/* Media badge on the cover image. */
.card-media { position: relative; }
.card-media-badge {
    position: absolute; top: 8px; right: 8px;
    display: grid; place-items: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(17,24,39,0.62); color: #fff;
}

/* Hero / "виділити" — full-bleed cover, title on the photo. */
.card-hero { padding: 0; overflow: hidden; }
.card-hero-link { position: relative; display: block; }
.card-hero-img {
    width: 100%; aspect-ratio: 4 / 3; max-height: 460px;
    object-fit: cover; display: block;
    transition: transform 0.4s ease;
}
.card-hero:hover .card-hero-img { transform: scale(1.02); }
.card-hero-top {
    position: absolute; top: 14px; left: 16px; right: 48px;   /* room for the media badge */
    display: flex; align-items: flex-start; gap: 8px;
}
.card-hero-cat {
    color: #fff; font-size: 12px; font-weight: 800;
    letter-spacing: 0.08em; text-transform: uppercase;
    text-shadow: 0 1px 6px rgba(0,0,0,0.55);
}
.card-hero-overlay {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 64px 20px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 8%, rgba(0,0,0,0.45) 45%, rgba(0,0,0,0));
}
.card-hero-title {
    color: #fff; font-size: 26px; font-weight: 800;
    line-height: 1.16; letter-spacing: -0.02em;
    text-shadow: 0 1px 10px rgba(0,0,0,0.35);
}

/* Compact / "не виділяти" — text row with a small side thumbnail.
   Lighter than a full card: tinted background, no shadow. */
.card-compact {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: #ffffffb8;
    box-shadow: none;
}
.card-compact-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 7px; }
.card-title-sm { font-size: 18px; line-height: 1.25; }
.card-compact-thumb {
    flex: 0 0 56px; width: 56px; height: 56px;
    border-radius: 8px; overflow: hidden; background: var(--soft);
}
.card-compact-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Standard card: featured photo rendered under the excerpt */
.card-photo {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--soft);
    margin-top: 2px;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.card:hover .card-photo img { transform: scale(1.02); }

/* Vertical card: meta on top (full width), photo|text two columns in the
   middle, actions at the bottom (full width). The outer card keeps the
   single-column stack from .card; only the middle row is 30/70. */
.card-vertical { gap: 10px; }
.card-vert-cols {
    display: grid;
    grid-template-columns: minmax(110px, 30%) 1fr;
    align-items: start; /* media keeps its aspect-ratio, no stretch glitch */
    gap: 16px;
}
.card-vert-media {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--soft);
}
.card-vert-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.card-vertical:hover .card-vert-media img { transform: scale(1.02); }
.card-vert-text { min-width: 0; display: grid; gap: 8px; align-content: start; }

/* Multi-line excerpt clamp (vertical card) */
.card-excerpt-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 560px) {
    .card-vert-cols { grid-template-columns: minmax(96px, 34%) 1fr; gap: 12px; }
}

/* Hero post inside a grid (category / tag / search / related) — full-width
   row with the same cover-overlay treatment as the feed hero. */
.grid-card-hero {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    gap: 0;
}
.grid-card-hero .card-hero-link { display: block; width: 100%; height: 100%; }
.grid-card-hero .card-hero-img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.5s ease;
}
.grid-card-hero:hover .card-hero-img { transform: scale(1.06); }
.grid-card-hero .card-hero-title { font-size: 20px; }
.grid-card-hero .card-hero-overlay { padding: 44px 16px 16px; }

@media (max-width: 560px) {
    .card-hero-title { font-size: 21px; }
    .card-hero-img { aspect-ratio: 3 / 2; }
    .card-compact-thumb { flex-basis: 76px; width: 76px; height: 76px; }
    .card-title-sm { font-size: 16px; }
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
    color: var(--ink-3);
    font-size: 13px;
}

.card-actions .action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.card-actions .ico { color: var(--ink-4); }

.card-actions .action-spacer { flex: 1; }

.card-actions a.action {
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: var(--radius);
    color: var(--ink-3);
}

.card-actions a.action:hover { background: var(--soft); color: var(--ink); }

.action-bookmark.is-on .ico { color: var(--accent); }

.load-more {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

/* Distinct accent pill with a hover shine sweep + lift. */
#load-more-posts {
    position: relative;
    overflow: hidden;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 12px 30px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 3px 12px rgba(15, 118, 110, 0.28);
    transition: transform 0.16s ease, box-shadow 0.22s ease, background 0.22s ease;
}
#load-more-posts:hover {
    background: #0b5e57;
    border-color: #0b5e57;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(15, 118, 110, 0.36);
}
#load-more-posts:active { transform: translateY(0); }
#load-more-posts::after {
    content: "";
    position: absolute;
    top: 0; left: -65%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.38), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}
#load-more-posts:hover::after { animation: lmShine 0.85s ease; }
@keyframes lmShine { from { left: -65%; } to { left: 130%; } }
/* Idle attention pulse (respects reduced motion). */
#load-more-posts { animation: lmPulse 2.6s ease-in-out infinite; }
@keyframes lmPulse {
    0%, 100% { box-shadow: 0 3px 12px rgba(15, 118, 110, 0.28); }
    50%      { box-shadow: 0 3px 20px rgba(15, 118, 110, 0.5); }
}
@media (prefers-reduced-motion: reduce) {
    #load-more-posts { animation: none; }
    #load-more-posts:hover { transform: none; }
    #load-more-posts:hover::after { animation: none; }
}

/* ============================================================
   Права колонка — віджети
   ============================================================ */

.mini-list { display: grid; gap: 12px; }

.mini-item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 10px;
    align-items: start;
}

.mini-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--soft);
    display: grid;
    place-items: center;
    color: var(--ink-4);
    flex: none;
}

.mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-text { display: grid; gap: 2px; min-width: 0; }

.mini-title {
    font-size: 13px;
    font-weight: 650;
    color: var(--ink);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mini-item:hover .mini-title { color: var(--accent); }

.mini-meta { font-size: 12px; color: var(--ink-3); }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ============================================================
   Сторінка матеріалу
   ============================================================ */

.post {
    display: grid;
    gap: 0;
    margin: 10px 0;
    padding: 24px 28px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.04);
}

.post-head { display: grid; gap: 10px; }

.post-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-3);
    flex-wrap: wrap;
}
/* Views/comments pushed to the right edge of the kicker. */
.post-kicker-stats {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.post-title {
    font-size: 26px;
    line-height: 1.14;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 4px 0 15px 0;
}

.post-lead {
    font-size: 18px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0;
}

.post-cover {
    margin: 0px -15px 15px -15px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--soft);
}

.post-cover-zoom { display: block; cursor: zoom-in; }
.post-cover img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 480px;
    object-fit: cover;
}

/* Every in-text photo is zoomable. */
.post-figure-link { display: block; cursor: zoom-in; }

/* ---- Longread / hero post ---------------------------------------- */
.post-longread { padding: 0; overflow: hidden; }
/* Full-bleed cover with the title on the photo. */
.post-hero { position: relative; margin: 0; }
.post-hero-img {
    width: 100%; display: block;
    aspect-ratio: 16 / 9; max-height: 560px; object-fit: cover;
    cursor: zoom-in;
}
.post-hero-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: flex-end;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 6%, rgba(0,0,0,0.35) 42%, rgba(0,0,0,0) 72%);
    pointer-events: none;   /* let clicks reach the hero image (zoom) */
}
.post-hero-overlay a { pointer-events: auto; }   /* …except the category link */
.post-hero-inner { width: 100%; max-width: 820px; margin: 0 auto; padding: 30px 28px; }
.post-hero-cat {
    display: inline-block; margin-bottom: 12px;
    color: #fff; font-size: 12px; font-weight: 800;
    letter-spacing: 0.08em; text-transform: uppercase;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.post-hero-cat:hover { color: #fff; opacity: 0.85; }
.post-hero-title {
    color: #fff; font-size: 28px; font-weight: 800;
    line-height: 1.12; letter-spacing: -0.02em; margin: 0;
    text-shadow: 0 2px 14px rgba(0,0,0,0.4);
}
.post-hero-meta {
    display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px;
    color: rgba(255,255,255,0.88); font-size: 13px;
}
/* Centre the longread body in a readable column inside the wide card. */
.post-longread > *:not(.post-hero) {
    width: 100%; max-width: 760px; box-sizing: border-box;
    margin-left: auto; margin-right: auto;
    padding-left: 24px; padding-right: 24px;
}
.post-longread > .post-hero + * { margin-top: 22px; }
.post-longread { padding-bottom: 28px; }
.post-lead-longread { font-size: 20px; font-weight: 500; }
@media (max-width: 760px) {
    .post-title { font-size: 24px; }
    .post-hero-title { font-size: 20px; }
    .post-hero-inner { padding: 20px 18px; }
    .post-hero-img { aspect-ratio: 3 / 2; }
    .post-longread > *:not(.post-hero) { padding-left: 18px; padding-right: 18px; }
    /* Hero post full-bleed on mobile (break out of the .post 15px padding). */
    .post-hero { margin: -15px; }
}

/* Reading typography — single san-serif family across title, lead,
   and body, so the post reads as one piece of type. */
.post-body {
    font-family: var(--font-sans);
    font-size: 18px;
    line-height: 1.7;
    color: var(--ink);
}

/* Vertical rhythm: paragraphs and lists get padding (extra breathing
   room around each block); headings keep margin so they don't double-
   space against the surrounding paragraph paddings. */
.post-body > * + * { margin-top: 0; }       /* padding does the work */
.post-body p { margin: 0; padding: 12px 0; }
.post-body h2 { font-size: 24px; margin: 1.4em 0 0.3em; font-weight: 800; letter-spacing: -0.01em; }
.post-body h3 { font-size: 20px; margin: 1.2em 0 0.2em; font-weight: 700; }
.post-body ul, .post-body ol { padding: 8px 0 8px 1.4em; list-style: revert; }
.post-body li { margin: 0; }
.post-body li + li { margin-top: 4px; }
/* No more thick black accent bar — газетна цитата з тонкою лінією. */
.post-body blockquote {
    margin: 1.4em 0;
    padding: 6px 0 6px 18px;
    border-left: 1px solid var(--line-2);
    color: var(--ink-2);
    font-style: italic;
}
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-body figure { margin: 5px 0; }
.post-body figure img { border-radius: var(--radius); }
.post-body figcaption { margin-top: 6px; color: var(--ink-3); font-size: 14px; text-align: center; }
/* Gallery wraps its own figures (tile + caption); zero the body's
   margin so the grid stays edge-to-edge. */
.post-body .post-gallery figure { margin: 0; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

.post-tags {
    padding: 10px;
}

/* Action bar — без коробки, на лінії */
/* Bottom bar — now contains only actions (heart/bookmark/share);
   stats migrated to the header above. Actions are LEFT-aligned. */
.post-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.post-bar-actions {
    justify-content: flex-start;
}

/* Stats are now small chips in the post header (under the lead). */
.post-bar-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--ink-3);
    font-size: 13px;
    margin-top: 10px;
}

.post-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.post-stat .ico { color: var(--ink-4); }

.post-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.post-bar-form { margin: 0; display: inline-flex; }

/* Icon action button. Mostly icon-only (bookmark, telegram, facebook,
   copy); .post-react also carries an inline number next to the heart.
   Accessibility via aria-label + title. */
.post-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    font-size: 13px;
    font-weight: 600;
}

.post-act:hover { background: var(--surface-hover); color: var(--ink); }
.post-act[disabled] { opacity: 0.6; cursor: wait; }

/* Generic "on" state — bookmark filled / saved. */
.post-act.is-on { color: var(--ink); }
.post-act.is-on .ico { fill: currentColor; }

/* Heart goes red when liked — both stroke and fill via currentColor. */
.post-react.is-on { color: var(--danger); }
.post-react.is-on .ico { color: var(--danger); fill: currentColor; }

.post-react-count {
    font-variant-numeric: tabular-nums;
    color: inherit;
    font-weight: 600;
    line-height: 1;
}

/* Prev / Next — sits at the very bottom of the post page now.
   Simpler: just two faint pill tiles with a label and the title.
   No heavy border; lives on the soft body bg. */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.post-nav-item {
    display: grid;
    gap: 2px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    transition: box-shadow 0.16s ease;
}

.post-nav-item:hover { box-shadow: 0 0 0 1px var(--line-2), 0 0 3px rgba(0, 0, 0, 0.06); }
.post-nav-item-next { text-align: right; }
.post-nav-label { color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.post-nav-item strong { font-size: 14px; font-weight: 600; line-height: 1.35; }

@media (max-width: 560px) {
    .post-nav { grid-template-columns: 1fr; }
}

/* ============================================================
   Коментарі
   ============================================================ */

.post-comments {
    margin: 16px 0;
    background: #fdfdfd;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.04);
}

.post-comments-head { margin-bottom: 14px; }

.post-comments-head h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.post-comments-head h2 span {
    color: var(--ink-3);
    font-weight: 600;
    margin-left: 6px;
}

.comment {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.comment:last-child { border-bottom: 0; }

.comment-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--ink-2);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    overflow: hidden;
}

.comment-av img { width: 100%; height: 100%; object-fit: cover; }

.comment-main { min-width: 0; }

.comment-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-head strong { font-size: 14px; font-weight: 700; }
.comment-time { color: var(--ink-3); font-size: 12px; }

.comment-body {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
}

.comment-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Attached photo on a comment — sits above body, fixed sane size. */
.comment-photo-wrap {
    display: block;
    margin: 6px 0 8px;
    max-width: 320px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--soft);
    cursor: zoom-in;
    border: 1px solid var(--line);
}

.comment-photo-wrap img,
.comment-body .comment-photo {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.comment-embed {
    display: block;
    position: relative;
    margin: 10px 0;
    padding-top: 56.25%;
    max-width: 420px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.comment-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.comment-tools {
    display: flex;
    gap: 14px;
    margin-top: 6px;
}

.comment-link {
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    cursor: pointer;
}

.comment-link:hover { color: var(--ink); }
.comment-link.muted { color: var(--ink-4); cursor: default; }

.comment-replies {
    margin-top: 10px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.comment-replies .comment {
    padding: 10px 0;
    border-bottom: 0;
}

.comment-reply-form,
.comment-report-form {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.comment-reply-form textarea,
.comment-report-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
    resize: vertical;
}

.comment-reply-form textarea:focus,
.comment-report-form textarea:focus {
    outline: none;
    border-color: var(--ink);
}

.comment-form-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    padding: 0 15px;
    margin-top: 0;
}

.form-row { display: grid; gap: 4px; font-size: 13px; }

.form-row select {
    padding: 8px 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--surface);
    font: inherit;
}

.is-hidden { display: none !important; }

.muted { color: var(--ink-3); }

.notice {
    margin: 10px 0;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
}

.notice-success { background: var(--accent-soft); color: #0c5f59; }
.notice-error { background: var(--danger-soft); color: var(--danger-dark); }

.comments-empty { padding: 5px 0; }

/* Form for the main commentary (logged-in) */
.comment-form { margin-top: 20px; }

.comment-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
    resize: vertical;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--ink);
}

.comment-form-cta {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Guest hint to log in — wrapped in its own card with border so it
   reads as a distinct CTA, not a stray line of text. */
.comment-login-card {
    padding: 18px 20px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
}

.comment-login-card p {
    margin: 0;
    color: var(--ink-2);
    font-size: 14px;
}

/* ============================================================
   "Читайте також"
   ============================================================ */

.post-related { margin-top: 16px; }

.post-related-head h2 {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    margin-bottom: 14px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Grid card (used in related + listings) */
.grid-card { display: grid; gap: 10px; }

.grid-card-image {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--soft);
}
.grid-card-image .card-media-badge { width: 22px; height: 22px; }

/* Comment count overlay on a post card image */
.card-comments-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 28, 0.72);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}
.card-comments-badge svg { width: 13px; height: 13px; }

.grid-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.grid-card:hover .grid-card-image img { transform: scale(1.03); }

.grid-card-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--ink-4);
    background: var(--soft);
}

/* Bookmark card: position card relative so the × sits in the image corner. */
.grid-card { position: relative; }

.grid-card-remove { position: absolute; top: 8px; right: 8px; margin: 0; }

.grid-card-remove-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.7);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease;
}

.grid-card:hover .grid-card-remove-btn,
.grid-card-remove-btn:focus-visible { opacity: 1; }

.grid-card-remove-btn:hover { background: var(--danger); }

/* On touch devices there's no hover — always show the remove control. */
@media (hover: none) {
    .grid-card-remove-btn { opacity: 1; }
}

.empty-actions { margin-top: 14px; }

.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.grid-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.grid-card-title a:hover { color: var(--accent); }

.grid-card-meta {
    color: var(--ink-3);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grid-card-meta .chip { font-size: 11px; }

/* ============================================================
   Заголовки секцій (категорія, тег, пошук)
   ============================================================ */

.section-head {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.section-kicker {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.section-head h1 {
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.section-lead {
    margin-top: 6px;
    color: var(--ink-3);
    font-size: 14px;
}

.search-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.search-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
}

.search-form input:focus { outline: none; border-color: var(--ink); }

/* Minimal search bar (search page + 404). Light, square-ish, airy. */
.search-bar {
    display: flex;
    gap: 8px;
    align-items: stretch;
    max-width: 560px;
    margin: 24px auto 32px;
}
.search-bar-field {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.search-bar-icon {
    position: absolute;
    left: 12px;
    display: grid;
    place-items: center;
    color: var(--ink-3);
    pointer-events: none;
}
.search-bar input {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
}
.search-bar input:focus {
    outline: none;
    border-color: var(--ink-3);
}
.search-bar .btn {
    height: 46px;
    padding: 0 22px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .search-bar .btn { padding: 0 16px; }
}

/* ---- Tags index (/tags) ------------------------------------------ */
.tags-index {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-index-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px 7px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line-2);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    transition: border-color 0.14s ease, color 0.14s ease;
}
.tag-index-item:hover { border-color: var(--ink-3); color: var(--ink); }
.tag-index-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

/* ---- Error pages (404/403) — centred + search -------------------- */
.error-page {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 16px 64px;
    text-align: center;
}
.error-page-code {
    display: inline-block;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--ink-4);
}
.error-page-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 6px 0 8px;
}
.error-page-text { color: var(--ink-3); font-size: 15px; }
.error-page-search { margin: 22px auto 18px; }
.error-page-home { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.error-page-home:hover { color: var(--ink); }

/* Сітка карток для категорії/тегу/пошуку */
.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 28px 20px;
}

@media (max-width: 560px) {
    .feed-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 12px;
    }
    .grid-card-title { font-size: 14px; }
    .grid-card-meta { font-size: 11px; }
}

/* ============================================================
   Lightbox (zoom for post images / galleries)
   ============================================================ */

.is-zoomable { cursor: zoom-in; }

/* Old .lb-* lightbox removed — superseded by .lightbox in the
   "Lightbox viewer" block below. */

/* ==================================================================
   Report modal — пов'язана з [data-toggle-report] кнопками на
   коментарях. JS показує/ховає через hidden + aria-hidden, click
   на backdrop або кнопках з [data-report-close] закриває.
   ================================================================== */
.report-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.report-modal[hidden] { display: none; }

.report-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.32);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.report-modal-card {
    position: relative;
    width: min(92%, 460px);
    background: #fff;
    border-radius: 16px;
    padding: 24px 24px 20px;
    box-shadow: 0 30px 80px rgba(16, 24, 40, 0.22),
                0 6px 18px rgba(16, 24, 40, 0.08);
}

.report-modal-card h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.report-modal-card .muted {
    font-size: 13px;
    margin: 0 0 16px;
}

.report-modal-card .form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.report-modal-card .form-row label {
    font-weight: 500;
    color: var(--ink);
}

.report-modal-card select,
.report-modal-card textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    resize: vertical;
}

.report-modal-card select:focus,
.report-modal-card textarea:focus {
    outline: 0;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.report-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--soft);
    color: var(--ink-2);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.14s ease;
}

.report-modal-close:hover { background: var(--surface-2); }

.report-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

body.is-modal-open { overflow: hidden; }

/* ============================================================
   Emoji picker (textarea attachment)
   ============================================================ */
/* Comment form footer: actions on the left (attach + emoji), hint in the
   middle, submit on the right. Same shape for main form and reply form. */
.comment-form-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    padding: 0 15px;
}

.comment-form-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-form-hint {
    flex: 1;
    font-size: 12px;
    color: var(--ink-3);
}

/* Moderation info — small (i) icon with a hover/tap tooltip. */
.comment-mod-info {
    position: relative;
    margin-right: auto;          /* keep the submit button on the right */
    display: inline-grid;
    place-items: center;
    color: var(--ink-4);
    cursor: help;
}
.comment-mod-info:hover,
.comment-mod-info:focus-visible { color: var(--ink-2); outline: none; }
.comment-mod-info::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: max-content;
    max-width: 230px;
    padding: 8px 10px;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    z-index: 20;
    pointer-events: none;
}
.comment-mod-info:hover::after,
.comment-mod-info:focus::after,
.comment-mod-info:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.attach-trigger,
.emoji-trigger {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    color: var(--ink-3);
    font-size: 18px;
    line-height: 1;
    display: inline-grid;
    place-items: center;
    transition: background 0.12s ease, color 0.12s ease;
}

.attach-trigger:hover,
.emoji-trigger:hover {
    background: var(--soft);
    color: var(--ink);
}

/* Attached-photo preview tile shown above the textarea. */
.attach-preview {
    position: relative;
    display: inline-block;
    width: 72px;
    height: 72px;
    margin: 0 0 8px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--soft);
    border: 1px solid var(--line);
}

.attach-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.attach-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.78);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.attach-remove:hover { background: var(--danger); }

/* Primary submit button styled like a chat send. */
.btn-submit {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 0 18px;
    height: 36px;
    font-weight: 700;
}

.btn-submit:hover { background: var(--accent-strong, #0c5f59); border-color: var(--accent-strong, #0c5f59); color: #fff; }

.emoji-pop {
    position: absolute;
    z-index: 900;
    width: 320px;
    max-height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: 0 12px 36px rgba(16, 24, 40, 0.14);
}

.emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 6px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: var(--soft);
    flex: none;
}

.emoji-tab {
    border: 0;
    background: transparent;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    cursor: pointer;
    white-space: nowrap;
}

.emoji-tab:hover { color: var(--ink); background: #ffffff; }
.emoji-tab.is-active { color: var(--ink); background: var(--surface); }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.emoji-btn {
    border: 0;
    background: transparent;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.1s ease;
}

.emoji-btn:hover { background: var(--soft); }

@media (max-width: 480px) {
    .emoji-pop { width: calc(100vw - 16px); }
    .emoji-grid { grid-template-columns: repeat(7, 1fr); }
}

/* ============================================================
   Comment reactions (+/−)
   ============================================================ */
.comment-reactions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.cr-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.cr-btn:hover:not([disabled]) { background: var(--soft); color: var(--ink); }

.cr-btn.is-on.cr-up { background: var(--accent-soft); color: var(--accent); }
.cr-btn.is-on.cr-up .ico { color: var(--accent); }

.cr-btn.is-on.cr-down { background: #fdf0ef; color: var(--danger); }
.cr-btn.is-on.cr-down .ico { color: var(--danger); }

.cr-btn[disabled] { opacity: 0.5; cursor: default; }

.cr-count {
    font-variant-numeric: tabular-nums;
    min-width: 8px;
    text-align: center;
}

/* ============================================================
   Toast notifications (window.nv.toast)
   ============================================================ */
.toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 180px;
    max-width: 320px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #111418;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    cursor: pointer;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--ink-2); }

@media (max-width: 560px) {
    .toasts { left: 12px; right: 12px; align-items: stretch; }
    .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; }
}

/* Card bookmark count alignment */
.action.action-bookmark,
.action-form .action-bookmark {
    background: transparent;
    border: 0;
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.action.action-bookmark:hover,
.action-form .action-bookmark:hover { background: var(--soft); color: var(--ink); }

.action.action-bookmark.is-on,
.action-form .action-bookmark.is-on { color: var(--accent); }
.action.action-bookmark.is-on .ico,
.action-form .action-bookmark.is-on .ico { color: var(--accent); }

.action-form { display: inline-flex; margin: 0; }

/* Inline SVG sizing */
.ico { display: inline-block; vertical-align: middle; }

/* Responsive ----------------------------------------------- */
/* Burger — only visible on mobile. Big tap-target (44px Apple HIG). */
.burger {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    place-items: center;
    flex: none;
    transition: background 0.16s ease;
}

.burger:hover,
.burger:active { background: var(--soft); }

/* Close-button inside the mobile drawer. Hidden on desktop. */
.menu-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--soft);
    color: var(--ink);
    cursor: pointer;
    place-items: center;
    transition: background 0.16s ease, transform 0.16s ease;
    z-index: 2;
}

.menu-close:hover { background: var(--surface-2); }
.menu-close:active { transform: scale(0.95); }

/* Mobile menu backdrop. Apple-style: subtle dim + frosted blur. */
.menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(17, 24, 39, 0.32);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.42s cubic-bezier(0.32, 0.72, 0.16, 1);
}

body.is-menu-open .menu-backdrop {
    display: block;
    opacity: 1;
}

@media (max-width: 1100px) {
    /* Hide the right rail but keep the same grid shape so the centre
       doesn't suddenly grow / shift. */
    .site-main,
    .site-main.is-wide,
    .site-main.no-right-panel {
        grid-template-columns: var(--left-w) minmax(0, 1fr);
        column-gap: var(--gutter);
    }
    .col-right { display: none; }
}

@media (max-width: 760px) {
    /* Edge-to-edge content on mobile (cards/sections carry their own padding). */
    .site-main,
    .site-main.is-wide,
    .site-main.no-right-panel {
        grid-template-columns: 1fr;
        padding: 0;
        column-gap: 0;
    }
    .header-nav { display: none; }
    .site-footer-inner { grid-template-columns: 1fr; gap: 24px; }
    .site-header-inner { padding: 8px 16px; gap: 10px; }
    .brand img { height: 34px; }
    .brand-name { font-size: 15px; }
    .brand-sub { font-size: 10px; }
    .burger { display: inline-grid; }

    /* Generic side breathing room lives on .col-center (one place, no
       double-padding). Full-bleed app-like elements break out of it. */
    .col-center { padding: 0 16px 32px; }
    .feed,
    .feed-tabs-bar,
    .post { margin-left: -16px; margin-right: -16px; }

    /* Denser feed + post on mobile (user-specified spacing). */
    .feed-tabs-bar { padding: 15px 15px 0 20px; }
    .card { gap: 6px; margin: 6px 0; padding: 15px; }
    /* Hero feed card stays full-bleed (must come AFTER .card to win). */
    .card-hero { padding: 0; border-radius: 0; }
    .card-title { font-size: 20px; }
    .post { padding: 15px; }
    /* In-feed ads → distinct grey band (already inside the full-bleed .feed). */
    .oa-feed-ads { padding: 15px; background: var(--surface-hover); }

    /* ------------------------------------------------------------------
       Apple-style CENTERED mobile menu. The .col-left node is reused as
       a centred modal sheet: floats above the page, white, rounded,
       opens with a gentle fade + scale (iOS-style spring curve).
       The big × close-button is visible at the top-right of the panel,
       big enough to hit with a thumb without aiming. */
    .col-left {
        position: fixed;
        top: 50%;
        left: 50%;
        width: min(92%, 360px);
        max-height: min(86vh, 640px);
        padding: 56px 18px 22px;   /* top room for the × button */
        background: #ffffff;
        border-radius: 22px;
        z-index: 60;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translate(-50%, -50%) scale(0.96);
        opacity: 0;
        visibility: hidden;
        transition:
            opacity 0.32s cubic-bezier(0.32, 0.72, 0.16, 1),
            transform 0.36s cubic-bezier(0.32, 0.72, 0.16, 1),
            visibility 0s linear 0.36s;
        display: block;
        box-shadow:
            0 30px 80px rgba(16, 24, 40, 0.22),
            0 6px 18px rgba(16, 24, 40, 0.08);
        font-feature-settings: "ss01", "cv11";
    }

    body.is-menu-open .col-left {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        visibility: visible;
        transition:
            opacity 0.32s cubic-bezier(0.32, 0.72, 0.16, 1),
            transform 0.36s cubic-bezier(0.32, 0.72, 0.16, 1),
            visibility 0s linear 0s;
    }

    body.is-menu-open { overflow: hidden; }

    /* Show the close button only when the drawer is on screen (mobile). */
    .menu-close { display: inline-grid; }

    /* Nav items in the drawer: larger, airier, with a soft hover pill. */
    .col-left .nav1,
    .col-left .nav2,
    .col-left .left-nav { display: flex; flex-direction: column; gap: 2px; }

    .col-left .nav1 a,
    .col-left .nav2 a,
    .col-left .left-nav a {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 13px 14px;
        border-radius: 12px;
        color: var(--ink);
        font-size: 17px;
        font-weight: 500;
        letter-spacing: -0.01em;
        line-height: 1.25;
        text-decoration: none;
        transition: background 0.18s ease, color 0.18s ease;
    }

    .col-left .nav1 a:hover,
    .col-left .nav1 a.is-active,
    .col-left .nav2 a:hover,
    .col-left .nav2 a.is-active,
    .col-left .left-nav a:hover,
    .col-left .left-nav a.is-active {
        background: var(--soft);
        color: var(--ink);
    }

    .col-left h3,
    .col-left .left-section-title {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--muted);
        margin: 18px 14px 8px;
    }
}

/* ==================================================================
   Account / cabinet pages — газетний мінімалізм. Used by:
   - /account              (edit.php)
   ================================================================== */

/* Stats row: 3 cards summarising counts + profile visibility. */
.account-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 28px;
}

.account-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.account-stat:hover:not(.is-static) {
    border-color: var(--ink-3);
    background: var(--soft);
}

.account-stat-label {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.account-stat-value {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* Two-column form: identity (avatar + name/email/roles) left, fields right. */
.account-form {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.account-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 24px 20px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--surface);
    position: sticky;
    top: 80px;
}

.account-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-size: 36px;
    font-weight: 600;
    overflow: hidden;
    margin-bottom: 4px;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.account-identity-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.account-identity-email {
    font-size: 13px;
    color: var(--muted);
    word-break: break-all;
}

.account-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 6px 0 0;
}

/* The "Change avatar" label is itself styled as a btn so the input
   is invisible. Clicking the label opens the file picker; on change
   the JS submits the form. */
.account-avatar-upload {
    margin-top: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.account-avatar-upload input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.account-help {
    font-size: 12px;
    color: var(--muted);
    margin: 4px 0 0;
}

/* Right side: stacked sections. */
.account-fields {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.account-section {
    padding: 0;
}

.account-section h2 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 14px;
}

/* Override the small .form-row used elsewhere — account inputs are larger. */
.account-form .form-row {
    display: grid;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 14px;
}

.account-form .form-row > label {
    font-weight: 500;
    color: var(--ink);
}

.account-form input[type="text"],
.account-form input[type="email"],
.account-form input[type="url"],
.account-form input[type="password"],
.account-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    font: inherit;
    font-size: 16px;   /* 16px+ on every device to prevent iOS Safari auto-zoom */
    color: var(--ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.account-form input:focus,
.account-form textarea:focus {
    outline: 0;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.account-form textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Checkbox row: input + (label + help) inline. */
.form-row-check {
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: start;
    gap: 10px !important;
}

.form-row-check input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--ink);
    cursor: pointer;
}

.form-row-check > label {
    cursor: pointer;
    display: block;
}

.form-row-check .account-help {
    display: block;
    margin-top: 2px;
    font-weight: 400;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

/* Small button variant for the avatar upload. */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Mobile: stack identity above fields, collapse stats to 1 column. */
@media (max-width: 760px) {
    .account-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .account-stat { padding: 12px; }
    .account-stat-value { font-size: 18px; }

    .account-form {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .account-identity {
        position: static;
        padding: 20px 18px;
    }

    .account-avatar { width: 84px; height: 84px; font-size: 32px; }
}

/* ==================================================================
   /account/comments — compact read-only list of the user's own
   comments. Each row shows status, when, which post, body, score,
   reply count, and a quiet "Видалити" action.
   ================================================================== */

.my-comments {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.my-comment {
    padding: 12px 16px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* A meta row (top: status + time + post-link; bottom: score + replies + delete). */
.my-comment-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
}

.my-comment-foot {
    margin-top: 2px;
    color: var(--ink-3);
}

.my-comment-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--soft);
    color: var(--ink);
}

.my-comment-status.is-approved { background: #dcfce7; color: #14532d; }
.my-comment-status.is-pending  { background: #fef3c7; color: #78350f; }
.my-comment-status.is-hidden   { background: var(--surface-2); color: #374151; }
.my-comment-status.is-spam     { background: var(--danger-soft); color: var(--danger-dark); }

.my-comment-time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Post link: subtle, with newspaper hairline. */
.my-comment-post {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    transition: border-color 0.16s ease;
    margin-left: auto;          /* push to the right end of the top row */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.my-comment-post:hover { border-color: var(--ink); }
.my-comment-post.is-gone { color: var(--muted); border: 0; font-style: italic; margin-left: auto; }

/* Compact body. */
.my-comment-body {
    margin: 2px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Footer meta chips (score, replies). */
.my-comment-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--ink-3);
}

.my-comment-meta .ico { color: var(--ink-4); }
.my-comment-meta strong { color: var(--ink); font-weight: 600; }

.my-comment-delete { margin: 0 0 0 auto; }

.btn-link-danger {
    background: none;
    border: 0;
    padding: 0;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.16s ease;
}

.btn-link-danger:hover { color: var(--danger-dark); }

@media (max-width: 560px) {
    .my-comment { padding: 12px 14px; }

    /* On phones the post link gets its own line below status+time so
       long titles read in full instead of being ellipsis-truncated. */
    .my-comment-row { gap: 8px; }
    .my-comment-post {
        margin-left: 0;
        max-width: 100%;
        flex-basis: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.3;
    }
    .my-comment-delete { margin-left: auto; }

    /* The section-head h1 ("Мої коментарі") is heavy on small screens
       — drop a step so it doesn't push the layout. */
    .section-head h1 { font-size: 22px; }
}

/* ==================================================================
   /users/id{N} — public user profile (newspaper minimal).
   Identity card (avatar + meta), then a list of approved comments
   in the same compact style as /account/comments (read-only).
   ================================================================== */

.profile-card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 22px;
    padding: 22px 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    margin: 0 0 28px;
    align-items: center;
}

.profile-card-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--soft);
    overflow: hidden;
    display: grid;
    place-items: center;
    font-size: 44px;
    font-weight: 600;
    color: var(--ink);
}

.profile-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-card-body { display: flex; flex-direction: column; gap: 14px; }

/* dl meta laid out as a row of small key/value chips. */
.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin: 0;
}

.profile-meta > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-meta dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.profile-meta dd {
    margin: 0;
    font-size: 14px;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.profile-meta dd strong { font-weight: 600; }

.profile-meta dd a {
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding-bottom: 1px;
    transition: border-color 0.16s ease;
}

.profile-meta dd a:hover { border-color: var(--ink); }

.profile-card-actions { margin-top: 4px; }

/* Comments section header. */
.profile-comments-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.profile-comments-head h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

.profile-comments-head .muted { font-size: 12px; }

@media (max-width: 560px) {
    .profile-card {
        grid-template-columns: 1fr;
        text-align: left;
        padding: 18px;
    }
    .profile-card-avatar {
        width: 88px;
        height: 88px;
        font-size: 32px;
    }
    .profile-meta { gap: 14px; }
}

/* ==================================================================
   Static pages — /{slug}  (about, contacts, AI-generated widgets…)
   --------------------------------------------------------------
   IMPORTANT: $page['content'] is rendered as RAW HTML. Admin can paste
   a self-contained widget with its own <style> and <script> (prefixed
   class names, e.g. .ap-*). The rules below ONLY style the bare
   first-level newspaper tags (p, h2, h3, ul, ol, blockquote, etc.)
   inside .page-body. We do NOT use universal selectors, do NOT impose
   overflow:hidden, display:flex, or transform on .page-body — that
   would break embedded widgets. Treat .page-body as a transparent
   passthrough; styling is opt-in via the standard tag list only.
   ================================================================== */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--muted);
    padding: 10px 0 0 0;
    margin: 0 0 14px;
    letter-spacing: 0.02em;
}

.breadcrumbs a {
    color: var(--muted);
    transition: color 0.14s ease;
}

.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs .sep { color: var(--ink-4); }
.breadcrumbs [aria-current="page"] { color: var(--ink); }

.page-article {
    display: block;
    /* No min-height / overflow / flex — keep transparent. */
}

/* Typography for plain HTML inside .page-body. These selectors only
   match direct/descendant tags; they do NOT touch anything inside an
   element that has its own class with another prefix. */
.page-body {
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink);
}

.page-body > * + * { margin-top: 1em; }

.page-body h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 1.6em;
    margin-bottom: 0.4em;
}

.page-body h3 {
    font-size: 18px;
    font-weight: 700;
    margin-top: 1.4em;
    margin-bottom: 0.3em;
}

.page-body p { margin: 0; }

.page-body a {
    color: var(--ink);
    border-bottom: 1px solid var(--line-2);
    padding-bottom: 1px;
    transition: border-color 0.16s ease;
}

.page-body a:hover { border-color: var(--ink); }

.page-body ul,
.page-body ol {
    padding-left: 1.4em;
    margin: 0;
    list-style: revert;            /* revert: undo the global "no bullets" reset */
}

.page-body li + li { margin-top: 0.3em; }

.page-body blockquote {
    margin: 1.4em 0;
    padding: 6px 0 6px 16px;
    border-left: 1px solid var(--line-2);
    color: var(--ink-2);
    font-style: italic;
}

.page-body hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2em 0;
}

.page-body img,
.page-body video {
    border-radius: 10px;
}

.page-body figure { margin: 0; }

.page-body figcaption {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

.page-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.page-body th, .page-body td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.page-body code {
    padding: 1px 6px;
    background: var(--soft);
    border-radius: 4px;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
}

.page-body pre {
    background: var(--soft);
    border-radius: 10px;
    padding: 14px 16px;
    overflow-x: auto;
}

.page-body pre code {
    padding: 0;
    background: transparent;
}

.page-foot {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 560px) {
    .page-body { font-size: 16px; }
    .page-body h2 { font-size: 20px; }
    .page-body h3 { font-size: 17px; }
}

/* ==================================================================
   /login, /register — centred newspaper-minimal auth pages.
   Uses layouts/auth.php which is its own <body class="auth-page"> —
   no site shell, no header/footer/nav. The card is centered on a
   soft background.
   ================================================================== */

.auth-page { background: var(--soft); }
.auth-page.has-bg { background-color: #0c141c; min-height: 100vh; }
.auth-page.has-bg .auth-brand { color: #fff; }
.auth-page.has-bg .auth-back a { color: rgba(255, 255, 255, 0.82); }
.auth-page.has-bg .auth-back a:hover { color: #fff; }

.auth-shell {
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 20px 32px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
}

.auth-brand {
    align-self: center;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}

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

.auth-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 32px 28px 28px;
    box-shadow:
        0 1px 0 rgba(16, 24, 40, 0.02),
        0 24px 60px -28px rgba(16, 24, 40, 0.18);
}

.auth-head { margin: 0 0 22px; }

.auth-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
}

.auth-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    background: var(--danger-soft);
    color: var(--danger-dark);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
}

.auth-alert p { margin: 0; }
.auth-alert p + p { margin-top: 4px; }

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field { display: flex; flex-direction: column; gap: 6px; }

.auth-field > label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.auth-field-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.auth-field-link {
    font-size: 12px;
    color: var(--muted);
    transition: color 0.14s ease;
}

.auth-field-link:hover { color: var(--ink); }

.auth-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    font: inherit;
    font-size: 16px;            /* iOS-zoom safe */
    color: var(--ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-field input:focus {
    outline: 0;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.auth-hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.auth-submit {
    width: 100%;
    height: 44px;
    margin-top: 4px;
    justify-content: center;
}

/* btn-primary — black "ink" filled button. Used here and in /account. */
.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.btn-primary:hover { background: #000; border-color: #000; color: #fff; }

.auth-foot {
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.auth-foot a {
    color: var(--ink);
    font-weight: 500;
    border-bottom: 1px solid var(--line-2);
    padding-bottom: 1px;
}

.auth-foot a:hover { border-color: var(--ink); color: var(--ink); }

.auth-back {
    text-align: center;
    font-size: 13px;
    margin: 0;
}

.auth-back a { color: var(--muted); transition: color 0.14s ease; }
.auth-back a:hover { color: var(--ink); }

/* Reserved hooks for Google OAuth — commented out in templates until
   OAuth + email verification are wired (see task #14). When we enable
   them, the styles below light up automatically. */
.auth-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    margin: 0 0 16px;
    padding: 0 14px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.16s ease;
}

.auth-social:hover { border-color: var(--ink-3); }
.auth-social:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0 18px;
    color: var(--ink-4);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

@media (max-width: 480px) {
    .auth-shell { padding: 28px 16px; gap: 14px; }
    .auth-card { padding: 24px 20px; border-radius: 14px; }
    .auth-head h1 { font-size: 22px; }
}

/* ==================================================================
   Post embeds (Editor.js → server-rendered HTML).
   Mirrors the admin app.css rules so iframes are sized correctly on
   the public site too: Telegram, Facebook, Instagram, Twitter/X,
   TikTok, YouTube, generic <video>, and the orientation wrappers
   (.post-embed-auto / .post-embed-horizontal / .post-embed-vertical).
   ================================================================== */

/* Orientation wrappers — set the max-width of the entire embed block. */
.post-embed-auto       { margin: 24px auto; max-width: 540px; }
.post-embed-horizontal { margin: 24px auto; max-width: 680px; }
.post-embed-vertical   { margin: 24px auto; max-width: 360px; }

.post-embed-auto > figure,
.post-embed-horizontal > figure,
.post-embed-vertical > figure {
    margin: 0;
    max-width: none;
}

/* Generic <figure> embeds shared by all platforms. */
.embed-video,
.embed-telegram,
.embed-facebook,
.embed-instagram,
.embed-twitter,
.embed-tiktok {
    margin: 24px auto;
    max-width: 540px;
}

/* YouTube / generic <iframe> video — keep 16:9. */
.embed-video {
    aspect-ratio: 16 / 9;
}

.embed-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--radius);
}

/* Telegram (resizes itself via postMessage; we give a sensible minimum). */
.embed-telegram { max-width: 520px; }
.embed-telegram iframe {
    width: 100%;
    min-height: 320px;
    border: 0;
    background: #ffffff;
    border-radius: var(--radius);
}

/* Facebook posts. */
.embed-facebook iframe {
    width: 100%;
    min-height: 560px;
    border: 0;
    background: #ffffff;
    border-radius: var(--radius);
}

/* Instagram posts. */
.embed-instagram iframe {
    width: 100%;
    min-height: 620px;
    border: 0;
    background: #ffffff;
    border-radius: var(--radius);
}

/* Twitter / X. */
.embed-twitter iframe {
    width: 100%;
    min-height: 560px;
    border: 0;
    background: #ffffff;
    border-radius: var(--radius);
}

/* TikTok — taller and narrower (portrait). */
.embed-tiktok { max-width: 340px; }
.embed-tiktok iframe {
    width: 100%;
    min-height: 740px;
    border: 0;
    background: #ffffff;
    border-radius: var(--radius);
}

/* ---- Uploaded audio / file (Editor.js asset blocks) --------------------- */
.post-audio {
    margin: 24px auto;
    max-width: 640px;
}
.post-audio audio {
    width: 100%;
    display: block;
}
.post-audio figcaption {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
    text-align: center;
}

/* Downloadable file card. */
.post-file {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 20px 0;
    padding: 14px 18px;
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 12px;
    background: var(--surface-2, #f8f9fb);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}
.post-file:hover {
    border-color: var(--accent, #c8102e);
    background: #fff;
}
.post-file-icon {
    flex: 0 0 auto;
    min-width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: var(--accent, #c8102e);
    border-radius: 9px;
    padding: 0 8px;
}
.post-file-body { display: flex; flex-direction: column; min-width: 0; }
.post-file-name {
    font-weight: 600;
    color: var(--ink, #1a1d24);
    word-break: break-word;
}
.post-file-meta {
    font-size: 0.8rem;
    color: var(--muted, #6b7280);
}

/* ---- AI comments: bot badge + admin generation panels ------------------ */
.comment-ai-badge {
    display: inline-block;
    margin-left: 2px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    color: #6d4bd1;
    background: #efeaff;
    border-radius: 20px;
    vertical-align: middle;
}
.ai-comment-panel,
.ai-reply-tool {
    margin: 0 0 18px;
    border: 1px solid var(--line, #e3e6ea);
    border-radius: 10px;
    background: var(--surface-2, #f7f7fb);
}
.ai-reply-tool { margin: 8px 0 0; }
.ai-comment-panel > summary,
.ai-reply-tool > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    color: #5b3fbf;
}
.ai-comment-panel > summary::-webkit-details-marker,
.ai-reply-tool > summary::-webkit-details-marker { display: none; }
.ai-reply-tool > summary { padding: 6px 10px; font-size: 13px; }
.ai-comment-form { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-reply-tool .ai-comment-form { padding: 0 10px 10px; }
.ai-comment-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ai-comment-row label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted, #6b7280); flex: 1 1 120px; }
.ai-comment-form select,
.ai-comment-form input[type="text"] {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--line, #e3e6ea);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}
.ai-comment-hint { margin-bottom: 16px; font-size: 0.9rem; }

/* Inline AI-comment review (after generation) */
.ai-result {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #d9d2f5;
    border-left: 3px solid #6d4bd1;
    border-radius: 0 10px 10px 0;
    background: #faf9ff;
}
.ai-result.is-approved { border-left-color: #1c9e4b; background: #f1faf3; }
.ai-result-body {
    width: 100%;
    min-height: 80px;
    padding: 9px 11px;
    border: 1px solid var(--line, #e3e6ea);
    border-radius: 8px;
    font: inherit;
    line-height: 1.45;
    resize: vertical;
    background: #fff;
}
.ai-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-result-actions .btn { padding: 6px 12px; font-size: 13px; }
.ai-result-msg { margin-top: 8px; font-size: 13px; color: var(--muted, #6b7280); }

/* ---- "Джерело" attribution paragraph (rendered from posts.sources) ----- */
.post-source {
    margin: 0 0 18px;
    font-size: 0.92rem;
    color: var(--muted, #4b5563);
}
.post-source b { color: var(--ink, #1a1d24); }
.post-source a { color: var(--accent, #c8102e); }

/* ---- Table (Editor.js table block) ------------------------------------- */
.post-table {
    margin: 24px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.post-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    line-height: 1.45;
}
.post-table th,
.post-table td {
    border: 1px solid var(--border, #e3e6ea);
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
}
.post-table th {
    background: var(--surface-2, #f5f6f8);
    font-weight: 700;
}
.post-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.015);
}

/* Multi-image gallery from the Editor.js media block.
   Layout adapts to image count via .count-{1..many}, social-media style.
   Lightbox is wired via JS (data-gallery / data-lightbox-src).

   Approach: each tile carries its OWN aspect-ratio. The grid container
   only sets columns. That guarantees every tile in the same row is the
   same height (no jagged red-line gaps between rows). */
.post-gallery {
    display: grid;
    gap: 15px;
    margin: 24px 0;
}

.post-gallery-item { margin: 0; min-width: 0; }

.post-gallery-link {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    cursor: zoom-in;
    background: var(--soft);
    aspect-ratio: 4 / 3;   /* default per-tile; overridden per layout */
}

.post-gallery-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-gallery-link:hover img { transform: scale(1.02); }

.post-gallery figcaption {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

/* "+N" overlay on the 4th visible tile. */
.post-gallery-more {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* 1 photo: full-bleed 16:9. */
.post-gallery.count-1 { grid-template-columns: 1fr; }
.post-gallery.count-1 .post-gallery-link { aspect-ratio: 16 / 9; }

/* 2 photos: half / half (4:3 each). */
.post-gallery.count-2 { grid-template-columns: 1fr 1fr; }
.post-gallery.count-2 .post-gallery-link { aspect-ratio: 4 / 3; }

/* 3 photos: one tall left (3:4), two square right. The grid sets one
   tall left column + two square right cells using grid rows. */
.post-gallery.count-3 {
    grid-template-columns: 2fr 1fr;
    grid-auto-rows: minmax(0, 1fr);
}
.post-gallery.count-3 .post-gallery-item:nth-child(1) {
    grid-row: 1 / span 2;
}
.post-gallery.count-3 .post-gallery-item:nth-child(1) .post-gallery-link { aspect-ratio: auto; height: 100%; }
.post-gallery.count-3 .post-gallery-item:nth-child(n+2) .post-gallery-link { aspect-ratio: 1 / 1; }

/* 4 photos: 2x2 squares. */
.post-gallery.count-4 { grid-template-columns: 1fr 1fr; }
.post-gallery.count-4 .post-gallery-link { aspect-ratio: 1 / 1; }

/* 5+ photos: desktop 3 columns, mobile 2 columns — all photos shown,
   no "+N" collapsing (robust across old/new stored content). Any legacy
   "+N" overlay baked into older posts is hidden. */
.post-gallery.count-many { grid-template-columns: 1fr 1fr 1fr; }
.post-gallery.count-many .post-gallery-link { aspect-ratio: 1 / 1; }
.post-gallery-more { display: none !important; }

/* Captions hidden in packed layouts; they reappear in the lightbox.
   Single-tile gallery keeps its caption visible. */
.post-gallery:not(.count-1) figcaption { display: none; }

@media (max-width: 560px) {
    .post-gallery.count-2,
    .post-gallery.count-3 {
        grid-template-columns: 1fr;
    }
    .post-gallery.count-3 .post-gallery-item:nth-child(1) { grid-row: auto; }
    .post-gallery.count-3 .post-gallery-link { aspect-ratio: 4 / 3; }

    /* Gallery on mobile: 2-column grid, all photos in rows. */
    .post-gallery.count-many { grid-template-columns: 1fr 1fr; }
}

/* ==================================================================
   Lightbox viewer — opens when any [data-lightbox-src] is clicked.
   Pure CSS scaffold; JS toggles .is-open and updates .lightbox-img.
   ================================================================== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.96);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.lightbox.is-open {
    display: flex;
    opacity: 1;
}
.lightbox.is-open .lightbox-stage { animation: lbIn 0.26s cubic-bezier(0.22, 0.61, 0.36, 1); }
@keyframes lbIn {
    from { transform: scale(0.95) translateY(8px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.lightbox-stage {
    position: relative;
    width: min(96vw, 1400px);
    height: min(88vh, 100vh);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

/* iOS-style carousel: viewport clips, track holds 3 slides (prev/cur/next). */
.lightbox-viewport {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
    will-change: transform;
    touch-action: none;
}
.lightbox-track {
    display: flex;
    height: 100%;
    will-change: transform;
}
.lightbox-slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-sizing: border-box;
}
.lightbox-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
}

/* Top title pill — shows the material name (iOS Photos "date" style). */
.lightbox-title {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    max-width: min(64vw, 520px);
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(20, 20, 22, 0.62);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;       /* hard limit: max 2 lines (iOS/Android Safari OK) */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Two-line caption: bold title + muted "Фото: …" credit. */
.lightbox-caption {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    padding: 0 16px;
    max-width: 760px;
}

.lightbox-caption-title {
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.lightbox-caption-source {
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.lightbox-caption-title:empty,
.lightbox-caption-source:empty { display: none; }

/* Thumbnail strip — small previews to jump to any image in the set. */
.lightbox-thumbs {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
    padding: 4px 12px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.lightbox-thumbs::-webkit-scrollbar { height: 6px; }
.lightbox-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }

.lightbox-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 48px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: rgba(255,255,255,0.05);
    transition: border-color 0.14s ease, opacity 0.14s ease;
    opacity: 0.55;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lightbox-thumb:hover { opacity: 0.85; }
.lightbox-thumb.is-active {
    border-color: #fff;
    opacity: 1;
}

.lightbox-counter {
    position: absolute;
    top: 16px;
    left: 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px; height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.16s ease;
}

.lightbox-btn:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-btn[data-lightbox-prev] { left: 16px; }
.lightbox-btn[data-lightbox-next] { right: 16px; }
.lightbox-btn[data-lightbox-close] {
    top: 16px; right: 16px;
    transform: none;
    width: 44px; height: 44px;
}

.lightbox-btn svg { width: 22px; height: 22px; }

body.is-lightbox-open { overflow: hidden; }

@media (max-width: 560px) {
    /* Swipe is the primary navigation on touch → hide the side arrows. */
    .lightbox-btn[data-lightbox-prev],
    .lightbox-btn[data-lightbox-next] { display: none; }

    .lightbox-stage {
        width: 100vw;
        height: 100dvh;
        gap: 10px;
        padding: 8px 0;
    }
    .lightbox-img { border-radius: 4px; }

    /* Bigger, clearer close target. */
    .lightbox-btn[data-lightbox-close] {
        top: 10px; right: 10px;
        width: 42px; height: 42px;
        background: rgba(0, 0, 0, 0.4);
    }
    .lightbox-counter { top: 14px; left: 14px; font-size: 14px; }
    .lightbox-title { font-size: 13px; max-width: 64vw; padding: 3px 14px; }
    .lightbox-caption-title { font-size: 14px; }
    .lightbox-thumbs { padding: 2px 10px; }
    .lightbox-thumb { width: 52px; height: 40px; }
}

/* Mobile: collapse all embeds to viewport width and let tall ones (TikTok)
   stay tall but never overflow. */
@media (max-width: 560px) {
    .post-embed-auto,
    .post-embed-horizontal,
    .post-embed-vertical,
    .embed-video,
    .embed-telegram,
    .embed-facebook,
    .embed-instagram,
    .embed-twitter,
    .embed-tiktok {
        max-width: 100%;
    }
}

/* Important banner — реалізацію відкладено: будемо налаштовувати promo
   в адмінці окремо. Не видаляю місце повністю — CSS повернемо, коли
   запускатимемо. */

/* ==================================================================
   Classifieds board ("Оголошення") — /board.
   Newspaper-minimal, mobile-first. White tiles on soft bg.
   ================================================================== */

.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Type filter chips */
.board-types {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 20px;
}
.board-type {
    padding: 7px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.14s ease, color 0.14s ease;
}
.board-type:hover { border-color: var(--ink-3); color: var(--ink); }
.board-type.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Ad grid */
/* Compact ~200px square cards. */
.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 0 0 24px;
}
.board-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.16s ease, transform 0.16s ease;
}
.board-card:hover { box-shadow: 0 6px 20px -12px rgba(16,24,40,0.22); transform: translateY(-1px); }

/* Priority accents: plus = subtle accent ring; important = red ring. */
.board-card.priority-plus { box-shadow: 0 0 0 1px var(--accent), 0 0 3px rgba(0,0,0,0.04); }
.board-card.priority-important { box-shadow: 0 0 0 1px var(--danger), 0 0 3px rgba(0,0,0,0.04); }

.board-card-image {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;     /* square ~200x200 */
    background: var(--soft);
}
.board-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.board-card-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-4); }

/* Badge: top-right. plus = star (accent), important = red circle with "!". */
.board-badge {
    position: absolute;
    top: 8px; right: 8px;
    display: grid;
    place-items: center;
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.board-badge .ico { width: 13px; height: 13px; }
.board-badge-important { background: var(--danger); }
.board-badge-plus { background: var(--accent); }

.board-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.board-card-title {
    font-size: 14px; font-weight: 600; line-height: 1.3; margin: 0;
    overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.board-card-title a { color: var(--ink); }
.board-card-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.board-card-type { background: var(--chip-bg); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.board-price { margin-top: auto; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }

/* Similar ads block on the ad page. */
.board-similar { margin: 24px 0; }
.board-similar-title { font-size: 18px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.01em; }

@media (max-width: 560px) {
    .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .board-price { font-size: 14px; }
}

/* ---- Ad create form ("Facebook-simple") -------------------------- */
.oa-form { display: flex; flex-direction: column; gap: 22px; }

/* Progressive reveal: the rest of the form slides in once a type is chosen. */
.oa-rest {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(6px);
    transition: max-height 0.45s ease, opacity 0.35s ease, transform 0.35s ease;
}
.oa-rest.is-revealed {
    max-height: 6000px;
    opacity: 1;
    transform: none;
    overflow: visible;
}
.oa-rest > .oa-block,
.oa-rest > .oa-actions { animation: adFadeUp 0.4s ease both; }
@keyframes adFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.oa-block { display: flex; flex-direction: column; gap: 8px; }
.oa-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.oa-hint { font-size: 12px; font-weight: 400; color: var(--muted); }

.oa-form input[type="text"],
.oa-form input[type="tel"],
.oa-form input[type="url"],
.oa-form input[type="number"],
.oa-form textarea,
.oa-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 16px;      /* iOS no-zoom */
    color: var(--ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.oa-form input:focus, .oa-form textarea:focus, .oa-form select:focus {
    outline: 0; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(16,24,40,0.08);
}
.oa-form textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.oa-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .oa-grid-2 { grid-template-columns: 1fr; } }

/* Type chips (radio) */
.oa-types { display: flex; flex-wrap: wrap; gap: 8px; }
.oa-type-chip { position: relative; cursor: pointer; }
.oa-type-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.oa-type-chip span {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line-2);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
    transition: all 0.14s ease;
}
.oa-type-chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Photos dropzone */
.oa-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    border: 2px dashed var(--line-2);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.oa-dropzone:hover { border-color: var(--ink-3); background: var(--soft); }
.oa-dropzone-icon { color: var(--ink-4); }
.oa-dropzone-text { font-size: 14px; color: var(--muted); }
.oa-dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.oa-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.oa-preview-tile { position: relative; width: 104px; height: 104px; border-radius: 8px; overflow: hidden; background: var(--soft); }
.oa-preview-tile.is-main { outline: 2px solid var(--accent); }
.oa-preview-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.oa-preview-main {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 700; text-align: center; padding: 3px;
}
.oa-preview-setmain {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.62); color: #fff; border: 0;
    font-size: 10px; font-weight: 600; text-align: center; padding: 4px;
    cursor: pointer;
    opacity: 0; transition: opacity 0.15s ease;
}
.oa-preview-tile:hover .oa-preview-setmain { opacity: 1; }
@media (hover: none) { .oa-preview-setmain { opacity: 1; } }
.oa-preview-remove {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; padding: 0;
    border: 0; border-radius: 50%;
    background: rgba(17,24,39,0.72); color: #fff;
    font-size: 15px; line-height: 1; cursor: pointer;
    display: grid; place-items: center;
}
.oa-preview-remove:hover { background: var(--danger); }

/* Price segmented */
.oa-price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.oa-seg { position: relative; cursor: pointer; }
.oa-seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.oa-seg span {
    display: inline-block; padding: 9px 16px; border-radius: 10px;
    background: #fff; border: 1px solid var(--line-2);
    font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.oa-seg.is-active span, .oa-seg input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.oa-price-input { max-width: 200px; }

/* Promotion (disabled MVP) */
.oa-promote-row { display: flex; flex-wrap: wrap; gap: 8px; }
.oa-promote-chip span {
    display: inline-block; padding: 8px 14px; border-radius: 999px;
    background: var(--soft); border: 1px solid var(--line); color: var(--ink-4);
    font-size: 13px; font-weight: 600;
}
.oa-promote-chip.is-disabled { cursor: not-allowed; }
.oa-promote-chip input { display: none; }

.oa-actions { display: flex; gap: 10px; padding-top: 6px; }

/* ---- Board panel + green CTAs (round 7) -------------------------- */
/* Soft card behind the board list / create form. */
.oa-panel {
    background: #fefeff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.04);
    margin-top: 4px;
}
@media (max-width: 560px) { .oa-panel { padding: 14px; } }

/* Green, gently animated "add ad" CTA. */
.btn-add-oa, .btn-publish-oa {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.28);
}
.btn-add-oa:hover, .btn-publish-oa:hover {
    background: #15803d; border-color: #15803d; color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.34);
}
.btn-add-oa { animation: oaPulse 2.4s ease-in-out infinite; }
.btn-add-oa:hover { animation: none; }
@keyframes oaPulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(22, 163, 74, 0.28); }
    50%      { box-shadow: 0 2px 18px rgba(22, 163, 74, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
    .btn-add-oa { animation: none; }
    .btn-add-oa:hover, .btn-publish-oa:hover { transform: none; }
}

/* Edit-mode notice on the ad form. */
.oa-edit-note { margin-bottom: 16px; }
.my-oa-note { font-size: 13px; }

/* Share row on the ad page — compact icon-only buttons. */
.oa-share {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-top: 4px; padding-top: 16px;
    border-top: 1px solid var(--line);
}
.oa-share-btn {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line-2); background: #fff;
    color: var(--ink-2); cursor: pointer;
    transition: all 0.14s ease;
}
.oa-share-btn:hover { border-color: var(--ink-3); color: var(--ink); transform: translateY(-1px); }
.oa-share-fb:hover { background: #1877f2; border-color: #1877f2; color: #fff; }
.oa-share-tg:hover { background: #2aabee; border-color: #2aabee; color: #fff; }
.oa-share-copy:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Thank-you modal after submitting an ad. */
.oa-thanks-card { text-align: center; }
.oa-thanks-icon {
    width: 58px; height: 58px; margin: 4px auto 12px;
    border-radius: 50%; display: grid; place-items: center;
    background: #dcfce7; color: #16a34a;
}
.oa-thanks-card h3 { margin: 0 0 8px; }
.oa-thanks-card p { color: var(--ink-2); margin: 0 0 18px; }
.oa-thanks-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Search results: matching headings for both sections. */
.search-section { margin-bottom: 8px; }
.search-section + .search-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.search-section-title {
    font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
    margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}
.search-section-count {
    font-size: 12px; font-weight: 700; color: var(--muted);
    background: var(--soft); border-radius: 999px; padding: 1px 9px;
}
.search-ads-more { margin-top: 14px; }
/* Slightly smaller ad cards inside search. */
.search-ads .board-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ---- In-feed ads carousel (mobile only, when the right rail is hidden) --- */
/* min-width:0 so this flex item of the column .feed can shrink (else the
   horizontal track forces it to its content width and nothing scrolls). */
.oa-feed-ads { display: none; min-width: 0; max-width: 100%; margin: 14px 0 18px; }
@media (max-width: 1100px) { .oa-feed-ads { display: block; } }
.oa-feed-ads-title {
    font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
    margin: 0 0 12px;
}
.oa-feed-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.oa-feed-track::-webkit-scrollbar { display: none; }
.oa-feed-card {
    flex: 0 0 148px;
    width: 148px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.06);
}
.oa-feed-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;          /* a touch taller — fits poster-style ads */
    background: var(--soft);
    display: grid;
    place-items: center;
    overflow: hidden;
}
/* contain (not cover): show the WHOLE main photo, no cropping of posters. */
.oa-feed-card-img img { width: 100%; height: 100%; object-fit: contain; }
.oa-feed-card-ph { color: var(--ink-4); }
.oa-feed-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px 10px;
}
.oa-feed-card-title {
    font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.oa-feed-card-price { margin-top: auto; font-size: 14px; font-weight: 700; color: var(--ink); }
.oa-feed-card-type { margin-top: auto; font-size: 12px; color: var(--muted); }

/* "Усі оголошення" card — same footprint, centred CTA. */
.oa-feed-card-all {
    align-items: center;
    justify-content: center;
    background: #f7f7f8;
    box-shadow: none;
    border: 1px dashed var(--line-2);
}
.oa-feed-all-inner {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 0 12px; text-align: center;
    font-size: 13px; font-weight: 700; color: var(--accent);
}
.oa-feed-all-inner .ico { width: 22px; height: 22px; }

/* ---- Ad card (show) ---------------------------------------------- */
/* Ad page wrapped in a white card. */
.oa-view {
    display: flex; flex-direction: column; gap: 18px;
    padding: 15px;
    margin-top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.04);
}
/* Owner-only view of an unpublished/expired/rejected ad — muted card. */
.oa-view--inactive {
    background: #f6f7f9;
    box-shadow: inset 0 0 0 1px var(--line);
}
.oa-view--inactive .oa-gallery-main img,
.oa-view--inactive .oa-view-title { opacity: 0.78; }
.oa-inactive-banner { background: #eef1f4; color: var(--ink-2); }
.oa-view-head { display: flex; flex-direction: column; gap: 10px; }

/* Title is the hero; price sits on the same row, smaller, highlighted. */
.oa-view-headline {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 14px;
}
.oa-view-title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 0; flex: 1 1 auto; min-width: 0; }
.oa-view-price {
    flex: none;
    font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 4px 12px;
    border-radius: 8px;
    white-space: nowrap;
}
.oa-view-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.oa-view-body { font-size: 16px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }

/* Ad gallery — big original main image (not cropped), thumbnails below. */
.oa-gallery { display: flex; flex-direction: column; gap: 8px; }
.oa-gallery-main {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    background: var(--soft);
    cursor: zoom-in;
}
.oa-gallery-main img {
    display: block;
    width: 100%;
    max-height: 560px;
    min-height: 280px;
    object-fit: contain;
}
.oa-gallery-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.oa-gallery-thumb {
    width: 84px; height: 84px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--soft);
    cursor: zoom-in;
}
.oa-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Contacts — soft tinted card so it stands out from the body. */
.oa-contacts {
    background: var(--accent-soft);
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 12px; padding: 18px 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.oa-contacts h2 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.oa-contact-row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); }
.oa-contact-row .ico { color: var(--ink-4); flex: none; }
.oa-phone-reveal {
    background: none; border: 0; padding: 0; color: var(--accent);
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.oa-phone-value { font-weight: 700; color: var(--ink); }
.oa-contacts-note { font-size: 12px; margin: 4px 0 0; }

.oa-owner-actions { display: flex; align-items: center; gap: 8px; }

/* ---- My ads ------------------------------------------------------ */
.my-oa-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.my-oa {
    display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center;
    background: #fff; border-radius: 10px; padding: 12px 14px;
    box-shadow: 0 0 3px rgba(0,0,0,0.04);
}
.my-oa-thumb { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--soft); display: grid; place-items: center; }
.my-oa-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-oa-thumb span { color: var(--ink-4); }
.my-oa-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.my-oa-top { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.my-oa-status { padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.my-oa-status.is-active { background: #dcfce7; color: #14532d; }
.my-oa-status.is-pending { background: #fef3c7; color: #78350f; }
.my-oa-status.is-expired, .my-oa-status.is-inactive { background: var(--surface-2); color: #374151; }
.my-oa-status.is-rejected { background: var(--danger-soft); color: var(--danger-dark); }
.my-oa-title { font-size: 15px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.my-oa-meta { display: flex; gap: 6px; font-size: 13px; color: var(--ink-2); }
.my-oa-actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 560px) {
    .my-oa { grid-template-columns: 56px 1fr; }
    .my-oa-thumb { width: 56px; height: 56px; }
    .my-oa-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---- Sidebar widget ---------------------------------------------- */
/* Sidebar widget — compact rows with a small photo (like account/ads). */
.board-widget-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.board-widget-list li {
    background: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.04);
}
.board-widget-list li.priority-plus { background: var(--accent-soft); }
.board-widget-list li.priority-important { background: #fef2f2; }
.board-widget-item {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--ink);
}
.board-widget-type {
    font-size: 11px; font-weight: 600;
    color: var(--ink-3);
    background: rgba(17, 24, 39, 0.06);
    border-radius: 999px;
    padding: 1px 8px;
    align-self: flex-start;
}
.board-widget-thumb {
    position: relative;
    flex: none;
    width: 52px; height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--soft);
    display: grid;
    place-items: center;
    color: var(--ink-4);
}
.board-widget-thumb img { width: 100%; height: 100%; object-fit: cover; }
.board-badge-sm { width: 16px; height: 16px; top: 3px; right: 3px; font-size: 9px; box-shadow: none; }
.board-badge-sm .ico { width: 10px; height: 10px; }
.board-widget-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.board-widget-name {
    font-size: 13px; font-weight: 500; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.board-widget-price { color: var(--accent); font-weight: 700; font-size: 12px; }

/* ---- Ad form validation + hints --------------------------------- */
.oa-req { color: var(--danger); font-weight: 700; }
.oa-block.is-invalid .oa-label { color: var(--danger); }
.oa-block.is-invalid input,
.oa-block.is-invalid textarea,
.oa-block.is-invalid select,
.oa-block.is-invalid .oa-type-chip span,
.oa-block.is-invalid .oa-seg span {
    border-color: var(--danger);
}
.oa-block.is-invalid .oa-dropzone { border-color: var(--danger); }

.oa-dropzone-sub { font-size: 12px; color: var(--accent); font-weight: 600; }

.oa-preview-tile.is-toobig { outline: 2px solid var(--danger); }
.oa-preview-warn {
    position: absolute; top: 0; left: 0; right: 0;
    background: rgba(225,29,72,0.85); color: #fff;
    font-size: 10px; font-weight: 700; text-align: center; padding: 2px;
}

/* ============================================================
   Account cabinet tabs + verification banner (Phase A)
   ============================================================ */
.account-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 20px;
    padding-bottom: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.account-tabs::-webkit-scrollbar { display: none; }

.account-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 8px 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.account-tab:hover { border-color: var(--ink); color: var(--ink); }
.account-tab.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: #0c5f59;
}
.account-tab-count {
    min-width: 20px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--soft);
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.account-tab.is-active .account-tab-count { background: #ffffff; color: #0c5f59; }

.account-profile-link { margin: 0 0 18px; font-size: 14px; color: var(--ink-3); }

/* Security page bits */
.account-section h3 { margin: 20px 0 6px; font-size: 15px; }
.account-inline-form { margin: 6px 0 0; }
.account-email-status {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 9px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
}
.account-email-status.is-ok { background: var(--accent-soft); color: #0c5f59; }
.account-email-status.is-no { background: #fef3c7; color: #92400e; }

/* Verification banner (public layout, shown to unverified users) */
.verify-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent-soft);
}
.verify-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.verify-banner-text strong { color: #0c5f59; font-size: 15px; }
.verify-banner-text span { color: var(--ink-2); font-size: 13px; }
.verify-banner-form { flex: none; margin: 0; }

/* Auth success/notice line (login, forgot) */
.auth-notice {
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: #0c5f59;
    font-weight: 600;
    font-size: 14px;
}

/* Security page panels (Phase A, step 5) */
.account-panel {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.account-email-line { margin: 0 0 10px; }
.account-panel .account-form { margin-top: 4px; }
.account-panel .btn { margin-top: 2px; }
.account-support-hint {
    margin: 22px 0 0;
    font-size: 14px;
    color: var(--ink-3);
}
.account-support-hint a { color: var(--accent); font-weight: 600; }

.auth-hint { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); text-align: center; }

/* Remember-me checkbox (login) + device list (security) — Phase A, step 6 */
.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 4px;
    font-size: 14px;
    color: var(--ink-2);
    cursor: pointer;
}
.auth-remember input { width: 16px; height: 16px; }

.account-device-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.account-device {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--soft);
}
.account-device.is-current { border-color: var(--accent); background: var(--accent-soft); }
.account-device-name { font-weight: 600; color: var(--ink); }
.account-device-tag {
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: #ffffff;
    color: #0c5f59;
    font-size: 11px;
    font-weight: 700;
}
.account-device-meta { font-size: 13px; color: var(--ink-3); }

/* Simple vertical form (security page) — nice inputs WITHOUT the profile grid */
.account-form-stack { max-width: 460px; }
.account-form-stack .form-row {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
}
.account-form-stack .form-row > label { font-weight: 500; color: var(--ink); }
.account-form-stack input[type="text"],
.account-form-stack input[type="email"],
.account-form-stack input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.account-form-stack input:focus {
    outline: 0;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}
.account-form-stack .form-row .account-help { margin: 2px 0 0; }
.account-form-stack .btn { margin-top: 6px; }

/* Cookie consent banner (Phase A, step 7) */
.cookie-consent {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 1200;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 14px 18px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(17, 24, 39, 0.18);
}
.cookie-consent-text { margin: 0; font-size: 14px; color: var(--ink-2); flex: 1 1 320px; }
.cookie-consent-text a { color: var(--accent); font-weight: 600; }
.cookie-consent .btn { flex: none; }

@media (max-width: 560px) {
    .cookie-consent {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 12px;
        text-align: left;
    }
    /* In a column flex container a px flex-basis becomes a HEIGHT basis — which
       stretched the banner to ~320px tall. Reset it. */
    .cookie-consent-text { flex: none; font-size: 13px; }
    .cookie-consent .btn { width: 100%; }
}

/* ============================================================
   Members-only splash / login page
   ============================================================ */
.splash-page { margin: 0; background: var(--surface); }
.splash {
    display: grid;
    grid-template-columns: minmax(320px, 480px) 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}
.splash-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 28px;
}
.splash-form-inner { width: 100%; max-width: 360px; }
.splash-brand {
    display: inline-block;
    margin-bottom: 28px;
    font-weight: 800;
    font-size: 18px;
    color: var(--accent);
    text-decoration: none;
}
.splash-form-inner h1 { margin: 0 0 8px; font-size: 28px; }
.splash-lead { margin: 0 0 22px; color: var(--ink-3); font-size: 15px; }
.splash-copyright { margin: 28px 0 0; font-size: 12px; color: var(--ink-4); }

.splash-media { position: relative; overflow: hidden; background: var(--soft); }
.splash-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.splash-media-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 30%, #134e4a, #0f766e 55%, #0c4a45);
}
.splash-media-placeholder span {
    font-size: 22vmin;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1;
}

@media (max-width: 820px) {
    .splash { grid-template-columns: 1fr; }
    .splash-media { order: -1; height: 200px; }
    .splash-form { padding: 28px 20px 40px; }
}

/* ============================================================
   Header account dropdown (public)
   ============================================================ */
.user-menu { position: relative; }
.user-menu .avatar { border: 0; cursor: pointer; padding: 0; }
.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1100;
    min-width: 210px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 14px 40px rgba(17, 24, 39, 0.16);
}
.user-menu-panel a,
.user-menu-panel button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.user-menu-panel a:hover,
.user-menu-panel button:hover { background: var(--soft); }
.user-menu-panel a svg,
.user-menu-panel button svg { color: var(--ink-3); flex: none; }
.user-menu-logout { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.user-menu-logout button:hover { background: var(--danger-soft); color: var(--danger-dark); }
.user-menu-logout button:hover svg { color: var(--danger-dark); }

/* Footer contacts (settings → Загальне → Контакти редакції) */
.footer-contacts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    font-size: 13px;
}
.footer-contacts a,
.footer-contacts span { color: var(--ink-3); text-decoration: none; }
.footer-contacts a:hover { color: var(--ink); }

.auth-social { text-decoration: none; font-weight: 600; font-size: 14px; }

/* Share-card buttons (4:5 / 9:16) — plain icon buttons like the rest */
.post-act-card { gap: 6px; }

/* Pending comment (visible only to its author + moderators) */
.comment.is-pending { opacity: 0.85; }
.comment.is-pending > .comment-main { border-left: 3px solid var(--warning, #d99000); padding-left: 12px; }
.comment-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--warning, #b97a00);
    background: rgba(217, 144, 0, 0.12);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.comment-pending-badge svg { width: 13px; height: 13px; }

/* Account tab as icon-only (Безпека) */
.account-tab-icon { display: inline-flex; align-items: center; gap: 6px; }
.account-tab-icon svg { width: 18px; height: 18px; }

/* Avatar cropper modal */
.avatar-cropper { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; }
.avatar-cropper[hidden] { display: none; }
.avatar-cropper-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 28, 0.6); }
.avatar-cropper-card {
    position: relative;
    background: var(--surface, #fff);
    border-radius: 14px;
    padding: 18px;
    width: min(340px, 92vw);
    box-shadow: 0 18px 50px rgba(0,0,0,.3);
}
.avatar-cropper-card h3 { margin: 0 0 12px; font-size: 17px; }
.avatar-cropper-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 50%;
    background: #222;
    touch-action: none;
    cursor: grab;
    user-select: none;
}
.avatar-cropper-stage:active { cursor: grabbing; }
.avatar-cropper-stage img { position: absolute; top: 0; left: 0; max-width: none; will-change: transform; }
.avatar-cropper-zoom { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; font-size: 14px; color: var(--muted); }
.avatar-cropper-zoom input { flex: 1; }
.avatar-cropper-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* Lazy-image fade-in (added by JS only; no-JS shows images normally) */
img.img-lazy { opacity: 0; transition: opacity 0.4s ease; }
img.img-lazy.is-loaded { opacity: 1; }

/* Account danger zone (delete account) */
.account-danger { border: 1px solid var(--danger-soft); }
.account-danger h2 { color: var(--danger-dark); }

/* Account danger zone — collapsed into a spoiler */
.account-danger > details > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--danger-dark);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.account-danger-summary::-webkit-details-marker { display: none; }
.account-danger-summary::before { content: "⚠"; }
.account-danger > details[open] > .account-danger-summary { margin-bottom: 10px; }

/* Library/uploaded icon in nav (matches the line-icon footprint) */
.ui-ico-img { flex: none; object-fit: contain; vertical-align: middle; }

/* Feed default-tab gear picker */
.feed-gear { position: relative; flex: none; }
.feed-gear > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    color: var(--ink-3);
}
.feed-gear > summary::-webkit-details-marker { display: none; }
.feed-gear > summary:hover { background: var(--soft); color: var(--ink); }
.feed-gear[open] > summary { background: var(--soft); color: var(--ink); }
.feed-gear-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,.12);
    padding: 12px;
    min-width: 200px;
    display: grid;
    gap: 6px;
}
.feed-gear-title { font-size: 13px; color: var(--ink-3); margin: 0 0 2px; }
.feed-gear-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 2px; cursor: pointer; }
.feed-gear-menu .btn { margin-top: 4px; }
