/* Wigwam Tools — stylesheet
 * ---------------------------------------------------------------------------
 * Same ISOLATION CONTRACT as the Elements kit (wg-elements.css):
 *  1. Every selector begins with a .wt- class. No bare element selectors.
 *  2. No Bootstrap class names (the theme loads Bootstrap 5.2.3 sitewide).
 *  3. No #secondary / #breadcrumbs selectors.  4. No !important.
 * Tokens (--wg-*) and the :where() reset come from the kit's .wg-el scope; tools render inside .wg-el.
 * Served only on pages that contain a [wt_tool] shortcode.
 * --------------------------------------------------------------------------- */

.wt-tool { position: relative; }
.wt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* --- the tool shell: controls left, result right (stacked on phones) ------- */
.wt-shell { display: grid; gap: var(--wg-gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .wt-shell { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); } }
.wt-panel { background: #fff; border: 1px solid var(--wg-line); border-radius: var(--wg-radius); padding: 20px; }
.wt-panel--band { background: var(--wg-band); border-color: transparent; }
.wt-panel-h { margin: 0 0 12px; color: var(--wg-blue); font-size: 20px; font-weight: 600; line-height: 1.2; }
/* 152px: the theme's sticky header is 136px tall once scrolled (TL-11 r2, TL-12 r1) */
@media (min-width: 1000px) { .wt-result { position: sticky; top: 152px; } }

/* --- tabs (ARIA tablist) ---------------------------------------------------- */
.wt-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; padding: 0; list-style: none; }
.wt-tab {
  min-height: 44px; padding: 10px 16px; border: 1.5px solid var(--wg-line); border-radius: 999px;
  background: #fff; color: var(--wg-blue); font-size: 15px; font-weight: 500; line-height: 1.2; cursor: pointer;
}
.wt-tab[aria-selected="true"] { background: var(--wg-blue); border-color: var(--wg-blue); color: #fff; }
.wt-tab:hover { border-color: var(--wg-blue); }
.wt-tabpanel.wt-off, .wt-tool .wt-off { display: none; }
/* hide with classes, not [hidden]: Bootstrap sets [hidden]{display:none!important}, which no <noscript> style can undo */
.wt-tool .wt-nojs, .wt-tool .wt-actions.wt-nojs { display: none; } /* (0,2,0)/(0,3,0): beats .wt-actions{display:flex} */

/* --- preset cards ----------------------------------------------------------- */
.wt-cards { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
@media (min-width: 620px) { .wt-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .wt-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.wt-card {
  display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 64px; height: 100%; padding: 12px 14px;
  border: 1.5px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff;
  color: var(--wg-ink); text-align: left; text-decoration: none; font-size: 15px; font-weight: 500; line-height: 1.25; cursor: pointer;
}
.wt-card:hover { border-color: var(--wg-blue); }
.wt-card[aria-pressed="true"], .wt-card[aria-current="true"] { border-color: var(--wg-teal); box-shadow: inset 0 0 0 1px var(--wg-teal); }
.wt-card-sub { color: var(--wg-mute); font-size: 13px; font-weight: 400; }

/* --- form controls ---------------------------------------------------------- */
.wt-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin: 14px 0 0; }
@media (min-width: 620px) { .wt-row--3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr); } }
.wt-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wt-label { color: var(--wg-ink); font-size: 14px; font-weight: 600; }
.wt-hint { color: var(--wg-mute); font-size: 13px; }
.wt-input, .wt-select {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #A9BCD0; border-radius: var(--wg-radius-s);
  background: #fff; color: var(--wg-ink); font: inherit; font-size: 16px;
}
.wt-input:focus-visible, .wt-select:focus-visible { outline: 2px solid var(--wg-teal); outline-offset: 1px; }
.wt-error { color: var(--wg-coral-text); font-size: 14px; font-weight: 500; }

/* --- item list rows with always-visible steppers ---------------------------- */
.wt-group { margin: 16px 0 0; }
.wt-group-h { margin: 0 0 6px; color: var(--wg-blue); font-size: 16px; font-weight: 600; }
.wt-items { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--wg-line); }
.wt-item { display: flex; gap: 10px; align-items: center; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--wg-line); }
.wt-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 0; background: none; border: 0; text-align: left; color: var(--wg-ink); cursor: pointer; }
.wt-item-name { font-size: 15.5px; font-weight: 500; }
.wt-item-meta { color: var(--wg-mute); font-size: 13px; }
.wt-step { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.wt-step-b {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border: 1.5px solid var(--wg-blue); border-radius: var(--wg-radius-s); background: #fff; color: var(--wg-blue);
  font-size: 22px; font-weight: 500; line-height: 1; cursor: pointer;
}
.wt-step-b:hover { background: var(--wg-blue); color: #fff; }
.wt-step-b:disabled { border-color: var(--wg-line); color: #9AA8B8; background: #fff; cursor: default; }
.wt-step-q { width: 48px; min-height: 44px; padding: 6px 4px; border: 1px solid #A9BCD0; border-radius: var(--wg-radius-s); font: inherit; font-size: 16px; text-align: center; }

/* --- result ----------------------------------------------------------------- */
.wt-result-size { margin: 0 0 6px; color: var(--wg-blue); font-size: clamp(26px, 2.6vw, 34px); font-weight: 600; line-height: 1.15; }
.wt-result-why { margin: 0 0 12px; color: var(--wg-ink); font-size: 15.5px; }
.wt-meter { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.wt-meter-bar { flex: 1 1 auto; height: 10px; border-radius: 999px; background: var(--wg-grey); overflow: hidden; }
.wt-meter-fill { height: 100%; background: var(--wg-teal); border-radius: 999px; }
.wt-meter-t { flex: 0 0 auto; font-size: 14px; font-weight: 600; }
.wt-alts { display: grid; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.wt-alt { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--wg-radius-s); background: var(--wg-grey); font-size: 14.5px; }
.wt-alt-l { color: var(--wg-mute); }
.wt-prices { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.wt-price { padding: 10px 12px; border: 1px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; }
.wt-price-l { display: block; color: var(--wg-mute); font-size: 13px; }
.wt-price-v { display: block; color: var(--wg-ink); font-size: 16px; font-weight: 600; }
.wt-price-o { display: block; margin-top: 2px; color: var(--wg-teal-d); font-size: 13.5px; }
.wt-lines { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.wt-line { padding: 10px 12px; border-radius: var(--wg-radius-s); background: var(--wg-amber); font-size: 14.5px; }
.wt-line--info { background: var(--wg-band); }
.wt-small { color: var(--wg-mute); font-size: 13.5px; }
.wt-asof { margin: 8px 0 0; color: var(--wg-mute); font-size: 13px; }
.wt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.wt-empty { color: var(--wg-mute); font-size: 15.5px; }
.wt-gate { color: var(--wg-mute); font-style: italic; }

/* --- your list -------------------------------------------------------------- */
.wt-list { margin: 0; padding: 0; list-style: none; }
.wt-list-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 44px; border-bottom: 1px solid var(--wg-line); font-size: 14.5px; }
.wt-list-x { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--wg-coral-text); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.wt-list-total { display: flex; justify-content: space-between; padding: 10px 0 0; font-weight: 600; }

/* --- mobile sticky result bar ---------------------------------------------- */
.wt-stickybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--wg-blue); color: #fff; font-size: 15px; font-weight: 500;
}
.wt-stickybar a { color: #fff; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.wt-stickybar[hidden] { display: none; }
@media (min-width: 1000px) { .wt-stickybar { display: none; } }
.wt-tool.wt-has-bar { padding-bottom: 72px; }
@media (min-width: 1000px) { .wt-tool.wt-has-bar { padding-bottom: 0; } }

/* --- twin tables ------------------------------------------------------------ */
.wt-table-wrap { overflow-x: auto; border: 1px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; }
.wt-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.wt-table caption { padding: 12px 14px; color: var(--wg-mute); font-size: 13.5px; text-align: left; caption-side: top; }
.wt-table th, .wt-table td { padding: 10px 14px; border-top: 1px solid var(--wg-line); text-align: left; vertical-align: top; }
.wt-table thead th { background: var(--wg-band); color: var(--wg-blue); font-weight: 600; border-top: 0; }
.wt-table tr[aria-current="true"] td, .wt-table tr[aria-current="true"] th { background: #E6F4F1; }
.wt-num { text-align: right; white-space: nowrap; }
.wt-table .wt-num { text-align: right; }
.wt-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--wg-teal); color: #fff; font-size: 12px; font-weight: 600; }

/* --- prose blocks in twins -------------------------------------------------- */
.wt-prose { max-width: 75ch; font-size: 16px; }
.wt-noscript { margin: 0 0 12px; }

/* --- loading (never shifts layout: the twin is already in place) ------------ */
.wt-is-loading .wt-live { opacity: .6; }
@media (prefers-reduced-motion: no-preference) { .wt-meter-fill { transition: width .25s ease; } }

/* --- tool page head (no hero: the first control sits in the first phone screen) --- */
.wt-s--tool { padding-top: 18px; }
.wt-h1 { margin: 0 0 6px; font-size: clamp(28px, 3.2vw, 44px); }
.wt-intro { margin: 0 0 16px; color: var(--wg-mute); font-size: 17px; max-width: 64ch; }
.wt-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.wt-fieldset .wt-label { display: block; margin: 0 0 8px; }
.wt-card:has(input:checked) { border-color: var(--wg-teal); box-shadow: inset 0 0 0 1px var(--wg-teal); }
.wt-card:has(input:focus-visible) { outline: 2px solid var(--wg-teal); outline-offset: 2px; }

/* phones: the four tabs as one segmented row (they wrapped to two rows at 360px) */
@media (max-width: 520px) {
  .wt-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .wt-tab { padding: 10px 2px; font-size: 14px; border-radius: var(--wg-radius-s); }
  .wt-panel { padding: 14px; }
}

.wt-line--offer { background: #E6F4F1; color: var(--wg-ink); }

/* --- TL-03 size ladder ---------------------------------------------------------------------------------- */
.wt-ladder-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.wt-units { display: inline-flex; align-items: center; gap: 6px; }
.wt-unit { min-height: 44px; min-width: 56px; padding: 8px 12px; border: 1.5px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; color: var(--wg-blue); font-size: 14.5px; font-weight: 500; cursor: pointer; }
.wt-unit[aria-pressed="true"] { background: var(--wg-blue); border-color: var(--wg-blue); color: #fff; }
.wt-steps-group { margin: 10px 0 0; }
.wt-steps-h { margin: 0 0 8px; color: var(--wg-mute); font-size: 14px; font-weight: 600; }
.wt-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.wt-step-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 76px; min-height: 48px; padding: 6px 12px;
  border: 1.5px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; color: var(--wg-blue);
  font-size: 15px; font-weight: 500; line-height: 1.15; text-decoration: none; text-align: center;
}
.wt-step-btn:hover { border-color: var(--wg-blue); }
/* the theme's main.css gives every <a> `transition: .3s`, which made selection fade in; switch instantly */
.wt-step-btn, .wt-card { transition: none; }
.wt-step-btn[aria-pressed="true"] { background: var(--wg-blue); border-color: var(--wg-blue); color: #fff; }
.wt-sel { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.wt-ladder-nav { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 14px; }
.wt-typeform { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0 0 0 auto; }
.wt-typeform .wt-label { width: 100%; }
.wt-typeform .wt-input { width: 110px; }
.wt-typeform .wt-select { width: 90px; }
.wt-ladder-panel { margin-top: var(--wg-gap); }
.wt-ladder-h { font-size: clamp(24px, 2.4vw, 32px); }
.wt-ladder-body { display: grid; gap: var(--wg-gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .wt-ladder-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.wt-figure { margin: 0; }
.wt-tiles { width: 100%; max-width: 520px; height: auto; display: block; max-height: 420px; }
.wt-floor { fill: var(--wg-band); stroke: var(--wg-blue); stroke-width: .08; }
.wt-grid line { stroke: #9EC3E6; stroke-width: .03; }
.wt-ref { fill: none; stroke-width: .09; stroke-dasharray: .25 .15; }
.wt-ref--mattress { stroke: var(--wg-coral-d); }
.wt-ref--sofa { stroke: var(--wg-teal-d); }
.wt-key { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; white-space: nowrap; }
.wt-key::before { content: ""; display: inline-block; width: 18px; height: 10px; border: 2px dashed currentColor; border-radius: 2px; }
.wt-key--mattress { color: var(--wg-coral-text); }
.wt-key--sofa { color: var(--wg-teal-d); }
.wt-size-sections { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-top: 16px; }
@media (min-width: 760px) { .wt-size-sections { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.wt-size-sec { padding: 14px 16px; border: 1px solid var(--wg-line); border-radius: var(--wg-radius-s); background: #fff; }
.wt-size-sec p { margin: 0 0 .4em; font-size: 15px; }
.wt-row--store { margin: 0 0 16px; }
.wt-row--store .wt-field { max-width: 380px; }

/* --- TL-04 price table ---------------------------------------------------------------------------------- */
.wt-pt { padding: 4px 0 8px; }
.wt-pt-h { margin: 0 0 8px; color: var(--wg-blue); font-size: clamp(24px, 2.4vw, 34px); font-weight: 600; text-align: left; }
.wt-pt-answer { max-width: 75ch; margin: 0 0 14px; font-size: 16.5px; }
.wt-pt-filters { margin: 0 0 14px; padding: 16px; border: 1px solid var(--wg-line); border-radius: var(--wg-radius); background: var(--wg-band); }
.wt-pt-filters .wt-row { margin-top: 0; }
.wt-pt-stores { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin: 0 0 14px; padding: 0; list-style: none; }
.wt-sort { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--wg-blue); font: inherit; font-weight: 600; cursor: pointer; text-align: inherit; }
.wt-sort::after { content: "↕"; font-size: 12px; opacity: .55; }
.wt-pt-table th[aria-sort="ascending"] .wt-sort::after { content: "↑"; opacity: 1; }
.wt-pt-table th[aria-sort="descending"] .wt-sort::after { content: "↓"; opacity: 1; }
.wt-pt-table tbody th { font-weight: 500; }
.wt-pt-inc { margin-top: 18px; padding: 16px 18px; border-radius: var(--wg-radius); background: var(--wg-grey); }
.wt-pt-list { margin: 0 0 10px; padding-left: 1.1em; }
/* phones: one card per row (TL-04 §8.1) */
@media (max-width: 599.98px) {
  .wt-pt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .wt-pt-table, .wt-pt-table tbody, .wt-pt-table tr, .wt-pt-table th, .wt-pt-table td { display: block; }
  .wt-pt-table tr { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--wg-line); border-radius: var(--wg-radius-s); }
  .wt-pt-table tr[hidden] { display: none; }
  .wt-pt-table th, .wt-pt-table td { padding: 3px 0; border: 0; text-align: left; }
  .wt-pt-table td::before { content: attr(data-label) ": "; color: var(--wg-mute); font-size: 13.5px; }
  .wt-pt-table .wt-num { text-align: left; }
  .wt-pt-wrap { border: 0; overflow: visible; }
  .wt-pt-table caption { display: block; width: 100%; padding: 0 0 10px; }
}

/* Visible focus on every control in a tool (WCAG 2.4.7): the kit's :where() ring is overridden by the theme. */
.wt-tool a:focus-visible, .wt-tool button:focus-visible, .wt-tool summary:focus-visible,
.wt-tool select:focus-visible, .wt-tool input:focus-visible, .wt-tool [tabindex]:focus-visible { outline: 2px solid var(--wg-teal); outline-offset: 2px; }
.wt-band-h { margin: 22px 0 10px; color: var(--wg-blue); font-size: 22px; font-weight: 600; }
/* If a tool's script fails to load, the loader adds .wt-is-static: the tool then behaves exactly like its no-JS form
   (TL-02 review r1, Major 9: tabs that did nothing, submit hidden). */
.wt-tool.wt-is-static .wt-js, .wt-tool.wt-is-static .wt-tabs, .wt-tool.wt-is-static .wt-step { display: none; }
.wt-tool.wt-is-static .wt-nojs, .wt-tool.wt-is-static .wt-tabpanel.wt-off { display: block; }
.wt-tool.wt-is-static .wt-actions.wt-nojs { display: flex; }
