/* ==========================================================================
   Кировский Клуб Кудесники — стили
   ========================================================================== */

:root {
    /* палитра из логотипа: салатовый фон, золото птицы, синие и красные «К» */
    --bg: #f8f6ec;
    --bg-alt: #efecd9;
    --surface: #fffef8;
    --ink: #2b2618;
    --ink-soft: #514a35;
    --muted: #78705a;
    --line: #e6e2cb;
    --accent: #4d7318;
    --accent-hover: #3f6114;
    --accent-soft: #eef3d3;
    --sage: #1f7a8c;
    --sage-soft: #ddf0f3;
    --gold: #e7b51a;
    --blue: #393181;
    --blue-soft: #e6e4f4;
    --danger: #b8222a;
    --danger-soft: #fbe5e3;
    --warn-soft: #fdf3cc;

    --radius: 18px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(43, 38, 24, .06);
    --shadow: 0 1px 2px rgba(43, 38, 24, .05), 0 8px 24px rgba(43, 38, 24, .07);
    --shadow-lg: 0 24px 60px rgba(43, 38, 24, .16);

    --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --header-h: 72px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

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

[hidden] { display: none !important; }

/* manipulation: тап срабатывает сразу, браузер не ждёт двойного касания для зума */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 400 16px/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 820px; }
.section { padding-top: 40px; padding-bottom: 56px; }
.site-main { flex: 1; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.page-head { margin-bottom: 28px; }
.page-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 600; }
.page-title .muted { font-family: var(--font); font-size: 1rem; font-weight: 500; vertical-align: middle; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-title { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 600; margin-bottom: 20px; }
.section-head .section-title { margin-bottom: 0; }
.section-title .muted { font-family: var(--font); font-size: 1rem; font-weight: 500; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; color: var(--muted); font-size: .9rem; font-weight: 600; }

/* ---------------------------------------------------------------- кнопки */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    /* половина высоты: в одну строку — «таблетка», при переносе текста — скруглённый прямоугольник, а не овал */
    border-radius: 22px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(77, 115, 24, .6); }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost { border-color: var(--line); background: transparent; }
.btn--ghost:hover { border-color: var(--ink-soft); color: var(--ink); background: var(--surface); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #8f1a20; color: #fff; }
.btn--danger-ghost { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; color: var(--danger); }
.btn--danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }
.btn--sm { min-height: 36px; padding: 7px 14px; font-size: .875rem; }
.btn--block { width: 100%; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-alt); color: var(--ink); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- шапка */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; gap: 28px; height: var(--header-h); }

.logo { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo__mark {
    width: 46px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 6px 16px -6px rgba(77, 115, 24, .5);
}
.logo__text { display: flex; flex-direction: column; line-height: 1; }
.logo__text b { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: .01em; }
.logo__text small { margin-top: 3px; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }

/* min-width: 0 — шапка не раздвигается содержимым, а переполнение видно app.js (меню «⋯») */
.nav { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.nav__links { display: flex; align-items: center; gap: 8px; }
.nav__spacer { flex: 1; }
.nav__link, .nav .btn { flex-shrink: 0; white-space: nowrap; }
/* «⋯»: разделы, которые не поместились в шапку */
.nav .nav-more__toggle { padding: 7px 10px; border: 0; background: none; font: inherit; cursor: pointer; }
.nav .nav-more__toggle:hover, .nav-more.is-open .nav-more__toggle { color: var(--ink); background: var(--bg-alt); }
.nav .nav-more__toggle.is-active { color: var(--accent); background: var(--accent-soft); }
/* иконки разделов в строке скрыты (.nav__link .icon) — у «⋯» и в его меню они нужны */
.nav .nav-more__toggle .icon { display: block; width: 22px; height: 22px; }
.nav-more__menu { left: 0; right: auto; }
.nav .nav-more__menu .nav__link .icon { display: block; color: var(--muted); }
.nav .nav-more__menu .nav__link.is-active { color: var(--accent); background: var(--accent-soft); }
.nav .nav-more__menu .nav__link.is-active .icon { color: var(--accent); }
.nav__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: .95rem;
}
.nav__link .icon { display: none; }
.nav__link:hover { color: var(--ink); background: var(--bg-alt); }
.nav__link.is-active { color: var(--accent); background: var(--accent-soft); }
.nav__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 50%;
    color: var(--ink-soft);
}
.nav__icon:hover, .nav__icon.is-active { background: var(--bg-alt); color: var(--ink); }
.nav__icon .icon { width: 22px; height: 22px; }
.nav__icon-label { display: none; }
.nav__icon .badge { position: absolute; top: 2px; right: 0; }

.badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}

.burger { display: none; margin-left: auto; border: 0; background: none; padding: 8px; cursor: pointer; color: var(--ink); }
.burger .icon { width: 26px; height: 26px; }

.dropdown { position: relative; }
.dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 4px 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
}
.dropdown__name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s, transform .15s var(--ease), visibility .15s;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.dropdown__menu a, .dropdown__menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--ink);
    font-size: .92rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.dropdown__menu a:hover, .dropdown__menu button:hover { background: var(--bg-alt); color: var(--ink); }
.dropdown__menu .icon { color: var(--muted); }
.dropdown__menu form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- аватары, теги, чипы */

.avatar { flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--bg-alt); }
.avatar--placeholder {
    display: inline-grid;
    place-items: center;
    background: hsl(var(--hue) 45% 88%);
    color: hsl(var(--hue) 40% 32%);
    font-family: var(--font-display);
    font-weight: 700;
}
.avatar--xs { width: 24px; height: 24px; font-size: .8rem; }
.avatar--sm { width: 34px; height: 34px; font-size: 1rem; }
.avatar--md { width: 48px; height: 48px; font-size: 1.4rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 2rem; }
.avatar--xl { width: 140px; height: 140px; font-size: 3.8rem; }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-alt);
    color: var(--ink-soft);
    font-size: .74rem;
    font-weight: 600;
    white-space: nowrap;
}
.tag--author { background: var(--sage-soft); color: var(--sage); }
.tag--admin { background: var(--accent-soft); color: var(--accent); }
.tag--user { background: var(--blue-soft); color: var(--blue); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }

.chip {
    position: absolute;
    top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
}
.chip--dark { right: 12px; background: rgba(30, 27, 16, .55); color: #fff; }
.chip--warn { left: 12px; background: rgba(253, 243, 204, .92); color: #7a5300; }

/* теги работ */
.tag-list, .tag-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-bar { margin: -8px 0 24px; }
[data-live-results] { transition: opacity .2s; }
[data-live-results].is-loading { opacity: .5; pointer-events: none; }
.tag-bar > .icon { width: 14px; height: 14px; color: var(--muted); }
.tag-group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 3px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-alt); }
.tag-bar__sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.tag-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 12px;
    border: 1px solid var(--line);
    /* не 999px: длинный тег переносится на вторую строку и остаётся аккуратной «таблеткой», а не овалом */
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: .86rem;
    font-weight: 600;
    transition: border-color .15s, color .15s, background .15s;
}
.tag-link .icon { width: 14px; height: 14px; color: var(--gold); }
.tag-link__parent { color: var(--muted); font-weight: 500; }
/* подкатегория: стрелка, пунктирная рамка и свой цвет, чтобы не путать с корневым тегом */
.tag-link--child { border-style: dashed; border-color: color-mix(in srgb, var(--sage) 45%, var(--line)); background: var(--sage-soft); color: var(--sage); }
.tag-link--child .icon { color: var(--sage); }
.tag-link--child:hover { border-color: var(--sage); color: var(--sage); }
.tag-link--child.is-active { border-style: solid; border-color: var(--sage); background: var(--sage); color: #fff; }
.tag-link--child.is-active .icon, .tag-link--child.is-active .tag-link__parent, .tag-link--child.is-active .tag-link__count { color: rgba(255, 255, 255, .85); }
.tag-link:hover { border-color: var(--accent); color: var(--accent); }
.tag-link.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tag-link--sm { gap: 4px; padding: 2px 9px; border-radius: 12px; font-size: .76rem; }
/* подпись тега — один блок текста: «родитель › подкатегория» переносится как обычная строка */
.tag-link__label { min-width: 0; overflow-wrap: anywhere; }
.tag-link > .icon, .tag-link__count { flex-shrink: 0; }
.tag-link--sm .icon { width: 12px; height: 12px; }
.tag-link--more { color: var(--muted); }
.work-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -2px; }
.tag-link__count { color: var(--muted); font-size: .76rem; font-weight: 700; }

.tag-picker { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; padding: 6px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.tag-picker__empty { margin: 6px 8px; }
.tag-option { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px calc(10px + var(--depth, 0) * 24px); border-radius: 8px; font-size: .94rem; cursor: pointer; }
.tag-option input { width: 17px; height: 17px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.tag-option > .icon { width: 15px; height: 15px; margin-right: -4px; color: var(--sage); flex-shrink: 0; }
.tag-option:hover { background: var(--bg); }
.tag-option:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag-option.is-new { animation: tag-flash 1.2s var(--ease); }
@keyframes tag-flash { from { box-shadow: 0 0 0 3px var(--accent); } }
.tag-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; }
.tag-tree-name { display: inline-flex; align-items: center; gap: 8px; padding-left: calc(var(--depth, 0) * 26px); }
.tag-tree-name .icon { width: 15px; height: 15px; color: var(--gold); flex-shrink: 0; }

/* ---------------------------------------------------------------- уведомления */

.flash-stack {
    position: fixed;
    top: calc(var(--header-h) + 14px);
    right: 20px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(420px, calc(100vw - 40px));
}
.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 14px 18px;
    border-left: 4px solid var(--sage);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    font-size: .92rem;
    animation: flash-in .35s var(--ease);
}
.flash span { flex: 1; }
.flash--error { border-color: var(--danger); }
.flash--info { border-color: var(--blue); }
.flash.is-leaving { opacity: 0; transform: translateX(20px); transition: .3s; }
.flash__close { border: 0; background: none; color: var(--muted); padding: 2px; cursor: pointer; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px); } }

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    color: #6d4c00;
    font-size: .92rem;
    font-weight: 500;
}

/* ---------------------------------------------------------------- главная: hero */

.hero {
    position: relative;
    overflow: hidden;
    padding: 64px 0 48px;
    background:
        radial-gradient(circle at 85% 20%, rgba(231, 181, 26, .18), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(31, 122, 140, .14), transparent 45%),
        radial-gradient(rgba(77, 115, 24, .09) 1.2px, transparent 1.2px) 0 0 / 22px 22px,
        var(--bg);
    border-bottom: 1px solid var(--line);
}
.hero__inner { display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 48px; }
.hero__title { font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 600; line-height: 1.02; letter-spacing: -.01em; }
.hero__title em { color: var(--accent); font-style: italic; }
.hero__lead { max-width: 560px; margin: 20px 0 28px; color: var(--ink-soft); font-size: 1.1rem; }

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 560px;
    padding: 6px 6px 6px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.search > .icon { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; padding: 8px 4px; outline: none; color: var(--ink); }

/* статистика: плашки «со швом», цвета — как в дымковской росписи */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 600px; margin: 32px 0 0; padding: 0; list-style: none; }
.stat-tile {
    --tone: var(--accent);
    --tone-soft: var(--accent-soft);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 14px 12px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm), 0 10px 24px -18px color-mix(in srgb, var(--tone) 70%, transparent);
    transition: transform .25s var(--ease), box-shadow .25s;
}
/* пунктирный «шов» по краю, как строчка вышивки */
.stat-tile::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1.5px dashed color-mix(in srgb, var(--tone) 40%, transparent);
    border-radius: 12px;
    pointer-events: none;
}
@media (hover: hover) { .stat-tile:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: var(--shadow), 0 14px 28px -16px color-mix(in srgb, var(--tone) 75%, transparent); } }
.stat-tile--terracotta { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.stat-tile--sage { --tone: var(--sage); --tone-soft: var(--sage-soft); }
.stat-tile--blue { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.stat-tile--berry { --tone: #b8334a; --tone-soft: #f9e1e5; }
.stat-tile__icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 10px; border-radius: 50%; background: var(--tone-soft); color: var(--tone); }
.stat-tile__icon .icon { width: 18px; height: 18px; }
.stat-tile--berry .stat-tile__icon .icon { fill: currentColor; }
.stat-tile__value { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.stat-tile__label { margin: 4px 0 0; color: var(--muted); font-size: .84rem; font-weight: 600; }
.stats--compact { grid-template-columns: repeat(3, minmax(0, 150px)); gap: 10px; margin-top: 20px; }
.stats--compact .stat-tile { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 10px; padding: 12px 14px; }
.stats--compact .stat-tile__icon { width: 30px; height: 30px; margin: 0; }
.stats--compact .stat-tile__value { font-size: 1.6rem; }
.stats--compact .stat-tile__label { flex-basis: 100%; margin-top: 2px; }
.author-hero__since { display: inline-flex; align-items: center; gap: 6px; margin: 12px 0 0; }
.author-hero__since .icon { width: 14px; height: 14px; color: var(--gold); }

.hero__collage { position: relative; height: 440px; }
.hero__frame {
    position: absolute;
    overflow: hidden;
    border: 8px solid #fff;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    transition: transform .4s var(--ease);
}
.hero__frame img { width: 100%; height: 100%; object-fit: cover; }
.hero__frame--1 { top: 0; left: 18%; width: 56%; height: 70%; transform: rotate(-4deg); z-index: 2; }
.hero__frame--2 { bottom: 0; left: 0; width: 44%; height: 52%; transform: rotate(5deg); z-index: 3; }
.hero__frame--3 { bottom: 6%; right: 0; width: 42%; height: 56%; transform: rotate(-2deg); z-index: 1; }
@media (hover: hover) { .hero__frame:hover { transform: rotate(0) scale(1.03); z-index: 4; } }

/* ---------------------------------------------------------------- сетка работ */

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

.work-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
@media (hover: hover) { .work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); } }
.work-card__media { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--bg-alt); }
.work-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
@media (hover: hover) { .work-card:hover .work-card__media img { transform: scale(1.05); } }
.work-card__noimg { display: grid; place-items: center; height: 100%; color: var(--muted); }
.work-card__noimg .icon { width: 40px; height: 40px; }
.work-card__body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; }
.work-card__title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; line-height: 1.15; }
.work-card__title a { color: var(--ink); }
.work-card__title a:hover { color: var(--accent); }
/* вся карточка — ссылка на работу (заголовок растянут на карточку); теги и автор — свои ссылки поверх */
.work-card__title a::after, .news-card__title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.work-card__tags a, .work-card__author { position: relative; z-index: 2; }
.work-card__meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }
.work-card__author { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink-soft); font-size: .88rem; font-weight: 600; line-height: 1.3; }
.work-card__author .avatar { flex-shrink: 0; }
/* имя и фамилия переносятся на вторую строку (а очень длинные — сокращаются после неё), полное имя — в title */
.work-card__author-name { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.work-card__stats { display: inline-flex; gap: 12px; color: var(--muted); font-size: .82rem; font-weight: 600; }
.work-card__stats > span { display: inline-flex; align-items: center; gap: 4px; }
.work-card__stats .icon { width: 15px; height: 15px; }

.empty-state { padding: 64px 24px; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; }
.empty-state > .icon { width: 48px; height: 48px; margin-bottom: 12px; color: var(--gold); }
.empty-state h3 { margin-bottom: 8px; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.empty-state p { margin: 12px 0 0; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.pagination__item {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
}
.pagination__item:hover { border-color: var(--accent); color: var(--accent); }
.pagination__item.is-current { border-color: var(--accent); background: var(--accent); color: #fff; }
.pagination__gap { color: var(--muted); padding: 0 4px; }

/* ---------------------------------------------------------------- страница работы */

/* крошки — всегда одна строка: длинные пункты сокращаются многоточием (полный текст — в title),
   раздел не сжимается, промежуточные — не больше половины строки, текущая страница занимает остаток */
.breadcrumbs { display: flex; align-items: center; gap: 6px; min-width: 0; margin-bottom: 24px; color: var(--muted); font-size: .88rem; }
.breadcrumbs a { color: var(--ink-soft); font-weight: 600; }
.breadcrumbs > a, .breadcrumbs > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs > a { flex: 0 1 auto; max-width: 50%; }
.breadcrumbs > a:first-child { flex-shrink: 0; }
.breadcrumbs > span { flex: 1 1 0; }
.breadcrumbs .icon { flex-shrink: 0; width: 14px; height: 14px; }

.work-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 40px; align-items: start; }

.gallery__main {
    position: relative;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: #1e1b10;
    box-shadow: var(--shadow);
}
.gallery__open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery__main img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; margin: 0 auto; transition: opacity .2s; }
.gallery__main img.is-loading { opacity: .4; }
.gallery__nav {
    position: absolute;
    top: 50%;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-top: -23px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 254, 248, .88);
    color: var(--ink);
    box-shadow: var(--shadow);
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s, transform .2s;
}
.gallery__nav--prev { left: 14px; }
.gallery__nav--next { right: 14px; }
.gallery__nav:focus-visible { opacity: 1; }
@media (hover: hover) { .gallery__main:hover .gallery__nav { opacity: 1; } }
/* на сенсорных экранах наведения нет — стрелки видны всегда */
@media (hover: none) { .gallery__nav { opacity: 1; } }
@media (hover: hover) { .gallery__nav:hover { transform: scale(1.08); } }
.gallery__counter {
    position: absolute;
    bottom: 14px;
    right: 14px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(30, 27, 16, .6);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.gallery__thumb {
    flex: 0 0 84px;
    height: 84px;
    padding: 0;
    overflow: hidden;
    border: 3px solid transparent;
    border-radius: 12px;
    background: var(--bg-alt);
    cursor: pointer;
    opacity: .65;
    transition: opacity .15s, border-color .15s;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb:hover { opacity: 1; }
.gallery__thumb.is-active { border-color: var(--accent); opacity: 1; }

.work-info { position: sticky; top: calc(var(--header-h) + 24px); display: flex; flex-direction: column; gap: 18px; }
.work-info__title { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 600; }
.work-info > .muted { margin-top: -10px; }

.author-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px 12px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.author-chip:hover { border-color: var(--accent); color: var(--ink); box-shadow: var(--shadow); }
.author-chip__text { display: flex; flex-direction: column; flex: 1; line-height: 1.3; }
.author-chip > .icon { color: var(--muted); }

.work-info__stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--bg-alt); color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
a.stat:hover { color: var(--ink); }
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.like-btn .icon { width: 20px; height: 20px; transition: transform .2s; }
.like-btn:hover { border-color: #e0474c; color: #b8222a; }
.like-btn.is-liked { border-color: #e0474c; background: #fdeaea; color: #b8222a; }
.like-btn.is-liked .icon { fill: currentColor; }
.like-btn.pop .icon { animation: pop .4s var(--ease); }
@keyframes pop { 40% { transform: scale(1.45); } }

.prose { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.7; overflow-wrap: anywhere; }
.work-info__actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line); }
.work-info__actions form { margin: 0; }

/* комментарии */
.comments { max-width: 820px; margin-top: 64px; }
.comment-list { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.comment { display: flex; gap: 14px; }
.comment:target .comment__content { box-shadow: 0 0 0 3px var(--accent-soft); }
.comment__content { flex: 1; min-width: 0; padding: 14px 18px; border-radius: 4px var(--radius) var(--radius) var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.comment__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.comment__tools { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.comment__tools form { margin: 0; }
.comment__tools .icon-btn { width: 30px; height: 30px; }
.comment__body { color: var(--ink-soft); overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 16px; }
.comment-form__as { display: flex; align-items: center; gap: 10px; font-size: .92rem; }

/* ---------------------------------------------------------------- мастера */

.author-hero {
    padding: 56px 0 40px;
    background:
        radial-gradient(circle at 90% 10%, rgba(231, 181, 26, .16), transparent 40%),
        radial-gradient(rgba(77, 115, 24, .08) 1.2px, transparent 1.2px) 0 0 / 22px 22px,
        var(--bg);
    border-bottom: 1px solid var(--line);
}
.author-hero__inner { display: flex; gap: 40px; align-items: flex-start; }
.author-hero__inner > .avatar { border: 6px solid #fff; box-shadow: var(--shadow-lg); }
.author-hero__info { flex: 1; min-width: 0; }
.author-hero__name { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 600; margin-bottom: 14px; }
.author-hero__bio { max-width: 720px; }
.author-hero__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

.authors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.author-card {
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--ink);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
@media (hover: hover) { .author-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--ink); } }
.author-card { display: flex; flex-direction: column; }
.author-card__link { display: block; flex: 1; color: inherit; }
.author-card__link:hover { color: inherit; }
.author-card__tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0 22px 20px; }
.author-card__thumbs { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 3px; height: 180px; overflow: hidden; background: var(--bg-alt); }
.author-card__thumbs > :first-child { grid-row: span 2; }
.author-card__thumbs img, .author-card__empty { width: 100%; height: 100%; min-height: 0; object-fit: cover; background: var(--bg-alt); }
.author-card__body { position: relative; padding: 0 22px 22px; text-align: center; }
.author-card__body .avatar { position: relative; display: grid; margin: -36px auto 10px; border: 4px solid var(--surface); }
.author-card__body h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin-bottom: 6px; }
.author-card__stats { display: flex; justify-content: center; gap: 16px; margin-top: 14px; color: var(--muted); font-size: .88rem; font-weight: 600; }
.author-card__stats span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------------------------------------------------------------- формы */

.card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.form { display: flex; flex-direction: column; gap: 18px; }
.form-card { padding: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: .88rem; font-weight: 700; color: var(--ink-soft); }
.field__hint { color: var(--muted); font-size: .82rem; }
.input {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.55; }
select.input { appearance: none; padding-right: 38px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a7c70' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; cursor: pointer; }
.checkbox input, .choice-card input { width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.choice-card {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-card > span { display: flex; flex-direction: column; gap: 2px; }
.fieldset { margin: 6px 0 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 16px; }
.fieldset legend { padding: 0 8px; font-weight: 700; color: var(--ink-soft); }

.auth-page { display: grid; place-items: center; padding: 56px 20px; }
.auth-card { width: 100%; max-width: 480px; padding: 40px; text-align: center; box-shadow: var(--shadow); }
.auth-card .form { margin-top: 24px; text-align: left; }
.auth-card__icon { display: inline-grid; place-items: center; width: 60px; height: 60px; margin-bottom: 14px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.auth-card__icon .icon { width: 30px; height: 30px; }
.auth-card__alt { margin-top: 22px; font-size: .92rem; }
.auth-card .form-row { grid-template-columns: 1fr; }

.avatar-field { display: flex; align-items: center; gap: 24px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-field .checkbox { margin-top: 10px; }
.avatar-field .field__hint { margin-top: 8px; }

/* загрузка изображений */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 36px 20px;
    border: 2px dashed color-mix(in srgb, var(--accent) 35%, var(--line));
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent-soft) 40%, #fff);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 6px; border-radius: 50%; background: #fff; color: var(--accent); box-shadow: var(--shadow); }
.dropzone__icon .icon { width: 26px; height: 26px; }
.dropzone__title { font-weight: 600; }
.dropzone__title u { color: var(--accent); }

.preview-grid, .image-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.preview-grid:not(:empty) { margin-top: 14px; }
.preview-item, .image-manage__item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--bg-alt); }
.preview-item img, .image-manage__item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item__remove {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(30, 27, 16, .65);
    color: #fff;
    cursor: pointer;
}
.preview-item__badge { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; }
.preview-item.is-invalid { outline: 3px solid var(--danger); }
.preview-item.is-invalid::after { content: attr(data-error); position: absolute; inset: auto 0 0; padding: 4px; background: var(--danger); color: #fff; font-size: .7rem; text-align: center; }

.image-manage { margin-top: 6px; }
.image-manage__cover, .image-manage__delete {
    position: absolute;
    top: 6px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 254, 248, .9);
    color: var(--muted);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.image-manage__cover { left: 6px; }
.image-manage__delete { right: 6px; }
.image-manage__cover input, .image-manage__delete input { position: absolute; opacity: 0; pointer-events: none; }
.image-manage__cover:has(input:checked) { background: var(--gold); color: var(--ink); }
.image-manage__cover:has(input:checked) .icon { fill: currentColor; }
.image-manage__delete:has(input:checked) { background: var(--danger); color: #fff; }
.image-manage__item:has(.image-manage__delete input:checked) img { opacity: .3; filter: grayscale(1); }

/* кабинет: список работ */
.manage-list { display: flex; flex-direction: column; gap: 14px; }
.manage-item { display: flex; align-items: center; gap: 20px; padding: 14px; }
.manage-item__thumb { flex: 0 0 96px; height: 96px; overflow: hidden; border-radius: 12px; background: var(--bg-alt); }
.manage-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.manage-item__info { flex: 1; min-width: 0; }
.manage-item__info h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin-bottom: 4px; }
.manage-item__info h3 a { color: var(--ink); }
.manage-item__info p { margin-bottom: 6px; }
.manage-item__actions { display: flex; gap: 8px; }
.manage-item__actions form { margin: 0; }

/* ---------------------------------------------------------------- сообщения */

.conversation-list { padding: 6px; }
.conversation { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; color: var(--ink); }
.conversation + .conversation { border-top: 1px solid var(--line); }
.conversation:hover { background: var(--bg); color: var(--ink); }
.conversation__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conversation__head { display: flex; align-items: center; gap: 8px; }
.conversation__head time { margin-left: auto; white-space: nowrap; }
.conversation__preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.conversation.is-unread .conversation__preview { color: var(--ink); font-weight: 600; }

.thread { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: calc(100vh - var(--header-h) - 100px); min-height: 460px; }
.thread__head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.thread__head a b { color: var(--ink); }
.thread__body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 24px 20px; background: var(--bg); }
.thread__empty { margin: auto; max-width: 340px; text-align: center; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.msg--mine { align-self: flex-end; align-items: flex-end; }
.msg__bubble { padding: 10px 16px; border-radius: 18px 18px 18px 4px; background: var(--surface); box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.msg--mine .msg__bubble { border-radius: 18px 18px 4px 18px; background: var(--accent); color: #fff; }
.msg--mine .msg__bubble a { color: #fff; text-decoration: underline; }
.msg__time { margin-top: 4px; color: var(--muted); font-size: .74rem; }
/* чат мастеров: значок вместо аватара, имя автора над первым из его сообщений подряд */
.avatar--group { display: inline-grid; place-items: center; background: var(--sage-soft); color: var(--sage); }
.avatar--group .icon { width: 24px; height: 24px; }
.avatar--updates { background: var(--accent-soft); color: var(--accent); }
.thread__readonly { display: flex; align-items: center; gap: 10px; margin: 0; padding: 16px 18px; border-top: 1px solid var(--line); }
.thread__readonly .icon { flex-shrink: 0; width: 18px; height: 18px; }
.msg-menu__reactions:last-child { padding-bottom: 0; border-bottom: 0; }
.msg__author { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 4px 4px; color: var(--ink-soft); font-size: .82rem; }
.msg__author:hover { color: var(--ink); }
.msg--cont { margin-top: -8px; }
/* список участников чата мастеров: раскрывается из шапки, строка ведёт в личный диалог */
.thread__head { position: relative; }
.members__toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px 0; color: var(--muted); font-size: .85rem; cursor: pointer; list-style: none; }
.members__toggle::-webkit-details-marker { display: none; }
.members__toggle:hover, .members[open] .members__toggle { color: var(--accent); }
.members__toggle .icon { width: 16px; height: 16px; transition: transform .15s; }
.members[open] .members__toggle .icon { transform: rotate(180deg); }
.members__panel {
    position: absolute;
    top: calc(100% - 6px);
    left: 18px;
    z-index: 5;
    width: min(340px, calc(100% - 36px));
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.members__hint { margin: 4px 10px 6px; }
.members__list { margin: 0; padding: 0; list-style: none; }
.members__item { display: flex; align-items: center; gap: 4px; }
.members__profile { display: flex; flex: 1; min-width: 0; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border-radius: 10px; color: var(--ink); }
.members__profile:hover { background: var(--bg-alt); color: var(--ink); }
.members__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.members__write { width: 44px; height: 44px; flex-shrink: 0; }
.members__write:hover { color: var(--accent); }
.thread__form { display: flex; gap: 10px; align-items: flex-end; padding: 14px; border-top: 1px solid var(--line); }
.thread__form textarea { min-height: 48px; max-height: 180px; resize: none; }
.thread__blocked { margin: 14px; }
.thread__form { position: relative; flex-wrap: wrap; }
/* поле ввода не должно переносить кнопки на новую строку, когда сверху появилась плашка ответа */
.thread__form textarea { flex: 1 1 0; width: auto; min-width: 0; }

/* ответы на сообщения: цитата в пузыре, плашка над полем ввода */
.msg__quote { display: flex; flex-direction: column; margin: 0 0 6px; padding: 5px 10px; border-left: 3px solid var(--accent); border-radius: 6px; background: rgba(30, 27, 16, .05); color: var(--ink-soft); font-size: .85rem; line-height: 1.35; }
.msg__quote b { color: var(--accent); font-size: .8rem; }
.msg__quote span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
a.msg__quote:hover { background: rgba(30, 27, 16, .09); color: var(--ink); }
.msg__quote.is-missing { flex-direction: row; align-items: center; gap: 6px; font-style: italic; }
.msg__quote.is-missing .icon { width: 14px; height: 14px; }
.msg--mine .msg__bubble .msg__quote { border-color: rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .9); text-decoration: none; }
.msg--mine .msg__quote b { color: #fff; }
.msg--mine a.msg__quote:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.msg.is-highlight .msg__bubble { animation: msg-highlight 1.6s var(--ease); }
@keyframes msg-highlight { 0%, 40% { box-shadow: 0 0 0 4px var(--gold); } 100% { box-shadow: var(--shadow-sm); } }
.msg__meta { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; margin-top: 4px; }
.msg--mine .msg__meta { justify-content: flex-end; }
.msg__meta .msg__time { margin-top: 0; }
.reply-bar { display: flex; flex-basis: 100%; align-items: center; gap: 10px; min-width: 0; padding: 4px 4px 4px 12px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--bg); }
.reply-bar > .icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--accent); }
.reply-bar__body { display: flex; flex: 1; flex-direction: column; min-width: 0; font-size: .85rem; line-height: 1.35; }
.reply-bar__body b { color: var(--accent); }
.reply-bar__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.reply-bar__cancel { flex-shrink: 0; width: 40px; height: 40px; }

/* реакции на сообщения: плашки под пузырём */
.reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 0; }
.reactions.is-empty { display: none; }
.msg--mine .reactions { justify-content: flex-end; }
.reaction { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 1rem; line-height: 1; cursor: pointer; }
.reaction__count { color: var(--ink-soft); font-size: .78rem; font-weight: 700; }
.reaction.is-mine { border-color: var(--accent); background: var(--accent-soft); }
.reaction.is-mine .reaction__count { color: var(--accent); }

/* меню сообщения: открывается нажатием на пузырь — реакции и «Ответить» */
.msg { position: relative; }
.msg__bubble[data-msg-bubble] { cursor: pointer; }
.msg__bubble[data-msg-bubble]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg.is-menu-open .msg__bubble { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm); }
.msg-menu { position: absolute; left: 0; z-index: 6; display: flex; flex-direction: column; min-width: 260px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); animation: msg-menu-in .14s var(--ease); }
.msg--mine .msg-menu { left: auto; right: 0; }
@keyframes msg-menu-in { from { opacity: 0; transform: translateY(-4px); } }
.msg-menu__reactions { display: flex; justify-content: space-between; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.msg-menu__emoji { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 1.45rem; line-height: 1; cursor: pointer; transition: transform .12s; }
.msg-menu__emoji:hover, .msg-menu__emoji:focus-visible { background: var(--bg-alt); transform: scale(1.15); }
.msg-menu__emoji.is-mine { background: var(--accent-soft); }
.msg-menu__item { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; padding: 0 12px; border-radius: 12px; color: var(--ink); font-weight: 600; }
.msg-menu__item:hover, .msg-menu__item:focus-visible { background: var(--bg-alt); color: var(--ink); }
.msg-menu__item .icon { width: 18px; height: 18px; color: var(--muted); }

/* смайлы в сообщениях: панель открывается над полем ввода */
.emoji__toggle { width: 44px; height: 48px; flex-shrink: 0; list-style: none; }
.emoji__toggle::-webkit-details-marker { display: none; }
.emoji__toggle .icon { width: 24px; height: 24px; }
.emoji[open] .emoji__toggle { background: var(--bg-alt); color: var(--accent); }
.emoji__panel {
    position: absolute;
    right: 14px;
    bottom: calc(100% + 6px);
    z-index: 5;
    width: min(352px, calc(100% - 28px));
    max-height: min(320px, 50vh);
    overflow-y: auto;
    padding: 8px 10px 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.emoji__group { margin: 6px 4px 4px; }
.emoji__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji__item { display: grid; place-items: center; height: 40px; padding: 0; border: 0; border-radius: 10px; background: none; font-size: 1.45rem; line-height: 1; cursor: pointer; }
.emoji__item:hover, .emoji__item:focus-visible { background: var(--bg-alt); }

/* ---------------------------------------------------------------- админка */

.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 32px; align-items: start; }
.admin-nav { position: sticky; top: calc(var(--header-h) + 24px); padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.admin-nav__title { display: flex; align-items: center; gap: 8px; padding: 6px 10px 12px; color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.admin-nav nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav__link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink-soft); font-weight: 600; font-size: .94rem; }
.admin-nav__link:hover { background: var(--bg); color: var(--ink); }
.admin-nav__link .badge { margin-left: auto; }

/* заявки «Хочу стать мастером»: блок на странице пользователя и строка в списке */
.master-request { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; padding: 16px 20px; border-left: 4px solid var(--accent); }
.master-request p { margin: 2px 0 0; }
.master-request--row { margin: 6px 0 0; padding: 0; border: 0; justify-content: flex-start; gap: 8px; }
.master-request__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.master-request__actions form { margin: 0; }
.admin-nav__link.is-active { background: var(--accent-soft); color: var(--accent); }
.admin-content .page-title { margin-bottom: 20px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
a.stat-card:hover { border-color: var(--accent); color: var(--ink); }
.stat-card b { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; }
.stat-card span { margin-top: 4px; font-weight: 600; color: var(--ink-soft); }
.stat-card small { margin-top: 4px; color: var(--muted); }
.stat-card--accent { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.stat-card--accent b { color: var(--accent); }

.admin-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-panel__title { margin-bottom: 14px; font-size: 1.05rem; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mini-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mini-list li time { margin-left: auto; }
.mini-list--stack li { display: block; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mini-list--stack li:last-child { border: 0; padding-bottom: 0; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filters .input { flex: 1 1 200px; width: auto; }
.filters select.input { flex: 0 1 220px; }
.filters.card { padding: 16px; }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg); }
.table tr.is-muted td { opacity: .6; }
.table a b { color: var(--ink); }
.table-user { display: flex; align-items: center; gap: 12px; }
.table-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.table-actions form { margin: 0; }

.admin-comments { display: flex; flex-direction: column; gap: 14px; }
.admin-comment { padding: 18px 20px; }
.admin-comment__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.admin-comment__head time { margin-left: auto; }
.admin-comment__body { margin: 8px 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--bg); overflow-wrap: anywhere; }
.admin-comment__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-comment__actions form { margin: 0; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.danger-zone form { margin: 0; }

/* ---------------------------------------------------------------- ошибки, подвал */

.error-page { text-align: center; padding: 80px 24px; }
.error-page__code { display: block; font-family: var(--font-display); font-size: clamp(6rem, 18vw, 10rem); font-weight: 700; line-height: 1; color: var(--accent); opacity: .25; }
.error-page p { margin-top: 16px; }

.site-footer { margin-top: 40px; padding: 40px 0; border-top: 1px solid var(--line); background: var(--bg-alt); }
.site-footer__inner { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 32px; align-items: start; }
.site-footer p { margin-top: 14px; font-size: .9rem; }
.site-footer__nav { display: flex; flex-direction: column; gap: 8px; }
.site-footer__nav a { color: var(--ink-soft); font-weight: 600; }
.site-footer__copy { align-self: end; font-size: .85rem; }

/* ---------------------------------------------------------------- лайтбокс */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(18, 16, 9, .94);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
    touch-action: pan-y;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__img { max-width: 94vw; max-height: 88vh; object-fit: contain; border-radius: 4px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); user-select: none; }
.lightbox__btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background .15s;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, .25); }
.lightbox__btn .icon { width: 26px; height: 26px; }
.lightbox__close { top: 18px; right: 18px; }
.lightbox__prev { left: 18px; top: 50%; margin-top: -26px; }
.lightbox__next { right: 18px; top: 50%; margin-top: -26px; }
.lightbox__counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: rgba(255, 255, 255, .75); font-weight: 600; font-size: .9rem; }
body.no-scroll { overflow: hidden; }

/* ---------------------------------------------------------------- адаптивность */

/* ---------------------------------------------------------------- события */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs__item { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
.tabs__item:hover { border-color: var(--accent); color: var(--accent); }
.tabs__item.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tag--news { background: var(--warn-soft); color: #7a5300; }

.news-head__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search--compact { min-width: 260px; padding: 2px 14px; box-shadow: none; }

.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.news-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s; }
@media (hover: hover) { .news-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); } }
.news-card__media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-alt); }
.news-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
@media (hover: hover) { .news-card:hover .news-card__media img { transform: scale(1.05); } }
.news-card__noimg { display: grid; place-items: center; height: 100%; color: var(--gold); }
.news-card__noimg .icon { width: 44px; height: 44px; }
.news-card__body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; }
.news-card__date { color: var(--muted); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.news-card__title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.15; }
.news-card__title a { color: var(--ink); }
.news-card__title a:hover { color: var(--accent); }
.news-card__excerpt { margin: 0; color: var(--ink-soft); font-size: .94rem; line-height: 1.55; }

.news-article__head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.news-article__title { font-family: var(--font-display); font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 600; line-height: 1.08; }
.news-article__stats { margin-bottom: 24px; }
.news-article__body { display: flex; flex-direction: column; gap: 28px; margin-bottom: 32px; }
.news-text { font-size: 1.08rem; color: var(--ink); }
.news-text > * + *, .rte__area > * + * { margin-top: .9em; }
.news-text h2, .rte__area h2 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; line-height: 1.2; }
.news-text h3, .rte__area h3 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; line-height: 1.25; }
.news-text blockquote, .rte__area blockquote { margin: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--ink-soft); font-style: italic; }
.news-text ul, .news-text ol, .rte__area ul, .rte__area ol { padding-left: 1.4em; }
.news-text a, .rte__area a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.news-text p, .rte__area p { margin-bottom: 0; }

.news-photos { display: grid; gap: 8px; }
.news-photos--2 { grid-template-columns: repeat(2, 1fr); }
.news-photos--3 { grid-template-columns: repeat(3, 1fr); }
.news-photos__item { display: block; padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: var(--bg-alt); cursor: zoom-in; }
.news-photos__item img { display: block; width: 100%; height: auto; transition: transform .4s var(--ease); }
.news-photos--2 .news-photos__item, .news-photos--3 .news-photos__item { aspect-ratio: 1; }
.news-photos--2 .news-photos__item img, .news-photos--3 .news-photos__item img { height: 100%; object-fit: cover; }
@media (hover: hover) { .news-photos__item:hover img { transform: scale(1.03); } }
.news-video { margin: 0; }
.news-video video { display: block; width: 100%; max-height: 80vh; border-radius: 14px; background: #000; }
.video-embed { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* редактор */
.input--lg { font-size: 1.15rem; font-weight: 600; }
.nblocks { display: flex; flex-direction: column; gap: 14px; }
.nblocks:empty { display: none; }
.nblocks__add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; padding: 12px; border: 2px dashed var(--line); border-radius: 14px; }
.nblock { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg); }
.nblock:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.nblock__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nblock__title { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.nblock__title .icon { width: 16px; height: 16px; color: var(--accent); }
.nblock__tools { display: inline-flex; gap: 2px; }
.nblock:first-child [data-block-up], .nblock:last-child [data-block-down] { opacity: .35; pointer-events: none; }

.rte { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rte__toolbar { position: sticky; top: var(--header-h); z-index: 2; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; background: #fff; }
.rte__btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-soft); cursor: pointer; }
.rte__btn .icon { width: 18px; height: 18px; }
.rte__btn:hover { background: var(--bg); color: var(--ink); }
.rte__btn.is-active { background: var(--accent-soft); color: var(--accent); }
.rte__sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.rte__linkbar { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--bg); }
.rte__linkbar .input { min-height: 36px; padding: 6px 12px; }
.rte__area { position: relative; min-height: 160px; padding: 14px 16px; color: var(--ink); outline: none; }
.rte.is-empty .rte__area::before { content: attr(data-placeholder); position: absolute; color: var(--muted); pointer-events: none; }

.dropzone--compact { min-height: 0; padding: 16px; gap: 4px; }
.dropzone--compact .dropzone__title { display: inline-flex; align-items: center; gap: 8px; }
.dropzone--compact .dropzone__title .icon { color: var(--accent); }
.nphotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.nphotos:empty { display: none; }
.nphotos__item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: var(--bg-alt); }
.nphotos__item img { width: 100%; height: 100%; object-fit: cover; }
.nphotos__item.is-uploading img { opacity: .5; }
.nphotos__item .progress { position: absolute; left: 8px; right: 8px; bottom: 8px; }
.nphotos__remove { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: rgba(30, 27, 16, .65); color: #fff; cursor: pointer; }
.nphotos__remove .icon { width: 14px; height: 14px; }

.progress { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 1px var(--line); }
.progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s; }
.upload-progress { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.upload-progress__name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress__pct { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.upload-progress .progress { grid-column: 1 / -1; }

.segmented { display: inline-flex; align-self: flex-start; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; color: var(--ink-soft); font-size: .88rem; font-weight: 600; cursor: pointer; }
.segmented span .icon { width: 15px; height: 15px; }
.segmented input:checked + span { background: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.nvideo__pane { display: flex; flex-direction: column; gap: 12px; }
.nvideo__pane[hidden] { display: none; }
.nvideo__file { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.nvideo__file:empty { display: none; }
.nvideo__file video { width: 100%; max-height: 420px; border-radius: 12px; background: #000; }
.nvideo__file .upload-progress { width: 100%; }
.nvideo__poster { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; }
.nvideo__poster-preview { flex-shrink: 0; display: grid; place-items: center; width: 112px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: var(--bg-alt); }
.nvideo__poster-preview:empty::before { content: ''; width: 26px; height: 26px; opacity: .35; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21'/%3E%3C/svg%3E") center / contain no-repeat; }
.nvideo__poster-preview.is-uploading { opacity: .5; }
.nvideo__poster-preview img { width: 100%; height: 100%; object-fit: cover; }
.nvideo__poster-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nvideo__poster-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.nvideo__link { display: flex; gap: 8px; }
.field__hint.is-error { color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- календарь */
.field--date .input { max-width: 240px; }

.news-card__event, .event-date { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .82rem; font-weight: 700; }
.event-date { padding: 6px 14px; font-size: .9rem; font-weight: 500; }
.event-date:hover { color: var(--accent-hover); }

.cal { padding: 20px; }
.cal__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal__title { flex: 0 1 auto; min-width: 11ch; font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; text-align: center; }
.cal__today { margin-left: auto; }
.cal__legend { display: flex; gap: 18px; margin-bottom: 14px; color: var(--muted); }
.cal__legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.cal__dot--event { background: var(--accent); }
.cal__dot--birthday { background: var(--sage); }

.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal__wd { padding: 4px 0; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-align: center; text-transform: uppercase; }
.cal__wd--weekend { color: var(--accent); }
.cal__day { display: flex; flex-direction: column; gap: 4px; min-height: 104px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.cal__day--empty { border-style: dashed; background: transparent; }
.cal__day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal__num { align-self: flex-start; min-width: 26px; padding: 1px 6px; border-radius: 999px; color: var(--ink-soft); font-size: .88rem; font-weight: 700; text-align: center; }
a.cal__num:hover { background: var(--bg-alt); color: var(--ink); }
.cal__day.is-today .cal__num { background: var(--accent); color: #fff; }
/* до двух строк названия, дальше — многоточие (полное — в title) */
.cal__item { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; padding: 2px 6px; border-radius: 6px; font-size: .76rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.cal__item .icon { vertical-align: -2px; margin-right: 3px; }
.cal__item .icon { width: 12px; height: 12px; }
.cal__item--event { background: var(--accent-soft); color: var(--accent); }
.cal__item--event:hover { background: var(--accent); color: #fff; }
.cal__item--birthday { background: var(--sage-soft); color: var(--sage); }
.cal__item--birthday:hover { background: var(--sage); color: #fff; }

.cal-list { margin-bottom: 32px; }
.cal-list__empty { margin: 0; }
.cal-list__day:last-child { border-bottom: 1px solid var(--line); }
.cal-list__day { display: flex; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header-h) + 16px); }
.cal-list__date { display: flex; flex-direction: column; align-items: center; flex: 0 0 56px; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.cal-list__date b { color: var(--ink); font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.cal-list__date.is-today b { color: var(--accent); }
.cal-list__items { display: flex; flex-direction: column; gap: 10px; flex: 1; margin: 0; padding: 4px 0 0; list-style: none; }
.cal-list__item { display: flex; align-items: center; gap: 10px; }
.cal-list__item > .icon { color: var(--accent); }
.cal-list__item--event a { color: var(--ink); font-weight: 600; }
.cal-list__item--event a:hover { color: var(--accent); }
.cal-list__item--birthday { color: var(--ink-soft); }
.cal-list__item--birthday a { color: var(--sage); font-weight: 600; }

@media (max-width: 1080px) {
    /* minmax(0, …): колонка не растягивается по крупному заголовку или картинке галереи */
    .hero__inner { grid-template-columns: minmax(0, 1fr); }
    .hero__collage { height: 340px; max-width: 560px; }
    .work-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .work-info { position: static; }
    /* minmax(0, …): иначе колонка растягивается по строке меню админки и страница уезжает вбок */
    .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .admin-nav { position: static; }
    .admin-nav nav { flex-direction: row; overflow-x: auto; }
    .admin-nav__link { white-space: nowrap; }
}

@media (max-width: 900px) {
    :root { --header-h: 64px; }
    .burger { display: block; }
    .nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        /* шапка с backdrop-filter — контейнер для fixed, поэтому высота явно */
        height: calc(100vh - var(--header-h));
        height: calc(100dvh - var(--header-h));
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 16px 20px 32px;
        background: var(--bg);
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .2s, transform .25s var(--ease), visibility .2s;
    }
    .nav.is-open { opacity: 1; visibility: visible; transform: none; }
    .nav__spacer { display: none; }
    /* в бургер-меню все разделы на месте, «⋯» не нужно */
    .nav__links { display: contents; }
    .nav-more { display: none !important; }
    .nav__link, .nav__icon { padding: 14px 16px; border-radius: 12px; font-size: 1.05rem; }
    .nav__link .icon { display: block; }
    .nav__icon { border-radius: 12px; }
    .nav__icon-label { display: inline; font-weight: 600; }
    .nav__icon .badge { position: static; margin-left: auto; }
    .nav .btn { margin: 8px 0; min-height: 50px; }
    .dropdown { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
    .dropdown__toggle { width: 100%; border: 0; padding: 10px 16px; background: none; font-size: 1.05rem; pointer-events: none; }
    .dropdown__name { max-width: none; }
    /* inherit, а не visible: иначе пункты меню пользователя остаются кликабельными поверх страницы, пока меню закрыто */
    .dropdown__menu { position: static; opacity: 1; visibility: inherit; transform: none; border: 0; box-shadow: none; background: none; padding: 0; }
    .dropdown__menu a, .dropdown__menu button { padding: 14px 16px; font-size: 1.02rem; }
    .site-footer__inner { grid-template-columns: 1fr; gap: 20px; }
    .admin-columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .cal { padding: 14px 10px; margin: 0 -6px; }
    .cal__title { font-size: 1.45rem; }
    .cal__grid { gap: 3px; }
    .cal__day { min-height: 52px; padding: 4px 2px; align-items: center; gap: 3px; border-radius: 8px; }
    .cal__num { min-width: 0; padding: 0 5px; font-size: .82rem; }
    /* на телефоне в клетке только цветные точки, подробности — в списке под календарём */
    .cal__item { width: 7px; height: 7px; padding: 0; border-radius: 50%; font-size: 0; }
    .cal__item .icon { display: none; }
    .cal__item--event { background: var(--accent); }
    .cal__item--birthday { background: var(--sage); }
    .cal__day.has-event, .cal__day.has-birthday { flex-flow: row wrap; justify-content: center; align-content: flex-start; }
    .cal__day .cal__num { flex-basis: 100%; text-align: center; align-self: auto; }
    .field--date .input { max-width: none; }
    .news-grid { grid-template-columns: 1fr; }
    .news-photos--3 { grid-template-columns: repeat(2, 1fr); }
    .nvideo__link, .rte__linkbar { flex-direction: column; }
    .nvideo__poster { flex-direction: column; align-items: flex-start; }
    .search--compact { min-width: 0; flex: 1; }
    .tag-new { grid-template-columns: 1fr; }
    .container { padding: 0 16px; }
    .section { padding-top: 28px; padding-bottom: 40px; }
    .hero { padding: 40px 0 32px; }
    .hero__collage { height: 260px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search { padding-left: 14px; }
    .search .btn { padding: 10px 16px; }
    .grid-works { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .work-card { border-radius: 14px; }
    .work-card__body { padding: 10px 12px 12px; gap: 6px; }
    .work-card__title { font-size: 1.12rem; }
    .work-card__meta { flex-direction: column; align-items: flex-start; gap: 6px; }
    .work-card__stats { gap: 8px; font-size: .75rem; }
    .chip { top: 8px; padding: 3px 8px; font-size: .7rem; }
    .chip--dark { right: 8px; }
    .gallery__main { border-radius: 12px; margin: 0 -16px; border-radius: 0; }
    .gallery__nav { opacity: 1; width: 38px; height: 38px; margin-top: -19px; }
    .gallery__thumb { flex-basis: 64px; height: 64px; }
    .author-hero__inner { flex-direction: column; align-items: center; text-align: center; gap: 20px; }
    .author-hero__actions { justify-content: center; }
    .stats--compact { margin-inline: auto; }
    .avatar--xl { width: 112px; height: 112px; font-size: 3rem; }
    .form-row { grid-template-columns: 1fr; }
    .form-card, .auth-card { padding: 22px 18px; }
    .avatar-field { flex-direction: column; align-items: flex-start; }
    .manage-item { flex-wrap: wrap; }
    .manage-item__thumb { flex-basis: 72px; height: 72px; }
    .manage-item__actions { width: 100%; }
    .manage-item__actions > * { flex: 1; }
    .manage-item__actions .btn { width: 100%; }
    .msg { max-width: 90%; }
    .thread { height: calc(100vh - var(--header-h) - 56px); margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
    .hide-sm { display: none; }
    .danger-zone { flex-direction: column; align-items: flex-start; }
    .lightbox__prev, .lightbox__next { top: auto; bottom: 14px; margin: 0; }
    /* длинная надпись на кнопке переносится, а не раздвигает страницу */
    .btn { white-space: normal; text-align: center; }
    .btn .icon { flex-shrink: 0; }
    /* цели нажатия крупнее: в мелкие теги и подпись автора трудно попасть пальцем */
    .tag-link--sm { padding-block: 6px; }
    /* в узкой карточке «родитель ›» переносит тег на три строки — достаточно названия подкатегории */
    .work-card__tags .tag-link__parent { display: none; }
    .work-card__author { padding-block: 6px; }
    .flash__close { padding: 8px; margin: -6px -6px -6px 0; }
    .flash-stack { right: 12px; width: calc(100vw - 24px); }
}

/* телефоны в портретной ориентации: одна работа в строке — карточка снова крупная, как на компьютере */
@media (max-width: 480px) {
    .grid-works, .grid-works--compact { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .work-card { border-radius: var(--radius); }
    .work-card__body { padding: 14px 16px 16px; gap: 8px; }
    .work-card__title { font-size: 1.3rem; }
    .work-card__meta { flex-direction: row; align-items: center; justify-content: space-between; gap: 6px 12px; }
    .work-card__stats { gap: 12px; font-size: .82rem; }
    .chip { top: 12px; padding: 4px 10px; font-size: .78rem; }
    .chip--dark { right: 12px; }
    /* в широкой карточке «родитель › подкатегория» снова помещается */
    .work-card__tags .tag-link__parent { display: inline; }
}

/* ---------------------------------------------------------------- технические работы и супер-админка */

.bare__main { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; min-height: 100dvh; }
.maintenance { max-width: 520px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.maintenance__logo { margin: 0 auto 24px; border-radius: 20px; box-shadow: 0 10px 28px -10px rgba(77, 115, 24, .5); }
.maintenance__title { margin-bottom: 14px; font-family: var(--font-display); font-size: clamp(2.2rem, 7vw, 3.2rem); font-weight: 600; }
.maintenance__text { margin-bottom: 28px; color: var(--ink-soft); font-size: 1.1rem; overflow-wrap: anywhere; }
.maintenance-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 16px; background: var(--danger); color: #fff; font-size: .88rem; font-weight: 600; text-align: center; }
.maintenance-bar .icon { width: 16px; height: 16px; }
.maintenance-bar a { color: #fff; text-decoration: underline; }
/* без шапки уведомления встают в правый нижний угол — не закрывают кнопки «На сайт» и «Выйти» */
.bare .flash-stack { top: auto; bottom: 20px; }
.superadmin__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.superadmin__actions form { margin: 0; }
.superadmin__status { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.superadmin__status--on { background: var(--sage-soft); color: var(--sage); }
.superadmin__status--off { background: var(--danger-soft); color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------ push-уведомления */

.push-settings__title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.25rem; }
.push-events { display: flex; flex-direction: column; gap: 10px; }
.choice-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.push-notice { flex-wrap: wrap; margin: 0; }
.push-notice span { flex: 1; min-width: 200px; }
.push-test { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.push-test p { margin: 4px 0 0; }
