/* Подключение локальных шрифтов из корня */
@font-face {
    font-family: 'Cascadia Code';
    src: url("./CascadiaCode.woff2") format("woff2");
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Cascadia Code';
    src: url("./CascadiaCodeItalic.woff2") format("woff2");
    font-style: italic;
    font-display: swap;
}

/* Базовые настройки страницы */
:root {
    font-family: 'Cascadia Code', 'Courier New', Courier, monospace;
    line-height: 1.5;
    font-weight: 400;

    color-scheme: light dark;
    color: rgba(255, 255, 255, 0.87);
    background-color: #161616;
    transition: background-color 2s ease;

    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    display: flex;
    justify-content: flex-start;
    min-width: 320px;
    min-height: 100vh;
}

/* Сброс внешних отступов у абзацев */
p {
    margin: 0;
}

/* Главный контейнер разметки */
#app {
    max-width: min(880px, 100vw);
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem 2rem 2rem;
    gap: 1.5em;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#app>* {
    min-width: 0;
}

/* Секции */
section {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    /* Расстояние между строками */
}

/* Оформление заголовков с добавлением # и ## */
section>h1 {
    font-size: 2em;
    line-height: 1.1;
    margin: 0 0 0.5em 0;
}

section>h1::before {
    content: "# ";
    opacity: 0.5;
}

section>h2 {
    font-size: 1.5em;
    line-height: 1.1;
    margin: 0.5em 0 0.8em 0;
}

section>h2::before {
    content: "## ";
    opacity: 0.5;
}

/* Вспомогательные текстовые стили */
.text-half-visible {
    opacity: 0.35;
}

.text-small {
    font-size: 0.8em;
}

strong {
    font-weight: bold;
}

/* Стили встроенных плашек и строк информации (About Me) */
.info-line {
    font-size: 0.95em;
    color: rgb(255 255 255 / 0.85);
    line-height: 1.8;
    margin-top: 0.4rem;
}

.info-label {
    color: rgb(255 255 255 / 0.5);
    margin-right: 0.2em;
}

.inline-badge {
    display: inline-flex;
    align-items: center;
    background-color: #212121;
    border: 1px solid #2d2d2d;
    padding: 0.1em 0.45em;
    border-radius: 6px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

/* Сетки и карточки проектов */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 680px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.project-card {
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-sizing: border-box;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-3px);
}

/* Стили свечения для карточек */
.card-yellow {
    background: linear-gradient(135deg, rgba(235, 203, 139, 0.04) 0%, rgba(22, 22, 22, 1) 100%);
    border: 2px solid rgba(235, 203, 139, 0.15);
}

.card-yellow:hover {
    border-color: rgba(235, 203, 139, 0.35);
}

.card-blue {
    background: linear-gradient(135deg, rgba(136, 192, 208, 0.04) 0%, rgba(22, 22, 22, 1) 100%);
    border: 2px solid rgba(136, 192, 208, 0.15);
}

.card-blue:hover {
    border-color: rgba(136, 192, 208, 0.35);
}

.card-purple {
    background: linear-gradient(135deg, rgba(180, 142, 173, 0.04) 0%, rgba(22, 22, 22, 1) 100%);
    border: 2px solid rgba(180, 142, 173, 0.15);
}

.card-purple:hover {
    border-color: rgba(180, 142, 173, 0.35);
}

.project-card h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: bold;
}

.project-card p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
}

/* Ссылки */
a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
    transition: border-color 0.2s, opacity 0.2s;
}

a:hover {
    border-bottom-color: rgba(255, 255, 255, 0.9);
}

/* Плашки-хайлайты */
.highlight {
    align-self: flex-start;
    font-size: 0.85em;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 0.2rem;
}

.highlight-yellow {
    background-color: rgba(235, 203, 139, 0.15);
    color: #ebcb8b;
}

.highlight-blue {
    background-color: rgba(136, 192, 208, 0.15);
    color: #88c0d0;
}

.highlight-purple {
    background-color: rgba(180, 142, 173, 0.15);
    color: #b48ead;
}

/* Подвал карточки с тегами */
.card-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.85em;
}

.tech-icon {
    opacity: 0.5;
    font-weight: bold;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    padding: 0.15em 0.5em;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Цвета тегов */
.tag-html {
    border-color: rgba(235, 203, 139, 0.3);
    color: #ebcb8b;
}

.tag-telegram {
    border-color: rgba(94, 129, 172, 0.4);
    color: #81a1c1;
}

.tag-mtproto {
    border-color: rgba(208, 135, 112, 0.4);
    color: #d08770;
}

.tag-current {
    border-color: rgba(163, 190, 140, 0.4);
    color: #a3be8c;
}

/* Тонкая разделительная линия */
hr {
    height: 1px;
    margin: 1.5em 0;
    border: none;
    background: linear-gradient(to right,
            transparent 0%,
            rgb(255 255 255 / 0.18) 20%,
            rgb(255 255 255 / 0.18) 80%,
            transparent 100%);
}

/* === ИНТЕРАКТИВНЫЙ ЧИСТЫЙ РЕДАКТОР ВВОДА === */
.editor-card {
    display: flex;
    background-color: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 1rem;
}

.editor-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#letter-input {
    background: transparent;
    border: none;
    color: white;
    padding: 1.2rem;
    min-height: 80px;
    font-family: inherit;
    font-size: 0.95em;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

#letter-input::placeholder {
    color: rgba(255, 255, 255, 0.18);
}

/* Боковая панель с кнопкой отправки */
.editor-sidebar {
    width: 54px;
    border-left: 1px solid #242424;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1d1d1d;
}

.send-letter-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    transition: color 0.15s, background-color 0.15s;
}

.send-letter-btn:hover {
    color: #ebcb8b;
    background-color: #242424;
}

.send-letter-btn:disabled {
    color: rgba(255, 255, 255, 0.15) !important;
    background-color: transparent !important;
    cursor: not-allowed;
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.35rem;
}

/* === ОФОРМЛЕНИЕ ПИСЕМ === */
#letters-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1rem;
}

.letter-item {
    background-color: #1a1a1a;
    border: 1px solid #242424;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    box-sizing: border-box;
}

.letter-text {
    font-size: 0.95em;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
}

/* Ответ администратора */
.letter-reply {
    border-left: 3px solid #5e81ac;
    padding-left: 1rem;
    margin-top: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.reply-text {
    font-size: 0.95em;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
}

.reply-meta {
    font-size: 0.8em;
    color: #ebcb8b;
    opacity: 0.5;
}

/* Нижняя панель */
.letter-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    gap: 1rem;
}

/* Кнопки-реакции */
.reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.reaction-btn {
    background-color: #212121;
    border: 1px solid #2d2d2d;
    border-radius: 20px;
    padding: 0.3rem 0.65rem;
    /* Увеличенные отступы */
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.5);
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s, color 0.15s;
}

.reaction-btn:hover {
    background-color: #292929;
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.reaction-btn:active {
    transform: translateY(1px);
}

.reaction-btn.active {
    border-color: #ebcb8b;
    color: #ebcb8b;
    background-color: rgba(235, 203, 139, 0.05);
}

.reaction-img {
    width: 19px;
    /* Увеличенный размер */
    height: 19px;
    object-fit: contain;
    display: inline-block;
}

.reaction-count {
    font-weight: bold;
}

.letter-date {
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

/* СТИЛИ ПАГИНАЦИИ */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    user-select: none;
}

.pagination-btn {
    background-color: #212121;
    border: 1px solid #2d2d2d;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #292929;
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

.pagination-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: bold;
}

/* === СТИЛИ ДЛЯ ПОДВАЛА САЙТА (FOOTER) === */
footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.7rem;
    margin-top: 3.5rem;
    padding-bottom: 2.5rem;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.4);
}

footer p {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.4rem;
}

/* Кнопка-капсула Telegram в подвале */
.footer-btn {
    background-color: #212121;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    padding: 0.35rem 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-bottom: none !important;
    /* Убираем дефолтное пунктирное подчеркивание */
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.footer-btn:hover {
    background-color: #292929;
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Иконка сердечка из твоих реакций */
.footer-heart {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    display: inline-block;
    margin-left: 0.15rem;
}

/* Динамические просмотры */
.views-counter {
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.22);
}

/* Адаптивность */
@media (max-width: 500px) {
    #app {
        padding: 2rem 1rem 1rem 1rem;
        gap: 1.2em;
    }

    .project-card {
        padding: 1.1rem;
        gap: 0.6rem;
    }

    section>h1 {
        font-size: 1.8em;
    }

    section>h2 {
        font-size: 1.35em;
    }

    .tag {
        font-size: 0.82em;
    }

    .letter-item {
        padding: 1rem;
        gap: 0.6rem;
    }

    .reaction-btn {
        padding: 0.15rem 0.4rem;
        font-size: 0.78em;
    }
}