/* ─── Tokens ─────────────────────────────────────────────────── */
:root {
  --color-teal: #1a8787;
  --color-amber: #f0a040;
  --color-slate: #476178;
  --color-link: #2a9090;
  --color-footer-bg: #f2f2f0;
  --color-footer-dark: #2a5060;
  --color-border: #ebebeb;

  --font-main: "Poppins", sans-serif;
  --container-max: 1100px;
  --radius-pill: 50px;
  --radius-circle: 50%;
}

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

body {
  font-family: var(--font-main);
  background: linear-gradient(
      to bottom,
      rgb(238, 248, 250) 0%,
      rgb(254, 254, 254) 30%,
      rgb(238, 248, 250) 70%
    )
    no-repeat fixed;
  color: var(--color-slate);
  font-size: 17px;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ─── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Header ──────────────────────────────────────────────────── */
.site-header {
  background: transparent;
  padding: 26px 0;
  border-bottom: 1px solid var(--color-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-logo {
  height: 120px;
  width: auto;
  display: block;
}
.site-logo-link {
  text-decoration: none;
}
.site-logo-text {
  font-family: "Poppins", system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: #0d9488;
}

.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 32px;
}
.main-nav a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-slate);
  transition: color 0.15s;
}
.main-nav a:hover {
  color: var(--color-teal);
}
.main-nav a.nav-current {
  color: var(--color-teal);
}

.btn-apply {
  background: var(--color-amber);
  color: #fff;
  width: 65px;
  height: 65px;
  border-radius: var(--radius-circle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: opacity 0.15s;
}
.btn-apply:hover {
  opacity: 0.88;
}

/* ─── Main ────────────────────────────────────────────────────── */
.site-main {
  padding: 80px 0 96px;
}

.site-main h1 {
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--color-slate);
  margin-bottom: 40px;
}

.contact-block {
  margin-bottom: 40px;
}

.contact-question {
  font-weight: 700;
  color: var(--color-teal);
  margin-bottom: 8px;
}

.contact-block p {
  margin-bottom: 0;
  font-size: 1rem;
}

.contact-block a {
  color: var(--color-link);
  transition: text-decoration 0.1s;
}
.contact-block a:hover {
  text-decoration: underline;
}

/* ─── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: transparent;
  padding: 52px 0 40px;
}

/* Logo (left) + CTA circles (right) on the same row */
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.footer-logo img {
  height: 148px;
  width: auto;
}
.footer-logo-text {
  font-family: "Poppins", system-ui, sans-serif;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.01em;
  color: #0d9488;
}

.footer-ctas {
  display: flex;
  gap: 24px;
}

.footer-cta {
  width: 158px;
  height: 158px;
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  text-align: center;
  line-height: 1.35;
  transition:
    transform 0.18s,
    opacity 0.18s;
}
.footer-cta:hover {
  transform: scale(1.06);
  opacity: 0.93;
}
.footer-cta--amber {
  background: var(--color-amber);
}
.footer-cta--teal {
  background: var(--color-teal);
}
.footer-cta--dark {
  background: var(--color-footer-dark);
}

/* Legal text: full width, left-aligned */
.footer-legal {
  font-size: 0.78rem;
  color: #777;
  line-height: 1.55;
  margin-bottom: 24px;
}

/* Policy links (left) + social icons (right) */
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  font-size: 0.82rem;
}
.footer-links a {
  color: var(--color-link);
}
.footer-links a:hover {
  text-decoration: underline;
}
.footer-links span {
  margin: 0 8px;
  color: #aaa;
}

.footer-social {
  display: flex;
  gap: 12px;
}
.social-link {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: opacity 0.15s;
}
.social-link:hover {
  opacity: 0.82;
}
.social-link--facebook {
  background: #1877f2;
}
.social-link--twitter {
  background: #1da1f2;
}
.social-link--instagram {
  background: #e1306c;
}
.social-link--linkedin {
  background: #0a66c2;
}
.social-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.social-link svg path[fill="currentColor"] {
  fill: currentColor;
  stroke: none;
}

/* ─── Context-aware contact reveal ──────────────────────────── */
#contact-section[data-revealed] .contact-block {
  opacity: 0.3;
  filter: grayscale(0.35);
  transition:
    opacity 400ms ease,
    filter 400ms ease,
    background 400ms ease,
    box-shadow 400ms ease;
}

#contact-section[data-revealed="vulnerability"]
  .contact-block[data-type="vulnerability"],
#contact-section[data-revealed="handoff"]
  .contact-block[data-type="update-settle"],
#contact-section[data-revealed="general"] .contact-block[data-type="new-loan"] {
  opacity: 1;
  filter: none;
  border-left: 4px solid var(--color-teal);
  padding: 16px 20px;
  border-radius: 8px;
  background: rgb(26 135 135 / 10%);
  box-shadow: 0 4px 20px rgb(26 135 135 / 18%);
}

/* Label above the question for the promoted block */
#contact-section[data-revealed="vulnerability"]
  .contact-block[data-type="vulnerability"]
  .contact-question::before,
#contact-section[data-revealed="handoff"]
  .contact-block[data-type="update-settle"]
  .contact-question::before,
#contact-section[data-revealed="general"]
  .contact-block[data-type="new-loan"]
  .contact-question::before {
  content: "Relevant to your query";
  display: block;
  margin-bottom: 4px;
  color: var(--color-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Demo controls ──────────────────────────────────────────── */
#mal-demo-controls {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10000;
  padding: 14px 16px;
  border: 1px solid #cad4d9;
  border-radius: 8px;
  background: #ffffff;
  font-family: var(--font-main);
  font-size: 13px;
  color: #172026;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  min-width: 200px;
}

#mal-demo-controls p {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #577267;
}

#mal-demo-controls .demo-state {
  margin: 0 0 12px;
  font-size: 12px;
  color: #41535a;
}

#mal-demo-controls button {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 10px;
  border: 1px solid #cbd9d5;
  border-radius: 6px;
  background: #ffffff;
  color: #172026;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}

#mal-demo-controls button:hover {
  border-color: #1f6f78;
  background: #eef7f6;
}

#mal-demo-controls button:last-child {
  margin-bottom: 0;
  color: #9a3412;
  border-color: #f0c0b0;
}

#mal-demo-controls button:last-child:hover {
  background: #fff4f2;
}

/* ─── Launcher idle glow ─────────────────────────────────────── */
@keyframes launcher-glow {
  0%,
  100% {
    box-shadow:
      0 4px 20px rgba(0, 0, 0, 0.28),
      0 0 6px 0 rgba(26, 135, 135, 0.55);
  }
  50% {
    box-shadow:
      0 4px 20px rgba(0, 0, 0, 0.28),
      0 0 22px 6px rgba(26, 135, 135, 0.18);
  }
}

#mal-launcher {
  animation: launcher-glow 2.6s ease-in-out infinite;
}

/* ─── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  .container {
    padding: 0 16px;
  }

  /* Header: logo on its own row, nav wraps full width beneath it. */
  .site-header {
    padding: 16px 0;
  }
  .site-header .container {
    flex-wrap: wrap;
    gap: 12px;
  }
  .site-logo-text {
    font-size: 22px;
  }
  .main-nav {
    order: 3;
    width: 100%;
  }
  .main-nav ul {
    flex-wrap: wrap;
    gap: 10px 16px;
  }
  .main-nav a {
    font-size: 0.85rem;
  }
  .btn-apply {
    width: 48px;
    height: 48px;
    font-size: 0.7rem;
  }

  .site-main {
    padding: 36px 0 56px;
  }
  .site-main h1 {
    font-size: 1.8rem;
    margin-bottom: 24px;
  }
  .contact-block {
    margin-bottom: 28px;
  }

  /* Footer: stack logo above the CTA circles; shrink circles to fit a row. */
  .site-footer {
    padding: 36px 0 32px;
  }
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
  }
  .footer-logo-text {
    font-size: 30px;
  }
  .footer-ctas {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }
  .footer-cta {
    width: 30%;
    max-width: 110px;
    height: auto;
    aspect-ratio: 1 / 1;
    font-size: 0.72rem;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/* ─── Engine internals devtools panel (?devtools=true) ──────────── */
#sm-devtools {
  --sm-teal: #1a8787;
  --sm-amber: #e08a2b;
  --sm-rose: #cf5168;
  --sm-plum: #8d6fb0;
  --sm-slate: #6b8190;
  --sm-line: #d3dfe2;
  --sm-ink: #294049;
  position: fixed;
  left: 24px;
  top: 84px;
  bottom: 24px;
  right: 540px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
  border: 1px solid #e3ebed;
  border-radius: 16px;
  box-shadow: 0 14px 48px rgba(20, 70, 80, 0.18);
  font-family: var(--font-main);
  color: var(--sm-ink);
  overflow: hidden;
}

.sm-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #eef3f4;
}
.sm-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sm-teal);
  margin-bottom: 4px;
}
.sm-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sm-title-row h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-slate);
}
.sm-turn {
  font-size: 12px;
  font-weight: 600;
  color: var(--sm-slate);
  white-space: nowrap;
}

.sm-banner {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.3;
}
.sm-banner-idle {
  background: #f3f7f8;
  color: var(--sm-slate);
}
.sm-banner-aligned {
  background: rgba(26, 135, 135, 0.1);
  color: var(--sm-teal);
}
.sm-banner-changed {
  background: rgba(207, 81, 104, 0.1);
  color: var(--sm-rose);
}
.sm-banner-tag {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
}
.sm-banner-flow {
  font-weight: 700;
  color: var(--sm-ink);
}
.sm-banner-flow em {
  font-style: normal;
  opacity: 0.55;
  padding: 0 2px;
}
.sm-banner-reason {
  color: var(--sm-ink);
  opacity: 0.78;
}

.sm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px 0;
}
.sm-serving {
  font-size: 12px;
  font-weight: 700;
}
.sm-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sm-flag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(207, 81, 104, 0.12);
  color: var(--sm-rose);
}
.sm-flag-none {
  background: #eef3f4;
  color: var(--sm-slate);
}

.sm-serving.tone-teal {
  color: var(--sm-teal);
}
.sm-serving.tone-amber {
  color: var(--sm-amber);
}
.sm-serving.tone-plum {
  color: var(--sm-plum);
}
.sm-serving.tone-rose {
  color: var(--sm-rose);
}
.sm-serving.tone-slate {
  color: var(--sm-slate);
}

.sm-body {
  flex: 1;
  min-height: 0;
  padding: 8px 12px 4px;
}
.sm-body.sm-flash {
  animation: sm-flash 0.5s ease;
}
@keyframes sm-flash {
  from {
    background: rgba(26, 135, 135, 0.06);
  }
  to {
    background: transparent;
  }
}
.sm-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sm-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 16px 12px;
  border-top: 1px solid #eef3f4;
  font-size: 11px;
  color: var(--sm-slate);
}
.sm-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

/* nodes */
.sm-rect {
  fill: #ffffff;
  stroke: var(--sm-line);
  stroke-width: 1.5;
  transition:
    stroke 0.25s,
    fill 0.25s;
}
.sm-title {
  fill: var(--sm-ink);
  font-size: 14px;
  font-weight: 600;
  text-anchor: middle;
}
.sm-sub {
  fill: var(--sm-slate);
  font-size: 11.5px;
  text-anchor: middle;
}
.sm-node.sm-idle .sm-rect {
  stroke: var(--sm-line);
  fill: #fbfdfd;
}
.sm-node.sm-idle .sm-title {
  fill: #9aabb1;
}
.sm-node.sm-idle .sm-sub {
  fill: #b3c1c5;
}
.sm-node.sm-active.tone-teal .sm-rect {
  stroke: var(--sm-teal);
  fill: rgba(26, 135, 135, 0.08);
}
.sm-node.sm-active.tone-amber .sm-rect {
  stroke: var(--sm-amber);
  fill: rgba(224, 138, 43, 0.1);
}
.sm-node.sm-active.tone-rose .sm-rect {
  stroke: var(--sm-rose);
  fill: rgba(207, 81, 104, 0.09);
}
.sm-node.sm-active.tone-plum .sm-rect {
  stroke: var(--sm-plum);
  fill: rgba(141, 111, 176, 0.1);
}
.sm-node.sm-active.tone-slate .sm-rect {
  stroke: var(--sm-slate);
  fill: rgba(107, 129, 144, 0.07);
}

/* terminals */
.sm-term .sm-title {
  font-size: 13px;
}
.sm-term.sm-active .sm-rect {
  stroke-width: 2;
}
.sm-term.sm-active.tone-teal .sm-rect {
  filter: drop-shadow(0 0 6px rgba(26, 135, 135, 0.4));
}
.sm-term.sm-active.tone-amber .sm-rect {
  filter: drop-shadow(0 0 6px rgba(224, 138, 43, 0.4));
}
.sm-term.sm-active.tone-rose .sm-rect {
  filter: drop-shadow(0 0 6px rgba(207, 81, 104, 0.4));
}
.sm-term.sm-active.tone-plum .sm-rect {
  filter: drop-shadow(0 0 6px rgba(141, 111, 176, 0.4));
}
.sm-term.sm-active .sm-title {
  fill: var(--sm-ink);
  font-weight: 700;
}

/* validator band + guards */
.sm-band {
  fill: #f6f9fa;
  stroke: #e2ebed;
  stroke-width: 1.2;
}
.sm-band-label {
  fill: var(--sm-slate);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.sm-chip {
  fill: #ffffff;
  stroke: var(--sm-line);
  stroke-width: 1.3;
  transition:
    stroke 0.25s,
    fill 0.25s;
}
.sm-chip-label {
  fill: #8194a0;
  font-size: 11.5px;
  font-weight: 600;
  text-anchor: middle;
}
.sm-guard.sm-idle .sm-chip {
  fill: #fbfdfd;
  stroke: #dde7e9;
}
.sm-guard.sm-fired .sm-chip-label {
  fill: var(--sm-ink);
  font-weight: 700;
}
.sm-guard.sm-fired.tone-rose .sm-chip {
  stroke: var(--sm-rose);
  fill: rgba(207, 81, 104, 0.12);
  animation: sm-pulse 1.1s ease-in-out infinite;
}
.sm-guard.sm-fired.tone-amber .sm-chip {
  stroke: var(--sm-amber);
  fill: rgba(224, 138, 43, 0.12);
  animation: sm-pulse 1.1s ease-in-out infinite;
}
.sm-guard.sm-fired.tone-plum .sm-chip {
  stroke: var(--sm-plum);
  fill: rgba(141, 111, 176, 0.12);
  animation: sm-pulse 1.1s ease-in-out infinite;
}
.sm-guard.sm-fired.tone-slate .sm-chip {
  stroke: var(--sm-slate);
  fill: rgba(107, 129, 144, 0.1);
}
.sm-guard.sm-fired.tone-teal .sm-chip {
  stroke: var(--sm-teal);
  fill: rgba(26, 135, 135, 0.1);
}
@keyframes sm-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* edges */
.sm-edge {
  stroke: #d7e1e4;
  stroke-width: 1.6;
  fill: none;
  transition: stroke 0.25s;
}
.sm-edge.sm-idle {
  stroke: #e3ebed;
}
.sm-edge.sm-active {
  stroke-width: 2;
  stroke-dasharray: 5 5;
  animation: sm-flow 0.8s linear infinite;
}
.sm-edge.sm-active.tone-teal {
  stroke: var(--sm-teal);
}
.sm-edge.sm-active.tone-amber {
  stroke: var(--sm-amber);
}
.sm-edge.sm-active.tone-rose {
  stroke: var(--sm-rose);
}
.sm-edge.sm-active.tone-plum {
  stroke: var(--sm-plum);
}
.sm-edge.sm-active.tone-slate {
  stroke: var(--sm-slate);
}
@keyframes sm-flow {
  to {
    stroke-dashoffset: -20;
  }
}

@media (max-width: 1180px) {
  #sm-devtools {
    right: auto;
    width: min(92vw, 680px);
  }
}
@media (max-width: 760px) {
  #sm-devtools {
    left: 12px;
    right: 12px;
    top: 70px;
    width: auto;
  }
}
