/* MaxLenta — светлая тема, акценты #ffd700 и чёрный */
:root {
    --ml-gold: #ffd700;
    --ml-gold-dark: #e6c200;
    --ml-black: #1a1a1a;
    --ml-white: #fff;
    --ml-bg: #fafafa;
    --ml-card-bg: #fff;
    --ml-border: #e0e0e0;
    --ml-text: #1a1a1a;
    --ml-muted: #666;
}

* { box-sizing: border-box; }

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

.ml-header {
    background: var(--ml-black);
    color: var(--ml-white);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ml-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ml-logos {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.ml-logo {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.ml-site-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ml-gold);
}

.ml-nav a {
    color: var(--ml-white);
    text-decoration: none;
    margin-left: 1rem;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
}

.ml-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--ml-gold);
}

.ml-breadcrumbs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--ml-muted);
    background: var(--ml-bg);
    border-bottom: 1px solid var(--ml-border);
}
.ml-breadcrumbs a {
    color: var(--ml-gold-dark);
    text-decoration: none;
}
.ml-breadcrumbs a:hover { text-decoration: underline; }
.ml-breadcrumbs-sep { margin: 0 0.35rem; }

.ml-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    min-height: 60vh;
}

/* Каталог */
.ml-catalog-toolbar {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.ml-search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ml-search-input {
    flex: 1;
    max-width: 320px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--ml-border);
    border-radius: 6px;
    font-size: 1rem;
}

.ml-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--ml-border);
    background: var(--ml-card-bg);
    color: var(--ml-text);
}

.ml-btn-primary {
    background: var(--ml-gold);
    color: var(--ml-black);
    border-color: var(--ml-gold-dark);
}

.ml-btn-primary:hover {
    background: var(--ml-gold-dark);
}

.ml-filters, .ml-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ml-filter-label {
    color: var(--ml-muted);
    font-size: 0.9rem;
    margin-right: 0.25rem;
}

.ml-chip {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    text-decoration: none;
    color: var(--ml-text);
    background: var(--ml-bg);
    border: 1px solid var(--ml-border);
    font-size: 0.9rem;
}

.ml-chip:hover, .ml-chip.active {
    background: var(--ml-gold);
    color: var(--ml-black);
    border-color: var(--ml-gold-dark);
}

.ml-catalog-count {
    color: var(--ml-muted);
    margin-bottom: 1rem;
}

.ml-resource-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.ml-resource-card {
    margin: 0;
}

.ml-resource-link {
    display: block;
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.ml-resource-link:hover {
    border-color: var(--ml-gold);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.ml-resource-image-wrap {
    aspect-ratio: 1;
    background: var(--ml-bg);
    overflow: hidden;
}

.ml-resource-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ml-resource-image-placeholder {
    background: #e8e8e8;
}

.ml-resource-info {
    padding: 1rem;
}

.ml-resource-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ml-black);
}

.ml-resource-subscribers, .ml-resource-sections {
    display: block;
    font-size: 0.85rem;
    color: var(--ml-muted);
}

.ml-resource-max-btn {
    display: inline-block;
    margin: 0 1rem 1rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: var(--ml-gold);
    color: var(--ml-black);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}
.ml-resource-max-btn:hover { background: var(--ml-gold-dark); }

/* Пагинация — стильный блок */
.ml-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ml-pagination a {
    text-decoration: none;
    color: inherit;
}
.ml-pagination-prev, .ml-pagination-next {
    padding: 0.55rem 1rem;
    background: var(--ml-bg);
    border: 1px solid var(--ml-border);
    border-radius: 8px;
    color: var(--ml-text);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ml-pagination-prev:hover, .ml-pagination-next:hover {
    background: var(--ml-gold);
    border-color: var(--ml-gold);
    color: var(--ml-black);
}
.ml-pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.ml-pagination-num, .ml-pagination-current, .ml-pagination-ellipsis {
    min-width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}
.ml-pagination-num {
    background: var(--ml-bg);
    border: 1px solid var(--ml-border);
    border-radius: 8px;
    color: var(--ml-text);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ml-pagination-num:hover {
    background: var(--ml-gold);
    border-color: var(--ml-gold);
    color: var(--ml-black);
}
.ml-pagination-current {
    background: var(--ml-gold);
    color: var(--ml-black);
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid var(--ml-gold-dark);
}
.ml-pagination-ellipsis {
    color: var(--ml-muted);
    font-weight: 600;
    padding: 0 0.25rem;
}

/* Одиночная карточка */
.ml-single {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border);
    border-radius: 8px;
    overflow: hidden;
    padding: 1.5rem;
}

.ml-single-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.ml-single-image-wrap {
    flex-shrink: 0;
}

.ml-single-image {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--ml-border);
}

.ml-resource-image-placeholder.ml-single-image {
    width: 160px;
    height: 160px;
    background: #e8e8e8;
    border-radius: 8px;
}

.ml-single-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: var(--ml-black);
}

.ml-single-meta p {
    margin: 0.25rem 0;
    color: var(--ml-muted);
    font-size: 0.95rem;
}

.ml-btn-max {
    margin-top: 1rem;
}

.ml-single-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ml-border);
    line-height: 1.7;
}

.ml-single-similar {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ml-border);
}
.ml-single-similar-title {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    color: var(--ml-black);
}
.ml-resource-grid-similar {
    margin-bottom: 0;
}

/* 404 */
.ml-404 {
    text-align: center;
    padding: 3rem 1rem;
}

.ml-404 h1 {
    margin-bottom: 1rem;
}

/* Подвал сайта */
.ml-footer {
    margin-top: 3rem;
    padding: 2rem 1rem;
    background: var(--ml-black);
    color: var(--ml-white);
    text-align: center;
    font-size: 0.9rem;
    border-top: 3px solid var(--ml-gold);
}

.ml-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.ml-footer a {
    color: var(--ml-gold);
    text-decoration: none;
}
.ml-footer a:hover { text-decoration: underline; }
.ml-footer-desc { margin: 0 0 0.5rem; }
.ml-footer-ecosystem { margin: 0 0 0.5rem; font-size: 0.95rem; opacity: 0.95; }
.ml-footer-links { margin: 0 0 0.5rem; }
.ml-footer-copy { margin: 0.75rem 0 0; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.15); font-size: 0.9rem; opacity: 0.9; }
.ml-footer-copy a:hover { text-decoration: underline; }

/* Страница «Добавить ресурс» */
.ml-add-page {
    padding: 1rem 0;
    max-width: 640px;
}
.ml-add-title { margin: 0 0 0.5rem; font-size: 1.5rem; }
.ml-add-intro { color: var(--ml-muted); margin-bottom: 1.5rem; }
.ml-add-notice { background: #e8f5e9; color: #2e7d32; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; }
.ml-add-error { background: #ffebee; color: #c62828; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; }
.ml-add-form .form-row { margin-bottom: 1rem; }
.ml-add-form label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.ml-add-form .required { color: #c62828; }
.ml-add-form input[type="text"],
.ml-add-form input[type="url"],
.ml-add-form input[type="email"],
.ml-add-form input[type="number"],
.ml-add-form textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--ml-border);
    border-radius: 4px;
    font-size: 1rem;
}
.ml-add-form textarea { min-height: 100px; resize: vertical; }
.ml-add-form .form-row-checkbox { margin-bottom: 1rem; }
.ml-add-form .ml-add-privacy-label { font-weight: normal; display: flex; align-items: flex-start; gap: 0.5rem; }
.ml-add-form .ml-add-privacy-label a { color: var(--ml-gold-dark); }
.ml-add-terms { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.ml-add-term { font-weight: normal; display: inline-flex; align-items: center; gap: 0.35rem; }
.ml-add-filters { margin-top: 0.25rem; }
.ml-add-chip { cursor: pointer; font-weight: normal; }
.ml-add-chip .ml-add-chip-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.form-row .ml-filter-label { display: block; margin-bottom: 0.25rem; }
.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.ml-add-btn {
    padding: 0.5rem 1.25rem;
    background: var(--ml-gold);
    color: var(--ml-black);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}
.ml-add-btn:hover { background: var(--ml-gold-dark); }
.ml-add-cancel { color: var(--ml-muted); text-decoration: none; }
.ml-add-cancel:hover { color: var(--ml-black); }

/* Страница политики конфиденциальности */
.ml-privacy-page { padding: 1rem 0; max-width: 720px; }
.ml-privacy-title { margin: 0 0 1rem; font-size: 1.5rem; }
.ml-privacy-content { line-height: 1.7; }
.ml-privacy-html h1, .ml-privacy-html h2, .ml-privacy-html h3 { margin: 1rem 0 0.5rem; }
.ml-privacy-html p { margin: 0.5rem 0; }
.ml-privacy-html ul, .ml-privacy-html ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.ml-privacy-html a { color: var(--ml-gold-dark); }
.ml-privacy-empty { color: var(--ml-muted); }

/* ——— Бургер-меню (кнопка видна только на узких экранах) ——— */
.ml-nav-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--ml-white);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}
.ml-nav-toggle:hover { background: rgba(255,255,255,0.1); }
.ml-nav-toggle-bar {
    display: block;
    position: absolute;
    left: 50%;
    margin-left: -11px;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.ml-nav-toggle-bar:nth-child(1) { top: 13px; }
.ml-nav-toggle-bar:nth-child(2) { top: 21px; }
.ml-nav-toggle-bar:nth-child(3) { top: 29px; }
body.ml-nav-open .ml-nav-toggle-bar:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}
body.ml-nav-open .ml-nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
body.ml-nav-open .ml-nav-toggle-bar:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}
.ml-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.2s;
}
body.ml-nav-open .ml-nav-overlay { opacity: 1; }
.ml-nav-open .ml-nav-overlay { display: block; }

@media (max-width: 768px) {
    .ml-nav-toggle { display: flex; }
    .ml-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(280px, 85vw);
        margin: 0;
        padding: 3.5rem 1rem 1.5rem;
        background: var(--ml-black);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        box-shadow: -4px 0 20px rgba(0,0,0,0.3);
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 101;
    }
    .ml-nav a {
        margin: 0;
        padding: 0.85rem 0.75rem;
        font-size: 1.05rem;
        border-radius: 6px;
    }
    body.ml-nav-open .ml-nav { transform: translateX(0); }
}

@media (min-width: 769px) {
    .ml-nav-overlay { display: none !important; }
}

/* ——— Адаптив: общее ——— */
@media (max-width: 768px) {
    .ml-header { padding: 0.5rem 0.75rem; }
    .ml-header-inner { gap: 0.5rem; }
    .ml-logo { height: 36px; max-width: 100px; }
    .ml-main { padding: 1rem 0.75rem; min-height: 50vh; }
    .ml-breadcrumbs { padding: 0.5rem 0.75rem; font-size: 0.85rem; word-break: break-word; }
}

@media (max-width: 480px) {
    .ml-header { padding: 0.4rem 0.6rem; }
    .ml-main { padding: 0.85rem 0.6rem; }
}

/* ——— Каталог: тулбар, поиск, фильтры ——— */
@media (max-width: 768px) {
    .ml-catalog-toolbar { padding: 0.85rem; margin-bottom: 1rem; }
    .ml-search-form {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 0.85rem;
    }
    .ml-search-input { max-width: none; }
    .ml-search-form .ml-btn { align-self: flex-start; min-height: 44px; }
    .ml-filters, .ml-sort { gap: 0.5rem; margin-top: 0.5rem; }
    .ml-filter-label { width: 100%; margin-bottom: 0.25rem; margin-right: 0; }
}

@media (max-width: 480px) {
    .ml-catalog-toolbar { padding: 0.65rem; }
    .ml-chip {
        min-height: 44px;
        padding: 0.5rem 0.85rem;
        display: inline-flex;
        align-items: center;
    }
}

/* ——— Сетка карточек и карточка ——— */
@media (max-width: 768px) {
    .ml-resource-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }
    .ml-resource-info { padding: 0.75rem; }
    .ml-resource-title { font-size: 0.95rem; }
    .ml-resource-max-btn { margin: 0 0.75rem 0.75rem; min-height: 44px; display: inline-flex; align-items: center; }
}

@media (max-width: 640px) {
    .ml-resource-grid { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 480px) {
    .ml-resource-grid { gap: 0.75rem; }
    .ml-resource-max-btn { margin: 0 0.6rem 0.6rem; padding: 0.5rem 0.85rem; }
}

/* ——— Пагинация ——— */
@media (max-width: 768px) {
    .ml-pagination { padding: 1rem; margin-top: 2rem; gap: 0.5rem; }
    .ml-pagination-prev, .ml-pagination-next { min-height: 44px; padding: 0.6rem 0.85rem; }
    .ml-pagination-num, .ml-pagination-current, .ml-pagination-ellipsis { min-width: 2.25rem; height: 2.25rem; }
}

@media (max-width: 480px) {
    .ml-pagination { flex-direction: column; }
    .ml-pagination-pages { flex-wrap: wrap; justify-content: center; }
}

/* ——— Одиночная страница ресурса ——— */
@media (max-width: 640px) {
    .ml-single-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .ml-single-image, .ml-resource-image-placeholder.ml-single-image {
        width: 120px;
        height: 120px;
    }
    .ml-single { padding: 1rem; }
    .ml-single-title { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .ml-single-image, .ml-resource-image-placeholder.ml-single-image { width: 100px; height: 100px; }
}

/* ——— Страница «Добавить» и формы ——— */
@media (max-width: 768px) {
    .ml-add-page { padding: 0.85rem 0; }
    .ml-add-title { font-size: 1.3rem; }
    .ml-add-filters .ml-chip { min-height: 44px; padding: 0.5rem 0.85rem; }
    .form-actions { flex-wrap: wrap; }
    .ml-add-btn, .ml-add-cancel { min-height: 44px; }
}

@media (max-width: 480px) {
    .ml-add-form input[type="file"] { font-size: 16px; }
}

/* ——— Политика, 404, подвал ——— */
@media (max-width: 768px) {
    .ml-privacy-page, .ml-404 { padding: 1rem 0.5rem; }
    .ml-footer { padding: 1.5rem 0.75rem; font-size: 0.85rem; margin-top: 2rem; }
}

@media (max-width: 480px) {
    .ml-footer { padding: 1.25rem 0.6rem; }
}
