/* ===========================
   Основные стили и типографика
   =========================== */

:root {
    --color-text: #000000;
    --color-text-secondary: #666;
    --color-border: #e0e0e0;
    --color-bg: #ffffff;
    --color-accent: #2563eb;
    --color-accent-hover: #1d4ed8;
    --spacing-unit: 1rem;
    --max-width: 1200px;
    --max-width-content: 800px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: 0;
    font-size: 16px;
}

/* ===========================
   Header с логотипом
   =========================== */

.site-header {
    background-color: #ffffff;
    padding: 20px 40px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo-link {
    display: inline-block;
    line-height: 0;
}

.site-header .site-logo {
    height: 70px;
    width: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.site-header .site-logo:hover {
    opacity: 0.8;
}

/* ===========================
   Общие элементы
   =========================== */

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--color-text);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

p {
    margin: 0 0 1.5rem 0;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul{
    margin: 0;
    margin-left: 15px;
    padding: 0;
    list-style: none;
}

ol {
    margin: 0;
    margin-left: 15px;
    padding: 0;
}

/* ===========================
   Навигация (список категорий)
   =========================== */

/* Навигация в шапке */
.site-header nav {
    margin: 0;
    padding: 0;
}

.site-header nav h3 {
    display: none;
}

.site-header nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-header nav li {
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0;
}

.site-header nav li a {
    color: var(--color-text-secondary);
}

.site-header nav li a:hover {
    color: var(--color-text);
}

.site-header nav li[aria-current="page"] strong {
    color: var(--color-text);
    font-weight: 600;
}

/* Навигация на других страницах (если есть) */
nav:not(.site-header nav):not([aria-label="Breadcrumb"]) {
    max-width: var(--max-width);
    margin: 0 auto 3rem;
    padding: 0 var(--spacing-unit);
}

nav:not(.site-header nav):not([aria-label="Breadcrumb"]) h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

nav:not(.site-header nav):not([aria-label="Breadcrumb"]) ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

nav:not(.site-header nav):not([aria-label="Breadcrumb"]) li {
    font-size: 0.9375rem;
    font-weight: 500;
}

nav:not(.site-header nav):not([aria-label="Breadcrumb"]) li a {
    color: var(--color-text-secondary);
}

nav:not(.site-header nav):not([aria-label="Breadcrumb"]) li a:hover {
    color: var(--color-text);
}

/* ===========================
   Breadcrumb
   =========================== */

nav[aria-label="Breadcrumb"] {
    margin: 2rem auto 1rem;
    padding: 0 var(--spacing-unit);
    max-width: var(--max-width-content);
}

nav[aria-label="Breadcrumb"] ol {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    list-style: none;
    margin-left: 0;
    flex-wrap: wrap;
}

nav[aria-label="Breadcrumb"] li:first-child {
    white-space: nowrap;
}

nav[aria-label="Breadcrumb"] li:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    color: var(--color-border);
}

nav[aria-label="Breadcrumb"] a {
    color: var(--color-text-secondary);
}

nav[aria-label="Breadcrumb"] a:hover {
    color: var(--color-text);
}

/* ===========================
   Список постов (list.html)
   =========================== */

[itemtype*="Blog"] > h1 {
    max-width: var(--max-width);
    margin: 3rem auto 2rem;
    padding: 0 40px;
}

.blog-posts {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit) 4rem;
}

.blog-posts > ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 3rem;
    margin-bottom: 4rem;
}

.blog-posts article {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-posts article img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-bottom: 1.25rem;
    border: 1px solid var(--color-border);
}

.blog-posts article h2 {
    font-size: 1.375rem;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

.blog-posts article h2:hover {
    color: var(--color-accent);
}

.blog-posts article p {
    color: var(--color-text);
    font-size: 0.9375rem;
    margin-bottom: 0;
    flex-grow: 1;
    line-height: 1.6;
    text-align: justify;
}

/* ===========================
   Пагинация
   =========================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
    font-size: 0.9375rem;
}

.pagination a {
    font-weight: 500;
}

.pagination span {
    color: var(--color-text-secondary);
}

/* ===========================
   Страница поста (post.html)
   =========================== */

article {
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: 2rem var(--spacing-unit) 4rem;
}

article > h1 {
    margin-bottom: 1rem;
}

.post-meta {
    margin-bottom: 1rem;
}

.post-date {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin: 0;
    font-style: italic;
}

.post-author {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin: 0.5rem 0 0 0;
}

.author-label {
    color: var(--color-text-secondary);
    font-style: italic;
}

.author-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    cursor: pointer;
}

.author-link:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* ===========================
   Кнопки редактирования поста
   =========================== */

/* Верхняя кнопка под h1 */
.edit-button-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* Нижняя кнопка справа */
.edit-button-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}

.edit-post-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 20px;
    background-color: #0056b3;
    color: #ffffff;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    border: none;
}

.edit-post-link:hover {
    background-color: #004085;
    color: #ffffff;
}

.edit-post-link svg {
    flex-shrink: 0;
}

.hero-image {
    width: 100%;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    margin-bottom: 3rem;
    border: 1px solid var(--color-border);
}

/* ===========================
   Контент поста
   =========================== */

.post-content {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.content-heading {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.content-heading:first-child {
    border-top: none;
    padding-top: 0;
}

.content-paragraph {
    margin-bottom: 1.5rem;
}

.content-paragraph p {
    margin: 0 0 1.5rem 0;
    text-align: justify;
}

.content-paragraph strong {
    font-weight: 600;
    color: var(--color-text);
}

.content-paragraph em {
    font-style: italic;
}

.content-image {
    margin: 3rem 0;
}

.content-image img {
    width: 100%;
    border: 1px solid var(--color-border);
}

.content-list {
    margin: 2rem 0;
    padding-left: 0;
}

.content-list li {
    padding-left: 2rem;
    margin-bottom: 1rem;
    position: relative;
}

/* .content-list li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--color-accent);
    font-weight: bold;
} */

.content-list li p {
    margin: 0;
}

.content-numbered-list {
    margin: 2rem 0;
    padding-left: 2rem;
    counter-reset: item;
}

.content-numbered-list li {
    counter-increment: item;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 0.5rem;
}

/* .content-numbered-list li::marker {
    color: var(--color-accent);
    font-weight: 600;
} */

.content-numbered-list li p {
    margin: 0;
}

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

@media (max-width: 768px) {
    .site-header {
        padding: 15px 30px;
    }

    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .site-header .site-logo {
        height: 60px;
    }

    .site-header nav ul {
        gap: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    [itemtype*="Blog"] > h1 {
        padding: 0 30px;
    }

    h2 {
        font-size: 1.5rem;
    }

    .blog-posts > ul {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    nav:not(.site-header nav):not([aria-label="Breadcrumb"]) ul {
        flex-direction: column;
        gap: 0.75rem;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .post-content {
        font-size: 1rem;
    }

    article {
        padding: 1.5rem var(--spacing-unit) 3rem;
    }

    /* Кнопки редактирования на мобильных */
    .edit-button-top .edit-post-link,
    .edit-button-bottom .edit-post-link {
        justify-content: center;
        width: 100%;
    }

    .edit-button-bottom {
        justify-content: stretch;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 10px 20px;
    }

    .site-header .container {
        gap: 0.75rem;
    }

    .site-header .site-logo {
        height: 50px;
    }

    .site-header nav ul {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .site-header nav li {
        font-size: 0.875rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    [itemtype*="Blog"] > h1 {
        padding: 0 20px;
        margin-top: 2rem;
    }

    .blog-posts {
        padding-bottom: 3rem;
    }
}

/* ===========================
   Страницы аутентификации
   =========================== */

.auth-container {
    max-width: 480px;
    margin: 4rem auto;
    padding: 0 var(--spacing-unit);
}

.auth-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 3rem 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.auth-card h1 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-description {
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.9375rem;
}

.auth-form {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-accent);
    color: #ffffff;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-family: inherit;
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-footer {
    margin-top: 2rem;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.auth-footer p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
}

.auth-footer a {
    color: var(--color-accent);
    font-weight: 500;
}

.auth-footer a:hover {
    color: var(--color-accent-hover);
}

/* Ссылка "Забыли пароль?" */

.forgot-password {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
}

.forgot-password a {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot-password a:hover {
    color: var(--color-accent);
}

/* Иконка успеха */

.success-icon {
    text-align: center;
    margin-bottom: 1.5rem;
}

.success-icon svg {
    margin: 0 auto;
}

/* Сообщения об ошибках и уведомления */

.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.field-errors {
    margin-top: 0.5rem;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.help-text {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin: 0.5rem 0 0 0;
    line-height: 1.4;
}

.form-errors {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
}

/* Адаптивность для форм */

@media (max-width: 480px) {
    .auth-container {
        margin: 2rem auto;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .auth-card h1 {
        font-size: 1.5rem;
    }
}

/* ===========================
   Утилиты
   =========================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===========================
   Footer
   =========================== */

.site-footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem var(--spacing-unit) 3rem;
}

.site-footer .container {
    padding: 0;
}

.site-footer nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-footer nav li {
    margin: 0;
}

.site-footer nav a {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}

.site-footer nav a:hover {
    color: var(--color-text);
}

@media (max-width: 768px) {
    .site-footer {
        padding: 1.5rem var(--spacing-unit) 2rem;
    }
    
    .site-footer nav ul {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .site-footer {
        padding: 1rem var(--spacing-unit) 1.5rem;
    }
    
    .site-footer nav ul {
        gap: 0.75rem;
        flex-direction: column;
    }
    
    .site-footer nav a {
        font-size: 0.875rem;
    }
}

/* ===========================
   Страница авторов
   =========================== */

   .authors-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.authors-page h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #000000;
}

.page-description {
    margin-bottom: 40px;
    font-size: 1.1rem;
    color: #000000;
    line-height: 1.6;
}

.authors-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

.author-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    scroll-margin-top: 120px; /* Отступ для sticky header */
}

.author-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.author-card:target {
    animation: highlight 2s ease;
    border: 2px solid #0056b3;
}

@keyframes highlight {
    0% {
        background-color: #e0e7ff;
    }
    100% {
        background-color: #fff;
    }
}

.author-photo,
.author-photo-placeholder {
    width: 120px;
    height: 120px;
    min-width: 120px;
    border-radius: 50%;
    overflow: hidden;
}

.author-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-photo-placeholder {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-initials {
    font-size: 48px;
    font-weight: bold;
    color: white;
}

.author-info {
    flex: 1;
}

.author-name {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #000000;
}

.author-bio {
    font-size: 0.95rem;
    color: #000000;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: justify;
}

.author-bio p {
    margin-bottom: 10px;
    color: #000000;
}

.author-posts-count {
    margin-top: 15px;
}

.posts-badge {
    display: inline-block;
    background: #0056b3;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.no-authors {
    text-align: center;
    font-size: 1.2rem;
    color: #000000;
    padding: 60px 20px;
}

@media (max-width: 768px) {
    .author-card {
        flex-direction: column;
        align-items: center;
    }
    
    .author-info {
        text-align: center;
    }
    
    .author-photo,
    .author-photo-placeholder {
        margin-bottom: 20px;
    }
    
    .authors-page h1 {
        font-size: 2rem;
        color: #000000;
    }
}