/* Total Trust Home Loans — shared styles for the long-form content pages
   (Learning Center + FAQ). Loads AFTER styles.css and heloc.css and reuses
   their tokens and components (.note, table.ex, .ex-section, .ex-reveal…)
   rather than redefining them. Additive only. */

/* ---------------------------------------------------------------- hero */
.doc-hero {
  background: linear-gradient(168deg, var(--navy-deep) 0%, var(--navy) 64%, #17507c 100%);
  color: #fff;
  padding: var(--band) 0;
}
.doc-hero h1 { color: #fff; max-width: 20ch; }
.doc-hero .eyebrow { color: #8fc4ea; }
.doc-hero .lede {
  font-size: clamp(1.02rem, 1.9vw, 1.18rem);
  color: #dbe9f5; max-width: 66ch; margin-top: var(--s-3);
}
.doc-hero .accent { color: #7dc0ee; }

.doc-hero-stats {
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  margin-top: var(--s-5); padding-top: var(--s-4);
  border-top: 1px solid rgba(255,255,255,.16);
}
.doc-hero-stat strong {
  display: block; font-family: var(--font-head); font-weight: 800;
  font-size: 1.7rem; color: #fff; line-height: 1.1;
}
.doc-hero-stat span { font-size: .84rem; color: #a9c8e0; }

/* ---------------------------------------------------- two-column layout */
.doc-layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 960px) { .doc-layout { grid-template-columns: 1fr; } }

.doc-toc {
  position: sticky; top: 92px; align-self: start;
  max-height: calc(100vh - 120px); overflow-y: auto;
  padding-right: .4rem;
}
@media (max-width: 960px) {
  .doc-toc {
    position: static; max-height: none; margin-bottom: var(--s-5);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s-3) var(--s-4); background: #fff;
  }
}
.doc-toc-title {
  font-family: var(--font-head); font-weight: 800; font-size: .74rem;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted);
  margin-bottom: var(--s-2);
}
.doc-toc ul { list-style: none; }
.doc-toc li { margin-bottom: .1rem; }
.doc-toc a {
  display: block; padding: .42rem .7rem; border-radius: 8px;
  font-size: .89rem; font-weight: 600; color: var(--muted);
  border-left: 3px solid transparent; text-decoration: none; line-height: 1.35;
}
.doc-toc a:hover { background: var(--bg-alt); color: var(--navy); text-decoration: none; }
.doc-toc a.is-current {
  background: var(--sky-soft); color: var(--navy); border-left-color: var(--sky);
}
.doc-toc .toc-sub a { padding-left: 1.4rem; font-size: .84rem; font-weight: 500; }

/* --------------------------------------------------------- content body */
.doc-body > section { scroll-margin-top: 90px; padding-bottom: var(--band-tight); }
.doc-body > section + section {
  border-top: 1px solid var(--line); padding-top: var(--band-tight);
}
.doc-body h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.95rem); margin-bottom: var(--s-3);
  scroll-margin-top: 90px;
}
.doc-body h3 {
  font-size: 1.12rem; margin-top: var(--s-4); margin-bottom: var(--s-2);
  color: var(--navy);
}
.doc-body p { margin-bottom: var(--s-3); max-width: 74ch; }
.doc-body ul, .doc-body ol { margin: 0 0 var(--s-3) 1.15rem; max-width: 74ch; }
.doc-body li { margin-bottom: .42rem; }
.doc-intro { font-size: 1.05rem; color: var(--muted); max-width: 72ch; }

/* --------------------------------------------------------- program card */
.prog {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--pad-card); box-shadow: var(--shadow); margin-bottom: var(--s-4);
}
.prog-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-2);
}
.prog-head h3 { margin: 0; font-size: 1.3rem; }
.prog-tag {
  font-family: var(--font-head); font-weight: 700; font-size: .72rem;
  letter-spacing: .08em; text-transform: uppercase;
  background: var(--sky-soft); color: var(--navy);
  padding: .3rem .65rem; border-radius: 999px; white-space: nowrap;
}
.prog-sub { color: var(--muted); font-size: .95rem; margin-bottom: var(--s-3); }

.prog-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-2); margin: var(--s-3) 0;
  background: var(--bg-alt); border-radius: 10px; padding: var(--s-3);
}
.prog-fact strong {
  display: block; font-family: var(--font-head); font-size: .95rem; color: var(--navy);
}
.prog-fact span {
  display: block; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: .15rem;
}

.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-3); }
@media (max-width: 700px) { .pros-cons { grid-template-columns: 1fr; } }
.pros-cons h4 {
  font-family: var(--font-head); font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: var(--s-2);
}
.pros-cons .pc-yes h4 { color: var(--good); }
.pros-cons .pc-no h4 { color: var(--bad); }
.pros-cons ul { list-style: none; margin: 0; }
.pros-cons li { padding-left: 1.5rem; position: relative; font-size: .93rem; margin-bottom: .45rem; }
.pros-cons li::before { position: absolute; left: 0; font-weight: 800; font-family: var(--font-head); }
.pc-yes li::before { content: "\2713"; color: var(--good); }
.pc-no li::before { content: "\2715"; color: var(--bad); }

/* ------------------------------------------------- comparison mega-table */
.cmp-wrap { overflow-x: auto; margin: var(--s-4) 0; border-radius: var(--radius); }
table.cmp {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: .88rem; background: #fff; min-width: 900px;
}
table.cmp th, table.cmp td {
  padding: .7rem .8rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
table.cmp thead th {
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 2;
  font-family: var(--font-head); font-weight: 700; font-size: .8rem;
  letter-spacing: .03em;
}
table.cmp tbody th {
  background: var(--bg-alt); position: sticky; left: 0; z-index: 1;
  font-family: var(--font-head); font-weight: 700; color: var(--navy);
  font-size: .86rem; white-space: nowrap;
  box-shadow: 1px 0 0 var(--line);
}
table.cmp tbody tr:hover td { background: var(--sky-soft); }
table.cmp td.y { color: var(--good); font-weight: 700; }
table.cmp td.n { color: var(--bad); font-weight: 700; }
.cmp-hint { font-size: .82rem; color: var(--muted); margin-top: -.4rem; }

/* ------------------------------------------------------------- FAQ items */
.faq-tools {
  display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--s-4);
}
.faq-search {
  flex: 1 1 280px; position: relative;
}
.faq-search input {
  width: 100%; padding: .8rem 1rem .8rem 2.5rem;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: .98rem; background: #fff;
}
.faq-search input:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.faq-search::before {
  content: "\1F50D"; position: absolute; left: .85rem; top: 50%;
  transform: translateY(-50%); font-size: .95rem; opacity: .5;
}
.faq-count { font-size: .87rem; color: var(--muted); font-weight: 600; }

.faq-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: var(--s-4); }
.faq-chip {
  font-family: var(--font-head); font-weight: 700; font-size: .78rem;
  padding: .42rem .85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  transition: all .15s ease;
}
.faq-chip:hover { border-color: var(--sky); color: var(--navy); }
.faq-chip.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }

details.faq {
  border: 1px solid var(--line); border-radius: 11px; background: #fff;
  margin-bottom: .55rem; overflow: hidden;
}
details.faq > summary {
  cursor: pointer; list-style: none; padding: .95rem 1.15rem .95rem 2.4rem;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  color: var(--navy); position: relative; line-height: 1.4;
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::before {
  content: "+"; position: absolute; left: 1.05rem; top: .95rem;
  color: var(--sky); font-size: 1.15rem; font-weight: 800; line-height: 1.35;
}
details.faq[open] > summary::before { content: "\2013"; }
details.faq[open] > summary { background: var(--bg-alt); }
details.faq > summary:hover { background: var(--sky-soft); }
.faq-a { padding: var(--s-3) 1.15rem var(--s-4) 2.4rem; }
.faq-a p { margin-bottom: var(--s-2); max-width: 72ch; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a ul { margin: 0 0 var(--s-2) 1.1rem; max-width: 72ch; }
.faq-a li { margin-bottom: .35rem; }
.faq-empty {
  text-align: center; padding: var(--s-6) var(--s-3); color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ----------------------------------------------------------- glossary */
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-3); }
.gloss {
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: var(--s-3);
}
.gloss dt { font-family: var(--font-head); font-weight: 700; color: var(--navy); margin-bottom: .25rem; }
.gloss dd { font-size: .9rem; color: var(--muted); margin: 0; }

/* --------------------------------------------------------- cross-links */
.xlinks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-3); margin-top: var(--s-4); }
.xlink {
  display: block; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--pad-card);
  text-decoration: none; transition: transform .18s ease, box-shadow .18s ease;
}
.xlink:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.xlink strong { display: block; font-family: var(--font-head); color: var(--navy); font-size: 1.05rem; margin-bottom: .3rem; }
.xlink span { font-size: .9rem; color: var(--muted); }
.xlink em { display: block; margin-top: .6rem; color: var(--sky); font-style: normal; font-weight: 700; font-size: .88rem; }

/* --------------------------------------------------------- back to top */
.to-top {
  position: fixed; right: max(1.1rem, 2vw); bottom: 1.4rem; z-index: 45;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--navy); color: #fff; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 1.1rem;
  box-shadow: 0 8px 22px rgba(17,58,92,.32);
  opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .3s ease;
  transform: translateY(8px);
}
.to-top.is-on { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { background: var(--sky); }

/* ---------------------------------------------------------- disclaimer */
.doc-disclaimer {
  font-size: .84rem; color: var(--muted); background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--pad-card); margin-top: var(--s-5);
}
.doc-disclaimer strong { color: var(--navy); }
.doc-disclaimer p { margin-bottom: var(--s-2); max-width: none; }
.doc-disclaimer p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .xlink:hover { transform: none; }
  .to-top { transition: none; }
}

/* screen-reader-only utility (used by the FAQ search label) */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
