/**
 * Recipe AI Poster — стилі для рецепту на фронтенді сайту.
 * Підключається плагіном автоматично (RAP_Admin::enqueue_frontend_assets)
 * лише на сторінках постів, згенерованих плагіном — нічого копіювати вручну
 * в тему не потрібно.
 */

.rap-recipe {
    /* ── Токени: тепла "кухонна" палітра ─────────────────────────────────── */
    --rap-ink:          #2b2620;
    --rap-muted:        #8a8072;
    --rap-paper:        #fffefb;
    --rap-line:         #ece5d8;

    --rap-accent:       #c1440e; /* смажена паприка — акцент №1 (рейтинг, кружки кроків, посилання) */
    --rap-accent-dark:  #8f3009;
    --rap-accent-soft:  #f7e4da;

    --rap-sage:         #55764c; /* поради шеф-кухаря */
    --rap-sage-soft:    #e9f1e5;
    --rap-sage-line:    #cfe0c9;

    --rap-mustard:      #b8860b; /* секрети + зірки рейтингу */
    --rap-mustard-soft: #f7edd6;

    --rap-plum:         #7c5a91; /* варіації рецепту */
    --rap-plum-soft:    #f0e6f5;

    --rap-sky:          #3f7ea6; /* цікаві факти */
    --rap-sky-soft:     #e5f0f6;

    max-width: 800px;
    margin: 0 auto;
    color: var(--rap-ink);
    font-size: 17px;
    line-height: 1.75;
}

.rap-recipe h2 {
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-size: 1.5em;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--rap-ink);
}

.rap-recipe-h1 {
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-size: 2.1em;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 18px;
}

.rap-description p {
    font-size: 17px;
    line-height: 1.85;
    color: var(--rap-ink);
    margin-bottom: 20px;
}

/* ─── Featured image ────────────────────────────────────────────────────── */
.rap-featured-image {
    position: relative;
    margin: 0 0 44px;
    border-radius: 16px;
    overflow: hidden;
    line-height: 0;
}

.rap-recipe-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 480px;
}

.rap-image-credit {
    position: absolute;
    right: 10px;
    bottom: 10px;
    margin: 0 !important;
    padding: 4px 11px;
    background: rgba(20, 16, 12, 0.55);
    color: #fff !important;
    border-radius: 999px;
    font-size: 11px !important;
    line-height: 1.4;
}

/* ─── Плаваюча стрічка: рейтинг + швидкі факти ──────────────────────────── */
.rap-meta-row {
    position: relative;
    margin: -60px 12px 30px;
    background: var(--rap-paper);
    border: 1px solid var(--rap-line);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(43, 38, 32, 0.1);
    padding: 14px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    z-index: 2;
}

@media (max-width: 560px) {
    .rap-meta-row { margin-top: -34px; }
}

.rap-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rap-stars {
    position: relative;
    display: inline-block;
    font-size: 16px;
    letter-spacing: 2px;
    line-height: 1;
    color: var(--rap-line);
}

.rap-stars::before {
    content: "★★★★★";
    position: absolute;
    inset: 0;
    width: var(--rap-star-pct, 0%);
    overflow: hidden;
    white-space: nowrap;
    color: var(--rap-mustard);
}

.rap-rating-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--rap-ink);
    white-space: nowrap;
}

.rap-rating-count {
    font-weight: 400;
    color: var(--rap-muted);
}

.rap-pill {
    background: var(--rap-accent-soft);
    color: var(--rap-accent-dark);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ─── Перейти до рецепту ─────────────────────────────────────────────────── */
.rap-jump-link {
    text-align: center;
    margin: 4px 0 30px;
}

.rap-jump-link a {
    display: inline-block;
    font-weight: 600;
    font-size: 14px;
    color: var(--rap-accent-dark);
    text-decoration: none;
    border-bottom: 2px solid var(--rap-accent);
    padding-bottom: 2px;
}

.rap-jump-link a:hover { color: var(--rap-accent); }

/* ─── Info stat-grid (замість таблиці) ──────────────────────────────────── */
.rap-info-block { margin: 8px 0 28px; }

.rap-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.rap-stat {
    background: var(--rap-paper);
    border: 1px solid var(--rap-line);
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
}

.rap-stat-icon {
    display: block;
    font-size: 20px;
    margin-bottom: 6px;
}

.rap-stat-value {
    display: block;
    font-weight: 700;
    font-size: 15px;
    color: var(--rap-ink);
}

.rap-stat-label {
    display: block;
    font-size: 11px;
    color: var(--rap-muted);
    margin-top: 2px;
}

/* ─── Картка рецепту: інгредієнти / кроки ───────────────────────────────── */
.rap-card-block {
    background: var(--rap-paper);
    border: 1px solid var(--rap-line);
    border-radius: 16px;
    padding: 22px 24px;
    margin: 22px 0;
    scroll-margin-top: 20px;
}

.rap-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.rap-card-head h2 { margin: 0; }

.rap-print-btn {
    flex-shrink: 0;
    border: 1px solid var(--rap-line);
    background: #fff;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rap-ink);
    cursor: pointer;
}

.rap-print-btn:hover {
    border-color: var(--rap-accent);
    color: var(--rap-accent-dark);
}

/* Чек-лист інгредієнтів */
.rap-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rap-check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--rap-line);
}

.rap-check-item:last-child { border-bottom: none; }

.rap-check-input {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--rap-accent);
}

.rap-check-item label { cursor: pointer; }

.rap-check-input:checked + label {
    text-decoration: line-through;
    color: var(--rap-muted);
}

/* Кроки з номерними кружками */
.rap-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rap-step-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px 0;
    border-bottom: 1px solid var(--rap-line);
}

.rap-step-item:last-child { border-bottom: none; padding-bottom: 4px; }

.rap-step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--rap-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    font-family: Georgia, serif;
}

.rap-step-body { padding-top: 4px; }

.rap-step-body strong {
    display: block;
    margin-bottom: 6px;
    color: var(--rap-ink);
}

/* ─── Chef tips / Secrets / Variations / Facts / FAQ ────────────────────── */
.rap-chef-tips {
    background: var(--rap-sage-soft);
    border: 1px solid var(--rap-sage-line);
    border-radius: 12px;
    padding: 22px 24px;
    margin: 26px 0;
}
.rap-chef-tips h2 { color: var(--rap-sage); }

.rap-tip-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rap-sage-line);
}
.rap-tip-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.rap-secrets {
    background: var(--rap-mustard-soft);
    border-left: 4px solid var(--rap-mustard);
    border-radius: 4px;
    padding: 18px 22px;
    margin: 22px 0;
}

.rap-variations {
    background: var(--rap-plum-soft);
    border-left: 4px solid var(--rap-plum);
    border-radius: 4px;
    padding: 18px 22px;
    margin: 22px 0;
}
.rap-variation-item h3 { margin: 0 0 6px; font-size: 16px; color: var(--rap-plum); }

.rap-facts {
    background: var(--rap-sky-soft);
    border-left: 4px solid var(--rap-sky);
    border-radius: 4px;
    padding: 18px 22px;
    margin: 22px 0;
}

.rap-faq-item {
    margin-bottom: 16px;
    border: 1px solid var(--rap-line);
    border-radius: 10px;
    padding: 16px 18px;
}
.rap-faq-q { margin: 0 0 8px; font-size: 16px; color: var(--rap-ink); }
.rap-faq-a p { margin: 0; color: var(--rap-muted); }

.rap-serving, .rap-nutrition, .rap-history {
    margin: 22px 0;
    padding-top: 4px;
}

/* ─── Друк ───────────────────────────────────────────────────────────────── */
@media print {
    body * { visibility: hidden; }
    .rap-recipe, .rap-recipe * { visibility: visible; }
    .rap-recipe {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 100%;
    }
    .rap-print-btn, .rap-jump-link { display: none !important; }
    .rap-meta-row { box-shadow: none; }
}

/* ─── Захист від переповнення ────────────────────────────────────────────
   Незалежно від класу — жодне зображення всередині рецепту не повинно
   вилазити за межі контейнера, навіть якщо тема не має власного скидання. */
.rap-recipe img {
    max-width: 100%;
    height: auto;
}
