/* AllBlog Gallery & Category polish — shared public styles */
:root {
    --gc-accent: #8b5cf6;
    --gc-accent-2: #22d3ee;
    --gc-danger: #fb7185;
}

/* Shared guardrails */
.ae-gallery-page *,
.ae-category-page *,
.gc-legacy-page * { box-sizing: border-box; }

.ae-gallery-page img,
.ae-category-page img,
.gc-legacy-page img { max-width: 100%; }

.gc-hero-meta {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}
.gc-hero-meta span,
.gc-hero-meta a {
    min-height: 34px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--ae-line, rgba(148,163,184,.2));
    border-radius: 999px;
    background: color-mix(in srgb, var(--ae-surface, #17171d) 88%, transparent);
    color: var(--ae-text-soft, #cbd5e1);
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.gc-hero-meta i {
    color: var(--ae-accent-2, #22d3ee);
    font-style: normal;
}
.gc-hero-meta a { transition: border-color .18s ease, color .18s ease, transform .18s ease; }
.gc-hero-meta a:hover { border-color: var(--ae-line-strong, rgba(148,163,184,.38)); color: var(--ae-text, #fff); transform: translateY(-1px); }

.gc-category-strip {
    margin-top: 24px;
    padding: 8px;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    border: 1px solid var(--ae-line, rgba(148,163,184,.2));
    border-radius: 15px;
    background: color-mix(in srgb, var(--ae-surface, #17171d) 90%, transparent);
}
.gc-category-strip a {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    color: var(--ae-text-soft, #cbd5e1);
    font-size: 11px;
    font-weight: 780;
    text-decoration: none;
    white-space: nowrap;
}
.gc-category-strip a b {
    min-width: 24px;
    height: 21px;
    padding: 0 6px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--ae-line, rgba(148,163,184,.2));
    border-radius: 7px;
    color: var(--ae-muted, #94a3b8);
    font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.gc-category-strip a:hover { background: var(--ae-surface-2, rgba(255,255,255,.05)); color: var(--ae-text, #fff); }
.gc-category-strip a.is-active {
    background: linear-gradient(135deg, color-mix(in srgb, var(--ae-accent, #8b5cf6) 32%, transparent), color-mix(in srgb, var(--ae-accent-2, #22d3ee) 16%, transparent));
    color: var(--ae-text, #fff);
}

.gc-results-count {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ae-muted, #94a3b8);
    font-size: 11px;
}
.gc-results-count strong { color: var(--ae-text, #fff); font-size: 12px; }

.gc-related-empty {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.gc-related-empty a {
    margin: 0 !important;
    padding: 9px 12px !important;
    border-radius: 999px !important;
    font-size: 11px !important;
}

/* Aurora Category */
.ae-category-page .ae-category-hero {
    overflow: hidden;
    background:
        radial-gradient(circle at 82% 15%, rgba(34,211,238,.10), transparent 25rem),
        radial-gradient(circle at 12% 0%, rgba(139,92,246,.14), transparent 29rem),
        linear-gradient(180deg, rgba(255,255,255,.018), transparent);
}
.ae-category-page .ae-category-hero h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.ae-category-page .ae-category-hero__count {
    min-width: 0;
    border-left: 0;
    padding: 22px;
    align-items: flex-end;
    border: 1px solid var(--ae-line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--ae-surface) 92%, transparent);
    box-shadow: var(--ae-shadow-soft);
}
.ae-category-page .ae-category-hero__count strong { color: var(--ae-accent-2); }
.ae-category-page .ae-feed-section--category { padding-top: 52px; }
.ae-category-page .ae-article-row { border-radius: 18px; transition: background .18s ease, transform .18s ease; }
.ae-category-page .ae-article-row:hover { background: color-mix(in srgb, var(--ae-surface) 74%, transparent); transform: translateY(-1px); }
.ae-category-page .ae-article-row__body h2 { overflow-wrap: anywhere; text-wrap: pretty; }
.ae-category-page .ae-article-row__body > p { overflow-wrap: anywhere; }
.ae-category-page .ae-article-row__footer span { white-space: nowrap; }
.ae-category-page .ae-rail-card { overflow: hidden; }
.ae-category-page .ae-category-list a span,
.ae-category-page .ae-flow-mini-list strong { min-width: 0; overflow-wrap: anywhere; }
.ae-category-page .ae-empty-state { min-height: 340px; align-content: center; }
.ae-category-page .ae-pagination { margin-top: 38px; }

/* Aurora Gallery */
.ae-gallery-page .ae-gallery-hero {
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 18%, rgba(34,211,238,.12), transparent 26rem),
        radial-gradient(circle at 15% -10%, rgba(139,92,246,.16), transparent 32rem),
        linear-gradient(180deg, rgba(255,255,255,.018), transparent);
}
.ae-gallery-page .ae-gallery-hero h1 { text-wrap: balance; }
.ae-gallery-page .ae-gallery-hero__stats {
    min-width: min(100%, 310px);
    border-color: var(--ae-line-strong);
    background: color-mix(in srgb, var(--ae-surface) 92%, transparent);
}
.ae-gallery-page .ae-gallery-hero__stats strong { color: var(--ae-accent-2); }
.ae-gallery-page .ae-gallery-grid { grid-auto-flow: dense; }
.ae-gallery-page .ae-gallery-tile {
    position: relative;
    isolation: isolate;
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.ae-gallery-page .ae-gallery-tile:hover {
    z-index: 2;
    transform: translateY(-3px);
    border-color: var(--ae-line-strong);
    box-shadow: var(--ae-shadow);
}
.ae-gallery-page .ae-gallery-tile:focus-within { outline: 2px solid var(--ae-accent-2); outline-offset: 3px; }
.ae-gallery-page .ae-gallery-tile img { background: var(--ae-surface-2); }
.ae-gallery-page .ae-gallery-tile.is-broken img { display: none; }
.ae-gallery-page .ae-gallery-tile.is-broken > a {
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(139,92,246,.12), rgba(34,211,238,.08)),
        var(--ae-surface-2);
}
.ae-gallery-page .ae-gallery-tile.is-broken > a::before {
    content: "Изображение недоступно";
    padding: 12px 16px;
    border: 1px dashed var(--ae-line-strong);
    border-radius: 12px;
    color: var(--ae-muted);
    font: 750 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.ae-gallery-page .ae-gallery-tile.is-broken .ae-gallery-tile__shade,
.ae-gallery-page .ae-gallery-tile.is-broken .ae-gallery-tile__copy,
.ae-gallery-page .ae-gallery-tile.is-broken > a > i { display: none; }
.ae-gallery-page .ae-gallery-tile__copy strong,
.ae-gallery-page .ae-gallery-tile__copy small { overflow-wrap: anywhere; }
.ae-gallery-page .ae-gallery-comments { max-height: calc(100vh - var(--ae-header-h) - 48px); display: flex; flex-direction: column; }
.ae-gallery-page .ae-gallery-comment-list { min-height: 0; overflow: auto; scrollbar-width: thin; }
.ae-gallery-page .ae-gallery-comment header strong { min-width: 0; overflow-wrap: anywhere; }
.ae-gallery-page .ae-gallery-comment > p { max-height: 11.2em; overflow: auto; scrollbar-width: thin; }
.ae-gallery-page .ae-gallery-comment > a strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ae-gallery-page .ae-gallery-comments__empty {
    min-height: 210px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
}
.ae-gallery-page .ae-gallery-comments__empty::before { content: "···"; color: var(--ae-accent-2); font-size: 24px; letter-spacing: .16em; }
.ae-gallery-page .ae-gallery-warning {
    margin-top: 18px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--gc-danger) 38%, var(--ae-line));
    border-radius: 13px;
    background: color-mix(in srgb, var(--gc-danger) 8%, var(--ae-surface));
    color: var(--ae-text-soft);
    font-size: 11px;
    line-height: 1.5;
}
.ae-gallery-page .ae-gallery-warning i { color: var(--gc-danger); font-style: normal; }

/* Legacy-theme clean layout */
.gc-legacy-page {
    --gc-bg: #0e1015;
    --gc-surface: #171a22;
    --gc-surface-2: #1e222c;
    --gc-text: #f6f7fb;
    --gc-soft: #c3c9d5;
    --gc-muted: #8992a5;
    --gc-line: rgba(148,163,184,.16);
    color: var(--gc-text);
}
[data-theme="light"] .gc-legacy-page {
    --gc-bg: #f5f7fb;
    --gc-surface: #ffffff;
    --gc-surface-2: #eef2f8;
    --gc-text: #141824;
    --gc-soft: #4b5567;
    --gc-muted: #778196;
    --gc-line: rgba(30,41,59,.12);
}
.gc-legacy-main { min-height: 60vh; padding: 46px 16px 92px; background: var(--gc-bg); }
.gc-legacy-shell { width: min(1180px, 100%); margin: 0 auto; }
.gc-legacy-hero {
    padding: clamp(28px, 5vw, 64px);
    overflow: hidden;
    border: 1px solid var(--gc-line);
    border-radius: 28px;
    background:
        radial-gradient(circle at 85% 15%, rgba(34,211,238,.13), transparent 25rem),
        radial-gradient(circle at 10% 0%, rgba(139,92,246,.18), transparent 28rem),
        var(--gc-surface);
    box-shadow: 0 24px 70px rgba(0,0,0,.18);
}
.gc-legacy-hero__grid { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 40px; }
.gc-legacy-kicker { color: var(--gc-accent-2); font: 800 11px/1 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.gc-legacy-hero h1 { margin: 14px 0 15px; color: var(--gc-text); font-size: clamp(46px, 8vw, 92px); line-height: .94; letter-spacing: -.065em; overflow-wrap: anywhere; }
.gc-legacy-hero p { max-width: 720px; margin: 0; color: var(--gc-soft); font-size: 16px; line-height: 1.7; }
.gc-legacy-stat { min-width: 190px; padding: 22px; border: 1px solid var(--gc-line); border-radius: 18px; background: color-mix(in srgb, var(--gc-surface-2) 88%, transparent); }
.gc-legacy-stat strong { display: block; color: var(--gc-accent-2); font-size: 40px; line-height: 1; }
.gc-legacy-stat span { display: block; margin-top: 7px; color: var(--gc-muted); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.gc-legacy-layout { margin-top: 28px; display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 28px; align-items: start; }
.gc-legacy-panel { overflow: hidden; border: 1px solid var(--gc-line); border-radius: 22px; background: var(--gc-surface); box-shadow: 0 16px 50px rgba(0,0,0,.12); }
.gc-legacy-panel__head { padding: 20px 22px; display: flex; justify-content: space-between; align-items: end; gap: 20px; border-bottom: 1px solid var(--gc-line); }
.gc-legacy-panel__head h2 { margin: 6px 0 0; color: var(--gc-text); font-size: 24px; }
.gc-legacy-panel__head span { color: var(--gc-muted); font-size: 11px; }
.gc-legacy-post-list { padding: 8px 22px; }
.gc-legacy-post { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 22px; padding: 22px 0; border-bottom: 1px solid var(--gc-line); }
.gc-legacy-post:last-child { border-bottom: 0; }
.gc-legacy-post__media { height: 130px; overflow: hidden; border-radius: 15px; background: var(--gc-surface-2); }
.gc-legacy-post__media img { width: 100%; height: 100%; object-fit: cover; }
.gc-legacy-post__placeholder { height: 100%; display: grid; place-items: center; color: var(--gc-muted); border: 1px dashed var(--gc-line); border-radius: inherit; font: 800 20px/1 ui-monospace, monospace; }
.gc-legacy-post h3 { margin: 8px 0 9px; font-size: 25px; line-height: 1.12; overflow-wrap: anywhere; }
.gc-legacy-post h3 a { color: var(--gc-text); text-decoration: none; }
.gc-legacy-post p { margin: 0; color: var(--gc-soft); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.gc-legacy-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--gc-muted); font-size: 10px; }
.gc-legacy-rail { position: sticky; top: 84px; padding: 10px; }
.gc-legacy-categories { display: grid; gap: 4px; }
.gc-legacy-categories a { padding: 11px 12px; display: flex; justify-content: space-between; gap: 12px; border-radius: 11px; color: var(--gc-soft); font-size: 12px; text-decoration: none; }
.gc-legacy-categories a:hover { background: var(--gc-surface-2); color: var(--gc-text); }
.gc-legacy-categories a.is-active { background: rgba(139,92,246,.14); color: var(--gc-text); }
.gc-legacy-categories b { color: var(--gc-muted); }
.gc-legacy-gallery-grid { padding: 12px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); grid-auto-rows: 205px; gap: 10px; }
.gc-legacy-gallery-item { margin: 0; overflow: hidden; border: 1px solid var(--gc-line); border-radius: 16px; background: var(--gc-surface-2); }
.gc-legacy-gallery-item:first-child { grid-column: span 2; }
.gc-legacy-gallery-item a { position: relative; width: 100%; height: 100%; display: block; }
.gc-legacy-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gc-legacy-gallery-item:hover img { transform: scale(1.04); }
.gc-legacy-gallery-item figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 13px; color: #fff; background: linear-gradient(transparent,rgba(0,0,0,.8)); font-size: 11px; overflow-wrap: anywhere; }
.gc-legacy-comment-list { padding: 10px; display: grid; gap: 8px; }
.gc-legacy-comment { padding: 14px; border: 1px solid var(--gc-line); border-radius: 14px; background: var(--gc-surface-2); }
.gc-legacy-comment header { display: flex; justify-content: space-between; gap: 12px; color: var(--gc-muted); font-size: 10px; }
.gc-legacy-comment header strong { color: var(--gc-text); font-size: 12px; overflow-wrap: anywhere; }
.gc-legacy-comment p { margin: 9px 0 12px; color: var(--gc-soft); font-size: 12px; line-height: 1.58; overflow-wrap: anywhere; }
.gc-legacy-comment a { color: var(--gc-accent-2); font-size: 11px; text-decoration: none; }
.gc-legacy-pagination { padding: 20px; display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; border-top: 1px solid var(--gc-line); }
.gc-legacy-pagination a,
.gc-legacy-pagination span { min-width: 35px; height: 35px; padding: 0 10px; display: inline-grid; place-items: center; border: 1px solid var(--gc-line); border-radius: 10px; color: var(--gc-soft); background: var(--gc-surface); font-size: 11px; text-decoration: none; }
.gc-legacy-pagination .is-current { border-color: transparent; color: #fff; background: linear-gradient(135deg,#7c3aed,#0891b2); }
.gc-legacy-empty { min-height: 260px; padding: 34px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--gc-muted); }
.gc-legacy-empty h2 { margin: 9px 0; color: var(--gc-text); }

@media (max-width: 980px) {
    .ae-gallery-page .ae-gallery-comments { max-height: none; }
    .ae-gallery-page .ae-gallery-comment-list { overflow: visible; }
    .gc-legacy-layout { grid-template-columns: 1fr; }
    .gc-legacy-rail { position: static; order: -1; }
    .gc-legacy-categories { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
    .gc-category-strip { margin-inline: -2px; }
    .ae-category-page .ae-category-hero__count { padding: 18px; }
    .ae-category-page .ae-article-row { padding-inline: 10px; }
    .ae-gallery-page .ae-gallery-section { padding-top: 38px; }
    .ae-gallery-page .ae-gallery-comments__head { align-items: center; }
    .gc-legacy-main { padding: 24px 12px 72px; }
    .gc-legacy-hero { border-radius: 21px; }
    .gc-legacy-hero__grid { grid-template-columns: 1fr; }
    .gc-legacy-stat { width: 100%; min-width: 0; }
    .gc-legacy-post { grid-template-columns: 1fr; }
    .gc-legacy-post__media { height: 210px; }
    .gc-legacy-gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: 190px; }
    .gc-legacy-gallery-item:first-child { grid-column: span 2; }
}
@media (max-width: 520px) {
    .gc-hero-meta span,
    .gc-hero-meta a { white-space: normal; }
    .ae-category-page .ae-category-hero h1 { font-size: clamp(44px, 15vw, 68px); }
    .ae-category-page .ae-article-row__media { height: 205px; }
    .ae-gallery-page .ae-gallery-tile__copy { right: 16px; }
    .ae-gallery-page .ae-gallery-tile > a > i { display: none; }
    .gc-legacy-categories { grid-template-columns: 1fr; }
    .gc-legacy-gallery-grid { grid-template-columns: 1fr; grid-auto-rows: 230px; }
    .gc-legacy-gallery-item:first-child { grid-column: auto; }
    .gc-legacy-panel__head { align-items: flex-start; flex-direction: column; }
}
#gallery-collection,
#gallery-comments,
#legacy-gallery,
#legacy-comments { scroll-margin-top: 92px; }

@media (prefers-reduced-motion: reduce) {
    .ae-category-page .ae-article-row,
    .ae-gallery-page .ae-gallery-tile,
    .ae-gallery-page .ae-gallery-tile img,
    .gc-hero-meta a { transition: none !important; }
}
