/*
  ----------------------------------------
  Application (Global styles)
  ----------------------------------------
*/

@font-face {
  font-family: "General Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/GeneralSans-Variable-8be593c1.ttf") format("truetype");
}

@font-face {
  font-family: "General Sans";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/GeneralSans-VariableItalic-632e4aa1.ttf") format("truetype");
}


@layer styles {
    /* ----------------------------------------
       Homepage – Impeccable Plate
       ---------------------------------------- */

    /* Serif headings (Lora) for homepage */
    .ip-serif {
        font-family: var(--font-heading);
        font-weight: 700;
        line-height: 1.05;
    }

    /* Small all-caps eyebrow label */
    .ip-eyebrow {
        font-size: var(--text-xs);
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        margin: 0;
    }

    /* Pill badge */
    .ip-badge {
        display: inline-block;
        padding: 0.3em 0.85em;
        border-radius: 9999px;
        font-size: var(--text-sm);
        font-weight: 600;
        line-height: 1.6;
    }

    .primary-cta .ui-button {
        padding: var(--space-xs) var(--space-sm);
    }

    .ip-nav-container {
        padding: var(--space-2xs) var(--space-xs) !important;
        margin-inline: initial !important;
        width: 100% !important;

        .nav-link {
            white-space: nowrap;
        }

        @media (min-width: 768px) {
            padding: var(--space-sm) var(--space-lg)  !important;
        }
    }

    .ip-nav-logo {
        width: 64px;

        @media (min-width: 768px) {
            width: 100px;
        }
    }

    .ip-hero {
        background-color: var(--brand-1);
        
        @media (min-width: 768px) {
            /* Extend hero background to the right on desktop */
            .primary-cta, .details-wrapper, .how-it-works-wrapper {
                flex-direction: row !important;
            }
            
        }
    }

    /* Hero: stacked on mobile, side-by-side on desktop */
    .ip-hero-cover-image {
        background: url("/assets/home-hero-header-4444b49f.jpg") no-repeat center top / cover;
        width: 100%;
        height: 800px;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .ip-hero-copy, .ip-section-container {
        position: relative;
        box-sizing: content-box;
        z-index: 2;
        max-width: 1280px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-2xl) var(--space-xs) var(--space-2xl);

        @media (min-width: 768px) {
            padding: clamp(2rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 4.5rem);
        }
    }

    .ip-hero-copy {
        padding-top: var(--space-xl);

        @media (min-width: 768px) {
            padding-top: var(--space-3xl);
        }       
    }

    .ip-hero-card {
        max-width: 640px;
        width: 100%;
    }

    .ip-hero-icon {
        width: calc(1.5rem);
        height: calc(1.5rem);

        &.large {
            width: calc(2rem);
            height: calc(2rem);
        }
    }

    .ip-question {
        max-width: 768px;
    }

    .ip-answer {
        background: var(--white);
        border-radius: var(--rounded);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    .ip-accordian {
        width: 100%;
        max-width: 768px;
        background: var(--white);
        cursor: pointer;
        border-radius: var(--rounded);

        &:hover {
            background: var(--neutral-200);
        }

        &:active {
            background: var(--neutral-300);
        }

        &.active {
            background: var(--white);
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;

            &:hover {
                background: var(--neutral-200);
            }
        }
    }

    .ip-featured-items {
        display: flex;
        flex-direction: row;
        gap: var(--space-sm);
        overflow-x: scroll;

        .ip-pickup-time-card-form {
            display: flex;
            flex: 1 0 320px;
            min-width: 320px;
        }

        .ui-card {
            min-width: 320px;
            aspect-ratio: 3 / 4;
        }

        @media (min-width: 768px) {
            overflow-x: initial;

            .ip-pickup-time-card-form {
                flex: 1 1 0;
                min-width: 0;
            }

            .ui-card {
                min-width: initial;
            }
        }
    }

    .ip-pickup-time-card {
        width: 100%;
        border: var(--border-lg) solid transparent;
        color: inherit;
        cursor: pointer;
        font: inherit;
        text-align: left;

        img {
            transition: transform 230ms ease;
        }

        &:hover img {
            transform: scale(1.02);
        }

        &:focus-visible {
            outline: var(--border-lg) solid var(--brand-1);
            outline-offset: 4px;
        }

        &.is-selected {
            border-color: var(--brand-1-light);
        }
    }

    .ip-pickup-time-card-title,
    .ip-pickup-time-card-time {
        display: block;
    }

    .ip-final-cta {
        display: flex;
        flex-direction: column;
        border-radius: 1rem;
        overflow: hidden;
        width: 100%;

        .ip-final-cta-copy {
            gap: var(--space-sm);
        }

        .ip-final-cta-image {
            background: url("/assets/home-hero-header-4444b49f.jpg") no-repeat center top / cover;
            width: 100%;
            height: 370px;
        }

        @media (min-width: 768px) {
            flex-direction: row;
            .ip-final-cta-image {
                width: 50%;
                height: auto;
                aspect-ratio: 3/4;
                max-height: 630px;
                order: 2;
            }
            .ip-final-cta-copy {
                width: 50%;
                gap: initial;
            }
            .primary-cta {
                flex-direction: row !important;
            }
            .no-account-needed {
                text-align: left !important;
            }
        }
    }

    .ip-newsletter-cta {
        display: flex;
        flex-direction: row;
        gap: 0;
        width: 100%;
        max-width: 700px;

        input, button {
            font-size: var(--text-base);
            padding: var(--space-sm);
            border: 0;
            outline: 0;
            line-height: 1.5;
        }

        input {
            flex: 1;
            border-top-left-radius: var(--rounded);
            border-bottom-left-radius: var(--rounded);
        }
        button {
            border: 0;
            border-top-right-radius: var(--rounded);
            border-bottom-right-radius: var(--rounded);
        }
    }

    /* How It Works steps: stacked on mobile, row on desktop */
    .ip-steps {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);

        @media (min-width: 768px) {
            flex-direction: row;
        }
    }

    .ip-step {
        display: flex;
        flex: 1;
        align-items: flex-start;
    }

    .ip-step-num {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 9999px;
        font-weight: 700;
        font-size: var(--text-base);
        flex-shrink: 0;
    }

    /* Menu cards: stacked on mobile, 2-col on desktop */
    .ip-menu-cards {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);

        @media (min-width: 640px) {
            flex-direction: row;
            align-items: stretch;
        }
    }

    .ip-menu-card {
        flex: 1;
    }

    .ip-menu-card-wide {
        flex: 1;
    }

    .ip-order-sections {
        display: flex;
        flex-direction: column;
        gap: var(--space-lg);
        margin-top: var(--space-lg);
    }

    .ip-order-category-section + .ip-order-category-section {
        border-top: var(--border) solid var(--neutral-300);
        padding-top: var(--space-lg);
    }

    /* Order page grid: keep cards a consistent width and cap the row at 4 cards */
    .ip-order-grid {
        --ip-order-card-width: calc((100% - var(--space-sm)) / 2);
        gap: var(--space-xs);
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: no-wrap;
        
        img {
            max-height: 100px;
        }

        .item-card {
            width: 240px !important;
        }

        @media (min-width: 640px) {
            img {
                max-height: initial;
            }
        }

        @media (min-width: 768px) {
            align-items: stretch;
            --ip-order-card-width: calc((100% - var(--space-sm)) / 2);
            gap: var(--space-sm);
            grid-template-columns: repeat(auto-fill, minmax(var(--ip-order-card-width), var(--ip-order-card-width)));
            display: grid;

            .item-card {
                width: 100% !important;
            }
        }

        @media (min-width: 960px) {
            --ip-order-card-width: calc((100% - (2 * var(--space-sm))) / 3);
        }

        @media (min-width: 1280px) {
            --ip-order-card-width: calc((100% - (3 * var(--space-sm))) / 4);
        }
    }

    .ip-order-card {
        height: 100%;
    }

    /* Pickup window cards: always side-by-side */
    .ip-pickup-cards {
        display: flex;
        gap: var(--space-md);
    }

    .ip-pickup-card {
        flex: 1;
    }

    /* Benefits: stacked on mobile, 3-col on desktop */
    .ip-benefits {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);

        @media (min-width: 768px) {
            flex-direction: row;
            align-items: stretch;
        }
    }

    .ip-benefit-card {
        flex: 1;
        border: 1px solid color-mix(in srgb, var(--brand-2) 10%, transparent);
    }

    /* Large decorative glyph icon */
    .ip-benefit-glyph {
        display: block;
        font-size: var(--text-2xl);
        color: var(--brand-2);
        line-height: 1;
    }

    /* Testimonials: stacked on mobile, 2-col on desktop */
    .ip-testimonials {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);

        @media (min-width: 640px) {
            flex-direction: row;
        }
    }

    .ip-testimonial {
        flex: 1;
    }

    /* ----------------------------------------
       Desktop nav links */
    .desktop {
        display: flex;
        position: relative;
        align-items: center;
        gap: var(--space-md);
        height: 100%;
        min-height: var(--height-md);

        .nav-link {
            position: relative;
            display: flex;
            align-items: center;
            height: 100%;
            text-decoration: none;
            color: var(--text-muted);
            font-weight: var(--font-base);

            &:hover {
                color: var(--text-primary);
            }

            /* &.active::after {
                content: "";
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                height: 4px;
                background-color: var(--brand-1);
            } */
        }
    }

    /* Mobile menu */
    .mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: start;
        padding-top: var(--space-md);
        gap: 1rem;

        .nav-link {
            padding: 1rem;
            font-size: var(--text-lg);
            font-weight: var(--font-semibold);
            text-decoration: none;
            color: var(--white);

            &:active {
                background-color: var(--brand-1);
            }
        }
    }

    /* Crud Header (for tables, forms – also used in custom scaffolds /erb/scaffold/*) */
    .crud-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: var(--space-2xl);

        h3 {
            margin: 0;
        }
    }

    /* Menu Item Category Tabs */
    .item-category-tabs {
        padding-top: var(--space-md);
        padding-bottom: var(--space-lg);
        display: block;

        .wrapper {
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
            gap: var(--space-xs);
        }

        .tab-link {
            cursor: pointer;
            border: var(--border) solid var(--brand-1-light);
            text-decoration: none;
            color: var(--midtone);
            transition: all 0.2s ease-in-out;
            margin-bottom: var(--space-2xs);
            border-radius: var(--rounded);

            img, .placeholder {
                display: none;
            }
            
            &:hover, &.active {
                color: var(--white) !important;
                background: var(--brand-1);
            }
        }

        @media (max-width: 640px) {
            .wrapper {
                flex-wrap: nowrap;
                overflow-x: auto;
                gap: var(--space-3xs);
            }

            --thumbnail-width: 150px;
            --thumbnail-height: 80px;

            .tab-link {
                border: 0;
                white-space: nowrap;
                width: calc(var(--thumbnail-width) + 2 * var(--space-xs));
                text-align: center;
                display: flex;
                flex-direction: column;
                gap: var(--space-2xs);
                border-radius: var(--rounded-lg);

                .name {
                    text-overflow: ellipsis;
                    overflow: hidden;
                    white-space: nowrap;
                }

                img, .placeholder {
                    width: var(--thumbnail-width);
                    display: block;
                    max-width: initial;
                    height: var(--thumbnail-height);
                }

                .placeholder {
                    display: flex;
                }
                
                &:last-child {
                    border-bottom: none;
                }
            }
        }
    }

    /* Menu Order Cart */
        #cart {
            pointer-events: auto;
    
    
            left: 0;
            width: 100%;
            height: 100%;
    
            .line-item-wrapper {
                max-height: initial;
                overflow-y: auto;
            }

            .cart-line-item {
                img, .img-placeholder {
                    width: 150px;
                    height: 100%;
                    object-fit: cover
                }
            }
    
            @media (min-width: 768px) {
                position: absolute;
                right: 0;
                transition: opacity 0.2s ease-in-out;
                width: 720px;
                height: 100%;
    
                .line-item-wrapper {
                    padding-right: 1rem;
                }

                .cart-line-item {
                    img, .img-placeholder {
                        width: 220px;
                        height: 160px;
                        object-fit: cover
                    }

                    h3 {
                        white-space: initial !important;
                    }
                }
            }
        }

    /* Front Display System */
    .fds-order-kanban {
        display: grid;
        grid-template-columns: repeat(3, minmax(320px, 1fr)) !important;
        gap: 1rem;
        position: relative;
        align-items: start;

        &:has(.kitchen-swim-lane.collapsible) {
        grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr) 3.75rem !important;
        }
        &:has(.kitchen-swim-lane.collapsible.show) {
            grid-template-columns: repeat(3, minmax(320px, 1fr)) !important;
        }
    }

    /* Kitchen Order Card */
    kitchen-order-card {
        display: block;
        height: min-content;
        cursor: grab;
        user-select: none;
        -webkit-user-select: none;

        &.kanban-chosen {
        opacity: 0.5;
        transform: scale(0.92);
        box-shadow: var(--shadow-lg);
        }

        &.kanban-ghost {
        opacity: 0.7;
        transform: scale(0.92);
        }

        &.kanban-drag {
        opacity: 0.7;
        transform: rotate(-3deg);
        }

        .kitchen-order-card {
            background: var(--dark);
        }

        .order-badge {
            border: none;
            border-radius: 50em;
            width: 5.5rem;
            padding: 0.5rem 0.75rem;
            text-align: center;
            font-size: 0.75rem;
        }

        .order-badge.now {
            background-color: var(--error);
        }

        .order-badge.lunch {
            background-color: var(--info);
        }

        .order-badge.dinner {
            background-color: var(--brand-3);
        }
    }

    /* Kitchen Swim Lane */
    .kitchen-swim-lane {
        border-top: var(--rounded-lg) solid;

        &.collapsible {
            max-width: 3.75rem;
            [data-kanban-target="lane"], .kcs-empty-state {
                display: none !important;
            }

            header {
                /* rotate 90 deg to right */
                transform: rotate(90deg);
                transform-origin: left top;
                position: relative !important;
                left: 2.5rem;
                top: 1.5rem !important;
                width: max-content;
                align-items: center;
                border-bottom: 0 !important;

                button {
                    transform: rotate(-90deg);
                }
                svg.collapse {
                    display: flex !important;
                }
                svg.expand {
                    display: none !important;
                }

                .scroll-arrows {
                    display: none !important;
                }
            }

            &.show {
                max-width: none;
                header {
                    /* rotate 90 deg to right */
                    transform: rotate(0deg);
                    left: initial;
                    top: 0 !important;
                    width: initial;
                    border-bottom: var(--border-sm) solid var(--midtone) !important;
                    
                    button {
                        transform: rotate(0deg);
                    }
                    
                    svg.collapse {
                        display: none !important;
                    }
                    
                    svg.expand {
                        display: flex !important;
                    }

                    .scroll-arrows {
                        display: flex !important;
                    }
                }
                [data-kanban-target="lane"], .kcs-empty-state {
                    display: flex !important;
                }
            }
        }
    
        &.open {
            border-color: var(--success);
        }
    
        &.preparing {
            border-color: var(--info);
        }
    
        &.ready {
            border-color: var(--warning);
        }
    
        &.picked-up {
            border-color: var(--midtone);
        }

        &.not-picked-up {
            border-color: var(--black);
        }

        /* Sortable drop zone — fill available space so empty lanes accept drops */
        .kcs-sortable-lane {
            min-height: 60vh;
            flex: 1;
        }

        .kcs-empty-state {
            margin-top: auto;
        }

        &.kanban-ghost {
            opacity: 0.35;
        }
    
        &.kanban-drag {
            cursor: grabbing;
        }
    }

    /* Checkout Review */
    .checkout-review {
        display: flex;

        .pickup-time-options {
            align-items: stretch;
        }

        .checkout-pickup-option,
        .checkout-complete-purchase {
            width: 100%;
        }

        .payment-icon {
            width: 3rem;
        }

        .customer-info, .order-info {
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
            width: fit-content;
            min-width: 450px;
        }

        .order-info {
            min-width: 200px;

            .cart-line-item {
                min-height: initial !important;
                img {
                    min-height: 100px;
                    max-width: 120px;
                }

                h3, h4 {
                    font-size: var(--text-base) !important;
                }

                h4 {
                    color: var(--text-secondary) !important;
                }
            }
            
        }

        @media (max-width: 768px) {
            display: grid;
            margin: initial !important;
            width: auto !important;
            grid-template-areas: 
                "name"
                "pickup-time"
                "line-item-wrapper"
                "total"
                "payment";

            .stripe-info {
                width: initial !important;
                display: flex !important;
                align-items: center !important;
                justify-content: center;
            }

            .payment-methods {
                display: none !important;
            }

            .customer-info, .order-info {
                display: contents;
            }

            .name {
                grid-area: name;
            }
            
            .pickup-time {
                grid-area: pickup-time;
            }

            .payment {
                grid-area: payment;
            }

            .line-item-wrapper {
                grid-area: line-item-wrapper;
            }

            .total {
                grid-area: total;
            }
        }
    }

    .menu-item-modal {
        max-width: initial;
        padding: 0 !important;
        background: var(--white) !important;
        justify-content: start;
        
        .item-card {
            overflow-y: scroll;
            height: 100%;
            position: relative;
            display: flex;
            flex-direction: column;
            border-radius: 0;
        }

        .item-card-info {
            padding: 0 var(--space-sm) !important;
            width: 100%;
            display: flex;
            position: relative;
            z-index: 100;
        }

        .mobile-actions {
            box-shadow: 0 -1px 20rem -1px rgb(0 0 0 / 0.25);
            position: sticky;
            bottom: 0;
            z-index: 101;
            background: var(--white);
        }

        .item-image, .item-placeholder {
            border-radius: 0;
            max-height: 350px !important;
            min-width: 100%;
            width: 100% !important;
        }

        .close-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: absolute;
            top: 0.5rem;
            left: 0.5rem;
        }

        @media (min-width: 768px) {
            max-width: 420px;
            margin: 0 auto;
            background: transparent !important;
            justify-content: center;

            form {
                position: relative;
            }

            .item-card {
                position: relative;
                overflow-y: scroll;
                scrollbar-width: none;
                height: initial;
                border-radius: var(--rounded-lg);
            }

            .item-image, .item-placeholder {
                max-height: 240px !important;
                aspect-ratio: 4 / 3;
                width: 100%;
                border-top-left-radius: var(--rounded-lg);
                border-top-right-radius: var(--rounded-lg);
            }

            .mobile-actions {
                box-shadow: none;
                border-bottom-left-radius: var(--rounded-lg);
                border-bottom-right-radius: var(--rounded-lg);
            }

            .close-btn {
                width: 40px;
                height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
                position: absolute;
                top: 0.5rem;
                left: 0.5rem;
            }
        }
    }

    .ip-sticky-bar {
        position: sticky;
            bottom: 0;
            z-index: 101;
            background: var(--white);

        &.ip-shadow-top {
        box-shadow:
            0px -3px 7px 0px rgba(0, 0, 0, 0.03),
            0px -13px 13px 0px rgba(0, 0, 0, 0.03),
            0px -29px 18px 0px rgba(0, 0, 0, 0.02),
            0px -52px 21px 0px rgba(0, 0, 0, 0.01),
            0px -81px 23px 0px rgba(0, 0, 0, 0);
        }
    }

    /* Menu Order Page */
    .ip-container {
        max-width: 1280px;

        @media (max-width: 640px) {
            padding-top: var(--space-sm) !important;
            padding-left: var(--space-sm) !important;
            padding-right: var(--space-sm) !important;
        }
    }

    /* SVG Color helpers */
    /* We might need a naming convention later if requirement grows */
    .svg-path-stroke-white {
        path {
            stroke: var(--white);
        }
    }

    .svg-path-fill-white {
        path {
            fill: var(--white);
        }
    }
}
