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