/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Stop mobile Safari from auto-inflating text size on rotation to
   landscape — it applies its own heuristic per text block, which blows
   some headings/paragraphs up far larger than the rest of the page. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

:root {
  /* Running-text size for every paragraph, bullet list and FAQ answer
     site-wide (tables, footnotes and labels are deliberately smaller).
     Change it here to resize all body text at once. */
  --body-text: 15px;
  --navy:      #1e3a5f;
  --navy-dark: #142b47;
  --accent:    #3b82f6;
  --bg:        #f1f5f9;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --green:     #16a34a;
  --red:       #dc2626;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: var(--body-text);
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--navy);
  color: white;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */
a.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: white;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.logo-mark { flex-shrink: 0; display: block; }

.logo-accent { color: #60a5fa; }

.site-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: 2rem;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  padding: .35rem .7rem;
  border-radius: 5px;
  transition: background .15s, color .15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.nav-link:hover, .nav-link.nav-active {
  background: rgba(255,255,255,.12);
  color: white;
}

/* Dropdowns */
.nav-dropdown { position: relative; }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 210px;
  z-index: 200;
  padding: .4rem 0;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }

/* Invisible bridge over the visual gap above the menu, so hover doesn't
   drop when the cursor crosses from the button down to the menu. */
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  min-width: 210px;
  height: 6px;
}

.nav-dropdown-menu a {
  display: block;
  padding: .5rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: .875rem;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--bg); }

.nav-dropdown-subhead {
  display: block;
  padding: .35rem 1rem .2rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--navy);
}
.nav-dropdown-subhead:not(:first-child) {
  margin-top: .3rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border);
}

/* CTA button */
.btn-nav-cta {
  margin-left: auto;
  background: white;
  color: var(--navy);
  font-size: .82rem;
  font-weight: 700;
  padding: .38rem .9rem;
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .15s;
}
.btn-nav-cta:hover { opacity: .88; }

/* Hamburger (mobile only) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  margin-left: .75rem;
  padding: .25rem;
}

/* Mobile nav: full-screen slide-in drill-down overlay */
.mobile-nav:not([hidden]) {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: var(--navy-dark);
  overflow: hidden;
}
.mobile-nav-screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: .75rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  background: var(--navy-dark);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.mobile-nav-screen[data-screen="root"] { transform: translateX(0); }
.mobile-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .6rem .5rem;
  font-size: .95rem;
  border-radius: 4px;
  display: block;
}
.mobile-nav a:hover { background: rgba(255,255,255,.1); color: white; }
.mobile-nav a.mobile-nav-cta {
  background: white;
  color: var(--navy);
  font-weight: 700;
  text-align: center;
  padding: .6rem .5rem;
  margin-bottom: .5rem;
}
.mobile-nav a.mobile-nav-cta:hover { background: white; opacity: .88; color: var(--navy); }
.mobile-nav-row {
  background: none;
  border: none;
  width: 100%;
  font: inherit;
  text-align: left;
  color: rgba(255,255,255,.85);
  padding: .6rem .5rem;
  font-size: .95rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mobile-nav-row:hover { background: rgba(255,255,255,.1); color: white; }
.mobile-nav-row .chevron { color: rgba(255,255,255,.35); font-size: 1.1rem; }
.mobile-nav-screen-head {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .1rem .1rem .8rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.mobile-nav-back {
  background: none;
  border: none;
  color: rgba(255,255,255,.85);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: .1rem .4rem .1rem 0;
}
.mobile-nav-back:hover { color: white; }
.mobile-nav-screen-title {
  color: white;
  font-weight: 700;
  font-size: 1rem;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero { padding: .5rem 0 .25rem; }

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}

.hero-sub {
  margin-top: .5rem;
  color: var(--muted);
  font-size: 1rem;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .2rem;
}

.section-note {
  color: var(--muted);
  font-size: .83rem;
  margin-bottom: 1rem;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

label {
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.field-error {
  font-size: .76rem;
  color: var(--red);
  margin-top: .1rem;
}

input.input-invalid,
.money-input.input-invalid {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
}

input[type=number],
input[type=text],
select {
  padding: .58rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  color: var(--text);
  background: white;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
  appearance: auto;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ── Money input ─────────────────────────────────────────────────────────── */
.money-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: white;
  transition: border-color .15s, box-shadow .15s;
  overflow: hidden;
}

.money-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.money-input > span {
  padding: 0 .4rem 0 .75rem;
  color: var(--muted);
  font-size: .95rem;
  user-select: none;
  flex-shrink: 0;
}

.money-input input {
  border: none;
  box-shadow: none !important;
  padding: .58rem .75rem .58rem 0;
  flex: 1;
  min-width: 0;
}

/* ── Assumptions panel ───────────────────────────────────────────────────── */
.assumptions {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-bottom: 1.25rem;
}

.assumptions > summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--navy);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  user-select: none;
}

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

.assumptions > summary::before {
  content: '▶';
  font-size: .65rem;
  transition: transform .2s;
  color: var(--muted);
}

.assumptions[open] > summary::before { transform: rotate(90deg); }

.defaults-note {
  color: var(--muted);
  font-weight: 400;
  font-size: .82rem;
}

.assumptions-grid {
  margin-top: 1rem;
  margin-bottom: 0;
}

/* ── Button ──────────────────────────────────────────────────────────────── */
.form-actions { margin-top: .25rem; }

.btn-primary {
  background: var(--navy);
  color: white;
  border: none;
  padding: .72rem 1.75rem;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  letter-spacing: .01em;
}

.btn-primary:hover  { background: var(--navy-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: default; transform: none; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  color: var(--muted);
}

.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ───────────────────────────────────────────────────────────────── */
.error-banner {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  font-size: .9rem;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  white-space: nowrap;
}

th {
  background: var(--navy);
  color: rgba(255,255,255,.9);
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .03em;
}

th:first-child { border-radius: 5px 0 0 0; }
th:last-child  { border-radius: 0 5px 0 0; }

td {
  padding: .62rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

tr.ineligible-row td { color: var(--muted); }

/* ── Eligibility badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .22rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  cursor: default;
  white-space: nowrap;
}

.badge-eligible   { background: #dcfce7; color: var(--green); }
.badge-ineligible { background: #fee2e2; color: var(--red);   cursor: help; }
.badge-uncertain  { background: #fef9c3; color: #92400e;      cursor: help; }

/* ── Rank colors ─────────────────────────────────────────────────────────── */
.rank-na { color: #94a3b8; font-size: .82rem; }
.over-max-note { font-size: .78rem; color: #94a3b8; font-style: italic; }

.swatch {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  margin: 0 .1rem;
}

/* ── Calc 2 controls ─────────────────────────────────────────────────────── */
.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1rem 0 .5rem;
  border-top: 1px solid var(--border);
  margin-top: .75rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.proceeds-wrap {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.proceeds-input { width: 180px; }

/* #t-slider only ("Amount to access", paired with the 180px .proceeds-input
   box above it). This used to be a blanket input[type=range] rule, which
   has higher CSS specificity than .mobile-slider's own width:100% (a type
   selector + attribute selector beats a lone class selector) and was
   silently capping every .mobile-slider range input — home value, mortgage,
   proceeds, credit score — at 180px on desktop, well short of the money
   input boxes they sit beneath. */
#t-slider {
  width: 180px;
  accent-color: var(--navy);
  cursor: pointer;
  height: 4px;
}

/* ── Scroll hint ─────────────────────────────────────────────────────────── */
.scroll-hint {
  font-size: .76rem;
  color: var(--muted);
  margin-top: .4rem;
  text-align: right;
  letter-spacing: .01em;
}

/* ── Table legend ────────────────────────────────────────────────────────── */
.table-legend {
  margin-top: .85rem;
  margin-bottom: .85rem;
  font-size: .79rem;
  color: var(--muted);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.legend-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}

.legend-label {
  font-weight: 600;
  color: var(--text);
  margin-right: .1rem;
}

.legend-keys {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* Plain block flow (not flex) so the badge and its sentence wrap together
   like normal text — flex-wrap was splitting them into separate flex items
   that could land on different lines with no visual link between them. */
.legend-key-row {
  display: block;
}

.legend-badge {
  display: inline-block;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05rem .4rem;
  margin-right: .35rem;
}

/* ── Table note ──────────────────────────────────────────────────────────── */
.table-note {
  font-size: .79rem;
  color: var(--muted);
  margin-top: .85rem;
  line-height: 1.5;
}
.table-note-warning {
  color: var(--text);
  background: #fef9c3;
  border-left: 3px solid #ca8a04;
  padding: .4rem .7rem;
  border-radius: 0 4px 4px 0;
}
.table-note-info {
  color: var(--text);
  background: rgba(59,130,246,.06);
  border-left: 3px solid var(--accent);
  padding: .4rem .7rem;
  border-radius: 0 4px 4px 0;
}
@media (prefers-color-scheme: dark) {
  .table-note-warning { background: #422006; border-color: #d97706; }
  .table-note-info { background: rgba(59,130,246,.12); }
}

/* ── Provider cell ───────────────────────────────────────────────────────── */
.provider-cell {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.provider-name-link {
  font-weight: 700;
  text-decoration: none;
  font-size: .95rem;
}

.provider-name-link:hover { text-decoration: underline; }

.btn-quote {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: .02em;
  white-space: nowrap;
}

.btn-quote:hover { text-decoration: underline; }

/* Eligibility table: Get Quote as a small outlined button under the logo */
.provider-cell .btn-quote {
  margin-top: .35rem;
  padding: .2rem .6rem;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  font-size: .74rem;
}
.provider-cell .btn-quote:hover { background: var(--accent); color: white; text-decoration: none; }

/* ── Next-step card (lowest-cost matches → provider buttons) ────────────── */
.next-step-card { border-left: 4px solid var(--green); }
.next-step-card p { color: var(--text); font-size: .92rem; line-height: 1.6; margin: .4rem 0 1rem; }
.next-step-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.next-step-actions a.btn-primary { display: inline-block; text-decoration: none; }
/* Phones: second sentence hidden to keep the card short; buttons stacked full width */
@media (max-width: 640px) {
  .next-step-card h2 { font-size: 1rem; }
  .next-step-card p { margin-bottom: .8rem; }
  .next-step-detail { display: none; }
  .next-step-actions { flex-direction: column; gap: .5rem; }
  .next-step-actions a.btn-primary { width: 100%; text-align: center; padding: .7rem .75rem; font-size: .9rem; }
}

.provider-header-link {
  color: rgba(255,255,255,.9);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}

.provider-header-link img { display: block; }

/* Fixed-size, centered box around each column's logo/name so every
   header -- image or text -- takes up the same width and height.
   Keeps "Get Quote" aligned across columns and stops the Reverse
   Mortgage column from rendering wider than the HEI provider ones. */
.header-name-slot {
  width: 72px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hecm-header-name {
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

/* Outlined pill on the navy header -- the white counterpart of the
   Eligibility table's .provider-cell .btn-quote button */
.provider-header-link .th-get-quote {
  font-size: .68rem;
  font-weight: 600;
  color: white;
  letter-spacing: .02em;
  white-space: nowrap;
  padding: .15rem .55rem;
  border: 1.5px solid rgba(255,255,255,.7);
  border-radius: 999px;
  transition: background .15s, color .15s;
}

.provider-header-link:hover img { opacity: .85; }
.provider-header-link:hover .th-get-quote { background: white; color: var(--navy); border-color: white; }

/* Splitero/Hometap/Unlock's logos sit visibly higher than Point's and
   Unison's in this white-on-navy header -- same asymmetric-SVG-padding
   issue as the paired compare-page hero (see css/inner.css), just at a
   smaller 24px logo height here. Nudging each down compensates. Shared
   by both calculators that render this table (hei-calculator.html,
   hecm-calculator.html), since both use the same #calc2-head id. */
#calc2-head img[alt="Splitero"] { transform: translateY(4px); }
#calc2-head img[alt="Hometap"]  { transform: translateY(2px); }
#calc2-head img[alt="Unlock"]   { transform: translateY(2px); }

/* ── Info button ─────────────────────────────────────────────────────────── */
.info-btn {
  background: none;
  border: none;
  cursor: help;
  color: rgba(255,255,255,.55);
  font-size: .85rem;
  padding: 0 .2rem;
  line-height: 1;
  vertical-align: middle;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 1000;
  background: #1e2d40;
  color: white;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .82rem;
  max-width: 300px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  pointer-events: none;
  line-height: 1.5;
}

.tooltip-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .25rem 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.tooltip-row:last-child { border-bottom: none; }

.tt-icon     { flex-shrink: 0; font-size: .9rem; margin-top: .05rem; }
.tt-label    { font-weight: 600; font-size: .83rem; }
.tt-detail   { color: #93c5fd; font-size: .76rem; margin-top: .05rem; }

.tt-icon-pass { color: #4ade80; }
.tt-icon-fail { color: #f87171; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  background: var(--navy);
  color: rgba(255,255,255,.55);
  padding: 2.25rem 1.5rem 1.5rem;
  font-size: .79rem;
  line-height: 1.6;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-cols {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.footer-col-title {
  color: white;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .6rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: .4rem; }
.footer-col a, .footer-disclaimers a { color: rgba(255,255,255,.8); text-decoration: none; font-size: .85rem; }
.footer-disclaimers a { font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-col a:hover, .footer-disclaimers a:hover { color: white; text-decoration: underline; }
.footer-col li.footer-view-all { margin-top: .6rem; }
.footer-col li.footer-view-all a { color: white; font-weight: 600; }
.footer-disclaimers { padding-top: 1.25rem; }
.footer-disclaimers p + p { margin-top: .6rem; }
.footer-copyright {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
}
@media (max-width: 900px) {
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .footer-cols { grid-template-columns: repeat(2, 1fr); gap: 1.25rem 1rem; }
}

/* ── Results section gap ─────────────────────────────────────────────────── */
#results:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-margin-top: 76px;
}

/* ── Table fade wrapper ──────────────────────────────────────────────────── */
.table-fade-wrap {
  position: relative;
}

.table-fade-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56px;
  background: linear-gradient(to right, transparent, white);
  pointer-events: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  opacity: 0;
  transition: opacity .2s;
}

/* Show fade only when table overflows (set via JS) */
.table-fade-wrap.is-overflowing::after { opacity: 1; }

/* ── Scroll chevron (alternative to .scroll-hint text) ──────────────────────── */
.scroll-chevron {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  animation: scroll-chevron-nudge 1.4s ease-in-out infinite;
}
.table-fade-wrap.is-overflowing .scroll-chevron { opacity: 1; }
@keyframes scroll-chevron-nudge {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50%      { transform: translateY(-50%) translateX(4px); }
}

/* ── Sticky first column (both tables) ───────────────────────────────────── */
#calc1-table th:first-child,
#calc1-table td:first-child,
#calc2-table th:first-child,
#calc2-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

#calc1-table th:first-child,
#calc2-table th:first-child { background: var(--navy); width: 110px; }

#calc1-table td:first-child,
#calc2-table td:first-child { background: var(--card); width: 110px; }

#calc1-table tbody tr:hover td:first-child,
#calc2-table tbody tr:hover td:first-child { background: #f8fafc; }

/* ── Center-align all data columns (Exit Year, Home Value, providers) ───── */
#calc2-table th,
#calc2-table td {
  text-align: center;
}

/* Center-align Eligibility, Max Term, Cash Available, Est. APR — leave
   Provider (sticky first column) and Key Distinction (variable-length
   sentences, reads better left-aligned) as-is. */
#calc1-table th:nth-child(n+2):nth-child(-n+5),
#calc1-table td:nth-child(n+2):nth-child(-n+5) {
  text-align: center;
}

/* ── Dual column labels (full on desktop, abbreviated on mobile) ─────────── */
.col-label-full   { display: inline; }
.col-label-mobile { display: none; }

/* ── Tap/click wording (desktop says "Click", mobile says "Tap") ─────────── */
.tap-click-desktop { display: inline; }
.tap-click-mobile  { display: none; }

/* ── Form sliders ────────────────────────────────────────────────────────── */
.mobile-slider {
  width: 100%;
  accent-color: var(--navy);
  cursor: pointer;
  height: 4px;
  margin-top: .25rem;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-nav, .btn-nav-cta { display: none; }
  .logo-mark { display: none; }
  .nav-hamburger { display: block; }
  .header-inner { justify-content: space-between; }

  .hero h1   { font-size: 1.5rem; }
  .form-grid { grid-template-columns: 1fr; }

  .badge-icon { display: none; }

  .tap-click-desktop { display: none; }
  .tap-click-mobile  { display: inline; }

  .col-label-full   { display: none; }
  .col-label-mobile { display: inline; }

  /* Shorter "Year" label (vs. "Exit Year") lets the sticky first column
     narrow, freeing width for the data columns next to it. */
  #calc2-table th:first-child,
  #calc2-table td:first-child {
    width: 84px;
    padding-left: .6rem;
    padding-right: .6rem;
  }

  /* Hide Key Distinction column on mobile */
  #calc1-table th:last-child,
  #calc1-table td:last-child { display: none; }

  /* 16px minimum prevents iOS auto-zoom on input focus */
  input, select, .money-input input { font-size: 16px !important; }

  /* Arrow aligns to first line when label wraps */
  .assumptions > summary { align-items: flex-start; }
  .assumptions > summary::before { margin-top: .2rem; }

  .controls-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .proceeds-input,
  #t-slider { width: 100%; }
}

/* Phones in landscape are wider than 640px but still touch devices with
   limited height — keep the hamburger instead of switching to the desktop
   dropdown nav, which doesn't fit and isn't built for touch. */
@media (max-height: 500px) and (max-width: 950px) and (orientation: landscape) {
  .site-nav, .btn-nav-cta { display: none; }
  .logo-mark { display: none; }
  .nav-hamburger { display: block; }
  .header-inner { justify-content: space-between; }
}
