/* ==========================================================================
   SIPO API — dynamic component styles
   Status strip, branch badges, hours tables, menu page.

   Self-contained on purpose: these styles land on two different page designs
   (the Bootstrap branch pages and the Kilbirnie page), so nothing here relies
   on either one's design tokens.
   ========================================================================== */

:root {
    --ss-open-bg: #14532d;
    --ss-open-fg: #d7f5e3;
    --ss-open-dot: #4ade80;
    --ss-closed-bg: #7f1d1d;
    --ss-closed-fg: #ffe1da;
    --ss-closed-dot: #fca5a5;
    --ss-error-bg: #3f3f46;
}

/* ---- Status strip -------------------------------------------------------
   Fixed at the very top. Both page designs put their navbar in fixed
   position at top:0, so the strip claims that slot and the rules below push
   each navbar down by the strip's measured height (--strip-height, published
   by statusManager.js).                                                    */
.status-strip {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
    background: var(--ss-error-bg);
    color: #fff;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.6rem 1rem;
    line-height: 1.35;
}

.status-strip.open { background: var(--ss-open-bg); color: var(--ss-open-fg); }
.status-strip.closed { background: var(--ss-closed-bg); color: var(--ss-closed-fg); }
.status-strip.error { background: var(--ss-error-bg); color: #f4f4f5; }

.status-strip-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.status-strip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.status-strip.open .status-strip-dot {
    background: var(--ss-open-dot);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: ss-pulse 2.4s infinite;
}

.status-strip.closed .status-strip-dot { background: var(--ss-closed-dot); }

@keyframes ss-pulse {
    70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* Two copies of the line; the short one wins on narrow screens where the
   full sentence wrapped onto three lines and ate the viewport. */
.ss-short { display: none; }
.ss-full { display: inline; }

@media (max-width: 640px) {
    .status-strip { font-size: 0.7rem; letter-spacing: 0.08em; }
    .ss-short { display: inline; }
    .ss-full { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .status-strip.open .status-strip-dot { animation: none; }
}

/* ---- Make room for the strip -------------------------------------------
   Body padding shifts normal flow; the two fixed navbars need their own
   `top` because fixed elements ignore that padding.                       */
body.has-status-strip { padding-top: var(--strip-height, 38px); }
body.has-status-strip header#site-header { top: var(--strip-height, 38px); }
body.has-status-strip .top-navbar .navbar { top: var(--strip-height, 38px); }

/* ---- Branch badges (selector page) ------------------------------------- */
.branch-status.is-open { color: #4ade80; }
.branch-status.is-closed { color: #fca5a5; }
.branch-status.is-open .branch-status-dot { background: #4ade80; }
.branch-status.is-closed .branch-status-dot { background: #fca5a5; }

/* ---- Hours tables ------------------------------------------------------ */
.hours-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.18);
}

.hours-row:last-child { border-bottom: 0; }
.hours-row .day { font-weight: 700; }
.hours-row .time { text-align: right; font-variant-numeric: tabular-nums; }
.hours-row .time.closed-day { opacity: 0.65; }
.hours-row.today { font-weight: 700; }

#footer-hours { list-style: none; margin: 0; padding: 0; }

#footer-hours li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.28rem 0;
}

#footer-hours .time.closed-day { opacity: 0.65; }

/* ---- Menu page --------------------------------------------------------- */
/* Branch stylesheets style bare `nav` elements for their own mobile drawers
   (position: absolute; max-height: 0), which would otherwise collapse this
   bar to nothing. Hold the layout explicitly so it can't be hijacked. */
.m-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.9rem 0;
    scrollbar-width: none;
    position: static;
    width: auto;
    max-height: none;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
}

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

.m-navlink {
    flex: none;
    padding: 0.45em 1.1em;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    white-space: nowrap;
    color: inherit;
    opacity: 0.65;
    transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.m-navlink:hover { opacity: 1; }

.m-navlink.is-active {
    opacity: 1;
    background: #b83526;
    border-color: #b83526;
    color: #fff;
}

.m-cat { padding-top: 2.6rem; scroll-margin-top: calc(var(--strip-height, 38px) + 90px); }
.m-cat-head { margin-bottom: 1.2rem; position: static; background: none; box-shadow: none; }
.m-cat-head h2 { margin: 0; }
.m-cat-head p { margin: 0.35rem 0 0; opacity: 0.7; }

.m-count {
    display: inline-block;
    margin-top: 0.45rem;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.6;
}

.m-list { list-style: none; margin: 0; padding: 0; }

.m-item {
    display: grid;
    grid-template-columns: 76px 1fr auto;
    gap: 1.1rem;
    align-items: start;
    padding: 1.05rem 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.18);
}

.m-item:last-child { border-bottom: 0; }

/* No thumbnail: let the text start in column 1 instead of leaving a gap. */
.m-item > .m-body { grid-column: 1 / 3; }
.m-item > .m-thumb + .m-body { grid-column: 2; }
.m-item > .m-price { grid-column: 3; }

.m-thumb {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: 8px;
    background: rgba(128, 128, 128, 0.12);
    grid-column: 1;
}

.m-name { margin: 0; font-size: 1.02rem; font-weight: 700; line-height: 1.25; }
.m-desc { margin: 0.3rem 0 0; font-size: 0.88rem; opacity: 0.72; line-height: 1.5; max-width: 58ch; }

.m-price {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
    padding-left: 0.5rem;
}

.m-size { display: block; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.m-size span { opacity: 0.65; font-weight: 400; margin-right: 0.5em; }

#menu-status {
    padding: 2.5rem 0;
    text-align: center;
    opacity: 0.75;
}

@media (max-width: 560px) {
    /* Tighter page head so the menu itself is above the fold on a phone. */
    .api-page-head { padding: 1.8rem 0 1.2rem; }
    .api-page-head h1 { font-size: 1.9rem; }
    .api-page-body { padding-top: 0.25rem; }
    .m-cat { padding-top: 1.8rem; }

    .m-item { grid-template-columns: 60px 1fr; gap: 0.2rem 0.85rem; padding: 0.9rem 0; }
    .m-thumb { width: 60px; height: 60px; }
    .m-item > .m-thumb + .m-body { grid-column: 2; }

    /* Price sits under the dish text, still right-aligned, with size variants
       flowing inline instead of stacking into a tall column. */
    .m-item > .m-price {
        grid-column: 2 / -1;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0 0.9rem;
        text-align: right;
        padding-left: 0;
    }
    .m-desc { font-size: 0.85rem; }
}

/* ---- Featured dishes (home pages) -------------------------------------- */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 40px;
}

.fcard {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(128, 128, 128, 0.18);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fcard:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12); }
.fcard-media { display: block; overflow: hidden; background: rgba(128, 128, 128, 0.1); }

.fcard-media img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fcard:hover .fcard-media img { transform: scale(1.05); }

.fcard-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.1rem 1.2rem 1.3rem;
    flex: 1;
}

.fcard-cat {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
    color: #b83526;
}

.fcard-name { font-size: 1.05rem; font-weight: 700; line-height: 1.25; }

.fcard-desc {
    font-size: 0.87rem;
    opacity: 0.72;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fcard-price {
    margin-top: auto;
    padding-top: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.menu-cta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 44px;
}

@media (max-width: 992px) { .featured-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .featured-grid { grid-template-columns: 1fr; } }

/* ---- Branch-page contact strip (Lower Hutt / Johnsonville) --------------
   That block sits on a black panel: its native <p class="lead"> is white,
   but links there default to near-black and the injected hours inherit #666,
   so both need lifting or they vanish into the background.               */
.contact-imfo-box #contact-hours-table,
.contact-imfo-box .sipo-address,
.contact-imfo-box a.sipo-phone { color: #fff; }

.contact-imfo-box a.sipo-phone:hover { color: #d4af37; }

.contact-imfo-box .hours-row {
    border-bottom-color: rgba(255, 255, 255, 0.16);
    font-size: 0.95rem;
    padding: 0.45rem 0;
}

.contact-imfo-box .hours-row .time.closed-day { opacity: 0.7; }

/* ---- Generated menu / contact pages ------------------------------------
   These pages inherit each branch's own header and footer, so this only
   styles the block between them and stays palette-neutral.               */
/* Each branch pins its navbar, which takes it out of flow. Home pages hide
   that behind a hero; these pages have none, so they pad past the measured
   nav height (--nav-height, published by statusManager). The status strip is
   already handled by body.has-status-strip, so it is not counted again. */
.api-page {
    padding-top: calc(var(--nav-height, 92px) + 0.75rem);
    padding-bottom: 4rem;
}

.api-page-head {
    padding: 3.2rem 0 2rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    margin-bottom: 1rem;
}

.api-page-head h1 { margin: 0 0 0.4rem; line-height: 1.15; }
.api-page-head p { margin: 0; opacity: 0.72; }
.api-page-body { padding-top: 1rem; }

.api-page .container {
    max-width: 1140px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.api-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.api-card {
    padding: 28px;
    border: 1px solid rgba(128, 128, 128, 0.22);
    border-radius: 12px;
}

.api-card h2 { margin: 0 0 1rem; font-size: 1.3rem; }

.api-label {
    margin: 1.1rem 0 0.2rem;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.6;
}

.api-card .api-label:first-of-type { margin-top: 0; }

.api-map {
    margin-top: 28px;
    height: 380px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(128, 128, 128, 0.22);
}

.api-btn {
    display: inline-block;
    padding: 0.8em 1.8em;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: inherit;
    transition: background 0.25s ease, color 0.25s ease;
}

.api-btn.primary { background: #b83526; border-color: #b83526; color: #fff; }
.api-btn.primary:hover { background: #962a1d; border-color: #962a1d; color: #fff; }
.api-btn:hover { background: rgba(128, 128, 128, 0.12); }

@media (max-width: 860px) {
    .api-contact-grid { grid-template-columns: 1fr; }
    .api-map { height: 300px; }
}

/* ---- "View Menu" call to action under the deals row -------------------- */
.api-view-menu { padding: 2.2rem 0 0.5rem; }
