/*
 * Shared menu, cart, checkout, confirmation, and lightbox structure.
 * Load a theme stylesheet after this file.
 */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--body-background);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.restaurant-header {
    padding: 26px 16px 18px;
    background: var(--header-background);
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.restaurant-header h1 {
    margin: 0;
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 700;
    letter-spacing: 0.015em;
    line-height: 1.05;
    text-shadow: var(--heading-text-shadow);
}

.restaurant-header p {
    margin: 8px 0 18px;
    color: var(--color-muted);
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-style: italic;
}

.search-box {
    width: min(680px, 100%);
    margin: 0 auto;
}

.search-box input {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-input-inset);
}

.search-box input::placeholder {
    color: var(--color-placeholder);
}

.search-box input:focus {
    border-color: var(--color-primary);
    outline: 3px solid var(--color-focus-ring);
}

.category-nav {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 11px 16px;
    background: var(--nav-background);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-nav);
    backdrop-filter: blur(10px);
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-chip {
    flex: 0 0 auto;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--color-surface-soft);
    color: var(--color-text);
    font-family: var(--font-heading);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.category-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.category-chip.active {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-active-chip);
}

.menu-container {
    width: min(1100px, 100%);
    margin: auto;
    padding: 8px 16px 110px;
}

.menu-category {
    scroll-margin-top: 70px;
    padding-top: 18px;
}

.menu-category h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.2;
}

.menu-category h2::after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(
        to right,
        var(--color-border),
        transparent
    );
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

/* Mobile portrait: compact horizontal cards with 4:3 thumbnails. */
.menu-card {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    min-height: 125px;
    overflow: hidden;
    padding: 10px 0 10px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-card);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}

.menu-card:hover {
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.menu-card:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-focus-ring-soft), var(--shadow-card);
}

.menu-image-button {
    display: block;
    width: 140px;
    height: 105px;
    min-width: 0;
    align-self: center;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-image);
    background: none;
    cursor: zoom-in;
}

.menu-image-button:hover .menu-card-image {
    transform: scale(1.035);
}

.menu-card-image {
    display: block;
    width: 140px;
    height: 105px;
    border-radius: var(--radius-image);
    object-fit: contain;
    object-position: center;
    transition: transform 220ms ease;
}

.menu-card-content {
    display: flex;
    min-width: 0;
    min-height: 105px;
    flex-direction: column;
    padding: 11px 12px;
}

.menu-card-header {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.menu-card-title,
.menu-card h3 {
    min-width: 0;
    margin: 0;
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.2;
}

.menu-card-price {
    flex: 0 0 auto;
    color: var(--color-primary);
    white-space: nowrap;
    font-family: var(--font-heading);
    font-size: 1.08rem;
    font-weight: 700;
}

.menu-card-description,
.menu-card-content > p {
    display: block;
    margin: 5px 0 8px;
    overflow: visible;
    color: var(--color-muted);
    font-size: 0.875rem;
    line-height: 1.35;
}

.menu-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
}

/* Very narrow portrait phones. */
@media (max-width: 370px) and (orientation: portrait) {
    .menu-card {
        grid-template-columns: 120px minmax(0, 1fr);
        min-height: 110px;
padding: 10px 0 10px 10px;
    }

    .menu-image-button,
    .menu-card-image {
        width: 120px;
        height: 90px;
    }

    .menu-card-content {
        min-height: 90px;
        padding: 9px 10px;
    }
}

/* Landscape phones, tablets, and desktop: two vertical columns. */
@media (min-width: 600px), (orientation: landscape) and (min-width: 480px) {
    .menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }

    .menu-card {
        display: grid;
        grid-template-columns: 160px minmax(0, 1fr);
        min-height: 140px;
        padding: 10px 0 10px 10px;
    }

    .menu-image-button,
    .menu-card-image {
        width: 160px;
        height: 120px;
    }

    .menu-image-button {
        align-self: center;
    }

    .menu-card-image {
        object-fit: cover;
        object-position: center;
    }

    .menu-card-content {
        min-height: 120px;
        padding: 12px 14px;
    }
}

.add-to-cart,
.primary-button,
.checkout-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition:
        background 160ms ease,
        transform 160ms ease,
        box-shadow 160ms ease;
}

.add-to-cart:hover,
.primary-button:hover,
.checkout-button:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover);
}

.add-to-cart:active,
.primary-button:active,
.checkout-button:active {
    transform: translateY(0);
}

.mobile-cart-bar {
    position: fixed;
    z-index: 30;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-cart);
    background: var(--color-secondary-dark);
    color: white;
    text-decoration: none;
    box-shadow: var(--shadow-floating);
}

.cart-page,
.confirmation-page {
    width: min(760px, 100%);
    margin: auto;
    padding: 24px 16px 80px;
}

.back-link {
    color: inherit;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-bottom: 12px;
    padding: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-card);
}

.cart-item h2 {
    margin: 0;
    font-size: 1.05rem;
}

.cart-item p {
    margin: 5px 0;
    color: var(--color-muted);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--color-control-border);
    border-radius: 50%;
    background: var(--color-surface);
}

.remove-cart-item {
    justify-self: start;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-danger);
    cursor: pointer;
}

.cart-summary {
    margin-top: 24px;
    padding: 18px;
    background: var(--color-surface);
    border-radius: var(--radius-cart);
}

.cart-summary > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cart-total-row {
    padding-top: 14px;
    border-top: 1px solid var(--color-divider);
    font-size: 1.15rem;
}

.checkout-button {
    width: 100%;
    margin-top: 12px;
}

.checkout-button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.error-message {
    color: var(--color-danger);
}






.customer-details-form {
    margin-top: 18px;
}

.customer-details-card {
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
}

.customer-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.customer-details-header h2 {
    margin: 0;
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: 1.35rem;
}

.customer-details-header p {
    margin: 5px 0 0;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.checkout-cancel-button {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font-weight: 700;
    cursor: pointer;
}

.checkout-field {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    color: var(--color-text);
    font-weight: 700;
}

.checkout-field small {
    color: var(--color-muted);
    font-weight: 400;
}

.checkout-field input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-surface);
    color: var(--color-text);
}

.checkout-field input:focus {
    border-color: var(--color-primary);
    outline: 3px solid var(--color-focus-ring);
}

.checkout-field input:user-invalid {
    border-color: var(--color-danger);
}

.customer-details-card .error-message {
    margin: 12px 0 0;
}

@media (max-width: 480px) {
    .customer-details-header {
        display: block;
    }

    .checkout-cancel-button {
        margin-top: 8px;
    }
}



.confirmation-card {
    margin-top: 60px;
    padding: 32px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.confirmation-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: auto;
    place-items: center;
    border-radius: 50%;
    background: var(--success-background);
    color: var(--color-secondary-dark);
    font-size: 2rem;
}

.confirmation-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.confirmation-card dd {
    margin: 0;
    font-weight: 700;
}

[hidden] {
    display: none !important;
}

@media (min-width: 700px) {
    .mobile-cart-bar {
        right: 24px;
        left: auto;
        width: 360px;
    }
}


body.lightbox-open {
    overflow: hidden;
}

.image-lightbox {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: var(--color-overlay);
    cursor: zoom-out;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    display: grid;
    max-width: min(1100px, 96vw);
    max-height: 92vh;
    place-items: center;
}

.lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 88vh;
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    object-fit: contain;
    box-shadow: var(--shadow-lightbox-image);
}

.lightbox-close {
    position: absolute;
    z-index: 2;
    top: -14px;
    right: -14px;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-lightbox-close);
}

.menu-image-button:focus-visible,
.lightbox-close:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

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