/* Lineage Name Harmonizer (Tool 20, prefix nh-) — the Origin Forge, the Crown Moniker, the lineage suites.
   Loaded through the `styles:` list in name-harmonizer.njk, so it sits in <head>, BEFORE the tool kit's inline <style> blocks.
   Rules are scoped `.nh .x`; where one restyles a kit class it adds a class (`.nh .rk-bento.nh-bento`) so it outranks the kit's
   `.tk .x`. Token overrides use `.tk.nh`. Depends on tokens.css, partials/tool-kit-css.njk and partials/result-kit-css.njk.

   Origin I is Cinnabar (the page accent), Origin II is ink. The crest, the lineage bar and the tile shapes all draw from those two
   tokens; the crest's border is always --c-accent. Colour and shape travel together: flow triangle, fusion circle, quiet ring. */
.tk.nh {
  --tk-accent: var(--accent-love, #E11D48);
  --tone-flow: #0284C7;
  --tone-friction: #D97706;
  --tone-fusion: #7C3AED;
  --tone-quiet: #94A3B8;
  --pa: var(--c-accent);
  --pb: var(--c-ink);
}

/* ================= Level 1: the Origin Forge ================= */
.nh .nh-pair { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .nh .nh-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; } }
.nh .nh-badge { font-size: 0.9375rem; font-weight: 800; letter-spacing: 0; }
.nh .nh-b .nh-badge { background: #EEF2F6; color: var(--c-ink); }
.nh .nh-controls { display: grid; gap: 22px; margin-top: 16px; }
@media (min-width: 720px) { .nh .nh-controls { margin-top: 20px; gap: 24px; } }
.nh .nh-go { width: min(100%, 380px); margin: 20px auto 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.nh .nh-go svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nh .nh-hint { margin-top: 10px; text-align: center; }
.nh .nh-forge .form-error { max-width: 560px; margin: 12px auto 0; text-align: center; }
.tk #nh-forms { margin-bottom: 20px; }

/* the segmented toggles: native radios, visually hidden but focusable, drawn as one joined control */
.nh .nh-seg { min-width: 0; border: 0; padding: 0; margin: 0; }
.nh .nh-seg legend { display: flex; align-items: baseline; gap: 6px; padding: 0; margin-bottom: 10px; font-size: 0.9375rem; font-weight: 600; }
.nh .nh-seg-row { display: grid; gap: 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; border: 1px solid var(--c-field); border-radius: 14px; background: #fff; }
@media (min-width: 560px) { .nh .nh-seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) { .nh .nh-seg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 559px) { .nh .nh-seg-3 { grid-template-columns: minmax(0, 1fr); } }
.nh .nh-opt { position: relative; display: block; min-width: 0; cursor: pointer; }
.nh .nh-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.nh .nh-opt-box { display: grid; align-content: center; gap: 2px; min-height: 58px; padding: 10px 14px; border-radius: 10px; border-bottom: 3px solid transparent; transition: background 0.15s, color 0.15s; }
.nh .nh-opt-box b { font-size: 0.9375rem; font-weight: 800; letter-spacing: -0.01em; }
.nh .nh-opt-box small { font-size: 0.75rem; font-weight: 500; line-height: 1.3; color: var(--c-muted); }
.nh .nh-opt:hover .nh-opt-box { background: var(--c-accent-tint); }
.nh .nh-opt input:checked + .nh-opt-box { background: var(--c-ink); color: #fff; border-bottom-color: var(--c-accent); }
.nh .nh-opt input:checked + .nh-opt-box small { color: rgba(255, 255, 255, 0.72); }
.nh .nh-opt input:focus-visible + .nh-opt-box { outline: 3px solid color-mix(in srgb, var(--c-accent) 55%, transparent); outline-offset: 2px; }

/* After a reading the forge folds into one bar. The origins stay one tap away. */
.nh .nh-strip { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 12px 12px 12px 20px; border: 1px solid var(--c-line); border-radius: var(--r-card); background: var(--c-card); }
.nh .nh-strip-names { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.01em; }
.nh .nh-strip-names span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.nh .nh-strip-names i { font-style: normal; font-weight: 500; color: var(--c-muted); }
.nh .nh-strip-names small { font-size: 0.8125rem; font-weight: 600; color: var(--c-muted); }
.nh .nh-strip + .tk-layout { margin-top: 16px; }
.nh .tk-layout.nh-layout { grid-template-columns: minmax(0, 1fr); }
.nh .nh-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; }
.nh .nh-dot.a { background: var(--pa); }
.nh .nh-dot.b { background: var(--pb); }

/* ---- Shapes: colour never works alone ---- */
.nh .nh-sh { display: inline-block; flex: none; width: 11px; height: 11px; background: var(--tone); }
.nh .nh-sh.fusion { --tone: var(--tone-fusion); border-radius: 50%; }
.nh .nh-sh.flow { --tone: var(--tone-flow); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.nh .nh-sh.quiet { --tone: var(--tone-quiet); background: transparent; border: 2.5px solid var(--tone); border-radius: 50%; }

.nh .nh-kick { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-accent-ink); margin-bottom: 4px; }
.nh .nh-funnel { container: nhfunnel / inline-size; }

/* ---- The empty state's crest ---- */
.nh .nh-sample { margin: 0 auto; width: 100%; max-width: 240px; }
.nh .nh-crest { display: block; width: 100%; height: auto; overflow: visible; }
.nh .nh-sample .nh-crest circle, .nh .nh-sample .nh-crest path { fill: none; }
.nh .nh-sample .s-accent { stroke: var(--c-accent); }
.nh .nh-sample .s-ink { stroke: var(--c-ink); }
.nh .nh-sample .s-line { stroke: #CBD5E1; }
.nh .nh-sample .nh-crest path.f-accent { fill: var(--c-accent); }

/* ================= Level 2: the Crown Moniker ================= */
.nh .nh-hero .rk-top { position: relative; }
.nh .nh-hero .rk-ribbon { white-space: normal; height: auto; min-height: 28px; padding: 4px 12px; }
.nh .nh-mark { position: absolute; right: -14%; top: -12%; width: min(70%, 520px); height: auto; fill: none; stroke: var(--c-accent); stroke-width: 1.5; opacity: 0.1; pointer-events: none; }
.nh .nh-stage { position: relative; display: grid; gap: 20px; justify-items: center; margin-top: 12px; text-align: center; }
.nh .nh-crestwrap { width: min(62%, 240px); }
.nh .nh-crestwrap .nh-crest { filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--c-accent) 18%, transparent)); }
.nh .nh-crown { container: nhcrown / inline-size; width: 100%; min-width: 0; }
@container rk (min-width: 700px) {
  .nh .nh-stage { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 36px; align-items: center; justify-items: stretch; text-align: left; }
  .nh .nh-crestwrap { width: 100%; }
}

/* the Crown Name: 800 weight, the loudest thing on the page. Its size follows its length so eleven letters still fit the column. */
.nh .nh-name { --chars: 5; margin: 0; font-size: clamp(2.5rem, calc(150cqw / var(--chars)), 6.75rem); font-weight: 800; letter-spacing: -0.045em; line-height: 0.95; color: var(--c-ink); overflow-wrap: anywhere; }
.nh .nh-name::after { content: ""; display: block; width: min(100%, 4.2em); height: 0.07em; min-height: 4px; margin: 0.12em auto 0; border-radius: 2px; background: var(--c-accent); }
@container rk (min-width: 700px) { .nh .nh-name::after { margin-left: 0; } }
.nh .nh-guide { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 12px; margin-top: 14px; }
@container rk (min-width: 700px) { .nh .nh-guide { justify-content: flex-start; } }
.nh .nh-guide-k { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); }
.nh .nh-guide-v { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem); font-weight: 700; letter-spacing: 0.06em; color: var(--c-ink); }

/* the lineage bar: two tones, one per origin, the exact split */
.nh .nh-lin { margin-top: 22px; text-align: left; }
.nh .nh-lin-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.nh .nh-lin-l { display: grid; gap: 1px; min-width: 0; }
.nh .nh-lin-l.b { text-align: right; justify-items: end; }
.nh .nh-lin-l b { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); }
.nh .nh-lin-n { max-width: 100%; font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.nh .nh-lin-l.a .nh-lin-n { color: var(--c-accent-ink); }
.nh .nh-lin-p { font-style: normal; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.nh .nh-lin-t { display: flex; gap: 3px; height: 14px; margin-top: 8px; }
.nh .nh-lin-t i { display: block; height: 100%; }
.nh .nh-lin-t i.a { flex: 0 0 calc(var(--w) - 1.5px); border-radius: 999px 3px 3px 999px; background: var(--c-accent); }
.nh .nh-lin-t i.b { flex: 1; border-radius: 3px 999px 999px 3px; background: var(--c-ink); }

.nh .nh-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; justify-content: center; }
@container rk (min-width: 700px) { .nh .nh-chips { justify-content: flex-start; } }
.nh .nh-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--c-line); background: #F1F5F9; font-size: 0.875rem; font-weight: 700; color: #334155; }
.nh .nh-chip.essence { background: color-mix(in srgb, var(--c-accent) 7%, #fff); border-color: color-mix(in srgb, var(--c-accent) 22%, #fff); color: var(--c-accent-ink); }
.nh .nh-chip-k { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); }
.nh .nh-chip b { font-size: 0.9375rem; font-weight: 800; }
.nh .nh-hero .rk-actions { justify-content: center; }
@container rk (min-width: 700px) { .nh .nh-hero .rk-actions { justify-content: flex-start; } }

/* ================= Level 3: the curated lineage suites ================= */
.nh .rk-bento.nh-bento { grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
@container nhfunnel (min-width: 860px) { .nh .rk-bento.nh-bento { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.nh .nh-tile { --tone: var(--tone-quiet); display: flex; flex-direction: column; border-top: 3px solid var(--tone); }
.nh .nh-tile.flow { --tone: var(--tone-flow); }
.nh .nh-tile.fusion { --tone: var(--tone-fusion); }
.nh .nh-tile h3 { display: flex; align-items: center; gap: 8px; }
.nh .nh-tile-sub { margin-top: 10px; font-size: 0.9375rem; font-weight: 600; line-height: 1.35; color: var(--c-muted); }
.nh .nh-list { display: grid; gap: 8px; margin-top: 16px; }
.nh .nh-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; width: 100%; min-height: 60px; padding: 10px 14px; border: 1px solid var(--c-line); border-radius: 12px; background: #fff; font: inherit; color: var(--c-ink); text-align: left; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease); }
.nh .nh-pick:hover { background: var(--c-accent-tint); border-color: color-mix(in srgb, var(--c-accent) 35%, #fff); }
.nh .nh-pick:active { transform: translateY(1px); }
.nh .nh-pick-main { display: grid; gap: 1px; min-width: 0; }
.nh .nh-pick-name { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.nh .nh-pick-say { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; color: var(--c-muted); }
.nh .nh-pick-score { font-size: 1.125rem; font-weight: 800; color: #334155; }
.nh .nh-pick-copy { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--c-muted); }
.nh .nh-pick-copy svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nh .nh-pick:hover .nh-pick-copy { color: var(--c-accent-ink); }
.nh .nh-ic-done { display: none; }
.nh .nh-pick.is-copied { background: var(--c-accent-tint); border-color: var(--c-accent); }
.nh .nh-pick.is-copied .nh-ic-copy { display: none; }
.nh .nh-pick.is-copied .nh-ic-done { display: block; }
.nh .nh-pick.is-copied .nh-pick-copy { color: var(--c-accent-ink); }

.nh .nh-method { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--c-line); }
.nh .nh-method summary { display: inline-flex; align-items: center; min-height: 36px; font-size: 0.9375rem; font-weight: 700; color: var(--c-accent-ink); cursor: pointer; }
.nh .nh-method ol { display: grid; gap: 6px; margin: 10px 0 0 1.25rem; list-style: decimal; font-size: 0.875rem; line-height: 1.45; color: #475569; max-width: 70ch; }
.nh .nh-pool { margin-top: 12px; font-size: 0.875rem; font-weight: 600; color: var(--c-muted); }

.nh .nh-nexts { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .nh .nh-nexts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Motion: the crown rises, the bar fills ---- */
@keyframes nh-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes nh-grow { from { flex-basis: 0; } }
@keyframes nh-draw { from { opacity: 0; transform: scale(0.94); } to { opacity: 0.1; transform: none; } }
@keyframes nh-spin { from { opacity: 0; transform: rotate(-18deg) scale(0.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .nh .results.is-in .nh-mark { animation: nh-draw 1.1s var(--ease) 0.1s backwards; transform-origin: 70% 40%; }
  .nh .results.is-in .nh-crestwrap .nh-crest { animation: nh-spin 0.9s var(--ease) 0.15s backwards; }
  .nh .results.is-in .nh-name { animation: nh-rise 0.6s var(--ease) 0.35s backwards; }
  .nh .results.is-in .nh-lin-t i.a { animation: nh-grow 0.9s var(--ease) 0.55s backwards; }
}
