/* 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; }
}
