/* ============================================================
   TREE OF LIFE RUSSIA — STYLES
   ============================================================ */

/* --- RESET & BASE --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.tol-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #1a0e05;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: default;
}

/* --- TREE WRAPPER (zoomable) --- */
.tol-tree-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

/* --- STATIC BACKGROUND LAYER (does NOT zoom) --- */
.tol-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    /* Fallback gradient if no image */
    background-image: linear-gradient(180deg,
            #2d1810 0%,
            #3d2317 20%,
            #5a3a28 40%,
            #8b6f47 60%,
            #c4944a 80%,
            #e8b858 100%);
}

/* --- ZOOMABLE TREE CONTAINER --- */
.tol-tree-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-origin: center bottom;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- TREE PNG (zoomable) --- */
.tol-tree-png {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
    display: none;
    /* Hidden until image is loaded */
    transition: opacity 0.4s ease;
}

.tol-tree-png.loaded {
    display: block;
}

/* --- LEAVES CONTAINER --- */
.tol-leaves-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* --- LEAF --- */
.tol-leaf {
    position: absolute;
    width: 42px;
    height: 42px;
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s ease;
    animation: tol-leaf-sway 4s ease-in-out infinite, tol-leaf-glow-pulse 3s ease-in-out infinite alternate;
    z-index: 6;
}

.tol-leaf:hover {
    transform: scale(1.6) !important;
    z-index: 10;
    filter: brightness(1.5);
}

.tol-leaf svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px var(--leaf-color)) drop-shadow(0 0 16px var(--leaf-color)) drop-shadow(0 0 24px var(--leaf-color));
}

/* Leaf shape variants */
.tol-leaf--maple svg {
    transform: rotate(var(--leaf-rotate, 0deg));
}

.tol-leaf--oak svg {
    transform: rotate(var(--leaf-rotate, 0deg)) scale(0.9);
}

.tol-leaf--birch svg {
    transform: rotate(var(--leaf-rotate, 0deg)) scale(0.85);
}

/* leaf animations */
@keyframes tol-leaf-sway {

    0%,
    100% {
        transform: rotate(0deg) translateY(0);
    }

    25% {
        transform: rotate(2deg) translateY(-2px);
    }

    75% {
        transform: rotate(-2deg) translateY(2px);
    }
}

@keyframes tol-leaf-glow-pulse {
    0% {
        opacity: 0.85;
    }

    100% {
        opacity: 1;
    }
}

@keyframes tol-leaf-appear {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tol-leaf--entering {
    animation: tol-leaf-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* --- TITLE OVERLAY --- */
.tol-title-overlay {
    position: fixed;
    top: 30px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 50;
    pointer-events: none;
}

.tol-main-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
    text-shadow:
        0 0 20px rgba(0, 0, 0, 0.8),
        0 2px 8px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.02em;
}

.tol-main-title span {
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* --- BOTTOM BAR --- */
.tol-bottom-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 30px;
    z-index: 100;
}

/* --- CONTRIBUTE BUTTON (bottom center) --- */
.tol-contribute-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: linear-gradient(135deg, rgba(200, 160, 80, 0.85), rgba(160, 120, 50, 0.9));
    border: 1px solid rgba(220, 180, 100, 0.6);
    border-radius: 6px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        0 4px 20px rgba(180, 140, 60, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.tol-contribute-btn:hover {
    background: linear-gradient(135deg, rgba(220, 180, 90, 0.95), rgba(180, 140, 60, 0.95));
    box-shadow:
        0 6px 30px rgba(200, 160, 70, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tol-contribute-btn:active {
    transform: translateY(0);
}

.tol-btn-icon {
    opacity: 0.9;
}

/* --- LEAF COUNTER --- */
.tol-leaf-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tol-counter-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: #e8c860;
    text-shadow: 0 0 20px rgba(232, 200, 96, 0.4);
    line-height: 1;
}

.tol-counter-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    margin-top: 2px;
}

/* --- ZOOM CONTROLS --- */
.tol-zoom-controls {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
}

.tol-zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 20, 10, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
}

.tol-zoom-btn:hover {
    background: rgba(50, 35, 20, 0.9);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}



/* --- STAR BUTTON (decorative) --- */
.tol-star-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 20, 10, 0.6);
    border: 1px solid rgba(232, 200, 96, 0.3);
    border-radius: 50%;
    color: rgba(232, 200, 96, 0.7);
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.tol-star-btn:hover {
    color: #e8c860;
    box-shadow: 0 0 16px rgba(232, 200, 96, 0.4);
}

/* --- SEARCH BUTTON --- */
.tol-search-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 20, 10, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
}

.tol-search-btn:hover {
    background: rgba(50, 35, 20, 0.9);
    color: #fff;
}

/* ============================================================
   MODAL
   ============================================================ */

.tol-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 5, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.tol-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tol-modal {
    background: linear-gradient(160deg, rgba(40, 30, 18, 0.95), rgba(25, 18, 10, 0.98));
    border: 1px solid rgba(200, 160, 80, 0.25);
    border-radius: 20px;
    padding: 40px;
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(200, 160, 80, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tol-modal-overlay.active .tol-modal {
    transform: scale(1) translateY(0);
}

.tol-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tol-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* --- Modal Header --- */
.tol-modal-header {
    text-align: center;
    margin-bottom: 28px;
}

.tol-modal-icon {
    margin-bottom: 12px;
    color: rgba(232, 200, 96, 0.7);
}

.tol-modal-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #e8dcc0;
    margin-bottom: 6px;
}

.tol-modal-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

/* --- Form --- */
.tol-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tol-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.tol-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tol-form-group--full {
    grid-column: 1 / -1;
}

.tol-form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(232, 220, 192, 0.8);
    letter-spacing: 0.03em;
}

.tol-required {
    color: #e8c860;
}

.tol-form-group input,
.tol-form-group textarea {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
}

.tol-form-group input::placeholder,
.tol-form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.tol-form-group input:focus,
.tol-form-group textarea:focus {
    border-color: rgba(232, 200, 96, 0.5);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 12px rgba(232, 200, 96, 0.1);
}

/* --- Submit Button --- */
.tol-submit-btn {
    margin-top: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #c4944a, #a07832);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tol-submit-btn:hover {
    background: linear-gradient(135deg, #d4a45a, #b08842);
    box-shadow: 0 6px 24px rgba(196, 148, 74, 0.4);
    transform: translateY(-1px);
}

.tol-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tol-submit-loader svg {
    animation: tol-spin 1.2s linear infinite;
}

@keyframes tol-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* --- Success State --- */
.tol-form-success {
    text-align: center;
    padding: 20px 0;
}

.tol-success-icon {
    margin-bottom: 16px;
}

.tol-form-success h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    color: #4cff72;
    margin-bottom: 8px;
}

.tol-form-success p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================================
   CARD POPUP (on leaf click)
   ============================================================ */

.tol-card-popup {
    position: fixed;
    z-index: 200;
    pointer-events: all;
}

.tol-card-inner {
    background: #fff;
    color: #333;
    border-radius: 12px;
    padding: 20px 24px;
    min-width: 240px;
    max-width: 320px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    position: relative;
    animation: tol-card-appear 0.3s ease forwards;
}

@keyframes tol-card-appear {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tol-card-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.tol-card-close:hover {
    color: #333;
}

.tol-card-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d1810;
    margin-bottom: 2px;
    padding-right: 20px;
}

.tol-card-region {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 10px;
    font-weight: 500;
}

.tol-card-story {
    font-size: 0.88rem;
    line-height: 1.55;
    color: #444;
    margin-bottom: 12px;
    background: #f8f6f2;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid #c4944a;
}

.tol-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tol-card-nationality,
.tol-card-occupation {
    font-size: 0.72rem;
    padding: 3px 10px;
    background: #f0ece4;
    border-radius: 20px;
    color: #7a6840;
    font-weight: 500;
}

/* --- Card pointer arrow --- */
.tol-card-inner::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 24px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .tol-main-title {
        font-size: 2rem;
    }

    .tol-contribute-btn {
        padding: 12px 20px;
        font-size: 0.7rem;
    }

    .tol-bottom-bar {
        flex-direction: column;
        gap: 14px;
        bottom: 20px;
    }

    .tol-counter-number {
        font-size: 2rem;
    }

    .tol-modal {
        padding: 24px;
        max-width: 95%;
    }

    .tol-form-row {
        grid-template-columns: 1fr;
    }

    .tol-modal-title {
        font-size: 1.4rem;
    }

    .tol-zoom-controls {
        left: 10px;
    }

    .tol-leaf {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .tol-main-title {
        font-size: 1.6rem;
    }

    .tol-contribute-btn span {
        font-size: 0.65rem;
    }
}

/* --- Scrollbar inside modal --- */
.tol-modal::-webkit-scrollbar {
    width: 6px;
}

.tol-modal::-webkit-scrollbar-track {
    background: transparent;
}

.tol-modal::-webkit-scrollbar-thumb {
    background: rgba(200, 160, 80, 0.3);
    border-radius: 3px;
}

/* --- Selection color --- */
::selection {
    background: rgba(200, 160, 80, 0.4);
    color: #fff;
}

/* ============================================================
   SEARCH PANEL
   ============================================================ */

.tol-search-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: linear-gradient(180deg, rgba(30, 22, 12, 0.97), rgba(20, 14, 8, 0.99));
    border-left: 1px solid rgba(200, 160, 80, 0.2);
    z-index: 500;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
}

.tol-search-panel.active {
    right: 0;
}

.tol-search-panel-inner {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow-y: auto;
}

.tol-search-panel-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.tol-search-panel-close:hover {
    color: #fff;
}

.tol-search-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #e8dcc0;
    margin-bottom: 4px;
}

.tol-search-input {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.tol-search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.tol-search-input:focus {
    border-color: rgba(232, 200, 96, 0.5);
    background: rgba(255, 255, 255, 0.12);
}

.tol-filter-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tol-filter-select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.tol-filter-select option {
    background: #1e160c;
    color: #fff;
}

.tol-search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    margin-top: 4px;
}

.tol-search-result-item {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.tol-search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(232, 200, 96, 0.3);
}

.tol-search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e8dcc0;
    margin-bottom: 2px;
}

.tol-search-result-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.tol-search-no-results {
    text-align: center;
    padding: 20px 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

/* Overlay behind search panel */
.tol-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 499;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.tol-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- CREDIT --- */
.tol-credit {
    position: fixed;
    bottom: 6px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.05em;
    z-index: 50;
    pointer-events: none;
}