/* Customizations\IngredientFinder: "Evdeki malzemeleri seç" on the front page
   and the "Malzemeler" page. Colours from the theme's --gt-* variables. */

.yt-if {
    --yt-if-primary: var(--gt-theme-primary, #ff4400);
    --yt-if-text: var(--gt-text-color-primary, #162a28);
    --yt-if-muted: var(--gt-text-color-secondary, #6b6b6b);
    --yt-if-border: color-mix(in srgb, var(--gt-text-color-primary, #162a28) 12%, transparent);
    --yt-if-tint: var(--yt-surface, #fff2ea);
    color: var(--yt-if-text);
    text-align: center;
}

.yt-if-head {
    margin-bottom: 2.25rem;
}

/* On the front page the head is HomeSections' (yt-home-head / yt-home-title). */
.yt-if-page .yt-if-title {
    margin: 0 0 .75rem;
    font-family: hardcover-vf, Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    line-height: 1.25;
}

.yt-if-text {
    max-width: 640px;
    margin: 0 auto;
    color: var(--yt-if-muted);
}

/* Ingredient cards */

.yt-if-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.yt-if-cards > li {
    width: 112px;
    margin: 0;
}

.yt-if .yt-if-card,
.yt-if .yt-if-card:hover,
.yt-if .yt-if-card:focus {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
    height: auto;
    min-height: 0;
    box-shadow: none;
    cursor: pointer;
}

.yt-if-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.yt-if-card-box {
    position: relative;
    display: grid;
    place-items: center;
    width: 112px;
    aspect-ratio: 1;
    border: 1px solid var(--yt-if-border);
    border-radius: 22px;
    background: #fff;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.yt-if-card:hover .yt-if-card-box {
    border-color: var(--yt-if-primary);
    transform: translateY(-2px);
}

.yt-if-card input:focus-visible + .yt-if-card-box,
.yt-if-card--add:focus-visible .yt-if-card-box {
    outline: 2px solid var(--yt-if-primary);
    outline-offset: 3px;
}

.yt-if-card input:checked + .yt-if-card-box {
    border-color: var(--yt-if-primary);
    background: var(--yt-if-tint);
    box-shadow: 0 0 0 2px var(--yt-if-primary);
}

.yt-if-icon {
    display: block;
    width: 62px;
    height: 62px;
    color: var(--yt-if-primary);
}

.yt-if-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.yt-if-icon .b {
    fill: currentColor;
    fill-opacity: .14;
}

.yt-if-icon .d {
    fill: currentColor;
    stroke: none;
}

/* The round "+" on the card's lower edge; a tick when ticked. */
.yt-if-plus {
    position: absolute;
    bottom: -15px;
    left: 50%;
    width: 30px;
    height: 30px;
    margin-left: -15px;
    border: 1px solid var(--yt-if-border);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    transition: background-color .15s ease, border-color .15s ease;
}

.yt-if-plus::before,
.yt-if-plus::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    margin: -1px 0 0 -6px;
    border-radius: 2px;
    background: var(--yt-if-muted);
}

.yt-if-plus::after {
    transform: rotate(90deg);
}

.yt-if-card input:checked + .yt-if-card-box .yt-if-plus {
    border-color: var(--yt-if-primary);
    background: var(--yt-if-primary);
}

.yt-if-card input:checked + .yt-if-card-box .yt-if-plus::before,
.yt-if-card input:checked + .yt-if-card-box .yt-if-plus::after {
    background: #fff;
}

.yt-if-card input:checked + .yt-if-card-box .yt-if-plus::before {
    width: 6px;
    margin: 1px 0 0 -5px;
    transform: rotate(45deg);
}

.yt-if-card input:checked + .yt-if-card-box .yt-if-plus::after {
    width: 11px;
    margin: -1px 0 0 -2px;
    transform: rotate(-50deg);
}

.yt-if .yt-if-card-name {
    color: var(--yt-if-text);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    font-size: .9375rem;
    line-height: 1.3;
}

/* "Malzeme ekle": a tinted box with a large plus in the middle. */
.yt-if-card--add .yt-if-card-box {
    border-style: dashed;
    background: var(--yt-if-tint);
}

.yt-if-card--add .yt-if-plus {
    position: relative;
    bottom: auto;
    left: auto;
    width: 46px;
    height: 46px;
    margin: 0;
}

.yt-if-card--add .yt-if-plus::before,
.yt-if-card--add .yt-if-plus::after {
    width: 18px;
    margin-left: -9px;
    background: var(--yt-if-primary);
}

/* Chips of the other ingredients (Malzemeler page) */

.yt-if-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.yt-if-chips[hidden] {
    display: none;
}

.yt-if .yt-if-chip {
    color: var(--yt-if-text);
    text-transform: none;
    letter-spacing: normal;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: .4rem .6rem .4rem 1rem;
    border: 1px solid var(--yt-if-primary);
    border-radius: 999px;
    background: var(--yt-if-tint);
    font-weight: 600;
    font-size: .9375rem;
    cursor: pointer;
}

.yt-if-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.yt-if-chip-x {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    color: var(--yt-if-primary);
    line-height: 1;
}

.yt-if-chip:has(input:not(:checked)) {
    border-color: var(--yt-if-border);
    background: #fff;
    text-decoration: line-through;
    opacity: .6;
}

.yt-if-chip:has(input:focus-visible) {
    outline: 2px solid var(--yt-if-primary);
    outline-offset: 2px;
}

/* Search */

.yt-if-search {
    max-width: 480px;
    margin: 2rem auto 0;
    text-align: left;
}

.yt-if .yt-if-search > label {
    display: block;
    color: var(--yt-if-text);
    font-size: .9375rem;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: .4rem;
    font-weight: 600;
}

.yt-if-search-field {
    position: relative;
    display: flex;
    gap: .5rem;
}

.yt-if .yt-if-search input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 1rem;
    border: 1px solid var(--yt-if-border);
    border-radius: 999px;
    background: #fff;
    font: inherit;
}

.yt-if .yt-if-search input[type="text"]:focus {
    border-color: var(--yt-if-primary);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--yt-if-primary) 15%, transparent);
}

.yt-if .yt-if-search-add {
    height: 48px;
    padding: 0 1.25rem;
    border: 1px solid var(--yt-if-primary);
    border-radius: 999px;
    background: #fff;
    color: var(--yt-if-primary);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

.yt-if-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: .35rem;
    border: 1px solid var(--yt-if-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .1);
    list-style: none;
}

.yt-if-suggestions[hidden] {
    display: none;
}

.yt-if-suggestions li {
    margin: 0;
    padding: .55rem .85rem;
    border-radius: 10px;
    cursor: pointer;
}

.yt-if-suggestions li[aria-selected="true"],
.yt-if-suggestions li:hover {
    background: var(--yt-if-tint);
}

.yt-if-suggestions li.yt-if-suggestion-empty {
    color: var(--yt-if-muted);
    cursor: default;
    background: none;
}

/* Mode: missing ingredients allowed / only what is at hand (segmented switch) */

.yt-if-mode {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 2.25rem auto 0;
    padding: 4px;
    border: 1px solid var(--yt-if-border);
    border-radius: 999px;
    background: #fff;
}

/* The dark pill behind the chosen option; both options are one width, so
   it slides by its own width (+ the gap) to the second one. */
.yt-if-mode::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 6px);
    border-radius: 999px;
    background: var(--yt-brand-green, #162a28);
    transition: transform .35s cubic-bezier(.65, 0, .35, 1);
}

.yt-if-mode:has(label:last-of-type input:checked)::before {
    transform: translateX(calc(100% + 4px));
}

.yt-if .yt-if-mode label {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--yt-if-text);
    font-size: .9375rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.yt-if-mode input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.yt-if-mode span {
    display: block;
    flex: 1;
    padding: .55rem 1.1rem;
    border-radius: 999px;
    text-align: center;
    white-space: nowrap;
    transition: color .25s ease;
}

.yt-if-mode label:hover span {
    color: var(--yt-if-primary);
}

.yt-if-mode input:checked + span,
.yt-if-mode label:hover input:checked + span {
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .yt-if-mode::before,
    .yt-if-mode span {
        transition: none;
    }
}

.yt-if-mode input:focus-visible + span {
    outline: 2px solid var(--yt-if-primary);
    outline-offset: 2px;
}

@media (max-width: 479.98px) {
    .yt-if-mode span {
        padding: .5rem .8rem;
        font-size: .875rem;
    }
}

/* Submit */

.yt-if-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1.25rem;
}

.yt-if .yt-if-submit {
    min-width: 220px;
    height: 56px;
    padding: 0 2rem;
    border: 0;
    border-radius: 999px;
    background: var(--yt-if-primary);
    color: #fff;
    font-size: 1.0625rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.yt-if .yt-if-submit:hover {
    filter: brightness(.95);
}

.yt-if .yt-if-submit:focus-visible {
    outline: 2px solid var(--yt-if-text);
    outline-offset: 2px;
}

.yt-if-note {
    margin: .85rem 0 0;
    color: var(--yt-if-muted);
    font-size: .875rem;
}

.yt-if-hint {
    margin: .85rem 0 0;
    color: var(--yt-if-primary);
    font-weight: 600;
}

/* Malzemeler page */

.yt-if-page {
    /* The site's container (--yt-container, child style.css); the page
       itself is full width (container-full). */
    max-width: var(--yt-container, 1320px);
    margin: 0 auto 3rem;
    padding: 0 12px;
}

.yt-if-all-title,
.yt-if-results-title {
    margin: 3.5rem 0 .5rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 400;
    text-align: center;
}

.yt-if-results {
    scroll-margin-top: 120px;
}

.yt-if-results-head {
    margin-bottom: 2rem;
    text-align: center;
}

.yt-if-results-count {
    margin: 0;
    color: var(--gt-text-color-secondary, #6b6b6b);
}

.yt-if-result {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.yt-if-missing {
    order: 2;
    margin: .5rem 0 0;
    padding: .45rem .8rem;
    border-radius: 12px;
    background: var(--yt-surface, #fff2ea);
    color: var(--gt-text-color-primary, #162a28);
    font-size: .875rem;
    line-height: 1.4;
}

.yt-if-missing strong {
    color: var(--gt-theme-primary, #ff4400);
}

.yt-if-missing--none {
    background: #e6f3ea;
    color: #1f5c3a;
    font-weight: 600;
}

.yt-if-pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
    margin-top: 2.5rem;
}

.yt-if-pages .page-numbers {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    padding: 0 .85rem;
    border: 1px solid color-mix(in srgb, var(--gt-text-color-primary, #162a28) 12%, transparent);
    border-radius: 999px;
    background: #fff;
    color: inherit;
    text-decoration: none;
}

.yt-if-pages .page-numbers.current,
.yt-if-pages a.page-numbers:hover {
    border-color: var(--gt-theme-primary, #ff4400);
    color: var(--gt-theme-primary, #ff4400);
}

/* Malzemeler page: the 18 cards in two rows of nine. */
@media (min-width: 992px) {
    .yt-if-page .yt-if-cards {
        gap: 1.5rem 1rem;
    }

    .yt-if-page .yt-if-cards > li,
    .yt-if-page .yt-if-card-box {
        width: 104px;
    }

    .yt-if-page .yt-if-icon {
        width: 56px;
        height: 56px;
    }
}

/* Phones: the front page cards scroll sideways like the other sections. */
@media (max-width: 767.98px) {
    .yt-if-cards > li,
    .yt-if-card-box {
        width: 92px;
    }

    .yt-if-icon {
        width: 50px;
        height: 50px;
    }

    .yt-if-home .yt-if-cards {
        flex-wrap: nowrap;
        justify-content: flex-start;
        /* The page's 12px gutter, like the category strip: the first card
           started at the screen edge. */
        margin: 0 -12px;
        padding: 4px 12px 6px;
        /* Whole cards only: --yt-if-visible cards fill the strip and every
           swipe stops on a card edge, so no card is cut in half. */
        --yt-if-visible: 4;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 12px;
        scrollbar-width: none;
    }

    .yt-if-home .yt-if-cards::-webkit-scrollbar {
        display: none;
    }

    /* A soft fade on the right edge while more cards follow (class set by
       ingredient-finder.js, dropped at the end of the strip). */
    .yt-if-home .yt-if-cards--more {
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), rgba(0, 0, 0, .15));
        mask-image: linear-gradient(to right, #000 calc(100% - 56px), rgba(0, 0, 0, .15));
    }

    .yt-if-home .yt-if-cards > li {
        flex: none;
        width: calc((100% - (var(--yt-if-visible) - 1) * 12px) / var(--yt-if-visible));
        scroll-snap-align: start;
    }

    .yt-if-home .yt-if-card-box {
        width: 100%;
    }

    .yt-if-page .yt-if-cards {
        gap: 1.4rem .75rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .yt-if-home .yt-if-cards {
        --yt-if-visible: 5;
    }
}
