/* ============================================================
   Aportize - Independência financeira (FIRE)
   Carregar depois de chrome.css e calculator.css.
   Mesma linguagem visual das demais calculadoras.
   Requer <main class="wrap calculator-page fi-page">.
   ============================================================ */

.calculator-page.fi-page {
  --fi-column-gap: clamp(56px, 6vw, 96px);
  padding-top: clamp(36px, 5vw, 72px);
  padding-bottom: clamp(64px, 8vw, 112px);
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  color-scheme: dark;
}

.fi-page [hidden] {
  display: none !important;
}

.fi-page button,
.fi-page input,
.fi-page summary {
  -webkit-tap-highlight-color: transparent;
}

.fi-page button,
.fi-page input {
  margin: 0;
  font-family: var(--sans);
}

.fi-page button {
  appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--t), background-color var(--t), border-color var(--t);
}

.fi-page button:focus-visible,
.fi-page summary:focus-visible,
.fi-page a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.fi-page input {
  caret-color: var(--green);
}
.fi-page input::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* ---------- Abertura ---------- */

.fi-page .intro {
  margin: 0 0 clamp(36px, 4.5vw, 60px);
}

.fi-page .intro .eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.fi-page .intro h1 {
  max-width: none;
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 4.5vw, 4rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.052em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.fi-page .intro h1 span {
  color: var(--muted);
}

.fi-page .intro .intro__description {
  max-width: 50ch;
  margin: 22px 0 0;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: -0.01em;
}

/* ---------- Estrutura ---------- */

.fi-page .calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 40px;
  padding-top: clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--hairline);
  background: none;
}

.fi-page #calculator-form {
  display: grid;
  min-width: 0;
  gap: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.fi-page .section-label,
.fi-page .section-header h2 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

.fi-page .section-header {
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
}

.fi-page .field-hint,
.fi-page .hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.fi-page .hint:empty {
  display: none;
}

/* ---------- Custo mensal em destaque ---------- */

.fi-page .primary-input {
  min-width: 0;
  margin: 0;
}
.fi-page .primary-input .section-label {
  margin: 0;
}

.fi-page .primary-input__field {
  gap: 12px;
  margin-top: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  transition: border-color var(--t);
}

.fi-page .primary-input__field:focus-within {
  border-color: var(--green);
}

.fi-page .primary-input__currency {
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(1.125rem, 1.7vw, 1.5rem);
  letter-spacing: -0.03em;
}

.fi-page #monthly-cost {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-family: var(--mono);
  font-size: clamp(2.25rem, 4.4vw, 4rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Parametros ---------- */

.fi-page .fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
  margin-top: 18px;
}

.fi-page .field {
  gap: 7px;
  min-width: 0;
}

.fi-page .field-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.fi-page .input-shell {
  height: 48px;
  min-width: 0;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color var(--t), background-color var(--t);
}

.fi-page .input-shell:focus-within {
  border-color: var(--green);
}

.fi-page .input-shell input {
  min-width: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-family: var(--mono);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.fi-page .input-shell__prefix,
.fi-page .input-unit {
  flex: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  pointer-events: none;
}
.fi-page .input-unit {
  font-family: var(--sans);
  font-size: 0.75rem;
}

/* ---------- Resposta ---------- */

.fi-page .result,
.fi-page .result-empty {
  position: static;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 32px 0 0;
  border: 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.fi-page .result > .section-label {
  margin: 0;
  color: var(--green);
  font-size: 0.8125rem;
  font-weight: 500;
}

.fi-page .fire-number {
  display: block;
  max-width: 100%;
  margin: 12px 0 0;
  padding-bottom: 3px;
  overflow-x: auto;
  color: var(--green);
  font-family: var(--mono);
  font-size: clamp(1.875rem, 2.7vw, 2.375rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  scrollbar-width: thin;
}

.fi-page .fire-number__note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.fi-page .fire-number__note:empty,
.fi-page .progress__note:empty {
  display: none;
}

.fi-page .progress {
  position: relative;
  height: 4px;
  margin-top: 26px;
  overflow: hidden;
  background: var(--surface-2);
}

.fi-page .progress__bar {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: 0;
  max-width: 100%;
  background: var(--green);
  transition: width var(--t);
}

.fi-page .progress__note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.fi-page .progress__note b {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.fi-page .statement {
  margin: 24px 0 0;
  border-top: 1px solid var(--hairline);
}

.fi-page .statement__row {
  align-items: baseline;
  gap: 6px 16px;
  min-width: 0;
  padding: 17px 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
}

.fi-page .statement__row dt {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.fi-page .statement__row dd {
  max-width: 100%;
  margin-left: auto;
  overflow-x: auto;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  scrollbar-width: thin;
}

.fi-page #term {
  color: var(--text);
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.fi-page .note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.fi-page .note:empty {
  display: none;
}
.fi-page .note b {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.fi-page .assumptions {
  margin-top: 20px;
  border-top: 1px solid var(--hairline);
}

.fi-page .assumptions summary {
  position: relative;
  display: block;
  min-height: 48px;
  padding: 15px 28px 15px 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
  list-style: none;
  cursor: pointer;
}

.fi-page .assumptions summary::-webkit-details-marker {
  display: none;
}

.fi-page .assumptions summary::after {
  content: "+";
  position: absolute;
  top: 11px;
  right: 2px;
  color: var(--muted);
  font-size: 1.25rem;
}

.fi-page .assumptions[open] summary::after {
  content: "\2212";
}
.fi-page .assumptions__content {
  padding-bottom: 10px;
}
.fi-page .assumptions__content .note:first-child {
  margin-top: 0;
}

.fi-page .next-step {
  margin: 18px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.fi-page .next-step a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color var(--t);
}

.fi-page .result:not([hidden]) + .result-empty {
  display: none;
}
.fi-page .result-empty {
  min-height: 240px;
}
.fi-page .result-empty > .section-label {
  color: var(--muted);
  font-size: 0.8125rem;
}
.fi-page .result-empty__title {
  margin: 20px 0 0;
  color: var(--text-secondary);
  font-size: clamp(1.75rem, 2.7vw, 2.375rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.04em;
}
.fi-page .result-empty__description {
  max-width: 34ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.fi-page .noscript {
  margin: 0 0 28px;
  padding: 16px 0;
  border-block: 1px solid var(--hairline);
  color: var(--text-secondary);
}

/* ---------- Gráfico ---------- */

.fi-page .fi-chart {
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--hairline);
}

.fi-page .fi-chart .section-header {
  margin-bottom: 0;
}

.fi-page .fi-chart .section-description {
  margin: 6px 0 16px;
}

.fi-page .fi-chart__canvas {
  width: 100%;
  min-width: 0;
  height: clamp(260px, 40vw, 420px);
}

/* ---------- Interacao ---------- */

@media (hover: hover) {
  .fi-page .primary-input__field:hover:not(:focus-within) {
    border-color: var(--muted);
  }
  .fi-page .assumptions summary:hover,
  .fi-page .next-step a:hover {
    color: var(--text);
  }
}

/* ---------- Tablet e desktop ---------- */

@media (min-width: 480px) {
  .fi-page .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 16px;
  }
}

@media (min-width: 1180px) {
  .fi-page .calculator-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: var(--fi-column-gap);
    background-image: linear-gradient(var(--hairline), var(--hairline));
    background-size: 1px 100%;
    background-repeat: no-repeat;
    background-position: calc(52.5% - var(--fi-column-gap) * 0.025) 0;
  }

  .fi-page .result,
  .fi-page .result-empty {
    padding: 0;
    border-top: 0;
  }
}

@media (min-width: 1180px) and (min-height: 920px) {
  .fi-page .result:not(:has(.assumptions[open])),
  .fi-page .result-empty {
    position: sticky;
    top: calc(var(--nav-h) + 28px);
  }
}

@media (max-width: 619px) {
  .fi-page .intro .eyebrow {
    margin-bottom: 16px;
    font-size: 0.75rem;
  }
  .fi-page .intro h1 {
    font-size: clamp(1.875rem, 8.5vw, 3rem);
    line-height: 1.08;
  }
  .fi-page .intro .intro__description {
    margin-top: 18px;
    font-size: 0.9375rem;
  }
  .fi-page .intro__break {
    display: none;
  }
  .fi-page #calculator-form {
    gap: 28px;
  }
  .fi-page #monthly-cost {
    font-size: clamp(2.125rem, 10.5vw, 3.5rem);
  }
  .fi-page .input-shell {
    height: 52px;
  }
  .fi-page .fi-chart {
    margin-top: 32px;
    padding-top: 24px;
  }
  .fi-page .fi-chart__canvas {
    height: 264px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fi-page *,
  .fi-page *::before,
  .fi-page *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

@media (forced-colors: active) {
  .fi-page .input-shell {
    border: 1px solid ButtonText;
  }
  .fi-page button:focus-visible,
  .fi-page summary:focus-visible,
  .fi-page a:focus-visible {
    outline-color: Highlight;
  }
  .fi-page .input-shell:focus-within,
  .fi-page .primary-input__field:focus-within {
    border-color: Highlight;
  }
  .fi-page .progress,
  .fi-page .progress__bar {
    forced-color-adjust: none;
  }
  .fi-page .progress {
    background: Canvas;
    outline: 1px solid CanvasText;
  }
  .fi-page .progress__bar {
    background: Highlight;
  }
}
