/* ============================================================
   Fat Mobile Fullscreen Overlay
   Optimized for iPhone Safari (393px / iPhone 17 viewport).
   Uses safe-area-inset-* for notch/Dynamic Island support.
   ============================================================ */

/* ── Trigger button — mobile only ───────────────────────────────── */
.fat-mobile-fullscreen-btn {
    display: none;
}

@media (max-width: 768px) {
    .fat-mobile-fullscreen-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        transform: translateX(-50%);
        z-index: 9000;
        background: #ff4a52;
        color: #fff;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.02em;
        padding: 14px 28px;
        border: none;
        border-radius: 50px;
        box-shadow: 0 4px 20px rgba(255, 74, 82, 0.45);
        cursor: pointer;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .fat-mobile-fullscreen-btn:active {
        transform: translateX(-50%) scale(0.97);
        box-shadow: 0 2px 10px rgba(255, 74, 82, 0.35);
    }
}

/* ── Overlay backdrop ────────────────────────────────────────────── */
/* position: fixed with explicit edges (not 'inset') for older iOS compatibility */
.fat-fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99990;
    background: #fff;
    overflow-y: scroll;           /* 'scroll' (not 'auto') enables momentum on iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* prevent page scroll bleed-through */
}

.fat-fullscreen-overlay.fat-fs-open {
    display: block;
}

/* ── Close button — fixed, always on top ─────────────────────────── */
.fat-fs-close {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    z-index: 99999;
    width: 44px;
    height: 44px;
    background: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
    font-size: 22px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    color: #333;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* display is managed directly in JS (display:flex / display:none) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ── Content wrapper ─────────────────────────────────────────────── */
.fat-fs-content {
    max-width: 480px;
    margin: 0 auto;
    padding: 56px 18px calc(40px + env(safe-area-inset-bottom, 0px));
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #222;
    box-sizing: border-box;
}

/* ── Recipe title ────────────────────────────────────────────────── */
.fat-fs-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    color: #111;
    margin: 0 0 16px;
    text-align: center;
}

/* ── Hero image ──────────────────────────────────────────────────── */
.fat-fs-hero {
    width: 100%;
    border-radius: 10px;
    display: block;
    margin: 0 0 16px;
    object-fit: cover;
    max-height: 280px;
}

/* ── Info grid: 4 cells ──────────────────────────────────────────── */
.fat-fs-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 0 24px;
}

.fat-fs-info-cell {
    padding: 10px 6px;
    text-align: center;
    border-right: 1px solid #e0e0e0;
}

.fat-fs-info-cell:last-child {
    border-right: none;
}

.fat-fs-info-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    display: block;
    margin-bottom: 3px;
}

.fat-fs-info-value {
    font-size: 13px;
    font-weight: 700;
    color: #222;
    display: block;
    line-height: 1.2;
}

/* ── Collapsible sections ────────────────────────────────────────── */
.fat-fs-section {
    margin-bottom: 8px;
}

.fat-fs-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 10px;
    border-bottom: 2px solid #ff4a52;
    margin-bottom: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fat-fs-section-header h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.fat-fs-chevron {
    font-size: 14px;
    color: #ff4a52;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    will-change: transform;
}

.fat-fs-section.fat-fs-collapsed .fat-fs-chevron {
    transform: rotate(-90deg);
}

.fat-fs-section-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* ── Ingredients list ────────────────────────────────────────────── */
.fat-fs-ingredients {
    margin: 0 0 8px;
}

.fat-fs-ingredient-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    line-height: 1.4;
}

.fat-fs-ingredient-item::before {
    content: "•";
    color: #ff4a52;
    font-size: 16px;
    margin-right: 10px;
    flex-shrink: 0;
    margin-top: -1px;
}

/* ── Directions ──────────────────────────────────────────────────── */
.fat-fs-directions {
    margin: 0 0 8px;
}

.fat-fs-step {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.fat-fs-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.fat-fs-step-title {
    font-size: 14px;
    font-weight: 700;
    color: #ff4a52;
    margin: 0 0 8px;
    line-height: 1.2;
}

.fat-fs-step-img {
    width: 100%;
    border-radius: 8px;
    display: block;
    margin: 0 0 10px;
    object-fit: cover;
    max-height: 200px;
}

.fat-fs-step-text {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

/* ── Nutrition ───────────────────────────────────────────────────── */
.fat-fs-nutrition {
    margin: 0 0 8px;
}

.fat-fs-nutrition-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.fat-fs-nutrition-item:last-child {
    border-bottom: none;
}

.fat-fs-nutrition-pct {
    color: #999;
    font-size: 12px;
}
