/* Кабинет автора: профиль-hero, статистика, панель прав, список работ. */

section {
    padding: 80px 0;
}

.section-head {
    margin-bottom: 36px;
}

.section-head h2 {
    font-size: clamp(26px, 3.2vw, 34px);
    line-height: 1.15;
    margin-bottom: 14px;
}

.section-head p {
    font-size: 16px;
}

/* Заголовок с кнопкой справа: «Все ваши работы» + «Добавить произведение».
   Кнопка выровнена по низу заголовка, а не по центру блока, — иначе она
   плавает по вертикали от длины подзаголовка. */
.section-head-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.section-head-actions p {
    margin-bottom: 0;
}

/* ---------- Профиль ---------- */
.profile-hero {
    position: relative;
    background: var(--brand-gradient), var(--brand-dark);
    color: var(--text-on-brand);
    overflow: hidden;
    padding: 56px 0 80px;
}

.profile-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items: center;
}

/* Аватар — инициалы на цветном круге, файлов не грузим (бриф, ответ №9).
   Цвет приходит инлайном из User.avatar_color и детерминирован по id. */
.avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    /* Цвет приходит инлайном из User.avatar_color; фон здесь — запасной,
       на случай если аватар отрисуется до появления пользователя. */
    background: rgba(255, 255, 255, 0.14);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 26px;
    margin-bottom: 22px;
}

.profile-name {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(28px, 3.6vw, 40px);
    line-height: 1.08;
    margin-bottom: 12px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    font-size: 14px;
    color: var(--text-muted-on-brand);
    margin-bottom: 20px;
}

.profile-meta span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.profile-meta svg {
    width: 15px;
    height: 15px;
}

/* Место в рейтинге — ссылка на каталог авторов: увидев свою строку, автор
   первым делом хочет посмотреть, кто выше. */
.profile-place {
    padding: 4px 12px;
    border: 1px solid var(--rule-on-brand, rgba(255, 255, 255, .3));
    border-radius: 999px;
    color: inherit;
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
}

.profile-place:hover {
    border-color: currentColor;
    color: var(--text-on-brand);
}

.profile-bio {
    font-size: 16.5px;
    color: var(--text-muted-on-brand);
    max-width: 460px;
    /* Био — свободный текст автора: абзацы в нём значимы, как и в стихах. */
    white-space: pre-wrap;
}

/* Подсказка вместо пустого био — видно, что это приглашение, а не текст. */
.profile-bio-empty {
    font-style: italic;
    opacity: 0.8;
}

.profile-link {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.profile-link:hover {
    color: var(--brand);
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

/* Кнопка «Выйти» — submit внутри формы (выход только POST-ом), поэтому
   рядом с обычной ссылкой-кнопкой оказывается лишний блочный контейнер. */
.profile-actions form {
    display: contents;
}

/* Публичная страница автора: правой колонки-«рукописи» на ней нет. */
.profile-grid-single {
    grid-template-columns: 1fr;
}

/* Карточка-«рукопись» в кабинете — компактнее, чем на лендинге. */
.profile-hero .manuscript {
    padding: 28px 30px 24px;
    transform: rotate(1.5deg);
}

.profile-hero .manuscript-tag {
    letter-spacing: 0.08em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.profile-hero .manuscript-text {
    font-size: 19px;
    margin: 14px 0;
}

.manuscript-status {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(var(--rule-rgb), 0.07);
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

/* ---------- Статистика ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--surface-raised);
    border-radius: var(--radius);
    padding: 24px 22px;
}

.stat-card b {
    font-family: var(--serif);
    font-size: 32px;
    display: block;
    margin-bottom: 6px;
}

.stat-card span {
    font-size: 13.5px;
    color: var(--text-muted);
}

/* ---------- Права и согласие ---------- */
.section-tight {
    padding-top: 0;
}

.rights-panel {
    background: var(--brand-dark);
    color: var(--text-on-brand);
    border-radius: 24px;
    padding: 48px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 48px;
    align-items: center;
}

.rights-panel .eyebrow {
    color: var(--brand);
    margin-bottom: 12px;
    display: block;
}

.rights-panel h2 {
    font-family: var(--serif);
    font-size: clamp(22px, 2.8vw, 28px);
    line-height: 1.22;
    margin-bottom: 14px;
}

.rights-panel p {
    color: var(--text-muted-on-brand);
    font-size: 15px;
}

.consent-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    padding: 22px 24px;
}

.consent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.consent-row:last-of-type {
    border-bottom: none;
}

.consent-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
}

.consent-actions {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.consent-actions a {
    font-size: 13px;
    text-decoration: underline;
    color: var(--text-muted-on-brand);
    text-underline-offset: 3px;
}

.consent-actions a:hover {
    color: var(--text-on-brand);
}

/* ---------- Список произведений ---------- */
.works-list {
    margin-top: 20px;
}

.work-row {
    display: grid;
    /* Последняя колонка — фиксированной ширины, а не auto. В ней стоит либо
       счётчик прочтений, либо кнопка «Отозвать» у работы в очереди, и они
       разной ширины: на auto-колонке плашки статусов переставали бы
       выстраиваться в вертикаль от строки к строке. Фиксированный трек
       существует независимо от того, что в нём лежит и лежит ли вообще. */
    grid-template-columns: auto 1fr auto 64px;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-top: 1px solid rgba(var(--rule-rgb), 0.1);
}

.work-icon {
    width: 22px;
    height: 22px;
    color: var(--accent);
    flex-shrink: 0;
}

.work-main h3 {
    font-family: var(--serif);
    font-size: 17.5px;
    margin-bottom: 4px;
}

/* Название — ссылка на правку, но выглядеть должно названием: подчёркивание
   на каждой строке списка превратило бы его в оглавление ссылок. */
.work-main h3 a {
    color: inherit;
}

.work-main h3 a:hover {
    color: var(--brand-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.work-main .work-meta {
    font-size: 12.5px;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* Причина отклонения. Цвет акцента, потому что это единственная строка
   в списке, которая требует от автора действия. */
.work-comment {
    margin-top: 8px;
    padding-left: 11px;
    border-left: 2px solid var(--accent);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 62ch;
}

.work-withdraw {
    text-align: right;
}

/* Отзыв работы с модерации. Стоит на месте счётчика прочтений: у работы
   в очереди прочтений всё равно нет, а второй колонки строка не выдержит. */
.work-withdraw button {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.work-withdraw button:hover {
    color: var(--accent);
}

.status-badge {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.status-published {
    background: var(--brand-dark);
    color: var(--text-on-brand);
}

.status-review {
    background: transparent;
    border: 1.3px solid rgba(var(--rule-rgb), 0.3);
    color: var(--text-muted);
}

.status-draft {
    background: transparent;
    border: 1.3px dashed rgba(var(--rule-rgb), 0.28);
    color: rgba(61, 74, 73, 0.65);
}

/* Отклонено модератором — статус появляется на этапе 2.5. */
.status-rejected {
    background: transparent;
    border: 1.3px solid var(--accent);
    color: var(--accent);
}

.work-views {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: right;
}

/* ---------- Пусто ----------
   Список работ пуст до этапа 2. Пунктирная рамка вместо карточки: так видно,
   что это место под будущий контент, а не сломанный блок. */
/* ---------- Публикации на странице автора ----------
   Кликабельна вся строка, а не одно название: здесь у неё ровно одно
   назначение — открыть текст, и мельчить цель попадания незачем. */
.pub-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    background: var(--surface-raised);
    border-radius: var(--radius);
    margin-bottom: 12px;
    transition: transform .18s ease, box-shadow .18s ease;
}

.pub-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px -22px rgba(22, 26, 51, 0.5);
}

.pub-icon {
    width: 22px;
    height: 22px;
    color: var(--accent);
    flex-shrink: 0;
}

.pub-title {
    display: block;
    font-family: var(--serif);
    font-size: 17.5px;
    margin-bottom: 4px;
}

.pub-row:hover .pub-title {
    color: var(--brand-dark);
}

.pub-meta {
    display: block;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--text-muted);
}

.pub-counters {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11.5px;
    white-space: nowrap;
}

.pub-counters>span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pub-counters b {
    color: var(--text);
    font-weight: 500;
}

/* Стрелка проявляется на наведении: в покое двадцать одинаковых стрелок
   в столбик — шум, а не подсказка. */
.pub-arrow {
    color: var(--brand-dark);
    opacity: 0;
    transition: opacity .18s ease;
}

.pub-row:hover .pub-arrow {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 52px 24px;
    border: 1.5px dashed rgba(var(--rule-rgb), 0.2);
    border-radius: var(--radius);
}

.empty-state h3 {
    font-family: var(--serif);
    font-size: 21px;
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 15px;
    max-width: 460px;
    margin: 0 auto 20px;
}

@media (max-width:920px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .rights-panel {
        grid-template-columns: 1fr;
        padding: 36px 28px;
    }

    /* Счётчик прочтений уходит первым: он справочный. Кнопка отзыва остаётся —
       это единственное действие, доступное автору для работы в очереди.
       Колонку под неё сетка держит и пустой, поэтому плашки статусов
       по-прежнему выстраиваются в вертикаль. */
    .work-views {
        display: none;
    }
}

@media (max-width:560px) {
    section {
        padding: 56px 0;
    }

    .work-row {
        grid-template-columns: auto 1fr;
        row-gap: 10px;
    }

    /* Плашка и кнопка отзыва переезжают под название, в одну строку с ним
       по левому краю: в две колонки они на телефоне не помещаются. */
    .status-badge,
    .work-withdraw {
        grid-column: 2;
        justify-self: start;
    }

    /* Выравнивание по правому краю нужно колонке, которой здесь уже нет. */
    .work-withdraw {
        text-align: left;
    }

    .section-head-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .pub-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 12px;
        padding: 16px;
    }

    .pub-counters {
        gap: 9px;
        font-size: 10.5px;
    }

    .pub-counter-label {
        display: none;
    }

    .pub-arrow {
        display: none;
    }
}
