/* ============================================================
   CozyRecipes — Premium Enhancements
   Additive styles only. No existing rules are overridden unless
   explicitly noted. All selectors are scoped to new components.
   ============================================================ */

/* ── 1. HERO FEATURED RECIPE — EDITORIAL STYLE ──────────────── */

/* ── SECTION WRAPPER ─────────────────────────────────────────── */
/*
 * calc((100vw - 100%) / 2) = half the scrollbar width.
 * On Windows classic scrollbars ≈ 8.5px; on Mac / overlay = 0px.
 * Applying it as equal left+right padding centres the image between
 * both viewport edges and preserves card alignment with the header
 * (the P terms cancel in the centering formula at any viewport width).
 */
.hero-featured-section {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 calc((100vw - 100%) / 2) 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    box-sizing: border-box;
}

/* ── EDITORIAL WRAP — full-width image + floating card ───────── */
.hero-editorial-wrap {
    position: relative;
    width: 100%;
    height: 460px;
    overflow: hidden;
    background: #1a1a1a;
}

/*
 * Inner centering wrapper mirrors the header-container exactly
 * (max-width: 1200px, margin: 0 auto, padding: 0 1.5rem) so the
 * card's left edge lines up with the logo / nav on every viewport.
 */
.hero-editorial-inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
}

/* ── BACKGROUND IMAGE ────────────────────────────────────────── */
.hero-editorial-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-editorial-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    display: block;
    transition: transform 0.8s ease;
}

.hero-editorial-wrap:hover .hero-editorial-bg img {
    transform: scale(1.03);
}

/* Subtle right-side vignette keeps image edge soft */
.hero-editorial-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.22) 0%,
        rgba(0, 0, 0, 0.06) 45%,
        rgba(0, 0, 0, 0.12) 100%
    );
    pointer-events: none;
}

/* ── OVERLAY TEXT CARD ───────────────────────────────────────── */
.hero-editorial-card {
    background: #ffffff;
    padding: 1.5rem 1.75rem;
    max-width: 355px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 12px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Eyebrow — small accent label above category */
.hero-card-eyebrow {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--hf-badge-bg, #ff6b6b);
    margin-bottom: -0.2rem;
}

/* Category badge */
.hero-card-category {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hf-badge-bg, #ff6b6b);
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 0.22rem 0.65rem;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.hero-card-category:hover {
    background: var(--hf-badge-bg, #ff6b6b);
    color: #fff;
}

/* Title */
.hero-card-title {
    font-size: clamp(1.3rem, 2vw, 1.85rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
    color: #111;
}

.hero-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hero-card-title a:hover {
    color: var(--hf-badge-bg, #ff6b6b);
}

/* Description — max 2 lines */
.hero-card-desc {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #555;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta row — prep/cook/servings */
.hero-card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: #777;
    border-top: 1px solid #f0f0f0;
    padding-top: 0.6rem;
    margin-top: -0.1rem;
}

.hero-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.28rem;
}

.hero-card-meta-item svg {
    color: var(--hf-badge-bg, #ff6b6b);
    flex-shrink: 0;
    opacity: 0.85;
}

/* CTA button */
.hero-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: flex-start;
    padding: 0.7rem 1.5rem;
    background: var(--hf-btn-bg, #ff6b6b);
    color: var(--hf-btn-text, #fff);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    margin-top: 0.15rem;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.hero-card-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.hero-card-btn svg {
    transition: transform 0.22s ease;
}

.hero-card-btn:hover svg {
    transform: translateX(3px);
}

/* ── TABLET (641–900px) ──────────────────────────────────────── */
@media (max-width: 900px) and (min-width: 641px) {
    .hero-editorial-wrap {
        height: 360px;
    }

    .hero-editorial-card {
        max-width: 300px;
        padding: 1.25rem 1.5rem;
    }

    .hero-card-title {
        font-size: 1.4rem;
    }
}

/*
 * Mirror .header-container horizontal padding at every breakpoint so the
 * card's left edge tracks the logo exactly.
 *
 * ≥1024px  → 1.5rem (default above)
 * 768–1023px → 1.25rem  (style.css: .header-container { padding: 0.875rem 1.25rem })
 * 641–767px  → 1rem     (critical CSS: .header-container { padding: 0.875rem 1rem })
 */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero-editorial-inner {
        padding: 0 1.25rem;
    }
}

@media (max-width: 767px) and (min-width: 641px) {
    .hero-editorial-inner {
        padding: 0 1rem;
    }
}

/* ── MOBILE (≤640px) — stack: image on top, card below ───────── */
@media (max-width: 640px) {
    .hero-featured-section {
        padding: 0 0 1rem;
    }

    .hero-editorial-wrap {
        height: auto;
    }

    /* Inner wrapper: revert to normal flow on mobile */
    .hero-editorial-inner {
        position: static;
        height: auto;
        display: block;
        padding: 0;
        max-width: none;
        margin: 0;
    }

    /* Image block at the top */
    .hero-editorial-bg {
        position: relative;
        height: 220px;
    }

    .hero-editorial-bg::after {
        background: rgba(0, 0, 0, 0.1);
    }

    /* Card flows below, full width */
    .hero-editorial-card {
        max-width: none;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        padding: 1.25rem 1rem;
        gap: 0.5rem;
    }

    .hero-card-title {
        font-size: 1.25rem;
    }
}

/* ── 2. TRENDING RECIPES SECTION ────────────────────────────── */

.trending-recipes-section {
    background: #fff9f7;
    padding: 4rem 0;
    border-top: 1px solid #f5e8e4;
    border-bottom: 1px solid #f5e8e4;
}

.trending-recipes-section .section-header {
    text-align: left;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.trending-recipes-section .section-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.trending-recipes-section .section-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ff6b6b;
}

.trending-recipes-section .section-title {
    font-size: 1.75rem;
    margin: 0;
    text-align: left;
}

.trending-recipes-section .section-subtitle {
    text-align: left;
    font-size: 0.95rem;
    margin: 0;
}

.trending-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ff6b6b;
    text-decoration: none;
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 1px;
    white-space: nowrap;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.trending-view-all:hover {
    color: #ff5252;
}

.trending-recipes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* Trending card — inherits .recipe-card but adds a rank badge */
.trending-card {
    position: relative;
}

.trending-rank-badge {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ff6b6b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(255,107,107,0.4);
    pointer-events: none;
}

@media (max-width: 1024px) {
    .trending-recipes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .trending-recipes-section {
        padding: 2.5rem 0;
    }

    .trending-recipes-section .section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .trending-recipes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* ── 3. RECIPE CARD META ICONS ──────────────────────────────── */

.recipe-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.4rem 0 0.6rem;
}

.recipe-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: #888;
    font-weight: 500;
}

.recipe-card-meta-item svg {
    flex-shrink: 0;
    color: #ff6b6b;
}

/* Star Rating on cards */
.recipe-card-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.3rem 0 0.5rem;
}

.recipe-card-rating .star {
    font-size: 0.75rem;
    color: #ddd;
    line-height: 1;
}

.recipe-card-rating .star-full,
.recipe-card-rating .star-half {
    color: #f5a623;
}

.recipe-card-rating .rating-count {
    font-size: 0.72rem;
    color: #aaa;
    margin-left: 0.1rem;
}

/* ── 4. SINGLE POST: RECIPE META BAR ────────────────────────── */

.recipe-meta-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: #fff9f7;
    border: 1px solid #f5e8e4;
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem auto 2rem;
    max-width: 800px;
    width: calc(100% - 40px); /* matches .single-recipe-header padding */
}

.recipe-meta-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.1rem 0.75rem;
    text-align: center;
    border-right: 1px solid #f5e8e4;
    gap: 0.3rem;
}

.recipe-meta-bar-item:last-child {
    border-right: none;
}

.recipe-meta-bar-item svg {
    color: #ff6b6b;
    flex-shrink: 0;
}

.recipe-meta-bar-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    line-height: 1;
}

.recipe-meta-bar-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

@media (max-width: 600px) {
    .recipe-meta-bar {
        flex-wrap: wrap;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 10px;
    }

    .recipe-meta-bar-item {
        flex: 0 0 33.333%;
        border-bottom: 1px solid #f5e8e4;
        padding: 0.875rem 0.5rem;
    }

    /* Last row: remove bottom border */
    .recipe-meta-bar-item:nth-last-child(-n+3):nth-child(3n+1),
    .recipe-meta-bar-item:nth-last-child(-n+3):nth-child(3n+1) ~ .recipe-meta-bar-item {
        border-bottom: none;
    }
}

/* ── 5. SINGLE POST: INGREDIENT CHECKLIST ───────────────────── */

.recipe-ingredients-section {
    max-width: 800px;
    margin: 2.5rem auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.recipe-ingredients-section h2,
.recipe-ingredients-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #ff6b6b;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.recipe-ingredients-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.recipe-ingredient-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.recipe-ingredient-item:hover {
    background: #fff9f7;
}

.recipe-ingredient-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-top: 1px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.recipe-ingredient-item input[type="checkbox"]:checked {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

.recipe-ingredient-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.recipe-ingredient-label {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #444;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.recipe-ingredient-item input[type="checkbox"]:checked ~ .recipe-ingredient-label {
    color: #aaa;
    text-decoration: line-through;
}

/* ── 6. SINGLE POST: INSTRUCTION STEPS ──────────────────────── */

.recipe-instructions-section {
    max-width: 800px;
    margin: 2.5rem auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.recipe-instructions-section h2,
.recipe-instructions-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #ff6b6b;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.recipe-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    counter-reset: step-counter;
}

.recipe-step-item {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
    counter-increment: step-counter;
    transition: box-shadow 0.2s ease;
}

.recipe-step-item:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

.recipe-step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ff6b6b;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.recipe-step-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
    flex: 1;
}

/* ── 7. SINGLE POST: AUTHOR BOX ─────────────────────────────── */

.single-author-box {
    max-width: 800px;
    margin: 3rem auto 2rem;
    padding: 1.75rem;
    background: #fff9f7;
    border: 1px solid #f5e8e4;
    border-radius: 14px;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    box-sizing: border-box;
    width: calc(100% - 0px);
}

.single-author-box-avatar {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.single-author-box-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.single-author-box-avatar-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff6b6b, #ff8a7a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

.single-author-box-body {
    flex: 1;
    min-width: 0;
}

.single-author-box-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ff6b6b;
    margin-bottom: 0.2rem;
    display: block;
}

.single-author-box-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.5rem;
}

.single-author-box-bio {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #666;
    margin: 0 0 0.75rem;
}

.single-author-box-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ff6b6b;
    text-decoration: none;
    border-bottom: 1.5px solid currentColor;
    padding-bottom: 1px;
    transition: color 0.2s ease;
}

.single-author-box-link:hover {
    color: #ff5252;
}

@media (max-width: 480px) {
    .single-author-box {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
}

/* ── 8. IMPROVED RECIPE CARD HOVER ──────────────────────────── */

/* Existing .recipe-card:hover raises image; also add card-level lift */
.recipes-grid .recipe-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border-radius: 14px;
    overflow: visible; /* allows box-shadow to show */
}

.recipes-grid .recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.09);
}

/* Round the image corners within the card */
.recipes-grid .recipe-card .recipe-card-image {
    border-radius: 12px;
    overflow: hidden;
}

/* ── 9. IMPROVED SECTION SPACING ────────────────────────────── */

.editors-picks-section {
    padding: 4rem 0;
}

.category-slider-section {
    padding: 3rem 0;
}

/* ── 10. SMOOTH SCROLL ──────────────────────────────────────── */

html {
    scroll-behavior: smooth;
}

/* Offset for sticky header when jumping to recipe */
#recipe-card {
    scroll-margin-top: 80px;
}

/* ── 11. SIDEBAR FIXES (desktop) ────────────────────────────── */
/*
 * style.css sets max-height + overflow-y:auto on .single-sidebar which
 * (a) clips the "You May Also Like" widget so only ~4 items show and the
 *     rest require internal mouse-wheel scroll, and
 * (b) breaks position:sticky because a scrollable box can't also be sticky.
 *
 * Fix: remove the height cap and the internal scroll so ALL widget posts
 * are visible and page-level scrolling drives the sticky behaviour.
 */
@media (min-width: 1024px) {
    .single-sidebar {
        position: sticky;
        top: 1.5rem;
        max-height: none;
        overflow-y: visible;
        overflow-x: visible;
        scrollbar-width: auto;
    }
    .single-sidebar::-webkit-scrollbar {
        display: revert;
    }
}

/* ── 12. HERO SEARCH BAR — FLOATING CIRCLE BUTTON ───────────── */

/* Remove hardcoded gradient so Customizer color wins */
.hero-section-simple {
    background: transparent;
}

/*
 * style.css has 3 separate blocks that set:
 *   .hero-search-form          { overflow: hidden }
 *   .hero-search-form button   { padding: 1rem 2rem; border-radius: 0 50px 50px 0 }
 * We beat all of them with !important on the shape-critical properties.
 */

/* 1 — Reset the form so it doesn't clip the circle button */
.hero-section .hero-search-form {
    max-width: 580px !important;
    width: 100% !important;
    margin: 0 auto !important;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;   /* MUST be visible — hidden clips the circle */
    box-shadow: none !important;
    padding: 0 !important;
    display: block !important;
    min-height: 0 !important;
}

/* 2 — Relative wrapper: this is the position:relative parent */
.hero-search-wrap {
    position: relative;
    width: 100%;
}

/* 3 — Pill input */
.hero-search-input {
    display: block !important;
    width: 100% !important;
    height: 58px !important;
    padding: 0 72px 0 24px !important;  /* right gap keeps text clear of button */
    border: 2px solid #e4e4e4 !important;
    border-radius: 40px !important;
    background: #fff !important;
    font-size: 1rem !important;
    color: #333 !important;
    outline: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    box-sizing: border-box !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
    -webkit-appearance: none;
    appearance: none;
}

.hero-search-input::placeholder {
    color: #bbb;
}

.hero-search-input:focus {
    border-color: var(--cr-accent, #c8783a) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08),
                0 0 0 3px rgba(200, 120, 58, 0.15) !important;
    outline: none !important;
}

/* 4 — Perfect circle button — all !important to beat style.css */
.hero-search-form button.hero-search-btn-icon,
.hero-search-btn-icon {
    /* SHAPE — these three are critical, must not be overridden */
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;

    /* POSITION */
    position: absolute !important;
    right: 5px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;

    /* RESET style.css padding that stretches the button */
    padding: 0 !important;

    /* LOOK */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border: none !important;
    background: var(--cr-accent, #c8783a) !important;
    color: #fff !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(200, 120, 58, 0.45) !important;
    transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease !important;
    z-index: 2 !important;
    line-height: 1 !important;
    font-size: 0 !important;   /* hide any leftover text */
    white-space: nowrap !important;
}

.hero-search-form button.hero-search-btn-icon svg,
.hero-search-btn-icon svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    flex-shrink: 0 !important;
}

.hero-search-form button.hero-search-btn-icon:hover,
.hero-search-btn-icon:hover {
    background: var(--cr-accent-dark, #a85e27) !important;
    box-shadow: 0 6px 20px rgba(200, 120, 58, 0.55) !important;
    transform: translateY(-50%) scale(1.05) !important;
}

.hero-search-form button.hero-search-btn-icon:active,
.hero-search-btn-icon:active {
    transform: translateY(-50%) scale(0.97) !important;
    box-shadow: 0 2px 8px rgba(200, 120, 58, 0.35) !important;
}

/* 5 — Mobile */
@media (max-width: 480px) {
    .hero-search-input {
        height: 52px !important;
        padding-right: 64px !important;
    }
    .hero-search-form button.hero-search-btn-icon,
    .hero-search-btn-icon {
        width: 42px !important;
        height: 42px !important;
        right: 5px !important;
    }
}


/* ── 13. RELATED RECIPES — THUMBNAIL FIX + RESPONSIVE ───────── */

/*
 * BUG: style.css uses height:0 + padding-top:100% on .recipe-card-image.
 * When the img inside uses height:100%, it computes 100% of the content
 * height (0px) — not the padding — so the image renders invisible.
 *
 * FIX: switch to aspect-ratio:1/1 so the container has a real height,
 * then use inset:0 on the img to fill it correctly.
 */
.related-recipes .recipe-card-image {
    position: relative !important;
    aspect-ratio: 1 / 1 !important;
    padding-top: 0 !important;
    height: auto !important;
    overflow: hidden !important;
    background: #f0f0f0 !important;
}

.related-recipes .recipe-card-image a {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.related-recipes .recipe-card-image img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* Related recipes grid — 3 columns on desktop, 1 on mobile */
.related-recipes .recipes-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem !important;
}

@media (max-width: 640px) {
    .related-recipes .recipes-grid {
        grid-template-columns: 1fr !important;
    }

    /* On mobile show related posts as horizontal rows, not tall cards */
    .related-recipes .recipe-card {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.75rem !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        background: #fff !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important;
    }

    .related-recipes .recipe-card-image {
        flex-shrink: 0 !important;
        width: 90px !important;
        height: 90px !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: 8px !important;
    }

    .related-recipes .recipe-card-content {
        padding: 0.5rem 0.5rem 0.5rem 0 !important;
    }

    .related-recipes .recipe-card-title {
        font-size: 0.9rem !important;
        -webkit-line-clamp: 2 !important;
    }

    .related-recipes .recipe-excerpt {
        display: none !important;
    }
}

/* ── 14. SIDEBAR — RESPONSIVE FIX ───────────────────────────── */

/* Desktop: ensure sidebar stays on the side (already handled by style.css grid)
   just tighten widget padding so it doesn't tower */
@media (min-width: 768px) {
    .sidebar.single-sidebar .widget {
        padding: 1.25rem !important;
        margin-bottom: 1.25rem !important;
    }
}

/* Mobile: sidebar drops below content — make widgets compact and readable */
@media (max-width: 767px) {
    .sidebar.single-sidebar {
        margin-top: 2rem;
    }

    .sidebar.single-sidebar .widget {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 10px !important;
    }

    .sidebar.single-sidebar .widget-title {
        font-size: 0.95rem !important;
        margin-bottom: 0.85rem !important;
    }

    /* YMAAL widget: switch from 2-col square grid to compact horizontal list */
    .cozy-ymaal-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
    }

    .cozy-ymaal-card {
        flex-direction: row !important;
        align-items: center !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important;
    }

    /* Square thumbnail, fixed small size */
    .cozy-ymaal-card-img {
        flex-shrink: 0 !important;
        width: 72px !important;
        height: 72px !important;
        padding-top: 0 !important;       /* override the padding-top:100% hack */
        position: relative !important;
    }

    .cozy-ymaal-card-img img {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .cozy-ymaal-card-body {
        padding: 0.4rem 0.6rem !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    .cozy-ymaal-card-title {
        font-size: 0.8rem !important;
        -webkit-line-clamp: 2 !important;
    }

    .cozy-ymaal-card-cat {
        display: none !important;   /* hide badge in list view — too crowded */
    }
}

/* Desktop YMAAL: fix the same height:0 + padding-top issue for the widget */
@media (min-width: 768px) {
    .cozy-ymaal-card-img {
        position: relative;
        aspect-ratio: 1 / 1;
        padding-top: 0 !important;
        height: auto !important;
        overflow: hidden;
    }

    .cozy-ymaal-card-img img {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
}

/* ── 15. DROPDOWN / SUBMENU STABILITY FIX ───────────────────── */

/*
 * Problems in style.css:
 *  1. sub-menu has margin-top:0.5rem — creates a physical gap between the
 *     parent link and the dropdown. Moving the mouse across that gap leaves
 *     li:hover → menu closes immediately.
 *  2. display:none / display:flex toggle — no delay, any micro-movement
 *     outside the li kills the menu at once.
 *  3. Nested sub-menu has margin-left:0.5rem — same gap bug horizontally.
 *
 * Fix:
 *  - Replace margin with padding (padding is still inside the element,
 *    so the mouse hovering there keeps li:hover active).
 *  - Switch to opacity + visibility with a transition so there is a short
 *    grace period (120ms) before the menu actually disappears.
 *  - Extend the li's clickable zone downward with a ::after pseudo-element
 *    that bridges the remaining pixel-gap between link bottom and menu top.
 */

/* Always render as flex, control visibility via opacity + visibility */
.main-navigation .sub-menu {
    display: flex !important;           /* stay in DOM — no layout cost (absolute) */
    flex-direction: column !important;
    margin-top: 0 !important;           /* kill the gap — padding takes its place */
    padding-top: 10px !important;       /* transparent hover-safe bridge */
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.18s ease,
                visibility 0.18s ease !important;
    /* keep all other positioning from style.css */
}

/* Show on hover */
.main-navigation li:hover > .sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Bridge pseudo-element on the parent li — extends hit-area
   down into the padding zone of the sub-menu */
.main-navigation li.menu-item-has-children {
    padding-bottom: 0 !important;
}

.main-navigation li.menu-item-has-children::after {
    content: '';
    position: absolute;
    bottom: -10px;          /* matches sub-menu padding-top */
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
    pointer-events: auto;   /* mouse over this keeps li:hover alive */
}

/* Nested (fly-out) sub-menu — same fix for the horizontal gap */
.main-navigation .sub-menu .sub-menu {
    margin-left: 0 !important;         /* kill horizontal gap */
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-left: 6px !important;      /* transparent horizontal bridge */
    left: calc(100% + 0px) !important;
    top: -10px !important;             /* align with first item, not top of padding */
}

/* Hover lift on sub-menu items — subtle UX polish */
.main-navigation .sub-menu a {
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease !important;
}

.main-navigation .sub-menu a:hover {
    padding-left: 1.5rem !important;
}
