/* ============================================================
   QuoTrak — free trade tools on /tools
   Depends on shell.css, builder.css (hero, article, FAQ) and
   calculator.css (the input card and results card).
   ============================================================ */

.tool-back { display: inline-block; margin-bottom: 14px; font-size: 14px; color: rgba(255, 255, 255, 0.7); }
.tool-back:hover { color: var(--white); }

.calc-input[data-unit]:not([data-unit="$"]):not([data-unit="%"])::after { content: attr(data-unit); right: 11px; }
.calc-input[data-unit]:not([data-unit="$"]):not([data-unit="%"]) input { padding-right: 34px; }
.calc-input select { width: 100%; height: 40px; padding: 0 8px; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--white); font: inherit; font-size: 14.5px; color: var(--app-fg); }
.calc-input select:focus { outline: 2px solid var(--app-primary); outline-offset: 0; border-color: var(--app-primary); }
.calc-input--wide { flex-basis: 190px; }
.calc-pair { display: flex; gap: 6px; flex: 0 0 170px; }
.calc-pair .calc-input { flex: 1 1 0; min-width: 0; }
.calc-pair input { -moz-appearance: textfield; appearance: textfield; padding-left: 9px !important; padding-right: 24px !important; }
.calc-pair input::-webkit-inner-spin-button, .calc-pair input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.calc-pair .calc-input::after { right: 8px !important; }
[data-show][hidden] { display: none; }
.calc-group .calc-row:last-child { margin-bottom: 0; }
.calc-modes--two { grid-template-columns: repeat(2, 1fr); }

.tool-rows { margin: 0; }
.tool-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.14); font-size: 14.5px; }
.tool-rows dt { color: rgba(255, 255, 255, 0.7); }
.tool-rows dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tool-formula { margin: 14px 0 0; font-size: 13px; line-height: 1.5; color: rgba(255, 255, 255, 0.65); }

.tool-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 4px 8px; margin: 0; }
.tool-tiles > div { padding: 2px 4px; }
.tool-tiles dt { font-size: 12.5px; color: rgba(255, 255, 255, 0.65); margin-bottom: 2px; }
.tool-tiles dd { margin: 0; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tool-tiles .is-warn dd { color: #fca5a5; }
.tool-check { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; }
.tool-check p { margin: 0 0 6px; }
.tool-check p:last-child { margin-bottom: 0; }
.tool-check.is-ok { background: rgba(74, 222, 128, 0.14); color: #86efac; }
.tool-check.is-warn { background: rgba(252, 211, 77, 0.14); color: #fcd34d; }

.calc-grid--bench { grid-template-columns: 340px minmax(0, 1fr); max-width: 1160px; align-items: start; }
.tool-controls { position: sticky; top: calc(var(--nav-h) + 16px); max-height: calc(100vh - var(--nav-h) - 32px); overflow-y: auto; }
.tool-bench { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tool-bench .calc-results { padding: 18px 20px; display: block; }
.calc-segment { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.calc-segment > legend { display: block; padding: 0; margin-bottom: 7px; font-size: 14.5px; color: var(--app-fg); }
.tool-diagram { padding: 14px; }
.tool-drawing { overflow-x: auto; border-radius: 8px; }
.tool-diagram svg { display: block; width: 100%; height: auto; font-family: var(--app-font); }
.tool-swipe { display: none; }
.tool-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 12px 4px 2px; padding: 0; font-size: 12.5px; color: var(--app-muted-fg); }
.tool-legend li { display: flex; align-items: center; gap: 6px; }
.tool-legend span { width: 11px; height: 11px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(8, 26, 48, 0.18); }
.tool-legend-note { margin-left: auto; }
.tool-openings { list-style: none; margin: 12px 4px 2px; padding: 0; }
.tool-openings li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 10px 0; border-top: 1px solid var(--app-border-soft); font-size: 14px; color: var(--app-fg); }
.tool-opening-tag { width: 20px; height: 20px; border-radius: 50%; background: #33475f; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.tool-openings dl { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; margin: 0; }
.tool-openings dt { font-size: 12.5px; color: var(--app-muted-fg); }
.tool-openings dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tool-sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; padding: 20px 24px; }
.tool-sheet-label { font-size: 14px; font-weight: 600; margin: 0 0 6px; color: var(--app-fg); }
.tool-sheet-title { grid-column: 1 / -1; }
.tool-sheet > .tool-list { grid-column: 1 / -1; columns: 2; column-gap: 32px; }
.tool-list { list-style: none; margin: 0; padding: 0; }
.tool-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--app-border-soft); font-size: 14px; break-inside: avoid; }
.tool-list span { color: var(--app-muted-fg); }
.tool-list strong { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tool-next { align-self: flex-start; font-size: 14.5px; font-weight: 600; color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

.tool-opening { border: 1px solid var(--app-border-soft); border-radius: var(--app-radius); padding: 10px 12px 12px; margin-bottom: 8px; background: var(--white); }
.tool-opening-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13.5px; font-weight: 600; }
.tool-ofields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool-ofield { display: block; min-width: 0; }
.tool-ofield > span:first-child { display: block; font-size: 12.5px; color: var(--app-muted-fg); margin-bottom: 3px; }
.tool-ofield .calc-input { display: block; }
.tool-ofield input { height: 36px !important; }
.tool-opening button, .tool-add button, .tool-swap { background: var(--white); border: 1px solid var(--app-border); border-radius: var(--app-radius); font: inherit; font-size: 13.5px; font-weight: 600; color: var(--app-fg); padding: 7px 12px; cursor: pointer; }
.tool-opening button { border: 0; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--app-muted-fg); text-decoration: underline; background: none; }
.tool-opening button:hover { color: var(--red); }
.tool-add { display: flex; gap: 8px; }
.tool-add button { flex: 1; }
.tool-swap { display: block; width: 100%; margin-bottom: 10px; }

.tool-convert-result { font-size: clamp(30px, 5vw, 42px); font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.tool-disclaimer { font-size: 14px; color: var(--gray-600); background: var(--gray-50); border-radius: 8px; padding: 12px 16px; }
.tool-related { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fb-article .tool-related li { margin: 0; }
.fb-article .tool-related a { display: block; height: 100%; padding: 12px 14px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 15px; text-decoration: none; }
.fb-article .tool-related a:hover { border-color: var(--orange); }

.feat-hero.tool-hero { padding: 44px 0 36px; }
.tool-hero .feat-hero-heading { font-size: clamp(28px, 4vw, 42px); margin-bottom: 12px; }
.tool-hero .feat-hero-sub { font-size: 16px; }
.tool-hero .feat-hero-trust { margin-top: 14px; }

.tool-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 20px 0 0; padding: 0; }
.tool-jump a { display: block; padding: 7px 14px; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 100px; font-size: 13.5px; color: rgba(255, 255, 255, 0.85); }
.tool-jump a:hover { background: rgba(255, 255, 255, 0.1); color: var(--white); }

.tool-hub { background: var(--app-bg); padding: 16px 0 40px; font-family: var(--app-font); }
.tool-hub .container { max-width: 1140px; }
.tool-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 36px 0; border-bottom: 1px solid var(--app-border); scroll-margin-top: var(--nav-h); }
.tool-section:last-child { border-bottom: 0; }
.tool-section-head h2 { font-size: 22px; font-weight: 700; color: var(--app-fg); margin: 0 0 8px; }
.tool-section-head p { font-size: 14.5px; line-height: 1.5; color: var(--app-muted-fg); margin: 0; }
.tool-features, .tool-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tool-features { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tool-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tool-feature { display: flex; flex-direction: column; height: 100%; background: var(--app-card); border: 1px solid var(--app-border); border-radius: 12px; overflow: hidden; transition: border-color var(--transition), box-shadow var(--transition); }
.tool-feature:hover { border-color: var(--app-primary); box-shadow: var(--shadow); }
.tool-feature-art { display: flex; align-items: center; justify-content: center; height: 210px; background: #f7f9fc; border-bottom: 1px solid var(--app-border-soft); }
.tool-feature-art svg { display: block; width: 100%; height: 100%; }
.tool-feature-text { display: block; padding: 16px 18px 18px; }
.tool-feature-text strong { display: block; font-size: 18px; font-weight: 600; color: var(--app-fg); margin-bottom: 4px; }
.tool-feature-text > span { display: block; font-size: 14.5px; line-height: 1.45; color: var(--app-muted-fg); }
.tool-feature-text .tool-feature-go { margin-top: 10px; font-weight: 600; color: var(--app-primary-dark); }

.tool-card { display: flex; flex-direction: column; height: 100%; background: var(--app-card); border: 1px solid var(--app-border); border-radius: 12px; padding: 16px; transition: border-color var(--transition), box-shadow var(--transition); }
.tool-card:hover { border-color: var(--app-primary); box-shadow: var(--shadow); }
.tool-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.tool-card-head strong { font-size: 16px; font-weight: 600; color: var(--app-fg); }
.tool-icon { flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 8px; background: var(--app-muted); color: var(--app-primary-dark); }
.tool-card-blurb { font-size: 14px; line-height: 1.45; color: var(--app-muted-fg); }
.tool-eg { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: auto; padding-top: 12px; font-size: 13px; color: var(--app-muted-fg); }
.tool-eg span { padding-top: 0; }
.tool-eg strong { color: var(--app-fg); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.ref-nav { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 8px; }
.fb-article .ref-nav li { margin: 0; }
.fb-article .ref-nav a { display: block; padding: 6px 12px; border: 1px solid var(--gray-200); border-radius: 20px; font-size: 14px; text-decoration: none; }
.ref-table-wrap { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) { .tool-card, .tool-feature { transition: none; } }
@media (max-width: 980px) {
  .calc-grid--bench { grid-template-columns: minmax(0, 1fr); }
  .tool-controls { position: static; max-height: none; overflow: visible; }
  .tool-section { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 28px 0; }
}
@media (max-width: 760px) {
  .tool-sheet { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .tool-sheet > .tool-list { columns: 1; }
  .tool-related, .tool-features, .tool-grid--two, .tool-grid--three { grid-template-columns: minmax(0, 1fr); }
  .tool-feature-art { height: 180px; }
  .tool-legend-note { margin-left: 0; }
  .tool-openings dl { grid-template-columns: minmax(0, 1fr); }
  .tool-openings dl > div { display: flex; justify-content: space-between; gap: 12px; }
  .tool-tiles dd { font-size: 19px; }
  .tool-diagram { padding: 8px; }
  .tool-diagram svg { min-width: 560px; }
  .tool-swipe { display: block; margin: 8px 4px 0; font-size: 12.5px; color: var(--app-muted-fg); }
  .calc-input--wide { flex-basis: 170px; }
  .calc-pair { flex-basis: 160px; }
}
