/* Nia sections (1 Dec 2026): the fit check as Nia's check.
   Markup: src/index.html + src/who-its-for.html ([data-fitc] > figure.nia-cut + .fitc-col > form[data-fit]).
   Code: public/js/site.js (fit check). Without JS the plain form shows on the ink stage beside Nia.
   With JS: a board of four stations on the current line, her questions, answer cards, a revenue gate on the $1M
   question and her verdict, fed by the current. Out = signal blue, answers come back whiter.
   Tokens, .inlet, .gate, .card-ink and the nia-cut mask come from depth.css; nothing here edits them. */

.fitc-sec .sec-head { margin-bottom: 32px; }
.fitc .vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Stage: an ink panel that breaks out of the paper ---------- */
.fitc {
  --lamp: .34; --gut: 40px;
  position: relative; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  max-width: 1080px; min-height: 600px; border-radius: var(--r-card); overflow: hidden;
  background: linear-gradient(180deg, #0B0D12, #0D1018);
  color: var(--text-on-ink); box-shadow: var(--z3);
}
.fitc.is-chat { min-height: 560px; }
.fitc.is-chat .fitc-col { max-height: 700px; justify-content: center; grid-column: 2; grid-row: 1; }
.fitc.is-chat .fitc-log { flex: 0 1 auto; }
@media (min-width: 860px) {
  .fitc.is-chat .nia-cut.fitc-nia { position: absolute; left: -2%; bottom: 0; top: auto; height: 100%; width: auto; max-width: 54%; aspect-ratio: 1; margin: 0; }
  .fitc.is-chat .nia-cut.fitc-nia img { object-position: 50% 100%; }
}
.fitc::before { /* signal inlet where the current arrives */
  content: ""; position: absolute; left: 32px; top: 0; width: 56px; height: 3px; background: var(--signal); z-index: 3;
}
/* Key light behind Nia: brightens with each yes, full at a fit, low at a wait */
.fitc-key, .fitc:not(.is-chat)::after {
  position: absolute; left: 0; top: 0; bottom: 0; width: calc(5 / 11 * 100%); pointer-events: none; z-index: 0;
  background: radial-gradient(56% 50% at 54% 46%, rgba(91,140,255,.46), rgba(56,82,150,.16) 52%, rgba(11,13,18,0) 76%);
}
.fitc:not(.is-chat)::after { content: ""; opacity: .55; }
.fitc-key { opacity: calc(.18 + var(--lamp) * .8); transition: opacity 1.1s var(--ease-arrive); }

/* Nia, large, bleeding off the bottom of the stage (reuses the depth.css nia-cut mask) */
.fitc .nia-cut.fitc-nia {
  position: relative; right: auto; bottom: auto; align-self: end; width: 118%; height: auto; aspect-ratio: 1;
  margin: 0 0 -2px -6%; z-index: 1; pointer-events: none; grid-column: 1; grid-row: 1;
}
.fitc .fitc-nia img { transition: transform 1.4s var(--ease-arrive); transform-origin: 56% 70%; }
.fitc .fitc-nia::after { /* veil: dims her a little when the verdict is not yet */
  content: ""; position: absolute; inset: 0; background: #0B0D12; opacity: 0; transition: opacity 1.2s var(--ease-arrive); pointer-events: none;
  -webkit-mask-image: radial-gradient(60% 60% at 50% 55%, #000, transparent); mask-image: radial-gradient(60% 60% at 50% 55%, #000, transparent);
}
.fitc .nia-cut .rim { opacity: var(--lamp); }
.fitc.is-talking .nia-cut .rim { opacity: calc(var(--lamp) + .3); transition-duration: .3s; }
.fitc[data-fitc-result="fit"] .fitc-nia img { transform: scale(1.035) translate(1.2%, -.8%); }
.fitc[data-fitc-result="wait"] .fitc-nia img { transform: scale(.99) translate(-.8%, .6%); }
.fitc[data-fitc-result="wait"] .fitc-nia::after { opacity: .3; }

/* Her credit sits on her shoulder, with a live status line */
.fitc .nia-cut figcaption { left: 9%; right: auto; top: auto; bottom: 30px; text-align: left; z-index: 2; }
.fitc-status { display: block; margin-top: 6px; font: 600 .82rem/1.3 var(--font-body); color: var(--signal-lit); min-height: 1.3em; }
.fitc-status:empty { display: none; }
.fitc[data-fitc-result="wait"] .fitc-status { color: var(--mute-on-ink); }

/* The current line between Nia and the chat; a pulse runs down it while she types */
.fitc-wire { position: absolute; top: 0; bottom: 0; left: calc(5 / 11 * 100%); width: 1px; background: rgba(91,140,255,.26); z-index: 2; overflow: hidden; }
.fitc-wire::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 120px;
  background: linear-gradient(180deg, rgba(169,195,255,0), #A9C3FF); opacity: 0; transform: translateY(-120px);
}
.fitc.is-talking .fitc-wire::after { animation: fitc-current 1.1s linear infinite; }
@keyframes fitc-current { 0% { opacity: 1; transform: translateY(-120px); } 100% { opacity: 1; transform: translateY(700px); } }

/* ---------- Chat column ---------- */
.fitc-col { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 12px; padding: 40px 44px 32px var(--gut); min-width: 0; min-height: 0; }
.fitc-who { display: block; margin: 0 0 2px; font: 700 .82rem/1.2 var(--font-display); color: var(--signal-lit); letter-spacing: 0; }
.fitc-hello { /* plain form (no JS) intro */
  position: relative; max-width: 34em; margin: 0; padding: 12px 16px 13px; border-radius: 2px var(--r-card) var(--r-card) var(--r-card);
  background: #161B28; color: #fff; font-size: 1.02rem; line-height: 1.5; box-shadow: var(--z3);
}

/* Board: Nia's check, four stations on the current line from the wire */
.fitc-board { flex: none; margin: 0 0 4px; }
.fitc-board-top { display: flex; justify-content: space-between; gap: 16px; margin: 0 0 12px; max-width: none; font: 600 .88rem/1.3 var(--font-body); color: var(--mute-on-ink); font-variant-numeric: tabular-nums; }
.fitc-step { color: #fff; }
.fitc-track { position: relative; margin-left: calc(-1 * var(--gut)); padding-left: var(--gut); }
.fitc-line, .fitc-fill { position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: #262C3A; }
.fitc-fill { background: var(--signal); transform-origin: 0 50%; transform: scaleX(0); transition: transform .7s linear; }
.fitc-pulse { position: absolute; left: 0; top: 7px; width: 72px; height: 4px; border-radius: 2px; opacity: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, rgba(91,140,255,0), #5B8CFF 70%, #A9C3FF); }
.fitc-pulse.back { background: linear-gradient(90deg, #fff, rgba(169,195,255,.9) 30%, rgba(169,195,255,0)); }
.fitc-sts { position: relative; z-index: 2; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fitc-st { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fitc-dot { position: relative; width: 18px; height: 18px; border-radius: 50%; background: #0D1018; border: 2px solid #3A4252;
  transition: background var(--ui) ease, border-color var(--ui) ease; }
.fitc-dot::after { /* glow sprite, opacity only */
  content: ""; position: absolute; left: -15px; top: -15px; width: 44px; height: 44px; border-radius: 50%; opacity: 0;
  background: radial-gradient(50% 50% at 50% 50%, rgba(169,195,255,.7), rgba(91,140,255,0) 70%); transition: opacity .5s var(--ease-arrive);
}
.fitc-lab { font: 600 .8rem/1.25 var(--font-body); color: var(--mute-on-ink); transition: color var(--ui) ease; }
.fitc-st.now .fitc-dot { border-color: var(--signal-lit); }
.fitc-st.now .fitc-lab { color: #fff; }
.fitc-st.yes .fitc-dot { background: var(--signal); border-color: var(--signal); }
.fitc-st.yes .fitc-dot::after { opacity: .9; }
.fitc-st.yes .fitc-lab { color: var(--signal-lit); }
.fitc-st.no .fitc-dot { background: #262C3A; border-color: #262C3A; transform: scale(.72); }
.fitc-st.no .fitc-lab { color: rgba(245,246,248,.4); }

/* Log: newest at the bottom, earlier lines fold up */
.fitc-log { list-style: none; margin: 0; padding: 4px 2px 2px 0; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
.fitc-log::-webkit-scrollbar { display: none; }
.fitc-log.is-over { -webkit-mask-image: linear-gradient(180deg, transparent, #000 44px); mask-image: linear-gradient(180deg, transparent, #000 44px); }
.fitc-msg { margin: 0; flex: none; }
.fitc-msg p { margin: 0; max-width: none; }
.fitc-msg.nia { position: relative; max-width: 34em; color: var(--text-on-ink); font-size: .92rem; line-height: 1.45; }
.fitc-msg.nia.now {
  padding: 13px 18px 14px; border-radius: 2px var(--r-card) var(--r-card) var(--r-card);
  background: #161B28; color: #fff; font-size: 1.02rem; line-height: 1.5; box-shadow: var(--z3);
}
.fitc-msg.nia.now::before { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 28px; background: var(--signal); }
.fitc-msg.nia .fitc-react { color: var(--text-on-ink); }
.fitc-msg.nia.past .fitc-react { display: none; }
.fitc-msg.nia .fitc-react + .fitc-q { margin-top: 6px; }
.fitc-msg.nia.now .fitc-q { color: #fff; font-weight: 600; font-size: 1.1rem; line-height: 1.42; }
.fitc-msg.nia.past .fitc-q { padding-left: 14px; border-left: 1px solid rgba(91,140,255,.4); }
.fitc-msg.fitc-hi.now .fitc-q { font-weight: 400; font-size: 1.02rem; }
.fitc-msg.fitc-hi .fitc-who { display: inline; margin-right: 6px; }
.fitc-msg.fitc-hi.past { display: none; }
.fitc-msg.you { /* answers come back whiter */
  align-self: flex-end; max-width: 80%; padding: 8px 14px; border-radius: var(--r-card) 2px var(--r-card) var(--r-card);
  background: var(--paper-2); color: var(--ink); font: 600 .95rem/1.35 var(--font-body); box-shadow: 0 0 0 1px rgba(169,195,255,.5), var(--z2);
}
.fitc-msg.gate-msg { align-self: stretch; max-width: 360px; }
.fitc .fitc-gate { max-width: 360px; padding: 14px 16px 12px; }
.fitc .fitc-gate .gate-meter { margin-top: 10px; }
.fitc .fitc-gate .gate-status { justify-content: flex-start; flex-wrap: wrap; }
.fitc .fitc-gate .example-text { margin-left: auto; font-size: .78rem; }
.fitc-typing { align-self: flex-start; flex: none; padding: 14px 16px; border-radius: 2px var(--r-card) var(--r-card) var(--r-card); background: #161B28; box-shadow: var(--z3); }
.fitc-typing span { display: block; position: relative; width: 44px; height: 2px; background: rgba(91,140,255,.25); overflow: hidden; }
.fitc-typing span::after { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 2px; background: var(--signal-lit); animation: fitc-type .62s linear infinite; }
@keyframes fitc-type { from { transform: translateX(-14px); } to { transform: translateX(44px); } }

/* Answers: big cards on the near plane */
.fitc-answers { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; outline: none; }
.fitc-answers:empty { display: none; }
.fitc-opt {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 14px 18px; border: 1px solid var(--rule-ink); border-radius: var(--r-card);
  background: #151A27; color: #fff; font: 600 1.05rem/1.3 var(--font-body); text-align: left; cursor: pointer; box-shadow: var(--z3);
  transition: background var(--ui) ease, border-color var(--ui) ease;
}
.fitc-ring { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(169,195,255,.55); transition: background var(--ui) ease, border-color var(--ui) ease; }
.fitc-opt:hover { background: #1A2030; border-color: rgba(91,140,255,.5); }
.fitc-opt:hover .fitc-ring { border-color: var(--signal); background: var(--signal); }
.fitc-opt:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.fitc-opt:disabled { opacity: .4; cursor: default; }
.fitc-opt.picked { opacity: 1; background: var(--paper-2); color: var(--ink); }
.fitc-opt.picked .fitc-ring { border-color: var(--signal); background: var(--signal); }

/* Arrivals (transform + opacity only) */
.fitc-in { animation: fitc-arrive .34s var(--ease-arrive) both; }
.fitc-msg.you.fitc-in { animation-name: fitc-arrive-r; }
@keyframes fitc-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fitc-arrive-r { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- The form: plain fallback without JS, holder of the verdict with JS ---------- */
.fitc .fit-box.fitc-form { margin: 4px 0 0; padding: 0; background: none; border: 0; box-shadow: none; display: block; max-width: none; flex: none; }
.fitc .fit-q { margin: 0 0 18px; }
.fitc .fit-q legend { color: #fff; font-weight: 600; font-size: 1.02rem; margin-bottom: 8px; }
.fitc .fit-q label {
  display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 6px 0; padding: 10px 14px;
  border: 1px solid rgba(245,246,248,.18); border-radius: var(--r-control); color: #fff; cursor: pointer;
}
.fitc .fit-q label:has(input:checked) { border-color: var(--signal); }
.fitc .fit-q input { margin: 0; accent-color: var(--signal); width: 18px; height: 18px; flex: none; }
.fitc .fit-end { margin-top: 4px; }
.fitc.is-chat .fit-q, .fitc.is-chat .fit-end { display: none; }
.fitc.is-chat .fit-box.fitc-form { margin: 0; }

/* Plain-form result (no chat) on the ink stage */
.fitc .fit-result { margin-top: 14px; border-radius: var(--r-card); background: #161B28; color: var(--text-on-ink); border-left: 3px solid var(--signal); }
.fitc .fit-result b, .fitc .fit-result h3 { color: #fff; }
.fitc .fit-result p { margin: 0 0 8px; }
.fitc-miss { margin: 6px 0 10px; padding: 0; list-style: none; }
.fitc-miss li { position: relative; padding-left: 20px; margin: 4px 0; }
.fitc-miss li::before { content: ""; position: absolute; left: 2px; top: .52em; width: 8px; height: 8px; border-radius: 50%; border: 2px solid #9AA3B4; }
.fitc-miss-k { font-weight: 600; margin-top: 10px !important; }

/* Verdict: her answer as a paper card on the nearest plane, fed by the current from the wire */
.fitc .fit-result.fitc-verdict {
  position: relative; margin: 6px 0 0; padding: 20px 22px 16px; border: 0; border-radius: var(--r-card);
  background: var(--paper-2); color: var(--text-on-paper); box-shadow: var(--z4);
}
.fitc-feed { position: absolute; left: calc(-1 * var(--gut)); top: -1px; width: calc(var(--gut) + 24px); height: 3px; background: var(--signal);
  transform-origin: 0 50%; transform: scaleX(0); transition: transform .45s linear; }
.fitc-verdict.is-feeding .fitc-feed, .fitc-verdict.is-fed .fitc-feed { transform: none; }
.fitc-verdict.is-feeding { --inlet: 1; }
.fitc-verdict.is-fed { --inlet: .35; }
.fitc-verdict.no.is-fed { --inlet: 0; }
.fitc-verdict .fitc-who { color: var(--signal-link); }
.fitc .fitc-verdict h3 { margin: 2px 0 8px; color: var(--ink); font: 700 1.45rem/1.15 var(--font-display); letter-spacing: -.01em; outline: none; }
.fitc-verdict p { margin: 0; max-width: 36em; }
.fitc .fitc-verdict p { margin: 0 0 6px; }
.fitc-verdict .fit-actions { margin-top: 14px !important; display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.fitc-verdict .btn-signal { min-height: 48px; }
.fitc-verdict .inner-text-link, .fitc-verdict .fit-ask { color: var(--ink); }
.fitc-again-row { margin: 14px 0 0 !important; padding-top: 10px; border-top: 1px solid var(--rule-paper); }
.fitc-again { padding: 0; border: 0; background: none; color: var(--mute-on-paper); font: 600 .88rem/1.3 var(--font-body); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.fitc-again:hover { color: var(--ink); }

/* One Nia at a time: the floating launcher docks while her stage is on screen */
html.fitc-near .nchat-launch { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(16px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s; }
.nchat-launch { transition: opacity .2s ease, transform .2s ease; }

/* ---------- Phone and narrow tablets ---------- */
@media (max-width: 859px) {
  .fitc { --gut: 18px; display: block; min-height: 0; margin-inline: -4px; }
  .fitc.is-chat { height: auto; }
  .fitc-key, .fitc:not(.is-chat)::after { width: 100%; bottom: auto; height: 260px; }
  .fitc .nia-cut.fitc-nia { width: 100%; height: 260px; margin: 0; aspect-ratio: auto; display: block; }
  .fitc .nia-cut.fitc-nia img { width: 260px; height: 260px; margin: 0 -10px 0 auto; display: block; }
  .fitc .nia-cut.fitc-nia .rim, .fitc .fitc-nia::after { left: auto; width: 260px; right: -10px; }
  .fitc .nia-cut figcaption { left: 18px; right: auto; bottom: 30%; text-align: left; }
  .fitc-wire { left: 0; right: 0; top: 260px; bottom: auto; width: auto; height: 1px; }
  .fitc-wire::after { display: none; }
  .fitc-col { padding: 20px 18px 22px; }
  .fitc-log, .fitc.is-chat .fitc-log { overflow: visible; flex: none; }
  .fitc.is-chat .fitc-col { max-height: none; }
  .fitc-log > :first-child { margin-top: 0; }
  .fitc-log.is-over { -webkit-mask-image: none; mask-image: none; }
  .fitc-lab { font-size: .72rem; }
  .fitc-answers { grid-template-columns: 1fr; }
  .fitc-opt { min-height: 58px; }
  .fitc-msg.you { max-width: 88%; }
  .fitc-feed { display: none; }
  .fitc .fit-result.fitc-verdict { padding-top: 18px; }
  .fitc .fitc-verdict h3 { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fitc-in, .fitc-msg.you.fitc-in { animation: none; }
  .fitc.is-talking .fitc-wire::after, .fitc-typing span::after { animation: none; }
  .fitc-key, .fitc .fitc-nia img, .fitc .fitc-nia::after, .fitc-fill, .fitc-dot, .fitc-dot::after, .fitc-feed, .fitc-opt, .fitc-ring, .fitc .nia-cut .rim,
  html.fitc-near .nchat-launch, .nchat-launch { transition: none; }
}
