/* Investace Mutual Funds — financial tools hub.
   One index (grouped by intent) + one workspace that swaps in place.
   Built only on shared theme variables → correct in dark and light. */

.tx-intro { padding-top: clamp(112px, 13vh, 150px); padding-bottom: 40px; display: grid; gap: 18px; justify-items: start; }
.tx-intro .lede { max-width: 560px; }
.tx-intro h1 { font-size: clamp(36px, 4.4vw, 64px); text-wrap: balance; }

.tx-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 80px; }

/* ---------- index ---------- */
.tx-rail { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.tx-search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--mute); transition: box-shadow .25s; }
.tx-search:focus-within { box-shadow: inset 0 0 0 1px var(--text); }
.tx-search:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 3px; }
.tx-search svg { width: 16px; height: 16px; flex: none; }
.tx-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; outline: none; }
.tx-search input::placeholder { color: var(--dim); }
.tx-search input::-webkit-search-cancel-button { display: none; }
.tx-search kbd { font: 12px/1 var(--f); padding: 3px 6px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--dim); }
.tx-index { margin-top: 18px; display: grid; gap: 18px; }
.tx-group p { padding: 0 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.tx-item { position: relative; display: grid; gap: 2px; padding: 9px 12px 10px 24px; border-radius: 10px; transition: background .25s, box-shadow .25s; }
.tx-item::before { content: ""; position: absolute; left: 11px; top: 18px; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); transition: background .25s, transform .45s var(--spring); }
.tx-item b { font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.tx-item span { font-size: 13.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-item:hover { background: var(--surface-2); }
.tx-item[aria-current="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.tx-item[aria-current="true"]::before { background: var(--signal); transform: scale(1.4); }
.tx-item[aria-current="true"] span { color: var(--mute); }
.tx-item:active { transform: scale(.985); }
.tx-item:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }

/* mobile switcher (sheet trigger) */
.tx-switch { display: none; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-bottom: 12px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); text-align: left; }
.tx-switch small { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.tx-switch b { font-size: 18px; font-weight: 500; }
.tx-switch em { font-style: normal; font-size: 14px; padding: 10px 16px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- workspace ---------- */
.tx-work { border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); padding: clamp(22px, 3vw, 36px); outline: none; transition: opacity .32s cubic-bezier(.2,.9,.25,1), transform .55s cubic-bezier(.2,.9,.25,1), filter .32s; }
.tx-work.is-leaving { opacity: 0; transform: translateY(-6px) scale(.992); filter: blur(4px); transition-duration: .17s; }
.tx-work.is-entering { opacity: 0; transform: translateY(14px) scale(.992); filter: blur(4px); transition: none; }
.tx-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.tx-kicker { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.tx-head h2 { margin-top: 8px; font-size: clamp(28px, 2.6vw, 38px); font-weight: 400; letter-spacing: -.04em; }
.tx-blurb { margin-top: 6px; font-size: 17px; color: var(--mute); }
.tx-grid { margin-top: 26px; display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(22px, 3vw, 40px); align-items: start; }

/* fields: number + slider pair (direct manipulation, 1:1) */
.tx-inputs { display: grid; gap: 22px; }
.tx-field label { display: block; font-size: 15px; color: var(--mute); margin-bottom: 8px; }
.tx-num { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow .25s; }
.tx-num:focus-within { box-shadow: inset 0 0 0 1px var(--text); }
.tx-num:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 3px; }
.tx-num .tx-u { font-style: normal; font-size: 16px; font-weight: 500; color: var(--mute); white-space: nowrap; }
.tx-num input { flex: 1; align-self: stretch; min-width: 0; border: 0; background: transparent; color: var(--text); font: 500 18px/1 var(--f); letter-spacing: -.02em; font-variant-numeric: tabular-nums; outline: none; }
.tx-field.is-bad .tx-num { box-shadow: inset 0 0 0 1px var(--negative); }
.tx-hint { display: block; min-height: 0; margin-top: 6px; font-size: 13px; color: var(--negative); }
.tx-hint:empty { display: none; }
.tx-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin-top: 8px; background: transparent; cursor: pointer; touch-action: pan-y; }
.tx-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--text) 0 var(--p, 50%), var(--line-2) var(--p, 50%) 100%); }
.tx-range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.tx-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
.tx-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 4px 12px -2px rgba(0,0,0,.35); transition: transform .35s cubic-bezier(.2,.9,.25,1); }
.tx-range::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 4px 12px -2px rgba(0,0,0,.35); }
.tx-range:active::-webkit-slider-thumb { transform: scale(1.18); }
.tx-range:focus-visible { outline: none; }
.tx-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.tx-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }

/* result */
.tx-result { min-width: 0; padding: 22px 22px 20px; border-radius: 16px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.tx-h-label { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--mute); }
.tx-h-value { margin-top: 6px; font-size: clamp(38px, 4vw, 54px); line-height: 1; letter-spacing: -.05em; font-weight: 400; font-variant-numeric: tabular-nums; background: var(--metal); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tx-split { margin-top: 20px; }
.tx-split__bar { display: flex; gap: 3px; height: 10px; }
.tx-split__bar i { display: block; height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.2,.9,.25,1); }
.tx-split__bar .a { background: var(--k3); }
.tx-split__bar .b { background: var(--signal); }
.tx-split__keys { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--mute); }
.tx-split__keys span { display: inline-flex; align-items: center; gap: 8px; }
.tx-split__keys b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.tx-split__keys i { width: 8px; height: 8px; border-radius: 2px; }
.tx-split__keys .a i { background: var(--k3); }
.tx-split__keys .b i { background: var(--signal); }

.tx-chart { margin-top: 22px; width: 100%; height: 200px; overflow: visible; }
.tx-chart__grid path { stroke: var(--line); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.tx-chart__area { fill: color-mix(in srgb, var(--signal) 24%, transparent); }
.tx-chart__line { fill: none; stroke: var(--signal); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.tx-chart__area2 { fill: color-mix(in srgb, var(--text) 7%, transparent); }
.tx-chart__line2 { fill: none; stroke: var(--k3); stroke-width: 1.4; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.tx-chart__target { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 5; opacity: 0; vector-effect: non-scaling-stroke; transition: opacity .4s; }
.tx-axis { margin-top: 6px; display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.tx-legend { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--mute); }
.tx-legend span { display: inline-flex; align-items: center; gap: 7px; }
.tx-legend i { width: 14px; height: 0; border-top: 2px solid var(--signal); }
.tx-legend .k-area2 i, .tx-legend .k-line i { border-top: 2px dashed var(--k3); }
.tx-legend .k-target i { border-top: 1.5px dotted var(--text); }
.tx-rows { margin-top: 18px; display: grid; }
.tx-rows div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.tx-rows dt { color: var(--mute); }
.tx-rows dd { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.tx-note { margin-top: 12px; font-size: 14px; line-height: 1.55; color: var(--mute); }
.tx-cta { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.tx-disc { margin-top: 14px; font-size: 14px; line-height: 1.55; color: var(--dim); }
.tx-reg { margin-top: 0; }

/* mobile result peek: the answer stays visible while you drag */
.tx-peek { display: none; }
@media (max-width: 699px) {
  .tx-peek { position: sticky; bottom: 14px; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: 0 18px 40px -16px rgba(0,0,0,.55); transition: opacity .35s, transform .5s cubic-bezier(.2,.9,.25,1); }
  .tx-peek span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .82; }
  .tx-peek b { font-size: 20px; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
  .tx-peek.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
}

/* ---------- sheet (mobile picker) ---------- */
.tx-sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 86vh; margin: 0; padding: 0 16px 24px; border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -20px 60px -20px rgba(0,0,0,.6); overflow: auto; }
.tx-sheet::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
.tx-sheet[open] { animation: sheet-in .5s cubic-bezier(.2,.9,.25,1); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
.tx-sheet__head { position: sticky; top: 0; z-index: 1; display: flex; gap: 10px; align-items: center; padding: 16px 0 12px; background: var(--surface); }
.tx-sheet__head .tx-search { flex: 1; }
.tx-sheet__close { height: 46px; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: inset 0 0 0 1px var(--line-2); }
.tx-sheet .tx-index { margin-top: 6px; }
.tx-sheet .tx-item span { white-space: normal; }

/* ---------- responsive: ≥1181 · 1025–1180 · 700–1024 · ≤699 ---------- */
@media (min-width: 700px) { .tx-result { position: sticky; top: 84px; } }
@media (max-width: 1180px) {
  .tx-shell { grid-template-columns: 248px minmax(0, 1fr); gap: 22px; }
  .tx-work { padding: 26px 24px; }
  .tx-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; }
  .tx-result { padding: 20px 18px; }
}
@media (max-width: 1024px) {
  .tx-shell { grid-template-columns: minmax(0, 1fr); }
  .tx-rail { display: none; }
  .tx-switch { display: flex; position: sticky; top: 72px; z-index: 5; }
  .tx-result { top: 140px; }
}
@media (max-width: 699px) {
  .tx-grid { grid-template-columns: minmax(0, 1fr); }
  .tx-result { position: static; }
  .tx-work { padding: 20px 16px; border-radius: 18px; }
  .tx-result { padding: 18px 16px; }
  .tx-cta .sq { flex: 1 1 auto; }
  .tx-intro { padding-bottom: 28px; }
}
@media (pointer: coarse) {
  .tx-range { height: 44px; margin-top: 4px; }
  .tx-range::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -12px; }
  .tx-range::-moz-range-thumb { width: 28px; height: 28px; }
  .tx-item { min-height: 48px; }
  .tx-switch { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .tx-work, .tx-work.is-leaving, .tx-work.is-entering { transition: none; transform: none; filter: none; opacity: 1; }
}
