/* =========================================================================
   fundamentals.css — long-form Fundamentals template
   ========================================================================= */

/* ===== SET-PIECE HEADER ===== */
.fund-head {
  padding-top: clamp(3rem, 6vw, 5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  position: relative;
  border-bottom: 1px solid var(--border);
}
.fund-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient-frame);
}
.fund-head__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
}
@media (max-width: 980px) {
  .fund-head__grid { grid-template-columns: 1fr; gap: 2rem; }
}
/* Home only: the brand mark fills the open right column of the hero (.fund-head__logo
   is used solely on index.php). Hidden below the 2-col breakpoint. */
.fund-head__logo {
  justify-self: end;
  align-self: center;
  width: 100%;
  max-width: 17rem;
  height: auto;
}
@media (max-width: 980px) { .fund-head__logo { display: none; } }

/* ===== Library catalog (grouped by domain) ===== */
.library-intro {
  font-size: var(--size-body);
  line-height: 1.65;
  max-width: 46rem;
  margin: 0 0 1.5rem;
  color: var(--text-body);
}
.library-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 3rem;
}
.library-jump a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-body);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.library-jump a:hover {
  background: var(--surface-alt);
  color: var(--brand-blue-deep);
  border-color: var(--brand-blue-deep);
}
.library-cat {
  margin-bottom: 3rem;
  scroll-margin-top: 5rem;
}
.library-cat__h {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-heading);
  margin: 0 0 1rem;
}
.library-cat__n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.fund-eyebrow {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.fund-eyebrow__num {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 400;
  color: var(--brand-blue-mark);
  line-height: 1;
}
.fund-eyebrow__series {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.fund-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 380;
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: var(--text-heading);
  margin: 0 0 1.5rem;
  max-width: 18ch;
  text-wrap: balance;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.fund-title em {
  font-style: italic;
  color: var(--brand-blue-deep);
  font-weight: 400;
}

.fund-meta {
  display: grid;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
}
.fund-meta dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.fund-meta dd {
  font-family: var(--font-reading);
  margin: 0 0 0.5rem;
  font-size: var(--size-small);
  color: var(--text-body);
}
.fund-meta dd:last-of-type { margin-bottom: 0; }

/* ===== READING SHELL ===== */
.fund-body {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}
.fund-body__grid {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr) 14rem;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}
@media (max-width: 1100px) {
  .fund-body__grid { grid-template-columns: minmax(0, 1fr); }
  .fund-body__rail--right { display: none; }
}

/* The left rail = sticky TOC */
.fund-toc {
  position: sticky;
  top: 6rem;
  border-top: 2px solid var(--neutral-900);
  padding-top: 1rem;
}
@media (max-width: 1100px) { .fund-toc { position: static; } }
.fund-toc__label {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.fund-toc ol {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: fundtoc;
  display: grid; gap: 0;
}
.fund-toc li { counter-increment: fundtoc; }
.fund-toc a {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-body);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color var(--dur-fast) var(--ease-out);
}
.fund-toc li:last-child a { border-bottom: none; }
.fund-toc a::before {
  content: counter(fundtoc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  align-self: center;
}
.fund-toc a:hover { color: var(--brand-blue-deep); }
.fund-toc a:hover::before { color: var(--brand-blue-deep); }
.fund-toc a.is-active {
  color: var(--brand-blue-deep);
  font-weight: 500;
}
.fund-toc a.is-active::before { color: var(--brand-blue-deep); }

/* The right rail = related, verified, glossary-jumps */
.fund-body__rail--right { display: grid; gap: 1rem; position: sticky; top: 6rem; }

/* ===== READING BODY ===== */
.fund-prose {
  max-width: var(--reading-width);
  margin: 0 auto;
}
.fund-prose .lede {
  font-family: var(--font-reading);
  font-size: clamp(1.2rem, 1.7vw, 1.5rem);
  line-height: 1.45;
  font-weight: 400;
  color: var(--text-heading);
  padding-block: 1.5rem;
  margin-bottom: 2.5rem;
  border-block: 1px solid var(--border);
  position: relative;
  max-width: 38rem;
}
.fund-prose .lede::before {
  content: "";
  position: absolute;
  left: -1px; top: -1px;
  width: 48px; height: 2px;
  background: var(--gradient-frame);
}
.fund-prose h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  margin-block: 3rem 1.25rem;
  line-height: 1.12;
  text-wrap: balance;
  max-width: 22ch;
  font-variation-settings: "opsz" 96;
}
.fund-prose h2 .h2-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.fund-prose h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  margin-block: 2rem 0.75rem;
  letter-spacing: -0.005em;
  line-height: 1.25;
  color: var(--text-heading);
  text-wrap: balance;
}
.fund-prose p {
  font-size: var(--size-body);
  line-height: 1.7;
  margin: 0 0 1.2em;
  max-width: 38rem;
}
.fund-prose p strong { font-weight: 600; }
.fund-prose p em { font-style: italic; }
.fund-prose ul, .fund-prose ol {
  font-size: var(--size-body);
  line-height: 1.65;
  padding-left: 1.4em;
  max-width: 38rem;
  margin-block: 0.75em 1.5em;
}
.fund-prose ul li, .fund-prose ol li { margin-block: 0.4em; }

.fund-prose blockquote {
  margin: 2.5rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 3px solid var(--brand-blue-mark);
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  line-height: 1.35;
  font-style: italic;
  font-weight: 400;
  color: var(--text-heading);
  max-width: 36rem;
  text-wrap: pretty;
}
.fund-prose blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-family: var(--font-reading);
  font-size: var(--size-small);
  font-style: normal;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.fund-prose blockquote cite::before {
  content: "— ";
}

/* Inline glossary term — subtle dotted underline */
.fund-prose a.gloss {
  text-decoration: none;
  border-bottom: 1px dotted var(--brand-blue-mark);
  color: var(--text-body);
  padding-bottom: 1px;
  transition: all var(--dur-fast) var(--ease-out);
}
.fund-prose a.gloss:hover {
  color: var(--brand-blue-deep);
  border-bottom-style: solid;
  border-bottom-color: var(--brand-blue-deep);
}

/* Section break ornaments */
.fund-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block: 3rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
}
.fund-rule::before, .fund-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 5rem;
  margin-inline: 1rem;
}

/* Pull-quote — set-piece break in long prose */
.fund-pullquote {
  margin: 3rem -2rem;
  padding: 2rem 2.5rem;
  background: var(--surface-alt);
  border-block: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 1.875rem);
  line-height: 1.25;
  font-weight: 400;
  color: var(--text-heading);
  position: relative;
  text-wrap: balance;
}
@media (max-width: 700px) { .fund-pullquote { margin-inline: 0; padding-inline: 1.5rem; } }
.fund-pullquote::before {
  content: """;
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--brand-blue-mark);
  opacity: 0.25;
}
.fund-pullquote cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-reading);
  font-size: var(--size-small);
  font-style: normal;
  color: var(--text-muted);
}

/* Callout box — sidebar inside prose */
.fund-callout {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-left: 3px solid var(--brand-blue-mark);
  max-width: 38rem;
}
.fund-callout__label {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-blue-deep);
  margin: 0 0 0.5rem;
}
.fund-callout p:last-child { margin-bottom: 0; }
.fund-callout p { font-size: var(--size-small); line-height: 1.6; }

/* Section divider — major H1-level break */
.fund-section-break {
  margin-block: 4rem;
  padding-top: 2rem;
  border-top: 2px solid var(--neutral-900);
}
.fund-section-break::before {
  display: block;
  content: "";
  width: 32px;
  height: 4px;
  background: var(--gradient-frame);
  margin-bottom: 1.5rem;
}

/* The shortest version recap — for fundamentals */
.fund-prose .recap {
  background: var(--surface-alt);
  border-left: 4px solid var(--brand-blue-mark);
  padding: 1.5rem 1.75rem;
  margin: 3rem 0;
}
.fund-prose .recap__label {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.fund-prose .recap p {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.45;
  margin: 0;
  color: var(--text-heading);
  text-wrap: pretty;
  max-width: none;
}

/* FAQ section at the bottom */
.fund-faq {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 2px solid var(--neutral-900);
}
.fund-faq h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 400;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
.fund-faq__sub {
  font-size: var(--size-small);
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 38rem;
}

/* ===== Related-at-bottom — when the right rail collapses */
.fund-related {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}
.fund-related h3 {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.fund-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--border);
  border-block: 1px solid var(--border-strong);
}
.fund-related a, .fund-related__grid a {
  background: var(--surface);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text-body);
  display: grid;
  gap: 0.35rem;
}
.fund-related a:hover, .fund-related__grid a:hover { background: var(--surface-raised); }
.fund-related a strong, .fund-related__grid a strong {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text-heading);
}
.fund-related a span, .fund-related__grid a span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =========================================================================
   Practical-page additions: stack diagram, steps, cost-breakdown
   ========================================================================= */

/* ===== STACK DIAGRAM ===== */
.fund-stack {
  display: grid;
  gap: 2px;
  margin-block: 2rem;
  max-width: 38rem;
  background: var(--border-strong);
  border: 1px solid var(--border-strong);
}
.fund-stack__layer {
  background: var(--surface-raised);
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1rem;
  align-items: baseline;
}
.fund-stack__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--brand-blue-deep);
  letter-spacing: 0.08em;
}
.fund-stack__name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}
.fund-stack__desc {
  font-size: var(--size-small);
  line-height: 1.5;
  color: var(--text-body);
  margin: 0;
}
.fund-stack__layer:nth-child(1) { border-left: 3px solid var(--layer-1); }
.fund-stack__layer:nth-child(2) { border-left: 3px solid var(--layer-2); }
.fund-stack__layer:nth-child(3) { border-left: 3px solid var(--layer-3); }
.fund-stack__layer:nth-child(4) { border-left: 3px solid var(--layer-4); }

/* ===== STEPS ===== */
.fund-steps {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  gap: 0;
  max-width: 38rem;
  counter-reset: step;
}
.fund-steps li {
  counter-increment: step;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--border);
}
.fund-steps li > *:not(::before) { min-width: 0; }
.fund-steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--brand-blue-deep);
  border: 1px solid var(--brand-blue-mark);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
  display: grid;
  place-items: center;
  letter-spacing: 0;
}
.fund-steps li > div { flex: 1 1 auto; }
.fund-steps__title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text-heading);
  line-height: 1.25;
}
.fund-steps p {
  font-size: var(--size-small);
  line-height: 1.55;
  margin: 0;
  max-width: 36rem;
}

/* ===== COST BREAKDOWN ===== */
.fund-cost {
  width: 100%;
  max-width: 38rem;
  margin-block: 1.5rem;
  border-collapse: collapse;
  font-family: var(--font-reading);
  font-size: var(--size-small);
}
.fund-cost caption {
  font-family: var(--font-mono);
  font-size: var(--size-tiny);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: left;
  padding-bottom: 0.5rem;
}
.fund-cost th,
.fund-cost td {
  text-align: left;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}
.fund-cost th {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  width: 45%;
  color: var(--text-heading);
}
.fund-cost td.tnum {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--brand-blue-deep);
  font-variant-numeric: tabular-nums;
  width: 22%;
  white-space: nowrap;
}
.fund-cost td.note {
  font-size: var(--size-small);
  color: var(--text-muted);
}
.fund-cost tr.total td,
.fund-cost tr.total th {
  border-bottom: 0;
  border-top: 2px solid var(--neutral-900);
  padding-top: 1rem;
  font-weight: 600;
}
