/* =============================================================================
 *
 *  DIAMOND FINANCIALS — MORTGAGE CALCULATORS
 *  Loaded after styles.css on calculators.html and every calculator-*.html.
 *  Same rules as the main sheet: tokens only, no raw hex, block_element--mod.
 *
 *  ---------------------------------------------------------------------------
 *  CONTENTS
 *  ---------------------------------------------------------------------------
 *   01  HERO ................. shorter blue title block for tool pages
 *   02  HUB GRID ............. the calculator buttons on calculators.html
 *   03  TABS ................. switcher strip above each calculator
 *   04  LAYOUT ............... form beside the sticky result panel
 *   05  FIELDS ............... steps, inputs, sliders, segmented controls
 *   06  RESULT PANEL ......... headline figure, stats, flag, CTA
 *   07  CHARTS ............... line and bar charts drawn by calculators.js
 *   08  RESPONSIVE
 *
 * ========================================================================== */

/* =============================================================================
   01. HERO
   ========================================================================== */
.page_hero--tool {
  min-height: 48vh;
}
/* "Calculators" is one long word — sized so it never breaks mid-word */
.page_hero_title--word {
  font-size: clamp(2.5rem, 8.6vw, 10rem);
}

/* =============================================================================
   02. HUB GRID
   ========================================================================== */
.calc_hub {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.calc_card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  min-height: 21rem;
  padding: clamp(1.4rem, 2.4vw, 2rem);
  border: 1px solid var(--sand-300);
  border-radius: 0.6rem;
  background: var(--beige-500);
  overflow: hidden;
  isolation: isolate;
  transition: color 0.45s ease, border-color 0.45s ease,
    transform 0.6s var(--ease-expo);
}
/* the navy fill rises from the bottom edge on hover */
.calc_card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand-800);
  transform: translateY(101%);
  transition: transform 0.6s var(--ease-expo);
}
.calc_card:hover,
.calc_card:focus-visible {
  color: var(--beige-500);
  border-color: var(--brand-800);
  transform: translateY(-4px);
}
.calc_card:hover::before,
.calc_card:focus-visible::before {
  transform: translateY(0);
}
.calc_card:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
}
.calc_card_top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.calc_card_num {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  letter-spacing: 0.14em;
  opacity: 0.6;
}
.calc_card_icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--sand-200);
  color: var(--brand-600);
  transition: background 0.45s ease, color 0.45s ease;
}
.calc_card:hover .calc_card_icon,
.calc_card:focus-visible .calc_card_icon {
  background: var(--brand-500);
  color: var(--beige-500);
}
.calc_card_body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h4);
  line-height: 0.95;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}
.calc_card_body p {
  max-width: 34ch;
  opacity: 0.75;
}
.calc_card_go {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.calc_card_go svg {
  transition: transform 0.5s var(--ease-expo);
}
.calc_card:hover .calc_card_go svg {
  transform: translateX(6px);
}

/* the sixth tile — talk to an adviser — sits on the brand blue */
.calc_card--brand {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: var(--beige-500);
}
.calc_card--brand .calc_card_icon {
  background: rgb(var(--ivory-rgb) / 0.14);
  color: var(--beige-500);
}
.calc_card--brand .calc_card_body p {
  opacity: 0.85;
}

/* =============================================================================
   03. TABS
   ========================================================================== */
.calc_tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.calc_tabs a {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--sand-300);
  border-radius: 100px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.calc_tabs a:hover {
  border-color: var(--brand-800);
}
.calc_tabs a[aria-current="page"] {
  background: var(--brand-800);
  border-color: var(--brand-800);
  color: var(--beige-500);
}
.calc_tabs .calc_tabs_all {
  border-style: dashed;
}

/* =============================================================================
   04. LAYOUT
   ========================================================================== */
.calc {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.calc_intro {
  max-width: 46ch;
  font-size: var(--fs-large);
  opacity: 0.8;
  margin-bottom: 2.5rem;
}

/* =============================================================================
   05. FIELDS
   ========================================================================== */
.calc_form {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}
.calc_step {
  border-top: 1px solid var(--sand-300);
  padding-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 1.25rem;
}
.calc_step_title {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sub);
  text-transform: uppercase;
  line-height: 1.1;
}
.calc_step_num {
  font-size: var(--fs-small);
  letter-spacing: 0.14em;
  color: var(--brand-600);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.field--wide {
  grid-column: 1 / -1;
}
.field[hidden] {
  display: none;
}
.field_label {
  font-size: 0.9375rem;
  font-weight: 400;
}
.field_hint {
  font-size: var(--fs-small);
  opacity: 0.65;
}
.field_box {
  display: flex;
  align-items: center;
  height: 3.5rem;
  padding-inline: 1rem;
  border: 1px solid rgb(var(--ink-rgb) / 0.22);
  border-radius: 0.5rem;
  background: var(--beige-500);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.field_box:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgb(17 126 194 / 0.18);
}
.field_affix {
  font-family: var(--font-display);
  color: var(--brand-600);
  flex: none;
}
.field_box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding-inline: 0.5rem;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: var(--brand-800);
}

/* slider — a thin ink track, filled to the thumb in the logo blue */
.field_range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.5rem;
  background: transparent;
  cursor: pointer;
  --fill: 50%;
}
.field_range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--brand-500) var(--fill),
    rgb(var(--ink-rgb) / 0.14) var(--fill)
  );
}
.field_range::-moz-range-track {
  height: 3px;
  border-radius: 3px;
  background: rgb(var(--ink-rgb) / 0.14);
}
.field_range::-moz-range-progress {
  height: 3px;
  border-radius: 3px;
  background: var(--brand-500);
}
.field_range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: calc(-0.625rem + 1.5px);
  border-radius: 50%;
  background: var(--beige-500);
  border: 2px solid var(--brand-500);
  box-shadow: 0 2px 8px rgb(var(--ink-rgb) / 0.2);
  transition: transform 0.2s ease;
}
.field_range::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--beige-500);
  border: 2px solid var(--brand-500);
  box-shadow: 0 2px 8px rgb(var(--ink-rgb) / 0.2);
}
.field_range:active::-webkit-slider-thumb {
  transform: scale(1.15);
}
.field_range:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 4px;
  border-radius: 4px;
}

/* segmented control — radio buttons drawn as joined pills */
.seg {
  display: flex;
  padding: 0.25rem;
  border: 1px solid rgb(var(--ink-rgb) / 0.22);
  border-radius: 0.5rem;
  height: 3.5rem;
}
.seg label {
  flex: 1;
  position: relative;
  display: flex;
}
.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.seg span {
  flex: 1;
  display: grid;
  place-items: center;
  border-radius: 0.35rem;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.3s ease, color 0.3s ease;
}
.seg input:checked + span {
  background: var(--brand-800);
  color: var(--beige-500);
}
.seg input:focus-visible + span {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* =============================================================================
   06. RESULT PANEL
   ========================================================================== */
.calc_result {
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
  border-radius: 0.75rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  overflow: hidden;
}
/* the diamond mark, oversized and faint, behind the headline figure */
.calc_result::before {
  content: "";
  position: absolute;
  top: -2.5rem;
  right: -3rem;
  width: 15rem;
  aspect-ratio: 277.5 / 247.1;
  background-color: var(--brand-500);
  opacity: 0.16;
  -webkit-mask: var(--logo-mark) no-repeat center / contain;
  mask: var(--logo-mark) no-repeat center / contain;
  pointer-events: none;
}
.calc_result > * {
  position: relative;
}
.calc_big {
  display: block;
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.75rem, 1.9rem + 3.4vw, 4.75rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.calc_big_sub {
  display: block;
  margin-top: 0.6rem;
  color: var(--brand-300);
}
.calc_stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgb(var(--ivory-rgb) / 0.18);
}
.calc_stats > div {
  padding: 1rem 0;
  border-bottom: 1px solid rgb(var(--ivory-rgb) / 0.18);
}
.calc_stats > div:nth-child(odd) {
  padding-right: 1rem;
}
.calc_stats > div:nth-child(even) {
  padding-left: 1rem;
  border-left: 1px solid rgb(var(--ivory-rgb) / 0.18);
}
.calc_stats dt {
  font-size: var(--fs-small);
  color: var(--brand-300);
  margin-bottom: 0.3rem;
}
.calc_stats dd {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
}
.calc_flag {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 0.5rem;
  background: rgb(var(--ivory-rgb) / 0.08);
  border-left: 3px solid var(--brand-500);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.calc_flag[hidden] {
  display: none;
}
.calc_actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}
.calc_phone {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-300);
  transition: color 0.3s ease;
}
.calc_phone:hover {
  color: var(--beige-500);
}

.calc_note {
  margin-top: 2.5rem;
  max-width: 70ch;
  font-size: var(--fs-small);
  opacity: 0.65;
}

/* =============================================================================
   07. CHARTS
   ========================================================================== */
.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart_grid {
  stroke: rgb(var(--ivory-rgb) / 0.12);
  stroke-width: 1;
}
.chart_tick {
  fill: rgb(var(--ivory-rgb) / 0.55);
  font-family: var(--font-body);
  font-size: 11px;
}
.chart_line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart_line--a { stroke: var(--brand-500); }
.chart_line--b {
  stroke: rgb(var(--ivory-rgb) / 0.55);
  stroke-dasharray: 5 5;
}
.chart_area--a { fill: url(#calcFill); }
.chart_stop { stop-color: var(--brand-500); }

.chart_legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.85rem;
  font-size: var(--fs-small);
  color: var(--brand-300);
}
.chart_legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.chart_legend i {
  display: inline-block;
  width: 1.1rem;
  height: 0;
  border-top: 2.5px solid var(--brand-500);
}
.chart_legend i.is-b {
  border-top: 2px dashed rgb(var(--ivory-rgb) / 0.55);
}

/* bar comparison (borrowing) */
.bars {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.bar_head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--fs-small);
  color: var(--brand-300);
  margin-bottom: 0.45rem;
}
.bar_head strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--beige-500);
}
.bar_track {
  height: 0.6rem;
  border-radius: 1rem;
  background: rgb(var(--ivory-rgb) / 0.1);
  overflow: hidden;
}
.bar_fill {
  height: 100%;
  border-radius: 1rem;
  background: rgb(var(--ivory-rgb) / 0.4);
  transition: width 0.6s var(--ease-expo);
}
.bar.is-limit .bar_fill {
  background: var(--brand-500);
}

/* =============================================================================
   08. RESPONSIVE
   ========================================================================== */
@media (max-width: 991px) {
  .calc_hub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calc {
    grid-template-columns: minmax(0, 1fr);
  }
  .calc_result {
    position: relative;
    top: 0;
  }
}
@media (max-width: 600px) {
  .calc_hub {
    grid-template-columns: minmax(0, 1fr);
  }
  .calc_card {
    min-height: 0;
    gap: 2rem;
  }
  .calc_step {
    grid-template-columns: minmax(0, 1fr);
  }
  .calc_tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc(var(--site-pad) * -1);
    padding-inline: var(--site-pad);
    scrollbar-width: none;
  }
  .calc_tabs a {
    flex: none;
  }
  .calc_stats dd {
    font-size: 1.15rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .calc_card,
  .calc_card::before,
  .bar_fill {
    transition: none;
  }
}
