/* ---------------------------------------------------------------------------
   The Source — the order-ahead screen.

   Paired with mu-plugins/014-thesource-order.php (markup) and
   assets/js/order.js (behaviour). Loaded only on a page that renders
   [tsr_order]. Depends on style.css for the palette and the motif.

   The layout, and why:

     WIDE (>=62rem)   two columns. Menu left, basket a sticky column right.
                      A coffee order is built by glancing between the two, so
                      they are both on screen at once and neither moves.

     NARROW           one column, and the basket becomes a full-screen drawer
                      behind a bottom bar carrying the item count and the
                      total. A sticky basket on a phone is a slab across a
                      third of the screen you cannot dismiss.

   One <dialog> serves every item's options. Sixteen dialogs in the markup
   would be sixteen focus traps to get right, and only one is ever open.

   Everything is square. The only exception in the whole file is the count
   bubble on the mobile bar, which is a true circle like the disc.
   ------------------------------------------------------------------------- */

.tsr-order{--ord-gap:clamp(1.5rem,3vw,2.5rem)}

.tsr-order__grid{display:grid;gap:var(--ord-gap);align-items:start}
@media (min-width:62rem){
  .tsr-order__grid{grid-template-columns:minmax(0,1fr) minmax(21rem,24rem)}
}

/* ── min-width:0, and why the page needs it ──────────────────────────────
   A grid item's min-width is `auto`, which resolves to its MIN-CONTENT width
   — and the widest thing in this column is the section rail: a nowrap flex
   row of six links that is 861px across. The rail scrolls, so it never looked
   too wide itself; instead it forced its grid-item parent to 861px and the
   whole order screen scrolled sideways on a phone, menu tiles running off the
   right edge with the prices cut in half.

   min-width:0 lets the column be narrower than its content and hands the
   overflow back to the rail, which is the one box set up to scroll.
   tests/overflow.py checks every page for exactly this. */
.tsr-order__menu,.tsr-order__side{min-width:0}

/* =============================================================== the rail */
/* The rail component itself is .tsr-rail in style.css — the menu board uses
   the same one and does not load this file. Only the ordering screen's own
   offset belongs here: it sits inside a band that starts higher up than the
   menu page's does. */
.tsr-rail{margin-bottom:clamp(.9rem,1.8vw,1.3rem)}

/* ============================================================== sections */
.tsr-osec{scroll-margin-top:calc(var(--tsr-stick-h,76px) + 4.5rem)}
.tsr-osec + .tsr-osec{margin-top:clamp(1.6rem,3vw,2.25rem)}
.tsr-osec__h{font-size:clamp(1.25rem,2.6vw,1.7rem);border-bottom:3px solid var(--ink);padding-bottom:.5rem}
.tsr-osec__lede{margin:.55rem 0 0;color:var(--body);font-size:.96rem;line-height:1.5;max-width:62ch}

/* ── Two columns from the narrowest phone, not from 34rem ────────────────
   One column of 33 tiles, each carrying a description, made the ordering
   screen 5,375px tall at 390px — six and a half screens of thumb-work to
   reach a bag of coffee. Two columns halves the row count outright, and the
   description comes off below 48rem because at 185px wide it is three lines
   of wrap for something the option sheet repeats in full the moment you tap.

   A tile is still a 44px-plus target in both axes at 2-up on a 320px screen,
   which is the floor that matters. */
.tsr-ogrid{
  display:grid;gap:1px;background:var(--rule);border:1px solid var(--rule);
  margin-top:1.1rem;grid-template-columns:repeat(2,minmax(0,1fr));
}
@media (min-width:86rem){.tsr-ogrid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:47.9375rem){
  .tsr-oitem__desc{display:none}
  .tsr-oitem__btn{padding:.85rem .8rem .75rem;gap:.3rem}
  .tsr-oitem__name{font-size:1rem}
  .tsr-oitem__foot{padding-top:.5rem}
}

/* ---- an item tile ----
   The whole tile is one button. A card with a separate "Add" control gives a
   thumb two targets where it wants one, and the smaller of the two is the one
   people hit. */
.tsr-oitem{display:flex}
.tsr-oitem__btn{
  appearance:none;-webkit-appearance:none;border:0;border-radius:0;margin:0;
  width:100%;text-align:left;cursor:pointer;font:inherit;
  background:var(--paper);padding:.95rem 1rem .85rem;
  display:flex;flex-direction:column;gap:.45rem;
  transition:background .14s linear;
}
.tsr-band--paper .tsr-oitem__btn{background:var(--sage)}
.tsr-oitem__btn:hover{background:var(--highlight)}
.tsr-oitem__name{
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;
  font-size:1.1rem;line-height:1.2;letter-spacing:-.01em;color:var(--ink);
  display:flex;align-items:baseline;gap:.55rem;flex-wrap:wrap;
}
.tsr-oitem__tag{
  font-size:.68rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;
  color:var(--paper);background:var(--wine);padding:.18rem .4rem;line-height:1.3;
}
.tsr-oitem__desc{font-size:.94rem;line-height:1.45;color:var(--body)}
.tsr-oitem__foot{
  margin-top:auto;padding-top:.65rem;display:flex;align-items:center;
  justify-content:space-between;gap:.75rem;
}
.tsr-oitem__price{font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;font-size:1.02rem;color:var(--ink)}
.tsr-oitem__add{
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;font-size:.9rem;
  color:var(--claret);border-bottom:2px solid var(--wine);padding-bottom:1px;
}
.tsr-oitem__btn:hover .tsr-oitem__add{color:var(--ink);border-bottom-color:var(--ink)}

/* ================================================================ basket */

.tsr-obasket{
  background:var(--ink);color:var(--highlight);padding:1.35rem 1.35rem 1.5rem;
  display:flex;flex-direction:column;
}
@media (min-width:62rem){
  .tsr-order__side{position:sticky;top:calc(var(--tsr-stick-h,76px) + 1.25rem)}
  /* The basket can grow past the viewport on a big order. Capping it and
     letting it scroll keeps the Send button reachable without scrolling the
     page back up, which is the one thing that loses an order. */
  .tsr-obasket{max-height:calc(100vh - var(--tsr-stick-h,76px) - 2.5rem);overflow-y:auto}
}

.tsr-obasket__top{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.tsr-obasket__h{
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;
  font-size:1.25rem;color:var(--paper);margin:0;
}
.tsr-obasket__close{
  appearance:none;border:0;background:transparent;color:var(--paper);
  font-size:1.6rem;line-height:1;width:44px;height:44px;cursor:pointer;display:none;
}
.tsr-obasket__empty{margin:1rem 0 0;font-size:.95rem;color:var(--dimsage);line-height:1.55}

.tsr-olines{list-style:none;margin:1.1rem 0 0;padding:0}
.tsr-oline{
  display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;
  gap:.3rem .7rem;align-items:center;
  padding:.8rem 0;border-top:1px solid var(--rule-dark);
}
.tsr-oline__mid{display:flex;flex-direction:column;gap:.15rem;min-width:0}
.tsr-oline__name{
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:500;
  font-size:1rem;color:var(--paper);line-height:1.25;
}
.tsr-oline__det{font-size:.84rem;color:var(--dimsage);line-height:1.35}
.tsr-oline__p{font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;color:var(--paper);font-size:.98rem}
.tsr-oline__x{
  appearance:none;border:0;background:transparent;color:var(--dimsage);
  font-size:1.2rem;line-height:1;width:34px;height:34px;cursor:pointer;
}
.tsr-oline__x:hover{color:var(--paper)}

/* ---- the stepper ---- */
.tsr-oqty{display:inline-flex;align-items:center;border:1.5px solid var(--rule)}
.tsr-oqty button{
  appearance:none;border:0;background:transparent;color:var(--ink);cursor:pointer;
  width:44px;height:44px;font-size:1.15rem;line-height:1;font-family:Jost,ui-sans-serif,system-ui,sans-serif;
}
.tsr-oqty output{min-width:2.2rem;text-align:center;font-weight:600;color:var(--ink)}
.tsr-oqty--sm{border-color:var(--rule-dark)}
.tsr-oqty--sm button{width:32px;height:32px;font-size:1rem;color:var(--highlight)}
.tsr-oqty--sm button:hover{color:var(--paper)}
.tsr-oqty--sm output{min-width:1.6rem;color:var(--paper);font-size:.95rem}

/* ---- the sums ---- */
.tsr-obasket__sums{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--rule-dark)}
.tsr-osum{display:flex;justify-content:space-between;gap:1rem;font-size:.98rem;padding:.25rem 0;color:var(--highlight)}
.tsr-osum--big{
  margin-top:.45rem;padding-top:.65rem;border-top:1px solid var(--rule-dark);
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;font-size:1.2rem;color:var(--paper);
}

/* ---- fields, on the dark basket ---- */
.tsr-ofield{display:flex;flex-direction:column;gap:.4rem;margin-top:1.1rem;border:0;padding:0;min-width:0}
.tsr-ofield > label,.tsr-ofield > legend{
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:500;font-size:.96rem;
  color:var(--paper);padding:0;
}
.tsr-ofield .tsr-hint{display:block;font-size:.85rem;color:var(--dimsage);font-weight:400;margin-top:.15rem}
.tsr-ofield input,.tsr-ofield select,.tsr-ofield textarea{
  font:inherit;font-size:1rem;color:var(--ink);background:var(--paper);
  border:1.5px solid var(--rule);border-radius:0;padding:.7rem .8rem;min-height:50px;width:100%;
}
.tsr-ofield textarea{min-height:84px;resize:vertical}
.tsr-ofield input:focus-visible,.tsr-ofield select:focus-visible,.tsr-ofield textarea:focus-visible{border-color:var(--wine)}
.tsr-obasket .tsr-field-row{display:grid;gap:0 .8rem;align-items:end}
@media (min-width:26rem){.tsr-obasket .tsr-field-row{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* ---- tips and paying ---- */
.tsr-otips{margin-top:1.25rem}
.tsr-opay{margin-top:1.25rem;display:flex;flex-direction:column;gap:.55rem}
.tsr-opay__opt{
  display:flex;gap:.7rem;align-items:flex-start;cursor:pointer;
  padding:.75rem .85rem;box-shadow:inset 0 0 0 1.5px var(--rule-dark);
}
.tsr-opay__opt:has(input:checked){box-shadow:inset 0 0 0 1.5px var(--dimsage);background:#20231C}
.tsr-opay__opt input{width:20px;height:20px;margin:.2rem 0 0;flex:0 0 auto;accent-color:var(--wine)}
.tsr-opay__opt strong{display:block;font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;font-size:.98rem;color:var(--paper)}
.tsr-opay__opt em{display:block;font-style:normal;font-size:.84rem;color:var(--dimsage);line-height:1.4;margin-top:.15rem}
/* The card option is shown and visibly switched off, on purpose: it is a
   conversation about their payment account, not a missing feature. */
.tsr-opay__opt.is-off{cursor:not-allowed;opacity:.62}
.tsr-opay__opt.is-off strong{color:var(--highlight)}

.tsr-osend{margin-top:1.4rem;width:100%;gap:.6rem}
.tsr-osend[disabled]{opacity:.45;cursor:not-allowed}
.tsr-osend__t{font-weight:600}
.tsr-obasket__fine{margin:.85rem 0 0;font-size:.85rem;color:var(--dimsage);line-height:1.5}

/* ---- chips (sizes, milks, grinds, tips) ----
   A radio drawn as a square tile. The input stays in the DOM and keeps focus
   and keyboard behaviour; only its box is hidden. appearance:none alone would
   leave a 13px square the label then has to dodge. */
.tsr-ochips{display:flex;flex-wrap:wrap;gap:.45rem}
.tsr-ochip{position:relative;display:inline-flex}
.tsr-ochip input{
  position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;
  -webkit-appearance:none;appearance:none;
}
.tsr-ochip span{
  display:inline-flex;align-items:center;gap:.4rem;min-height:46px;padding:.5rem .85rem;
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:500;font-size:.96rem;
  color:var(--ink);background:var(--paper);box-shadow:inset 0 0 0 1.5px var(--rule);
  transition:box-shadow .12s linear,background .12s linear,color .12s linear;
}
.tsr-ochip span em{font-style:normal;font-size:.84rem;color:var(--muted)}
.tsr-ochip input:checked + span{
  background:var(--ink);color:var(--paper);box-shadow:inset 0 0 0 1.5px var(--ink);
}
.tsr-ochip input:checked + span em{color:var(--highlight)}
.tsr-ochip input:focus-visible + span{outline:3px solid var(--tsr-focus);outline-offset:2px}
.tsr-ochip input:hover + span{box-shadow:inset 0 0 0 1.5px var(--ink)}

/* ---- chips ON THE DARK BASKET ----
   The states have to invert, not just recolour. On paper, "chosen" is a solid
   ink tile against pale ones and it is the loudest thing in the group. Dropped
   unchanged onto the ink basket, the chosen tile IS the background: the 15%
   tip read as a hole in the row where a button should be, and the four
   unchosen ones read as four bright buttons all equally pressed.

   So here: unchosen is a ring on nothing, chosen is a solid pale slab. Same
   idea — the chosen one is the solid one — stated against the surface it is
   actually on. Contrast is fine either way; this is about which one your eye
   lands on, which no contrast sweep will ever catch. */
.tsr-obasket .tsr-ochip span{
  background:transparent;color:var(--highlight);
  box-shadow:inset 0 0 0 1.5px var(--rule-dark);
}
.tsr-obasket .tsr-ochip span em{color:var(--dimsage)}
.tsr-obasket .tsr-ochip input:hover + span{box-shadow:inset 0 0 0 1.5px var(--dimsage);color:var(--paper)}
.tsr-obasket .tsr-ochip input:checked + span{
  background:var(--paper);color:var(--ink);box-shadow:inset 0 0 0 1.5px var(--paper);
}
.tsr-obasket .tsr-ochip input:checked + span em{color:var(--muted)}

/* ========================================================== the sheet == */

.tsr-osheet{
  border:0;border-radius:0;padding:0;max-width:34rem;width:calc(100% - 2rem);
  max-height:min(84vh,46rem);background:var(--paper);color:var(--body);
  /* The only shadow on the site, and it is not a shadow: a solid offset slab,
     which is what this shape language does instead. */
  box-shadow:10px 10px 0 rgba(26,28,22,.18);
}
.tsr-osheet::backdrop{background:rgba(26,28,22,.68)}
.tsr-osheet__in{padding:clamp(1.35rem,3vw,2rem)}
.tsr-osheet__x{position:absolute;top:0;right:0;margin:0}
.tsr-osheet__x button{
  appearance:none;border:0;background:var(--ink);color:var(--paper);
  width:44px;height:44px;font-size:1.5rem;line-height:1;cursor:pointer;
}
.tsr-osheet h2{font-size:clamp(1.4rem,3.2vw,1.85rem);padding-right:2.5rem}
.tsr-osheet__desc{margin:.6rem 0 0;color:var(--body);font-size:1rem;line-height:1.55;max-width:50ch}

/* Every group gets the rule, including the first. Scoping it to
   `.tsr-ogroup + .tsr-ogroup` left "Size" as the one heading without one,
   which read as an accident rather than a device. A legend sitting on its own
   fieldset's top border is the native behaviour and it is the right one here:
   the label interrupts the rule, which is how a spec sheet is set. */
.tsr-ogroup{border:0;border-top:1px solid var(--rule);padding:1.35rem 0 0;margin:1.35rem 0 0;min-width:0}
.tsr-ogroup:first-child{margin-top:1.1rem}
.tsr-ogroup legend{
  padding:0;font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;
  font-size:.86rem;text-transform:uppercase;letter-spacing:.09em;color:var(--muted);
  margin-bottom:.7rem;
}
.tsr-ogroup__note{margin:-.35rem 0 .7rem;font-size:.88rem;color:var(--muted);line-height:1.45;max-width:46ch}

.tsr-osheet .tsr-ofield{margin-top:1.35rem;border-top:1px solid var(--rule);padding-top:1.35rem}
.tsr-osheet .tsr-ofield > label{color:var(--ink)}
.tsr-osheet .tsr-ofield .tsr-hint{color:var(--muted)}

.tsr-osheet__foot{
  display:flex;align-items:center;gap:1rem;flex-wrap:wrap;
  margin-top:1.5rem;padding-top:1.35rem;border-top:3px solid var(--ink);
}
.tsr-osheet__add{flex:1 1 11rem;justify-content:space-between;min-height:54px}

/* ================================================== the mobile drawer == */

.tsr-obar{
  position:fixed;left:0;right:0;bottom:0;z-index:97;
  appearance:none;border:0;border-radius:0;cursor:pointer;width:100%;
  background:var(--wine);color:var(--paper);
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;font-size:1.05rem;
  display:flex;align-items:center;gap:.8rem;
  padding:.9rem 1.1rem calc(.9rem + env(safe-area-inset-bottom,0px));
}
.tsr-obar__n{
  width:28px;height:28px;border-radius:50%;background:var(--paper);color:var(--wine);
  display:grid;place-items:center;font-size:.9rem;flex:0 0 auto;
}
.tsr-obar__t{margin-left:auto}
@media (min-width:62rem){.tsr-obar{display:none!important}}

@media (max-width:61.9375rem){
  /* The basket is off-canvas until the bar opens it. display:none would lose
     the form state on every open and close; translate keeps it mounted.

     z-index 101 is not arbitrary. mechanics.css stacks this site as: mobile
     nav panel 90, quick-action bar 95, back-to-top 96, and the STICKY HEADER
     at 100 — and the header is position:sticky, so it participates. At 98 the
     drawer opened underneath it: the "Your order" heading and the close
     button sat behind the logo, and the burger's own full-size checkbox
     swallowed every tap in that corner. The drawer is a full-screen modal
     with its own close control, so it belongs above the header. */
  .tsr-order__side{
    position:fixed;inset:0;z-index:101;overflow-y:auto;overscroll-behavior:contain;
    background:var(--ink);
    transform:translateY(100%);visibility:hidden;
    transition:transform .26s cubic-bezier(.22,.61,.36,1),visibility .26s;
  }
  .tsr-order.is-basket .tsr-order__side{transform:none;visibility:visible}
  .tsr-obasket{min-height:100%;padding-bottom:3rem}
  .tsr-obasket__close{display:inline-flex;align-items:center;justify-content:center}

  /* Back-to-top is redundant while a full-screen basket is open, and it is
     fixed to the same corner. order.js sets .tsr-nobounce on <body>. */
  body.tsr-nobounce .tsr-top{display:none!important}
  body.tsr-nobounce{overflow:hidden}

  /* The site's own quick-action bar ("Call us" / "Order ahead") is one bar too
     many on the page that already carries the basket bar — and "Order ahead"
     there links to the page you are standing on.

     It has to be hidden from a BODY class, not a selector rooted at
     .tsr-order: the action bar lives in the footer template part, which is a
     sibling of <main>, so no combinator starting inside <main> can reach it.
     014-thesource-order.php adds .tsr-ordering via body_class. */
  body.tsr-ordering .tsr-actionbar{display:none!important}
}
@media (prefers-reduced-motion:reduce){
  .tsr-order__side{transition:none}
}

/* ========================================================= confirmation = */

.tsr-oconf{background:var(--ink);color:var(--highlight);max-width:46rem}
.tsr-oconf__bars{display:flex;gap:3px;height:10px}
.tsr-oconf__bars i{display:block;flex:1 1 auto;background:var(--wine)}
.tsr-oconf__bars i:nth-child(n+5){background:var(--rule-dark)}
.tsr-oconf__in{padding:clamp(1.5rem,4vw,2.5rem)}
.tsr-oconf__eyebrow{
  margin:0 0 .6rem;font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;
  font-size:.82rem;text-transform:uppercase;letter-spacing:.11em;color:var(--dimsage);
}
.tsr-oconf__h{font-size:clamp(1.6rem,4vw,2.3rem);color:var(--paper)}

.tsr-oconf__facts{
  display:grid;gap:1px;background:var(--rule-dark);border:1px solid var(--rule-dark);
  margin-top:1.5rem;grid-template-columns:repeat(2,minmax(0,1fr));
}
@media (min-width:38rem){.tsr-oconf__facts{grid-template-columns:repeat(4,minmax(0,1fr))}}
.tsr-oconf__facts > div{background:var(--ink);padding:.9rem 1rem;display:flex;flex-direction:column;gap:.3rem}
.tsr-oconf__facts span{font-size:.82rem;color:var(--dimsage)}
.tsr-oconf__facts strong{
  font-family:Jost,ui-sans-serif,system-ui,sans-serif;font-weight:600;
  font-size:1.2rem;color:var(--paper);line-height:1.15;
}

.tsr-oconf__moved{
  margin:1.25rem 0 0;padding:.8rem 1rem;border-left:3px solid var(--wine);
  font-size:.95rem;line-height:1.55;background:#20231C;
}
.tsr-oconf__moved strong{color:var(--paper)}

.tsr-oconf__lines{list-style:none;margin:1.5rem 0 0;padding:0;border-top:1px solid var(--rule-dark)}
.tsr-oconf__lines li{
  display:flex;justify-content:space-between;gap:1.25rem;
  padding:.65rem 0;border-bottom:1px solid var(--rule-dark);font-size:.98rem;line-height:1.45;
}
.tsr-oconf__p{font-weight:600;color:var(--paper);white-space:nowrap}
.tsr-oconf__where{margin:1.5rem 0 0;font-size:1rem;line-height:1.6}
.tsr-oconf__demo{
  margin:1.75rem 0 0;padding-top:1.25rem;border-top:1px solid var(--rule-dark);
  font-size:.9rem;line-height:1.6;color:var(--dimsage);max-width:62ch;
}

@media print{
  .tsr-obar,.tsr-rail,.tsr-osheet{display:none!important}
  .tsr-obasket{background:#fff!important;color:#000!important}
}
