/* ATC calculators. Loaded after atc.css and pages.css on /tools/ and the transfer-fee guide.
   Layout: tab pills, then a two-column card (white inputs, black results). Stacks below 900px and always inside .prose. */

.calcs [hidden] { display: none !important; }
.calcs { margin-block: 0; max-width: 100%; min-width: 0; }
.calcs > * + * { margin-top: 32px; }
.calcs, .calcs * { box-sizing: border-box; }

/* Tab bar */
.calcs__tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; max-width: 100%; }
.calcs__tab { display: inline-flex; align-items: center; gap: 8px; flex: none; height: 44px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid #e3e4e7; background: #fff; color: #3F4B5B; font: inherit; font-weight: 600; font-size: .90625rem; line-height: 1; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.calcs__tab svg { width: 16px; height: 16px; flex: none; color: var(--red-500); transition: color .2s; }
.calcs__tab:hover { border-color: var(--dark-900); color: var(--dark-900); }
.calcs__tab[aria-selected="true"] { background: var(--dark-900); border-color: var(--dark-900); color: #fff; }
.calcs__tab[aria-selected="true"] svg { color: #fff; }
.calcs__tab:focus-visible { outline: 2px solid var(--red-500); outline-offset: 2px; }

/* Card */
.calc { min-width: 0; max-width: 100%; }
.calc__card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); border-radius: 20px; background: #fff; border: 1px solid #e6e6e8; box-shadow: 0 20px 50px -24px rgba(0,0,0,.25); overflow: hidden; max-width: 100%; }
.calc__card > * { min-width: 0; }

/* Input side */
.calc__in { padding: 36px; display: flex; flex-direction: column; }
.calcs h2.calc__title, .calc h2.calc__title { margin: 0; font-size: 1.375rem; font-weight: 700; line-height: 1.25; letter-spacing: -.2px; color: var(--ink-900); }
.calc__lead { margin: 6px 0 28px; font-size: .90625rem; line-height: 1.5; color: #6C6E76; }
.calc__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 16px; margin: 0 0 28px; }
.calc__grid > * { min-width: 0; }
.calc__grid .span-2 { grid-column: 1 / -1; }
.cf { margin: 0; padding: 0; border: 0; min-width: 0; }
.cf__lab, .cf legend { display: block; float: none; width: 100%; margin: 0 0 8px; padding: 0; font-size: .71875rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #6C6E76; line-height: 1.3; }
.cf legend { float: left; } /* legend in a fieldset: float so margin-bottom is honoured, the next block clears it */
.cf legend + * { clear: both; }

/* Segmented pills (radio) */
.cf__pills { display: flex; gap: 6px; }
.cf__pills label { position: relative; flex: 1 1 0; min-width: 0; cursor: pointer; display: block; }
.cf__pills input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cf__pills span { display: flex; align-items: center; justify-content: center; width: 100%; height: 46px; padding: 0 8px; border-radius: var(--r-pill); border: 1px solid #e3e4e7; background: #fff; font-size: .90625rem; font-weight: 600; line-height: 1.1; text-align: center; color: #3F4B5B; transition: background .2s, color .2s, border-color .2s; }
.cf__pills label:hover span { border-color: var(--dark-900); color: var(--dark-900); }
.cf__pills input:checked + span { background: var(--dark-900); border-color: var(--dark-900); color: #fff; }
.cf__pills input:focus-visible + span { outline: 2px solid var(--red-500); outline-offset: 2px; }

/* Selects and number inputs */
.calc .cf input[type="number"], .calc .cf select, .calc .cf .xsel__btn {
  display: block; width: 100%; max-width: 100%; height: 46px; margin: 0; padding: 0 16px; border: 1px solid #e3e4e7; border-radius: 12px; background-color: #fafafa;
  font: inherit; font-size: .9375rem; font-weight: 600; color: var(--ink-900); transition: border-color .2s, box-shadow .2s, background-color .2s; }
.calc .cf select { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A1A1A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 16px; }
.calc .cf .xsel__btn { display: flex; align-items: center; padding-right: 44px; text-align: left; }
.calc .cf input:hover, .calc .cf select:hover, .calc .cf .xsel__btn:hover { border-color: #C9CBD0; }
.calc .cf input:focus, .calc .cf select:focus, .calc .cf .xsel__btn:focus-visible, .calc .cf .xsel.is-open .xsel__btn { outline: none; background-color: #fff; border-color: var(--ink-900); box-shadow: 0 0 0 4px rgba(26,26,26,.07); }

/* Contextual note, pinned to the bottom of the input column */
.calc__note { display: flex; align-items: flex-start; gap: 10px; margin: auto 0 0; padding: 14px 16px; border-radius: 12px; background: #f5f5f6; font-size: .84375rem; line-height: 1.5; color: #3F4B5B; }
.calc__note i { flex: 0 0 18px; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--red-500); color: #fff; font-style: normal; font-size: .6875rem; font-weight: 800; line-height: 1; }
.calc__note span { min-width: 0; overflow-wrap: anywhere; }

/* Results (black) */
.calc__out { display: flex; flex-direction: column; padding: 36px; background: var(--dark-950); color: var(--on-dark-body); }
.calc__kicker { margin: 0; font-size: .71875rem; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; color: var(--on-dark-muted); }
.calc__big { margin: 10px 0 8px; font-size: 3rem; font-weight: 800; line-height: 1.05; letter-spacing: -1.5px; color: #fff; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.calc__sub { margin: 0; min-height: 1.5em; font-size: .875rem; color: var(--on-dark-muted); overflow-wrap: anywhere; }
.calc__rows { margin: 26px 0 0; padding: 0; border-top: 1px solid #2b2b2e; }
.calc__rows:empty { border-top: 0; margin: 0; }
.calc__row { display: flex; align-items: center; gap: 16px; margin: 0; padding: 14px 0; border-bottom: 1px solid #2b2b2e; }
.calc__row dt { flex: 1 1 auto; min-width: 0; margin: 0; font-size: .90625rem; line-height: 1.35; color: #d5d7db; overflow-wrap: anywhere; }
.calc__row dt small { display: block; margin-top: 2px; font-size: .78125rem; font-weight: 400; color: #85878e; }
.calc__row dd { flex: 0 1 auto; max-width: 58%; margin: 0; text-align: right; font-size: .9375rem; font-weight: 700; line-height: 1.3; color: #fff; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc__row dd.is-mut { color: var(--on-dark-muted); font-weight: 500; }
.calc__row.is-total { border-bottom: 0; padding-top: 18px; }
.calc__row.is-total dt { color: #fff; font-weight: 700; font-size: .96875rem; }
.calc__row.is-total dd { font-size: 1.125rem; }
.calc__ns { margin: 18px 0 0; font-size: .8125rem; }
.calc__small { margin: auto 0 14px; padding-top: 22px; font-size: .78125rem; line-height: 1.5; color: #85878e; }
.calc__out .btn--wa { width: 100%; min-height: 52px; height: auto; white-space: normal; text-align: center; justify-content: center; }

/* Phone, and always inside an article column */
@media (max-width: 899px) {
  .calc__card { grid-template-columns: minmax(0, 1fr); }
  .calc__in, .calc__out { padding: 22px; }
  .calc__grid { grid-template-columns: minmax(0, 1fr); }
  .calc__grid .span-2 { grid-column: auto; }
  .calc__big { font-size: 2.375rem; }
  .calcs__tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .calcs__tabs::-webkit-scrollbar { display: none; }
  .calc__lead { margin-bottom: 20px; }
}
.prose .calc__card { grid-template-columns: minmax(0, 1fr); }
.prose .calc__in, .prose .calc__out { padding: 22px; }
.prose .calc__big { font-size: 2.375rem; }
.prose .calcs { margin: 24px 0 40px; }
/* Undo article typography (heading bar, paragraph margins, link underline) inside the calculator */
.prose .calcs h2.calc__title { margin: 0; padding: 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -.2px; line-height: 1.25; }
.prose .calcs h2.calc__title::before { content: none; }
.prose .calcs .calc__lead { margin: 6px 0 20px; }
.prose .calcs .calc__kicker { margin: 0; }
.prose .calcs .calc__big { margin: 10px 0 8px; }
.prose .calcs .calc__sub { margin: 0; }
.prose .calcs .calc__small { margin: auto 0 14px; }
.prose .calcs .calc__ns { margin: 18px 0 0; }
.prose .calcs a.btn { text-decoration: none; }
.prose .calcs a.btn--wa, .prose .calcs a.btn--wa:hover { color: #06331b; }
@media (max-width: 400px) {
  .calc__row { gap: 12px; }
  .calc__row dd { max-width: 55%; }
}
@media (prefers-reduced-motion: reduce) {
  .calcs__tab, .cf__pills span { transition: none; }
}
.calcs__tabs + .calc { margin-top: 0; }

@media (max-width: 899px) {
  .cf__lab, .cf legend, .calc__kicker, .calc__note i { font-size: .75rem; }
}
