/* =========================================================
   Calculator page styles
   Uses the brand colors and fonts defined in styles.css.
   ========================================================= */

/* ---------- Page intro ---------- */
.tool-hero {
  background: var(--cobalt);
  color: var(--white);
  padding: 44px 0 52px;
}
.tool-hero h1 { color: var(--white); font-size: clamp(1.9rem, 5vw, 3rem); max-width: 16em; }
.tool-hero .eyebrow { color: var(--aqua); }
.tool-lead { font-size: 1.1rem; color: rgba(255, 255, 255, 0.88); max-width: 40em; }
.tool-note {
  max-width: 40em;
  margin: 20px 0 0;
  padding: 14px 18px;
  border-left: 4px solid var(--aqua);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 8px 8px 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
}
.tool-note strong { color: var(--white); }

/* ---------- Layout: inputs left, results right (desktop) ---------- */
.calc-section { padding-top: 48px; }
.calc-layout { display: flex; flex-direction: column; gap: 40px; }

/* ---------- Inputs ---------- */
.calc-head,
.calc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;     /* phones: label on its own line, two inputs below */
  gap: 8px 12px;
  align-items: center;
}
.calc-head span:first-child { display: none; }

.calc-head {
  position: sticky;
  top: 84px;               /* sits just under the sticky site header */
  z-index: 5;
  background: var(--white);
  padding: 12px 0;
  border-bottom: 2px solid var(--mist);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.col-new, .col-resale { display: flex; align-items: center; gap: 8px; color: var(--cobalt); }
.col-new::before, .col-resale::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
}
.col-new::before { background: var(--cobalt); }
.col-resale::before { background: var(--aqua); border: 2px solid var(--cobalt); }

.calc-group {
  border: 0;
  margin: 0;
  padding: 24px 0 8px;
}
.calc-group legend {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--cobalt);
  padding: 0;
  margin-bottom: 8px;
}

.calc-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--mist);
}
.row-label {
  grid-column: 1 / -1;
  font-family: var(--font-head);
  font-weight: 500;
  color: var(--onyx);
  font-size: 0.95rem;
  line-height: 1.35;
}
.row-label small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

/* Input boxes with "$" in front or "%" behind */
.field { position: relative; }
.field input,
.field select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--onyx);
  background: var(--white);
  border: 1.5px solid #C9CCD4;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 46px;
  appearance: none;
  -moz-appearance: textfield;
}
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--cobalt) 50%),
                    linear-gradient(135deg, var(--cobalt) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(0, 251, 240, 0.45);   /* aqua = active state, per brand guide */
}
.field.money input { padding-left: 26px; }
.field.money::before,
.field.pct::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.field.money::before { content: "$"; left: 12px; }
.field.pct input { padding-right: 30px; }
.field.pct::after { content: "%"; right: 12px; }

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.btn-plain {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.9rem;
  background: none;
  border: 1.5px solid var(--mist);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--cobalt);
  cursor: pointer;
}
.btn-plain:hover { border-color: var(--cobalt); }

/* ---------- Results ---------- */
.calc-results {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  border-top: 4px solid var(--aqua);
}

.summary-cards { display: grid; gap: 14px; }
.summary-card {
  background: var(--white);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.summary-card h3 { font-size: 0.95rem; margin-bottom: 10px; }
.summary-card h3 small { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.summary-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary-pair strong {
  display: block;
  font-family: var(--font-head);
  font-size: 1.35rem;
  color: var(--cobalt);
  line-height: 1.3;
}
.tag {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
}
.tag-new { background: var(--cobalt); color: var(--white); }
.tag-resale { background: var(--aqua); color: var(--cobalt); }
.summary-diff {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--mist);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.warnings p {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #FFF8E6;
  border-left: 4px solid #E0A100;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
}

.breakdown { margin-top: 20px; }
.breakdown summary {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--cobalt);
  cursor: pointer;
  padding: 6px 0;
}
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.85rem;
}
.breakdown-table th,
.breakdown-table td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--mist);
  text-align: right;
  font-weight: 400;
}
.breakdown-table th[scope="row"] { text-align: left; color: var(--onyx); }
.breakdown-table thead th {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--cobalt);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.breakdown-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-group th {
  text-align: left !important;
  font-family: var(--font-head);
  font-weight: 600 !important;
  color: var(--cobalt);
  padding-top: 18px !important;
  border-bottom: 2px solid var(--cobalt) !important;
}
.row-subtotal th, .row-subtotal td { font-weight: 600 !important; }
.row-total th, .row-total td {
  font-weight: 700 !important;
  color: var(--cobalt) !important;
  background: rgba(0, 251, 240, 0.12);
}
.row-minus td { color: var(--text-muted); }

.results-disclaimer {
  margin: 16px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Assumptions ---------- */
.assumptions-intro { max-width: 44em; color: var(--text-muted); margin-bottom: 32px; }
.assumption-grid { display: grid; gap: 20px; }
.assumption {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border-top: 4px solid var(--aqua);
}
.assumption p { color: var(--text-muted); font-size: 0.95rem; }
.assumption p:last-child { margin-bottom: 0; }

/* ---------- Larger screens ---------- */
@media (min-width: 700px) {
  .calc-head,
  .calc-row { grid-template-columns: 1.3fr 1fr 1fr; }
  .calc-head span:first-child { display: block; }
  .row-label { grid-column: auto; }
  .assumption-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1000px) {
  .calc-layout { flex-direction: row; align-items: flex-start; gap: 48px; }
  .calc-form { flex: 1.35; }
  .calc-results { flex: 1; position: sticky; top: 104px; }
  .calc-head { top: 84px; }
  .mobile-only { display: none; }
  .assumption-grid { grid-template-columns: repeat(3, 1fr); }
}
