/*
  FeatureWorth — tool page components (v2)
  Load after fw-layout.css. Uses its tokens; adds nothing to the palette.
*/

:root { interpolate-size: allow-keywords; }   /* lets <details> animate open where supported */

.fw-num, .fw-price { font-variant-numeric: tabular-nums; }
.fw-muted { color: var(--muted); }

@keyframes fw-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fw-in { animation: fw-in .32s var(--ease) both; }
.fw-stagger { animation: fw-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }

/* ── Page head and controls ───────────────────────────────── */
.fw-hero--tool { padding-bottom: 0; }

.fw-controls {
  margin-top: 28px;
  padding: 16px;
  background: var(--off);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  display: grid; gap: 12px; align-items: end;
}
.fw-controls--vc { grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 46px minmax(220px, 1.4fr); }
.fw-controls--cc { grid-template-columns: 1fr 46px 1fr; }
.fw-pair { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }

.fw-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fw-field > span { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 2px; }

.fw-select {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  font: 500 15px/1.3 var(--font);
  color: var(--ink);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230e2f36' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--line-s);
  border-radius: 10px;
  padding: 12px 38px 12px 14px;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.fw-select:hover { border-color: var(--teal-l); }
.fw-select:focus-visible { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,47,54,.16); }

.fw-swap {
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--line-s); border-radius: 10px;
  transition: border-color .15s, transform .15s var(--ease);
}
.fw-swap:hover { border-color: var(--teal); }
.fw-swap:active { transform: scale(.95); }
.fw-swap svg { transition: transform .35s var(--ease); }
.fw-swap.is-flipped svg { transform: rotate(180deg); }

/* ── Notices, empty, loading ──────────────────────────────── */
.fw-notice {
  margin-top: 8px; margin-bottom: 8px;
  padding: 11px 16px;
  background: var(--amber-pale);
  border: 1px solid var(--amber-line);
  border-radius: 10px;
  font-size: 14px; color: var(--grey-d);
}
.fw-notice strong { color: var(--amber); }

.fw-empty { padding: 48px 0; max-width: 560px; }
.fw-empty h3 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.fw-empty p { font-size: 15px; color: var(--muted); }

@keyframes fw-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.fw-skel {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--grey-l) 0%, #f7f8f4 40%, var(--grey-l) 80%);
  background-size: 200% 100%;
  animation: fw-shimmer 1.3s linear infinite;
}
.fw-loading { padding: 32px 0; display: grid; gap: 14px; }
.fw-loading .fw-skel:nth-child(1) { height: 34px; width: 60%; }
.fw-loading .fw-skel:nth-child(2) { height: 18px; width: 80%; }
.fw-loading .fw-skel:nth-child(3) { height: 180px; width: 100%; border-radius: var(--radius-l); margin-top: 12px; }

.fw-sources { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); max-width: 92ch; line-height: 1.7; }

/* ── Verdict ──────────────────────────────────────────────── */
.fw-verdict { margin-top: 32px; }
.fw-verdict h2 {
  font-size: clamp(24px, 3.2vw, 36px);
  font-weight: 800; letter-spacing: -.025em; line-height: 1.15;
  max-width: 30ch; text-wrap: balance;
  margin-bottom: 14px;
}
.fw-verdict > p { font-size: 17px; line-height: 1.65; color: var(--grey-d); max-width: 66ch; text-wrap: pretty; }
.fw-verdict .fw-hint { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ── Gap meter: the signature visual ──────────────────────── */
.fw-meter {
  margin-top: 28px;
  padding: 24px 28px 20px;
  background: var(--off);
  border-radius: var(--radius-l);
  display: grid; gap: 20px;
}
.fw-mrow { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: end; }
.fw-mrow-label { font-size: 15px; font-weight: 700; }
.fw-mrow-label small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 8px; }
.fw-mrow-value { font-size: 17px; font-weight: 800; text-align: right; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fw-mrow-note { grid-column: 1 / -1; order: 4; font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.fw-track { grid-column: 1 / -1; position: relative; height: 14px; background: #e4e8df; border-radius: 99px; }
.fw-bar { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 99px; transition: width .6s var(--ease); }
.fw-bar--gap { background: var(--yellow); box-shadow: inset 0 0 0 1px rgba(14,47,54,.28); }
.fw-bar--max { background: rgba(14,47,54,.24); }
.fw-bar--min { background: var(--teal); }
.fw-mark { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--teal); border-radius: 2px; transition: left .6s var(--ease); }
.fw-meter-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); padding-top: 4px; border-top: 1px solid var(--line); }
.fw-meter-legend i { display: inline-block; vertical-align: -1px; margin-right: 6px; border-radius: 3px; }
.fw-meter-legend .k-min { width: 14px; height: 10px; background: var(--teal); }
.fw-meter-legend .k-max { width: 14px; height: 10px; background: rgba(14,47,54,.24); }
.fw-meter-legend .k-mark { width: 2px; height: 12px; background: var(--teal); }

.fw-only { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fw-only > span { font-size: 14px; font-weight: 700; margin-right: 4px; }
.fw-only b {
  font-size: 13px; font-weight: 600;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--teal);
  color: var(--ink);
}

/* ── Sections and feature rows ────────────────────────────── */
.fw-section { margin-top: 56px; }
.fw-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.fw-section-head h3 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.fw-count { font-size: 13px; font-weight: 700; color: var(--muted); background: var(--grey-l); padding: 2px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.fw-section > p { font-size: 15px; color: var(--muted); margin-bottom: 14px; max-width: 72ch; }

.fw-row {
  display: grid;
  grid-template-columns: 28px minmax(170px, 1.5fr) 124px repeat(3, minmax(118px, 1fr));
  gap: 6px 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
  transition: background .15s, box-shadow .15s;
}
/* Hover band bleeds 12px either side without moving the dividers off the text edge */
.fw-rows > .fw-row:not(.fw-row--head):hover { background: var(--off); box-shadow: -12px 0 0 var(--off), 12px 0 0 var(--off); }
.fw-row--head { padding-top: 8px; padding-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom-color: var(--line-s); }
.fw-row--head > :first-child { grid-column: 2; }
.fw-rows--fixed .fw-row { grid-template-columns: minmax(170px, 1.2fr) minmax(150px, 1fr) minmax(220px, 2fr); }
.fw-rows--fixed .fw-row--head > :first-child { grid-column: 1; }

.fw-row input[type="checkbox"], .fw-check input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; margin-top: 1px;
  border: 1.5px solid var(--line-s); border-radius: 6px;
  background: var(--white) no-repeat center / 12px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .12s var(--ease);
}
.fw-row input[type="checkbox"]:hover, .fw-check input[type="checkbox"]:hover { border-color: var(--teal); }
.fw-row input[type="checkbox"]:active, .fw-check input[type="checkbox"]:active { transform: scale(.9); }
.fw-row input[type="checkbox"]:checked, .fw-check input[type="checkbox"]:checked {
  background-color: var(--teal); border-color: var(--teal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.fw-row label { cursor: pointer; }
.fw-row.is-off .fw-tier, .fw-row.is-off .fw-pill { opacity: .4; transition: opacity .2s; }
.fw-row .fw-tier, .fw-row .fw-pill { transition: opacity .2s; }

.fw-fname { font-size: 15px; font-weight: 700; line-height: 1.35; }
.fw-change { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.fw-why { font-size: 14px; color: var(--grey-d); line-height: 1.55; }
.fw-val { font-size: 15px; }
.fw-val--lead { font-weight: 700; }
.fw-val--none { color: var(--grey-m); }

.fw-tier { display: flex; flex-direction: column; gap: 2px; }
.fw-tier .fw-price { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.fw-tier-name { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.fw-tier--empty { color: var(--grey-m); font-size: 15px; }
.fw-tag {
  align-self: flex-start;
  font-size: 11.5px; font-weight: 700;
  padding: 1px 8px; margin-top: 4px;
  border-radius: 99px;
  background: var(--amber-pale); color: var(--amber);
}

.fw-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  padding: 3px 10px 3px 8px;
  border-radius: 99px;
  white-space: nowrap; justify-self: start;
}
.fw-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.fw-pill--easy     { background: var(--green-pale); color: var(--green); }
.fw-pill--moderate { background: var(--amber-pale); color: var(--amber); }
.fw-pill--complex  { background: var(--red-pale);   color: var(--red-dark); }
.fw-pill--none     { background: var(--grey-l);     color: var(--grey-d); }

/* Expanders */
.fw-more { grid-column: 2 / -1; font-size: 14px; }
.fw-more summary, .fw-both > summary, .fw-misses > summary {
  cursor: pointer; width: max-content; list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--teal-l);
  border-radius: 6px;
}
.fw-more summary { font-size: 13.5px; }
.fw-more summary::-webkit-details-marker, .fw-both > summary::-webkit-details-marker, .fw-misses > summary::-webkit-details-marker { display: none; }
.fw-more summary::before, .fw-both > summary::before, .fw-misses > summary::before {
  content: ''; width: 7px; height: 7px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s var(--ease);
}
.fw-more[open] summary::before, .fw-both[open] > summary::before, .fw-misses[open] > summary::before { transform: rotate(45deg); }
details::details-content { block-size: 0; overflow: hidden; transition: block-size .28s var(--ease), content-visibility .28s allow-discrete; }
details[open]::details-content { block-size: auto; }

.fw-more ul { list-style: none; margin-top: 12px; display: grid; gap: 12px; }
.fw-more li { padding-left: 14px; border-left: 2px solid var(--line-s); line-height: 1.5; }
.fw-more li .fw-price { margin-left: 6px; font-weight: 700; }
.fw-more li .fw-muted { display: block; font-size: 13px; }
.fw-more .fw-note { color: var(--grey-d); margin-top: 10px; font-size: 13.5px; }
.fw-link { font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: text-decoration-color .15s; }
.fw-link:hover { text-decoration-color: var(--yellow-d); }

.fw-both { margin-top: 40px; }
.fw-both > summary { font-size: 16px; color: var(--ink); }
.fw-both-list { margin-top: 14px; columns: 2 260px; column-gap: 40px; }
.fw-both-list div { break-inside: avoid; display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.fw-both-list span:last-child { color: var(--muted); text-align: right; }

/* ── Segmented control and chips ──────────────────────────── */
.fw-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--grey-l); }
.fw-seg button {
  font-size: 13.5px; font-weight: 600;
  padding: 7px 13px;
  border: none; border-radius: 8px;
  background: transparent; color: var(--grey-d);
  transition: background .18s, color .18s, box-shadow .18s;
}
.fw-seg button:hover { color: var(--ink); }
.fw-seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(14,47,54,.12), 0 2px 8px rgba(14,47,54,.08); }

.fw-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.fw-chip {
  font-size: 13.5px; font-weight: 500;
  padding: 7px 13px;
  border: 1px solid var(--line-s); border-radius: 99px;
  background: var(--white); color: var(--ink);
  transition: background .15s, color .15s, border-color .15s, transform .12s var(--ease);
}
.fw-chip:hover { border-color: var(--teal); }
.fw-chip:active { transform: scale(.96); }
.fw-chip[aria-pressed="true"] { background: var(--teal); color: var(--white); border-color: var(--teal); }

/* ── Car compare ──────────────────────────────────────────── */
.fw-duo { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fw-side { padding: 22px 24px; background: var(--off); border-radius: var(--radius-l); }
.fw-side-name { font-size: 13px; font-weight: 600; color: var(--muted); }
.fw-side-car { font-size: 20px; font-weight: 800; letter-spacing: -.015em; line-height: 1.3; margin-top: 2px; }
.fw-side-price { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.fw-side-extra { margin-top: 12px; font-size: 14.5px; color: var(--grey-d); line-height: 1.6; }
.fw-side-extra strong { font-variant-numeric: tabular-nums; }

.fw-cc-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 32px; font-size: 14px; font-weight: 600; color: var(--muted); }

.fw-rows--cc .fw-row { grid-template-columns: minmax(170px, 1.3fr) minmax(110px, .8fr) minmax(110px, .8fr) minmax(180px, 1.2fr); }
.fw-rows--cc .fw-row--head > :first-child { grid-column: 1; }
.fw-rows--cc .fw-more { grid-column: 1 / -1; }

/* ── Dream car ────────────────────────────────────────────── */
#dc-notice .fw-notice { margin: 0 0 24px; }
.fw-dream { display: grid; grid-template-columns: 340px 1fr; gap: 44px; align-items: start; }
.fw-filters {
  position: sticky; top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--off);
  border-radius: var(--radius-l);
  padding: 22px;
  scrollbar-width: thin;
}
.fw-filter + .fw-filter { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.fw-filter h3 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 2px; }
.fw-filter > p { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.fw-cat { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 7px; }
.fw-grade { display: none; margin: 8px 0 2px; }
.fw-grade.is-on { display: flex; align-items: center; gap: 8px; font-size: 13px; animation: fw-in .25s var(--ease) both; }
.fw-grade select {
  font: 500 13.5px var(--font); color: var(--ink);
  border: 1px solid var(--line-s); border-radius: 8px; padding: 6px 10px; background: var(--white);
}
.fw-budget-out { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fw-range { width: 100%; accent-color: var(--teal); margin-top: 8px; }
.fw-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-top: 14px; cursor: pointer; }
.fw-check input { flex-shrink: 0; }
.fw-clear { background: none; border: none; font-size: 13.5px; font-weight: 700; color: var(--teal-l); text-decoration: underline; text-underline-offset: 3px; padding: 0; margin-top: 14px; }

.fw-results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line-s); }
.fw-results-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.fw-results-head p { font-size: 14px; color: var(--muted); }

.fw-result { padding: 28px 0; border-bottom: 1px solid var(--line-s); }
.fw-result-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.fw-result-top h3 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.fw-result-top h3 small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.fw-result-best { font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; }
.fw-result-best strong { display: block; font-size: 24px; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.fw-routes { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.fw-route { padding: 18px 20px; border: 1px solid var(--line-s); border-radius: var(--radius-l); background: var(--white); }
.fw-route--win { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.fw-route-kind { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fw-route-kind b { font-size: 11.5px; font-weight: 700; color: var(--white); background: var(--teal); padding: 2px 8px; border-radius: 99px; }
.fw-route-variant { font-size: 16px; font-weight: 700; margin-top: 4px; }
.fw-route-price { font-size: 22px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fw-route-price small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.fw-route ul { list-style: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 14px; }
.fw-route li { display: flex; justify-content: space-between; gap: 10px; }
.fw-route li span:last-child { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fw-route li small { display: block; color: var(--muted); font-size: 12.5px; }
.fw-save {
  display: inline-block; margin-top: 12px;
  font-size: 13.5px; font-weight: 800;
  padding: 4px 11px; border-radius: 8px;
  background: var(--yellow); color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.fw-route-note { margin-top: 10px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.fw-result > .fw-route-note { margin-top: 14px; }

.fw-misses { margin-top: 32px; }
.fw-misses > summary { font-size: 16px; color: var(--ink); }
.fw-misses ul { list-style: none; margin-top: 12px; display: grid; gap: 10px; font-size: 14.5px; }
.fw-misses li strong { font-weight: 700; }
.fw-misses li span { color: var(--muted); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 980px) {
  .fw-controls--vc { grid-template-columns: 1fr 46px 1fr; }
  .fw-controls--vc .fw-field:first-child { grid-column: 1 / -1; }
  .fw-dream { grid-template-columns: 1fr; gap: 28px; }
  .fw-filters { position: static; max-height: none; }
}

@media (max-width: 760px) {
  .fw-controls { padding: 14px; }
  .fw-controls--vc, .fw-controls--cc { grid-template-columns: 1fr; }
  .fw-controls--vc .fw-swap, .fw-controls--cc .fw-swap { justify-self: center; width: 40px; height: 36px; }
  .fw-controls .fw-swap svg { transform: rotate(90deg); }
  .fw-controls .fw-swap.is-flipped svg { transform: rotate(270deg); }
  .fw-meter { padding: 18px 18px 16px; gap: 18px; }
  .fw-mrow-label small { display: block; margin-left: 0; }
  .fw-row--head { display: none; }
  .fw-row { grid-template-columns: 24px repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
  .fw-row > label, .fw-row > .fw-pill, .fw-row > .fw-more { grid-column: 2 / -1; }
  .fw-row > .fw-pill + .fw-tier { grid-column: 2; }
  .fw-row > .fw-tier::before { content: attr(data-tier-label); font-size: 11.5px; font-weight: 600; color: var(--muted); }
  .fw-tier .fw-price { font-size: 13.5px; }
  .fw-tier-name { font-size: 11.5px; }
  .fw-rows--fixed .fw-row, .fw-rows--cc .fw-row { grid-template-columns: 1fr 1fr; }
  .fw-rows--fixed .fw-row > :first-child, .fw-rows--cc .fw-row > :first-child { grid-column: 1 / -1; }
  .fw-rows--fixed .fw-why, .fw-rows--cc .fw-row > .fw-tier { grid-column: 1 / -1; }
  .fw-duo { grid-template-columns: 1fr; }
  .fw-routes { grid-template-columns: 1fr; }
  .fw-result-best { text-align: left; }
}
