/* ways.css · SPEC §6.3 · owned by the ways builder. Four ways (buttons, one active) beside the app's own orders list:
   the active way's order lands on top of it as the next order. The list is .app (/home/css/screens.css), 1:1 Pinkas. */

.ways {
  border-top: 1px solid var(--line);
  padding-block: var(--s9);
  background: var(--bg);
}

.ways__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--s6);
  align-items: start;
}
.ways__h { grid-column: 1 / -1; max-width: 24ch; margin-block-end: var(--s7); }
.ways__ways { grid-column: 1 / span 6; margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
/* the panel sits right against the ways (start of its column), so cause and effect read as one move */
.ways__panel { grid-column: 7 / span 6; justify-self: start; width: min(100%, 440px); position: relative; }

/* ---------- the four ways: hairline bands ---------- */
.ways__way {
  position: relative; display: block; width: 100%; min-height: 88px;
  padding-block: var(--s5); padding-inline: var(--s5) 0;
  border-top: 1px solid var(--line); text-align: start; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* the select rule: the accent with its 1px ink ring, on the start edge */
.ways__way::before {
  content: ""; position: absolute; inset-inline-start: 0; inset-block: var(--s5);
  width: 4px; border-radius: 2px; background: var(--accent); box-shadow: inset 0 0 0 1px var(--ink);
  transform: scaleY(0); transition: transform var(--d-hover, 150ms) var(--e-lift);
}
.ways__way[aria-pressed="true"]::before { transform: scaleY(1); }
.ways__title { display: block; font-size: 22px; line-height: 1.3; font-weight: 500; color: var(--ink); }
.ways__line { display: block; margin-block-start: var(--s2); max-width: 52ch; font-size: var(--t-body); line-height: 1.55; color: var(--ink-2); }
/* inactive ways step back by colour, never opacity: title ink-2 (8.45), line ink-3 (5.41) */
.ways__ways.has-on .ways__way[aria-pressed="false"] .ways__title { color: var(--ink-2); }
.ways__ways.has-on .ways__way[aria-pressed="false"] .ways__line { color: var(--ink-3); }
.ways__title, .ways__line { transition: color var(--d-hover, 150ms) linear; }
@media (hover: hover) { .ways__way:hover .ways__title { color: var(--ink); } }

/* ---------- the panel: the app's orders list, on its own page colour ---------- */
.ways .ways__app {   /* .app is a fill-the-box layer in screens.css; here it is a card in flow */
  position: relative; inset: auto; contain: content; overflow: hidden;
  border-radius: 20px; padding: var(--s5) var(--s4) var(--s4);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-rest);
}
.ways__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-inline: var(--s1); margin-block-end: var(--s4); }
.ways__rows { display: flex; flex-direction: column; gap: 8px; }   /* the route's gap-2 */
.ways__slot { display: grid; grid-template-columns: minmax(0, 1fr); }
.ways__slot > .ways__in { grid-area: 1 / 1; }
.ways__in:not(.is-on) { visibility: hidden; }

/* ---------- the four screens (one per way), drawn in the app's own tokens (.app scope, css/screens.css) ---------- */
.ways .wx { display: flex; flex-direction: column; gap: 10px; color: var(--color-ink); font-size: 14px; line-height: 1.45; }
.ways .wx p { margin: 0; }
.ways .wx-shop { font-size: 13px; color: var(--color-ink-muted); }
.ways .wx-title { font-size: 28px; line-height: 1.3; }
.ways .wx-label { font-size: 12px; font-weight: 600; color: var(--color-ink-muted); }
.ways .wx-note, .ways .wx-sub { font-size: 13px; line-height: 1.45; color: var(--color-ink-muted); }
.ways .wx-strong { font-weight: 600; }
.ways .wx-muted { color: var(--color-ink-muted); }
.ways .wx-num { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.ways .wx-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ways .wx-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ways .wx-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--color-hairline); border-radius: 12px; background: var(--color-paper); }
.ways .wx-card--quiet { background: var(--color-paper-soft); }
.ways .wx-btn { display: flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: 16px; border-radius: 999px; background: var(--color-marker); color: var(--color-ink); font-weight: 600; font-size: 15px; margin-top: auto; }
.ways .wx-btn--soft { background: var(--color-paper-dim); }
.ways .wx-badge { flex: none; height: 22px; padding-inline: 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 22px; }
.ways .wx-badge--ok { background: var(--color-success-soft); color: var(--color-success-text); }
.ways .wx-badge--wait { background: var(--color-warning-soft); color: var(--color-warning-text); }

/* from a chat: the pasted messages, then the draft */
.ways .wx-chat { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #ece5dd; }
.ways .wx-bub { align-self: flex-start; max-width: 85%; padding: 6px 10px; border-radius: 10px 10px 10px 2px; background: #fff; box-shadow: 0 1px 0 rgb(0 0 0 / .06); }
.ways .wx-bub--me { align-self: flex-end; border-radius: 10px 10px 2px 10px; background: #dcf8c6; }

/* a standing box */
.ways .wx-up { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--color-marker-soft); }
.ways .wx-up__h { font-weight: 600; font-size: 15px; }
.ways .wx-chips { display: flex; gap: 6px; }
.ways .wx-chip { height: 32px; padding-inline: 12px; border-radius: 999px; border: 1px solid var(--color-hairline-strong); font-size: 13px; line-height: 30px; color: var(--color-ink-soft); }
.ways .wx-chip.is-on { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.ways .wx-list { display: flex; flex-direction: column; border: 1px solid var(--color-hairline); border-radius: 12px; background: var(--color-paper); }
.ways .wx-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; }
.ways .wx-item + .wx-item { border-top: 1px solid var(--color-hairline); }

/* at the fair stall */
.ways .wx-open { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: start; padding: 12px 14px; border-radius: 12px; background: var(--color-paper); border: 1px solid var(--color-hairline); }
.ways .wx-switch { width: 44px; height: 26px; border-radius: 999px; background: var(--color-marker); box-shadow: inset 0 0 0 1px var(--color-ink); position: relative; }
.ways .wx-switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-ink); }
.ways .wx-qr { grid-column: 1 / -1; justify-self: center; width: 88px; height: 88px; color: var(--color-ink); }
.ways .wx-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ways .wx-tile { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--color-hairline); border-radius: 12px; background: var(--color-paper); font-size: 13px; }
.ways .wx-tile.is-on { border-color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-ink); }
.ways .wx-qty { position: absolute; top: -8px; inset-inline-end: -6px; min-width: 22px; height: 22px; padding-inline: 6px; border-radius: 999px; background: var(--color-marker); box-shadow: inset 0 0 0 1px var(--color-ink); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; }
.ways .wx-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }

/* order rounds */
.ways .wx-bar { display: block; height: 8px; border-radius: 999px; background: var(--color-paper-dim); overflow: hidden; }
.ways .wx-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--color-ink); }

/* ---------- < 1024: h2 · the panel (full width, held under the nav) · the four ways ----------
   The panel stays in sight while the ways scroll beneath it; it lets go once the last way sits under it
   (the grid's sticky area ends --ways-release early, the grid's end margin gives the space back). */
@media (max-width: 1023.98px) {
  .ways {
    --ways-gap: var(--s6);
    --ways-release: max(0px, 100svh - var(--nav-h) - var(--s2) - var(--ways-panel-h, 330px) - var(--ways-gap));
  }
  .ways__grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--ways-gap); margin-block-end: var(--ways-release); }
  .ways__h, .ways__ways, .ways__panel { grid-column: 1; }
  .ways__h { margin-block-end: 0; }
  .ways__panel {
    grid-row: 2; justify-self: stretch; width: auto;
    position: sticky; top: calc(var(--nav-h) + var(--s2)); z-index: 2;
  }
  .ways__panel::before {   /* a white collar over the strip between the nav and the held panel */
    content: ""; position: absolute; inset-inline: calc(-1 * var(--gutter)); bottom: 100%; height: calc(var(--s2) + 1px); background: var(--bg);
  }
  .ways__ways { grid-row: 3; margin-block-end: calc(-1 * var(--ways-release)); }
}
@media (max-width: 767.98px) {
  .ways { padding-block: var(--s8); --ways-gap: var(--s5); }
  .ways .ways__app { padding: var(--s3) var(--s3) var(--s3); border-radius: 16px; }
  .ways__head { margin-block-end: var(--s2); }
  .ways .ways__head .text-3xl { font-size: 26px; }   /* screens.css loads after this file: selectors here outrank .app utilities */
  .ways__way { min-height: 64px; padding-block: var(--s4); padding-inline-start: var(--s4); }
  .ways__way::before { inset-block: var(--s4); }
  .ways__title { font-size: 19px; }
  .ways__line { font-size: 15px; line-height: 1.5; }
}

/* ---------- reduced: no travel; the rule and the entry cross-fade (ways.js) ---------- */
@media (prefers-reduced-motion: reduce) {
  .ways__way::before { transform: none; opacity: 0; transition: opacity 150ms linear; }
  .ways__way[aria-pressed="true"]::before { opacity: 1; }
}
