/*
 * Finance Toolkit — tool-doc-minimal.css
 * A clean, minimal theme for the tool page's editorial sections: the description
 * (What it does → Values that may change), the FAQ, and Related tools.
 *
 * Theme-agnostic: surfaces, borders, dividers and muted text are all derived from
 * the inherited text colour via color-mix(currentColor …), so it reads correctly
 * on both light and dark site themes. The only colour literal is a single accent
 * (used for links, markers and heading ticks) — rule 15's spirit: one place.
 */

.ftk-tool-doc,
.ftk-faq,
.ftk-related,
.ftk-data-sources,
.ftk-author {
  --min-accent: var(--theme-palette-color-1, #4f8cff);
  --min-divider: color-mix(in srgb, currentColor 16%, transparent);
  --min-border: color-mix(in srgb, currentColor 14%, transparent);
  --min-surface: color-mix(in srgb, currentColor 5%, transparent);
  --min-muted: color-mix(in srgb, currentColor 65%, transparent);

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.75;
  color: inherit;
}

/* ---- Section headings: icon badge + clean hairline underline ---- */
.ftk-tool-doc h2,
.ftk-faq h2,
.ftk-related h2,
.ftk-data-sources h2,
.ftk-author h2 {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
  margin: 2.3rem 0 1.1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--min-divider);
}
.ftk-tool-doc h2::after,
.ftk-faq h2::after,
.ftk-related h2::after,
.ftk-data-sources h2::after,
.ftk-author h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 44px;
  height: 2px;
  background: var(--theme-palette-color-1, var(--min-accent));
}
/* Themed icon badge before each section heading. */
.ftk-doc-ic {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--theme-palette-color-6, color-mix(in srgb, currentColor 6%, transparent));
  color: var(--theme-palette-color-1, var(--min-accent));
}
.ftk-doc-ic svg { width: 21px; height: 21px; display: block; }

.ftk-tool-doc p { margin: 0 0 1rem; }

/* Inline live-parameter values: a soft highlight, no border. */
.ftk-tool-doc .ftk-doc-param {
  background: var(--min-surface);
  border-radius: 4px;
  padding: 0 5px;
  font-weight: 600;
}

/* ---- The formula: a quiet monospace card ---- */
.ftk-tool-doc .ftk-doc-formula { margin: 0 0 1.2rem; }
.ftk-tool-doc .ftk-doc-formula code {
  display: inline-block;
  background: var(--min-surface);
  border: 1px solid var(--min-border);
  border-radius: 8px;
  padding: 9px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

/* ---- "Where it is used": simple dot markers ---- */
.ftk-tool-doc ul:not(.ftk-doc-variables) {
  list-style: none;
  padding-left: 0;
  margin: 0 0 1.2rem;
}
.ftk-tool-doc ul:not(.ftk-doc-variables) > li {
  position: relative;
  padding-left: 20px;
  margin: 0.5rem 0;
}
.ftk-tool-doc ul:not(.ftk-doc-variables) > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--min-accent);
}

/* ---- Worked example: a light bordered card ---- */
.ftk-tool-doc .ftk-doc-case {
  background: var(--min-surface);
  border: 1px solid var(--min-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0 0 1.4rem;
}
.ftk-tool-doc .ftk-doc-case [data-ftk-cr] { font-weight: 700; }

/* ---- "Values that may change": tidy two-column rows ---- */
.ftk-tool-doc .ftk-doc-variables {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 26px;
}
.ftk-tool-doc .ftk-doc-variables > li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--min-divider);
  font-size: 0.9rem;
}
.ftk-tool-doc .ftk-doc-var-label { color: var(--min-muted); }
.ftk-tool-doc .ftk-doc-var-value { font-weight: 600; }
.ftk-tool-doc .ftk-doc-auto { font-size: 0.85rem; color: var(--min-muted); margin-top: 0.5rem; }

/* ---- FAQ: clean accordion ---- */
.ftk-faq { margin: 2rem 0; }
.ftk-faq-item {
  border-top: 1px solid var(--min-divider);
}
.ftk-faq-item:last-of-type { border-bottom: 1px solid var(--min-divider); }
.ftk-faq-item > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 2px;
  font-weight: 600;
  color: inherit;
}
.ftk-faq-item > summary::-webkit-details-marker { display: none; }
.ftk-faq-item > summary::after {
  content: "+";
  color: var(--min-accent);
  font-size: 1.3rem;
  line-height: 1;
  flex: 0 0 auto;
}
.ftk-faq-item[open] > summary::after { content: "\2013"; }
.ftk-faq-item > div {
  padding: 0 2px 16px;
  color: var(--min-muted);
  line-height: 1.7;
}

/* ---- Related tools: quiet cards that lift on hover ---- */
.ftk-related ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.ftk-related a {
  display: block;
  border: 1px solid var(--min-border);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.ftk-related a:hover {
  border-color: var(--min-accent);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .ftk-tool-doc h2,
  .ftk-faq h2,
  .ftk-related h2,
  .ftk-data-sources h2,
  .ftk-author h2 { font-size: 1.15rem; }
}

/* ---- Data sources & parameters: same card + hairline language as above ---- */
.ftk-data-sources { margin: 2rem 0; }
.ftk-data-sources__intro { margin: 0 0 1.1rem; color: var(--min-muted); }
.ftk-data-sources__method { margin: -0.4rem 0 1.1rem; font-size: 0.9rem; }
.ftk-data-sources__method a { color: var(--min-accent); text-decoration: none; font-weight: 600; }
.ftk-data-sources__scroll {
  overflow-x: auto;
  border: 1px solid var(--min-border);
  border-radius: 10px;
  background: transparent;
}
.ftk-data-sources__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 520px;
}
.ftk-data-sources__table th,
.ftk-data-sources__table td {
  text-align: left;
  padding: 11px 15px;
  vertical-align: top;
  border-bottom: 1px solid var(--min-divider);
}
.ftk-data-sources__table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--min-muted);
}
.ftk-data-sources__table tbody tr:last-child th,
.ftk-data-sources__table tbody tr:last-child td { border-bottom: 0; }
.ftk-data-sources__table th[scope="row"] { font-weight: 600; color: inherit; }
.ftk-src-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ftk-src-muted { color: var(--min-muted); }
.ftk-src-link { color: var(--min-accent); text-decoration: none; overflow-wrap: anywhere; }
.ftk-src-link:hover { text-decoration: underline; }
.ftk-src-date { display: block; font-variant-numeric: tabular-nums; }
.ftk-src-eff { display: block; }
.ftk-src-reason { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--min-muted); line-height: 1.4; }
.ftk-data-sources__disc { margin: 1rem 0 0; font-size: 0.82rem; color: var(--min-muted); }
.ftk-data-sources__reviewed { margin: 0.45rem 0 0; font-size: 0.82rem; color: var(--min-muted); }

/* ---- Author box: same bordered card as the worked example ---- */
.ftk-author { margin: 2rem 0; }
.ftk-author__card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--min-border);
  border-radius: 10px;
  background: transparent;
}
.ftk-author__media { flex: 0 0 auto; }
.ftk-author__img,
.ftk-author__initials {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ftk-author__initials {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--theme-palette-color-8, #fff);
  background: var(--min-accent);
}
.ftk-author__body { flex: 1 1 auto; min-width: 0; }
.ftk-author__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--min-muted);
}
.ftk-author__name { margin: 3px 0 0; font-size: 1.15rem; font-weight: 700; color: inherit; }
.ftk-author__cred { margin: 3px 0 0; font-size: 0.88rem; color: var(--min-muted); }
.ftk-author__bio { margin: 0.7rem 0 0; font-size: 0.92rem; line-height: 1.7; }
.ftk-author__bio p { margin: 0 0 0.5rem; }
.ftk-author__links { margin: 0.8rem 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.ftk-author__profile { font-weight: 600; font-size: 0.86rem; color: var(--min-accent); text-decoration: none; }
.ftk-author__profile:hover { text-decoration: underline; }
.ftk-author__social { font-size: 0.84rem; color: var(--min-accent); text-decoration: none; overflow-wrap: anywhere; }
.ftk-author__social:hover { text-decoration: underline; }
@media (max-width: 480px) {
  .ftk-author__card { flex-direction: column; gap: 12px; }
  .ftk-author__img, .ftk-author__initials { width: 60px; height: 60px; }
}
