/* ═══════════════════════════════════════════════════════════════════════════
   Monavo — calculator kit (.cc-*)

   Shared by every calculator page (budget, couple, emergency fund, food).
   Structure-only components in the site's token vocabulary; the few surfaces
   that must flip differently per theme are the --cc-* tokens below. Loaded
   after style.css, so the theme tokens are already defined.

   Depth model (the reason the --cc-* tokens exist): on dark the card LIFTS
   off the pure-black page (surface-2) and wells/cells lift again (surface-3)
   — never darker-inside-lighter, which reads as punched holes (the old
   trust-grid treatment). On light the card is paper and cells go true white
   with a faint warm shadow.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --cc-card-bg: var(--surface-2);
  --cc-well-bg: var(--surface-3);
  --cc-cell-bg: var(--surface-3);
  --cc-cell-shadow: none;
  --cc-card-shadow: none;
}
:root[data-theme="light"] {
  --cc-card-bg: var(--surface);
  --cc-well-bg: var(--surface-2);
  --cc-cell-bg: #ffffff;
  --cc-cell-shadow: 0 1px 2px rgba(33, 32, 28, 0.05);
  --cc-card-shadow: 0 1px 2px rgba(33, 32, 28, 0.04), 0 10px 28px rgba(33, 32, 28, 0.05);
}

/* Utility-tool page: .wrap container per spec (not .legal-page), so restore
   the fixed-nav top clearance that .legal-page would normally provide. */
.calc-page {
  padding-top: 100px;
  padding-bottom: 80px;
}

/* FAQ answers use the homepage accordion; keep their text at the homepage
   size rather than inheriting the larger .legal-inner paragraph style. */
.calc-page .faq-answer p {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 0;
}

.calc-card {
  background: var(--cc-card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--cc-card-shadow);
  padding: 26px 26px 22px;
  margin: 24px 0 8px;
}

/* minmax(0, 1fr) everywhere: a bare 1fr track refuses to shrink below the
   number input's intrinsic ~250px, which pushes the second column past the
   card edge (bit the couple calculator's lei/lună wells). */
.calc-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

/* Labels: one small-caps voice for every field/section name in the tool. */
.cc-label {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
}

/* Amount input: big tabular number, unit inside the well. */
.cc-amount {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--cc-well-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 18px;
  transition: border-color 0.15s;
}
.cc-amount:focus-within {
  border-color: var(--accent);
}
.cc-amount input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.cc-amount input::-webkit-outer-spin-button,
.cc-amount input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cc-amount input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.cc-amount .cc-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
}
.cc-hint {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 7px;
}

/* Checkbox row: custom mark, the whole row is the hit area. */
.cc-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}
.cc-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cc-check .cc-box {
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--cc-well-bg);
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.cc-check .cc-box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.12s, transform 0.15s;
}
.cc-check input:checked + .cc-box {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.cc-check input:checked + .cc-box svg {
  opacity: 1;
  transform: scale(1);
}
.cc-check input:focus-visible + .cc-box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Segmented option picker — replaces a <select>; every option visible. */
.cc-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--cc-well-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.cc-seg button {
  flex: 1 1 auto;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.cc-seg button:hover {
  color: var(--text);
}
.cc-seg button[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent);
}

/* Stacked option list — for option sets too wordy for .cc-seg chips. Replaces
   a <select>: every choice stays visible (nothing hidden behind a click),
   native radio semantics kept. The right-aligned .cc-tag pill carries the
   option's consequence (months, style) so rows scan as text → answer. */
.cc-radio {
  display: grid;
  gap: 6px;
}
.cc-radio label {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cc-well-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
  transition: border-color 0.15s, color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.cc-radio label:hover {
  color: var(--text);
}
.cc-radio label:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
}
.cc-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cc-radio .cc-mark {
  flex: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: border-color 0.15s;
}
.cc-radio .cc-mark::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  transform: scale(0);
  transition: transform 0.15s;
}
.cc-radio input:checked ~ .cc-mark {
  border-color: var(--accent-strong);
}
.cc-radio input:checked ~ .cc-mark::after {
  transform: scale(1);
}
.cc-radio input:focus-visible ~ .cc-mark {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cc-radio .cc-tag {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--text-3);
  background: var(--cc-cell-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  transition: color 0.15s;
}
.cc-radio label:has(input:checked) .cc-tag {
  color: var(--accent);
  border-color: var(--accent);
}

/* Caption row + reference marker for a .cc-bar: the caption names what the
   bar shows, the marker pins an external reference point (e.g. the INS
   national average) onto the track. */
.cc-bar-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
}
.cc-bar-wrap {
  position: relative;
}
.cc-bar-wrap .cc-bar {
  margin-bottom: 0;
}
.cc-bar-mark {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  border-radius: 1px;
  background: var(--text-2);
  transform: translateX(-1px);
  pointer-events: none;
}

/* Select in the same well voice as .cc-amount, for option sets too wordy for
   a segmented control (e.g. the emergency-fund situations). The chevron is a
   baked data-URI, so light re-declares it in sand-11 ink (same trick as
   .contact-field select in style.css). */
.cc-select select {
  width: 100%;
  background: var(--cc-well-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 42px 13px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='14'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%238896b0'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
:root[data-theme="light"] .cc-select select {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='14'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2363635e'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'/%3E%3C/svg%3E");
}
.cc-select select:focus {
  border-color: var(--accent);
}

/* Guidance line anchored to an accent rule; warnings swap the rule and ink
   to the expense register (visible guard for impossible inputs). */
.cc-reco {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  border-left: 2px solid var(--accent);
  padding-left: 13px;
  margin: 22px 0 20px;
}
.cc-reco.is-warn {
  border-left-color: var(--expense);
  color: var(--expense);
}

/* Proportion bar — parts-of-a-whole only, never for alternatives. Widths
   animate on change; inner labels are hidden by JS below ~9% width. */
.cc-bar {
  display: flex;
  gap: 3px;
  height: 24px;
  margin-bottom: 12px;
}
.cc-bar .seg {
  display: grid;
  place-items: center;
  border-radius: 7px;
  min-width: 6px;
  overflow: hidden;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.cc-bar .seg span {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--invert-ink);
}
.cc-bar .seg-accent { background: var(--accent); }
.cc-bar .seg-expense { background: var(--expense); }
.cc-bar .seg-income { background: var(--income); }
/* Neutral remainder for progress bars (saved vs still-to-save). */
.cc-bar .seg-track { background: var(--cc-well-bg); border: 1px solid var(--border); }
.cc-bar .seg-track span { color: var(--text-2); }

/* Result cells: lifted, dot-keyed to the bar when the split is
   parts-of-a-whole; alternatives drop the dot and take uniform accent
   names (.cc-name-accent) per the alternatives rule. */
.cc-cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.cc-cells.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cc-cell {
  background: var(--cc-cell-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--cc-cell-shadow);
  padding: 15px 17px 13px;
}
.cc-cell-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.cc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.cc-cell-head .cc-name {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-cell-head .cc-name-accent {
  color: var(--accent);
}
.cc-cell-head .cc-pct {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--text-3);
}
.cc-cell .cc-val {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.cc-cell .cc-val small {
  font-size: 14px;
  font-weight: 550;
  color: var(--text-3);
  letter-spacing: 0;
}
.cc-cell .cc-sub {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-3);
  margin-top: 5px;
}
/* Per-person rows inside a cell (couple calculator): label + amount pairs. */
.cc-cell .cc-split {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.cc-cell .cc-split + .cc-split {
  margin-top: 2px;
}
.cc-cell .cc-split .cc-lbl {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
}
.cc-cell .cc-split .cc-amt {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Footer: insight + copy action on one hairline-separated row. */
.cc-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 22px;
  padding-top: 18px;
}
.cc-insight {
  flex: 1 1 260px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}
.cc-insight strong {
  color: var(--income);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
}
.cc-copy-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cc-copy-btn:hover {
  border-color: var(--text-3);
  background: var(--cc-well-bg);
}
.cc-copy-btn svg {
  flex: none;
}

.cc-disclaimer {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
  margin-top: 16px;
}

/* Vertical rhythm between input groups inside the card. */
.cc-gap {
  margin-top: 18px;
}

@media (max-width: 560px) {
  .calc-card {
    padding: 20px 18px 18px;
  }
  /* Thumb-sized copy target on touch layouts. */
  .cc-copy-btn {
    min-height: 44px;
  }
  /* minmax(0, 1fr) here too — a bare 1fr track sizes to the number input's
     intrinsic ~350px min-content and overflows the card (same lesson as the
     desktop two-col rule above; a bare 1fr shipped a 3px page wiggle). */
  .calc-two-col {
    grid-template-columns: minmax(0, 1fr);
  }
  .cc-cells,
  .cc-cells.cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .cc-cell {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 12px;
  }
  .cc-cell-head {
    margin-bottom: 0;
  }
  .cc-cell .cc-val {
    text-align: right;
  }
  .cc-cell .cc-sub,
  .cc-cell .cc-split {
    grid-column: 1 / -1;
  }
}
