/* ==========================================================
   Cookhouse Kitchen -- public site styles
   Mobile-first: base rules target small screens, then
   @media (min-width: ...) blocks widen things for larger ones.
   ========================================================== */

:root {
    --color-primary: #c65d2e;
    --color-primary-dark: #a3481f;
    --color-accent: #4a7c59;
    --color-cream: #fdf6ee;
    --color-text: #2c2420;
    --color-muted: #7a6f66;
    --color-border: #e8ddd0;
    --radius: 10px;
    --radius-s: 7px;
    --shadow: 0 2px 10px rgba(44, 36, 32, 0.08);
    --max-width: 1320px;

    /* Three-tier text scale: headings get the darkest ink, body copy the
       middle tier, and meta/muted text (timestamps, hints, placeholders)
       the lightest -- gives hierarchy without changing font-weight. */
    --ink: #2c2420;
    --ink-2: #5a5049;
    --ink-3: #948a80;

    /* Two-step shadow scale: -sm for resting cards, -md for hover/raised
       state, so "this is clickable" reads as an escalation rather than
       an on/off switch. */
    --shadow-sm: 0 1px 3px rgba(44, 36, 32, 0.07), 0 1px 2px rgba(44, 36, 32, 0.05);
    --shadow-md: 0 10px 25px rgba(44, 36, 32, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--color-text);
    background: #fff;
    line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-family: Georgia, 'Times New Roman', serif; }
p { margin: 0 0 1em; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-secondary:hover { background: var(--color-primary); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-outline { background: #fff; border: 1px solid var(--color-border); color: var(--color-text); }

/* ---------- Header / nav ---------- */
.site-header {
    border-bottom: 1px solid var(--color-border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--color-text); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 40px; width: auto; border-radius: 6px; }
.brand-name { font-family: Georgia, serif; font-size: 1.3rem; font-weight: bold; color: var(--color-primary-dark); }

.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--color-text); }

.site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 10px 20px 20px;
}
.site-nav.open { display: flex; }
.site-nav a { padding: 10px 0; color: var(--color-text); border-bottom: 1px solid var(--color-border); }
.site-nav a:last-child { border-bottom: none; }
.site-nav a.active { color: var(--color-primary); font-weight: 600; }
.site-nav a.nav-cta {
    margin-top: 10px;
    background: var(--color-primary);
    color: #fff;
    text-align: center;
    border-radius: 999px;
    border-bottom: none;
    padding: 10px;
}

@media (min-width: 800px) {
    .nav-toggle { display: none; }
    .site-nav {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        border: none;
        padding: 0;
        gap: 24px;
    }
    .site-nav a { border-bottom: none; padding: 6px 0; }
    .site-nav a.nav-cta { margin-top: 0; padding: 10px 20px; }
}

/* ---------- Hero / page-title background image ---------- */
/* A soft, warm illustrated background (not a real photo) sits behind
   the hero copy. The cream gradient overlay on top of it keeps text
   legible without needing to change any text colors below. */
.hero, .page-hero {
    background-image: linear-gradient(rgba(253, 246, 238, 0.82), rgba(253, 246, 238, 0.7)), url('../images/hero-bg.svg');
    background-size: cover;
    background-position: center;
    text-align: center;
}
.hero { padding: 50px 0; }
.hero h1 { font-size: 1.9rem; color: var(--color-primary-dark); }
.hero p { font-size: 1.1rem; color: var(--color-muted); max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

.page-hero { padding: 36px 0; }

@media (min-width: 700px) {
    .hero h1 { font-size: 2.6rem; }
}

section { padding: 40px 0; }
.section-title { text-align: center; margin-bottom: 30px; }
.section-title h2 { color: var(--color-primary-dark); }
.section-title p { color: var(--color-muted); }

/* ---------- Grids / cards ---------- */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
/* min-width:0 stops a long, unbreakable menu-item name or price from
   forcing its grid cell (and the whole page) wider than the viewport --
   grid/flex children default to min-width:auto, which ignores wrapping. */
.grid > * { min-width: 0; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 800px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 800px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
/* Subtle lift + shadow escalation on hover -- a cheap, tasteful way to
   signal "this card is worth a closer look" even where it isn't a link. */
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.card-image {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--color-cream) url('../images/placeholder-food.svg') center/cover no-repeat;
}
/* Sold-out state: badge in the image corner, image dimmed slightly, and
   the Order button (see card-price-row) is swapped for a muted label
   in the markup so the item simply can't be added to an order. */
.sold-out-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #93231b;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4px 10px;
    border-radius: 999px;
}
.card-sold-out .card-image { opacity: 0.55; }
.card-sold-out .card-body h3 { color: var(--color-muted); }
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.card-body h3 {
    margin-bottom: 6px;
    /* Clamp to 2 lines so cards in the same row stay the same height
       regardless of how long a dish name runs. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-price { color: var(--color-primary); font-weight: bold; font-size: 1.1rem; }
.card-price-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.card-body .btn { padding: 8px 18px; font-size: 0.88rem; flex-shrink: 0; }
.card-desc {
    color: var(--color-muted);
    flex: 1;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-category {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    font-weight: 600;
    margin-bottom: 6px;
}

/* ---------- Gallery ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 700px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
.gallery-item {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-cream) url('../images/placeholder-food.svg') center/cover no-repeat;
    cursor: pointer;
    border: none;
    padding: 0;
    display: block;
    width: 100%;
    transition: transform 0.15s ease;
}
.gallery-item:hover { transform: scale(1.03); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Lightbox (gallery viewer) ---------- */
/* A single translateX track, no slider library. Opened/closed via a
   .open class toggle in main.js; swipe, arrow-key and click-outside
   handling all live there too. */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(20, 16, 14, 0.92);
    align-items: center;
    justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox-viewport { width: 100%; max-width: 900px; overflow: hidden; touch-action: pan-y; }
.lightbox-track { display: flex; transition: transform 0.25s ease; }
.lightbox-track img { width: 100%; flex-shrink: 0; max-height: 80vh; object-fit: contain; }
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    /* Explicit z-index matters here: .lightbox is a flex container, and
       flex items are painted according to DOM order when z-index is
       auto (they're treated as if position:relative for stacking, per
       the flexbox spec) -- without this, .lightbox-viewport (which sits
       between .lightbox-prev and .lightbox-next in the markup) would
       paint on top of whichever button comes before it, silently
       swallowing its clicks even though the button is still visible. */
    z-index: 2;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-caption { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: #f0e8dd; font-size: 0.9rem; }

/* ---------- FAQ accordion ---------- */
/* CSS-only expand/collapse via a max-height transition (no animation
   library) -- main.js just toggles the .open class. */
.faq-item { border-bottom: 1px solid var(--color-border); }
.faq-question {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 16px 0;
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.faq-icon { flex-shrink: 0; font-size: 1.3rem; color: var(--color-primary); transition: transform 0.18s ease; }
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.faq-item.open .faq-answer { max-height: 400px; }
.faq-answer-inner { padding-bottom: 16px; color: var(--ink-2); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .form-row-2 { grid-template-columns: 1fr 1fr; } }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=number], textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
.form-hint { color: var(--color-muted); font-size: 0.85rem; margin-top: 4px; }
.form-error { color: #b3261e; font-size: 0.85rem; margin-top: 4px; }
/* Browsers give <fieldset> an implicit min-width: min-content, which
   stops it shrinking below the intrinsic width of whatever's inside it
   -- a wide flex child (like the item slider) then forces the fieldset,
   and everything around it, wider than the page instead of scrolling
   within itself. Overriding it to 0 is what actually lets that inner
   overflow-x:auto take effect. */
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; min-width: 0; }
legend { font-weight: 600; padding: 0 8px; }

.radio-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    display: block;
}
.radio-card input { width: auto; margin-right: 10px; }
.radio-card.selected { border-color: var(--color-primary); background: var(--color-cream); }

/* ---------- Order picker ---------- */
.order-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.order-item-row > div:first-child { min-width: 0; }
.order-item-row .item-name { font-weight: 600; overflow-wrap: break-word; }
.order-item-row .item-price { color: var(--color-muted); font-size: 0.9rem; }
.order-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 16px 0;
    border-top: 2px solid var(--color-text);
    margin-top: 10px;
}

/* ---------- Item slider (tap a card to add) ---------- */
/* Used on the Order page instead of listing every menu item with its
   own quantity box, or a plain dropdown -- a horizontally-scrollable
   row of cards scales well once the menu has more than a handful of
   items, and lets the photo do the selling. */
.item-slider-wrap { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; max-width: 100%; }
.item-slider {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 2px;
    /* Without these two, a flex item's default min-width is its content's
       full width -- so as more items are added, the strip would just
       keep growing and push the whole page wider instead of scrolling
       within itself. flex:1 lets it fill the space between the two nav
       arrows; min-width:0 is what actually lets it shrink below that
       content width so overflow-x:auto can kick in. */
    flex: 1 1 0%;
    min-width: 0;
}
.item-slider::-webkit-scrollbar { display: none; }
.item-slider-card {
    flex: 0 0 auto;
    width: 120px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-s);
    background: #fff;
    padding: 0;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.item-slider-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-primary); }
.item-slider-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--color-cream) url('../images/placeholder-food.svg') center/cover no-repeat;
}
.item-slider-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 8px 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 2.4em;
}
.item-slider-price { display: block; padding: 2px 8px 8px; color: var(--color-primary); font-weight: bold; font-size: 0.85rem; }
.slider-nav {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slider-nav:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ---------- Kitchen tips box ---------- */
.kitchen-tips {
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-top: 20px;
    font-size: 0.92rem;
    color: var(--ink-2);
}

.cart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.cart-row-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: break-word; }
.cart-row-qty { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: #fff;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.qty-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.qty-value { min-width: 18px; text-align: center; font-weight: 600; }
.cart-row-subtotal { width: 70px; flex-shrink: 0; text-align: right; color: var(--color-muted); font-size: 0.9rem; }
.cart-row-remove {
    background: none;
    border: none;
    color: #b3261e;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
}

/* ---------- Flash / alert messages ---------- */
/* Fades out on its own after a few seconds (see main.js) rather than
   sitting on the page forever -- opacity/transform are transitioned so
   the JS only needs to toggle one class. */
.flash { padding: 14px 18px; border-radius: var(--radius); margin: 20px 0; transition: opacity 0.3s ease, transform 0.3s ease; }
.flash.flash-hide { opacity: 0; transform: translateY(-6px); }
.flash-success { background: #e6f4ea; color: #1e6b34; border: 1px solid #b8e0c4; }
.flash-error { background: #fbeaea; color: #93231b; border: 1px solid #f3c1bd; }
.flash-info { background: #eaf2fb; color: #1a4a7a; border: 1px solid #c2dbf3; }

/* ---------- Payment instructions ---------- */
.payment-box {
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
}
.payment-box dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0; }
.payment-box dt { font-weight: 600; color: var(--color-muted); }
.payment-box dd { margin: 0; }
.reference-badge {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

/* ---------- Order status timeline ---------- */
/* Three connected steps (Placed -> Payment -> Confirmed). The
   connecting line is drawn with a ::before pseudo-element on each step
   except the first, positioned to run through the circle's vertical
   center -- easier to keep straight across responsive widths than
   trying to draw one continuous line behind three separate flex items. */
.status-timeline { display: flex; margin: 20px 0 30px; }
.status-step { flex: 1; text-align: center; position: relative; padding-top: 2px; }
.status-step:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 16px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--color-border);
    z-index: 0;
}
.status-step.complete:not(:first-child)::before { background: var(--color-primary); }
.status-step-circle {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--color-muted);
}
.status-step.complete .status-step-circle { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.status-step.active .status-step-circle { border-color: var(--color-primary); color: var(--color-primary); }
.status-step-label { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.status-cancelled-box {
    background: #fbeaea;
    border: 1px solid #f3c1bd;
    color: #93231b;
    padding: 16px 20px;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
    margin: 20px 0 30px;
}

/* ---------- Reviews ---------- */
.review-card .card-body { padding-top: 20px; }
.review-stars { color: #f0a83c; font-size: 1.1rem; letter-spacing: 2px; margin-bottom: 8px; }
.review-card .card-desc { font-style: italic; -webkit-line-clamp: 5; }
.review-author { font-weight: 600; margin-top: 10px; color: var(--ink-2); }

.review-form-wrap { max-width: 600px; margin: 40px auto 0; }

/* Pure-CSS star rating input: radios are hidden, labels are reversed in
   DOM order and laid out row-reverse so hovering/checking a star also
   highlights every star before it (which, thanks to the reversal, are
   later --sibling in the DOM but earlier visually). */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 6px;
}
.star-rating input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-rating label {
    font-size: 2rem;
    line-height: 1;
    color: var(--color-border);
    cursor: pointer;
    margin: 0;
    transition: color 0.1s ease;
}
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #f0a83c;
}

/* ---------- Footer ---------- */
.site-footer { background: #2c2420; color: #e8ddd0; margin-top: 60px; }
.footer-inner { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 40px 0 20px; }
@media (min-width: 700px) { .footer-inner { grid-template-columns: repeat(3, 1fr); } }
.footer-col { min-width: 0; }
.footer-col h3 { color: #fff; font-size: 1rem; }
.site-footer a { color: #e8ddd0; }
.footer-bottom { border-top: 1px solid #443a32; padding: 16px 0; text-align: center; font-size: 0.85rem; color: #b5a99b; }

/* ---------- Misc utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge-muted { background: #eee; color: #555; }
