/* card.css — карточка кабинета и публичной части, шапка профиля и блоки кабинета.
   Основа — утверждённые макеты razrabotka/mockup-card_5.css и razrabotka/mockup-card_9.css. */

/* --- карточка --- */
.c-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.c-card:hover, .c-card:focus-within { border-color: var(--accent); }

.c-card__image {
    position: relative;
    display: block;
    background: var(--surface-2);
}

.c-card__image img {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

/* нейтральный блок с кружком загрузки до появления картинки */
.c-card__image::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--line-strong);
    border-radius: 50%;
    animation: c-card-spin .8s linear infinite;
}

@keyframes c-card-spin { to { transform: rotate(360deg); } }

/* статус модерации — правый верхний угол картинки */
.c-card__mod, .image-card__mod {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--warning);
    color: var(--warning);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1;
    text-transform: lowercase;
    box-shadow: var(--shadow-sm);
}

.c-card__mod--rejected { background: var(--danger); color: var(--text-inverse); }

.c-card__body { padding: 11px 13px 13px; }

.c-card__title {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c-card__title:hover { color: var(--link-hover); }

/* строка сведений: показатели слева, видимость справа */
.c-card__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 9px;
    margin-top: 9px;
}

.c-card__stats {
    display: flex;
    gap: 10px;
    color: var(--muted);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.c-card__vis {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin-left: auto;
    border-radius: 50%;
    color: var(--text-inverse);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1;
    text-transform: lowercase;
}

.c-card__vis--public { background: var(--success); }
.c-card__vis--registered { background: var(--brand); }
.c-card__vis--unlisted { background: var(--warning); }
.c-card__vis--private { background: var(--danger); }

/* строка действий: иконки слева, «По шаблону» по центру свободного места, дата справа */
.c-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 11px;
}

.c-icon-btn {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    visibility: hidden;
}

.c-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.c-icon-btn[disabled] { opacity: .45; cursor: default; }

.c-btn {
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: var(--text-xs);
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}

.c-btn:hover { border-color: var(--accent); color: var(--accent); }
.c-btn--accent { font-weight: 700; }
.c-btn--center { margin-left: auto; margin-right: auto; visibility: hidden; }
.c-btn[disabled] { opacity: .45; cursor: default; }

/* действия показываются при наведении на карточку (место под них не пропадает) */
.c-card:hover .c-icon-btn,
.c-card:focus-within .c-icon-btn,
.c-card:hover .c-btn--center,
.c-card:focus-within .c-btn--center { visibility: visible; }

@media (hover: none) {
    .c-icon-btn, .c-btn--center { visibility: visible; }
}

.c-card__date { margin-left: auto; color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }

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

/* --- шапка публичного профиля --- */
.p-head {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.p-head__avatar {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--accent);
    font-size: 24px;
    font-weight: 700;
    object-fit: cover;
}

.p-head__name { margin: 0; font-size: clamp(21px, 3.4vw, 28px); }
.p-head__about { margin: 7px 0 0; }
.p-head__meta { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 11px 0 0; color: var(--muted); font-size: var(--text-base); }
.p-head__follow { margin: 15px 0 0; }
.p-head__link { color: var(--link); font-size: 15px; font-weight: 700; text-decoration: none; }
.p-head__link:hover { text-decoration: underline; }

/* --- верх области контента кабинета --- */
.cab-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.cab-toolbar h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); }
.cab-toolbar__actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 11px; }

.cab-menu { position: relative; }

.cab-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 11px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--text-inverse);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    line-height: 1;
}

.cab-icon-button svg { display: block; }

.cab-menu__list {
    position: absolute;
    right: 0;
    z-index: 5;
    min-width: 220px;
    margin: 9px 0 0;
    padding: 9px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.cab-menu__list[hidden] { display: none; }
.cab-menu__list a { display: block; padding: 9px 11px; border-radius: var(--radius-sm); font-size: 15px; text-decoration: none; }
.cab-menu__list a:hover { background: var(--brand-soft); color: var(--link-hover); }
.cab-menu__sep { height: 1px; margin: 7px 4px; background: var(--line); }

/* --- блок статистики --- */
.cab-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-bottom: 20px; padding: 15px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.cab-stats__list { display: flex; flex-wrap: wrap; gap: 29px; margin: 0; padding: 0; list-style: none; }
.cab-stats__list li { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.cab-stats__value { font-size: 18px; font-weight: 700; }
.cab-stats__label { color: var(--muted); font-size: var(--text-sm); }
.cab-stats__more { margin-left: auto; color: var(--link); font-weight: 700; text-decoration: none; }
.cab-stats__more:hover { text-decoration: underline; }

/* Одноразовое уведомление кабинета («Картинка создана…»): плавающая плашка поверх контента,
   плавно скрывается через 3 секунды или по крестику (js/main.js). */
.cab-toast { position: fixed; top: 18px; left: 50%; z-index: 3000; display: flex; align-items: center; gap: 18px; max-width: min(560px, calc(100% - 32px)); padding: 15px 18px; background: var(--success-soft); border: 1px solid var(--success-soft); border-radius: var(--radius-md); box-shadow: var(--shadow-md); color: var(--success); opacity: 1; transform: translateX(-50%); transition: opacity .4s ease, transform .4s ease; }
.cab-toast.is-hidden { opacity: 0; transform: translate(-50%, -12px); pointer-events: none; }
.cab-toast__text { flex: 1 1 auto; }
.cab-toast__close { flex: 0 0 auto; padding: 0 2px; border: 0; background: none; color: inherit; font: inherit; font-size: var(--text-lg); line-height: 1; cursor: pointer; }
.cab-toast__close:hover { opacity: .7; }

/* --- сортировка --- */
.cab-sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; margin-bottom: 20px; }
.cab-sortbar .feed-tabs { margin-bottom: 0; border-bottom: 0; }
/* Охват ленты («Все | Подписки») — сегментированный переключатель, визуально отличный
   от подчёркнутых вкладок сортировки. */
.cab-sortbar .feed-tabs--scope { gap: 0; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.feed-tabs--scope .feed-tab { padding: 8px 18px; border: 0; border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; }
.feed-tabs--scope .feed-tab + .feed-tab { margin-left: 2px; }
.feed-tabs--scope .feed-tab:hover { color: var(--accent); }
.feed-tabs--scope .feed-tab.is-active { background: var(--accent); color: var(--text-inverse); font-weight: 700; }
.feed-tabs--scope .feed-tab--locked { color: var(--muted); opacity: .55; cursor: pointer; }
.feed-tabs--scope .feed-tab--locked:hover { color: var(--muted); }
.cab-period { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.cab-period[hidden] { display: none; }
.cab-period select { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

/* --- кружок-оповещение о непрочитанных (поддержка) --- */
.cab-dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.cab-icon-button { position: relative; }
.cab-dot--badge { position: absolute; top: 3px; right: 3px; box-shadow: var(--shadow-sm); }
.cab-menu__list a.cab-menu__notify { display: flex; align-items: center; justify-content: space-between; gap: 11px; }

/* --- меню кабинета и рубрик --- */
.cab-count { float: right; color: var(--muted); font-size: var(--text-sm); }
.category-menu li.is-active > a .cab-count { color: var(--brand-soft); }
.cab-sep { height: 1px; margin: 13px 4px; background: var(--brand-soft); }
.cab-svc { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--brand-soft); }
.cab-svc__title { margin: 0 0 7px; padding: 0 11px; color: var(--muted); font-size: var(--text-xs); letter-spacing: .07em; text-transform: uppercase; }

/* Заголовок «Рубрики» оформлен так же, как «Статусы». */
.category-navigation__header { margin-bottom: 7px; }
.category-navigation__header h2 { margin: 0; padding: 0 11px; color: var(--muted); font-size: var(--text-xs); letter-spacing: .07em; text-transform: uppercase; font-weight: 400; }

/* Пустой кабинет: подсказка создать первую картинку. */
.cab-empty { padding: 31px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.cab-empty p { margin: 0; }

/* --- плашка «Продолжить проект» --- */
.cab-resume { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-md); }
.cab-resume p { margin: 0 0 11px; }
.cab-resume p:last-child { margin-bottom: 0; }

.hist-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 11px; }
.hist-item { padding: 13px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.hist-item__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; font-size: 15px; }
.hist-actor { font-weight: 600; }
.hist-actor a, .hist-object a { color: var(--link); text-decoration: none; }
.hist-actor a:hover, .hist-object a:hover { text-decoration: underline; }
.hist-arrow { color: var(--muted); }
.hist-action { color: var(--muted); }
.hist-item__time { margin-left: auto; color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.hist-item__body { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; margin-top: 9px; padding-left: 13px; border-left: 3px solid var(--line); }
.hist-item__comment { color: var(--muted); font-size: var(--text-base); }
.hist-chip { padding: 2px 10px; border-radius: var(--radius-pill); font-size: var(--text-xs); background: var(--brand-soft); color: var(--accent); }
.hist-chip--published { background: var(--success-soft); color: var(--success); }
.hist-chip--pending_moderation { background: var(--warning-soft); color: var(--warning); }
.hist-chip--hidden, .hist-chip--deleted { background: var(--danger-soft); color: var(--danger); }
.hist-pager { display: flex; gap: 11px; margin-top: 18px; }

@media (max-width: 640px) {
    .p-head { flex-direction: column; align-items: flex-start; gap: 15px; }
    .p-head__avatar { width: 64px; height: 64px; font-size: var(--text-lg); }
    .cab-menu__list { left: 0; right: auto; }
}

/* Пагинация лент: кнопка «Еще» и номера страниц (docs/public/pagination.md). */
.pager { display: flex; flex-direction: column; align-items: center; gap: 15px; margin: 29px 0 9px; }
.pager__more { min-width: 160px; }
.pager__pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; }
.pager__num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 9px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: inherit;
    font-size: var(--text-base); line-height: 1; text-decoration: none;
}
.pager__num:hover { border-color: var(--accent); }
.pager__num.is-active { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); cursor: default; }
.pager__gap { padding: 0 2px; color: var(--muted); }
@media (max-width: 640px) {
    .pager__num { min-width: 30px; height: 30px; font-size: var(--text-sm); }
}
