/* Narrera site previews: base styles for the shared demo. Layout and behaviour
   live here; each direction sets the tokens (colours, type, radius). */
.nd {
  --nd-bg: #fbfbf9; --nd-fg: #141416; --nd-muted: #66666a; --nd-line: #e4e4e0;
  --nd-field: #fbfbf9; --nd-panel: #fbfbf9; --nd-accent: #7fcbe6; --nd-accent-fg: #141416;
  --nd-highlight: #ffd54a; --nd-link: #1b6f8f; --nd-flag: #c8352f; --nd-ink-pill: #141416; --nd-ink-pill-fg: #fbfbf9;
  --nd-who: #7fcbe6; --nd-problem: #ffd54a; --nd-when: #1b6f8f; --nd-because: #141416; --nd-today: #c5c5c1;
  --nd-radius: 10px;
  --nd-font-display: 'Figtree', ui-sans-serif, system-ui, sans-serif;
  --nd-font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --nd-font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: var(--nd-font-body); color: var(--nd-fg); min-width: 0;
}
.nd *, .nd *::before, .nd *::after { box-sizing: border-box; }
.nd button { font: inherit; cursor: pointer; }
.nd button:focus-visible, .nd input:focus-visible, .nd textarea:focus-visible { outline: 2px solid var(--nd-link); outline-offset: 2px; }

.nd-field { display: flex; flex-direction: column; gap: 12px; }
.nd-label { font-family: var(--nd-font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--nd-link); }
.nd-textarea { width: 100%; min-height: 92px; resize: vertical; border: 1px solid var(--nd-line); border-radius: var(--nd-radius); padding: 14px 16px; font-family: var(--nd-font-body); font-size: 18px; line-height: 1.45; background: var(--nd-field); color: var(--nd-fg); }
.nd-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nd-try { font-family: var(--nd-font-display); font-size: 13px; color: var(--nd-muted); margin-right: 2px; }
.nd-ex { border: 1px solid var(--nd-line); background: transparent; color: var(--nd-fg); border-radius: 999px; padding: 6px 12px; font-family: var(--nd-font-display); font-size: 13px; font-weight: 500; line-height: 1.2; }
.nd-ex:hover { border-color: var(--nd-fg); }
.nd-ex.is-active { background: var(--nd-ink-pill); color: var(--nd-ink-pill-fg); border-color: var(--nd-ink-pill); }
.nd-actions { gap: 14px; }
.nd-run { border: 0; background: var(--nd-accent); color: var(--nd-accent-fg); border-radius: 999px; padding: 12px 20px; font-family: var(--nd-font-display); font-weight: 600; font-size: 15px; line-height: 1; }
.nd-run:hover { filter: brightness(.96); }
.nd-run:disabled { opacity: .6; cursor: default; }
.nd-status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--nd-font-mono); font-size: 13px; color: var(--nd-muted); min-height: 20px; }
.nd-mark { width: 18px; height: 18px; flex: none; color: var(--nd-fg); }

.nd-out { display: flex; flex-direction: column; gap: 26px; margin-top: 26px; }
.nd-section { min-width: 0; }
.nd-h { font-family: var(--nd-font-display); font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--nd-muted); margin: 0 0 12px; }

.nd-sentence { font-size: clamp(19px, 2.2vw, 24px); line-height: 1.55; margin: 0; text-wrap: pretty; }
.nd-m { color: inherit; background: transparent; border-radius: 3px; padding: .04em .1em; white-space: normal; }
.nd-m[data-part="who"] { background: var(--nd-who); }
.nd-m[data-part="problem"] { background: var(--nd-problem); }
.nd-m[data-part="when"] { box-shadow: inset 0 -2px 0 var(--nd-when); }
.nd-m[data-part="because"] { text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: .2em; text-decoration-color: var(--nd-because); }
.nd-m[data-part="today"] { background: var(--nd-today); }
.nd-tag { font-family: var(--nd-font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; margin-left: 5px; vertical-align: .35em; opacity: .75; }

.nd-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.nd-part { border: 1px solid var(--nd-line); border-radius: var(--nd-radius); padding: 14px 14px 12px; background: var(--nd-panel); min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.nd-part.is-missing { border-style: dashed; }
.nd-part-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nd-sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.nd-part[data-part="who"] .nd-sw { background: var(--nd-who); }
.nd-part[data-part="problem"] .nd-sw { background: var(--nd-problem); }
.nd-part[data-part="when"] .nd-sw { background: transparent; border-bottom: 3px solid var(--nd-when); border-radius: 0; height: 10px; }
.nd-part[data-part="because"] .nd-sw { background: transparent; border-bottom: 3px dotted var(--nd-because); border-radius: 0; height: 10px; }
.nd-part[data-part="today"] .nd-sw { background: var(--nd-today); }
.nd-part-l { font-family: var(--nd-font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--nd-fg); }
.nd-missing { font-family: var(--nd-font-display); font-style: normal; font-size: 12px; color: var(--nd-muted); margin-left: auto; }
.nd-added { font-family: var(--nd-font-display); font-size: 11px; color: var(--nd-link); margin-left: auto; }
.nd-val { margin: 0; font-size: 17px; line-height: 1.4; }
.nd-hint { margin: 0; font-family: var(--nd-font-display); font-size: 12.5px; line-height: 1.4; color: var(--nd-muted); }
.nd-ask { margin: 0; font-size: 16px; line-height: 1.4; display: flex; flex-direction: column; gap: 2px; }
.nd-ask-l { font-family: var(--nd-font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--nd-link); }
.nd-sugs { display: flex; flex-wrap: wrap; gap: 6px; }
.nd-sug { border: 1px solid var(--nd-link); color: var(--nd-link); background: transparent; border-radius: 999px; padding: 5px 10px; font-family: var(--nd-font-display); font-size: 12.5px; font-weight: 500; text-align: left; line-height: 1.25; }
.nd-sug:hover { background: var(--nd-link); color: var(--nd-bg); }
.nd-answer { display: flex; gap: 6px; }
.nd-answer input { flex: 1; min-width: 0; border: 1px solid var(--nd-line); border-radius: 8px; padding: 7px 10px; font-family: var(--nd-font-display); font-size: 13px; background: var(--nd-field); color: var(--nd-fg); }
.nd-answer button { border: 1px solid var(--nd-fg); background: transparent; color: var(--nd-fg); border-radius: 999px; padding: 6px 12px; font-family: var(--nd-font-display); font-size: 13px; font-weight: 500; }

.nd-qs { margin: 0; padding-left: 0; list-style: none; counter-reset: q; display: flex; flex-direction: column; gap: 10px; }
.nd-qs li { counter-increment: q; display: grid; grid-template-columns: 34px 1fr; gap: 10px; font-size: 17px; line-height: 1.45; align-items: start; }
.nd-qs li::before { content: "Q" counter(q); font-family: var(--nd-font-mono); font-size: 12px; letter-spacing: .06em; color: var(--nd-link); padding-top: .35em; }
.nd-never { margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--nd-flag); display: flex; flex-direction: column; gap: 4px; font-family: var(--nd-font-display); font-size: 14px; }
.nd-never s { color: var(--nd-muted); }
.nd-never span { color: var(--nd-flag); }

.nd-samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.nd-sample { margin: 0; border: 1px solid var(--nd-line); border-radius: var(--nd-radius); padding: 14px; background: var(--nd-panel); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.nd-who { display: flex; align-items: center; gap: 10px; font-family: var(--nd-font-display); }
.nd-who img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.nd-who b { display: block; font-weight: 600; font-size: 14px; }
.nd-who span { display: block; font-size: 12.5px; color: var(--nd-muted); }
.nd-sample blockquote { margin: 0; font-size: 17px; line-height: 1.5; }
.nd-band { padding: .05em .15em; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.nd-sample[data-strength="5"] .nd-band { background: var(--nd-highlight); }
.nd-sample[data-strength="4"] .nd-band { background: color-mix(in srgb, var(--nd-highlight) 60%, transparent); }
.nd-sample[data-strength="3"] .nd-band { background: color-mix(in srgb, var(--nd-highlight) 30%, transparent); }
.nd-sample[data-strength="2"] .nd-band { text-decoration: underline; text-decoration-color: var(--nd-today); text-decoration-thickness: 2px; text-underline-offset: .18em; }
.nd-sample[data-strength="1"] .nd-band { text-decoration: underline dotted; text-decoration-color: var(--nd-today); text-decoration-thickness: 2px; text-underline-offset: .18em; }
.nd-sample figcaption { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--nd-font-display); font-size: 12.5px; color: var(--nd-muted); }
.nd-badge { font-family: var(--nd-font-mono); font-size: 12px; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--nd-line); color: var(--nd-fg); }
.nd-sample[data-strength="5"] .nd-badge { background: var(--nd-highlight); border-color: var(--nd-highlight); }
.nd-meter { display: inline-flex; gap: 3px; }
.nd-meter i { width: 6px; height: 12px; border-radius: 2px; background: var(--nd-line); }
.nd-meter i.on { background: var(--nd-fg); }
.nd-note { margin: 10px 0 0; font-family: var(--nd-font-display); font-size: 12.5px; color: var(--nd-muted); }

/* The waves settle: the brand's one motion, copied from the app's keyframes. */
@keyframes nd-settle-middle {
  from { d: path('M8 54C16.65 37.96 20.35 37.96 29 54C37.65 70.04 41.35 70.04 50 54C58.65 37.96 62.35 37.96 71 54C79.65 70.04 83.35 70.04 92 54'); stroke-width: 8; }
  to   { d: path('M8 54C16.65 45.98 20.35 45.98 29 54C37.65 62.02 41.35 62.02 50 54C58.65 45.98 62.35 45.98 71 54C79.65 62.02 83.35 62.02 92 54'); stroke-width: 5; }
}
@keyframes nd-settle-bottom {
  from { d: path('M8 74C16.65 57.96 20.35 57.96 29 74C37.65 90.04 41.35 90.04 50 74C58.65 57.96 62.35 57.96 71 74C79.65 90.04 83.35 90.04 92 74'); stroke-width: 8; }
  to   { d: path('M8 74C16.65 69.99 20.35 69.99 29 74C37.65 78.01 41.35 78.01 50 74C58.65 69.99 62.35 69.99 71 74C79.65 78.01 83.35 78.01 92 74'); stroke-width: 4; }
}
.nd-settle .w2 { animation: nd-settle-middle .6s ease-out; }
.nd-settle .w3 { animation: nd-settle-bottom .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .nd-settle .w2, .nd-settle .w3 { animation: none; } }

@media (max-width: 520px) {
  .nd-textarea { font-size: 16px; }
  .nd-sentence { font-size: 18px; }
  .nd-parts { grid-template-columns: 1fr; }
}
