/* Commercial pages (/compare, /tools, feature landings). Loaded after
   /blog/blog.css and reuses its tokens; only what the blog does not have. */

.page-wrap .art-head { margin-bottom: 6px; }
.page-wrap .art-hero { margin-bottom: 26px; }
.art-body .lede { font-size: 19px; color: var(--text); }

/* comparison table: 3 columns fit without scrolling on desktop */
.art-body table.cmp { min-width: 520px; }
.art-body table.cmp td:first-child { font-weight: 600; width: 34%; }
.art-body table.cmp th:not(:first-child) { width: 33%; }

/* two "pick this if" cards */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.art-body .pick-grid { margin-top: 1.4em; }
.pick { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; background: var(--bg-soft); }
.pick h3 { margin-top: 0 !important; font-size: 18.5px; }
.pick ul { margin-top: .7em; }


/* ---- calculator ----
   One card. Phones and tablets: inputs, then the result panel below.
   Wide screens (>= 1100px): the card grows past the text column to the nav
   width (1040px) and the result panel sits on the right and stays in view
   while you edit. Every field is >= 44px tall with 16px+ text (no iOS zoom). */
.calc {
  --calc-line: #dfe7ec;
  --calc-field: #f4f7f9;
  --calc-ring: 0 0 0 3px rgba(0, 136, 204, .18);
  margin: 1.8em 0 0; padding: 28px; border: 1px solid var(--border); border-radius: 24px;
  background: #fff; box-shadow: 0 1px 2px rgba(6, 40, 61, .04), var(--shadow);
  font-size: 16px; line-height: 1.4;
}
/* :where() keeps this reset at element specificity, so the class rules below win */
:where(.calc) input, :where(.calc) select, :where(.calc) button { font: inherit; color: inherit; }
.calc button { -webkit-tap-highlight-color: transparent; }

/* labels */
.calc-field { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; min-width: 0; }
.calc-top .calc-field { margin-top: 0; }
.calc-field > span, .calc-head {
  font-size: 12.5px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em;
}

/* bill total + currency */
.calc-top { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 12px; }
.calc-total, .calc-currency {
  width: 100%; height: 60px; border: 1px solid transparent; border-radius: 14px; background: var(--calc-field);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.calc-total {
  padding: 0 18px; font-size: 28px; font-weight: 800; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.calc-currency {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 0 40px 0 18px; font-size: 20px; font-weight: 700;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2346535e' stroke-width='2.5' 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;
}
.calc-total:hover, .calc-currency:hover { border-color: var(--calc-line); }
.calc-total:focus, .calc-currency:focus {
  outline: none; background-color: #fff; border-color: var(--tg-primary); box-shadow: var(--calc-ring);
}

/* tip: one segmented control, the custom value is the last segment */
.calc-tips {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--calc-field); border-radius: 14px;
}
.calc-chip { position: relative; display: flex; flex: 1 0 40px; min-width: 0; cursor: pointer; }
.calc-chip > input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.calc-chip > span {
  flex: 1; display: flex; align-items: center; justify-content: center; height: 44px; padding: 0 6px;
  border-radius: 10px; font-weight: 700; color: var(--text-soft); white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.calc-chip:hover > span { color: var(--text); }
.calc-chip > input[type="radio"]:checked + span,
.calc-chip-custom:has(> input[type="radio"]:checked) {
  background: #fff; color: var(--tg-primary); box-shadow: 0 1px 3px rgba(6, 40, 61, .12), 0 0 0 1px rgba(0, 136, 204, .22);
}
/* the custom segment is a text field: outlined until it is the chosen tip */
.calc-chip-custom { border-radius: 10px; box-shadow: inset 0 0 0 1px var(--calc-line); transition: background-color .15s ease, box-shadow .15s ease; }
.calc-chip-custom > input[type="radio"]:checked ~ .calc-pct { color: var(--tg-primary); }
.calc-chip > input[type="radio"]:focus-visible + span { outline: 2px solid rgba(0, 136, 204, .5); outline-offset: 1px; }
.calc-chip-custom { flex: 1.6 0 76px; }
.calc-chip-custom .calc-tip-custom {
  flex: 1; min-width: 0; height: 44px; padding: 0 2px 0 8px; border: none; border-radius: 10px 0 0 10px;
  background: transparent; text-align: right; font-weight: 700; color: var(--text);
}
.calc-chip-custom .calc-tip-custom::placeholder { color: #8a98a3; font-weight: 600; }
.calc-chip-custom .calc-tip-custom:focus { outline: none; background: #fff; }
.calc-chip-custom .calc-pct {
  flex: none; display: flex; align-items: center; height: 44px; padding: 0 10px 0 2px;
  border-radius: 0 10px 10px 0; font-weight: 700; color: var(--text-soft);
}
.calc-chip-custom .calc-tip-custom:focus ~ .calc-pct { background: #fff; }

/* people */
.calc-people { margin-top: 26px; }
.calc-head, .calc-person {
  display: grid; grid-template-columns: minmax(0, 1fr) 116px 112px 112px 32px;
  gap: 10px; align-items: center;
}
.calc-head { padding: 0 0 8px; }
/* One shared column grid for the header and all rows, so a long amount
   (Rp, ₽) widens its column for every row instead of running into the ×. */
@supports (grid-template-columns: subgrid) {
  .calc-people { display: grid; grid-template-columns: minmax(0, 1fr) 116px auto auto 32px; column-gap: 10px; }
  .calc-head, .calc-person { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .calc-amount { min-width: 84px; }
}
.calc-head span:nth-child(2), .calc-head span:nth-child(3) { text-align: center; }
.calc-head span:nth-child(4) { text-align: right; }
.calc-person { padding: 10px 0; border-top: 1px solid var(--border); }
.calc-person:last-child { border-bottom: 1px solid var(--border); }

.calc-who {
  display: flex; align-items: center; gap: 10px; min-width: 0; height: 48px; padding: 0 6px 0 7px;
  border: 1px solid transparent; border-radius: 14px; background: var(--calc-field);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.calc-who:hover { border-color: var(--calc-line); }
.calc-who:focus-within { background: #fff; border-color: var(--tg-primary); box-shadow: var(--calc-ring); }
.calc-avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .02em; line-height: 1;
  background: linear-gradient(180deg, #72D5FD 0%, #2A9EF1 100%);
}
/* Telegram's seven avatar gradients, same as the Mini App (utils/avatar.ts).
   Child 1 of .calc-people is the header row, people start at child 2. */
.calc-person:nth-child(7n+2) .calc-avatar { background: linear-gradient(180deg, #FF885E 0%, #FF516A 100%); }
.calc-person:nth-child(7n+3) .calc-avatar { background: linear-gradient(180deg, #82B1FF 0%, #665EFF 100%); }
.calc-person:nth-child(7n+4) .calc-avatar { background: linear-gradient(180deg, #A0DE7E 0%, #54CB68 100%); }
.calc-person:nth-child(7n+5) .calc-avatar { background: linear-gradient(180deg, #FFCD6B 0%, #FFA85C 100%); }
.calc-person:nth-child(7n+6) .calc-avatar { background: linear-gradient(180deg, #53EAD1 0%, #28B4C3 100%); }
.calc-person:nth-child(7n+7) .calc-avatar { background: linear-gradient(180deg, #E0A2F3 0%, #D669ED 100%); }
.calc-person:nth-child(7n+8) .calc-avatar { background: linear-gradient(180deg, #72D5FD 0%, #2A9EF1 100%); }
.calc-name {
  flex: 1; min-width: 0; height: 100%; border: none; background: transparent; padding: 0 4px 0 0;
  font-weight: 600; text-overflow: ellipsis;
}
.calc-name:focus { outline: none; }

.calc-stepper {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center;
  height: 48px; padding: 4px; border-radius: 14px; background: var(--calc-field);
}
.calc-stepper button {
  width: 40px; height: 40px; border: none; border-radius: 10px; background: #fff; cursor: pointer;
  color: var(--tg-primary); font-size: 20px; font-weight: 700; line-height: 1;
  box-shadow: 0 1px 2px rgba(6, 40, 61, .12); transition: background-color .15s ease, transform .1s ease;
}
.calc-stepper button:hover { background: #eaf5fb; }
.calc-stepper button:active { transform: scale(.94); }
.calc-stepper button:focus-visible { outline: 2px solid rgba(0, 136, 204, .5); outline-offset: 1px; }
.calc-stepper .calc-share {
  width: 100%; min-width: 0; height: 40px; border: none; background: transparent; padding: 0;
  text-align: center; font-weight: 800; font-variant-numeric: tabular-nums;
}
.calc-stepper .calc-share:focus { outline: none; background: #fff; border-radius: 8px; box-shadow: var(--calc-ring); }

/* "paid" is a radio styled as a pill; the chosen payer turns blue */
.calc-paid {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 12px;
  border: 1px solid var(--calc-line); border-radius: 999px; cursor: pointer; white-space: nowrap;
  font-size: 14.5px; font-weight: 600; color: var(--text-soft); background: #fff;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.calc-paid:hover { border-color: #b9cad6; }
.calc-paid input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid #b4c3ce; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.calc-paid input:checked { border-color: var(--tg-primary); box-shadow: inset 0 0 0 3px #fff; background: var(--tg-primary); }
.calc-paid input:focus-visible { outline: 2px solid rgba(0, 136, 204, .5); outline-offset: 2px; }
.calc-paid:has(input:checked) { background: rgba(0, 136, 204, .08); border-color: rgba(0, 136, 204, .45); color: var(--tg-primary-dark); }

.calc-amount { font-size: 17px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-person.is-out .calc-amount { font-size: 14.5px; font-weight: 600; color: var(--text-soft); }
.calc-person.is-out .calc-who { opacity: .6; }
.calc-person.is-out .calc-who:focus-within { opacity: 1; }
.calc-remove {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent;
  cursor: pointer; color: #8a98a3; font-size: 22px; line-height: 1;
  transition: background-color .15s ease, color .15s ease;
}
.calc-remove:hover { color: #c2413b; background: rgba(194, 65, 59, .08); }
.calc-remove:focus-visible { outline: 2px solid rgba(0, 136, 204, .5); outline-offset: 1px; }

.calc-add {
  width: 100%; margin-top: 14px; height: 48px; padding: 0 18px; border-radius: 14px;
  border: 1.5px dashed #b9cad6; background: transparent; color: var(--tg-primary); font-weight: 700; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.calc-add:hover { background: rgba(0, 136, 204, .05); border-color: var(--tg-primary); }

/* result: the same blue gradient as the landing CTA */
.calc-result {
  position: relative; overflow: hidden; margin-top: 26px; padding: 24px; border-radius: 20px; container-type: inline-size;
  color: #fff; background: var(--grad); box-shadow: 0 16px 36px rgba(0, 105, 160, .28);
}
.calc-result::before {
  content: ''; position: absolute; top: -140px; right: -120px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16) 0%, transparent 70%); pointer-events: none;
}
.calc-result > * { position: relative; }
.calc-error {
  margin-bottom: 14px; padding: 10px 14px; border-radius: 12px;
  background: #fff; color: #c2413b; font-weight: 700; font-size: 15px;
}
.calc-grand { display: flex; flex-direction: column; gap: 4px; }
.calc-grand span { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
/* --len (characters in the total) is set by the page script: long totals
   (Rp, ₽ with millions) shrink to fit the panel instead of breaking. */
.calc-grand strong {
  font-size: 40px; font-size: clamp(24px, calc(100cqi / (var(--len, 8) * .6)), 40px); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.calc-tipline { margin-top: 6px; font-size: 15px; color: rgba(255, 255, 255, .88); }
.calc-tipline:empty { display: none; }
.art-body .calc-tr-title {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .25);
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #fff; opacity: .85;
}
.art-body .calc-transfers { list-style: none; padding-left: 0; margin-top: 10px; }
.calc-transfers li {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; padding: 11px 14px;
  border-radius: 12px; background: rgba(255, 255, 255, .15);
}
.art-body .calc-transfers li + li { margin-top: 8px; }
.calc-transfers b { font-weight: 700; }
.calc-arrow { opacity: .8; font-weight: 700; }
.calc-tr-amount { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-transfers li.calc-none { display: block; padding: 0; background: none; color: rgba(255, 255, 255, .9); }
.calc-copy {
  width: 100%; margin-top: 18px; height: 52px; padding: 0 20px; border-radius: 14px; border: none; cursor: pointer;
  background: #fff; color: var(--tg-primary); font-weight: 700; box-shadow: 0 6px 18px rgba(0, 40, 70, .18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.calc-copy:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 40, 70, .24); }
.calc-copy:focus-visible { outline: 3px solid rgba(255, 255, 255, .7); outline-offset: 2px; }

/* Before the script runs the form is a static example: hide controls that do nothing yet. */
.calc:not(.is-live) .calc-add, .calc:not(.is-live) .calc-copy, .calc:not(.is-live) .calc-remove { visibility: hidden; }
.calc-noscript { margin-top: 10px; color: var(--text-soft); font-size: 14.5px; }

/* wide screens: break out of the 720px text column to the nav width, result on the right */
@media (min-width: 1100px) {
  .calc {
    --calc-w: min(1040px, calc(100vw - 48px));
    width: var(--calc-w); margin-left: calc((100% - var(--calc-w)) / 2);
    display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto auto auto 1fr;
    column-gap: 28px; padding: 32px;
  }
  .calc > .calc-top, .calc > .calc-field, .calc > .calc-people, .calc > .calc-add { grid-column: 1; }
  .calc > .calc-add { align-self: start; }
  .calc > .calc-result { grid-column: 2; grid-row: 1 / span 4; align-self: start; margin-top: 0; position: sticky; top: 88px; }
}

/* phones */
@media (max-width: 640px) {
  .calc { margin-top: 1.4em; padding: 18px 16px; border-radius: 20px; }
  .calc-top { grid-template-columns: minmax(0, 1fr) 104px; gap: 10px; }
  .calc-total { height: 56px; padding: 0 14px; font-size: 26px; }
  .calc-currency { height: 56px; padding: 0 30px 0 14px; background-position: right 12px center; }
  .calc-field { margin-top: 18px; }
  .calc-chip-custom { flex-basis: 70px; }
  .calc-people { margin-top: 20px; }
  .calc-head { display: none; }
  .calc-people { display: block; }
  /* two lines per person: who + their part, then shares / paid / remove */
  .calc-person { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; padding: 12px 0; }
  .calc-head + .calc-person { border-top: none; padding-top: 0; }
  .calc-person::after { content: ''; order: 3; flex-basis: 100%; height: 0; }
  .calc-person .calc-who { order: 1; flex: 1 1 0; height: 46px; }
  .calc-person .calc-amount { order: 2; flex: none; padding-left: 4px; }
  .calc-person .calc-stepper { order: 4; width: 128px; height: 46px; margin-top: 8px; grid-template-columns: 38px minmax(0, 1fr) 38px; }
  .calc-person .calc-stepper button { width: 38px; height: 38px; }
  .calc-person .calc-paid { order: 5; margin-top: 8px; height: 46px; padding: 0 14px; }
  .calc-person .calc-remove { order: 6; margin: 8px -4px 0 auto; width: 44px; height: 44px; }
  .calc-person:last-child { border-bottom: none; }
  .calc-add { margin-top: 6px; }
  .calc-result { margin-top: 20px; padding: 20px 18px; border-radius: 18px; }
  .calc-grand strong { font-size: 34px; font-size: clamp(22px, calc(100cqi / (var(--len, 8) * .6)), 34px); }
}

/* narrow phones: the presets keep one row, the custom tip gets its own full-width row
   (5 presets + "other" cannot all fit legibly at 390px) */
@media (max-width: 440px) {
  .calc-chip-custom { flex-basis: 100%; background: #fff; }
  .calc-chip-custom .calc-tip-custom { padding-left: 14px; }
}

/* small phones (360px): keep the second line of a person on one line */
@media (max-width: 380px) {
  .calc { padding: 16px 14px; }
  .calc-person .calc-stepper { width: 116px; grid-template-columns: 34px minmax(0, 1fr) 34px; }
  .calc-person .calc-stepper button { width: 34px; }
  .calc-person .calc-paid { padding: 0 10px; }
}
