/* ===== CSS Variables ===== */
:root {
    --color-gold: #C9A962;
    --color-gold-dark: #A88C4A;
    --color-bg: #0D0D0D;
    --color-bg-light: #1A1A1A;
    --color-bg-card: #1F1F1F;
    --color-text: #E8E8E8;
    --color-text-muted: #8A8A8A;
    --font-heading: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Open Sans', -apple-system, sans-serif;
    --radius: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --transition: 0.3s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 16px;
}

a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-gold-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dark));
    color: #0D0D0D;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 169, 98, 0.4);
    color: #0D0D0D;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
}

.btn-secondary:hover {
    background: var(--color-gold);
    color: #0D0D0D;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background: rgba(13, 13, 13, 0.9);
    backdrop-filter: blur(10px);
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-gold);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    color: var(--color-text);
    font-size: 0.95rem;
    transition: color var(--transition);
}

.nav-links a:hover {
    color: var(--color-gold);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-gold);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: url('../images/hero-bg.jpg') center/cover no-repeat;
    padding: 100px 20px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(13, 13, 13, 0.7) 0%, rgba(13, 13, 13, 0.5) 50%, rgba(13, 13, 13, 0.9) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 16px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.hero-text {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

/* Sections */
.section {
    padding: 80px 0;
}

.section:nth-child(even) {
    background: var(--color-bg-light);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--color-gold);
    text-align: center;
    margin-bottom: 16px;
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 48px;
}

/* About */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.about-text p {
    margin-bottom: 16px;
    line-height: 1.8;
}

.about-image img {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Treby Form */
.treby-form {
    max-width: 500px;
    margin: 0 auto;
    background: var(--color-bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-gold);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid #333;
    border-radius: var(--radius);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-gold);
}

.form-note {
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-align: center;
}

.form-result {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.form-result.success {
    background: rgba(76, 175, 80, 0.2);
    color: #81C784;
}

.form-result.error {
    background: rgba(244, 67, 54, 0.2);
    color: #E57373;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.gallery-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--transition);
}

.gallery-grid img:hover {
    transform: scale(1.05);
}

/* History Cards */
.history-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.history-card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.history-card-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    cursor: pointer;
    transition: background var(--transition);
}

.history-card-header:hover {
    background: rgba(201, 169, 98, 0.1);
}

.history-portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-gold);
    cursor: pointer;
    transition: transform var(--transition);
}

.history-portrait:hover {
    transform: scale(1.1);
}

.history-card-info {
    flex: 1;
}

.history-card-info h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--color-gold);
    margin-bottom: 4px;
}

.history-period {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.history-brief {
    font-size: 0.95rem;
}

.history-toggle {
    font-size: 1.2rem;
    color: var(--color-gold);
    transition: transform var(--transition);
}

.history-card.open .history-toggle {
    transform: rotate(180deg);
}

.history-card-content {
    display: none;
    padding: 0 24px 24px;
    border-top: 1px solid #333;
}

.history-card.open .history-card-content {
    display: block;
}

.history-card-content p {
    margin-top: 16px;
    line-height: 1.7;
}

/* Telegram Feed */
.telegram-feed {
    max-width: 1000px;
    margin: 0 auto;
}

.telegram-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.telegram-post-wrapper {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(201, 169, 98, 0.2);
    transition: transform var(--transition), border-color var(--transition);
}

.telegram-post-wrapper:hover {
    transform: translateY(-4px);
    border-color: var(--color-gold);
}

.telegram-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.telegram-subscribe {
    text-align: center;
    margin-top: 24px;
}

/* Donate */
.donate-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 48px;
}

.donate-card {
    background: var(--color-bg-card);
    padding: 32px;
    border-radius: var(--radius);
    text-align: center;
}

.donate-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-gold);
    margin-bottom: 16px;
}

.bank-org {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.donate-yoomoney iframe {
    margin: 0 auto;
    display: block;
}

.donate-note {
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.requisites {
    text-align: left;
    margin-bottom: 24px;
}

.requisite-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
    margin-bottom: 12px;
    cursor: pointer;
    transition: background var(--transition);
}

.requisite-item:hover {
    background: rgba(201, 169, 98, 0.1);
}

.requisite-label {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    min-width: 120px;
}

.requisite-value {
    flex: 1;
    font-family: monospace;
    font-size: 1rem;
}

.copy-icon {
    opacity: 0.5;
    transition: opacity var(--transition);
}

.requisite-item:hover .copy-icon {
    opacity: 1;
}

.requisite-item.copied {
    background: rgba(76, 175, 80, 0.2);
}

.qr-code {
    max-width: 150px;
    margin: 0 auto;
    border-radius: var(--radius);
}

/* Contacts */
.contacts-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.contact-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}

.contact-icon {
    font-size: 1.3rem;
}

.contact-map {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.contact-map iframe {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.contact-social {
    display: flex;
    gap: 16px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: all var(--transition);
}

.social-link.tg {
    background: #2AABEE;
    color: white;
}

.social-link.vk {
    background: #4C75A3;
    color: white;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: white;
}

/* Footer */
.footer {
    background: var(--color-bg);
    padding: 32px;
    text-align: center;
    border-top: 1px solid #222;
}

.footer p {
    color: var(--color-text-muted);
}

.footer-note {
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: color var(--transition);
}

.lightbox-close:hover {
    color: var(--color-gold);
}

#lightboxImg {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius);
}

/* Responsive */
@media (max-width: 1024px) {

    .about-content,
    .donate-content {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .telegram-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--color-bg);
        padding: 20px;
        gap: 16px;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
    }

    .telegram-posts-grid {
        grid-template-columns: 1fr;
    }

    .history-card-header {
        flex-wrap: wrap;
    }

    .history-portrait {
        width: 60px;
        height: 60px;
    }

    .contact-info {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 80px 16px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .treby-form {
        padding: 24px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid img {
        height: 250px;
    }

    .donate-card {
        padding: 20px;
    }

    .requisite-item {
        flex-wrap: wrap;
    }

    .requisite-label {
        width: 100%;
        min-width: unset;
    }
}

/* Alert Modal */
.alert-modal {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.alert-modal.hidden {
    display: none;
}

.alert-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1a1a 100%);
    padding: 48px;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
    position: relative;
    border: 2px solid #c9a962;
    box-shadow: 0 0 60px rgba(201, 169, 98, 0.3);
    animation: slideUp 0.4s ease;
}

.alert-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.alert-modal-close:hover {
    color: #fff;
}

.alert-modal-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: pulse 1.5s infinite;
}

.alert-modal-content h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    color: #e74c3c;
    margin-bottom: 16px;
}

.alert-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #c9a962;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.alert-modal-text {
    color: #aaa;
    font-size: 1.1rem;
    margin-bottom: 32px;
    line-height: 1.6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Nav Alert Link */
.nav-links .nav-alert {
    color: #e74c3c;
    font-weight: 700;
    border: 1px solid #e74c3c;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.3s;
}

.nav-links .nav-alert:hover {
    background: #e74c3c;
    color: #fff;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--color-bg-card);
    border: 1px solid var(--color-gold);
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
    font-weight: 600;
}

.page-btn:hover {
    background: rgba(201, 169, 98, 0.2);
    color: var(--color-gold);
}

.page-btn.active {
    background: var(--color-gold);
    color: #0D0D0D;
    border-color: var(--color-gold);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #444;
    color: #666;
}


/* Comparison Slider Styles */
.comparison-slider {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cd-image-container {
    position: relative;
    display: block;
    overflow: hidden;
    margin: 0;
}

.cd-image-container img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.cd-image-label {
    position: absolute;
    bottom: 0;
    right: 0;
    color: #ffffff;
    padding: 1em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cd-image-container:hover .cd-image-label {
    opacity: 1;
    transform: translateY(0);
}

.cd-image-label[data-type="original"] {
    right: auto;
    left: 0;
}

.cd-resize-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    /* Initial position */
    height: 100%;
    overflow: hidden;
    transform: translateZ(0);
    backface-visibility: hidden;
    border-right: 2px solid #ffffff;
}

.cd-resize-img img {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
}

.cd-image-label[data-type="modified"] {
    right: auto;
    left: 0;
}

.cd-handle {
    position: absolute;
    height: 44px;
    width: 44px;
    left: 50%;
    /* Initial position */
    top: 50%;
    margin-left: -22px;
    margin-top: -22px;
    border-radius: 50%;
    background: #dc717d url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12H3M12 3l-9 9 9 9M12 3l9 9-9 9"/></svg>') no-repeat center center;
    cursor: e-resize;
    box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s, transform 0.3s;
}

.cd-image-container:hover .cd-handle {
    opacity: 1;
    transform: scale(1);
}

/* ===== Article Pages ===== */
.article-page {
    padding-top: 120px;
    padding-bottom: 80px;
    min-height: 100vh;
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-gold);
    font-size: 1rem;
    margin-bottom: 32px;
    transition: color var(--transition);
}

.article-back:hover {
    color: var(--color-gold-dark);
}

.article-header {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(201, 169, 98, 0.3);
}

.article-header h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 16px;
}

.article-subtitle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.article-author {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.article-content {
    max-width: 800px;
    margin: 0 auto;
}

.article-content p {
    margin-bottom: 20px;
    line-height: 1.8;
    text-align: justify;
}

.article-gallery {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid rgba(201, 169, 98, 0.3);
}

.article-gallery h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--color-gold);
    text-align: center;
    margin-bottom: 32px;
}

.article-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.article-image {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.article-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: transform var(--transition);
}

.article-image img:hover {
    transform: scale(1.05);
}

.article-image figcaption {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* Read More Button in History Cards */
.btn-read-more {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    font-size: 0.9rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.btn-read-more:hover {
    background: var(--color-gold);
    color: #0D0D0D;
}

/* Article Figure Styles */
.history-figure {
    margin: 24px 0;
    text-align: center;
}

.history-figure img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 0 auto;
}

.history-figure figcaption {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.article-authors {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(201, 169, 98, 0.2);
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-style: italic;
}

@media (max-width: 768px) {
    .article-header h1 {
        font-size: 2rem;
    }

    .article-images-grid {
        grid-template-columns: 1fr;
    }
}
/* Treby Form Button Centered */
.treby-form .btn {
    display: block;
    width: 100%;
    margin: 0 auto;
}
