/* Total Trust Home Loans — payment calculator, embedded in the homepage.
   Rides on styles.css and inherits its navy/sky brand tokens.
   Scoped under .calc-embed so it cannot touch the rest of the page. */

/* ===================== THE BAND ===================== */
/* Sits between the hero (which fades to white) and the navy trust bar, so it
   gets its own soft band with hairlines top and bottom to separate cleanly. */
.calc-embed {
  position: relative;
  background:
    radial-gradient(900px 400px at 88% -10%, rgba(63,147,209,.13), transparent 60%),
    linear-gradient(180deg, #eef3f9 0%, var(--bg-alt) 22%, var(--bg-alt) 100%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: var(--band) 0;
}
/* Hairline of brand colour along the top edge — a small signal of care. */
.calc-embed::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--navy), var(--sky), var(--navy));
  opacity: .85;
}

.calc-embed-head { max-width: 46rem; margin-bottom: 2.2rem; }
.calc-embed-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); margin-bottom: 0; letter-spacing: -.015em; }
.calc-sub { color: var(--muted); font-size: 1.02rem; margin-top: .85rem; line-height: 1.65; }

.calc-noscript {
  background: #fff3cd; border: 1px solid #f0d98c; color: #6b5200;
  padding: 1rem 1.2rem; border-radius: var(--radius); margin-bottom: 1.6rem;
}

/* ===================== THE FORM ===================== */
.calc-form { max-width: 100%; }

.calc-block {
  border: 1px solid var(--line); border-radius: 16px; background: #fff;
  padding: 1.9rem 1.9rem 2.1rem; margin-bottom: 1.5rem;
  /* Two-layer shadow: a tight contact shadow plus a wide soft one. Reads as
     considered depth rather than a flat drop shadow. */
  box-shadow: 0 1px 2px rgba(17,58,92,.06), 0 12px 32px -12px rgba(17,58,92,.16);
}
.calc-block legend {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--font-head); font-weight: 800; color: var(--navy);
  font-size: 1.12rem; letter-spacing: -.01em; padding: 0 .7rem; margin-left: -.7rem;
}
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  background: linear-gradient(145deg, var(--sky), #2f82c2); color: #fff;
  font-size: .92rem; font-weight: 800;
  box-shadow: 0 3px 8px rgba(63,147,209,.38);
}
.block-intro { color: var(--muted); font-size: .92rem; margin: .7rem 0 1.3rem; max-width: 46rem; }

.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; margin-top: 1.1rem; }
.type-opt { display: block; cursor: pointer; }
.type-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.type-card {
  position: relative; display: flex; flex-direction: column; gap: .35rem; height: 100%;
  border: 1.5px solid var(--line); border-radius: 13px; padding: 1.05rem 1.1rem 1.05rem;
  background: #fff;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.type-card strong { font-family: var(--font-head); color: var(--navy); font-size: 1.04rem; letter-spacing: -.01em; }
.type-card em { font-style: normal; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.type-opt:hover .type-card {
  border-color: #bcd8ee; transform: translateY(-2px);
  box-shadow: 0 10px 24px -12px rgba(17,58,92,.28);
}
.type-opt input:checked + .type-card {
  border-color: var(--sky); background: var(--sky-soft);
  box-shadow: 0 0 0 3px rgba(63,147,209,.14);
}
/* A tick in the corner of the chosen programme — unmistakable at a glance. */
.type-opt input:checked + .type-card::after {
  content: "✓"; position: absolute; top: .6rem; right: .7rem;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--sky); color: #fff; font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.type-opt input:focus-visible + .type-card { outline: 3px solid rgba(63,147,209,.45); outline-offset: 2px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.6rem; margin-top: 1.1rem; }
.calc-embed .field { display: flex; flex-direction: column; }
.calc-embed .field > label, .calc-embed .field > .check {
  font-weight: 600; font-size: .88rem; color: var(--navy); margin-bottom: .4rem;
}
.calc-embed .field .opt { font-weight: 500; color: var(--muted); font-size: .82rem; }
.field-note { font-size: .78rem; color: var(--muted); margin-top: .4rem; line-height: 1.5; }

.input-wrap { position: relative; display: flex; align-items: stretch; }
.input-wrap input, .calc-embed .field select {
  width: 100%; border: 1px solid #dbe3ec; border-radius: 10px; background: #fbfcfe;
  padding: .8rem .95rem; font: inherit; font-weight: 600; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.calc-embed .field select { font-weight: 500; }
.input-wrap input:hover, .calc-embed .field select:hover { border-color: #c3d4e4; }
/* Soft branded focus halo rather than a hard outline — the difference between
   a form that feels built and one that feels defaulted. */
.input-wrap input:focus, .calc-embed .field select:focus {
  outline: none; border-color: var(--sky); background: #fff;
  box-shadow: 0 0 0 3px rgba(63,147,209,.16);
}
.input-wrap .affix {
  display: flex; align-items: center; padding: 0 .85rem; background: #eef4f9;
  border: 1px solid #dbe3ec; color: var(--muted); font-weight: 700; font-size: .9rem;
}
.has-prefix .affix { border-right: 0; border-radius: 10px 0 0 10px; }
.has-prefix input { border-radius: 0 10px 10px 0; }
.has-suffix .affix { border-left: 0; border-radius: 0 10px 10px 0; }
.has-suffix input { border-radius: 10px 0 0 10px; }
.dual-input { display: grid; grid-template-columns: 1.4fr .8fr; gap: .6rem; }

.checkbox-field .check { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; margin-bottom: 0; }
.checkbox-field .check input { width: 18px; height: 18px; margin-top: .12rem; accent-color: var(--sky); }
.type-only[hidden] { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 999px; padding: .34rem .8rem; font: inherit; font-size: .8rem; font-weight: 700;
  cursor: pointer; transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.chip:hover { border-color: var(--sky); background: var(--sky-soft); }
.chip.is-on { background: var(--sky); border-color: var(--sky); color: #fff; }
.chip-clear { color: var(--muted); font-weight: 600; }

.program-flag {
  margin-top: 1.3rem; background: var(--sky-soft); border-left: 4px solid var(--sky);
  border-radius: 0 10px 10px 0; padding: .85rem 1.1rem;
  font-size: .87rem; color: var(--navy); line-height: 1.6;
}

.calc-submit { text-align: center; margin-top: 2.2rem; }
.rate-claim {
  font-family: var(--font-head); font-weight: 800; color: var(--navy);
  font-size: clamp(1.02rem, 2.2vw, 1.24rem); line-height: 1.4; max-width: 40rem; margin: 0 auto .55rem;
}
.rate-claim::before {
  content: ""; display: block; width: 54px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--sky), var(--navy)); margin: 0 auto 1rem;
}
.rate-claim-sub { font-size: .74rem; color: var(--muted); max-width: 44rem; margin: 0 auto 1.5rem; line-height: 1.6; }
.btn-calc { min-width: 270px; }
.calc-error {
  margin-top: 1rem; color: #9b1c1c; background: #fdeaea; border: 1px solid #f5c6c6;
  padding: .8rem 1rem; border-radius: 9px; font-weight: 600; font-size: .9rem;
}

/* ===================== RESULTS ===================== */
.calc-embed .results {
  margin-top: 2.6rem; padding-top: 2.6rem; border-top: 2px solid var(--line);
}

.res-headline {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid var(--line); border-radius: 16px; padding: 2.3rem 2rem;
  box-shadow: 0 1px 2px rgba(17,58,92,.06), 0 20px 48px -20px rgba(17,58,92,.30);
}
.res-big { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem; }
.res-big-label { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sky); }
.res-big-num {
  font-family: var(--font-head); font-weight: 800; color: var(--navy);
  font-size: clamp(2.8rem, 7vw, 4.2rem); line-height: 1.05; letter-spacing: -.02em;
}
.res-big-sub { font-size: .9rem; color: var(--muted); }
.res-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 1.5rem 0 1rem; background: var(--line); }
.bar-seg { display: block; height: 100%; }
.res-legend { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: center; font-size: .84rem; color: var(--muted); }
.res-legend strong { color: var(--navy); }
.res-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .45rem; vertical-align: middle; }

/* Two columns, each led by its own call to action button. */
.res-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-top: 1.4rem; align-items: start; }
.res-col { display: flex; flex-direction: column; }
.btn-block {
  display: block; width: 100%; text-align: center; margin-bottom: 1rem;
  padding: .92rem 1.5rem; font-size: 1rem; letter-spacing: .01em;
}
.btn-block.btn-ghost { background: #fff; }
.btn-block.btn-ghost:hover { background: var(--navy); color: #fff; }

.res-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.7rem; flex: 1;
  box-shadow: 0 1px 2px rgba(17,58,92,.05), 0 12px 32px -16px rgba(17,58,92,.20);
}
.res-card h3 {
  font-size: 1.06rem; margin-bottom: 1.1rem; padding-bottom: .8rem;
  border-bottom: 1px solid var(--line);
}
.res-table { width: 100%; border-collapse: collapse; }
.res-table th, .res-table td { padding: .58rem 0; text-align: left; font-size: .92rem; vertical-align: top; }
.res-table th { font-weight: 500; color: var(--muted); }
.res-table td { text-align: right; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.res-table em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .82rem; }
.res-table .row-strong th { color: var(--navy); font-weight: 700; }
.res-table .row-strong td { font-size: 1.12rem; }
.res-table .row-muted td { color: var(--muted); font-weight: 600; }
.res-table .row-divider td { padding: 0; border-top: 1px solid var(--line); height: 1px; }
.res-note { font-size: .8rem; color: var(--muted); margin-top: 1rem; line-height: 1.6; }

/* ===== side by side ===== */
.sbs { margin-top: 2.2rem; }
.sbs h3 { font-size: 1.35rem; }
.sbs-intro { color: var(--muted); font-size: .93rem; margin: .5rem 0 1.1rem; max-width: 48rem; }
.sbs-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-width: 620px;
  box-shadow: 0 1px 2px rgba(17,58,92,.05), 0 16px 40px -20px rgba(17,58,92,.24);
}
.sbs-table thead th {
  background: var(--navy); color: #fff; font-family: var(--font-head); font-weight: 800;
  font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; padding: .85rem 1rem; text-align: right;
}
.sbs-table thead th:first-child { text-align: left; }
.sbs-table thead th.col-extra { background: var(--sky); }
.sbs-table thead th.col-save { background: #1c6b3a; }
.sbs-table tbody th { text-align: left; font-weight: 600; color: var(--muted); font-size: .92rem; padding: .85rem 1rem; }
.sbs-table tbody td { text-align: right; padding: .85rem 1rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; font-size: .96rem; }
.sbs-table tbody tr + tr th, .sbs-table tbody tr + tr td { border-top: 1px solid var(--line); }
.sbs-table tbody td.col-extra { background: rgba(63,147,209,.07); }
.sbs-table tbody td.col-save { background: rgba(28,107,58,.07); color: #1c6b3a; }
.sbs-table tr.sbs-strong th { color: var(--navy); font-weight: 700; }
.sbs-table tr.sbs-strong td { font-size: 1.1rem; }
.save-neg { color: var(--muted); font-weight: 600; }

.sbs-try { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; font-size: .87rem; color: var(--muted); font-weight: 600; }
.sbs-try .chips { margin-top: 0; }

.savings-banner {
  margin-top: 1.3rem; color: #fff; border-radius: 16px; padding: 2.3rem 2rem; text-align: center;
  background:
    radial-gradient(700px 260px at 50% -30%, rgba(63,147,209,.42), transparent 70%),
    linear-gradient(160deg, var(--navy), var(--navy-deep));
  box-shadow: 0 20px 44px -22px rgba(17,58,92,.55);
}
.savings-lead { font-size: .92rem; color: #b9d4e9; }
.savings-num { font-family: var(--font-head); font-weight: 800; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.1; margin: .3rem 0 .5rem; color: #fff; }
.savings-sub { font-size: .95rem; color: #d8e7f2; max-width: 44rem; margin: 0 auto; line-height: 1.65; }
.savings-sub strong { color: #fff; }

.res-warnings { margin-top: 1.8rem; background: #fff8e6; border: 1px solid #f0d98c; border-radius: var(--radius); padding: 1.3rem 1.5rem; }
.res-warnings h3 { font-size: 1rem; color: #6b5200; margin-bottom: .6rem; }
.res-warnings ul { margin-left: 1.1rem; }
.res-warnings li { font-size: .87rem; color: #6b5200; line-height: 1.6; margin-bottom: .4rem; }

.res-schedule { margin-top: 1.8rem; }
.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.sched-head h3 { margin-bottom: 0; }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.table-scroll { overflow-x: auto; margin-top: 1.1rem; -webkit-overflow-scrolling: touch; }
.sched-table { min-width: 560px; }
.sched-table thead th {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--sky);
  font-weight: 700; border-bottom: 1px solid var(--line); text-align: right; padding-bottom: .5rem;
}
.sched-table thead th:first-child { text-align: left; }
.sched-table tbody td { text-align: right; font-weight: 600; font-size: .87rem; }
.sched-table tbody td:first-child { text-align: left; color: var(--muted); font-weight: 700; }
.sched-table tbody tr:nth-child(even) { background: var(--bg-alt); }

.res-actions { display: flex; gap: .9rem; justify-content: center; flex-wrap: wrap; margin-top: 2.2rem; }

/* ===================== SOURCES + DISCLAIMER ===================== */
.calc-sources { margin-top: 2.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.calc-sources summary {
  cursor: pointer; font-family: var(--font-head); font-weight: 700; color: var(--navy);
  font-size: .9rem; list-style: revert;
}
.calc-sources summary:hover { color: var(--sky); }
.calc-sources ul { margin: .9rem 0 0 1.1rem; }
.calc-sources li { font-size: .8rem; color: var(--muted); line-height: 1.65; margin-bottom: .5rem; }
.res-source-date { font-size: .78rem; color: var(--muted); font-weight: 600; margin-top: .6rem; }
.calc-disclaimer { font-size: .76rem; color: var(--muted); line-height: 1.65; margin-top: 1.2rem; }

/* Status line under the site's contact form (success / warning / error). */
.contact-status {
  font-size: .86rem; padding: .7rem .85rem; border-radius: 8px; line-height: 1.55;
  background: var(--sky-soft); color: var(--navy);
}
.contact-status.is-ok { background: #e7f6ec; color: #1c6b3a; }
.contact-status.is-warn { background: #fff3cd; color: #6b5200; }
.contact-status.is-error { background: #fdeaea; color: #9b1c1c; }
.contact-status a { color: inherit; text-decoration: underline; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .type-grid { grid-template-columns: 1fr 1fr; }
  .res-cols { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .field-grid { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: 1fr; }
  .calc-block { padding: 1.25rem 1.15rem 1.5rem; }
  .res-headline, .res-card { padding: 1.25rem; }
  .btn-calc { width: 100%; min-width: 0; }
  .res-legend { justify-content: flex-start; }
  .savings-banner { padding: 1.5rem 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .type-opt:hover .type-card { transform: none; }
}

@media print {
  .calc-submit, .sbs-try, .chips, .res-actions, .sched-head .btn { display: none; }
  .calc-embed { background: #fff; }
  .res-headline, .res-card, .sbs-table { box-shadow: none; border-color: #ccc; }
}
