/* Page-specific styles for multi-credit-card-payoff-calculator-app.html.
   Shared layout, colours and components live in brand-shared.css (the
   whole site) and calculator-shared.css (every calculator) — this file
   only holds what's unique to this calculator. The page uses the shared
   single-column layout (.layout-single). */

  /* ---------- multi-credit-card-payoff-calculator (scoped) ---------- */

  /* Each card's provider rule, under its boxes, in the hint's own size. */
  .calc-shell .mc-rule:empty { display: none; }

  /* The chart's two lines: the reader's budget, highest rate first (the
     accent), and only the minimums (dashed, in the warning colour). */
  .calc-shell .chart-legend .dot.mc-plan { background: var(--accent); }
  .calc-shell .chart-legend .dot.mc-min { background: var(--danger); height: 3px; vertical-align: 3px; }

  /* "Card by card": each card's rate and balance on a line under its name.
     The figures are allowed to wrap, so the four columns fit a phone. */
  .calc-shell #cardBody .mc-rate { display: block; margin-top: 2px; font-size: var(--text-fine); font-weight: 400; color: var(--ink-soft); }

  /* ---------- the form's own look (a trial on this page only) ----------
     Bolder than the other calculators: the budget in a navy panel, each
     card in its own block with a colour, and a large "Add another card"
     tile. Nothing here is shared, so no other page changes. */

  /* One colour per card, for its stripe, number and the pips. */
  .calc-shell { --mc1: #143E6F; --mc2: #895430; --mc3: #1f7a74; --mc4: #7a3b6e; --mc5: #5b7a1f; }
  @media (prefers-color-scheme: dark) {
    .calc-shell { --mc1: #6ea3d8; --mc2: #c98a54; --mc3: #4fc1b6; --mc4: #c98ab8; --mc5: #a5c75a; }
  }
  .calc-shell #card1, .calc-shell #pips i:nth-child(1) { --mc: var(--mc1); }
  .calc-shell #card2, .calc-shell #pips i:nth-child(2) { --mc: var(--mc2); }
  .calc-shell #card3, .calc-shell #pips i:nth-child(3) { --mc: var(--mc3); }
  .calc-shell #card4, .calc-shell #pips i:nth-child(4) { --mc: var(--mc4); }
  .calc-shell #card5, .calc-shell #pips i:nth-child(5) { --mc: var(--mc5); }

  /* The budget: a navy panel, the same in light and dark. Its legend is
     kept for screen readers and drawn as a small heading inside. */
  .calc-shell fieldset.mc-budget {
    position: relative; margin-bottom: 22px; padding: 18px 20px 20px;
    border: 0; border-radius: 12px; color: #fff;
    background: linear-gradient(135deg, #143E6F 0%, #0D2B4E 100%);
    box-shadow: 0 6px 18px rgba(13, 43, 78, .22);
  }
  .calc-shell fieldset.mc-budget > legend {
    float: left; width: 100%; padding: 0; margin: 0 0 10px;
    color: rgba(255, 255, 255, .75);
  }
  .calc-shell fieldset.mc-budget > legend::after { background: rgba(255, 255, 255, .22); }
  .calc-shell fieldset.mc-budget > legend + * { clear: both; }
  .calc-shell .mc-budget .lbl { color: #fff; }
  .calc-shell .mc-budget-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
  .calc-shell .mc-budget-row .field { flex: 0 1 270px; min-width: 200px; margin: 0; }
  .calc-shell .mc-budget .input-money input { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; }
  .calc-shell .mc-budget .hint { flex: 1 1 220px; margin: 0; color: rgba(255, 255, 255, .82); font-size: .85rem; line-height: 1.5; }
  /* The link to the Minimum Payment calculator sits on the dark panel, so it goes white (the shared hover colour is navy). */
  .calc-shell .mc-budget .hint .xlink:hover .xtxt, .calc-shell .mc-budget .hint .xlink:focus-visible .xtxt { color: #fff; }
  .calc-shell .mc-budget .hint .xlink .xfrag { background: #d9a679; }

  /* A card: its own block, with a stripe in its colour. The legend stays
     for screen readers; the title line shows the number, what's in it and
     the × to remove it. */
  .calc-shell fieldset.mc-card {
    position: relative; margin-bottom: 16px; padding: 0 20px 16px 18px;
    border: 1px solid var(--line); border-left: 6px solid var(--mc); border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(20, 62, 111, .06), 0 6px 16px rgba(20, 62, 111, .06);
  }
  .calc-shell fieldset.mc-card > legend {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .calc-shell fieldset.mc-card > legend::after { display: none; }
  .calc-shell .mc-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
  .calc-shell .mc-badge {
    flex: none; box-sizing: border-box; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    /* The figure sits a little high in its line, so the top padding brings it down to the middle. */
    padding-top: 1.5px;
    background: var(--mc); color: #fff; font-family: var(--font-display); font-size: .95rem; font-weight: 700;
  }
  .calc-shell .mc-name { flex: none; color: var(--ink); font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; }
  .calc-shell .mc-sum { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: .85rem; white-space: nowrap; text-overflow: ellipsis; }
  .calc-shell .mc-pill {
    flex: none; padding: 3px 9px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px;
    background: var(--warn-soft); color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  }
  .calc-shell .mc-pill[hidden] { display: none; }
  .calc-shell .mc-x {
    flex: none; box-sizing: border-box; display: grid; place-items: center; width: 32px; height: 32px; min-width: 0; min-height: 0;
    position: relative; margin-left: auto; padding: 0; border: 1px solid var(--line); border-radius: 50%;
    background: var(--surface); color: var(--ink-soft); font: inherit; font-size: 0; line-height: 1; cursor: pointer;
    transition: background-color var(--hover-fade, .15s), border-color var(--hover-fade, .15s), color var(--hover-fade, .15s), transform .2s;
  }
  /* The cross is drawn, not typed, so it sits exactly in the middle whatever the font. */
  .calc-shell .mc-x::before, .calc-shell .mc-x::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; border-radius: 1px; background: currentColor;
  }
  .calc-shell .mc-x::before { transform: rotate(45deg); }
  .calc-shell .mc-x::after { transform: rotate(-45deg); }
  .calc-shell .mc-x:hover, .calc-shell .mc-x:focus-visible { border-color: var(--danger); background: var(--danger); color: #fff; transform: rotate(90deg); }
  .calc-shell .mc-x[hidden] { display: none; }
  @media (prefers-color-scheme: dark) {
    .calc-shell .mc-badge { color: #0d1520; }
    .calc-shell .mc-x:hover, .calc-shell .mc-x:focus-visible { color: #0d1520; }
  }
  /* A phone hides the summary: the boxes say the same just below. */
  @media (max-width: 560px) {
    .calc-shell fieldset.mc-card { padding-right: 14px; padding-left: 14px; }
    .calc-shell .mc-sum { display: none; }
  }
  /* The provider and balance stack on a phone (stack-sm); on the narrowest
     phones the card's own-rule and percentage boxes do too, so no figure
     is cut off inside the card's padding. */
  @media (max-width: 400px) {
    .calc-shell fieldset.mc-card .field-row { grid-template-columns: 1fr; }
    .calc-shell .mc-head { gap: 8px; }
    .calc-shell .mc-badge { width: 26px; height: 26px; font-size: .85rem; padding-top: 2.5px; }
    .calc-shell .mc-name { font-size: .98rem; }
    .calc-shell .mc-pill { padding: 2px 7px; font-size: .62rem; letter-spacing: .03em; }
  }

  /* A card that's just been added slides in. */
  .calc-shell fieldset.mc-card.mc-new { animation: mc-in .38s cubic-bezier(.2, .8, .2, 1); }
  @keyframes mc-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

  /* "Add another card", and a pip for each card in use. */
  .calc-shell .mc-add { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 4px 0 20px; }
  .calc-shell .mc-addtile {
    flex: 1 1 260px; display: flex; align-items: center; gap: 14px; padding: 14px 18px;
    border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: 12px;
    background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
    transition: background-color .18s, border-color .18s, box-shadow .18s, transform .18s;
  }
  .calc-shell .mc-addtile:hover, .calc-shell .mc-addtile:focus-visible {
    border-style: solid; border-color: var(--brand); background: var(--surface-alt);
    box-shadow: 0 6px 14px rgba(20, 62, 111, .12); transform: translateY(-1px);
  }
  .calc-shell .mc-plus {
    position: relative; flex: none; display: block; width: 38px; height: 38px; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: 0; line-height: 1; transition: transform .25s;
  }
  /* The plus is drawn as one shape the size of the circle, with the cross cut out
     of the middle, so it stays exactly centred however the screen is scaled. */
  .calc-shell .mc-plus::before {
    content: ""; position: absolute; inset: 0; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect y='6.75' width='16' height='2.5'/%3E%3Crect x='6.75' width='2.5' height='16'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect y='6.75' width='16' height='2.5'/%3E%3Crect x='6.75' width='2.5' height='16'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
  }
  .calc-shell .mc-addtile:hover .mc-plus { transform: rotate(90deg); }
  .calc-shell .mc-addtext { display: grid; gap: 1px; }
  .calc-shell .mc-addtext strong { color: var(--brand); font-family: var(--font-display); font-size: 1.02rem; }
  .calc-shell .mc-addtext small { color: var(--ink-soft); font-size: .8rem; }
  /* One small card for each card in use, shown from the back: a dark stripe and a signature strip. */
  .calc-shell .mc-pips { display: flex; gap: 7px; }
  .calc-shell .mc-pips i {
    position: relative; width: 44px; height: 28px; box-sizing: border-box; border: 2px dashed var(--line); border-radius: 5px;
    transition: background-color .2s, border-color .2s;
  }
  .calc-shell .mc-pips i::before {
    content: ""; position: absolute; left: -2px; right: -2px; top: 3px; height: 5px; background: var(--line); opacity: .6; transition: background-color .2s, opacity .2s;
  }
  .calc-shell .mc-pips i.on { border: 0; background: var(--mc); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
  .calc-shell .mc-pips i.on::before { left: 0; right: 0; top: 5px; height: 6px; background: rgba(0, 0, 0, .75); opacity: 1; }
  .calc-shell .mc-pips i.on::after { content: ""; position: absolute; left: 5px; right: 12px; bottom: 5px; height: 5px; border-radius: 1px; background: rgba(255, 255, 255, .85); }
  .calc-shell .mc-add.full .mc-addtile { border-style: solid; border-color: var(--line); background: var(--surface-alt); box-shadow: none; transform: none; cursor: default; }
  .calc-shell .mc-add.full .mc-plus { background: var(--ink-soft); transform: none; }
  .calc-shell .mc-add.full .mc-addtext strong { color: var(--ink-soft); }
  @media (prefers-color-scheme: dark) { .calc-shell .mc-plus { color: #0d1520; } }

  @media (prefers-reduced-motion: reduce) {
    .calc-shell fieldset.mc-card.mc-new { animation: none; }
    .calc-shell .mc-x, .calc-shell .mc-addtile, .calc-shell .mc-plus { transition: none; transform: none !important; }
  }
