/* MLYN — the phone as an app (2 Nov 2026, owner). Loaded last, under 900px only
   (media attribute in Base.astro), so wide screens never read a line of this.
   What it does: a bottom tab bar with the order button on every page, the shop as a
   list with a picker sheet (PickSheet.astro), a fixed buy bar on the dish page, less
   text above the food. New bottom bars stand on --tab-h and follow it automatically.
   Colours and type come from the same tokens as brand.css. */
@media (max-width:899px){
  /* Half the safe zone is enough to clear the home line, and keeps the tabs at the screen's edge. */
  :root{--tab-safe:calc(env(safe-area-inset-bottom) * .5);--tab-h:calc(60px + var(--tab-safe));--hdr-h:52px;}
  /* An Android browser that reports a safe area it does not draw under (Base.astro sets .fake-safe). */
  html.fake-safe{--tab-safe:0px;}
  /* The page only ever moves up and down. pan-y stops a sideways drag (and double-tap
     zoom) on everything but a real sideways scroller; pinch-zoom stays for those who need it.
     html is hidden, body is clip (brand.css): hidden on body would break the sticky header. */
  /* The BODY scrolls, not the window, so a browser's toolbar never slides away and the screen height never
     changes. Safari and Chrome on iPhone slide theirs with window scrolling and take the tabs along. Samsung Internet hides its bottom toolbar on any touch; no page can stop that. */
  html{-webkit-tap-highlight-color:transparent;touch-action:pan-y pinch-zoom;height:100%;overflow:hidden;overscroll-behavior:none;scroll-behavior:auto;}
  body{position:relative;height:100%;height:100dvh;overflow-x:hidden;overflow-y:auto;overscroll-behavior:none;} /* relative: the header's scroll marker moves with the page */
  /* Room under the page is a spacer, not padding: padding on a scroller moves sticky bars (the checkout's Next). */
  body{padding-bottom:0 !important;}
  body::after{content:'';display:block;height:var(--pb,0);}
  [id^="menu-"]{scroll-margin-top:calc(var(--hdr-h) + 10px);}
  .shop-tabs,.fk-pols{touch-action:pan-x pan-y pinch-zoom;overscroll-behavior-x:contain;}
  .hdr{-webkit-backdrop-filter:none;backdrop-filter:none;}
  :is(.scard,.pcard) .poster img{filter:none;} /* a shadow on every row costs more scroll than it gives */
  body{--pb:calc(var(--tab-h) + 8px);}
  body.has-cart{--pb:calc(var(--tab-h) + 40px);}
  body.xm-has-bar{--pb:calc(var(--tab-h) + 86px);}
  /* Checkout: the tabs stay, the Next button rides just above them, and the pill steps back
     so the page has one red button. WhatsApp is a tab, so the link under Next goes. */
  body[data-page="checkout"]{--pb:var(--tab-h);}
  .ob-panel.is-page .ob-foot{bottom:var(--tab-h);}
  body[data-page="checkout"] .tab-go{background:none;color:var(--ink);box-shadow:none;border:1.5px solid var(--hair);}
  body[data-page="checkout"] .tab-go-n{background:var(--mlyn);color:#fff;}
  .ob-page .ob-alt:not(.last){display:none;}
  /* Checkout on a phone: name and phone each get the full width, so the hint is never cut. */
  .ob-page .ob-fields .fl[data-f="name"],.ob-page .ob-fields .ob-phone{grid-column:1 / -1;}
  /* The tab bar's "add more" pill is an exit under the main button while paying. */
  /* Gone, not just invisible (10 Nov 2026, owner: an empty hole in the middle read as a missing
     button): the four tabs share the bar evenly. */
  body[data-page="checkout"] #tab-go{display:none;}
  body[data-page="checkout"] .tabbar{grid-template-columns:repeat(4,minmax(0,1fr));}
  /* The send button stays inside the page margin: it takes what the total leaves, and the
     total's small line wraps in its own narrow column instead of pushing the button out. */
  .ob-page .ob-foot-row .ob-send{flex:1 1 0;min-width:0;max-width:none;padding-inline:14px;font-size:15px;}
  .ob-page .ob-foot-row .ob-total{flex:0 1 auto;max-width:34%;}
  @media (max-width:380px){.ob-page .ob-foot-row .ob-send .ico-line{display:none;}}
  /* One slim top bar on the checkout (owner, 10 Nov 2026): no site header, no "Ваше замовлення"
     title, no language switch. Back on the left, the brand in the middle, steps right under it. */
  body[data-page="checkout"] .hdr{display:none;}
  .ob-panel.is-page .ob-head{display:grid;grid-template-columns:36px 1fr 36px;align-items:center;padding:10px 16px 8px;border-bottom:0;}
  .ob-panel.is-page .ob-head > div{display:none;}
  .ob-panel.is-page .ob-head .ob-top-back{grid-column:1;}
  .ob-panel.is-page .ob-brand{grid-column:2;justify-self:center;display:block;line-height:1;}
  .ob-panel.is-page .ob-brand b{font-family:var(--bristol);font-size:30px;color:var(--mlyn);letter-spacing:.04em;text-transform:uppercase;}
  .ob-pageroot:empty{min-height:80vh;} /* the footer waits below the form, it does not jump */

  /* The keyboard is up: the bars step aside so the field stays in view. */
  body:has(textarea:focus,input:not([type=radio],[type=checkbox],[type=button]):focus){--tab-h:0px;}
  body:has(textarea:focus,input:not([type=radio],[type=checkbox],[type=button]):focus) :is(.tabbar,#cartbar){display:none;}

  /* Between pages: the cross-fade itself is in brand.css (all widths); the tabs stand still. */
  .tabbar{view-transition-name:tabbar;}

  /* ── Header ─────────────────────────────────────────────────────────────── */
  .hdr-in{height:var(--hdr-h);}
  .hdr{background:var(--paper);}
  body[data-page] .offerbar{display:none;}
  .lang-btn{padding:4px 8px;font-size:11.5px;border-color:var(--hair-2);}
  .brand b{font-size:34px;}

  /* ── The tab bar ────────────────────────────────────────────────────────── */
  .tabbar{position:fixed;left:0;right:0;bottom:0;z-index:65;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto minmax(0,1fr) minmax(0,1fr);
    align-items:center;height:var(--tab-h);padding:0 4px var(--tab-safe);background:var(--paper);border-top:1px solid var(--hair);
    box-shadow:0 -8px 24px -18px rgba(70,42,18,.5);}
  /* The bar's colour runs past the screen's edge: a browser toolbar sliding away never shows the page under it. */
  .tabbar::after{content:'';position:absolute;left:0;right:0;top:100%;height:160px;background:var(--paper);}
  .tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:100%;min-width:0;padding:0;border:0;background:none;
    color:var(--ink-2);font:inherit;font-size:10.5px;font-weight:700;line-height:1;cursor:pointer;}
  /* Icons only (owner, 17 Nov 2026: the icons are clear on their own). The word stays in the
     markup, visually hidden, so screen readers still name each tab. */
  .tab .tab-l{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;}
  .tab > svg,.tab > .ico-line{width:27px !important;height:27px !important;}
  /* With no word under it, the current page's icon itself turns red. */
  .tab[aria-current="page"] .ico-line,.tab[aria-current="page"] > svg{color:var(--mlyn);}
  /* Home: these two follow another paper section, so 74px + 74px read as a hole on a phone. */
  .sect.boxteaser,.sect.cat-teaser{padding-top:18px;}
  .tab[aria-current="page"]{color:var(--mlyn);}
  .tab-go{display:flex;align-items:center;justify-content:center;gap:8px;height:46px;min-width:124px;padding:0 18px;margin:0 2px;border-radius:999px;
    background:var(--mlyn);color:#fff;font-size:15px;font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums;
    box-shadow:0 6px 14px -6px rgba(181,36,30,.8);}
  .tab-go:active{transform:scale(.96);}
  .tab-go-i{position:relative;display:flex;}
  .tab-go-w{display:flex;flex-direction:column;align-items:flex-start;line-height:1.05;}
  .tab-go-w small{display:none;font-size:10.5px;font-weight:700;opacity:.95;}
  .tab-go.full .tab-go-w small{display:block;}
  .tab-go-n{display:none;position:absolute;top:-7px;right:-9px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;
    background:var(--paper);color:var(--mlyn-deep);font-size:11px;line-height:17px;text-align:center;}
  .tab-go.full .tab-go-n{display:block;}
  .tab-go.full{gap:13px;padding-left:16px;}
  /* Narrow phones: the pill gives way, so "WhatsApp" keeps all its letters. */
  @media (max-width:379px){
    .tabbar{padding-inline:2px;}
    .tab{font-size:10px;}
    .tab-go{min-width:0;padding:0 12px;gap:6px;font-size:14px;margin:0;}
  }
  @media (max-width:339px){.tab-go:not(.full) .tab-go-i{display:none;}}
  .tab-go.bump{animation:go-bump .32s ease;}
  @keyframes go-bump{40%{transform:scale(1.1);}}

  /* Over the tabs: the free-delivery line, and the way back to an unpaid order. */
  #cartbar{bottom:var(--tab-h);padding:0;background:var(--paper-2);border:0;box-shadow:none;}
  #cartbar .cartbar-in{padding:5px 12px 7px;}
  #cartbar :is(.cartbar-n,.cartbar-go){display:none;}
  #cartbar .cartbar-free{font-size:12px;font-weight:700;text-align:center;}
  #cartbar::after{content:'';position:absolute;left:0;right:0;bottom:0;height:3px;background:linear-gradient(90deg,var(--mlyn) var(--pct,0%),transparent var(--pct,0%));}
  body[data-page="pay"] #cartbar{display:none;}
  #paybar{bottom:var(--tab-h);padding:8px 12px;}
  .xm-bar{bottom:var(--tab-h);padding-bottom:10px;}
  .lang-suggest{bottom:calc(var(--tab-h) + 12px);}
  .cartnote{bottom:calc(var(--tab-h) + 40px);z-index:66;width:max-content;}
  .cartnote-go{display:none;}
  .cartnote{padding:10px 16px;}

  /* ── Sheets ─────────────────────────────────────────────────────────────── */
  dialog.sheet{margin:auto 0 0;width:100%;max-width:100%;max-height:86dvh;padding:0;border:0;border-radius:18px 18px 0 0;background:var(--paper);color:var(--ink);overflow:auto;
    transform:translateY(100%);transition:transform .25s cubic-bezier(.2,.8,.2,1),overlay .25s allow-discrete,display .25s allow-discrete;}
  dialog.sheet[open]{transform:none;}
  @starting-style{dialog.sheet[open]{transform:translateY(100%);}}
  dialog.sheet::backdrop{background:rgba(28,20,14,.5);}
  body:has(dialog.sheet[open]){overflow:hidden;}
  .sheet-top{padding:8px 56px 0 16px;}
  .sheet-grab{display:block;width:38px;height:4px;margin:0 auto 8px calc(50% - 11px);border-radius:2px;background:var(--hair);}
  .sheet-x{position:absolute;top:8px;right:8px;width:40px;height:40px;border:0;border-radius:50%;background:none;color:var(--ink-2);font-size:16px;cursor:pointer;}
  .more nav{display:flex;flex-direction:column;padding:4px 20px calc(18px + env(safe-area-inset-bottom));}
  .more nav a{padding:15px 2px;font-family:var(--bristol);font-size:23px;text-transform:uppercase;color:var(--ink);border-bottom:1px dashed var(--hair);}
  .more nav a.more-s{padding-block:12px;border-bottom:0;font-family:inherit;font-size:15px;font-weight:700;text-transform:none;color:var(--ink-2);}
  /* Chat: WhatsApp for orders, the Telegram group for news. Each brand keeps its own colour on its icon only. */
  .chat nav{display:flex;flex-direction:column;gap:10px;padding:30px 16px calc(18px + env(safe-area-inset-bottom));}
  .chat-o{display:flex;align-items:center;gap:14px;padding:12px 14px;border:1px solid var(--hair);border-radius:12px;color:var(--ink);}
  .chat-o:active{transform:scale(.98);}
  .chat-o b{display:block;font-size:17px;font-weight:800;}
  .chat-o small{display:block;margin-top:2px;font-size:13px;font-weight:600;color:var(--ink-2);}
  .chat-i{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:46px;height:46px;border-radius:50%;color:#fff;}
  .chat-wa .chat-i{background:var(--wa);}
  .chat-tg .chat-i{background:var(--tg);}

  /* The buy bar's stepper (the pick sheet's twin lives in brand.css). No file loads shop.css outside the shop. */
  .qty-bar{flex:0 0 auto;display:flex;align-items:center;width:max-content;border:1.5px solid var(--hair);border-radius:999px;overflow:hidden;background:var(--panel);}
  .qty-bar button{width:42px;height:45px;border:0;background:none;color:var(--ink);font-size:21px;line-height:1;}
  .qty-bar output{min-width:32px;text-align:center;font-weight:800;font-size:16px;font-variant-numeric:tabular-nums;}

  /* ── The shop: a list, not a wall of cards ──────────────────────────────── */
  /* Whoever taps Order has decided: the page opens on the food. The title stays in
     the HTML for search and screen readers; delivery and the helpers close the list. */
  .shop{display:flex;flex-direction:column;}
  .shop-head{order:9;padding:22px 0 12px;}
  .shop-lede{display:none;}
  .shop-head h1{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);}
  .shop-head .dnote{margin:0;padding:9px 11px;font-size:12.5px;line-height:1.4;}
  .shop-helpers{gap:6px;margin-top:10px;}
  .shop-helper{padding:7px 11px;font-size:12.5px;}
  .shop-tabs{top:var(--hdr-h);margin:0 -16px;}
  .shop-tabs a{padding:9px 15px;}
  .shop-tabs a:not(.on):hover{border-color:var(--hair);color:var(--ink);} /* a finger leaves :hover behind */
  .shop-cat{padding-top:14px;scroll-margin-top:calc(var(--hdr-h) + 54px);}
  .shop-cat h2{font-size:19px;margin-bottom:0;padding-bottom:5px;border-bottom-width:1.5px;}
  .shop-grid{display:flex !important;flex-direction:column;gap:0 !important;}
  .scard{position:relative;display:grid;grid-template-columns:92px minmax(0,1fr);column-gap:12px;align-items:center;min-height:92px;padding:5px 0;border-bottom:1px dashed var(--hair);}
  .scard:last-child{border-bottom:0;}
  @media (min-width:640px){.shop-grid{display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;column-gap:28px !important;}}
  .scard-body{gap:2px;padding:0 54px 0 0 !important;justify-content:center;}
  .scard-body h3{font-size:16px;}
  .scard-sub{font-size:12.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
  .scard[data-card] .scard-sub{display:none;}
  .scard[data-card] .scard-price,.scard-units,.scard-fills,.scard-in{display:none;}
  .scard-from{display:block;margin:1px 0 0;font-size:13.5px;color:var(--ink-2);}
  .scard-from b{font-size:16px;font-weight:800;color:var(--mlyn);}
  .scard-from s{color:var(--soft);}
  .scard-hint{margin:0;font-size:12px;}
  .scard-buy{display:contents;}
  .scard-add span{display:none;}
  .scard-add,.mtile-add{position:absolute;z-index:4;}
  .scard-add{right:0;top:50%;width:44px;height:44px;margin-top:-22px;padding:0;border-radius:50%;font-size:24px;font-weight:600;line-height:1;}
  /* A box card grows when its list opens: picture and + stay level with the name. */
  .scard-bx{align-items:start;}
  .scard-bx .scard-body{padding-top:14px !important;}
  .scard-bx .scard-add{top:51px;}
  .scard-what{margin:0;}
  :is(.scard-add,.mtile-add)[data-n]::after{content:attr(data-n);position:absolute;top:-5px;right:-5px;min-width:19px;height:19px;padding:0 4px;border-radius:10px;
    background:var(--ink);color:#fff;font-size:11px;font-weight:800;line-height:19px;text-align:center;}

  .shop-more .shop-grid{display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:14px 12px !important;}
  .shop-more{margin-top:26px;}

  /* ── The dish page: choices up top, the buy bar always in reach ─────────── */
  .crumb{padding:12px 0 0;}
  .crumb > :not(a:nth-of-type(2)){display:none;}
  .crumb a:nth-of-type(2){font-size:14.5px;font-weight:700;color:var(--ink-2);}
  .crumb a:nth-of-type(2)::before{content:'‹';margin-right:6px;font-size:20px;line-height:1;}
  .prod{gap:8px;padding-top:4px;}
  .prod-shot{width:62%;margin-inline:auto;}
  .prod-desc{display:none;}
  .price-now{margin-top:8px;}
  .opt{margin-top:16px;}
  .chip{min-height:40px;}
  .opt-qty .opt-label,.opt-qty > .qty{display:none;}
  .opt-qty{margin-top:8px;}
  .qty-note{margin-top:0;}
  .buy-cta{position:fixed;left:0;right:0;bottom:var(--tab-h);z-index:64;flex-wrap:nowrap;gap:10px;margin:0;padding:8px 12px;background:var(--paper);border-top:1px solid var(--hair);}
  .buy-cta .btn{flex:1 1 auto;width:auto;min-width:0;height:48px;padding:0 10px;gap:6px;font-size:15px;white-space:nowrap;}
  .buy-free{display:none;}
  body:has(.buy-cta){--pb:calc(var(--tab-h) + 74px);}
  body:has(.buy-cta) #cartbar{display:none;}
  body:has(.buy-cta) .cartnote{bottom:calc(var(--tab-h) + 72px);}

  /* An app has no footer (owner, 2 Nov 2026): the tabs and More hold every link it had,
     the map and privacy included. The links stay in the HTML for search. */
  .foot{display:none;}
  body{--pb:calc(var(--tab-h) + 24px);}

  /* Home hero: headline, the rating badge on the first screen, the food, where we deliver.
     contents lets the badge and the delivery line take their own places around the pan. */
  .fp-hero-in{display:flex !important;flex-direction:column;align-items:center;}
  .fp-h1{order:1;align-self:stretch;}
  .fp-under,.fp-trust{display:contents;}
  .fp-rate{order:2;margin-top:12px;position:relative;z-index:3;}
  .fp-shot{order:3;align-self:stretch;margin-top:-14cqw;} /* the pan's handle rises beside the rating badge, the food closes up under it */
  .fp-trust > span{order:4;margin-top:12px;position:relative;z-index:3;}
  .fp-xmas{display:flex;width:max-content;}
  html[data-season="xmas"] .fp-hero-in{padding-top:58px;}
  .fp-xmas{margin-bottom:6px;}

  /* The menu is a wall of food: three to a row on a phone, picture, name, price. Fillings and
     prices stay in the HTML for search; the tile opens the picker (PickSheet.astro). */
  .menu-intro .dnote,.mtile-more,.mtile-vars,.mtile-min,.mtile-desc{display:none;}
  .menu-foot{display:block;margin:10px 0 0;font-size:12.5px;font-style:italic;color:var(--ink-2);}
  div.menu-foot{font-style:normal;}
  .menu-foot .dnote{margin:0;padding:9px 11px;font-size:12.5px;line-height:1.4;}
  .box-list{display:none;}
  @media (max-width:639px){
    .menu-sect .mtile .poster-serve{display:none;}
    .menu-sect .mtiles{grid-template-columns:repeat(3,minmax(0,1fr)) !important;gap:12px 8px !important;}
    .menu-sect .mtile-txt{padding:4px 2px 0 !important;gap:1px;}
    .menu-sect .mtile-name{font-size:13px;line-height:1.15;}
    .menu-sect .mtile-price{font-size:12.5px;}
    .menu-sect .mtile-price b{font-size:13.5px;}
    .menu-sect .mtile-was{display:none;}
    .menu-sect .mtile:has(.poster.plain:not(.nofood)) .mtile-add{top:calc(100cqw - 30px);right:0;width:30px;height:30px;}
    /* A dish with no picture yet (the name panel): the + sits in the panel's corner, off the price. */
    .menu-sect .mtile:has(.poster.nofood) .mtile-add{top:calc(125cqw - 36px);right:6px;width:30px;height:30px;}
    .menu-sect .mtile-add svg{width:15px;height:15px;}
    .msect{margin-bottom:6px;}
    .msect-h{margin-bottom:10px;}
  }
  @media (max-width:349px){.menu-sect .mtiles{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}}

  /* ── Less to read before the food ───────────────────────────────────────── */
  .menu-intro .kicker,.menu-lede{display:none;}
  .menu-sect{padding-top:20px;}
  .foot-cta,.menu-close,.fp-sticker,.blog-teaser{display:none;}
  .reveal{opacity:1 !important;transform:none !important;transition:none !important;}
}
@media (max-width:899px){
  /* Dish page: its own «У кошик» bar is the action; with an empty basket the tab bar's
     «Замовити» pill steps aside so two red buttons never stack (owner, 17 Nov 2026). */
  body:not(.has-cart):has(.buy-cta) #tab-go{display:none;}
  body:not(.has-cart):has(.buy-cta) .tabbar{grid-template-columns:repeat(4,minmax(0,1fr));}
}
@media (max-width:899px){
  /* Christmas step screens: the step bar's button is the one action. */
  body[data-xm^="xm-"] #tab-go{display:none;}
  body[data-xm^="xm-"] .tabbar{grid-template-columns:repeat(4,minmax(0,1fr));}
}
