/* components.css — reusable UI primitives (btn, card, form, scroller, menu-item),
   page-chrome (header hamburger, nav backdrop), and cross-cutting polish. */

/* ============================================================
   Section glyph (decorative icon above section headings)
   ============================================================ */

.section-glyph {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    color: var(--ember);
}

/* ============================================================
   Icon utility (for inline SVG icons, sized by class)
   ============================================================ */

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    stroke: currentColor;
    flex-shrink: 0;
}

.icon-lg  { width: 1.5em; height: 1.5em; }
.icon-xl  { width: 2em;   height: 2em; }
.icon-2xl { width: 2.5em; height: 2.5em; }
.icon-3xl { width: 3em;   height: 3em; }

/* ============================================================
   Button primitive — `.btn-ib`
   Brand spec CTA semantics:
     - Primary CTA      → `.btn-ib--white-ghost`  (white border, transparent fill — used on dark surfaces)
                          or `.btn-ib--ghost`      (ember border, transparent fill — for light surfaces)
     - Secondary/accent → `.btn-ib--accent` or bare `.btn-ib` (ember-filled, for emphasis moments)
     - Order Online specifically → `.btn-ib--white-ghost` (red as default reads as "active")
   ============================================================ */

.btn-ib {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 14px 22px; /* brand spec */
    font-family: var(--font-display);
    font-size: var(--fs-base);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--cream);
    background: var(--ember);
    border: 1px solid var(--ember);
    border-radius: var(--radius-sm); /* 4px max */
    cursor: pointer;
    transition: background-color var(--dur-base) var(--ease-out),
                border-color var(--dur-base) var(--ease-out),
                color var(--dur-base) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}

.btn-ib:hover,
.btn-ib:focus-visible {
    background: var(--ember-hover);
    border-color: var(--ember-hover);
    color: var(--cream);
    text-decoration: none;
}

.btn-ib:active { transform: translateY(1px); }

.btn-ib--ghost {
    background: transparent;
    color: var(--ember);
}

.btn-ib--ghost:hover,
.btn-ib--ghost:focus-visible {
    background: var(--ember);
    color: var(--cream);
}

/* Explicit ember-filled accent — semantic alias of bare `.btn-ib` */
.btn-ib--accent {
    /* inherits all ember-filled styles from `.btn-ib` base */
}

/* White-bordered ghost — used over dark sections (header, hero, promise) */
.btn-ib--white-ghost {
    background: transparent;
    border-color: var(--cream);
    color: var(--cream);
}

.btn-ib--white-ghost:hover,
.btn-ib--white-ghost:focus-visible {
    background: var(--cream);
    border-color: var(--cream);
    color: var(--ink);
}

.btn-ib--dark {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--cream);
}

.btn-ib--dark:hover,
.btn-ib--dark:focus-visible {
    background: var(--ember);
    border-color: var(--ember);
}

/* ============================================================
   Card primitive
   ============================================================ */

.card-ib {
    background: var(--cream);
    color: var(--ink);
    padding: var(--sp-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur-base) var(--ease-out),
                box-shadow var(--dur-base) var(--ease-out);
}

.card-ib--dark {
    background: color-mix(in oklch, var(--ink) 92%, var(--stone));
    color: var(--cream);
}

.card-ib:hover {
    box-shadow: var(--shadow-md);
}

/* Respect reduced-motion for transform-based hovers across the site */
@media (prefers-reduced-motion: reduce) {
    .card-ib:hover,
    .about-photo:hover,
    .value-card:hover,
    .home-hero .hero-image:hover,
    .home-hero:hover .hero-image,
    #testimonials .testimonial-block:hover,
    .menu-box .menu-details:hover .menu-thumbnail img,
    .social-icons a:hover,
    .footer-privacy a:hover,
    .footer-privacy button:hover,
    .btn-ib:active {
        transform: none;
    }
}

/* ============================================================
   Form field primitive
   ============================================================ */

.field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.field > label {
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.field > input,
.field > textarea,
.field > select {
    padding: var(--sp-3) var(--sp-4);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    color: var(--ink);
    background: var(--cream);
    border: 1px solid color-mix(in oklch, var(--ink) 25%, var(--cream));
    border-radius: var(--radius-sm);
    transition: border-color var(--dur-base) var(--ease-out),
                box-shadow var(--dur-base) var(--ease-out);
}

.field > input:focus-visible,
.field > textarea:focus-visible,
.field > select:focus-visible {
    outline: none;
    border-color: var(--ember);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ember) 35%, transparent);
}

/* ============================================================
   Typographic helpers — editorial rhythm
   ============================================================ */

.eyebrow {
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ember);
    display: inline-block;
    margin-bottom: var(--sp-3);
}

.display {
    font-family: var(--font-display);
    font-size: var(--fs-5xl);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    margin: 0 0 var(--sp-5);
}

.measure { max-width: var(--measure); }

.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
    align-items: center;
}

/* Pills row — small-caps brand feature list with dot separators */
.pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3) var(--sp-4);
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: 0.03em;
    margin-bottom: var(--sp-5);
}

.pills .pill {
    color: var(--ember);
}

.pills .pill-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: color-mix(in oklch, var(--stone) 70%, transparent);
}

/* ============================================================
   Section lede (editorial section header pattern)
   Eyebrow → heading → supporting copy, centered, capped measure.
   ============================================================ */

.section-lede {
    text-align: center;
    max-width: 60ch;
    margin-inline: auto;
    padding-inline: var(--sp-4);
    margin-bottom: var(--sp-8);
}

.section-lede .eyebrow {
    color: var(--ember);
    letter-spacing: 0.2em;
    font-size: var(--fs-xs);
}

.section-lede h1,
.section-lede h2 {
    margin: var(--sp-3) 0 var(--sp-4);
}

.section-lede p {
    color: color-mix(in oklch, var(--cream) 78%, transparent);
}

/* ============================================================
   Menu item styling (shared by Home Customer Favorites + Menu page)
   Works for both _MenuItemSimple and _MenuItemWithImage partials.
   ============================================================ */

.menu-box .menu-details {
    margin-inline: calc(var(--sp-3) * -1);
    padding-inline: var(--sp-3);
    padding-block: var(--sp-2);
    border-radius: var(--radius-md);
    transition: background-color var(--dur-base) var(--ease-out);
}

.menu-box .menu-details:hover {
    background: color-mix(in oklch, var(--cream) 5%, transparent);
}

.menu-box .menu-item-name {
    transition: color var(--dur-base) var(--ease-out);
}

.menu-box .menu-details:hover .menu-item-name {
    color: var(--ember);
}

/* Thumbnail sizing — legacy markup pairs an unwidthed .menu-thumbnail with
   a sibling carrying Bootstrap's w-100, which starves the image on desktop.
   Give it a real flex basis so the image always has room. */
.menu-box .menu-item .menu-thumbnail {
    overflow: hidden;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.menu-box .menu-item .menu-thumbnail img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform var(--dur-slow) var(--ease-out);
}

/* Cap thumbnail to a sensible square on phones so a single menu item doesn't
   take a full screen vertically (legacy column flex stacks image above text). */
@media (max-width: 991px) {
    .menu-box .menu-item .menu-thumbnail {
        width: 120px;
        margin-right: var(--sp-3);
        margin-bottom: var(--sp-2);
        align-self: flex-start;
    }
}

@media (min-width: 992px) {
    .menu-box .menu-item .menu-thumbnail {
        width: 140px;
        margin-right: var(--sp-4);
    }

    .menu-box .menu-item > .d-flex {
        min-width: 0;
    }

    .menu-box .menu-item-name {
        min-width: 0;
        word-break: break-word;
    }
}

.menu-box .menu-details:hover .menu-thumbnail img {
    transform: scale(1.04);
}

.menu-sub-category-name {
    position: relative;
    padding-left: var(--sp-4);
}

.menu-sub-category-name::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--ember);
    border-radius: 1px;
    rotate: 45deg;
}

/* ============================================================
   Scroll-snap carousel (replaces Owl Carousel)
   ============================================================ */

/* ============================================================
   Scroll-snap carousel (replaces Owl Carousel)
   ============================================================ */

.scroller {
    display: flex;
    gap: var(--sp-5);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: var(--sp-4);
}

.scroller::-webkit-scrollbar { display: none; }

.scroller > .item {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.scroller-dots {
    display: flex;
    justify-content: center;
    gap: var(--sp-2);
    padding-top: var(--sp-4);
    list-style: none;
    margin: 0;
}

.scroller-dots button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--cream);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background-color var(--dur-base) var(--ease-out),
                transform var(--dur-base) var(--ease-out),
                border-color var(--dur-base) var(--ease-out);
}

.scroller-dots button[aria-current="true"] {
    background: var(--ember);
    border-color: var(--ember);
    transform: scale(1.2);
}

/* ============================================================
   Sticky header (replaces mega-menu sticky_header plugin option)
   ============================================================ */

.header {
    transition: background-color var(--dur-base) var(--ease-out);
}

/* The .is-stuck class is added on scroll by app.js. Header is already
   position:fixed at all times, so we don't repaint chrome here — leaving
   this empty keeps the header flat (no shadow line, no size shrink). */

/* ============================================================
   Mobile hamburger + slide-in nav drawer
   Visible ≤ 992px — replaces mega-menu mobile collapse behavior.
   ============================================================ */

.nav-hamburger {
    display: none;
    position: absolute;
    top: 18px;
    right: var(--sp-5);
    z-index: calc(var(--z-nav) + 1);
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--cream);
    cursor: pointer;
}

.nav-hamburger svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    fill: none;
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-slow) var(--ease-out);
    z-index: calc(var(--z-nav) - 1);
}

/* Mobile-drawer-only chrome — hidden on desktop. The bumped specificity
   matters: `.menu-links > li { display: inline-block }` in header.css is
   0,0,1,1 and would otherwise win against a plain `.menu-drawer-head` rule,
   leaving the duplicate wordmark + close button visible in the topbar. */
.menu-links > li.menu-drawer-head,
.menu-link-row .menu-link-icon,
.menu-link-row .menu-link-chev,
.menu-order-cta__arrow {
    display: none;
}

@media (max-width: 992px) {
    .nav-hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Full-screen drawer: covers the viewport edge to edge, slides in from the right. */
    .header .menu-links {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw;
        max-width: 100%;
        padding: 0;
        background: var(--ink);
        transform: translateX(100%);
        transition: transform var(--dur-slow) var(--ease-out);
        z-index: var(--z-nav);
        display: flex !important;
        flex-direction: column;
        gap: 0;
        overflow-y: auto; /* falls back to scroll on very short screens */
        overscroll-behavior: contain;
        margin: 0;
    }

    .header[data-mobile-open="true"] .menu-links {
        transform: translateX(0);
    }

    .header[data-mobile-open="true"] .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .header .menu-links > li {
        display: block;
        width: 100%;
        float: none;
    }

    /* === Drawer header: logo top-left + close button top-right === */
    .menu-drawer-head {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: var(--sp-3);
        padding: var(--sp-4) var(--sp-5);
        flex: 0 0 auto;
        border-bottom: 1px solid color-mix(in oklch, var(--cream) 10%, transparent);
    }

    .menu-drawer-logo {
        display: inline-flex;
        align-items: center;
        line-height: 0;
    }

    .menu-drawer-logo img {
        width: 140px;
        height: auto;
        /* Wordmark SVG is black paths — invert to cream (matches header.css filter) */
        filter: invert(94%) sepia(5%) saturate(280%) hue-rotate(2deg) brightness(96%);
    }

    .menu-drawer-close {
        width: 44px;
        height: 44px;
        padding: 0;
        background: transparent;
        border: 0;
        color: var(--cream);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .menu-drawer-close svg {
        width: 26px;
        height: 26px;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        fill: none;
    }

    /* The default mobile hamburger button overlaps the drawer header.
       Hide it once the drawer is open since the drawer has its own close X. */
    .header[data-mobile-open="true"] .nav-hamburger {
        display: none;
    }

    /* === Scrollable rows (Bagels / Coffee / About / Contact / Discounts) === */

    /* The inner <li> rows make up a vertically scrollable list between the
       fixed header and the bottom-pinned CTA. */
    .header .menu-links > li.menu-link-row {
        flex: 0 0 auto;
    }

    .header .menu-links {
        /* Re-establish a proper column flex for the drawer chrome.
           The .menu-link-row siblings live in a scroll wrapper below. */
    }

    .header .menu-links > li.menu-link-row:first-of-type {
        margin-top: 0;
    }

    /* Each nav row: ember-outlined icon, centered uppercase label, chev right.
       Hairline separator between rows (handled by border-bottom on the link). */
    .menu-link-row > a {
        display: grid !important;
        grid-template-columns: 56px 1fr 56px;
        align-items: center;
        gap: var(--sp-3);
        padding: var(--sp-5) var(--sp-5);
        min-height: 64px;
        font-family: var(--font-display);
        font-size: var(--fs-lg);
        font-weight: 600;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        color: var(--cream);
        text-decoration: none;
        border: 0;
        border-bottom: 1px solid color-mix(in oklch, var(--cream) 12%, transparent);
        transition: background-color var(--dur-base) var(--ease-out),
                    color var(--dur-base) var(--ease-out);
    }

    .menu-link-row > a:hover,
    .menu-link-row > a:focus-visible {
        background: color-mix(in oklch, var(--ember) 10%, transparent);
        color: var(--cream);
    }

    .menu-link-row .menu-link-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1.5px solid var(--ember);
        border-radius: 50%;
        color: var(--ember);
        flex-shrink: 0;
    }

    .menu-link-row .menu-link-icon svg {
        width: 26px;
        height: 26px;
        display: block;
    }

    .menu-link-row .menu-link-label {
        text-align: center;
        line-height: 1;
    }

    .menu-link-row .menu-link-chev {
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
        font-family: var(--font-display);
        font-size: 1.75rem;
        line-height: 1;
        color: color-mix(in oklch, var(--cream) 60%, transparent);
        font-weight: 400;
    }

    /* Bottom-pinned ORDER ONLINE CTA — full-width white-ghost button. */
    .header .menu-links > li.menu-link-cta {
        margin: auto var(--sp-5) var(--sp-5);
        flex: 0 0 auto;
        padding: 0;
    }

    .header .menu-links > li.menu-link-cta > a.menu-order-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: var(--sp-4) var(--sp-5);
        font-family: var(--font-display);
        font-size: var(--fs-md);
        font-weight: 600;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        background: transparent;
        color: var(--cream);
        border: 1px solid var(--cream);
        border-radius: var(--radius-sm);
        text-decoration: none;
        text-align: center;
        transition: background-color var(--dur-base) var(--ease-out),
                    color var(--dur-base) var(--ease-out);
    }

    .header .menu-links > li.menu-link-cta > a.menu-order-cta:hover,
    .header .menu-links > li.menu-link-cta > a.menu-order-cta:focus-visible {
        background: var(--cream);
        color: var(--ink);
    }

    .menu-order-cta__arrow { display: inline; }

    body:has(.header[data-mobile-open="true"]) {
        overflow: hidden;
    }
}

/* Tighter rhythm on very short screens (≤992 wide AND ≤700 tall) so all 5
   rows + CTA fit without requiring a scroll. */
@media (max-width: 992px) and (max-height: 700px) {
    .menu-link-row > a {
        padding-block: var(--sp-4);
        min-height: 56px;
        font-size: var(--fs-md);
    }
    .menu-drawer-head {
        padding-block: var(--sp-3);
    }
}
