/* Article "Investing in Russia after tax" (/articles/russia-investment-taxes/), on top of style.css and
   articles.css. Classes start with .tx-. Rates of the salary scale are coloured from calm to hot:
   13% green (--home), 15% amber (--s4), 18% orange (--brand), 20% and 22% red (--bad, darker). */

/* lists inside the sections and the line of articles of the Code under each section */
.tx .art-sec ul { margin: 0 0 16px; padding-left: 22px; }
.tx .art-sec li { margin: 0 0 9px; text-wrap: pretty; }
.tx .art-sec h3 { margin-top: 26px; }
.art > .tx-more { margin-top: 18px; }
.art > .tx-norms { max-width: var(--col); margin-top: 6px; }
.tx-norms a { white-space: nowrap; }

/* the summary table: the first column is the row's name */
.tx-table th[scope="row"] { min-width: 130px; max-width: 190px; white-space: normal; vertical-align: top; }
.tx-table td { min-width: 190px; vertical-align: top; white-space: normal; text-align: left; }
.tx-table thead th { text-align: left; }
.art > .tx-narrow { max-width: var(--col); margin-top: 8px; }
.tx-back td, .tx-back th { text-align: left; white-space: normal; }

/* the rates */
.tx-r13 { background: var(--home); } .tx-r15 { background: var(--s4); } .tx-r18 { background: var(--brand); }
.tx-r20 { background: var(--bad); } .tx-r22 { background: var(--bad); filter: brightness(0.72) saturate(1.2); }

/* both calculators: a card with fields on top */
.art > .tx-form { margin-top: 18px; padding: 24px 26px 22px; display: grid; gap: 16px; }
.tx-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
.tx-field { display: grid; gap: 6px; align-content: end; font: 500 14.5px/1.3 var(--font); color: var(--muted); }
.tx-field.tx-wide { grid-column: 1 / -1; }
.tx-in { display: flex; align-items: center; gap: 8px; background: var(--track); border-radius: 12px; padding: 9px 12px; }
.tx-in:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.tx-in input { font: 600 17.5px/1.2 var(--mono); color: var(--ink); background: transparent; border: 0; padding: 0; margin: 0; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.tx-in input:focus { outline: none; }
.tx-in input[aria-invalid="true"] { color: var(--bad); }
.tx-in i { font: 500 15px/1 var(--font); color: var(--muted); font-style: normal; white-space: nowrap; }
.tx-field .seg { justify-self: start; }
.tx-legend { margin: 0; }
.tx-answer { margin: 0; max-width: 78ch; color: var(--ink-2); font-size: 17.5px; line-height: 1.6; }
.tx-answer b { color: var(--ink); font-weight: 650; }
.tx-note { margin: 0; max-width: 90ch; }
.tx-bad { opacity: 0.45; }

/* the ladder: two columns of rows, one for each set of rules */
.tx-ladder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tx-lside { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.tx-lhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tx-lhead b { font: 650 clamp(20px, 2.4vw, 25px)/1.15 var(--mono); color: var(--ink); white-space: nowrap; }
.tx-lside > div:last-child { display: grid; gap: 10px; }
.tx-lrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: end; }
.tx-lname { grid-area: 1 / 1; font: 500 14.5px/1.25 var(--font); color: var(--ink-2); }
.tx-lname small { color: var(--muted); font-size: 13px; margin-left: 7px; white-space: nowrap; }
.tx-ltax { grid-area: 1 / 2; font: 600 14.5px/1.25 var(--mono); color: var(--ink); white-space: nowrap; }
.tx-lbar { grid-area: 2 / 1 / 3 / -1; display: flex; height: 22px; min-width: 0; }
.tx-lbar i { display: block; height: 100%; min-width: 2px; position: relative; overflow: hidden; }
.tx-lbar i:first-child { border-radius: 5px 0 0 5px; } .tx-lbar i:last-child { border-radius: 0 5px 5px 0; }
.tx-lbar i:only-child { border-radius: 5px; }
.tx-lbar b { position: absolute; inset: 0; display: grid; place-items: center; font: 650 11.5px/1 var(--mono); color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, 0.45); }
.tx-lbar .tx-r13 b, .tx-lbar .tx-r15 b { color: #1d1d1f; text-shadow: none; }   /* green and amber: dark figures read better */

/* what is left after tax: one row per way */
.tx-calc { display: grid; gap: 12px; }
.tx-crow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: end; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 2px solid transparent; }
.tx-crow.tx-best { border-color: var(--home); }
.tx-crow.tx-off { opacity: 0.6; }
.tx-crow.tx-off .tx-cnote { grid-area: 2 / 1 / 3 / -1; }
.tx-cname { grid-area: 1 / 1; font: 600 15.5px/1.25 var(--font); color: var(--ink); }
.tx-cend { grid-area: 1 / 2; font: 650 17.5px/1.2 var(--mono); color: var(--ink); white-space: nowrap; }
.tx-cbar { grid-area: 2 / 1 / 3 / -1; display: flex; height: 20px; min-width: 0; border-radius: 5px; overflow: hidden; }
.tx-cbar i { display: block; height: 100%; }
.tx-b-put { background: var(--track-2, var(--border)); }
.tx-b-gain { background: var(--home); }
.tx-b-back { background: var(--s1); }
.tx-b-tax { background: repeating-linear-gradient(135deg, var(--bad) 0 4px, transparent 4px 7px); opacity: 0.75; }
.tx-cbar .tx-b-put { background: var(--muted); opacity: 0.35; }
.sw-sq.tx-b-put { background: var(--muted); opacity: 0.35; }
.tx-cnote { grid-area: 3 / 1 / 4 / -1; font: 500 14px/1.35 var(--font); color: var(--muted); }

/* untaxed deposit interest by year */
.tx-free { display: grid; gap: 10px; padding: 6px 40px 6px 2px; }
.tx-frow { display: grid; grid-template-columns: 52px minmax(60px, 1fr) 230px; gap: 12px; align-items: center; }
.tx-fyear { font: 600 15px/1 var(--mono); color: var(--ink-2); }
.tx-fbar { display: block; height: 22px; background: var(--track); border-radius: 6px; overflow: hidden; }
.tx-fbar i { display: block; height: 100%; background: var(--home); border-radius: 6px; }
.tx-fval { font: 500 14.5px/1.25 var(--font); color: var(--muted); }
.tx-fval b { font: 650 15.5px/1.2 var(--mono); color: var(--ink); white-space: nowrap; }
.tx-fval small { font-size: 12.5px; opacity: 0.85; }

/* the minimum term of an account by year of opening */
.tx-terms { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; align-items: end; padding: 6px 40px 0 2px; }
.tx-tcol { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; text-align: center; }
.tx-tcol b { font: 650 17.5px/1 var(--mono); color: var(--ink); }
.tx-tcol i { display: block; width: 100%; max-width: 86px; background: var(--s1); opacity: 0.45; border-radius: 6px 6px 2px 2px; }
.tx-tcol span { font: 500 13.5px/1.2 var(--font); color: var(--muted); }
.tx-tcol.tx-now i { opacity: 1; }
.tx-tcol.tx-now span { color: var(--ink); font-weight: 650; }

/* the calendar of a tax year */
.tx .tx-cal { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 0; border-left: 2px solid var(--border); }
.tx .tx-cal li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 9px 0 9px 16px; margin: 0; position: relative; }
.tx .tx-cal li::before { content: ""; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tx-cal b { font: 650 15.5px/1.4 var(--font); color: var(--ink); }
.tx-cal span { color: var(--ink-2); }

/* the ways to pay less */
.tx-ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 6px 0 22px; }
.tx-way { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; }
.tx .tx-way h3 { margin: 0 0 6px; font-size: 18.5px; }
.tx .tx-way p { margin: 0 0 8px; font-size: 16.5px; line-height: 1.55; }
.tx .tx-way p.tx-but { margin: 0; color: var(--muted); font-size: 15.5px; }

@media (max-width: 640px) {
  .art > .tx-form { padding: 18px; }
  .tx-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tx-field.tx-seg { grid-column: 1 / -1; }
  .tx-ladder { grid-template-columns: minmax(0, 1fr); }
  .tx-free { padding-right: 2px; padding-top: 30px; }
  .tx-frow { grid-template-columns: 44px minmax(40px, 1fr); }
  .tx-fval { grid-column: 2; }
  .tx-terms { gap: 5px; padding-right: 2px; padding-top: 30px; }
  .tx-tcol span { font-size: 11.5px; }
  .tx .tx-cal li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .tx-ways { grid-template-columns: minmax(0, 1fr); }
  /* the summary table as cards: one block a row, the column's heading above each cell */
  .tx-table thead { display: none; }
  .tx-table, .tx-table tbody, .tx-table tr, .tx-table th[scope="row"], .tx-table td { display: block; min-width: 0; max-width: none; }
  .tx-table tr { padding: 14px 16px; }
  .tx-table tr + tr { border-top: 1px solid var(--border); }
  .tx-table th[scope="row"] { padding: 0 0 6px; font-size: 17.5px; border: 0; }
  .tx-table td { padding: 4px 0; border: 0; }
  .tx-table td::before { content: attr(data-l); display: block; font: 500 12.5px/1.3 var(--font); color: var(--muted); }
}
