@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

/* Моментальное скрытие исходной секции Elementor до инициализации JS */
section[data-id="36c64a7"] {
    display: none !important;
}

.apple-bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px;
    gap: 24px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

.apple-bento-grid .bento-card {
    position: relative;
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 32px;
    padding: 32px;
    overflow: hidden;
    text-decoration: none;
    color: #1d1d1f;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    z-index: 1;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-sizing: border-box;
}

.apple-bento-grid .bento-card:hover {
    transform: scale(1.02) translateY(-4px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.apple-bento-grid .bento-card.size-large { grid-column: span 2; grid-row: span 2; }
.apple-bento-grid .bento-card.size-wide { grid-column: span 2; grid-row: span 1; }
.apple-bento-grid .bento-card.size-normal { grid-column: span 1; grid-row: span 1; }

.apple-bento-grid .bento-info { position: relative; z-index: 2; max-width: 65%; pointer-events: none; }
.apple-bento-grid .bento-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px 0; line-height: 1.1; }
.apple-bento-grid .bento-card.size-large .bento-title { font-size: 2.8rem; max-width: 100%; }
.apple-bento-grid .bento-card.size-normal .bento-title { font-size: 1.4rem; max-width: 100%; }
.apple-bento-grid .bento-desc { font-size: 1.05rem; color: #86868b; margin: 0; line-height: 1.3; font-weight: 500; }

/* Фиксация размеров картинок по блокам */
.apple-bento-grid .bento-card.size-normal .bento-img-wrap { 
    position: absolute; right: 20px; bottom: 20px; 
    width: 125px; height: 125px; z-index: 2; pointer-events: none; 
}
.apple-bento-grid .bento-card.size-normal .bento-img-wrap img { 
    width: 125px; height: 125px; max-width: none; object-fit: contain; 
}

.apple-bento-grid .bento-card.size-wide .bento-img-wrap { 
    position: absolute; right: 40px; top: 50%; bottom: auto; 
    transform: translateY(-50%); width: 160px; height: 160px; z-index: 2; pointer-events: none; 
}
.apple-bento-grid .bento-card.size-wide .bento-img-wrap img { 
    width: 160px; height: 160px; max-width: none; object-fit: contain; 
}

.apple-bento-grid .bento-card.size-large .bento-img-wrap { 
    position: absolute; right: 30px; bottom: 30px; 
    width: 250px; height: 250px; z-index: 2; pointer-events: none; 
}
.apple-bento-grid .bento-card.size-large .bento-img-wrap img { 
    width: 250px; height: 250px; max-width: none; object-fit: contain; 
}

.apple-bento-grid .bento-card .bento-img-wrap img {
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.15));
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    border: none; border-radius: 0; box-shadow: none;
}
.apple-bento-grid .bento-card:hover .bento-img-wrap img { transform: scale(1.08) translateY(-6px); }

/* Контейнер для кнопок, чтобы они выстраивались в ряд */
.apple-bento-grid .card-buttons-wrap {
    position: absolute; 
    left: 32px; 
    bottom: 32px; 
    display: flex; 
    gap: 10px; 
    z-index: 10;
}

/* Кнопки иконки */
.apple-bento-grid .recipe-trigger-btn {
    position: relative;
    width: 40px; height: 40px; background: #fdfbf7;
    border: 1px solid #e6ded2; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 12px rgba(44, 36, 22, 0.1);
    padding: 0; outline: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.apple-bento-grid .recipe-trigger-btn:hover {
    background: #f4efe6;
    transform: scale(1.05);
}
.apple-bento-grid .recipe-trigger-btn svg { width: 20px; height: 20px; fill: #423828; }

/* Подсказки (Tooltip) кнопок - позиция ПОВЕРХ кнопки */
.apple-bento-grid .recipe-trigger-btn::after {
    content: attr(data-tooltip); 
    position: absolute; 
    left: 50%; 
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(5px); 
    background: #2c2416; 
    color: #fdfbf7;
    font-size: 13px; 
    font-weight: 500; 
    padding: 6px 12px; 
    border-radius: 8px;
    white-space: nowrap; 
    opacity: 0; 
    visibility: hidden; 
    transition: 0.2s ease;
    pointer-events: none;
    z-index: 20;
}
.apple-bento-grid .recipe-trigger-btn:hover::after {
    opacity: 1; 
    visibility: visible; 
    transform: translateX(-50%) translateY(0);
}

/* Карточка со стихами (ПК) */
.poetic-card {
    position: fixed; bottom: 30px; right: 30px; 
    width: 360px; 
    height: auto; max-height: 85vh; background: #fdfbf7; 
    box-shadow: 0 20px 50px rgba(44, 36, 22, 0.1), 0 8px 16px rgba(44, 36, 22, 0.08); 
    border-radius: 40px 20px 20px 20px; z-index: 99999; 
    padding: 28px 30px 24px 30px; 
    box-sizing: border-box; opacity: 0; visibility: hidden; transform: translateY(12px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid #e6ded2; 
    outline: 2px solid #f4efe6; outline-offset: -4px;
    display: flex; flex-direction: column; pointer-events: none; overflow: visible;
}
.poetic-card.is-visible { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }

.poetic-card-header { 
    display: flex; align-items: center; margin-bottom: 16px; padding-bottom: 12px; 
    border-bottom: 1px solid #ede5db; position: relative; min-height: 40px; flex-shrink: 0; 
    overflow: visible; 
}

.poetic-card-image { 
    position: absolute; top: 0; left: 0; transform: translate(-50%, -50%); 
    width: 64px; height: 64px; 
    border-radius: 50%; object-fit: cover; 
    border: 3px solid #fdfbf7; box-shadow: -4px 6px 15px rgba(44, 36, 22, 0.15); 
    background: #ffffff; z-index: 10; 
}

.poetic-card-author { 
    font-family: "Lora", Georgia, serif; 
    font-size: 16px; 
    font-weight: 500; 
    color: #2c2416; letter-spacing: 0.2px; 
    margin-left: 44px; 
    margin-top: 0; 
}

.poetic-card-quote { 
    font-family: "Lora", Georgia, serif; 
    font-size: 14px; line-height: 1.7; 
    color: #423828; white-space: pre-line; font-style: italic; 
    overflow-y: auto; padding-right: 8px; margin-bottom: 16px; flex-shrink: 1;
    max-height: 220px; 
    scrollbar-width: thin; scrollbar-color: #d8cbb9 transparent; 
}
.poetic-card-quote::-webkit-scrollbar { width: 4px; }
.poetic-card-quote::-webkit-scrollbar-track { background: transparent; }
.poetic-card-quote::-webkit-scrollbar-thumb { background: #d8cbb9; border-radius: 4px; }

.poetic-card-source { 
    font-family: "Lora", Georgia, serif; 
    font-size: 11px; 
    color: #8c7e6c; border-top: 1px dashed #ede5db; padding-top: 12px; flex-shrink: 0; font-style: normal; 
}

/* Модальное окно рецепта */
.poetic-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px); z-index: 999998;
    opacity: 0; visibility: hidden; transition: 0.3s ease; display: flex; align-items: center; justify-content: center;
}
.poetic-modal-overlay.is-visible { opacity: 1; visibility: visible; }
.poetic-modal-card {
    position: relative; width: 90%; max-width: 650px; max-height: 85vh;
    background: #fdfbf7; border-radius: 32px; z-index: 999999; padding: 40px;
    box-sizing: border-box; display: flex; flex-direction: column; border: 1px solid #e6ded2;
}
.poetic-modal-close { position: absolute; top: 24px; right: 24px; width: 36px; height: 36px; background: rgba(0,0,0,0.05); border: none; border-radius: 50%; cursor: pointer; font-size: 18px; z-index: 5; transition: background 0.2s; }
.poetic-modal-close:hover { background: rgba(0,0,0,0.1); }
.poetic-modal-header { display: flex; align-items: center; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid #ede5db; flex-shrink: 0; position: relative; min-height: 48px; }
.poetic-modal-image { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid #fdfbf7; box-shadow: 0 8px 20px rgba(44, 36, 22, 0.16); background: #ffffff; margin-right: 16px; flex-shrink: 0; }
.poetic-modal-author { font-family: "Lora", Georgia, serif; font-size: 20px; font-weight: 500; color: #2c2416; margin: 0; }

.poetic-modal-quote { 
    font-family: "Lora", Georgia, serif; font-size: 16px; line-height: 1.85; 
    color: #423828; white-space: pre-line; font-style: italic; 
    overflow-y: auto; flex-grow: 1; padding-right: 10px; margin-bottom: 20px;
    scrollbar-width: thin; scrollbar-color: #d8cbb9 transparent;
}
.poetic-modal-quote::-webkit-scrollbar { width: 5px; }
.poetic-modal-quote::-webkit-scrollbar-track { background: transparent; }
.poetic-modal-quote::-webkit-scrollbar-thumb { background: #d8cbb9; border-radius: 4px; }

.poetic-modal-source { font-family: "Lora", Georgia, serif; font-size: 13px; color: #8c7e6c; border-top: 1px dashed #ede5db; padding-top: 14px; flex-shrink: 0; }

/* Адаптивность */
@media (max-width: 1024px) {
    .apple-bento-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 240px; }
    .apple-bento-grid .bento-card.size-large, .apple-bento-grid .bento-card.size-wide { grid-column: span 2; }
    .apple-bento-grid .bento-card.size-large .bento-img-wrap { width: 200px; height: 200px; }
    .apple-bento-grid .bento-card.size-large .bento-img-wrap img { width: 200px; height: 200px; }
}

@media (max-width: 768px) {
    .apple-bento-grid { grid-template-columns: 1fr; grid-auto-rows: 200px; padding: 20px 10px; gap: 16px; }
    .apple-bento-grid .bento-card.size-large, .apple-bento-grid .bento-card.size-wide, .apple-bento-grid .bento-card.size-normal { grid-column: span 1; grid-row: span 1; }
    .apple-bento-grid .bento-title { font-size: 1.5rem; }
    .apple-bento-grid .bento-card .bento-img-wrap, .apple-bento-grid .bento-card.size-large .bento-img-wrap, .apple-bento-grid .bento-card.size-wide .bento-img-wrap { width: 110px; height: 110px; right: 15px; bottom: 15px; top: auto; transform: none; }
    .apple-bento-grid .bento-card .bento-img-wrap img, .apple-bento-grid .bento-card.size-large .bento-img-wrap img, .apple-bento-grid .bento-card.size-wide .bento-img-wrap img { width: 110px; height: 110px; }
    
    .apple-bento-grid .card-buttons-wrap { left: 20px; bottom: 20px; }
    .apple-bento-grid .recipe-trigger-btn { width: 36px; height: 36px; }
    
    .poetic-card { display: none; }
}