/* Deals page: the board expanded to the full day. Page layout only; every component and color is site.css.
   Scoped to [data-page="deals"] so nothing here leaks. Candidates for promotion are marked "system:". */

/* ---------------------------------------------------------------- the day line: the board's top rule (system: the clock on the ground) */
[data-page="deals"] .page-head { padding-bottom: 0; }
[data-page="deals"] .day { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: var(--s3) var(--s7); border-top: 2px solid var(--fg); border-bottom: 1px solid var(--rule); padding: var(--s2) 0 var(--s3); margin-top: var(--s2); }
/* column-reverse packs from the bottom; flex-end pins every value to the top of its row so a two-line label hangs below instead of lifting its value */
[data-page="deals"] .day > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
[data-page="deals"] .day dd { margin: 0; padding: 4px 0; font-size: var(--t3); font-weight: 800; font-family: var(--font-narrow); font-stretch: 100%; line-height: 1; font-variant-numeric: tabular-nums lining-nums; text-transform: uppercase; white-space: nowrap; color: var(--figure); }
[data-page="deals"] .day dt { font-size: var(--t-2); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); margin-top: 6px; white-space: nowrap; }
/* the sweep clock in amber: the board's fill, ink on it, the fill grown outward so the figure stays on the label's left edge (amber text never sits on the ground) */
[data-page="deals"] .day .sun dd { align-self: flex-start; padding-inline: 10px; margin-inline: -10px; background: var(--amber); color: var(--on-amber); border-radius: var(--radius); }
[data-page="deals"] .day .skel { display: inline-block; vertical-align: bottom; margin: 0; }

/* ---------------------------------------------------------------- the filter row (system: .toolbar.filters)
   One instrument of four rows on a desk, each opened by a board caption at its left in the .bh voice: Category chips with the
   search; Grade chips with where you are; the Brand box; the Price band with the store and Only my sizes. Every chip and segment
   carries the count it would leave. The sort lives in the result header: it governs the result, not the filter. */
[data-page="deals"] .filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: var(--s2); padding: var(--s3) 0 var(--s4); }
[data-page="deals"] .filt-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-width: 0; }
[data-page="deals"] .filt-cap { flex: 0 0 5.25rem; margin: 0; }   /* the caption column: one width, so the four rows read as one board */
[data-page="deals"] .filt-cats, [data-page="deals"] .filt-grades, [data-page="deals"] .filt-brands { flex: 1 1 auto; min-width: 0; }
[data-page="deals"] .filt-q { margin-left: auto; flex: 0 1 20rem; }   /* at the row's right end; when the chips fill the row it takes the next line, still right-aligned and bounded, like the segment in the grade row */
[data-page="deals"] .filt-q input { width: 100%; }
[data-page="deals"] .filt-toggle { display: none; }
[data-page="deals"] .filt-more { display: contents; }
[data-page="deals"] .filt-r2 .seg { margin-left: auto; }
[data-page="deals"] .filt-box { flex: 0 1 14rem; min-width: 10rem; display: flex; flex-direction: column; gap: 4px; }
[data-page="deals"] .filt-box input { width: 100%; }
[data-page="deals"] .filt-box input[aria-invalid="true"] { border-color: var(--red); }
[data-page="deals"] .filt-hint { font-size: var(--t-1); font-weight: 600; color: var(--red); animation: m-fade var(--dur-1) ease-out both; }
[data-page="deals"] .filters select { max-width: 100%; }
[data-page="deals"] #store-sel { flex: 0 1 12rem; min-width: 9rem; }
[data-page="deals"] .seg-band button { flex: 0 0 auto; padding-inline: 10px; }
/* a desk has the brand box; the four brand chips are the phone panel's shortcut. A token repeats only a filter without a control in the rail
   (the search, the store, Only my sizes, and the brand, now that its chips are off the desk); Clear filters stays with any filter applied */
@media (min-width: 561px) {
  [data-page="deals"] .filt-brands { display: none; }
  [data-page="deals"] .token[data-filter="category"], [data-page="deals"] .token[data-filter="grade"], [data-page="deals"] .token[data-filter="band"] { display: none; }
}
[data-page="deals"] .filt-sizes { display: inline-flex; min-width: 0; }
/* "Only my sizes" before the profile has sizes: a working control that leads to the profile and says why */
[data-page="deals"] .filt-setsizes { display: inline-flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 5px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--fg-2); line-height: 1.25; transition: border-color var(--dur-1) ease-out, color var(--dur-1) ease-out, transform var(--dur-1) var(--ease-out); }
[data-page="deals"] .filt-setsizes b { font-size: var(--t-1); font-weight: 600; color: var(--fg-2); }
[data-page="deals"] .filt-setsizes span { font-size: var(--t-2); color: var(--fg-3); }
@media (hover: hover) and (pointer: fine) { [data-page="deals"] .filt-setsizes:hover { border-color: var(--fg); color: var(--fg); } }
@media (hover: hover) and (pointer: fine) { [data-page="deals"] .filt-setsizes:hover b { color: var(--fg); } }
[data-page="deals"] .filt-toggle[aria-expanded="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
[data-page="deals"] .filt-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------------------------------------------------------------- results */
[data-page="deals"] .res { margin-top: var(--s2); }
[data-page="deals"] .res-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: calc(-1 * var(--s2)) 0 var(--s4); }
[data-page="deals"] .res-tokens .tokens { min-width: 0; }
[data-page="deals"] .empty-acts { margin-top: var(--s4); }
[data-page="deals"] .empty .btn, [data-page="deals"] .empty-acts .btn { margin-top: 0; }
[data-page="deals"] .res-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); margin-bottom: var(--s4); }
[data-page="deals"] .res-h .bh { margin: 0; }
[data-page="deals"] .res-count { margin: 0 0 0 auto; flex: 0 1 auto; text-align: right; }
[data-page="deals"] .res-note { flex-basis: 100%; order: 4; margin: calc(-1 * var(--s1)) 0 0; }   /* the simulated-board line, under the count line */
/* the sort beside the count line: a captioned select, the caption in the board's voice */
[data-page="deals"] .res-sort { display: inline-flex; align-items: center; gap: var(--s2); flex: none; }
[data-page="deals"] #sort-sel { width: auto; min-width: 10.5rem; }
[data-page="deals"] .deals > .callout { grid-column: 1 / -1; }
[data-page="deals"] .skel-deal .skel { margin: 0; }
[data-page="deals"] .skel-deal .skel.price { height: 2rem; width: 6rem; }
[data-page="deals"] .res-more { display: flex; flex-direction: column; align-items: center; gap: var(--s3); margin-top: var(--s6); }
[data-page="deals"] .res-more[hidden] { display: none; }
[data-page="deals"] .res-more .note { margin: 0; }
[data-page="deals"] .empty .btn { margin-top: var(--s4); }

/* ---------------------------------------------------------------- breakpoints */
@media (max-width: 820px) {
  [data-page="deals"] .res-count { text-align: left; flex-basis: 100%; order: 3; }   /* the heading and the sort share a line; the count takes its own */
}
@media (max-width: 560px) {
  [data-page="deals"] .day { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); }
  [data-page="deals"] .day dd, [data-page="deals"] .day dt { white-space: normal; }
  [data-page="deals"] .day dd { font-size: var(--t2); }

  /* the filter row docks at the top; chips scroll sideways in one line beside the search and the Filters disclosure; the rest sits behind it */
  [data-page="deals"] .filters { position: sticky; top: 0; z-index: 10; background: var(--bg); margin-inline: calc(-1 * var(--gutter)); padding: var(--s2) var(--gutter); gap: var(--s2); }
  [data-page="deals"] .filt-cap { display: none; }   /* the dock and the panel stack their controls full width; the captions still name the groups */
  [data-page="deals"] .filt-r1 { gap: var(--s2); }
  /* the rail bleeds to the viewport edge and fades out on the right, so the chips past the edge read as more rail, not the end of it; the end padding keeps the last chip clear of the fade once scrolled there */
  [data-page="deals"] .filt-cats { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding: 4px calc(var(--gutter) + 40px) 4px var(--gutter); scroll-padding-inline: var(--gutter); -webkit-overflow-scrolling: touch; -webkit-mask-image: linear-gradient(to right, var(--fg) calc(100% - 48px), transparent); mask-image: linear-gradient(to right, var(--fg) calc(100% - 48px), transparent); }
  [data-page="deals"] .filt-cats .chip { flex: 0 0 auto; white-space: nowrap; }
  [data-page="deals"] .filt-q { margin-left: 0; flex: 1 1 12rem; min-width: 0; }   /* a real basis, so it wraps beside the Filters button instead of into the rail's margin */
  [data-page="deals"] .filt-toggle { display: inline-flex; flex: none; }
  /* closed, the panel fades out over 160 ms (the system's exit, faster than its --dur-2 rise) and only then leaves the layout, as the nav panel does */
  [data-page="deals"] .filters:not(.is-open) .filt-more { display: none; opacity: 0; transition-property: opacity, display; transition-duration: 160ms; transition-timing-function: ease-out; transition-behavior: allow-discrete; }
  /* open, the panel scrolls within the dock so the board stays reachable under it; the brand box and the selects go full width */
  [data-page="deals"] .filt-more { display: flex; flex-direction: column; gap: var(--s2); max-height: 60svh; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 2px; }
  [data-page="deals"] .filt-r2 .seg, [data-page="deals"] .filt-box, [data-page="deals"] #store-sel, [data-page="deals"] .seg-band, [data-page="deals"] .filt-sizes { flex: 1 1 100%; width: 100%; margin-left: 0; min-width: 0; }
  [data-page="deals"] .res-sort { flex: 1 1 auto; justify-content: space-between; }
  [data-page="deals"] #sort-sel { flex: 1 1 auto; min-width: 0; }
  [data-page="deals"] .filt-r2 .seg button { flex: 1 1 0; }
  /* the price band as a three-by-two segment: the hairlines between cells are the group's own colour showing through the gap */
  [data-page="deals"] .seg-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5px; background: var(--line); }
  [data-page="deals"] .seg-band button { border-left: 0; background: var(--bg); min-width: 0; padding-inline: 6px; }
  [data-page="deals"] .seg-band button[aria-pressed="true"] { background: var(--fg); }
  [data-page="deals"] .seg-band button:active:not([aria-pressed="true"]) { background: var(--bg-2); }
  [data-page="deals"] .filt-setsizes { width: 100%; }
  [data-page="deals"] .res-h { scroll-margin-top: calc(var(--dock-h, 112px) + var(--s2)); }
  [data-page="deals"] .deal, [data-page="deals"] .empty, [data-page="deals"] .deals > .callout { scroll-margin-top: calc(var(--dock-h, 112px) + var(--s2)); }
}

/* ---------------------------------------------------------------- motion (2 Nov 2026): continuity on a filter change */
[data-page="deals"] .deals { position: relative; }                       /* the ghosts of leaving cards sit at their old place */
[data-page="deals"] .deal.is-flip { transition: transform var(--dur-2) var(--ease-out), opacity var(--dur-2) var(--ease-out); }
[data-page="deals"] .deal.is-new { opacity: 0; }
[data-page="deals"] .deal-ghost { position: absolute; margin: 0; pointer-events: none; transition: opacity var(--dur-1) ease-out; }
[data-page="deals"] .deal-ghost.is-out { opacity: 0; }
[data-page="deals"] .res-n { font-variant-numeric: tabular-nums lining-nums; }
[data-page="deals"] .filt-toggle svg { transition: transform var(--dur-2) var(--ease-out); }
@media (max-width: 560px) {
  [data-page="deals"] .filters.is-open .filt-more { animation: m-rise var(--dur-2) var(--ease-out) both; }
  [data-page="deals"] .filters[data-instant] .filt-more { animation: none; }   /* a keyboard open is instant, like the nav */
}
@media (prefers-reduced-motion: reduce) {
  [data-page="deals"] .deal.is-flip, [data-page="deals"] .deal-ghost, [data-page="deals"] .filt-toggle svg, [data-page="deals"] .filters:not(.is-open) .filt-more { transition: none; }
  [data-page="deals"] .filters.is-open .filt-more { animation: none; }
}

/* ---------------------------------------------------------------- finish (2 Nov 2026) */
@keyframes m-rise { from { opacity: 0; transform: translateY(-6px); } }   /* the disclosure's rise was referenced above but never defined; in from the row's edge like the nav panel */
[data-page="deals"] .filt-setsizes:active { transform: scale(.98); }
[data-page="deals"] .filt-cats { overscroll-behavior-x: contain; }   /* the chip rail keeps its overscroll off the page's back swipe */
@media (prefers-reduced-motion: reduce) { [data-page="deals"] .filt-setsizes:active { transform: none; } }
