/* size-ladder.css: TL-03-only rules (auto-enqueued where [wt_tool id="size-ladder"] renders). Every selector starts
   .wt-, no !important (DECISIONS #2). The older TL-03 step rules stay in wt-tools.css (a lead-owned file). */

/* "Other sizes" heading + toggle side by side: the toggle sits OUTSIDE the h3 so the group's accessible name is only
   "Other sizes we list" (r2 Minor 7). */
.wt-tool .wt-steps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.wt-tool .wt-steps-head .wt-steps-h { margin: 0; }

/* Mattress line under sizes smaller than a double mattress (§FR-08). */
.wt-tool .wt-mattress-line { display: block; margin: 4px 0 6px; color: var(--wg-coral-text); font-weight: 500; }

/* A per-size fragment lands on the panel: clear the theme's sticky header (about 107 px on phones, 143 px wide). */
.wt-tool .wt-ladder-panel { scroll-margin-top: 124px; }
@media (min-width: 992px) { .wt-tool .wt-ladder-panel { scroll-margin-top: 160px; } }

/* Twin cards: arrow links are 44 px targets (r2 5c); tighten the paragraph rhythm around them. */
.wt-tool .wt-size-sec p:has(> .wg-arrowlink) { margin: 0; }
.wt-tool .wt-size-sec .wg-arrowlink { font-size: 15px; line-height: 1.3; }

/* Compact store embed (DECISIONS #28): no hub chrome, less vertical padding. */
.wt-tool .wt-s--compact { padding-top: 8px; padding-bottom: 8px; }

/* "Other sizes we list" collapses behind a toggle on phones (moved here from wt-tools.css in r4: only TL-03 uses it).
   r4 Major 1 / BUILD-GUIDE rule 14: PHP prints the group already collapsed, so nothing moves at mount. The hide applies
   only while the script runs (.wt-tool:not(.wt-is-static)); the tool's <noscript> style reveals the group with JS off. */
/* UX round (tl03-ux Major 3): collapsed at EVERY width now ("Show 16 more sizes"), not only on phones. */
.wt-steps-toggle { display: inline-flex; }
.wt-steps-group--other .wt-steps-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wt-tool:not(.wt-is-static) .wt-steps-group--other.wt-collapsed .wt-steps { display: none; }

/* r4 Major 2: the "Show prices for {store}" offer for a remembered store. Its line is reserved before first paint
   (44 px, a full target), so filling it never moves the page; beside the picker from 620 px. */
.wt-tool .wt-ladder-remember { min-height: 44px; margin: 0; }
.wt-tool .wt-ladder-remember .wg-arrowlink { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 620px) { .wt-tool .wt-row--remember { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: end; } }

/* r5 Major (rule 14, DECISIONS #47): on a per-size fragment landing the inline pre-paint script marks the ladder
   data-frag; the server's default panel is held hidden until the second inline script (printed right after it) has
   swapped in the fragment size's template, so the default panel is never painted and then replaced. */
.wt-tool .wt-ladder[data-frag]:not([data-frag-done]) ~ .wt-ladder-panel [data-panel] { visibility: hidden; }

/* r6 Major (rule 14): the offer never outgrows its reserved 44 px slot: one line, ellipsis, full text in the link's name. */
.wt-tool .wt-ladder-remember { max-width: 100%; overflow: hidden; }
.wt-tool .wt-ladder-remember .wg-arrowlink { max-width: 100%; white-space: nowrap; box-sizing: border-box; }
.wt-tool .wt-ladder-remember .wt-offer-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* r6 Minor 2: no-JS size-table rows and detail sections land clear of the fixed header (106 px phones / 136 px wide). */
.wt-tool #size-table tr[id], .wt-tool .wt-size-sec[id] { scroll-margin-top: 122px; }
@media (min-width: 992px) { .wt-tool #size-table tr[id], .wt-tool .wt-size-sec[id] { scroll-margin-top: 152px; } }

/* r6 Minor 6: at 320 px the drawing legend wraps inside the panel card. */
@media (max-width: 359.98px) { .wt-tool .wt-key { white-space: normal; max-width: 100%; } }

/* ===== UX round (reviews/ux/tl03-ux.md, UX-STANDARD.md) ===== */

/* Lead, 19 Nov: with JS the shared loader keeps scroll-padding-top (header + 16 px) on <html>, so the scroll margins
   above would double it. They stay for no-JS only (the loader never runs there); any loader state zeroes them. */
.wt-tool:is(.wt-is-loading, .wt-is-live, .wt-is-static) .wt-ladder-panel,
.wt-tool:is(.wt-is-loading, .wt-is-live, .wt-is-static) #size-table tr[id],
.wt-tool:is(.wt-is-loading, .wt-is-live, .wt-is-static) .wt-size-sec[id] { scroll-margin-top: 0; }

/* §7 "Which tool?" line under the H1. Links are 44 px tall targets. */
.wt-tool .wt-which { margin: -8px 0 12px; color: var(--wg-mute); font-size: 15px; line-height: 1.4; }
.wt-tool .wt-which a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.wt-tool .wt-which [aria-current] { color: var(--wg-ink); font-weight: 600; }

/* Major 3: "Typical sizes" starters, from TL-02's working figures. */
.wt-tool .wt-typical { margin: 2px 0 4px; }
.wt-tool .wt-typical-h { margin: 0 0 6px; color: var(--wg-mute); font-size: 14px; font-weight: 500; }
.wt-tool .wt-typical-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.wt-tool .wt-typ { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border: 1.5px solid transparent; border-radius: 999px; background: var(--wg-band); color: var(--wg-ink); font-size: 14.5px; line-height: 1.2; text-decoration: none; }
.wt-tool .wt-typ:hover { border-color: var(--wg-blue); }
.wt-tool .wt-typ-l { color: var(--wg-blue); font-weight: 600; }
/* Phones: two to a row, name above size, so the six starters take three short rows, not six. */
@media (max-width: 619.98px) {
  .wt-tool .wt-typical-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .wt-tool .wt-typ { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; padding: 5px 12px; border-radius: var(--wg-radius-s); font-size: 14px; }
}

/* Major 2: one unit control. With JS the typed box shows the switch's unit beside it; the select is the no-JS control. */
.wt-tool .wt-typed-box { display: inline-flex; align-items: center; gap: 8px; }
.wt-tool .wt-tunit-suffix { color: var(--wg-ink); font-size: 15px; font-weight: 500; }
.wt-tool .wt-ask { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* Major 1 (phones): the live one-line summary. In the flow at the end of the ladder (space reserved before first paint,
   fixed height so a new size or store never moves anything) and sticky to the screen's bottom edge while the ladder is
   in view. data-sticky: the shared loader adds its height to scroll-padding-bottom while it is stuck. */
.wt-tool .wt-ladder-sum {
  position: sticky; bottom: 0; z-index: 3; box-sizing: border-box; height: 62px; margin: 12px 0 0; padding: 6px 6px 6px 12px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  border: 1px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; box-shadow: 0 -4px 14px rgba(16, 42, 67, .08);
}
/* r5 pattern: on a fragment landing the summary line is swapped from its template by the same pre-paint script. */
.wt-tool .wt-ladder[data-frag]:not([data-frag-done]) [data-sum-body] { visibility: hidden; }
.wt-tool .wt-sum-txt { display: flex; flex-direction: column; min-width: 0; margin: 0; line-height: 1.3; }
.wt-tool .wt-sum-size, .wt-tool .wt-sum-price { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-tool .wt-sum-size { color: var(--wg-blue); font-size: 15.5px; font-weight: 600; }
.wt-tool .wt-sum-price { color: var(--wg-ink); font-size: 14px; }
.wt-tool .wt-sum-go { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--wg-radius-s); background: var(--wg-blue); color: #fff; font-weight: 600; text-decoration: none; }

/* Major 1 (desktop): the answer sits beside the ladder, sticky, so a pick always changes something in view. */
@media (min-width: 992px) {
  .wt-tool .wt-ladder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--wg-gap); align-items: start; }
  .wt-tool .wt-ladder-grid > .wt-ladder-panel { position: sticky; top: 152px; margin-top: 0; }
  .wt-tool .wt-ladder-grid .wt-ladder-body { grid-template-columns: minmax(0, 1fr); }
  .wt-tool .wt-ladder-grid .wt-row--remember { grid-template-columns: minmax(0, 1fr); }
  .wt-tool .wt-ladder-grid .wt-tiles { max-height: 300px; }
  .wt-tool .wt-ladder-grid .wt-ladder-h { font-size: 26px; }
  .wt-tool .wt-ladder-sum { display: none; }
}

/* §3 placeholder: "Choose a store to see prices" is a button that takes focus to the store picker. */
.wt-tool .wt-goto-site { min-height: 44px; padding: 8px 14px; border: 1.5px dashed var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; color: var(--wg-blue); font: inherit; font-weight: 600; cursor: pointer; }

/* Minor 8: the remembered-store line holds a quiet hint until a store is offered (same 44 px, one line). */
.wt-tool .wt-ladder-remember { color: var(--wg-mute); font-size: 14px; line-height: 44px; white-space: nowrap; text-overflow: ellipsis; }

/* Minor 7 + §4.5: chosen store first, other stores and the terms folded away. Summaries are 44 px targets. */
.wt-tool .wt-lists { margin: 0 0 6px; }
.wt-tool .wt-stores-more, .wt-tool .wt-gtk { margin: 6px 0 0; }
.wt-tool .wt-stores-more > summary, .wt-tool .wt-gtk > summary { padding: 11px 0; color: var(--wg-blue); font-size: 15px; font-weight: 600; line-height: 22px; cursor: pointer; }
.wt-tool .wt-ladder-fig > p { margin: 6px 0 0; }

/* Major 6: the mattress and sofa lie ON the floor, tinted so the squares still show through. Line widths come from the
   drawing's own custom properties (engine/ladder.js tilesSvg), so a 5 and a 450 sq ft drawing read alike. */
.wt-tool .wt-tiles .wt-floor { stroke-width: var(--wt-fw, .08); }
.wt-tool .wt-tiles .wt-grid line { stroke-width: var(--wt-gw, .03); }
.wt-tool .wt-tiles .wt-ref { stroke-width: var(--wt-rw, .09); stroke-dasharray: var(--wt-da, .25 .15); fill-opacity: .16; }
.wt-tool .wt-tiles .wt-ref--mattress { fill: var(--wg-coral-d); }
.wt-tool .wt-tiles .wt-ref--sofa { fill: var(--wg-teal-d); }
