/* === ROOT VARIABLES === */
:root {
    --main-green: #57583b;
    --accent: #d0b354;
    --beige: #fdfcf6;
    --off-white: #faf7ef;
    --white: #ffffff;
    --dark: #333333;
    --text: #111111;
    --olive-color: #656445;
}

/* === GLOBAL RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--beige);
    color: var(--text);
    line-height: 1.5;
    height: 100%;
}

iframe {
    border: none;
}

/* === HEADER === */

.header-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--main-green);
}

.site-header {
    background-color: var(--main-green);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    flex-wrap: wrap;
}

.header-logo {
    height: 60px;
    fill: var(--white);
}

.header-menu {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.5rem 1rem;
}

.menu-btn {
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--white);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.menu-btn:hover {
    background-color: var(--accent);
    color: var(--dark);
    border-color: var(--accent);
}

.menu-btn.active {
    background-color: var(--accent);
    color: var(--dark);
    border-color: var(--accent);
}

/* === GENERAL SECTIONS === */
section {
    padding: 0rem 0.5rem;
    margin: auto;
}

/* === CAROUSEL SECTION === */
.presentation-carousel {
    position: relative;
    padding: 2rem 0;
    margin: 2rem auto;
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
}

.carousel-title {
    text-align: center;
    color: var(--main-green);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    height: 600px;
    width: 100%;
    margin: 0 auto;
}

.carousel-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    right: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.carousel-slide iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: white;
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 1rem;
}

.carousel-prev,
.carousel-next {
    background-color: var(--main-green);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    line-height: 0; /* Це виправить вертикальне зміщення символів */
    padding-bottom: 3px; /* Невелике регулювання для кращого вирівнювання */
}

.carousel-prev:hover,
.carousel-next:hover {
    background-color: var(--accent);
    transform: scale(1.1);
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.carousel-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--main-green);
    opacity: 0.5;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.carousel-indicator:hover {
    opacity: 0.8;
    transform: scale(1.2);
}

.carousel-indicator.active {
    opacity: 1;
    background-color: var(--accent);
}

.carousel-play-pause {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(87, 88, 59, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 2;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Усуває блакитне підсвічування на iOS */
    touch-action: manipulation; /* Оптимізує сенсорні події */
    user-select: none; /* Запобігає виділенню тексту */
}

.carousel-play-pause:active {
    opacity: 0.8; /* Візуальний відгук при натисканні */
}

.carousel-play-pause svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none; /* Гарантує, що події відбуваються на кнопці, а не на SVG */
}

.section-title {
    color: white;
    font-size: 3rem;
    text-align: left;
    margin-bottom: 1rem;
    color: var(--main-green);
}

.projects-title {
    color: white;
    font-size: 3rem;
    text-align: center;
    margin-top: 1rem;
    color: var(--main-green);
}

.section-description,
.section-subtitle {
    text-align: left;
}

.desktop-only {
    display: none;
}

/* === MAIN BUTTONS === */
.main-btn,
.doc-switch-btn {
    padding: 0.75rem 1.25rem;
    background-color: transparent;
    border: 2px solid var(--main-green);
    color: var(--main-green);
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1rem;
    text-decoration: none;
}
.doc-btn,
.donate-logo-btn {
    background-color: #ffffffcc;
    border: 2px solid var(--main-green);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    margin: 0.5rem auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    backdrop-filter: blur(2px);
    color: var(--dark);
    font-weight: bold;
    text-decoration: none;
    gap: 1rem;
}

.main-btn.highlight {
    background-color: var(--accent);
    color: var(--dark);
    border-color: var(--accent);
    width: 20%;
}

.main-btn:hover,
.doc-switch-btn:hover,
.doc-switch-btn.active {
    background-color: var(--accent);
    color: var(--dark);
    border-color: var(--accent);
}

.doc-btn:hover,
.donate-logo-btn:hover {
    transform: scale(1.02);
    background-color: #f4f4f4ee;
}

.donate-logo-btn img {
    height: 40px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter: grayscale(0.1) contrast(1.1) brightness(0.95);
    mix-blend-mode: multiply;
}

.google-drive-embed {
    display: block;
    text-align: center;
    transform: translateX(5%);
}

/* === TOGGLE SECTIONS === */
.toggle-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%; /* ⬅️ This ensures full height */
    opacity: 0;
    transform: translateX(-100%);
    transition: transform 0.5s ease, opacity 0.5s ease;
    padding: 2rem;
    overflow-y: hidden; /* Enable scroll if content is tall */
    box-sizing: border-box;
}

.toggle-section.active {
    opacity: 1;
    transform: translateX(0);
    z-index: 1;
    pointer-events: auto;
    max-height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.toggle-wrapper {
    transition: padding 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    padding: 0;
    background-color: rgba(249, 246, 237, 0.85);
    pointer-events: none; /* prevents accidental hover/click */
    position: relative;
    overflow: visible;
    height: auto; /* ✅ Add this */
    max-height: none; /* ✅ Add this to prevent cutoff */
}

.toggle-wrapper.active {
    opacity: 1;
    padding: 2rem 1rem;
    pointer-events: auto;
    min-height: 800px;
}

.doc-links {
    list-style: none;
    padding-left: 0;
}

.doc-links li a {
    display: inline-block;
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--white);
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}

.doc-links li a:hover {
    background-color: var(--accent);
    color: var(--dark);
    border-color: var(--accent);
}

.modal-gallery a {
    display: inline-block;
    margin: 0.5rem;
    color: var(--accent);
    text-decoration: underline;
}

.airtable-placeholder {
    background-color: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: 6px;
    color: white;
    text-align: center;
    margin-top: 2rem;
}

/* === IFRAME GALLERY & LAYOUTS === */
.iframe-gallery,
.doc-button-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    flex: 1;
}

.doc-button-column a.main-btn {
    white-space: nowrap;        /* Keep text in one line */
    width: 100%;                /* Make all buttons same width */
    max-width: 240px;           /* Optional: limit width */
    text-align: center;         /* Center text inside buttons */
    overflow: hidden;           /* Prevent overflow */
    text-overflow: ellipsis;    /* Add "..." if it overflows */
    padding: 0.75rem 1rem;      /* Larger touch area */
    font-size: 0.95rem;
}

.doc-iframe-column {
    flex: 3;
    min-width: 300px;
    margin-right: 1rem; /* or 8px, 16px, etc. */
}

.doc-iframe-column iframe.modal-frame {
    width: 100%;
    height: 650px;
    border: none;
    border-radius: 3px;
    background-color: white;
}

.doc-switcher-columns {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.doc-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.doc-button-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 0 0 300px;
}
.doc-viewer-box,
.split-docs-layout {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 2rem;
}

.doc-preview-layout {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin-top: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}


.iframe-gallery iframe,
.doc-viewer-box iframe,
.doc-preview-area {
    flex: 1;
    max-width: 90%;
    max-height: 90%;
}

.split-docs-layout iframe {
    width: 280px;
    height: 380px;
    border-radius: 8px;
    background-color: white;
}

.modal-frame {
    width: 100%;
    border: none;
    margin: 0 auto;
    transform: translateX(3%);
    min-height: 500px;
}

.modal-frame-projects {
    min-height: 100%;
    max-width: 100%;
    width: 60%; /* Or whatever width works for your layout */
    overflow: hidden;
    border: none;
    margin: 0 auto;
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

.modal-frame-reports {
    min-height: 100vw;
    min-width: 100%;
    overflow: hidden;
}


/* === DONATE SECTION === */
.donate-options {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.donate-card img {
    height: 50px;
    object-fit: contain;
}

/* === MEDIA EMBEDS === */
.media-embed-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-direction: row;
    justify-content: center;
}

.media-item {
    align-item: center;
    overflow: hidden;
}

.media-title {
    text-align: center;
    font-weight: bold;
    margin-bottom: 1rem;
}

.spotify-media-embed {
    width: 550px;
    height: 310px;
    align-items: center;
}

.youtube-media-embed {
    width: 500px;
    height: 310px;
}

/* === INSTAGRAM SECTION === */
.instagram-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background-color: var(--off-white);
    max-width: 1200px;
    margin: 0 auto;
}

.instagram-section iframe {
    flex: 1 1 320px;
    max-width: 320px;
    min-width: 280px;
    height: 400px;
    border-radius: 12px;
    background: white;
}


/* === FUND SECTION === */
.fund-section {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.fund-left {
    flex: 1;
    background: url('assets/SiteBackImg.png') no-repeat center center;
    background-size: cover;
    min-height: 60%;
    position: relative; /* Important for positioning children */
    overflow: hidden;
    height: 800px;
}


.fund-right {
    flex: 1;
    background-color: var(--olive-color);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3rem;
    height: 800px;
}

.fund-right .help-types {
    margin: 2rem 0;
}

.fund-right .help-types ul {
    list-style: disc;
    margin-left: 1.5rem;
    color: white;
    line-height: 1.6;
    font-size: 1rem;
}

.fund-right .section-title,
.fund-right .section-subtitle,
.fund-right .section-description {
    color: white;
    margin-left: 0;
    max-width: 600px;
}

.fund-right .media-embed-row {
    justify-content: flex-start;
}



/* === FOOTER === */
.site-footer {
    background-color: var(--olive-color);
    color: white;
    padding: 2rem 1rem;
}

.footer-columns {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-col {
    flex: 1;
    min-width: 220px;
}

.footer-left a,
.footer-center a {
    color: #fff;
    text-decoration: none;
    display: block;
    margin-top: 0.25rem;
}

.footer-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.footer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.footer-logo-wrapper {
    text-align: right;
    margin-bottom: 0.5rem;
}

.footer-logo {
    max-width: 160px;
    height: auto;
    margin-bottom: 0.5rem;
}

.footer-contact {
    text-align: right;
}

.social-icons {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

.social-icons a img {
    width: 32px;
    height: 32px;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.social-icons a img:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.footer-email {
    color: var(--accent);
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 0.3px;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}

.footer-email:hover {
    color: var(--white);
    text-decoration: underline;
}


.toggle-close {
    position: absolute;
    top: 1rem;
    right: 2rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--main-green);
    cursor: pointer;
    z-index: 100;
}

.toggle-close:active {
    animation: spin 0.5s linear;
}

.iframe-container {
    position: relative;
}

.iframe-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    height: 40px;
    width: 40px;
}

.iframe-loader::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid var(--main-green);
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 0.5s linear infinite;
    display: block;
    background-color: transparent; /* ✅ ensure it's not hidden */
}

.desktop-only {
    display: block;
}

.google-drive-embed {
    display: block;
    text-align: center;
}


.google-drive-embed iframe {
    width: 60%; /* Stretch it a little to fill out */
    height: 80%;
    max-width: none; /* Prevent it from being limited */
}

.google-drive-embed-projects {
    display: flex;
    text-align: center;
    justify-content: center;
    padding: 2rem 1rem;
    height: auto; /* 🔧 let it expand based on content naturally */
    min-height: 400px; /* optional fallback */
}

.google-drive-embed-projects iframe {
    width: 100%;
    max-width: 700px;
    height: 600px; /* ✅ explicit and stable height */
    margin: 0 auto;
    display: block;
}

.doc-preview-area {
    display: block;
    text-align: center;
    padding: 0rem 0rem;
    transform: translateX(20%);
    width: 100%;
    max-width: 100%;
}

.doc-preview-area iframe {
    transform: translateX(-20%);
    max-width: none; /* Prevent it from being limited */
}

.help-types {
    list-style: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    text-align: left;
}

@media screen and (max-width: 1920px) and (min-width: 769px) {
    .fund-section {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        flex-wrap: nowrap;
        width: 100%;
    }

    .fund-left,
    .fund-right {
        flex: 1 1 50%;
        max-width: 50%;
        height: auto;
    }

    .media-embed-row {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .media-item {
        max-width: 90%;
        margin: 0 auto;
    }

    .youtube-media-embed,
    .spotify-media-embed {
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        display: block;
        border: none;
        box-sizing: border-box;
        width: 500px;
        height: 310px;
    }

    .toggle-wrapper {
        height: 100%;
        min-height: 100%;
        padding: 2rem 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .toggle-section {
        height: 100%;
        min-height: 100%;
        overflow-y: hidden;
    }

    .fund-left {
        display: flex;
        align-items: stretch;
    }

    .modal-frame,
    .modal-frame-reports {
        max-width: 100%;
        margin: 0 auto;
        display: block;
        box-sizing: border-box;
        overflow: hidden;
    }

}

@media screen and (max-width: 768px) {
    .toggle-section {
        overflow-x: hidden;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .doc-preview-area,
    .modal-frame-reports,
    .modal-frame {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto;
        display: block;
        box-sizing: border-box;
        transform: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow: hidden;
    }

    .doc-preview-area iframe {
        max-width: 100% !important;
        transform: none !important;
    }
}


@media screen and (min-width: 769px) {
    .fund-left {
        display: flex;
        align-items: stretch;
    }

    .toggle-wrapper {
        height: 100%;
        min-height: 100%;
        width: 100%;
        padding: 2rem 1rem;
        box-sizing: border-box;
    }

    .toggle-section {
        height: 100%;
        min-height: 100%;
        overflow-y: hidden;
    }
}



@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.lang-switcher {
    font-weight: bold;
    background-color: #efcb4c;
    color: #000;
    margin-left: 12px;
    transition: 0.3s ease;
}

.lang-switcher:hover {
    background-color: #f0d86e;
}

