/*
 * cook.css — the full-screen cook-along surface.
 *
 * VISION.md: "This needs to feel less like 'a website' and more like a
 * cooking instrument. Big type, minimal chrome, one action visible at a time."
 *
 * Dark, warm, Playfair-forward. Scoped to html.legendary so legacy pages
 * are untouched.
 */

html.legendary .cook-body {
    background: #0E0D0B;
    color: #F7F4EE;
    min-height: 100svh;
    overflow: hidden;
}

html.legendary .cook-stage {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    color: #F7F4EE;
    background: radial-gradient(
        ellipse at 30% 20%,
        color-mix(in srgb, var(--accent-600, #C45D3E) 18%, #0E0D0B) 0%,
        #0E0D0B 60%
    );
}

/* ── Top bar ─────────────────────────────────────────────────────── */
html.legendary .cook-stage__bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-4, 1rem);
    padding: max(var(--space-3, 0.75rem), env(safe-area-inset-top))
             var(--space-5, 1.25rem)
             var(--space-3, 0.75rem);
    border-bottom: 1px solid color-mix(in srgb, #F7F4EE 8%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: color-mix(in srgb, #0E0D0B 85%, transparent);
}

html.legendary .cook-stage__exit {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, #F7F4EE 8%, transparent);
    color: #F7F4EE;
    font-size: 1.1rem;
    line-height: 1;
    text-decoration: none;
    transition: background 150ms ease;
}
html.legendary .cook-stage__exit:hover {
    background: color-mix(in srgb, #F7F4EE 14%, transparent);
}

html.legendary .cook-stage__progress {
    height: 4px;
    background: color-mix(in srgb, #F7F4EE 12%, transparent);
    border-radius: 2px;
    overflow: hidden;
}
html.legendary .cook-stage__progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-color, #C45D3E);
    transition: width 400ms cubic-bezier(0.34, 1.3, 0.64, 1);
}

html.legendary .cook-stage__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.75rem;
    color: color-mix(in srgb, #F7F4EE 70%, transparent);
}
html.legendary .cook-stage__recipe {
    font-family: var(--font-display, 'Playfair Display'), serif;
    font-size: 0.95rem;
    color: #F7F4EE;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
html.legendary .cook-stage__step-counter {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, #F7F4EE 55%, transparent);
}

/* ── The instruction ─────────────────────────────────────────────── */
html.legendary .cook-stage__body {
    display: grid;
    place-items: center;
    padding: var(--space-6, 1.5rem);
    text-align: center;
    position: relative;
    overflow-y: auto;
}

html.legendary .cook-stage__coach-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-color, #C45D3E) 20%, transparent);
    color: var(--accent-200, #F1C9B8);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: var(--space-5, 1.25rem);
}
html.legendary .cook-stage__coach-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color, #C45D3E);
    animation: cookPulse 1.6s ease-in-out infinite;
}
@keyframes cookPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(1.25); }
}

html.legendary .cook-stage__instruction {
    font-family: var(--font-display, 'Playfair Display'), serif;
    font-size: clamp(2rem, 7vw, 4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #F7F4EE;
    max-width: 20ch;
    margin: 0;
    font-weight: 700;
}

html.legendary .cook-stage__coach-message {
    font-size: clamp(1rem, 2.4vw, 1.25rem);
    line-height: 1.45;
    color: var(--accent-200, #F1C9B8);
    max-width: 28ch;
    margin-top: var(--space-5, 1.25rem);
    font-style: italic;
}
html.legendary .cook-stage__coach-message.is-urgent {
    color: #FDECDF;
    background: color-mix(in srgb, var(--accent-color, #C45D3E) 22%, transparent);
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

/* ── Camera surface ──────────────────────────────────────────────── */
html.legendary .cook-stage__camera {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: end stretch;
    pointer-events: none;
    z-index: 1;
}
html.legendary .cook-stage__camera-video {
    position: absolute;
    right: var(--space-4, 1rem);
    bottom: calc(var(--space-4, 1rem) + 6rem);
    width: clamp(7rem, 22vw, 11rem);
    height: clamp(9rem, 30vw, 14rem);
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, #F7F4EE 20%, transparent);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    background: #000;
    opacity: 0.95;
    pointer-events: auto;
}
html.legendary .cook-stage__camera-state {
    position: absolute;
    right: var(--space-4, 1rem);
    bottom: calc(var(--space-4, 1rem) + 6rem + clamp(9rem, 30vw, 14rem) + 0.5rem);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: color-mix(in srgb, #F7F4EE 60%, transparent);
    text-transform: uppercase;
}

/* ── Bottom controls ─────────────────────────────────────────────── */
html.legendary .cook-stage__controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-3, 0.75rem);
    padding: var(--space-4, 1rem) var(--space-5, 1.25rem)
             max(var(--space-5, 1.25rem), env(safe-area-inset-bottom));
    border-top: 1px solid color-mix(in srgb, #F7F4EE 8%, transparent);
    background: color-mix(in srgb, #0E0D0B 92%, transparent);
    align-items: center;
    z-index: 2;
}
html.legendary .cook-stage__center-controls {
    display: flex;
    gap: var(--space-2, 0.5rem);
    justify-content: center;
    flex-wrap: wrap;
}

html.legendary .cook-stage__btn {
    appearance: none;
    border: 1px solid color-mix(in srgb, #F7F4EE 14%, transparent);
    background: color-mix(in srgb, #F7F4EE 5%, transparent);
    color: #F7F4EE;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, transform 120ms ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}
html.legendary .cook-stage__btn:hover {
    background: color-mix(in srgb, #F7F4EE 10%, transparent);
    border-color: color-mix(in srgb, #F7F4EE 22%, transparent);
}
html.legendary .cook-stage__btn:active { transform: scale(0.97); }

html.legendary .cook-stage__btn--prev,
html.legendary .cook-stage__btn--next {
    font-weight: 700;
}
html.legendary .cook-stage__btn--next {
    background: var(--accent-color, #C45D3E);
    color: #0E0D0B;
    border-color: transparent;
}
html.legendary .cook-stage__btn--next:hover {
    background: color-mix(in srgb, var(--accent-color, #C45D3E) 85%, #F7F4EE);
    border-color: transparent;
}

html.legendary .cook-stage__btn--voice[aria-pressed="true"],
html.legendary .cook-stage__btn--camera[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent-color, #C45D3E) 20%, transparent);
    border-color: var(--accent-color, #C45D3E);
    color: var(--accent-200, #F1C9B8);
}

html.legendary .cook-stage__beta {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: color-mix(in srgb, #F7F4EE 12%, transparent);
    color: color-mix(in srgb, #F7F4EE 80%, transparent);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    margin-left: 0.2rem;
}

html.legendary .cook-stage__btn--primary {
    background: var(--accent-color, #C45D3E);
    color: #0E0D0B;
    border-color: transparent;
    font-weight: 700;
}
html.legendary .cook-stage__btn--ghost {
    background: transparent;
    border-color: color-mix(in srgb, #F7F4EE 20%, transparent);
}

/* ── Done overlay ───────────────────────────────────────────────── */
html.legendary .cook-stage__done[hidden],
html.legendary .cook-stage__camera[hidden],
html.legendary .cook-stage__coach-badge[hidden],
html.legendary .cook-stage__coach-message[hidden] {
    display: none !important;
}
html.legendary .cook-stage__done {
    position: fixed;
    inset: 0;
    background: #0E0D0B;
    display: grid;
    place-items: center;
    padding: var(--space-6, 1.5rem);
    z-index: 10;
    animation: cookFade 400ms cubic-bezier(0.34, 1.3, 0.64, 1);
}
@keyframes cookFade {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
html.legendary .cook-stage__done-inner {
    text-align: center;
    max-width: 32rem;
}
html.legendary .cook-stage__done-emoji {
    font-size: clamp(3rem, 10vw, 5rem);
    margin-bottom: var(--space-4, 1rem);
}
html.legendary .cook-stage__done-title {
    font-family: var(--font-display, 'Playfair Display'), serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    line-height: 1.05;
    margin: 0 0 var(--space-2, 0.5rem) 0;
    color: #F7F4EE;
}
html.legendary .cook-stage__done-sub {
    font-size: 1.05rem;
    color: color-mix(in srgb, #F7F4EE 70%, transparent);
    margin: 0 0 var(--space-6, 1.5rem) 0;
}
html.legendary .cook-stage__rating {
    display: inline-flex;
    gap: var(--space-2, 0.5rem);
    margin-bottom: var(--space-6, 1.5rem);
}
html.legendary .cook-stage__rating-btn {
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0.5rem;
    color: color-mix(in srgb, #F7F4EE 30%, transparent);
    transition: color 180ms ease, transform 120ms ease;
}
html.legendary .cook-stage__rating-btn:hover {
    color: var(--accent-color, #C45D3E);
    transform: scale(1.15);
}
html.legendary .cook-stage__rating-btn[aria-checked="true"] {
    color: var(--accent-color, #C45D3E);
}
html.legendary .cook-stage__rating-star {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    line-height: 1;
}
html.legendary .cook-stage__done-actions {
    display: flex;
    gap: var(--space-3, 0.75rem);
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Narrow screens ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    html.legendary .cook-stage__bar { grid-template-columns: auto 1fr; }
    html.legendary .cook-stage__bar .cook-stage__meta { display: none; }
    html.legendary .cook-stage__btn { padding: 0.55rem 0.85rem; font-size: 0.78rem; }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html.legendary .cook-stage__coach-dot,
    html.legendary .cook-stage__done,
    html.legendary .cook-stage__progress-fill { animation: none !important; transition: none !important; }
}
