.mega-menu {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    justify-content: flex-start !important;
}

.recipe-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    @media (max-width: 1024px) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    @media (max-width: 768px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    @media (max-width: 480px) {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    & article {
        height: 100%;
    }

    & .post-card-1 {
        display: flex;
        flex-direction: column;
        height: 100%;

        &::before {
            left: 0px;
            right: 0px;
        }

        & .post-content {
            flex: 1;

            & .post-title {
                & a {
                    font-size: 16px;
                }
            }
        }
    }
}

/* Recipe card component */
.recipe-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.recipe-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.recipe-card__image {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #e5e7eb;
}

.recipe-card__image a {
    display: block;
}

.recipe-card__image img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.recipe-card:hover .recipe-card__image img {
    transform: scale(1.03);
}

.recipe-card__category {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.recipe-card__category:hover {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

.recipe-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1rem 1.25rem;
}

.recipe-card__title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.4rem;
}

.recipe-card__title a {
    color: #0f172a;
    text-decoration: none;
}

.recipe-card__title a:hover {
    color: #ff847c;
}

.recipe-card__desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.recipe-card__footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.7rem;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    padding: 0.65rem 1.25rem;
    margin-top: auto;
}

.recipe-card__footer i {
    color: #ff847c;
    margin-right: 4px;
}

.post-card-1 .top-left-icon {
    width: auto;
    height: auto;
    border-radius: 4px;
    line-height: 1;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;

    & a {
        color: #fff;
        text-decoration: none;
    }
}

hr {
    &.section-divider {
        height: 2px !important;
    }
}

.ingredients {
    & h2 {
        margin-top: 0px !important;
    }

    & .amount {
        display: inline-flex;
        gap: 20px;
        background: #eee;
        border-radius: 10px;
        margin-bottom: 20px;
        padding: 10px 15px;
        width: fit-content;

        & .text {
            display: inline-flex;
            align-items: center;
            gap: 10px;

            & .amount-of-people {
                background: #eee;
                width: 60px;
                border-radius: 5px;
                border: none;
                padding-left: 10px;
                text-align: right;
            }
        }

        & .counter {
            display: inline-flex;
            gap: 5px;

            & .counter-button {
                display: flex;
                align-items: center;
                justify-content: center;
                background: #ddd;
                width: 25px;
                height: 25px;
                padding: 0;
                border: none;
                border-radius: 45px;
                color: inherit;
                cursor: pointer;

                &:hover {
                    background: #eee;
                    transition: background 0.3s ease;
                }

                & i {
                    font-size: medium;
                }
            }
        }
    }

    & ul {
        list-style-type: none !important;
        padding: 0;

        & li {
            list-style-type: none !important;
        }
    }

    & .ingredient {
        display: block;
        position: relative;
        padding-left: 45px;
        margin-bottom: 12px;
        cursor: pointer;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        width: fit-content;

        & input {
            position: absolute;
            opacity: 0;
            cursor: pointer;
            height: 0;
            width: 0;

            &:checked {
                & ~ .checkmark {
                    background-color: #ff847c;

                    &::after {
                        display: block;
                    }
                }

                & ~ .text {
                    text-decoration: line-through;
                }
            }
        }

        & .checkmark {
            position: absolute;
            top: 4px;
            left: 0;
            height: 25px;
            width: 25px;
            background-color: #eee;

            &::after {
                content: "";
                position: absolute;
                display: none;
                left: 9px;
                top: 5px;
                width: 7px;
                height: 13px;
                border: solid white;
                border-width: 0 3px 3px 0;
                -webkit-transform: rotate(45deg);
                -ms-transform: rotate(45deg);
                transform: rotate(45deg);
            }
        }
    }
}

.pagination-area {
    .page-item.active {
        .page-link {
            background: #ff847c !important;
        }
    }
}

#scrollUp {
    background: #ff847c !important;
}

.preparation-method-number {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ff847c;
    border-radius: 2px;
    width: 30px;
    height: 30px;
    color: white;
    font-size: 1em;
    margin-right: 20px;
    flex: none;
}

/* As wide as the text column below it, not the whole container: at full
   container width a 3:2 photo filled more than the screen. The ratio matches
   the frame the recipe_detail_image filter produces; the height cap only
   trims a little off the top and bottom on wide screens. */
.full-width-image {
    display: block;
    width: 100%;
    /* The width/height attributes only reserve space; the ratio rules. */
    height: auto;
    max-width: 800px;
    max-height: min(480px, 60vh);
    margin: 0 auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

/* ------------------------------------------------------- recipe detail --- */

.recipe-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0;
    padding: 0;
    list-style: none;

    & i {
        margin-right: 4px;
    }
}

.recipe-print {
    margin-left: 6px;
    padding: 4px 12px;
    border: 1px solid #ddd;
    border-radius: 30px;
    background: none;
    color: inherit;
    font-size: 13px;
    cursor: pointer;

    &:hover {
        border-color: #ff847c;
    }
}

.header-social-network .list-inline-item a.wa {
    background: #25d366;
}

.recipe-steps__hint {
    font-size: 14px;
    color: #888;
}

.recipe-steps {
    margin: 0;
    padding: 0;

    /* The theme numbers every "ol li"; the coral block already shows the number. */
    & > li {
        list-style: none;
    }
}

/* The whole step is the click target; a ticked step fades so the cook can
   see at a glance where they are. */
.recipe-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    cursor: pointer;

    & .recipe-step__check {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    & .recipe-step__text {
        transition: opacity 0.2s ease;
    }

    & .recipe-step__check:checked ~ .preparation-method-number {
        background: #bbb;
    }

    & .recipe-step__check:checked ~ .recipe-step__text {
        opacity: 0.45;
        text-decoration: line-through;
    }

    & .recipe-step__check:focus-visible ~ .preparation-method-number {
        outline: 2px solid #ff847c;
        outline-offset: 2px;
    }
}

.print-only {
    display: none;
}

/* ------------------------------------------------- filters and search --- */

.recipe-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;

    & .recipe-filters__field {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 160px;
        font-size: 14px;
    }

    & .recipe-filters__reset {
        align-self: center;
        font-size: 14px;
    }
}

/* Doubled class: app.css loads before Bootstrap, whose .btn would win otherwise. */
.btn.btn-coral,
.btn.recipe-filters__submit {
    background: #ff847c;
    color: #fff;
    border-radius: 6px;

    &:hover {
        background: #e46a62;
        color: #fff;
    }
}

/* -------------------------------------------------------------- print --- */

/* A recipe card for the kitchen counter: title and summary, a small photo
   beside the intro, then ingredients and steps side by side. Ink-friendly:
   no backgrounds, one accent line, black text. */
@media print {
    @page {
        size: A4;
        margin: 14mm 14mm 16mm;
    }

    /* "html body" outranks Bootstrap's display utilities such as .d-md-inline. */
    html body .rl-header,
    html body footer,
    html body .dark-mark,
    html body .scroll-progress,
    html body .preloader,
    html body #scrollUp,
    html body .no-print,
    html body .entry-header .row,
    html body .section-divider {
        display: none !important;
    }

    html,
    body,
    main,
    .bg-grey,
    .single-content,
    .single-content article,
    .entry-main-content {
        background: #fff !important;
        color: #000 !important;
    }

    body {
        font-size: 10.5pt;
        line-height: 1.45;
    }

    html body main.bg-grey {
        padding: 0 !important;
    }

    /* Title and summary on the left, the photo on the right, the recipe
       itself below at full width. */
    .single-content {
        display: grid !important;
        grid-template-columns: 1fr 55mm;
        /* The second row absorbs the photo's extra height, so the summary
           stays right under the title. */
        grid-template-rows: auto 1fr;
        column-gap: 8mm;
        max-width: none !important;
        padding: 0 !important;
    }

    .single-content > .entry-header {
        grid-column: 1;
        grid-row: 1;
    }

    .single-content > .print-summary {
        grid-column: 1;
        grid-row: 2;
    }

    .single-content > figure.image {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: center;
    }

    html body .single-content > article {
        grid-column: 1 / -1;
        margin: 4mm 0 0 !important;
        padding-top: 4mm;
        border-top: 1.5pt solid #ff847c;
    }

    /* wow.js hides elements until they scroll into view. */
    .wow {
        visibility: visible !important;
        animation: none !important;
    }

    .print-only {
        display: block;
    }

    /* --- Header --- */

    /* "html body" again: the theme's spacing utilities (.mb-50, .pt-50) are
       !important too and load later. */
    html body .entry-header {
        margin: 0 !important;
        padding: 0 !important;
    }

    html body .entry-title {
        margin: 0 !important;
        font-size: 22pt !important;
        line-height: 1.15 !important;
    }

    .print-summary {
        margin: 1mm 0 0;
        font-size: 10pt;
        color: #444 !important;
    }

    figure.image {
        width: 55mm;
        margin: 0 !important;
    }

    .full-width-image {
        width: 100%;
        max-width: none;
        max-height: none;
        border-radius: 3mm !important;
    }

    .recipe-intro {
        grid-column: 1 / -1;
        margin-bottom: 5mm;
        color: #222 !important;
    }

    /* --- Ingredients and method in two columns --- */

    .entry-main-content {
        display: grid;
        grid-template-columns: 62mm 1fr;
        column-gap: 8mm;
    }

    .entry-main-content h2 {
        margin: 0 0 3mm !important;
        font-size: 13pt !important;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .ingredients ul {
        margin: 0;
    }

    /* Empty boxes to tick off with a pen. */
    .ingredients .ingredient {
        padding-left: 6.5mm;
        margin-bottom: 1.6mm;
        line-height: 1.35;
    }

    .ingredients .ingredient .checkmark {
        top: 0.8mm;
        width: 3.2mm;
        height: 3.2mm;
        border: 0.8pt solid #888;
        border-radius: 0.6mm;
        background: none !important;
    }

    .ingredients .ingredient .checkmark::after {
        display: none !important;
    }

    .ingredients .ingredient .checkbox:checked ~ .text {
        text-decoration: none !important;
        opacity: 1 !important;
    }

    .recipe-step {
        margin-bottom: 3mm;
        break-inside: avoid;
    }

    .recipe-step .preparation-method-number,
    .recipe-step .recipe-step__check:checked ~ .preparation-method-number {
        width: 6mm;
        height: 6mm;
        margin-right: 3mm;
        border: 1pt solid #ff847c;
        border-radius: 50%;
        background: none;
        color: #000;
        font-size: 9pt;
        font-weight: 700;
    }

    .recipe-step .recipe-step__check:checked ~ .recipe-step__text {
        opacity: 1;
        text-decoration: none;
    }

    /* Editor HTML in intro, ingredients and steps carries the theme's
       screen font sizes; on paper everything reads at one size. */
    .recipe-intro,
    .recipe-intro *,
    .ingredients .text,
    .ingredients .text *,
    .recipe-step__text,
    .recipe-step__text * {
        font-size: 10.5pt !important;
        line-height: 1.45 !important;
    }

    .ingredients li {
        break-inside: avoid;
    }

    /* --- Source line --- */

    .print-source {
        grid-column: 1 / -1;
        margin-top: 8mm;
        padding-top: 2mm;
        border-top: 0.5pt solid #ccc;
        font-size: 8.5pt;
        color: #666 !important;
    }
}
