/* Cooking Mode Overlay
   Colours here resolve through the design tokens, not raw hex. .cooking-overlay
   is listed alongside .dark in input.css, so the tokens below always resolve to
   their dark values — cook mode is deliberately dark whatever the site theme is,
   because it is read at arm's length in a bright kitchen.
   Structure follows the rest of the app: flat surfaces, hairline borders, no
   elevation. */
.cooking-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* Header bar */
.cooking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
    z-index: 2;
}

.cooking-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.cooking-header-sections {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.cooking-header-sections::-webkit-scrollbar {
    display: none;
}

.cooking-section-pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.cooking-section-pill:hover {
    color: var(--text);
    background: var(--surface-sunk);
}

.cooking-section-pill.active {
    background: var(--accent-strong);
    color: var(--accent-ink);
    border-color: var(--accent-strong);
}

.cooking-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cooking-close-btn:hover {
    background: var(--surface-sunk);
}

/* Carousel container */
.cooking-carousel {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card positioning */
.cooking-card-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cooking-card {
    position: absolute;
    width: calc(100% - 40px);
    max-width: 800px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
    padding: 32px;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.cooking-card::-webkit-scrollbar {
    width: 4px;
}

.cooking-card::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 2px;
}

.cooking-card.current {
    opacity: 1;
    transform: translateY(0) scale(1);
    z-index: 1;
    touch-action: pan-y;
}

.cooking-card.prev {
    opacity: 0.25;
    transform: translateY(-75%) scale(0.85);
    z-index: 0;
    cursor: pointer;
}

.cooking-card.next {
    opacity: 0.25;
    transform: translateY(75%) scale(0.85);
    z-index: 0;
    cursor: pointer;
}

.cooking-card.hidden-card {
    opacity: 0;
    transform: translateY(100%) scale(0.8);
    pointer-events: none;
}

/* Swipe animation */
.cooking-card.swiping {
    transition: none;
}

/* Section header card */
.cooking-card-section {
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
}

/* Was a gradient clipped to the text, which forced -webkit-text-fill-color:
   transparent — that renders as an invisible heading anywhere the clip is
   unsupported. A solid token has no such failure mode. */
.cooking-card-section h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--accent-text);
}

.cooking-mise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    text-align: left;
}

.cooking-mise-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 12px;
    background: var(--surface-sunk);
    border: 1px solid var(--border);
    border-radius: 6px;
    gap: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cooking-mise-item.checked {
    opacity: 0.35;
    text-decoration: line-through;
}

.cooking-mise-name {
    font-size: 18px;
    color: var(--text);
}

.cooking-mise-note {
    font-size: 14px;
    color: var(--text-faint);
    font-style: italic;
}

.cooking-mise-qty {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-text);
    white-space: nowrap;
}

/* Step card */
.cooking-card-step {
    background: var(--surface);
    border: 1px solid var(--border);
}

.cooking-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-strong);
    color: var(--accent-ink);
    font-weight: 700;
    font-size: 13px;
    margin-right: 8px;
    flex-shrink: 0;
    vertical-align: middle;
}

.cooking-step-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
}

.cooking-step-text {
    font-size: 24px;
    line-height: 1.6;
    color: var(--text);
}

/* Scale entity markup up for arm's-length reading. Only .timer-badge has a
   background of its own, so it is the only one that needs horizontal padding;
   padding on the other two just pushed the surrounding words apart. */
.cooking-step-text .ingredient-badge,
.cooking-step-text .cookware-badge {
    font-size: 22px;
}

.cooking-step-text .timer-badge {
    font-size: 22px;
    padding: 2px 10px;
}

.cooking-step-ingredients {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 15px;
    color: var(--text-faint);
}

.cooking-step-ingredients span {
    margin-right: 12px;
}

/* Done card */
.cooking-card-done {
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
}

.cooking-card-done h2 {
    font-size: 36px;
    margin-bottom: 12px;
}

.cooking-card-done p {
    font-size: 20px;
    color: var(--text-muted);
}

.cooking-done-close-btn {
    margin-top: 28px;
    padding: 12px 40px;
    border-radius: 6px;
    border: none;
    background: var(--accent-strong);
    color: var(--accent-ink);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.cooking-done-close-btn:hover {
    filter: brightness(.94);
}

/* Progress bar */
.cooking-progress {
    height: 3px;
    background: var(--surface-sunk);
    flex-shrink: 0;
}

.cooking-progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease-out;
}

/* Responsive */
@media (max-width: 640px) {
    .cooking-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .cooking-header-sections {
        flex-shrink: 1;
        min-width: 0;
    }

    .cooking-section-pill {
        padding: 4px 10px;
        font-size: 12px;
    }

    .cooking-header-title {
        font-size: 14px;
    }

    .cooking-card {
        width: calc(100% - 24px);
        padding: 20px 16px;
        max-height: 75vh;
        border-radius: 6px;
    }

    .cooking-card-section h2 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .cooking-step-text {
        font-size: 18px;
        line-height: 1.5;
    }

    .cooking-step-text .ingredient-badge,
    .cooking-step-text .cookware-badge {
        font-size: 16px;
        white-space: normal;
    }

    .cooking-step-text .timer-badge {
        font-size: 16px;
        padding: 1px 8px;
        white-space: normal;
    }

    .cooking-step-ingredients {
        font-size: 13px;
    }

    .cooking-mise-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .cooking-mise-name {
        font-size: 15px;
    }

    .cooking-mise-qty {
        font-size: 14px;
    }

    .cooking-mise-item {
        padding: 6px 10px;
    }

    .cooking-card-done h2 {
        font-size: 28px;
    }

    .cooking-done-close-btn {
        padding: 10px 32px;
        font-size: 16px;
    }

    .cooking-close-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

@media (min-width: 1024px) {
    .cooking-step-text {
        font-size: 28px;
    }
}
