/* Общие стили - zerafimus design */

*,
*::before,
*::after {
    box-sizing: border-box; /* Prevent padding and border from breaking layouts */
}

:root {
    --paper-grey: #f5f5f5;
    --white: #ffffff;
    --lilac-pale: #f2e6f0; /* Бледно-розовый для плейсхолдеров */
    --text-color: #333;
    --grey-background: #e2e2e2;
}

body {
    font-family: 'Lora', serif;
    background-color: var(--paper-grey);
    color: var(--text-color);
    margin: 0 100px 0;
    padding: 20px 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

main {
    width: 100%;
    max-width: 1200px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', serif;
}

/* Advantages Section */
.advantages-section-grid {
    display: grid;
    grid-template-columns: 300px 300px;
    grid-template-rows: 300px 300px;
    gap: 20px;
    margin: 50px auto;
    justify-content: center;
}

.grid-item-image {
    background-color: var(--lilac-pale);
    border-radius: 15px;
    padding: 15px;
}

.grid-item-text {
    background-color: var(--grey-background);
    border-radius: 15px;
    padding: 20px;
    aspect-ratio: 1 / 1;
}


.grid-item-text h3 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.grid-item-text p {
    font-size: 1.1rem;
}

.text-card p {
    font-size: 1.1rem;
}

#advantages-grid-text-1 h3 {
    justify-content: flex-start;
}

#advantages-grid-text-2 h3 {
    justify-content: flex-end;
}

.grid-item-text h3 img {
    vertical-align: middle;
    margin-left: 10px;
    margin-right: 10px;
}

.sub-title {
    font-size: 2rem;
}

.main-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 2rem;
    font-weight: 700; /* Make the text thicker */
    white-space: nowrap; /* Prevent title and arrow from wrapping separately */
    cursor: pointer; /* Показываем что заголовок кликабельный */
    transition: opacity 0.3s ease;
}

.main-title:hover {
    opacity: 0.8; /* Небольшое затемнение при наведении */
}

.heading-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: -15px; /* Pull the arrow closer to the text */
    color: var(--text-color);
    display: inline-flex; /* Use inline-flex to align with text */
    align-items: center; /* Vertically center the SVG */
    vertical-align: baseline; /* Align with text baseline */
}

.heading-action-btn svg {
    height: 24px; /* Keep height consistent */
    width: 50px; /* Make it wider */
}

.news-item-image {
    width: 100%; /* Or a specific size */
    height: 150px; /* Placeholder height */
    background-color: var(--lilac-pale); /* Use the placeholder color */
    border-radius: 8px;
    /* Removed margin-bottom */
}

.arrow-icon-rotated-placeholder {
    transform: translateY(-2px); /* Nudge rotated arrow up slightly */
}

#advantages-title-container .main-title {
    margin-top: 350px;
}

@keyframes arrow-move {
    0% { transform: translateX(0); }
    50% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

.heading-action-btn:hover .arrow-icon-placeholder svg,
.heading-action-btn:hover .arrow-icon-rotated-placeholder svg,
.main-title:hover .arrow-icon-placeholder svg,
.main-title:hover .arrow-icon-rotated-placeholder svg {
    animation: arrow-move 1s infinite alternate;
}

/* Main Content Container - center the first card */
#main-content-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Join Us Cards Section */
.join-us-cards-container {
    max-width: 800px; /* Match other sections */
    margin: 50px auto;
    padding: 20px;
    width: 100%;
}

.join-us-card-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: center; /* Center the cards if there's extra space */
}

.join-us-card-wrapper .text-card {
    width: 300px; /* Set a fixed width for small square cards */
    height: 320px; /* Set a fixed height to make cards identical */
}

/* --- Comprehensive Mobile Optimization --- */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    body {
        margin: 0 !important;
        padding: 10px 30px 0 !important; /* Отступы по бокам для всех элементов */
    }

    #page-container {
        width: 100%;
        max-width: 100%;
    }

    #main-content-container {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .main-title {
        font-size: 2.2rem; /* Reduce title font size */
        white-space: normal; /* Allow title to wrap */
        word-wrap: break-word;
    }

    .sub-title {
        font-size: 1.6rem;
    }

    p {
        font-size: 1rem; /* Adjust paragraph font size for readability */
    }

    /* Advantages Section to single column */
    .advantages-section-grid {
        grid-template-columns: 1fr; /* Single column layout */
        grid-template-rows: auto;
        width: 100%;
        gap: 15px;
    }

    .grid-item-image {
        min-height: 250px;
    }

    .grid-item-text {
        aspect-ratio: unset;
        min-height: 200px;
    }

    /* Поворачиваем стрелки на мобильных */
    #advantages-grid-text-1 h3 {
        justify-content: center !important;
        flex-direction: column;
    }

    #advantages-grid-text-1 h3 svg {
        transform: rotate(90deg); /* Стрелка влево → вверх */
        margin: 0 0 10px 0 !important;
    }

    #advantages-grid-text-2 h3 {
        justify-content: center !important;
        flex-direction: column-reverse;
    }

    #advantages-grid-text-2 h3 svg {
        transform: rotate(90deg); /* Стрелка вправо → вниз */
        margin: 10px 0 0 0 !important;
    }

    /* Join Us Cards to single column */
    .join-us-cards-container {
        padding: 0;
    }

    .join-us-card-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .join-us-card-wrapper .text-card {
        width: 100%;
        max-width: none;
        height: auto;
    }

    /* Reduce huge margins */
    #advantages-title-container .main-title,
    #news-feed-title-container .main-title,
    #join-us-heading-container .main-title {
        margin-top: 100px;
    }

    #zerafimus-title-container {
        margin-top: 40px;
    }

    /* Restore correct card background on mobile */
    .text-card, .grid-item-text {
        background-color: var(--grey-background) !important;
    }
}