/* Shared responsive guardrails for standalone and page-specific layouts. */
:root {
    --eat84-orange: #F4510B;
    --eat84-orange-hover: #D94305;
    --eat84-black: #111111;
    --eat84-white: #FFFFFF;
    --eat84-grey: #666666;
    --eat84-border: #E5E5E5;
    color-scheme: light;
}

html {
    max-width: 100%;
    overflow-x: clip;
    scroll-padding-top: 80px;
}

body {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}

img,
video,
canvas,
iframe,
svg {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--eat84-orange);
    outline-offset: 2px;
}

dialog {
    box-sizing: border-box;
    max-width: min(100vw - 24px, 760px);
    max-height: calc(100dvh - 24px);
    overflow: auto;
}

@media (max-width: 768px) {
    html body .top-header,
    html body header.top {
        gap: 8px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    html body .top-header > a,
    html body .top-header .header-logo,
    html body header.top .header-logo {
        flex: 0 1 auto;
        width: auto;
        min-width: 0;
        max-width: min(150px, calc(100vw - 116px));
        height: auto;
        max-height: 46px;
        object-fit: contain;
    }

    html body .top-header .header-right,
    html body header.top .header-right {
        min-width: 0;
        gap: 8px;
    }

    html body .main-content,
    html body main.main-content {
        min-width: 0;
        max-width: 100%;
    }

    html body :is(.table-wrap, .table-responsive, .table-container, .menu-table-wrap, .payment-table-wrap) {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    html body :is(input, select, textarea) {
        min-width: 0;
        font-size: max(16px, 1em);
    }

    html body :is(button, [role="button"], a.button, .button) {
        touch-action: manipulation;
    }

    html body:not([data-restaurant-branding="true"]) :is(.modal-overlay, .confirm-dialog-overlay) {
        max-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    html body:not([data-restaurant-branding="true"]) :is(
        dialog,
        [role="dialog"],
        .modal,
        .confirm-dialog,
        .food-dialog,
        .redemption-dialog,
        .details-dialog,
        .backup-dialog
    ) {
        box-sizing: border-box;
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 380px) {
    html body :is(.main-content, .content) {
        min-width: 0;
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
