@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

:root {
    --bg-base: #f5f5f7;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --accent: #d4af37;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.3);
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

body.dark-theme {
    --bg-base: #000000;
    --text-main: #f5f5f7;
    --text-muted: #86868b;
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    width: 0%;
    z-index: 9999;
    transition: width 0.2s ease-out;
}

.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #4a90e2 0%, transparent 70%);
    bottom: -200px;
    left: -100px;
    animation-delay: -5s;
    opacity: 0.2;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
}

header {
    position: sticky;
    top: 1rem;
    margin: 1rem;
    padding: 1rem 2rem;
    border-radius: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
}

header.zen-hide {
    transform: translateY(-150%);
    opacity: 0;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

nav {
    display: none;
    gap: 2rem;
}

nav a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s;
}

nav a:hover, nav a.active {
    color: var(--text-main);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 40px;
    gap: 2.5rem;
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
}

.bottom-nav.zen-hide {
    transform: translate(-50%, 150%);
    opacity: 0;
}

.bottom-nav a {
    color: var(--text-muted);
    width: 24px;
    height: 24px;
    transition: 0.3s;
}

.bottom-nav a.active {
    color: var(--text-main);
}

.bottom-nav svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.hero-card {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
    color: white;
}

.hero-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    transition: transform 0.7s ease;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
    z-index: -1;
}

.hero-card:hover .hero-img {
    transform: scale(1.05);
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.1;
    margin-top: 0.5rem;
}

.card {
    border-radius: 24px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card-img {
    width: 100%;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card-img img {
    transform: scale(1.05);
}

.meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meta span:last-child {
    color: var(--text-muted);
}

.card h3 {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    line-height: 1.3;
}

.badge-pro {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    z-index: 2;
}

.contact-section {
    text-align: center;
    padding: 4rem 0 6rem;
}

.contact-section h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.contact-section p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.contact-form {
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-form input, .contact-form textarea {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-main);
    font-family: var(--font-sans);
    outline: none;
    transition: 0.3s;
}

.contact-form input:focus, .contact-form textarea:focus {
    border-color: var(--accent);
}

.contact-form button {
    padding: 1rem;
    border-radius: 20px;
    border: none;
    background: var(--text-main);
    color: var(--bg-base);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.contact-form button:hover {
    transform: scale(0.98);
    opacity: 0.9;
}

#main-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.page-transitioning {
    opacity: 0;
    transform: translateY(15px);
}

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s;
}
.search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.search-input {
    width: 80%;
    max-width: 700px;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--accent);
    color: white;
    font-size: clamp(2rem, 5vw, 4rem);
    font-family: var(--font-serif);
    outline: none;
    padding-bottom: 10px;
    text-align: center;
    transition: 0.3s;
}
.search-input::placeholder {
    color: rgba(255,255,255,0.3);
}
.search-close {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
    border-radius: 50%;
}
.search-close:hover {
    background: rgba(255,255,255,0.1);
    transform: rotate(90deg);
    color: var(--accent);
}
.search-tags {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}
.search-tags span {
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s;
}
.search-tags span:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.bookmark-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
}
.bookmark-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: 0.3s;
}
.bookmark-btn:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}
.bookmark-btn.saved svg {
    fill: var(--accent);
    stroke: var(--accent);
}
.card.glass .bookmark-btn {
    background: var(--glass-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}
.card.glass .bookmark-btn:hover {
    background: var(--text-main);
    color: var(--bg-base);
}

.site-footer {
    margin-top: 5rem;
    padding: 4rem 2rem 2rem;
    border-radius: 40px 40px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    position: relative;
    overflow: hidden;
    z-index: 10;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    margin-bottom: 3rem;
}
.footer-brand p {
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.6;
    max-width: 300px;
    font-size: 0.95rem;
}
.footer-links h4 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}
.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.footer-links a {
    color: var(--text-muted);
    transition: 0.3s;
    font-size: 0.95rem;
    display: inline-block;
}
.footer-links a:hover {
    color: var(--accent);
    transform: translateX(5px);
}
.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}
.social-icons {
    display: flex;
    gap: 1rem;
}
.social-icons a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: 0.3s;
}
.social-icons a svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    stroke: none;
}
.social-icons a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-3px);
}

@media (min-width: 768px) {
    nav {
        display: flex;
    }
    .bottom-nav {
        display: none;
    }
    header {
        margin: 1.5rem 2rem;
    }
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-card {
        grid-column: 1 / -1;
        height: 500px;
    }
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr;
    }
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

@media (min-width: 1024px) {
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .hero-card {
        height: 600px;
    }
}
/* =======================================================
   📱 МОБИЛЬНАЯ АДАПТАЦИЯ (Для экранов меньше 768px)
   ======================================================= */
@media (max-width: 767px) {
    /* 1. Глобальные отступы */
    .container {
        padding: 0 1rem;
    }

    /* 2. Шапка (Header) */
    header {
        margin: 0.5rem;
        padding: 0.8rem 1.2rem;
        border-radius: 20px;
        top: 0.5rem;
    }
    .logo {
        font-size: 1.3rem;
    }

    /* 3. Мобильное нижнее меню (Tab Bar в стиле iOS) */
    .bottom-nav {
        width: calc(100% - 2rem);
        max-width: 400px;
        padding: 1rem 1.5rem;
        border-radius: 24px;
        /* Учитываем "челку" и полоску внизу на iPhone */
        bottom: calc(1rem + env(safe-area-inset-bottom));
        justify-content: space-between;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }
    .bottom-nav a {
        width: 26px;
        height: 26px;
    }

    /* 4. Сетка и карточки */
    .hero-card {
        height: 450px;
        padding: 1.5rem;
        border-radius: 20px;
    }
    .hero-title {
        font-size: 2.2rem; /* Уменьшаем огромный заголовок */
    }
    .card-img {
        height: 180px;
    }

    /* 5. Страница статьи (article.php) */
    .art-hero {
        height: 30vh;
        border-radius: 16px;
    }
    .art-content-wrap {
        padding: 1.5rem; /* На десктопе было 2.5rem, для мобилки это слишком много */
        border-radius: 20px;
    }
    .art-content {
        font-size: 1.05rem; /* Чуть мельче текст для комфортного чтения */
    }
    .first-letter::first-letter {
        font-size: 3.5rem; /* Уменьшаем буквицу */
        padding-top: 0.2rem;
    }

    /* Тулбар в статье */
    .toolbar {
        max-width: 100%;
        margin: 1rem 0;
        padding: 0.5rem;
        border-radius: 20px;
    }
    .toolbar button {
        width: 40px;
        height: 40px;
    }

    /* Фикс меню шрифтов (чтобы не уезжало за экран) */
    .font-menu {
        width: 100%;
        left: 0;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
        top: 65px;
    }
    .font-menu button {
        flex-grow: 1; /* Кнопки растягиваются на всю ширину */
        text-align: center;
    }

    /* 6. Поиск */
    .search-input {
        font-size: 2rem;
        width: 90%;
    }
    .search-close {
        top: 15px;
        right: 15px;
    }

    /* 7. Страница "О проекте" (about.php) */
    .manifesto-wrap {
        padding: 1.5rem;
        border-radius: 20px;
    }
    .manifesto-title {
        font-size: 2.2rem;
    }

    /* 8. Футер */
    .site-footer {
        padding: 3rem 1.5rem 6rem; /* Снизу делаем большой отступ (6rem), чтобы нижнее меню не перекрывало копирайт */
        border-radius: 30px 30px 0 0;
        margin-top: 3rem;
    }
}

/* Фикс для очень маленьких экранов (iPhone SE) */
@media (max-width: 375px) {
    .bottom-nav {
        gap: 1.5rem;
    }
    .meta {
        font-size: 0.7rem;
    }
}