/* ==========================================================================
   Legal & secondary pages (/terms, /privacy, /sms, /404)
   Loaded after styles.css; reuses its tokens, nav, buttons, and footer.
   ========================================================================== */

.legal-main {
  padding: 132px 0 110px;
  position: relative;
  z-index: 1;
}
.legal-doc {
  max-width: 800px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.65;
  color: var(--slate);
}
.legal-doc h1 {
  font-size: clamp(2.3rem, 4.6vw, 3.3rem);
  margin-bottom: 18px;
}
.legal-doc a { text-decoration: underline; text-decoration-color: rgba(99, 102, 241, 0.35); text-underline-offset: 3px; }
.legal-doc a:hover { color: var(--brand-deep); text-decoration-color: var(--brand-deep); }

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  font-size: 0.9rem;
  color: var(--slate);
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 32px;
}
.doc-meta strong { color: var(--ink); font-weight: 600; }
.intro { font-size: 1.05rem; margin-bottom: 34px; }

/* Table of contents */
.toc {
  background: var(--bg-off);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 22px 26px;
  margin-bottom: 52px;
}
.toc-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 12px;
}
.toc ol {
  columns: 2;
  column-gap: 32px;
  list-style: none;
  counter-reset: toc;
  margin: 0;
}
.toc li {
  counter-increment: toc;
  break-inside: avoid;
  font-size: 0.92rem;
  line-height: 1.45;
  padding: 4px 0;
  margin: 0;
}
.toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--slate-light);
  margin-right: 10px;
}
.toc a { color: var(--ink); text-decoration: none; font-weight: 520; }
.toc a:hover { color: var(--brand-deep); }

/* Sections */
.legal-doc section { margin-bottom: 46px; scroll-margin-top: 96px; }
.legal-doc h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin-bottom: 14px;
  padding-top: 4px;
}
.legal-doc h2 .num {
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 500;
  color: var(--slate-light);
  margin-right: 10px;
}
.legal-doc h3 {
  font-size: 1.05rem;
  margin: 22px 0 8px;
}
.legal-doc p { margin-bottom: 14px; }
.legal-doc p:last-child { margin-bottom: 0; }
.legal-doc ul, .legal-doc ol { margin: 0 0 14px 22px; }
.legal-doc li { margin-bottom: 8px; padding-left: 4px; }
.legal-doc li::marker { color: var(--slate-light); }
.legal-doc strong { color: var(--ink); font-weight: 620; }

.callout {
  background: #fff;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 18px 0;
  box-shadow: var(--shadow-sm);
}
.callout p:last-child { margin-bottom: 0; }

.sample-messages { display: grid; gap: 12px; margin: 16px 0; }
.sample {
  background: var(--navy);
  color: #dbe6f5;
  border-radius: 12px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

dl.terms-list dt { font-weight: 620; color: var(--ink); margin-top: 14px; }
dl.terms-list dd { margin: 4px 0 0 0; }

/* Footer legal links */
.footer-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 24px;
}
.footer-legal { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-legal a { font-size: 0.8rem; color: var(--slate); font-weight: 520; }
.footer-legal a:hover { color: var(--brand-deep); }

/* ---------- SMS opt-in form (/sms) ---------- */

.sms-page { max-width: 640px; }
.sms-lead { font-size: 1.08rem; margin-bottom: 30px; }

.consent-card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.field { margin-bottom: 20px; }
.field-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.phone-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(10, 37, 64, 0.18);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.phone-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}
.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--slate);
  font-size: 0.95rem;
  border-right: 1px solid var(--hairline);
  background: var(--bg-off);
  border-radius: 10px 0 0 10px;
  white-space: nowrap;
}
.phone-wrap input[type="tel"] {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.02rem;
  padding: 13px 14px;
  letter-spacing: 0.02em;
}
.phone-wrap input::placeholder { color: var(--slate-light); }
.hint { font-size: 0.82rem; color: var(--slate); margin-top: 8px; }
.field-error, .consent-error {
  display: none;
  font-size: 0.84rem;
  color: #be123c;
  margin-top: 8px;
}
.field.invalid .phone-wrap { border-color: #e11d48; }
.field.invalid .field-error { display: block; }

.program-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 24px 0;
}
.fact {
  background: var(--bg-off);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 14px;
}
.fact-k {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 4px;
}
.fact-v { font-size: 0.88rem; line-height: 1.5; color: var(--ink); }
.fact-v strong { color: var(--brand-deep); }

.consent {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}
.consent:hover { border-color: rgba(10, 37, 64, 0.3); }
.consent.invalid { border-color: #e11d48; }
.consent.invalid + .consent-error { display: block; }
.consent input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1.5px solid rgba(10, 37, 64, 0.35);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: 0.15s;
}
.consent input[type="checkbox"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.consent input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
.consent input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.consent-text { font-size: 0.88rem; line-height: 1.6; color: var(--slate); }
.consent-text a { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 2px; }

.consent-card .btn { width: 100%; justify-content: center; margin-top: 20px; }
.fine-print { margin-top: 18px; font-size: 0.8rem; line-height: 1.6; color: var(--slate); }
.fine-print a { color: var(--brand-deep); }

.success { display: none; text-align: center; padding: 12px 0 4px; }
.success-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--cyan));
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-size: 24px;
  font-weight: 700;
}
.success h2 { font-size: 1.4rem; margin-bottom: 8px; }
.success p { font-size: 0.95rem; }
.success .sample { text-align: left; margin-top: 18px; }
.consent-card.done form { display: none; }
.consent-card.done .success { display: block; }

/* ---------- 404 ---------- */
.notfound { text-align: center; max-width: 560px; }
.notfound h1 { margin-bottom: 14px; }
.notfound p { font-size: 1.05rem; margin-bottom: 28px; }
.notfound .btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 620px) {
  .legal-main { padding: 104px 0 80px; }
  .toc ol { columns: 1; }
  .program-facts { grid-template-columns: 1fr; }
  .consent-card { padding: 22px 18px; }
}

@media print {
  .nav, .footer, .toc { display: none; }
  .legal-main { padding: 0; }
  body::after { display: none; }
}
