/* KX Korsord — clean, compact korsordshjälp design.
   Palette tokens are overridable; prepare_engine.mjs bakes the version palette. */
:root, html body {
  --fbt-accent: #c8952a;
  --fbt-ink: #1f2937;
  --fbt-tint: #fbf6ec;
  --fbt-line: #e6e1d6;
  --fbt-muted: #6b7280;
  --fbt-card: #ffffff;
}

/* ---- framing: centred, comfortable reading width + air (CSS only loads on
   /korsord/ pages, so it's safe to frame the GeneratePress article here) ---- */
body.page .inside-article {
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
}
body.page .inside-article .entry-content {
  max-width: 100%;
}
/* keep running text to a calm line length; let the wide widgets breathe full width */
body.page .entry-content > p,
.fbt-lede,
.fbt-faq,
.fbt-sources,
.fbt-related,
.fbt-mini-cta {
  max-width: 720px;
}
/* vertical rhythm — more air between sections */
body.page .entry-content > h2,
.fbt-popular h2,
.fbt-index .fbt-index-sec:first-child h2 {
  margin-top: 2.4rem;
}
.fbt-answers,
.fbt-faq,
.fbt-sources,
.fbt-related,
.fbt-popular,
.fbt-index,
.fbt-search {
  margin-top: 1.8rem;
}

/* ---- direct answer lede ---- */
.fbt-lede {
  font-size: 1.16rem;
  line-height: 1.6;
  font-weight: 500;
  color: var(--fbt-ink);
  background: var(--fbt-tint);
  border-left: 4px solid var(--fbt-accent);
  padding: 1em 1.2em;
  border-radius: 8px;
  margin: 0 0 1.6em;
}
.fbt-lede strong { color: var(--fbt-accent); }

/* ---- answer block ---- */
.fbt-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 1.6em;
  max-width: 100%;
}
.fbt-answer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--fbt-card);
  border: 1px solid var(--fbt-line);
  border-radius: 9px;
  padding: 0.65em 1.05em;
  min-width: 120px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.fbt-word {
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 1.12rem;
  color: var(--fbt-ink);
  font-variant: small-caps;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.fbt-answer { box-sizing: border-box; max-width: 100%; }
.fbt-len {
  font-size: 0.78rem;
  color: var(--fbt-muted);
  margin-top: 2px;
}
.fbt-answer.is-hidden { display: none; }

/* per-page length filter bar (added by JS when >1 length) */
.fbt-lenfilter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 0.8em;
}
.fbt-lenfilter button {
  border: 1px solid var(--fbt-line);
  background: #fff;
  color: var(--fbt-ink);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}
.fbt-lenfilter button.is-active {
  background: var(--fbt-accent);
  border-color: var(--fbt-accent);
  color: #fff;
}

/* ---- FAQ ---- */
.fbt-faq { margin: 1.2em 0; }
.fbt-faq details {
  border: 1px solid var(--fbt-line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.fbt-faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.7em 0.9em;
  list-style: none;
  position: relative;
  color: var(--fbt-ink);
}
.fbt-faq summary::-webkit-details-marker { display: none; }
.fbt-faq summary::after {
  content: "+";
  position: absolute;
  right: 0.9em;
  color: var(--fbt-accent);
  font-weight: 700;
}
.fbt-faq details[open] summary::after { content: "–"; }
.fbt-faq details > div { padding: 0 0.9em 0.8em; }
.fbt-faq p { margin: 0; color: var(--fbt-ink); }

/* ---- sources + related ---- */
.fbt-sources, .fbt-related { margin: 1.2em 0; }
.fbt-sources h2, .fbt-related h2 { font-size: 1.05rem; margin: 0 0 0.4em; }
.fbt-sources ul, .fbt-related ul { margin: 0; padding-left: 1.1em; }
.fbt-sources li, .fbt-related li { margin-bottom: 3px; }

.fbt-mini-cta {
  margin: 1.4em 0 0;
  padding-top: 1em;
  border-top: 1px solid var(--fbt-line);
}
.fbt-mini-cta a { font-weight: 600; color: var(--fbt-accent); text-decoration: none; }

/* ---- hub: search tool ---- */
.fbt-hub-intro { font-size: 1.1rem; color: var(--fbt-ink); }
.fbt-search { margin: 1em 0 1.4em; }
.fbt-search-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fbt-search-input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.7em 0.9em;
  border: 1px solid var(--fbt-line);
  border-radius: 8px;
  font-size: 1rem;
}
.fbt-search-len {
  padding: 0.7em 0.6em;
  border: 1px solid var(--fbt-line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}
.fbt-search-btn {
  background: var(--fbt-accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.7em 1.2em;
  font-weight: 700;
  cursor: pointer;
}
.fbt-search-count { font-size: 0.85rem; color: var(--fbt-muted); margin: 0.5em 0 0; min-height: 1em; }

/* ---- hub: popular chips ---- */
.fbt-popular { margin: 0 0 1.4em; }
.fbt-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.fbt-chip {
  display: inline-block;
  background: var(--fbt-tint);
  border: 1px solid var(--fbt-line);
  color: var(--fbt-ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  text-decoration: none;
}
.fbt-chip:hover { border-color: var(--fbt-accent); color: var(--fbt-accent); }

/* ---- hub: A–Ö index ---- */
.fbt-index { margin-top: 0.5em; }
.fbt-az {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  position: sticky;
  top: 0;
  background: #fff;
  padding: 8px 0;
  border-bottom: 1px solid var(--fbt-line);
  z-index: 2;
}
.fbt-az a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--fbt-tint);
  color: var(--fbt-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
}
.fbt-az a:hover { background: var(--fbt-accent); color: #fff; }
.fbt-index-sec { margin: 1.2em 0; }
.fbt-index-sec h2 {
  font-size: 1.3rem;
  color: var(--fbt-accent);
  border-bottom: 2px solid var(--fbt-line);
  padding-bottom: 3px;
}
.fbt-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 3;
  column-gap: 24px;
}
.fbt-idx-item { break-inside: avoid; margin-bottom: 5px; font-size: 0.95rem; }
.fbt-idx-item a { text-decoration: none; color: var(--fbt-ink); }
.fbt-idx-item a:hover { color: var(--fbt-accent); }
.fbt-idx-ans { color: var(--fbt-muted); font-size: 0.8rem; font-variant: small-caps; letter-spacing: 0.08em; }
.fbt-idx-item.is-hidden { display: none; }
.fbt-index-sec.is-hidden { display: none; }

/* ---- mobile width guard + responsive (verified 0 overflow @390px) ---- */
body.page .inside-article,
body.page .entry-content,
.fbt-search,
.fbt-answers,
.fbt-chips,
.fbt-index,
.fbt-index-list,
.fbt-faq,
.fbt-sources,
.fbt-related {
  min-width: 0;
  max-width: 100%;
}
.fbt-lede,
.fbt-faq summary,
.fbt-faq p,
.fbt-idx-item,
.fbt-chip {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 980px) {
  body.page .inside-article { max-width: 100%; }
}
@media (max-width: 780px) {
  .fbt-index-list { columns: 2; column-gap: 18px; }
  .fbt-az { position: static; }
}
@media (max-width: 560px) {
  .fbt-search-row { flex-direction: column; gap: 10px; }
  .fbt-search-input,
  .fbt-search-len,
  .fbt-search-btn { width: 100%; flex: 1 1 100%; box-sizing: border-box; }
  .fbt-index-list { columns: 1; }
  .fbt-answer { min-width: 0; flex: 1 1 calc(50% - 10px); }
  .fbt-word { letter-spacing: 0.04em; font-size: 1.05rem; }
  .fbt-lede { font-size: 1.08rem; }
  .fbt-lenfilter { gap: 5px; }
  .fbt-kw-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---- Lexikon v2 (Synonym → Kreuzwort → FAQ) ---- */
:root, html body {
  --fbt-syn-blue: #2563eb;
  --fbt-syn-blue-soft: #eff6ff;
  --fbt-syn-blue-border: #bfdbfe;
}
.fbt-hero {
  background: var(--fbt-card);
  border: 1px solid var(--fbt-line);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin: 0 0 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.fbt-hero-def { font-size: 1.05rem; line-height: 1.55; margin: 0 0 0.85rem; color: var(--fbt-ink); }
.fbt-hero-top { margin: 0 0 0.65rem; }
.fbt-hero-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--fbt-muted); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }
.fbt-hero-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.fbt-hero-meta { font-size: 0.82rem; color: var(--fbt-muted); margin: 0; }

.fbt-jump {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 1.25rem;
  padding: 0;
}
.fbt-jump a {
  display: inline-block;
  background: var(--fbt-syn-blue-soft);
  border: 1px solid var(--fbt-syn-blue-border);
  color: var(--fbt-syn-blue);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.fbt-jump a:hover { background: var(--fbt-syn-blue); color: #fff; border-color: var(--fbt-syn-blue); }

.fbt-sec {
  background: var(--fbt-card);
  border: 1px solid var(--fbt-line);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  margin: 0 0 1rem;
  max-width: 100%;
}
.fbt-sec h2 { font-size: 1.15rem; margin: 0 0 0.75rem; color: var(--fbt-ink); }
.fbt-sec h3 { font-size: 0.92rem; margin: 1rem 0 0.5rem; color: var(--fbt-muted); text-transform: uppercase; letter-spacing: 0.03em; }

.fbt-pill {
  display: inline-block;
  background: var(--fbt-syn-blue-soft);
  border: 1px solid var(--fbt-syn-blue-border);
  color: var(--fbt-syn-blue);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}
.fbt-pill-ghost { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }
.fbt-pill-src { text-decoration: none; }
.fbt-pill-src:hover { background: var(--fbt-syn-blue); color: #fff; }

.fbt-syn-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fbt-syn-grid-muted .fbt-pill { font-weight: 500; }

.fbt-sec-mean p { margin: 0 0 0.65rem; line-height: 1.55; color: var(--fbt-ink); }

.fbt-kw-table { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--fbt-line); border-radius: 8px; overflow: hidden; margin-top: 0.5rem; }
.fbt-kw-row {
  display: grid;
  grid-template-columns: minmax(100px, 1.1fr) minmax(90px, 0.8fr) minmax(140px, 2fr);
  gap: 12px;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--fbt-line);
  background: #fff;
}
.fbt-kw-row:last-child { border-bottom: 0; }
.fbt-kw-row:nth-child(even) { background: #fafafa; }
.fbt-kw-row.is-hidden { display: none; }
.fbt-kw-word { font-weight: 700; color: var(--fbt-ink); font-size: 1rem; }
.fbt-kw-len { font-size: 0.85rem; font-weight: 600; color: var(--fbt-syn-blue); white-space: nowrap; }
.fbt-kw-tip { font-size: 0.85rem; color: var(--fbt-muted); line-height: 1.35; }
.fbt-kw-note { font-size: 0.82rem; color: var(--fbt-muted); margin: 0.65rem 0 0; font-style: italic; }

.fbt-sec-faq .fbt-faq { margin: 0; }
.fbt-src-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.fbt-sources ul { display: none; }
.fbt-sec + .fbt-sources,
.fbt-sec-faq + .fbt-sources { margin-top: 0; }

body.page .entry-content > .fbt-hero,
body.page .entry-content > .fbt-jump,
body.page .entry-content > .fbt-sec,
body.page .entry-content > .fbt-sources,
body.page .entry-content > .fbt-related {
  max-width: 100%;
}

/* ---- Ordbok word page: synonyms + meaning + EEAT (general lexicon model) ---- */
.fbt-synonyms { margin: 0 0 1.4em; max-width: 100%; }
.fbt-synonyms h2 { font-size: 1.12rem; margin: 0 0 0.6em; }
.fbt-synonyms .fbt-chips { gap: 8px; }
.fbt-synonyms .fbt-chip { font-size: 0.92rem; padding: 5px 13px; }
.fbt-def {
  font-size: 1.04rem;
  line-height: 1.6;
  color: var(--fbt-ink);
  margin: 0 0 0.5em;
  max-width: 720px;
}
.fbt-meta { font-size: 0.9rem; color: var(--fbt-muted); margin: 0 0 1.2em; }
.fbt-meta b { color: var(--fbt-ink); }

/* breadcrumb + reviewer/updated (engine-injected, EEAT) */
.fbt-crumb { font-size: 0.84rem; color: var(--fbt-muted); margin: 0 0 0.9em; }
.fbt-crumb a { color: var(--fbt-accent); text-decoration: none; }
.fbt-crumb a:hover { text-decoration: underline; }
.fbt-eeat {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: 1.4em 0 0;
  padding-top: 0.9em;
  border-top: 1px solid var(--fbt-line);
  font-size: 0.84rem;
  color: var(--fbt-muted);
}
.fbt-eeat .fbt-rev { color: #0f766e; font-weight: 600; }
.fbt-eeat a { color: var(--fbt-accent); text-decoration: none; }
