/**
 * Nutrition page — mobile responsiveness for tables, hero, and live calorie DB.
 */

.brew-page-nutrition .ds-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-inline: calc(-1 * var(--ds-space-4, 1rem));
    padding-inline: var(--ds-space-4, 1rem);
}

.brew-page-nutrition .ds-table-scroll .ds-table {
    min-width: 520px;
}

.brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack {
    width: 100%;
}

@media (max-width: 640px) {
    .brew-page-nutrition .ds-hero__actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .brew-page-nutrition .ds-hero__actions .ds-btn {
        width: 100%;
        justify-content: center;
    }

    .brew-page-nutrition .ds-phone {
        max-width: 220px;
        margin-inline: auto;
    }

    .brew-page-nutrition .ds-toc__grid {
        grid-template-columns: 1fr;
    }

    .brew-page-nutrition .ds-highlight-card {
        text-align: left;
    }

    .brew-page-nutrition .ds-steps .ds-step {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Stack wide tables as cards */
    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack thead {
        display: none;
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid var(--ds-gray-200, #e5e7eb);
        border-radius: 12px;
        background: #fff;
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 8px 0;
        border: none;
        text-align: right;
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ds-gray-700, #374151);
        text-align: left;
        flex: 0 0 42%;
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody td:first-child {
        font-size: 1.05rem;
        padding-bottom: 10px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--ds-gray-100, #f3f4f6);
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody td:first-child::before {
        display: none;
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody td:last-child {
        justify-content: center;
        padding-top: 12px;
    }

    .brew-page-nutrition .ds-table-card--stack-mobile .ds-table--stack tbody td:last-child::before {
        display: none;
    }

    .brew-page-nutrition .ds-category-block__title {
        font-size: 1.1rem;
        line-height: 1.35;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .brew-page-nutrition .ds-stats__grid--4 {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .brew-page-nutrition .ds-stat-card__value {
        font-size: 1.25rem;
    }
}
