/* Guide article layout — dispute-resolution.html and similar long-form guides
   Namespace: kb- */

:root {
  --kb-navy: #182743;
  --kb-yellow: #ffef4b;
  --kb-yellow-hover: #ffe820;
  --kb-white: #ffffff;
  --kb-beige: #faf8f4;
  --kb-gray-50: #f7f8fa;
  --kb-gray-100: #eef0f3;
  --kb-gray-200: #e2e5ea;
  --kb-gray-500: #6b7280;
  --kb-gray-700: #374151;
  --kb-max: 1120px;
  --kb-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --kb-nav-top: calc(var(--fpa-site-nav-bar-height, 56px) + 20px);
}

/* ——— Page shell ——— */

body.kb-page {
  margin: 0;
  background: var(--kb-white);
  color: var(--kb-navy);
  font-family: var(--kb-font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.kb-main {
  width: 100%;
  overflow-x: clip;
}

.kb-main :where(h1, h2, h3, h4, p, ul, ol) {
  margin: 0;
}

.kb-container {
  width: min(var(--kb-max), calc(100% - 3rem));
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2rem);
  min-width: 0;
}

/* ——— Breadcrumb ——— */

.kb-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  font-size: 14px;
  color: var(--kb-gray-500);
  border-bottom: 1px solid var(--kb-gray-200);
}

.kb-breadcrumb a {
  color: var(--kb-gray-700);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: none;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.kb-breadcrumb a:hover {
  color: var(--kb-navy);
  text-decoration-color: var(--kb-yellow);
}

.kb-breadcrumb-sep {
  color: var(--kb-gray-200);
}

.kb-breadcrumb-current {
  color: var(--kb-navy);
  font-weight: 500;
}

/* ——— Hero ——— */

.kb-hero {
  padding: 40px 0 48px;
  background: var(--kb-beige);
  border-bottom: 1px solid var(--kb-gray-200);
}

.kb-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kb-gray-500);
  margin-bottom: 12px;
}

.kb-hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--kb-navy);
  margin-bottom: 12px;
}

.kb-hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.65;
  color: var(--kb-gray-700);
  max-width: 720px;
}

.kb-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--kb-gray-500);
}

.kb-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ——— Two-column layout ——— */

.kb-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-block: 48px 80px;
  min-width: 0;
}

.kb-toc {
  position: sticky;
  top: var(--kb-nav-top);
  margin-top: 1rem;
}

.kb-toc-card {
  background: var(--kb-gray-50);
  border: 1px solid var(--kb-gray-200);
  border-radius: 16px;
  padding: 20px;
}

.kb-toc-card h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kb-navy);
  margin-bottom: 14px;
}

.kb-toc-card ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kb-toc-card a {
  font-size: 14px;
  color: var(--kb-gray-700);
  text-decoration: none;
  line-height: 1.4;
  display: block;
  padding: 2px 0 2px 10px;
  margin-left: -10px;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.kb-toc-card a:hover,
.kb-toc-card a.active,
.kb-toc-card a:focus-visible {
  color: var(--kb-navy);
  border-left-color: var(--kb-yellow);
  outline: none;
}

/* ——— Article body ——— */

.kb-article {
  min-width: 0;
  max-width: 100%;
}

.explanation-content {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.content-section {
  margin-bottom: 48px;
  scroll-margin-top: var(--kb-nav-top);
}

.content-section h2 {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--kb-navy);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--kb-gray-200);
}

.content-section h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--kb-navy);
  margin: 28px 0 12px;
}

.explanation-content p,
.faq-answer p,
.faq-answer ul,
.faq-answer ol,
.kb-legal p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--kb-gray-700);
}

.explanation-content p + p {
  margin-top: 16px;
}

.explanation-content ul,
.explanation-content ol {
  margin: 16px 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explanation-content li {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--kb-gray-700);
}

.kb-article a:not(.kb-btn) {
  color: var(--kb-navy);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--kb-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: none;
  transition: text-decoration-color 0.12s ease;
}

.kb-article a:not(.kb-btn):hover,
.kb-article a:not(.kb-btn):focus-visible {
  text-decoration-color: var(--kb-yellow-hover);
  outline: none;
}

/* ——— Glossary tooltips ——— */

.kb-gloss {
  position: relative;
  display: inline;
  cursor: help;
  border-bottom: 2px dotted rgb(24 39 67 / 0.35);
  text-decoration: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.kb-gloss:hover,
.kb-gloss:focus,
.kb-gloss:focus-visible {
  border-bottom-color: var(--kb-navy);
  background: rgb(255 239 75 / 0.35);
  outline: none;
}

.kb-gloss__tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 30;
  display: none;
  width: max-content;
  max-width: min(340px, calc(100vw - 40px));
  padding: 12px 14px;
  background: var(--kb-navy);
  color: var(--kb-white);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(24 39 67 / 0.18);
  pointer-events: none;
}

.kb-gloss__tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--kb-navy);
}

.kb-gloss:hover .kb-gloss__tip,
.kb-gloss:focus .kb-gloss__tip,
.kb-gloss:focus-within .kb-gloss__tip {
  display: block;
}

/* Hero title: show tooltips below so they don't clip off-screen */
.kb-hero h1 .kb-gloss__tip {
  bottom: auto;
  top: calc(100% + 10px);
}

.kb-hero h1 .kb-gloss__tip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--kb-navy);
}

/* ——— Callout ——— */

.kb-callout {
  margin-top: 24px;
  padding: 24px;
  background: var(--kb-yellow);
  border-radius: 16px;
}

.kb-callout h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--kb-navy);
  margin: 0 0 12px;
}

.kb-callout ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-callout li {
  font-size: 15px;
  line-height: 1.55;
  color: var(--kb-navy);
}

/* ——— Comparison table ——— */

.kb-table-wrap {
  margin: 24px 0;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--kb-gray-200);
  border-radius: 16px;
  background: var(--kb-white);
}

.kb-compare-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.kb-compare-table caption {
  padding: 16px 20px 0;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--kb-gray-500);
}

.kb-compare-table th,
.kb-compare-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--kb-gray-200);
  vertical-align: top;
  text-align: left;
}

.kb-compare-table thead th {
  background: var(--kb-gray-50);
  font-size: 13px;
  font-weight: 700;
  color: var(--kb-navy);
}

.kb-compare-table tbody th[scope="row"] {
  width: 22%;
  font-weight: 600;
  color: var(--kb-navy);
  background: var(--kb-beige);
}

.kb-compare-table tbody tr:last-child th,
.kb-compare-table tbody tr:last-child td {
  border-bottom: none;
}

.kb-compare-table td {
  color: var(--kb-gray-700);
}

/* ——— FAQ accordion ——— */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--kb-gray-200);
  border-radius: 12px;
  background: var(--kb-white);
  overflow: hidden;
}

.faq-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.faq-toggle h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--kb-navy);
  line-height: 1.4;
  margin: 0;
}

.faq-arrow {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  position: relative;
  color: var(--kb-gray-500);
  transition: transform 0.2s ease;
}

.faq-arrow::before,
.faq-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.faq-arrow::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.faq-item.active .faq-arrow::after {
  opacity: 0;
}

.faq-content {
  display: none;
  padding: 0 20px 18px;
}

.faq-item.active .faq-content {
  display: block;
}

.faq-answer ul,
.faq-answer ol {
  padding-left: 1.25rem;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-answer li {
  line-height: 1.65;
}

.faq-answer p:last-child,
.faq-answer ul:last-child,
.faq-answer ol:last-child {
  margin-bottom: 0;
}

/* ——— Legal / sources block ——— */

.kb-legal {
  padding: 24px;
  background: var(--kb-gray-50);
  border: 1px solid var(--kb-gray-200);
  border-radius: 16px;
}

.kb-legal h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kb-gray-500);
  margin-bottom: 8px;
}

.kb-legal strong {
  color: var(--kb-navy);
}

.kb-legal ul {
  margin: 12px 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-legal li {
  font-size: 15px;
  line-height: 1.6;
  color: var(--kb-gray-700);
}

/* ——— CTA ——— */

.kb-cta {
  padding: 32px;
  background: var(--kb-yellow);
  border-radius: 20px;
  text-align: center;
}

.kb-cta h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--kb-navy);
  margin-bottom: 12px;
  border: none;
  padding: 0;
}

.kb-cta p {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--kb-navy);
  margin-bottom: 24px;
  max-width: 560px;
  margin-inline: auto;
}

.kb-cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.kb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: var(--kb-font);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background 0.15s ease, transform 0.15s ease;
}

.kb-btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.kb-btn--primary {
  background: var(--kb-navy);
  color: var(--kb-white);
  border-color: var(--kb-navy);
}

.kb-btn--primary:hover {
  background: #0f1a2e;
}

/* ——— Responsive ——— */

@media (max-width: 960px) {
  .kb-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
  }

  .kb-toc {
    position: relative;
    top: 0;
  }
}

@media (max-width: 640px) {
  .kb-container {
    width: min(var(--kb-max), calc(100% - 2rem));
    padding-inline: 1.25rem;
  }

  .kb-hero {
    padding: 28px 0 36px;
  }

  .kb-breadcrumb {
    padding: 16px 0;
  }

  .kb-layout {
    padding-bottom: 56px;
  }

  .kb-cta {
    padding: 24px 20px;
  }

  .kb-cta-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .kb-btn {
    width: 100%;
  }

  /* On small screens, anchor tooltips below the term */
  .kb-gloss__tip {
    bottom: auto;
    top: calc(100% + 10px);
    left: 0;
    transform: none;
    max-width: min(300px, calc(100vw - 40px));
  }

  .kb-gloss__tip::after {
    top: auto;
    bottom: 100%;
    left: 20px;
    transform: none;
    border-top-color: transparent;
    border-bottom-color: var(--kb-navy);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kb-btn:hover {
    transform: none;
  }
}
