/* ============================================================
   AYL — KNOWLEDGE BASE (archive-knowledge_base.php)
   Layout ported faithfully from the mockup (pages-10-13.html,
   Page 11). Content sourced from the live site glossary.
   Terms use native <details>/<summary> for expand/collapse —
   no JavaScript. Shared primitives come from base.css/components.css.

   Sections:
     1. Hero + meta
     2. Search shell + A–Z jump nav
     3. Glossary content (letter sections + term cards)
   ============================================================ */


/* ===================== 1. HERO + META ===================== */
.kb-hero { background: var(--cream); padding: 7rem var(--gutter) 4rem; }
.kb-hero-inner { max-width: var(--container-max); margin: 0 auto; }
.kb-hero h1 { font-size: clamp(2.8rem, 6.5vw, 5rem); margin: 2rem 0 3rem; max-width: 900px; line-height: 0.98; }
.kb-hero h1 .accent-line { color: var(--terracotta); }
.kb-hero-bottom {
  display: grid; grid-template-columns: 1.3fr 1fr;
  gap: 5rem; align-items: end; padding-top: 2rem; border-top: 1px solid var(--rule);
}
.kb-hero-bottom p { color: var(--espresso); line-height: 1.7; font-size: 1.05rem; max-width: 560px; }
.kb-meta { text-align: right; }
.kb-meta .label { font-size: 0.65rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--copper); margin-bottom: 0.5rem; }
.kb-meta .num { font-family: var(--font-display); font-size: 2.5rem; color: var(--terracotta); font-weight: 300; line-height: 1; }
.kb-meta .sub { color: var(--espresso); font-size: 0.85rem; margin-top: 0.5rem; letter-spacing: 0.05em; }


/* ===================== 2. SEARCH + A–Z FILTER ===================== */
.kb-search {
  background: var(--cream-warm); padding: 2.5rem var(--gutter);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.kb-search-inner { max-width: var(--container-max); margin: 0 auto; }
.kb-search-bar { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }
.kb-search-input {
  flex-grow: 1; background: var(--cream); border: 1px solid var(--rule-strong);
  padding: 1rem 1.5rem; font-family: var(--font-body); font-size: 0.95rem;
  color: var(--forest); outline: none; transition: border-color 0.3s;
}
.kb-search-input:focus { border-color: var(--terracotta); }
.kb-search-input::placeholder { color: var(--olive); }
.kb-search-btn {
  background: var(--forest); color: var(--cream); border: none; padding: 1rem 2rem;
  font-family: var(--font-body); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer; transition: background 0.3s;
}
.kb-search-btn:hover { background: var(--terracotta); }
.kb-az { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.kb-az .label { font-size: 0.65rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--espresso); margin-right: 1rem; }
.kb-az a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; color: var(--forest); text-decoration: none;
  font-family: var(--font-display); font-size: 0.95rem; transition: all 0.3s; border: 1px solid transparent;
}
.kb-az a:hover { border-color: var(--terracotta); color: var(--terracotta); }
.kb-az a.active { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.kb-az a.disabled { color: rgba(24,33,28,0.3); pointer-events: none; }


/* ===================== 3. GLOSSARY CONTENT ===================== */
.kb-content { background: var(--cream); padding: 5rem var(--gutter) 8rem; }
.kb-content-inner { max-width: var(--container-max); margin: 0 auto; }
.kb-letter-section { margin-bottom: 5rem; scroll-margin-top: 1rem; }
.kb-letter {
  font-family: var(--font-display); font-size: 5rem; color: var(--terracotta);
  font-weight: 300; line-height: 1; margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule-strong); padding-bottom: 1.5rem;
}
.kb-letter-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 2rem; margin-top: -3rem; padding-bottom: 1.5rem; padding-left: 4rem;
}
.kb-letter-meta .count { font-size: 0.7rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--olive); }
.kb-terms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 1px solid var(--rule); }

/* Term card = native <details>. */
.kb-term {
  padding: 2rem 2.5rem;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  background: var(--cream); transition: background 0.3s;
}
.kb-term:nth-child(2n) { border-right: none; }
.kb-term:hover { background: var(--cream-warm); }

.kb-term-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 1rem; cursor: pointer; list-style: none;
}
.kb-term-head::-webkit-details-marker { display: none; }
.kb-term-head::marker { content: ''; }
.kb-term h3 { font-size: 1.3rem; font-weight: 400; line-height: 1.2; margin: 0; display: inline; }
.kb-term .term-abbr { font-family: var(--font-display); font-style: italic; color: var(--copper); font-size: 0.85rem; margin-left: 0.5rem; }
.kb-term .toggle { font-family: var(--font-display); color: var(--olive); font-size: 1.2rem; transition: transform 0.3s; flex-shrink: 0; margin-left: 1rem; }
.kb-term[open] .toggle { transform: rotate(45deg); }

.kb-term-content { padding-top: 1rem; border-top: 1px solid var(--rule); }
.kb-term-content .field { margin-bottom: 1rem; }
.kb-term-content .field:last-child { margin-bottom: 0; }
.kb-term-content .field-label { font-size: 0.65rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--copper); display: block; margin-bottom: 0.4rem; }
.kb-term-content .field-value { color: var(--espresso); font-size: 0.9rem; line-height: 1.65; }
.kb-term-content .field-value.formula {
  font-family: var(--font-display); font-style: italic; color: var(--forest);
  padding: 0.8rem 1rem; background: var(--cream-warm); border-left: 2px solid var(--copper); margin-top: 0.3rem;
}


/* ===================== RESPONSIVE (matches 968px breakpoint) ===================== */
@media (max-width: 968px) {
  .kb-hero,
  .kb-search,
  .kb-content { padding-left: var(--gutter-mobile); padding-right: var(--gutter-mobile); }

  .kb-hero-bottom,
  .kb-terms { grid-template-columns: 1fr; gap: 3rem; }
  .kb-hero-bottom { gap: 3rem; }
  .kb-meta { text-align: left; }
  .kb-term { border-right: none; }
  .kb-terms { gap: 0; }
  .kb-letter-meta { padding-left: 0; margin-top: 0; }
  .kb-search-bar { flex-wrap: wrap; }
}


/* ============================================================
   PHASE F — CLICKABLE DIRECTORY (hub) + TERM DETAIL PAGE
   ============================================================ */

/* ---- Hub expanded definition cards (2-up grid, quick-view modal styling) ---- */
.kb-card-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem;
}
.kb-card {
  display: flex; flex-direction: column;
  padding: 2.4rem 2.4rem 2.1rem; background: var(--cream-warm);
  border: 1px solid var(--rule-strong); transition: border-color 0.25s, box-shadow 0.25s;
}
.kb-card:hover { border-color: var(--terracotta); box-shadow: 0 12px 28px rgba(24,33,28,0.07); }
.kb-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.kb-card-term { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 1.85rem); font-weight: 400; color: var(--forest); line-height: 1.15; margin: 0; }
.kb-card-abbr { font-style: italic; color: var(--copper); font-size: 0.62em; margin-left: 0.3rem; }
.kb-card-badge {
  flex-shrink: 0; margin-top: 0.35rem; font-size: 0.56rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); border: 1px solid var(--gold); border-radius: 2px; padding: 0.2rem 0.5rem; white-space: nowrap;
}
.kb-card-divider { border-top: 1px solid var(--rule); margin: 1.3rem 0 0.4rem; }
.kb-card-section { margin-top: 1.5rem; }
.kb-card-label {
  display: block; font-size: 0.64rem; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--copper); margin-bottom: 0.55rem;
}
.kb-card-text { color: var(--espresso); font-size: 1.02rem; line-height: 1.65; margin: 0; }
.kb-card-text.kb-card-formula {
  font-family: var(--font-display); font-style: italic; color: var(--forest);
  padding: 0.55rem 0 0.55rem 1.2rem; border-left: 3px solid var(--copper);
}
.kb-card-deeplink {
  margin-top: auto; padding-top: 1.8rem;
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600;
  color: var(--terracotta); text-decoration: none; transition: gap 0.25s;
}
.kb-card-deeplink:hover { gap: 0.85rem; }


/* ---- Term detail page ---- */
.kb-term-hero {
  background: linear-gradient(180deg, var(--forest-1) 0%, var(--forest-4) 60%, var(--forest-7) 100%);
  color: var(--cream); padding: 5rem var(--gutter) 4rem;
}
.kb-term-hero-inner { max-width: 860px; margin: 0 auto; }
.kb-breadcrumb { display: flex; gap: 0.6rem; align-items: center; font-size: 0.8rem; color: rgba(244,241,234,0.7); margin-bottom: 2.5rem; }
.kb-breadcrumb a { color: var(--gold); text-decoration: none; }
.kb-breadcrumb a:hover { color: var(--cream); }
.kb-term-hero .eyebrow { color: var(--gold); margin-bottom: 1.5rem; }
.kb-term-hero .eyebrow::before { background: var(--gold); }
.kb-term-hero h1 { color: var(--cream); font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 300; line-height: 1.05; margin-bottom: 1.5rem; }
.kb-term-hero .kb-term-abbr { font-family: var(--font-display); font-style: italic; color: var(--gold); font-size: 0.5em; margin-left: 0.6rem; }
.kb-term-lede { color: rgba(244,241,234,0.9); font-size: 1.2rem; line-height: 1.55; max-width: 720px; }

.kb-term-body { background: var(--cream); padding: 4.5rem var(--gutter) 2.5rem; }
.kb-term-body-inner { max-width: 760px; margin: 0 auto; }
.kb-section { margin-bottom: 2.8rem; }
.kb-section > h2 {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--copper);
  font-weight: 600; margin-bottom: 0.9rem;
}
.kb-section > p { color: var(--espresso); font-size: 1.05rem; line-height: 1.8; }
.kb-section .kb-formula {
  font-family: var(--font-display); font-style: italic; color: var(--forest);
  padding: 0.9rem 1.2rem; background: var(--cream-warm); border-left: 2px solid var(--copper);
}

/* Bullet lists (Common Issues Businesses See / What Good Looks Like) */
.kb-bullets { list-style: none; margin: 0; padding: 0; }
.kb-bullets li {
  position: relative; padding: 0 0 0.9rem 1.5rem;
  color: var(--espresso); font-size: 1.05rem; line-height: 1.7;
}
.kb-bullets li:last-child { padding-bottom: 0; }
.kb-bullets li::before {
  content: ''; position: absolute; left: 0; top: 0.65rem;
  width: 6px; height: 6px; background: var(--copper); border-radius: 50%;
}

/* Frequently Asked Questions */
.kb-faqs .kb-faq { padding: 1.3rem 0; border-bottom: 1px solid var(--rule); }
.kb-faqs .kb-faq:first-of-type { border-top: 1px solid var(--rule); }
.kb-faq-q {
  font-family: var(--font-display); font-size: 1.12rem; line-height: 1.35;
  color: var(--forest); margin: 0 0 0.5rem;
}
.kb-faq-a { color: var(--espresso); font-size: 1.02rem; line-height: 1.75; margin: 0; }

/* Schedule a CFO Advisory Review CTA */
.kb-dd-cta {
  margin-top: 3.5rem; padding: 2.4rem 2.2rem;
  background: var(--forest); border-radius: 2px;
}
.kb-dd-cta > h2 { color: var(--gold); }
.kb-dd-cta > p { color: var(--cream); font-size: 1.05rem; line-height: 1.8; margin-bottom: 1.8rem; }
.kb-dd-cta .btn-primary { display: inline-block; }

/* Related terms + CFO areas */
.kb-related-terms, .kb-related-areas { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule-strong); }
.kb-related-grid, .kb-areas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--rule); }
.kb-related-link, .kb-area-link {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 0.5rem 1rem 0; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule);
  text-decoration: none; color: var(--forest); transition: background 0.25s, padding-left 0.25s;
}
.kb-related-link:nth-child(2n), .kb-area-link:nth-child(2n) { border-right: none; padding-right: 0.5rem; }
.kb-related-link:hover, .kb-area-link:hover { background: var(--cream-warm); padding-left: 0.8rem; color: var(--terracotta); }
.rt-name, .area-name { font-family: var(--font-display); font-size: 1.02rem; line-height: 1.3; }
.rt-arrow, .area-arrow { color: var(--olive); transition: transform 0.25s; }
.kb-related-link:hover .rt-arrow, .kb-area-link:hover .area-arrow { color: var(--terracotta); transform: translateX(3px); }

/* ---- Slim always-visible inline CTA (under section 3) ---- */
.kb-inline-cta {
  margin-top: 2.5rem; padding: 1.1rem 1.4rem;
  background: var(--cream-warm); border-left: 3px solid var(--copper);
  color: var(--espresso); font-size: 0.98rem; line-height: 1.6;
}
.kb-inline-cta a {
  color: var(--terracotta); font-weight: 500; text-decoration: none;
  border-bottom: 1px solid currentColor; white-space: nowrap;
  transition: color 0.25s;
}
.kb-inline-cta a:hover { color: var(--forest); }


/* ---- Expandable deep dive (native <details>) ---- */
.kb-deepdive { background: var(--cream); padding-bottom: 3rem; }
.kb-deepdive-summary {
  display: block; cursor: pointer; list-style: none;
  padding: 0 var(--gutter);
}
.kb-deepdive-summary::-webkit-details-marker { display: none; }
.kb-deepdive-summary::marker { content: ''; }
.kb-deepdive-summary:focus-visible { outline: none; }
.kb-deepdive-summary-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.4rem 1.8rem;
  background: var(--cream-warm); border: 1px solid var(--rule-strong);
  transition: border-color 0.25s, background 0.25s;
}
.kb-deepdive-summary:hover .kb-deepdive-summary-inner { border-color: var(--terracotta); }
.kb-deepdive-summary:focus-visible .kb-deepdive-summary-inner { border-color: var(--terracotta); box-shadow: 0 0 0 2px rgba(184,120,80,0.25); }
.kb-deepdive-label {
  font-family: var(--font-display); font-size: 1.15rem; color: var(--forest); line-height: 1.2;
}
.kb-deepdive[open] .kb-deepdive-label { color: var(--terracotta); }
.kb-deepdive-icon {
  font-family: var(--font-display); font-size: 1.7rem; color: var(--terracotta);
  line-height: 1; flex-shrink: 0; transition: transform 0.3s;
}
.kb-deepdive[open] .kb-deepdive-icon { transform: rotate(45deg); }
.kb-deepdive-content { background: var(--cream); padding: 1rem var(--gutter) 3rem; }

/* ---- Quick-view dialogue (hub modal — original elegant style) ---- */
body.kb-qv-open { overflow: hidden; }
.kb-qv-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.kb-qv-overlay[hidden] { display: none; }
.kb-qv-backdrop { position: absolute; inset: 0; background: rgba(24,33,28,0.55); }
.kb-qv-dialog {
  position: relative; z-index: 1; width: 100%; max-width: 620px;
  max-height: 86vh; overflow-y: auto;
  background: var(--cream-warm); padding: 2.75rem 3rem 2.5rem;
  box-shadow: 0 30px 70px rgba(24,33,28,0.30);
}
.kb-qv-close {
  position: absolute; top: 1.3rem; right: 1.6rem;
  background: none; border: none; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: var(--olive); transition: color 0.2s;
}
.kb-qv-close:hover { color: var(--terracotta); }
.kb-qv-title {
  font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 400;
  color: var(--forest); line-height: 1.1; margin: 0 0 1.4rem; padding-right: 2rem;
}
.kb-qv-title .kb-qv-abbr { font-style: italic; color: var(--copper); font-size: 0.55em; margin-left: 0.4rem; }
.kb-qv-divider { border-top: 1px solid var(--rule); margin-bottom: 2rem; }
.kb-qv-field { margin-bottom: 1.8rem; }
.kb-qv-field:last-child { margin-bottom: 0; }
.kb-qv-label {
  display: block; font-size: 0.68rem; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--copper); margin-bottom: 0.7rem;
}
.kb-qv-value { color: var(--espresso); font-size: 1.05rem; line-height: 1.65; }
.kb-qv-value.kb-qv-formula {
  font-family: var(--font-display); font-style: italic; color: var(--forest);
  padding: 0.5rem 0 0.5rem 1.2rem; border-left: 3px solid var(--copper);
}
.kb-qv-readmore {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 2.2rem;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 500;
  color: var(--terracotta); text-decoration: none;
  border-bottom: 1px solid var(--terracotta); padding-bottom: 0.35rem; transition: gap 0.25s;
}
.kb-qv-readmore:hover { gap: 0.85rem; }
@media (max-width: 600px) {
  .kb-qv-dialog { padding: 2.2rem 1.5rem; }
}


/* ---- "In the Real World" story (Dana/AYL voice) ---- */
.kb-story p {
  font-family: var(--font-display); font-style: italic; color: var(--forest);
  font-size: 1.08rem; line-height: 1.7;
  padding-left: 1.3rem; border-left: 3px solid var(--gold);
}

@media (max-width: 968px) {
  .kb-term-hero, .kb-term-body,
  .kb-deepdive-summary, .kb-deepdive-content { padding-left: var(--gutter-mobile); padding-right: var(--gutter-mobile); }
  .kb-card-grid { grid-template-columns: 1fr; }
  .kb-related-grid, .kb-areas-grid { grid-template-columns: 1fr; }
  .kb-related-link, .kb-area-link { border-right: none; }
  .kb-deepdive-summary-inner { padding: 1.2rem 1.3rem; }
  .kb-deepdive-label { font-size: 1.05rem; }
}
