/* How-to videos: the window (js/video-guide.js), the help hub's cards and the
   play buttons that open them (Components/Shared/VideoGuides.razor). The video
   is a phone screen, so it stands beside its steps on a computer and above
   them on a phone. */

.vg-dialog {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text, #222);
    width: min(880px, calc(100vw - 2rem));
    max-width: none;
    max-height: calc(100dvh - 2rem);
    overflow: visible;
}
.vg-dialog::backdrop { background: rgba(20, 16, 10, .62); }

.vg-window {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 2rem);
    background: var(--surface, #fff);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    overflow: hidden;
}

.vg-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem .8rem .75rem 1.1rem;
    border-bottom: 1px solid var(--border, #e8e0d2);
}
.vg-icon { font-size: 1.3rem; line-height: 1; }
.vg-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: var(--font-display);
    font-weight: var(--display-weight, 700);
    font-size: 1.15rem;
    line-height: 1.2;
}
/* The music switch: on, or off for good once a viewer turns it off. */
.vg-mute {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    height: 34px;
    padding: 0 .75rem 0 .6rem;
    border: 1px solid var(--border, #e8e0d2);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--text, #222);
    font: inherit;
    font-size: .85rem;
    white-space: nowrap;
    cursor: pointer;
}
.vg-mute:hover { border-color: var(--primary, #0a8a3f); }
.vg-mute.is-off { background: var(--surface-2, #f4efe6); color: var(--muted, #6b6b6b); }
.vg-mute-icon { font-size: 1rem; line-height: 1; }
.vg-close {
    flex: none;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-2, #f4efe6);
    color: var(--text, #222);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.vg-body {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 1.25rem;
    padding: 1rem 1.1rem;
}

/* aspect-ratio comes from the recording (set by the script). */
.vg-frame {
    flex: none;
    height: min(68dvh, 620px);
    max-width: 55%;
    border-radius: 16px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .18);
}
.vg-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #111;
}

.vg-text {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: .9rem;
}
.vg-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    overflow-y: auto;
    min-height: 0;
}
.vg-steps li {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: 12px;
    color: var(--muted, #6b6b6b);
    font-size: 1.05rem;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color .25s, color .25s;
}
.vg-n {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    border: 1px solid var(--border, #e8e0d2);
    background: var(--surface-2, #f4efe6);
    font-size: .9rem;
    font-weight: 700;
}
.vg-s { padding-top: .1rem; }
.vg-steps li.is-done { color: var(--text-2, #4a4540); }
.vg-steps li.is-done .vg-n {
    border-color: transparent;
    background: color-mix(in oklab, var(--primary, #0a8a3f) 14%, var(--surface, #fff));
    color: var(--primary, #0a8a3f);
    font-size: 0;
}
.vg-steps li.is-done .vg-n::before { content: "\2713"; font-size: .95rem; }
.vg-steps li.is-on {
    color: var(--text, #222);
    background: color-mix(in oklab, var(--primary, #0a8a3f) 10%, var(--surface, #fff));
    font-weight: 600;
}
.vg-steps li.is-on .vg-n {
    border-color: transparent;
    background: var(--primary, #0a8a3f);
    color: var(--primary-ink, #fff);
}

.vg-end {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: auto;
}
.vg-dialog.is-ended .vg-next {
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary, #0a8a3f) 25%, transparent);
}

.vg-more {
    display: flex;
    gap: .45rem;
    overflow-x: auto;
    padding: .7rem 1.1rem .85rem;
    border-top: 1px solid var(--border, #e8e0d2);
    scrollbar-width: thin;
}
.vg-pick {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .8rem;
    border: 1px solid var(--border, #e8e0d2);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--text, #222);
    font: inherit;
    font-size: .88rem;
    white-space: nowrap;
    cursor: pointer;
}
.vg-pick[aria-current] {
    border-color: var(--primary, #0a8a3f);
    background: color-mix(in oklab, var(--primary, #0a8a3f) 8%, var(--surface, #fff));
    color: var(--primary, #0a8a3f);
    font-weight: 600;
}

/* Two phones side by side (the family list, a shared link) are wider than
   tall: the steps go under the video on a computer too. */
.vg-dialog.is-wide .vg-body { flex-direction: column; align-items: center; }
.vg-dialog.is-wide .vg-frame { height: min(54dvh, 500px); max-width: 100%; }
.vg-dialog.is-wide .vg-text { width: 100%; }

/* A phone: the whole screen, the video on top, its steps under it. */
@media (max-width: 720px) {
    .vg-dialog {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
    }
    .vg-window {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
    .vg-head { padding-top: max(.75rem, env(safe-area-inset-top)); }
    .vg-body {
        flex-direction: column;
        align-items: center;
        gap: .6rem;
        padding: .6rem .8rem 0;
    }
    .vg-frame {
        height: 54dvh;
        max-width: 100%;
        border-radius: 14px;
    }
    .vg-dialog.is-wide .vg-frame { height: auto; width: 100%; }
    .vg-text { width: 100%; gap: .5rem; }
    .vg-steps li { padding: .45rem .6rem; font-size: 1rem; }
    /* The steps need the room while it plays; again/next come at the end. */
    .vg-dialog:not(.is-ended) .vg-end { display: none; }
    .vg-end .btn { flex: 1; }
    .vg-more { padding-bottom: max(.85rem, env(safe-area-inset-bottom)); }
}

/* The cards on the help hub: one row, scrolled sideways and round — the
   script repeats the cards on both sides and adds the arrows. A poster is the
   whole phone screen; a card shows its top, where the recipe is. */
.vg-strip {
    --vg-card: 168px;
    --vg-gap: 14px;
    --vg-edge: 30px;
    position: relative;
}
.vg-cards {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--vg-gap);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--vg-edge);
    scrollbar-width: none;
    padding: 4px var(--vg-edge) 12px;
    /* The loop counts pixels from the left, so the row runs left to right
       whichever way the page reads; the cards themselves keep the page's way. */
    direction: ltr;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--vg-edge), #000 calc(100% - var(--vg-edge)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--vg-edge), #000 calc(100% - var(--vg-edge)), transparent);
}
.vg-cards::-webkit-scrollbar { display: none; }
[dir="rtl"] .vg-card { direction: rtl; }
.vg-arrow {
    position: absolute;
    z-index: 2;
    top: calc(4px + var(--vg-card) * 5 / 8);
    width: 42px;
    height: 42px;
    margin-top: -21px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--border, #e8e0d2);
    border-radius: 50%;
    background: var(--surface, #fff);
    color: var(--text, #222);
    box-shadow: var(--shadow-md, 0 6px 20px rgba(0, 0, 0, .12));
    cursor: pointer;
}
.vg-arrow:hover { border-color: var(--primary, #0a8a3f); color: var(--primary, #0a8a3f); }
.vg-arrow svg { width: 20px; height: 20px; }
.vg-arrow-prev { left: 0; }
.vg-arrow-next { right: 0; }
@media (max-width: 600px) {
    .vg-strip { --vg-card: 140px; --vg-gap: 12px; --vg-edge: 22px; }
    .vg-arrow { width: 36px; height: 36px; margin-top: -18px; }
}
.vg-card {
    flex: 0 0 var(--vg-card);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text, #222);
    font: inherit;
    text-align: start;
    cursor: pointer;
}
.vg-card-shot {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-2, #f4efe6);
    box-shadow: var(--shadow-sm);
}
.vg-card-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform .3s;
}
.vg-card:hover .vg-card-shot img { transform: scale(1.03); }
.vg-card-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
}
.vg-card-len {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .66);
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
}
.vg-card-title { font-weight: 600; font-size: .95rem; line-height: 1.3; }

/* "Watch how" buttons: a round play mark and a line of text. */
.vg-link {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .85rem .35rem .4rem;
    border: 1px solid var(--border, #e8e0d2);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--text, #222);
    font: inherit;
    font-size: .92rem;
    line-height: 1.3;
    text-align: start;
    cursor: pointer;
}
.vg-link:hover { border-color: var(--primary, #0a8a3f); }
.vg-play-dot {
    position: relative;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary, #0a8a3f);
}

/* The play triangles. */
.vg-card-play::after,
.vg-play-dot::after,
.first-run-play::after {
    content: "";
    position: absolute;
    left: 55%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent #fff;
}
.vg-play-dot::after {
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent var(--primary-ink, #fff);
}
.first-run-play::after {
    border-width: 7px 0 7px 11px;
    border-color: transparent transparent transparent currentColor;
}

/* The first-run panel: a play button in each tile's corner — a sibling of
   the tile, not inside it: the tiles are links, labels and buttons. */
.first-run-cell { position: relative; display: flex; }
.first-run-cell > .first-run-option { flex: 1; padding-inline-end: 3.1rem; }
.first-run-cell:has(.first-run-voice:not(.is-ready)) { display: none; }
.first-run-play {
    position: absolute;
    top: .5rem;
    inset-inline-end: .5rem;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border, #e8e0d2);
    border-radius: 50%;
    background: var(--surface, #fff);
    color: var(--primary, #0a8a3f);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.first-run-play:hover { border-color: var(--primary, #0a8a3f); }
.first-run-videos { margin: .85rem 0 0; }

.add-videos { margin: -.35rem 0 1rem; }

.help-videos { margin: 1.75rem 0 2.25rem; }
.help-videos h2 {
    font-family: var(--font-display);
    font-weight: var(--display-weight, 700);
    font-size: 1.35rem;
    margin: 0 0 .3rem;
}
.help-videos-lead { margin: 0 0 1rem; color: var(--text-2, #4a4540); max-width: 60ch; }
