/* ==========================================================================
   «Рецепти» — list (search, filters, grid) and a recipe page
   ========================================================================== */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.recipes { padding-top: 0; }

/* ---- search & filters ------------------------------------------------------------------- */

.recipe-filters {
    display: grid;
    gap: 1rem;
    margin-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}
.recipe-filters fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

.recipe-search { position: relative; max-width: 720px; width: 100%; margin-inline: auto; }
.recipe-search__icon {
    position: absolute;
    top: 50%;
    left: 1.25rem;
    width: 20px;
    height: 20px;
    translate: 0 -50%;
    color: var(--muted);
    pointer-events: none;
}
.recipe-search__input {
    width: 100%;
    min-height: 56px;
    padding: .9rem 3.25rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;           /* 16px: no zoom-on-focus on iOS */
    box-shadow: var(--shadow-sm);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    -webkit-appearance: none;
    appearance: none;
}
.recipe-search__input::-webkit-search-cancel-button { display: none; }
.recipe-search__input::placeholder { color: var(--muted); }
.recipe-search__input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-sm);
}
.recipe-search__clear {
    position: absolute;
    top: 50%;
    right: .5rem;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    translate: 0 -50%;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.recipe-search__clear:hover { background: var(--surface-2); color: var(--ink); }
.recipe-search__clear .icon { width: 18px; height: 18px; }

/* chips: real radios / checkboxes, so they work with the keyboard and without JS */
.chip-row {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .25rem var(--gutter);
    margin-inline: calc(var(--gutter) * -1);
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
}
.chip-row::-webkit-scrollbar { display: none; }
@media (min-width: 961px) {
    .chip-row { flex-wrap: wrap; justify-content: center; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}
.chip-wrap { display: flex; flex-wrap: wrap; gap: .5rem; }

.chip { position: relative; flex: 0 0 auto; scroll-snap-align: start; cursor: pointer; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 44px;
    padding: .5rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip .icon { width: 18px; height: 18px; }
@media (hover: hover) {
    .chip:hover span { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--ink); }
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
/* "без: алерген": a dashed border and an ✕ even before it's chosen, so it never reads as "contains" */
.chip--exclude span { border-style: dashed; }
.chip--exclude .chip__x { width: 14px; height: 14px; color: #A3434C; }
.chip--exclude input:checked + span .chip__x { color: inherit; }
.chip--exclude input:checked + span { background: var(--blush-100); border-color: #C77A82; color: #8E3640; }
.chip--exclude input:checked + span { text-decoration: line-through; text-decoration-thickness: 1.5px; }

.recipe-filters__more { justify-self: center; width: 100%; text-align: center; }
.recipe-filters__more > summary { list-style: none; }
.recipe-filters__more > summary::-webkit-details-marker { display: none; }
.recipe-filters__more[open] > summary { --btn-border: var(--accent); --btn-fg: var(--accent); }
.recipe-filters__count {
    display: inline-grid;
    place-items: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding-inline: .35rem;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: var(--fs-xs);
}
.recipe-filters__panel {
    display: grid;
    gap: 1.25rem;
    margin-top: 1rem;
    padding: clamp(1rem, .8rem + 1vw, 1.5rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
}
@media (min-width: 961px) { .recipe-filters__panel { grid-template-columns: 1fr 1.4fr; } }
.recipe-filters__panel legend { margin-bottom: .6rem; font-weight: 700; }
.recipe-filters__hint { margin: -.4rem 0 .6rem; color: var(--muted); font-size: var(--fs-sm); }

.recipe-filters__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1.25rem; }
.recipe-filters__found { color: var(--muted); font-size: var(--fs-sm); }
.recipe-filters__found strong { color: var(--ink); }
.recipe-filters__reset {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 44px;
    color: var(--accent-text);
    font-size: var(--fs-sm);
    font-weight: 600;
}
.recipe-filters__reset .icon { width: 16px; height: 16px; }

/* ---- grid & cards --------------------------------------------------------------------- */

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: clamp(.75rem, .5rem + 1vw, 1.5rem);
}
@media (max-width: 640px) { .recipe-grid { grid-template-columns: 1fr 1fr; } }
.recipe-grid--compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); margin-top: 2rem; }
@media (min-width: 1101px) { .recipe-grid--compact { grid-template-columns: repeat(5, minmax(0, 1fr)); } }   /* 5 in a row */

.recipe-card { min-width: 0; }
.recipe-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .5s var(--ease), transform var(--dur) var(--ease-out), border-color var(--dur);
}
@media (hover: hover) {
    .recipe-card__link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
    .recipe-card__link:hover img { scale: 1.04; }
}
.recipe-card__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.recipe-card__media { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--surface-2); }
.recipe-card__media img { width: 100%; height: 100%; object-fit: cover; transition: scale .6s var(--ease-out); }
.recipe-card__play {
    position: absolute;
    right: .6rem;
    bottom: .6rem;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: var(--accent-strong);
    box-shadow: var(--shadow-sm);
}
.recipe-card__play .icon { width: 16px; height: 16px; translate: 1px 0; fill: currentColor; }
.recipe-card__body { display: flex; flex: 1; flex-direction: column; gap: .4rem; padding: .9rem 1rem 1rem; }
.recipe-card__category { color: var(--accent-text); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.recipe-card__title { font-family: var(--font-display); font-size: clamp(1.2rem, 1.05rem + .5vw, 1.45rem); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.recipe-card__meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: auto; padding-top: .3rem; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.recipe-card__meta > span { display: inline-flex; align-items: center; gap: .3rem; }
.recipe-card__meta .icon { width: 14px; height: 14px; }
.recipe-card__tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.recipe-card__tags .tag { padding: .2rem .55rem; font-size: .75rem; letter-spacing: .03em; }
@media (max-width: 640px) {
    .recipe-card__body { padding: .7rem .75rem .8rem; }
    .recipe-card__tags { display: none; }
}

.recipe-empty { display: grid; justify-items: center; gap: .5rem; padding: 3rem 1rem; color: var(--ink-soft); text-align: center; }
.recipe-empty > .icon { width: 40px; height: 40px; color: var(--muted); }
.recipe-empty__title { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 600; color: var(--ink); }
.recipe-empty .btn { margin-top: .5rem; }

/* ---- recipe page ---------------------------------------------------------------------- */

.recipe { padding-block: clamp(1.25rem, 1rem + 1.5vw, 2.5rem) var(--section-y); }
.recipe__crumbs { margin-bottom: .75rem; }
.recipe__crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.recipe__crumbs li { display: inline-flex; align-items: center; gap: .35rem; }
.recipe__crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.recipe__crumbs .icon { width: 14px; height: 14px; }

.recipe__layout {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    gap: clamp(1.5rem, 1rem + 3vw, 4rem);
    align-items: start;
}
.recipe__media { position: sticky; top: calc(var(--header-h) + 1rem); display: grid; gap: .75rem; }

/* video player: the poster with one big play button; while playing, a bar that hides itself */
.player {
    position: relative;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--green-900);
    box-shadow: var(--shadow-lg);
    isolation: isolate;
}
.player__video { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; }
.player__big, .player__bar { display: none; }

.player.is-ready .player__video { cursor: pointer; }
.player.is-ready .player__big {
    position: absolute;
    inset: 50% auto auto 50%;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    translate: -50% -50%;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--accent-strong);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    cursor: pointer;
    transition: opacity .3s var(--ease), scale .3s var(--ease-out);
}
.player__big .icon { width: 30px; height: 30px; translate: 2px 0; fill: currentColor; }
@media (hover: hover) { .player.is-ready .player__big:hover { scale: 1.08; } }
.player.is-playing .player__big { opacity: 0; scale: .8; pointer-events: none; }

.player.is-ready .player__bar {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 .15rem;
    padding: 3rem .5rem .35rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, .65));
    color: #fff;
    transition: opacity .3s var(--ease), translate .3s var(--ease);
}
.player.is-ready:not(.is-started) .player__bar { opacity: 0; pointer-events: none; }
.player.is-idle .player__bar { opacity: 0; translate: 0 8px; pointer-events: none; }
.player.is-idle .player__video { cursor: none; }

.player__btn {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font: 700 .8125rem var(--font-body);
    cursor: pointer;
}
.player__btn:hover { background: rgba(255, 255, 255, .15); }
.player__btn:focus-visible, .player__big:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.player__btn .icon { width: 20px; height: 20px; }
.player__btn--text { min-width: 48px; border-radius: var(--radius-pill); font-variant-numeric: tabular-nums; }
.player__icon-pause, .player.is-playing .player__icon-play,
.player__icon-muted, .player.is-muted .player__icon-sound { display: none; }
.player.is-playing .player__icon-pause, .player.is-muted .player__icon-muted { display: block; }
.player__icon-exit, .player.is-fullscreen .player__icon-full { display: none; }
.player.is-fullscreen .player__icon-exit { display: block; }
.player__time { flex: 1; min-width: 2.6rem; padding-left: .25rem; text-align: left; font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.player__seek {
    --p: 0%;
    order: -1;
    flex: 1 0 100%;
    min-width: 0;
    height: 28px;
    margin: 0;
    padding-inline: .5rem;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.player__seek::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #fff var(--p), rgba(255, 255, 255, .35) var(--p));
}
.player__seek::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.player__seek::-moz-range-progress { height: 4px; border-radius: 2px; background: #fff; }
.player__seek::-webkit-slider-thumb {
    width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%; background: #fff;
    -webkit-appearance: none; appearance: none; transition: scale .2s;
}
.player__seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.player__seek:hover::-webkit-slider-thumb { scale: 1.25; }
.player__seek:focus-visible { outline: 2px solid #fff; outline-offset: -8px; border-radius: 8px; }

.player.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    overflow: hidden;
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
    box-shadow: none;
}
.player::backdrop { background: #000; }
.player.is-fullscreen .player__video,
.player:fullscreen .player__video { position: relative; z-index: 1; object-fit: contain; background: transparent; }

/* full screen: instead of black bars, the video itself — blown up, blurred and dimmed — fills the sides */
.player__ambient { display: none; }
.player.is-fullscreen .player__ambient,
.player:fullscreen .player__ambient {
    position: absolute;
    inset: -10%;
    display: block;
    width: 120%;
    height: 120%;
    background: var(--poster) center / cover;
    filter: blur(48px) saturate(1.4) brightness(.55);
    transform: translateZ(0);
}
.player:fullscreen { aspect-ratio: auto; border-radius: 0; background: #000; }
.player:fullscreen .player__bar, .player.is-fullscreen .player__bar { z-index: 2; }
.player:fullscreen .player__big, .player.is-fullscreen .player__big { z-index: 2; }
.player.is-fullscreen .player__bar { padding-bottom: max(.35rem, env(safe-area-inset-bottom)); }

.recipe__instagram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 44px;
    color: var(--ink-soft);
    font-size: var(--fs-sm);
    font-weight: 600;
}
.recipe__instagram .icon { width: 18px; height: 18px; }

.recipe__main { display: grid; gap: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem); min-width: 0; }
.recipe__head { display: grid; gap: 1rem; }
.recipe__title { font-family: var(--font-display); font-size: clamp(2.25rem, 1.7rem + 2.6vw, 4rem); font-weight: 600; line-height: 1.02; overflow-wrap: anywhere; }
.recipe__summary { color: var(--ink-soft); font-size: var(--fs-lg); max-width: 60ch; }
.recipe__h2 { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 600; line-height: 1.1; }

.recipe__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .5rem;
    margin: 0;
}
.recipe__facts > div { padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.recipe__facts dt { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.recipe__facts dt .icon { width: 14px; height: 14px; }
.recipe__facts dd { margin: .15rem 0 0; font-weight: 700; }
.recipe__diet { display: flex; flex-wrap: wrap; gap: .4rem; }
.recipe__diet .icon { width: 14px; height: 14px; }

.recipe-allergens {
    display: grid;
    gap: .6rem;
    padding: 1rem 1.25rem;
    border: 1px solid #EBC3C7;
    border-radius: var(--radius);
    background: var(--blush-100);
}
.recipe-allergens--none { border-color: var(--sage-300); background: var(--sage-100); }
.recipe-allergens__title { display: flex; align-items: center; gap: .45rem; font-size: 1rem; font-weight: 700; }
.recipe-allergens__title .icon { width: 18px; height: 18px; color: #A3434C; }
.recipe-allergens--none .recipe-allergens__title .icon { color: var(--green-700); }
.recipe-allergens__list { display: flex; flex-wrap: wrap; gap: .4rem; }
.recipe-allergens__list li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .75rem;
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: #8E3640;
    font-size: var(--fs-sm);
    font-weight: 700;
}
.recipe-allergens__list .icon { width: 16px; height: 16px; }
.recipe-allergens__note { color: var(--ink-soft); font-size: var(--fs-xs); }

.recipe-ingredients,
.recipe-steps { display: grid; gap: .9rem; }
.recipe-ingredients__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.recipe-ingredients__group { margin-top: .4rem; color: var(--accent-text); font-size: var(--fs-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.recipe-ingredients__list { display: grid; border-top: 1px solid var(--line); }
.recipe-ingredients__list li { border-bottom: 1px solid var(--line); }

.servings {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
}
.servings__btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}
.servings__btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-text); }
.servings__btn:disabled { opacity: .35; cursor: default; }
.servings__btn .icon { width: 18px; height: 18px; }
.servings__value { min-width: 6.5rem; font-size: var(--fs-sm); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
html.no-js .servings { display: none; }

.check { display: flex; align-items: flex-start; gap: .75rem; padding: .7rem .25rem; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-top: .12rem;
    border: 1.5px solid color-mix(in srgb, var(--ink) 30%, transparent);
    border-radius: 7px;
    color: transparent;
    transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s;
}
.check__box .icon { width: 14px; height: 14px; stroke-width: 3; }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); color: #fff; }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check__text { line-height: 1.5; transition: color .2s, opacity .2s; }
.check input:checked ~ .check__text { color: var(--muted); text-decoration: line-through; }
.ingredient-amount { font-variant-numeric: tabular-nums; }
.ingredient-note { color: var(--muted); }

.recipe-steps__list { display: grid; gap: .5rem; counter-reset: none; }
.step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: background-color .25s var(--ease), border-color .25s var(--ease);
}
.step__num {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 700;
}
.step__num .icon { position: absolute; width: 18px; height: 18px; opacity: 0; stroke-width: 3; transition: opacity .2s; }
.step__text { align-self: center; line-height: 1.6; }
.step input:checked ~ .step__num { background: var(--accent); color: #fff; }
.step input:checked ~ .step__num > span { opacity: 0; }
.step input:checked ~ .step__num .icon { opacity: 1; }
.step:has(input:checked) { background: transparent; border-color: transparent; }
.step input:checked ~ .step__text { color: var(--muted); }
.step input:focus-visible ~ .step__num { outline: 2px solid var(--accent); outline-offset: 3px; }   /* without :has() */
.step:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.step:has(input:focus-visible) .step__num { outline: none; }

.recipe-tips { display: grid; gap: .6rem; padding: 1.1rem 1.25rem; border-radius: var(--radius); background: var(--surface-2); }
.recipe-tips__title { display: flex; align-items: center; gap: .45rem; font-size: 1rem; font-weight: 700; }
.recipe-tips__title .icon { width: 18px; height: 18px; color: var(--accent-text); }
.recipe-tips ul { display: grid; gap: .45rem; }
.recipe-tips li { position: relative; padding-left: 1.1rem; }
.recipe-tips li::before { content: ''; position: absolute; left: 0; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.recipe__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.recipe-related .section-title { text-align: center; }

.recipe-filters__more > summary,
.recipe__actions .btn,
.recipe-filters__bar .btn { min-height: 44px; }

@media (max-width: 960px) {
    /* phones & tablets: title, time and allergens first, the video right after them */
    .recipe__layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .recipe__main { display: contents; }
    .recipe__head, .recipe-allergens { order: -2; }
    .recipe__media { order: -1; position: static; width: min(100%, 340px, 72svh * 9 / 16); justify-self: center; }
}
@media (max-width: 400px) {
    .recipe-card__title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .recipe-card__link, .recipe-card__media img, .step, .check__box, .check__text { transition: none; }
    .recipe-card__link:hover { transform: none; }
    .recipe-card__link:hover img { scale: 1; }
}
@media (max-width: 640px) {
    .recipe-ingredients__head { flex-direction: column; align-items: flex-start; }
    .step { gap: .75rem; padding: .85rem; }
}

@media print {
    @page { margin: 1.5cm; }
    .site-header, .site-footer, .mobile-menu, .recipe__media, .recipe__actions, .recipe-related,
    .servings, .skip-link, .recipe__crumbs { display: none !important; }
    body { background: #fff; color: #000; }
    .recipe__summary, .ingredient-note, .recipe-allergens__note, .recipe__facts dt { color: #333; }
    .check__box, .step__num { background: none !important; color: inherit !important; border-color: #999 !important; }
    .step input:checked ~ .step__num > span { opacity: 1; }
    .step__num .icon, .check__box .icon { display: none; }
    .recipe__layout { grid-template-columns: 1fr; }
    .recipe { padding: 0; }
    .recipe-allergens, .recipe-tips, .step, .recipe__facts > div { break-inside: avoid; background: none; }
    .check input:checked ~ .check__text, .step input:checked ~ .step__text { color: inherit; text-decoration: none; }
}

/* ---- full screen on a wide screen: ingredients | video | steps ------------------------------ */
.player__side { display: none; }
@media (min-width: 1000px) and (min-aspect-ratio: 5 / 4) {
    .player.is-fullscreen, .player:fullscreen {
        --video-w: calc(100dvh * 9 / 16);
        /* up to 16:9 the panels fill the screen; on anything wider they stop at their 16:9 width
           (100dvh × (16/9 − 9/16) / 2) and hug the video, the rest is the blurred backdrop */
        --side-w: min(calc((100vw - var(--video-w)) / 2), calc(100dvh * 175 / 288));
        --video-x: calc(50vw - var(--video-w) / 2);   /* where the video starts */
    }
    .player.is-fullscreen .player__side,
    .player:fullscreen .player__side {
        /* the page's sections, re-coloured for a dark backdrop through their own tokens */
        --ink: #fff;
        --ink-soft: rgba(255, 255, 255, .82);
        --muted: rgba(255, 255, 255, .62);
        --line: rgba(255, 255, 255, .16);
        --surface: rgba(255, 255, 255, .07);
        --accent: #B9CBB4;
        --accent-text: #DFE7DA;
        --accent-soft: rgba(223, 231, 218, .16);
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 2;
        display: block;
        width: var(--side-w);
        padding: clamp(1.5rem, 1rem + 2vw, 3rem) clamp(1.25rem, .5rem + 2vw, 3rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        color: var(--ink);
        background: rgba(10, 14, 10, .45);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, .25) transparent;
    }
    .player__side--left { left: calc(var(--video-x) - var(--side-w)); }
    .player__side--right { right: calc(var(--video-x) - var(--side-w)); }
    .player__side .recipe__h2 { color: #fff; }
    .player__side .check__box { border-color: rgba(255, 255, 255, .45); }
    .player__side .check input:checked + .check__box,
    .player__side .step input:checked ~ .step__num { color: var(--green-900); }
    .player__side .servings { background: rgba(255, 255, 255, .1); }
    .player__side .servings__btn { color: #fff; }
    .player__side-title {
        margin-bottom: 1.25rem;
        font-family: var(--font-display);
        font-size: clamp(1.5rem, 1.1rem + 1vw, 2.1rem);
        font-weight: 600;
        line-height: 1.1;
    }
    .player__side--left .player__side-title + * { margin-top: 0; }
    /* the video and its controls keep to the middle column */
    .player.is-fullscreen .player__bar,
    .player:fullscreen .player__bar { left: var(--video-x); right: var(--video-x); }
    .player.is-fullscreen .player__video,
    .player:fullscreen .player__video { width: var(--video-w); margin-inline: auto; }
}

/* ---- «Ви нещодавно дивилися»: the same grid and cards as «Що ще приготувати», right under it ---- */
.recipe-viewed { margin-top: clamp(2.5rem, 2rem + 2vw, 4rem); }
.recipe-viewed .section-title { text-align: center; }
@media print { .recipe-viewed { display: none; } }

/* ---- phones & tablets: scrolled past the video → a mini window in a corner ---------------------- */
/* One size; paused it's scaled down from its corner, playing it's full size — transform only, so the
   video isn't re-laid out (smooth). Dragged with a finger, it snaps to the nearest of four corners. */
.player-slot { position: relative; aspect-ratio: 9 / 16; }   /* the video's room stays while it floats */
.player.is-flying, .player.is-mini.is-flying { z-index: 96; transition: none; }   /* on its way between the page and a corner */
.player.is-mini {
    --dx: 0px;
    --dy: 0px;
    --s: .7;                                   /* paused: smaller, a ▶ on it */
    flex: none;
    width: 132px;
    height: auto;
    aspect-ratio: 9 / 16;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(31, 42, 31, .28), 0 0 0 1px rgba(255, 255, 255, .6);
    transform: translate(var(--dx), var(--dy)) scale(var(--s));
    transform-origin: top right;
    transition: transform .4s var(--ease-out);
    touch-action: none;                        /* a drag moves the window, not the page */
    cursor: grab;
    will-change: transform;
}
.player.is-mini.is-playing { --s: 1; }          /* playing: full size, nothing on top */
/* dragged: it follows the finger 1:1, lifted a little (bigger, a deeper shadow) */
.player.is-mini.is-dragging {
    transition: box-shadow .2s var(--ease);
    transform: translate(var(--dx), var(--dy)) scale(calc(var(--s) * 1.05));
    box-shadow: 0 22px 48px rgba(31, 42, 31, .35), 0 0 0 1px rgba(255, 255, 255, .7);
    cursor: grabbing;
}
.player.is-mini[data-corner="tl"] { transform-origin: top left; }
.player.is-mini[data-corner="bl"] { transform-origin: bottom left; }
.player.is-mini[data-corner="br"] { transform-origin: bottom right; }

/* Its place is kept by CSS alone: a track from the video's place to the recipe's end (`top` set once by JS
   from the layout), with a position: sticky pin in it — at the top under the header or at the bottom of the
   screen, by corner. The browser keeps it in the corner and never lets it out of the recipe. */
.mini-dock { display: none; }
@media (max-width: 960px) {
    .recipe { position: relative; }
    .mini-dock {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 95;
        display: flex;
        flex-direction: column;
        pointer-events: none;                  /* the page under it stays usable; only the window takes taps */
    }
    .mini-dock[data-corner^="b"] { justify-content: flex-end; }
    .mini-dock__pin {
        position: sticky;
        top: calc(var(--header-h) + 10px);
        display: flex;
        justify-content: flex-end;
        margin-block: 12px;                    /* keeps clear of the recipe's end */
        padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
    }
    .mini-dock[data-corner^="b"] .mini-dock__pin { top: auto; bottom: calc(env(safe-area-inset-bottom) + 28px); }
    .mini-dock[data-corner$="l"] .mini-dock__pin { justify-content: flex-start; }
    .mini-dock__pin > .player { pointer-events: auto; }
}
.player.is-mini .player__bar { display: none; }
.player.is-mini .player__big { width: 48px; height: 48px; pointer-events: none; }
.player.is-mini .player__big .icon { width: 20px; height: 20px; translate: 1px 0; }
.player.is-mini .player__video { cursor: inherit; pointer-events: none; }   /* the window itself takes the taps */
/* ✕: turns the mini window off (until the video is scrolled to again); always top right, where it's expected */
.player__close { display: none; }
.player.is-mini .player__close {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 26, 20, .62);
    color: #fff;
    cursor: pointer;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
/* the ✕ scales with the window (in proportion, smoothly); while the video plays it steps back */
.player.is-mini .player__close { transition: opacity .25s var(--ease); }
.player.is-mini.is-playing .player__close { opacity: .45; }
.player.is-mini.is-playing .player__close:hover,
.player.is-mini.is-playing .player__close:focus-visible { opacity: 1; }
.player__close .icon { width: 16px; height: 16px; stroke-width: 2.5; }
.player__close::after { content: ''; position: absolute; inset: -10px; }   /* a bigger target than it looks */
@media (prefers-reduced-motion: reduce) { .player.is-mini { transition: none; } }
