/* ==========================================================================
   Ask Finish The Race — Knowledge Base UI
   Presentation layer only. All data is rendered by the plugin (PHP).
   Palette and type are tokenised so the whole look can be retuned in one place.
   ========================================================================== */

.ftrke {
  /* Color */
  --ink: #22302a;          /* primary text */
  --evergreen: #2f6d54;    /* brand green — actions, active states */
  --evergreen-deep: #1e4d3c;
  --paper: #f7f5ef;        /* warm ivory page */
  --surface: #ffffff;      /* cards */
  --line: #e7e3d8;         /* warm hairline */
  --line-strong: #d8d2c3;
  --muted: #67746d;        /* secondary text */
  --brass: #a9812f;        /* scripture references only — the gilt edge */
  --brass-soft: #f3ecdb;   /* brass tint background */
  --wash: #eef3ef;         /* soft sage wash for the explore band */

  /* Type */
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Rhythm */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 45, 38, .04), 0 10px 30px rgba(30, 45, 38, .06);
  --shadow-lift: 0 6px 16px rgba(30, 45, 38, .08), 0 18px 40px rgba(30, 45, 38, .10);

  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.ftrke *, .ftrke *::before, .ftrke *::after { box-sizing: border-box; }
.ftrke a { color: inherit; }

/* --------------------------------------------------------------------------
   Hero — the ask
   -------------------------------------------------------------------------- */
.ftrke-hero {
  text-align: center;
  padding: 30px 12px 6px;
}
.ftrke-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 14px;
}
.ftrke-hero__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 auto 14px;
  max-width: 16ch;
}
.ftrke-hero__lede {
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.5;
  margin: 0 auto 26px;
  max-width: 54ch;
}

/* Search */
.ftrke-search {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}
.ftrke-search__input {
  width: 100%;
  font-family: var(--sans);
  font-size: 18px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 17px 22px;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ftrke-search__input::placeholder { color: #9aa39d; }
.ftrke-search__input:focus {
  outline: none;
  border-color: var(--evergreen);
  box-shadow: 0 0 0 4px rgba(47, 109, 84, .12), var(--shadow);
}
.ftrke-search__btn {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--sans);
  font-size: 16px; font-weight: 700;
  color: #fff;
  background: var(--evergreen);
  border: 0; border-radius: 12px;
  padding: 14px 36px;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.ftrke-search__btn:hover { background: var(--evergreen-deep); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(30, 45, 38, .18); }
.ftrke-search__btn:active { transform: translateY(0); box-shadow: none; }
.ftrke-search__btn:focus-visible { outline: 2px solid var(--evergreen-deep); outline-offset: 3px; }

/* Loading + AI note (inside the popup) */
.ftrke-loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 40px 20px; color: var(--muted); font-size: 16px;
}
.ftrke-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--evergreen);
  animation: ftrke-spin .8s linear infinite;
}
@keyframes ftrke-spin { to { transform: rotate(360deg); } }
.ftrke-ainote {
  background: #faf7ee;
  border: 1px solid #ece3cf;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 22px;
  color: #7a6326;
  font-size: 13.5px; line-height: 1.5;
}

/* Injected modal host must not affect page layout */
.ftrke--modalhost { max-width: none; margin: 0; padding: 0; font-size: 17px; }

/* Compact dialog (for headers / sidebars) */
.ftrke-hero.is-compact { padding: 6px 0; text-align: left; }
.ftrke-hero.is-compact .ftrke-search { margin: 0; max-width: none; }

/* Signature — the finish-line lane rule */
.ftrke-rule {
  width: 120px; height: 6px;
  margin: 30px auto 4px;
  background-image:
    linear-gradient(var(--evergreen), var(--evergreen)),
    repeating-linear-gradient(90deg, var(--brass) 0 8px, transparent 8px 16px);
  background-size: 100% 1px, 100% 4px;
  background-position: center top, center bottom;
  background-repeat: no-repeat;
  opacity: .8;
}

/* --------------------------------------------------------------------------
   Filter bar
   -------------------------------------------------------------------------- */
.ftrke-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 14px;
  flex-wrap: wrap;
}
.ftrke-toolbar__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  color: var(--ink);
  margin: 0;
}
.ftrke-count { color: var(--muted); font-size: 14px; }

.ftrke-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 22px;
  scrollbar-width: thin;
}
.ftrke-filters::-webkit-scrollbar { height: 6px; }
.ftrke-filters::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.ftrke-chip {
  flex: 0 0 auto;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.ftrke-chip:hover { border-color: var(--evergreen); color: var(--evergreen-deep); }
.ftrke-chip:active { transform: translateY(1px); }
.ftrke-chip:focus-visible { outline: 2px solid var(--evergreen); outline-offset: 2px; }
.ftrke-chip[aria-pressed="true"] {
  background: var(--evergreen);
  border-color: var(--evergreen);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Answers (the knowledge base)
   -------------------------------------------------------------------------- */
.ftrke-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ftrke-answer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 22px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
}
.ftrke-answer:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: #cdd8d0; }
.ftrke-answer:focus-visible { outline: 3px solid var(--evergreen); outline-offset: 2px; }
.ftrke-answer__eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.ftrke-answer__q {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 8px;
}
.ftrke-answer__preview {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ftrke-answer__refs {
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brass);
  margin-top: 4px;
}
.ftrke-answer__more {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 14px; font-weight: 700; color: var(--evergreen-deep);
}
.ftrke-answer__more svg { width: 15px; height: 15px; transition: transform .15s ease; }
.ftrke-answer:hover .ftrke-answer__more svg { transform: translateX(3px); }
.ftrke-answer__full { display: none; }

.ftrke-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 40px 24px;
}
.ftrke-empty strong { color: var(--ink); display: block; font-family: var(--serif); font-size: 20px; margin-bottom: 6px; }

/* --------------------------------------------------------------------------
   Answer popup
   -------------------------------------------------------------------------- */
.ftrke-modal {
  position: fixed; inset: 0; z-index: 100000;
  display: none;
  align-items: flex-start; justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
}
.ftrke-modal.is-open { display: flex; }
.ftrke-modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 32, 26, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.ftrke-modal__card {
  position: relative;
  width: 100%; max-width: 720px;
  background: var(--surface);
  border-radius: 22px;
  overflow: hidden;
  margin: auto;
  box-shadow: 0 30px 80px rgba(15, 25, 20, .40);
  animation: ftrke-pop .22s cubic-bezier(.2, .7, .3, 1);
}
@keyframes ftrke-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.ftrke-modal__head {
  background: var(--evergreen-deep) !important;
  color: #fff !important;
  padding: 26px 30px;
  position: relative;
}
.ftrke-modal__eyebrow {
  display: inline-block;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #f2dca4 !important;
  margin-bottom: 10px;
}
.ftrke-modal__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.12;
  color: #fff !important;
  margin: 0;
  padding-right: 36px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.ftrke-modal__close {
  position: absolute; top: 20px; right: 20px;
  width: 36px; height: 36px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .18) !important; color: #fff !important;
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.ftrke-modal__close:hover { background: rgba(255, 255, 255, .32) !important; }
.ftrke-modal__body {
  padding: 28px 30px 32px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  color: var(--ink) !important;
}

/* Slim audio player */
.ftrke-audio { padding: 14px 30px 0; }
.ftrke-audio[hidden] { display: none !important; }
.ftrke-audio__btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--surface) !important;
  color: var(--evergreen-deep) !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  font: 600 14px/1 var(--sans);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.ftrke-audio__btn:hover { background: var(--wash) !important; border-color: var(--evergreen) !important; }
.ftrke-audio__btn:active { transform: translateY(1px); }
.ftrke-audio__btn:focus-visible { outline: 2px solid var(--evergreen); outline-offset: 2px; }
.ftrke-audio__label { color: var(--evergreen-deep) !important; }
.ftrke-audio__icon { display: inline-flex; width: 16px; height: 16px; color: var(--evergreen) !important; }
.ftrke-audio__icon svg { width: 16px; height: 16px; display: block; }
.ftrke-audio__btn .ftrke-ico-pause { display: none; }
.ftrke-audio__btn.is-playing .ftrke-ico-play { display: none; }
.ftrke-audio__btn.is-playing .ftrke-ico-pause { display: block; }
.ftrke-audio__eq { display: none; align-items: flex-end; gap: 2px; height: 14px; margin-left: 2px; }
.ftrke-audio__btn.is-playing .ftrke-audio__eq { display: inline-flex; }
.ftrke-audio__eq i { width: 3px; height: 5px; background: var(--evergreen); border-radius: 2px; animation: ftrke-eq .9s ease-in-out infinite; }
.ftrke-audio__eq i:nth-child(2) { animation-delay: .15s; }
.ftrke-audio__eq i:nth-child(3) { animation-delay: .3s; }
@keyframes ftrke-eq { 0%, 100% { height: 5px; } 50% { height: 14px; } }

/* The answer — leading block */
.ftrke-answerblock {
  background: var(--wash);
  border: 1px solid #dce7e0;
  border-left: 4px solid var(--evergreen);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 26px;
}
.ftrke-answerblock .ftrke-block__label { color: var(--evergreen-deep); }
.ftrke-answerblock p {
  margin: 6px 0 0;
  font-size: 18px; line-height: 1.55; color: var(--ink); font-weight: 500;
}

/* Content blocks */
.ftrke-block { margin-bottom: 26px; }
.ftrke-block:last-child { margin-bottom: 0; }
.ftrke-block__label {
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.ftrke-block__label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ftrke-block p { margin: 0 0 12px; line-height: 1.7; color: #2b382f; }
.ftrke-block p:last-child { margin-bottom: 0; }

/* Verses referenced */
.ftrke-verses { display: flex; flex-wrap: wrap; gap: 8px; }
.ftrke-verse {
  background: var(--brass-soft);
  border: 1px solid #e6dcc2;
  color: var(--brass);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13.5px; font-weight: 700; letter-spacing: .02em;
}

/* Key scriptures */
.ftrke-scripts {
  background: #faf7ee;
  border: 1px solid #ece3cf;
  border-radius: 12px;
  padding: 14px 16px;
  color: #5f4a1e;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  white-space: pre-line;
}

/* Next steps */
.ftrke-steps {
  background: var(--wash);
  border: 1px solid #dce7e0;
  border-radius: 12px;
  padding: 16px 18px;
}
.ftrke-steps__lines { white-space: pre-line; line-height: 1.7; color: #2b382f; }
.ftrke-nextstep {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed #cdddd4;
  color: var(--evergreen-deep); font-weight: 600;
}
.ftrke-nextstep svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; color: var(--evergreen); }

/* Prayer */
.ftrke-prayer {
  background: #f5f7f5;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  color: #3a473f;
}

/* Continue growing links */
.ftrke-links { display: flex; flex-wrap: wrap; gap: 10px; }
.ftrke-link {
  display: inline-flex; align-items: center; gap: 7px;
  background: #f3f5f3;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 14px; font-weight: 600; color: var(--evergreen-deep);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.ftrke-link:hover { background: var(--wash); border-color: #cdddd4; }

/* --------------------------------------------------------------------------
   Explore band — discipleship / marketing, separated from the KB
   -------------------------------------------------------------------------- */
.ftrke-explore {
  margin-top: 56px;
  background: var(--wash);
  border: 1px solid #dce7e0;
  border-radius: 24px;
  padding: 40px 32px;
}
.ftrke-explore__eyebrow {
  text-align: center;
  font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 6px;
}
.ftrke-explore__title {
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(26px, 4vw, 36px);
  color: var(--ink);
  margin: 0 auto 8px;
  max-width: 22ch;
}
.ftrke-explore__lede {
  text-align: center;
  color: var(--muted);
  margin: 0 auto 28px;
  max-width: 56ch;
}
.ftrke-paths {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.ftrke-path {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 18px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ftrke-path:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cdd8d0; }
.ftrke-path__name {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 4px;
}
.ftrke-path__desc { display: block; color: var(--muted); font-size: 14px; line-height: 1.45; }

.ftrke-cta { text-align: center; }
.ftrke-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--evergreen);
  color: #fff !important;
  border: 0; border-radius: 999px;
  padding: 13px 26px;
  font-family: var(--sans);
  font-size: 16px; font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.ftrke-btn:hover { background: var(--evergreen-deep); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(30, 45, 38, .18); }
.ftrke-btn:active { transform: translateY(0); box-shadow: none; }
.ftrke-btn:focus-visible { outline: 2px solid var(--evergreen); outline-offset: 3px; }
.ftrke-btn svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .ftrke-results { grid-template-columns: 1fr; }
  .ftrke-paths { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ftrke { padding: 18px 14px 32px; font-size: 16px; }
  .ftrke-hero { padding: 16px 4px 4px; }
  .ftrke-explore { padding: 30px 18px; border-radius: 18px; }
  .ftrke-paths { grid-template-columns: 1fr; }
  .ftrke-modal { padding: 0; }
  .ftrke-modal__card { border-radius: 0; min-height: 100vh; max-width: 100%; }
  .ftrke-modal__body { max-height: none; padding: 22px 20px 28px; }
  .ftrke-modal__head { padding: 22px 20px; }
  .ftrke-audio { padding: 14px 20px 0; }
}

/* Motion preference */
@media (prefers-reduced-motion: reduce) {
  .ftrke *, .ftrke *::before, .ftrke *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------------------
   Contrast safeguards
   The popup is injected into the page body, where a site theme's global
   heading/paragraph/link colors can bleed in. These lock in legible colors
   so every surface keeps proper contrast regardless of the active theme.
   -------------------------------------------------------------------------- */
/* Popup body text */
.ftrke-modal__body p,
.ftrke-modal__body li,
.ftrke-block p,
.ftrke-steps__lines        { color: #2b382f !important; }
.ftrke-answerblock p       { color: var(--ink) !important; }
.ftrke-prayer              { color: #3a473f !important; }
.ftrke-scripts             { color: #5f4a1e !important; }
.ftrke-verse               { color: #7e611f !important; }
.ftrke-block__label        { color: #5c6a62 !important; }
.ftrke-answerblock .ftrke-block__label { color: var(--evergreen-deep) !important; }
.ftrke-nextstep            { color: var(--evergreen-deep) !important; }
.ftrke-modal__body a,
.ftrke-link                { color: var(--evergreen-deep) !important; }
.ftrke-ainote              { color: #6f5716 !important; }
/* Cards */
.ftrke-answer__q           { color: var(--ink) !important; }
.ftrke-answer__eyebrow     { color: var(--evergreen-deep) !important; }
.ftrke-answer__preview     { color: #4a564f !important; }

/* Version 3.8 — Related resource cards in answer popup */
.ftrke-resources-block { margin-top: 22px; }
.ftrke-resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.ftrke-resource-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e5dbc7;
  border-radius: 14px;
  background: #fffaf0;
  color: var(--evergreen-deep, #0b3d2e) !important;
  text-decoration: none !important;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(15, 44, 33, .06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ftrke-resource-card:hover,
.ftrke-resource-card:focus-visible {
  transform: translateY(-2px);
  border-color: #d7bf75;
  box-shadow: 0 12px 28px rgba(15, 44, 33, .12);
}
.ftrke-resource-card__icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #123f31;
  color: #fff;
  flex: 0 0 auto;
  font-size: 16px;
}
.ftrke-resource-card__text {
  line-height: 1.2;
}

/* v3.13 directory result cards */
.ftrke-resource-card--network .ftrke-resource-card__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ftrke-resource-card--network .ftrke-resource-card__text small {
  font-size: 12px;
  font-weight: 600;
  color: #5d6f66;
}
.ftrke-network-block .ftrke-resource-card {
  background: #f4faf6;
  border-color: #cfe2d7;
}
.ftrke-network-block .ftrke-resource-card__icon {
  background: #1f5b45;
}
