/*
 * Financing page template (page-templates/financing.php).
 * Everything is scoped to .financing-page. Some rules use !important to beat the
 * theme's global typography (e.g. mobile h1-h6 sizes, a:hover underline, ul li bullets).
 */

.financing-page {
  --fin-navy: #16375C;
  --fin-blue: #3B6494;
  --fin-link: #1F4E79;
  --fin-gold: #A87C43;
  --fin-gold-dark: #946B36;
  --fin-text: #3F4A57;
  --fin-border: #D4D8DE;
  --fin-sky: #EDF3F8;
  --fin-sky-2: #E3ECF4;
  --fin-cream: #F7F6F2;
  --fin-white: #fff;
  --fin-radius: 6px;
  --fin-serif: 'Lora', Georgia, serif;
  --fin-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fin-gutter: clamp(16px, 4vw, 48px);
  --fin-header-fallback: 115px; /* mobile header + event bar; used only if JS hasn't run */

  background: var(--fin-white);
  color: var(--fin-text);
  font-family: var(--fin-sans);
  overflow-x: clip;
}

.financing-page *,
.financing-page *::before,
.financing-page *::after {
  box-sizing: border-box;
}

:where(.financing-page) img {
  max-width: 100%;
  height: auto;
}

.financing-page p,
.financing-page li,
.financing-page dd,
.financing-page span,
.financing-page address {
  font-family: var(--fin-sans);
  color: inherit;
  letter-spacing: normal;
}

.financing-page p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}

.financing-page a:not(.fin-btn) {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: var(--fin-link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.financing-page a:not(.fin-btn):hover {
  color: var(--fin-gold);
}

.financing-page a:focus-visible {
  outline: 3px solid var(--fin-gold);
  outline-offset: 3px;
}

.financing-page .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Layout ---------- */

.fin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--fin-gutter);
}

.fin-stack,
.fin-stack-sm {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.fin-stack-sm {
  gap: 10px;
}

.fin-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 40px;
  align-items: start;
}

.fin-split--cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 24px;
}

/* ---------- Typography ---------- */

.financing-page .fin-h1,
.financing-page .fin-h2,
.financing-page .fin-h3,
.financing-page .fin-card__title,
.financing-page .fin-apply__title {
  margin: 0;
  font-family: var(--fin-serif);
  color: var(--fin-navy);
  text-transform: none;
  letter-spacing: normal;
  text-shadow: none;
  text-wrap: balance;
}

.financing-page .fin-h1 {
  font-size: clamp(32px, 5vw, 52px) !important;
  line-height: 1.1 !important;
  font-weight: 700;
}

.financing-page .fin-h2 {
  font-size: clamp(24px, 3.4vw, 36px) !important;
  line-height: 1.2 !important;
  font-weight: 600;
}

.financing-page .fin-h2--xl {
  font-size: clamp(28px, 4vw, 42px) !important;
  line-height: 1.15 !important;
  font-weight: 700;
}

.financing-page .fin-h2--sm {
  font-size: clamp(22px, 2.8vw, 30px) !important;
}

.financing-page .fin-h3 {
  font-size: 22px !important;
  line-height: 1.3 !important;
  font-weight: 600;
}

.financing-page .fin-h3--lg {
  font-size: clamp(22px, 2.4vw, 24px) !important;
}

.financing-page .fin-lead,
.financing-page .fin-lead p {
  font-size: clamp(17px, 1.6vw, 18px);
  line-height: 1.65;
  text-wrap: pretty;
}

.financing-page .fin-lead p + p {
  margin-top: 1em;
}

.fin-prose {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
}

.financing-page .fin-prose p {
  font-size: 17px;
  line-height: 1.65;
}

.financing-page .fin-quote {
  font-family: var(--fin-serif);
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.5;
  color: var(--fin-navy);
  max-width: 900px;
  text-wrap: pretty;
}

/* ---------- Lists (override theme ul/li defaults) ---------- */

.financing-page ul.fin-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.financing-page ul.fin-list li {
  position: relative;
  padding: 0 0 0 20px;
  font-size: 16px;
  line-height: 1.55;
  color: inherit;
  list-style: none;
}

.financing-page ul.fin-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fin-gold);
  display: block;
}

.financing-page ul.fin-list--loose {
  gap: 14px;
}

.financing-page ul.fin-list strong {
  color: var(--fin-navy) !important;
  font-weight: 700;
}

.financing-page ul.fin-list--light li {
  font-size: 17px;
  color: var(--fin-white);
}

.financing-page ul.fin-list--light li::before {
  background: #D9B98A;
}

/* ---------- Buttons ---------- */

.financing-page .fin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 28px;
  border-radius: 3px;
  background: var(--fin-gold);
  color: var(--fin-white);
  font-family: var(--fin-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none !important;
  transition: background-color 0.2s ease;
}

.financing-page .fin-btn:hover,
.financing-page .fin-btn:focus-visible {
  background: var(--fin-gold-dark);
  color: var(--fin-white);
}

.financing-page .fin-btn--lg {
  min-height: 52px;
  padding: 14px 32px;
  font-size: 17px;
  letter-spacing: 0.08em;
  align-self: flex-start;
}

/* ---------- Overview ---------- */

.fin-overview {
  padding: 56px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.fin-overview__intro {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 820px;
}

.fin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

.fin-card {
  background: var(--fin-white);
  border: 1px solid var(--fin-border);
  border-radius: var(--fin-radius);
  box-shadow: 0 10px 30px rgba(22, 55, 92, 0.08);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fin-card__logo {
  height: 64px;
  display: flex;
  align-items: center;
}

.fin-card__logo img {
  width: auto;
  max-height: 60px;
}

.fin-card:nth-child(1) .fin-card__logo img { height: 44px; }
.fin-card:nth-child(2) .fin-card__logo img { height: 36px; }
.fin-card:nth-child(3) .fin-card__logo img { height: 60px; }

.financing-page .fin-card__title {
  font-size: 24px !important;
  line-height: 1.25 !important;
  font-weight: 600;
}

.fin-card__grow {
  flex: 1;
}

.fin-card .fin-btn {
  margin-top: 8px;
  width: 100%;
}

/* ---------- Provider sections ---------- */

.fin-provider {
  /* Clear the fixed site header; --fin-header-h is set by js/financing.js */
  scroll-margin-top: var(--fin-header-h, var(--fin-header-fallback));
  padding: 64px 0 24px;
  margin-top: 40px;
  border-top: 1px solid var(--fin-border);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Cherry hero */
.fin-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 32px;
  align-items: center;
  background: var(--fin-sky);
  border-radius: var(--fin-radius);
  padding: clamp(20px, 4vw, 40px);
}

.fin-hero__text {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.fin-hero__logo {
  height: clamp(44px, 5vw, 60px);
  width: auto;
  align-self: flex-start;
  mix-blend-mode: multiply;
}

.financing-page .fin-hero__amount {
  font-family: var(--fin-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--fin-navy);
  margin-top: 4px;
}

.fin-hero__img {
  display: block;
  width: 100%;
  border-radius: var(--fin-radius);
}

/* Cherry plans table */
.fin-table-wrap {
  border: 1px solid var(--fin-border);
  border-radius: var(--fin-radius);
  overflow: hidden;
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 16px;
}

.fin-table th,
.fin-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  font-family: var(--fin-sans);
}

.fin-table th:nth-child(1) { width: 32%; }
.fin-table th:nth-child(2) { width: 45%; }
.fin-table th:nth-child(3) { width: 23%; }

.fin-table thead th {
  background: var(--fin-navy);
  color: var(--fin-white);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fin-table tbody tr {
  border-top: 1px solid var(--fin-border);
}

.fin-table tbody th {
  color: var(--fin-navy);
  font-weight: 600;
}

.fin-table tbody td {
  color: var(--fin-text);
  font-weight: 400;
}

/* How it works steps */
.financing-page ol.fin-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
}

.financing-page ol.fin-steps li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.financing-page ol.fin-steps li::before {
  display: none;
}

.fin-steps__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fin-sky);
  color: var(--fin-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.financing-page .fin-steps strong {
  font-size: 17px;
  color: var(--fin-navy);
}

.financing-page .fin-steps li > span:last-child {
  font-size: 15px;
  line-height: 1.5;
}

/* CareCredit header */
.fin-cc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.fin-cc-head__logo {
  height: clamp(40px, 6vw, 64px);
  width: auto;
}

.fin-cc-head__card {
  display: block;
  width: clamp(110px, 16vw, 170px);
  filter: drop-shadow(0 8px 16px rgba(22, 55, 92, 0.18));
}

/* Panels */
.fin-panel {
  border: 1px solid var(--fin-border);
  border-radius: var(--fin-radius);
  padding: clamp(24px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.fin-panel--dark {
  background: var(--fin-navy);
  border-color: var(--fin-navy);
  color: var(--fin-white);
}

.financing-page .fin-panel--dark .fin-h3 {
  color: var(--fin-white);
}

/* Key points */
.fin-points {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fin-points--grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px 40px;
}

.fin-point {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 2px solid var(--fin-gold);
}

.financing-page .fin-point strong,
.financing-page .fin-faq dt {
  font-family: var(--fin-sans);
  font-size: 17px;
  font-weight: 700;
  color: var(--fin-navy);
}

.financing-page .fin-point span,
.financing-page .fin-faq dd {
  font-size: 16px;
  line-height: 1.55;
}

/* Advance Care */
.fin-ac-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 40px;
}

.fin-ac-head__logo {
  height: clamp(72px, 9vw, 100px);
  width: auto;
}

.fin-ac-head .fin-h2 {
  flex: 1 1 320px;
}

.financing-page ol.fin-numbered {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 20px;
}

.financing-page ol.fin-numbered li {
  border: 1px solid var(--fin-border);
  border-radius: var(--fin-radius);
  padding: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  font-size: 16px;
  line-height: 1.5;
  list-style: none;
}

.financing-page ol.fin-numbered li::before {
  display: none;
}

.financing-page .fin-numbered__num {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fin-navy);
  color: var(--fin-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 18px/1 var(--fin-serif);
}

.financing-page ol.fin-numbered li > span:last-child {
  align-self: center;
  min-width: 0;
}

.fin-faq {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fin-faq > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--fin-border);
}

.fin-faq > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.fin-faq dd {
  margin: 0;
}

/* ---------- Apply CTA ---------- */

.fin-apply {
  margin-top: 16px;
  background: var(--fin-cream);
  border-radius: var(--fin-radius);
  padding: clamp(24px, 4vw, 44px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 28px 48px;
}

.fin-apply__text {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1 1 320px;
  max-width: 480px;
}

.financing-page .fin-apply__title {
  font-size: clamp(24px, 3vw, 32px) !important;
  line-height: 1.25 !important;
  font-weight: 600;
}

.financing-page .fin-apply__lead {
  font-size: 17px;
  line-height: 1.5;
}

.fin-apply__lead--tap {
  display: none;
}

.fin-apply__qr {
  width: 168px;
  height: 168px;
  object-fit: contain;
  background: var(--fin-white);
  padding: 10px;
  border-radius: var(--fin-radius);
  border: 1px solid var(--fin-border);
}

/* ---------- Questions / help ---------- */

.fin-help {
  position: relative;
  margin: 56px 0 64px;
  background: var(--fin-sky-2);
  border-radius: var(--fin-radius);
  min-height: 200px;
  display: flex;
  align-items: center;
}

.fin-help__text {
  position: relative;
  z-index: 2;
  max-width: 60%;
  padding: 36px clamp(24px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.financing-page a.fin-help__phone {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--fin-link);
}

.financing-page .fin-help__address {
  margin: 0;
  font-style: normal;
  font-size: 16px;
  line-height: 1.5;
}

.fin-help__img {
  position: absolute;
  right: clamp(0px, 4vw, 48px);
  bottom: 0;
  height: calc(100% + 56px);
  max-height: 300px;
  width: auto;
  max-width: none;
  pointer-events: none;
}

/* ---------- Responsive ---------- */

@media (min-width: 992px) {
  .financing-page {
    --fin-header-fallback: 250px;
  }
}

@media (min-width: 1200px) {
  .financing-page {
    --fin-header-fallback: 290px;
  }
}

@media (max-width: 767.98px) {
  .fin-overview {
    padding-top: 32px;
    gap: 28px;
  }

  .fin-provider {
    padding-top: 40px;
    margin-top: 32px;
    gap: 28px;
  }

  .fin-card {
    padding: 24px 20px 20px;
  }

  .fin-split {
    gap: 28px;
  }

  .fin-table th,
  .fin-table td {
    padding: 10px 10px;
    font-size: 15px;
  }

  .fin-table thead th {
    font-size: 12px;
    letter-spacing: 0.02em;
  }

  /* Stack the help banner: text on top, photo below */
  .fin-help {
    flex-direction: column;
    align-items: stretch;
    margin: 40px 0 48px;
    overflow: hidden;
  }

  .fin-help__text {
    max-width: none;
    padding: 28px 20px 8px;
  }

  .fin-help picture {
    display: flex;
    justify-content: center;
  }

  .fin-help__img {
    position: static;
    height: 220px;
    max-width: 100%;
    object-fit: contain;
    object-position: bottom;
  }
}

/* On phones, scanning a QR code on the same screen isn't useful */
@media (max-width: 575.98px) {
  .fin-apply {
    justify-content: flex-start;
  }

  .fin-apply__qr,
  .fin-apply__lead--qr {
    display: none;
  }

  .fin-apply__lead--tap {
    display: inline;
  }

  .financing-page .fin-btn--lg {
    align-self: stretch;
  }

  .fin-ac-head {
    gap: 16px;
  }

  .fin-ac-head .fin-h2 {
    flex-basis: 100%;
  }
}

/* Tablet portrait / phone landscape: shrink the photo and keep the text clear of it */
@media (min-width: 768px) and (max-width: 1099.98px) {
  .fin-help__text {
    max-width: calc(100% - 300px);
  }

  .fin-help__img {
    right: 16px;
    max-height: 250px;
  }
}

/* Tablets: three narrow step cards, so put the number above the text */
@media (min-width: 576px) and (max-width: 991.98px) {
  .financing-page ol.fin-numbered li {
    flex-direction: column;
    gap: 12px;
    padding: 20px 16px;
  }

  .financing-page ol.fin-numbered li > span:last-child {
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:has(.financing-page) {
    scroll-behavior: smooth;
  }
}
