/*
  Styles of the shared form (form.js) and the legal footer injected into custom HTML.
  Derived from docs/design/debt-relief-draft.html. Every class is prefixed `lf` so custom HTML
  pages keep their own styles. The theme block of a template page overrides the three
  --lfPrimary* tokens; custom pages use the defaults below.
*/
:root {
  --lfPrimary: #0b6b5d;
  --lfPrimaryDark: #08564b;
  --lfPrimarySoft: #e7f3f0;
  --lfInk: #13201e;
  --lfMuted: #4b5a57;
  --lfLine: #d9e1de;
  --lfBg: #f6f8f7;
  --lfSurface: #ffffff;
  --lfError: #b42318;
  --lfFocus: #1d4ed8;
  --lfRadius: 14px;
  --lfFont: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.lfFlow,
.lfFlow *,
.lfFlow *::before,
.lfFlow *::after,
.lfBtn,
.lfLegalFooter {
  box-sizing: border-box;
}

.lfVisuallyHidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Buttons */
.lfBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 12px;
  background: var(--lfPrimary);
  color: #fff;
  font-family: var(--lfFont);
  font-weight: 650;
  font-size: 18px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}
.lfBtn:hover {
  background: var(--lfPrimaryDark);
}
.lfBtn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.lfBtn:focus-visible,
.lfFlow :focus-visible {
  outline: 3px solid var(--lfFocus);
  outline-offset: 2px;
}
.lfBtnBlock {
  width: 100%;
}
.lfBtnGhost {
  background: transparent;
  color: var(--lfInk);
  min-height: 44px;
  padding: 0 10px;
  font-weight: 550;
  font-size: 16px;
}
.lfBtnGhost:hover {
  background: var(--lfPrimarySoft);
}
.lfBtnGhost[hidden] {
  display: inline-flex;
  visibility: hidden;
}

/* Flow: full screen on phones, centred dialog on larger screens */
.lfFlow {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--lfSurface);
  color: var(--lfInk);
  font-family: var(--lfFont);
  font-size: 17px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  -webkit-text-size-adjust: 100%;
}
.lfFlow[hidden] {
  display: none;
}
.lfScrim[hidden] {
  display: none;
}
.lfFlowBar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 8px;
  border-bottom: 1px solid var(--lfLine);
}
.lfProgress {
  flex: none;
  height: 4px;
  background: var(--lfLine);
}
.lfProgress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--lfPrimary);
  transition: width 0.25s ease;
}
.lfStepCount {
  font-size: 14px;
  color: var(--lfMuted);
}
.lfFlowForm {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}
.lfFlowBody {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  -webkit-overflow-scrolling: touch;
}
.lfFlowFoot {
  flex: none;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--lfLine);
  background: var(--lfSurface);
}
.lfFlow fieldset.lfStep {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.lfStep[hidden],
.lfPanel[hidden] {
  display: none;
}
.lfStepTitle {
  display: block;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  padding: 0;
  margin: 0 0 6px;
}
.lfStepTitle:focus {
  outline: none;
}
.lfHint {
  color: var(--lfMuted);
  font-size: 15px;
  margin: 0 0 18px;
}
.lfGroup {
  margin-bottom: 16px;
}
.lfGroupLabel {
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 8px;
}
.lfOptions {
  display: grid;
  gap: 10px;
}
.lfOption {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  border: 2px solid var(--lfLine);
  border-radius: 12px;
  background: var(--lfSurface);
  color: var(--lfInk);
  font-family: var(--lfFont);
  font-size: 17px;
  font-weight: 550;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.lfOption:hover {
  border-color: #a9bbb6;
}
.lfOption[aria-pressed='true'],
.lfOption:has(input:checked) {
  border-color: var(--lfPrimary);
  background: var(--lfPrimarySoft);
}
.lfOption input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--lfPrimary);
  flex: none;
}
.lfOption:has(input:focus-visible) {
  outline: 3px solid var(--lfFocus);
  outline-offset: 2px;
}
.lfField {
  margin-bottom: 16px;
}
.lfField label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 16px;
}
.lfField input {
  width: 100%;
  height: 56px;
  padding: 0 14px;
  border: 2px solid var(--lfLine);
  border-radius: 12px;
  font-family: var(--lfFont);
  font-size: 18px;
  color: var(--lfInk);
  background: var(--lfSurface);
}
.lfField input:focus {
  border-color: var(--lfPrimary);
}
.lfFlow [aria-invalid='true'] {
  border-color: var(--lfError);
}
.lfError {
  color: var(--lfError);
  font-size: 15px;
  font-weight: 550;
  min-height: 1.5em;
  margin: 6px 0 0;
}
.lfError:empty {
  min-height: 0;
}
.lfConsent {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--lfInk);
  background: var(--lfBg);
  border: 1px solid var(--lfLine);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 10px;
  max-height: 34vh;
  max-height: 34dvh;
  overflow-y: auto;
}
.lfConsent[hidden] {
  display: none;
}
.lfConsent a {
  color: var(--lfPrimary);
}
.lfStatus {
  color: var(--lfError);
  font-size: 15px;
  font-weight: 550;
  margin: 0 0 10px;
}
.lfStatus:empty {
  display: none;
}
.lfTurnstile {
  margin-top: 14px;
}
.lfHoneypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.lfCenter {
  text-align: center;
  padding-top: 40px;
}
.lfSpinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 4px solid var(--lfPrimarySoft);
  border-top-color: var(--lfPrimary);
  animation: lfSpin 0.9s linear infinite;
}
@keyframes lfSpin {
  to {
    transform: rotate(360deg);
  }
}
.lfNoscript {
  font-family: var(--lfFont);
  padding: 16px 20px;
}

/* Inline form (a page without [data-lf-start] buttons) */
.lfFlow.lfInline {
  position: relative;
  inset: auto;
  z-index: auto;
  height: auto;
  max-width: 520px;
  margin: 0 auto;
  border: 1px solid var(--lfLine);
  border-radius: 18px;
  overflow: hidden;
}
.lfInline .lfFlowBody {
  overflow: visible;
}

/* Legal footer injected into custom HTML */
.lfLegalFooter {
  font-family: var(--lfFont);
  font-size: 14px;
  color: var(--lfMuted);
  padding: 24px 20px 32px;
  border-top: 1px solid var(--lfLine);
}
.lfLegalLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-bottom: 10px;
}
.lfLegalLinks a {
  color: var(--lfInk);
  padding: 6px 0;
}

@media (min-width: 760px) {
  .lfFlow:not(.lfInline) {
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 520px;
    height: min(720px, 92vh);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
  }
  .lfScrim {
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(16, 32, 29, 0.55);
  }
  .lfFlowBody {
    padding: 28px 32px;
  }
  .lfFlowFoot {
    padding: 14px 32px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lfFlow *,
  .lfFlow *::before,
  .lfFlow *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Draft preview only (step 4c): the would-be result of a submit, as text. */
.lfPreviewResult {
  max-height: 40vh;
  overflow: auto;
  margin: 8px 0;
  padding: 8px;
  border-radius: 6px;
  background: #f4f6f5;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}
.lfPreviewResult[hidden] {
  display: none;
}
