/* ==========================================================================
   RAG & Knowledge Assistants — page visuals
   knowledge pipeline (hero), cited excerpt (intro), pinned pipeline stages,
   source rows, trust card, question use cases, answer interface (cinematic)
   ========================================================================== */
.rag-title { font-size: clamp(2.8rem, 0.4rem + 8.2vw, 10.5rem); }
.d-glow--rag {
  inset: -4% 4% 42%;
  background:
    radial-gradient(34% 55% at 18% 55%, rgb(58 126 246 / 0.42), transparent 70%),
    radial-gradient(38% 60% at 52% 40%, rgb(107 63 212 / 0.55), transparent 70%),
    radial-gradient(30% 50% at 86% 60%, rgb(214 51 132 / 0.26), transparent 70%);
}

/* ==========================================================================
   Hero — sources → knowledge layer → assistant → traceable answer
   ========================================================================== */
.kp { --px: 0; --py: 0; position: relative; max-width: 76rem; margin-inline: auto; border: 1px solid rgb(255 255 255 / 0.12); border-radius: clamp(1rem, 1.6vw, 1.75rem); background: #07070a; color: var(--white); overflow: hidden; }
.kp__bar { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid rgb(255 255 255 / 0.08); font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(255 255 255 / 0.5); }
.kp__run { flex: 1; }
.kp__live { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--green); }
.kp__live i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.kp__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(3.5rem, 7vw, 7.5rem) minmax(0, 1.02fr) clamp(2rem, 3.5vw, 3.5rem) minmax(0, 1.25fr);
  padding: clamp(3rem, 5vw, 4.5rem) clamp(1.25rem, 3vw, 3rem) clamp(1.75rem, 3vw, 3rem);
  background-image: radial-gradient(rgb(255 255 255 / 0.06) 1px, transparent 1.5px);
  background-size: 22px 22px;
}
.kp__col { position: relative; min-width: 0; }
.kp__k { position: absolute; left: 0; bottom: calc(100% + 0.7rem); font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: rgb(255 255 255 / 0.45); white-space: nowrap; }

/* sources: equal rows so their centres match the fan's end points */
.kp__docs { display: grid; grid-template-rows: repeat(5, minmax(0, 1fr)); height: 100%; }
.kp__doc { display: flex; align-items: center; gap: 0.65rem; margin-block: 0.28rem; padding: 0.55rem 0.7rem; border: 1px solid rgb(255 255 255 / 0.12); border-radius: 0.7rem; background: rgb(255 255 255 / 0.03); }
.kp__type { flex: none; min-width: 2.7rem; padding: 0.3rem 0.35rem; border-radius: 0.35rem; background: rgb(58 126 246 / 0.16); font: 700 0.64rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-style: normal; letter-spacing: 0.06em; text-align: center; color: var(--blue-bright); }
.kp__doc > span { min-width: 0; display: grid; }
.kp__doc b { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp__doc small { font-size: 0.68rem; color: rgb(255 255 255 / 0.5); }
.kp__tick { flex: none; margin-left: auto; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--green); }

.kp__fan { display: block; width: 100%; height: 100%; overflow: visible; }
.kp__line { fill: none; stroke: rgb(255 255 255 / 0.16); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.kp__flow { fill: none; stroke: var(--blue-bright); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 10 170; stroke-dashoffset: 10; }

.kp__col--index, .kp__col--answer { align-self: center; translate: calc(var(--px) * 8px) calc(var(--py) * 5px); }
.kp__col--answer { translate: calc(var(--px) * 14px) calc(var(--py) * 8px); }
.kp__index { padding: 1rem; border: 1px solid rgb(91 150 255 / 0.4); border-radius: 1rem; background: linear-gradient(160deg, rgb(107 63 212 / 0.2), rgb(58 126 246 / 0.07)); }
.kp__cells { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.kp__cells i { position: relative; aspect-ratio: 1; border-radius: 3px; background: rgb(255 255 255 / 0.08); }
.kp__cells i[style]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--blue-bright); opacity: 0; }
.kp__stats { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.9rem; font-size: 0.68rem; color: rgb(255 255 255 / 0.5); }
.kp__stats b { display: block; font-size: 1rem; font-weight: 600; color: var(--white); }

.kp__wire { position: relative; align-self: center; height: 6px; overflow: hidden; }
.kp__wire::after { content: ""; position: absolute; left: 0; right: 0; top: 2.5px; height: 1px; background: rgb(255 255 255 / 0.3); }
.kp__wire i { position: absolute; inset: 0; border-radius: 3px; background: linear-gradient(90deg, transparent 36%, var(--blue-bright) 36% 64%, transparent 64%); transform: translateX(-70%); }

.kp__ask { display: flex; align-items: center; gap: 0.6rem; width: fit-content; max-width: 100%; padding: 0.5rem 0.9rem 0.5rem 0.5rem; border-radius: 99em; background: rgb(255 255 255 / 0.07); font-size: 0.85rem; }
.kp__avatar { flex: none; width: 1.7rem; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, #9b7cf0, #4f6ff0); }
.kp__answer { margin-top: 0.75rem; padding: 1rem 1.1rem; border: 1px solid rgb(91 150 255 / 0.4); border-radius: 1rem; background: rgb(58 126 246 / 0.08); font-size: 0.9rem; line-height: 1.55; }
.kp__answer mark, .hl, .ask__chunk mark {
  /* background sweep instead of a pseudo-element: stays correct when a phrase wraps across lines */
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background-color: transparent; /* drop the UA yellow */
  background-repeat: no-repeat; background-position: 0 0; background-size: 100% 100%;
}
.kp__answer mark { color: var(--white); background-image: linear-gradient(transparent 40%, rgb(58 126 246 / 0.45) 40% 92%, transparent 92%); }
.kp__answer sup, .kp__sources sup { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; margin-left: 0.15rem; border-radius: 0.25rem; background: var(--blue); font-size: 0.62rem; font-weight: 700; line-height: 1; vertical-align: 0.35em; }
.kp__sources { display: grid; gap: 0.35rem; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid rgb(255 255 255 / 0.1); }
.kp__sources span { font: 500 0.72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.65); }
.kp__sources sup { margin: 0 0.45rem 0 0; vertical-align: 0; }
.kp__grounded { display: inline-flex; margin-top: 0.75rem; padding: 0.3rem 0.6rem; border-radius: 99em; background: rgb(116 214 90 / 0.12); font-size: 0.7rem; font-weight: 600; color: var(--green); }

@media (prefers-reduced-motion: no-preference) {
  .js .kp__doc { opacity: 0; transform: translate3d(-1rem, 0, 0); }
  .is-loaded .kp__doc { opacity: 1; transform: none; transition: opacity 0.6s var(--ease-soft), transform 0.9s var(--ease-out); transition-delay: calc(1.1s + var(--k) * 110ms); }
  .js .kp__answer mark { background-size: 0% 100%; }
  .is-loaded .kp__answer mark { background-size: 100% 100%; transition: background-size 0.8s var(--ease-in-out) 2.1s; }
  .js .kp__sources span { opacity: 0; transform: translate3d(0, 0.4rem, 0); }
  .is-loaded .kp__sources span { opacity: 1; transform: none; transition: opacity 0.5s, transform 0.7s var(--ease-out); transition-delay: calc(2.5s + var(--k) * 160ms); }

  .kp__flow { animation: kp-flow 2.8s linear infinite; animation-delay: calc(var(--k) * -0.55s); }
  .kp__cells i[style]::after { animation: kp-hit 4.8s ease-in-out infinite; animation-delay: calc(var(--h) * 0.8s); }
  .kp__wire i { animation: kp-x 1.8s var(--ease-in-out) infinite; }
  .kp__live i { animation: kp-blink 1.6s ease-in-out infinite; }
  .d-hero.is-paused .kp *, .d-hero.is-paused .kp *::after { animation-play-state: paused; }

  @keyframes kp-flow { from { stroke-dashoffset: 10; } to { stroke-dashoffset: -170; } }
  @keyframes kp-hit { 0%, 14%, 100% { opacity: 0; } 4%, 10% { opacity: 1; } }
  @keyframes kp-x { from { transform: translateX(-70%); } to { transform: translateX(70%); } }
  @keyframes kp-blink { 50% { opacity: 0.25; } }
}

/* ==========================================================================
   Intro — the pitch written like a cited document
   ========================================================================== */
.rag-excerpt {
  max-width: 30em;
  margin: clamp(2rem, 3.5vw, 3.25rem) auto 0;
  font-size: clamp(1.35rem, 0.75rem + 1.85vw, 2.8rem); font-weight: 500; line-height: 1.42; letter-spacing: -0.03em;
  color: var(--gray-ink);
}
.hl { color: var(--black); font-weight: 600; background-image: linear-gradient(transparent 52%, rgb(58 126 246 / 0.26) 52% 94%, transparent 94%); }
.rag-excerpt sup { margin-left: 0.12em; font-size: 0.42em; vertical-align: 0.9em; }
.rag-excerpt sup a { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 0.35em; background: var(--blue); color: var(--white); font-weight: 700; line-height: 1; letter-spacing: 0; transition: background-color 0.3s; }
.rag-excerpt sup a:is(:hover, :focus-visible) { background: var(--purple); }
.rag-notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.75rem clamp(1.25rem, 3vw, 3rem); margin-top: clamp(3.5rem, 6vw, 6.5rem); padding-top: 1.5rem; border-top: 1px solid var(--black); text-align: left; }
.rag-notes li { display: grid; align-content: start; gap: 0.45rem; font-size: 0.95rem; line-height: 1.5; color: #5e5e5e; scroll-margin-top: calc(var(--header-h) + 3rem); }
.rag-notes b { font-size: 1.1rem; font-weight: 600; color: var(--black); }
.rag-notes__n { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 0.4rem; background: var(--blue); font-size: 0.75rem; font-weight: 700; color: var(--white); transition: box-shadow 0.4s; }
.rag-notes li:target .rag-notes__n { box-shadow: 0 0 0 5px rgb(58 126 246 / 0.25); }
@media (prefers-reduced-motion: no-preference) {
  .js .rag-excerpt .hl { background-size: 0% 100%; }
  .js .rag-excerpt.is-in .hl { background-size: 100% 100%; transition: background-size 0.9s var(--ease-in-out); transition-delay: calc(0.45s + var(--m) * 0.35s); }
}

/* ==========================================================================
   How RAG works — pipeline nodes + one stage in focus
   ========================================================================== */
.rag-flow { position: relative; background: var(--black); color: var(--white); }
.rag-flow .flow__title { margin-top: 1rem; font-size: clamp(2rem, 0.9rem + 2.8vw, 4.25rem); font-weight: 700; line-height: 0.98; letter-spacing: -0.05em; }
.rag-flow .flow__title .mask { display: block; width: fit-content; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.flow__status { font: 500 var(--fs-small)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.04em; color: var(--blue-bright); white-space: nowrap; }

.rag-flow .flow__steps { position: relative; }
.rag-flow .flow__steps ol { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rag-flow .flow__rail { position: absolute; left: calc(100% / 12); right: calc(100% / 12); top: 1.25rem; height: 1px; background: rgb(255 255 255 / 0.16); }
.rag-flow .flow__rail i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--purple), var(--blue-bright)); transform-origin: 0 50%; transform: scaleX(calc((var(--flow-progress, 0.1667) * 6 - 1) / 5)); transition: transform 0.8s var(--ease-out); }
.rag-flow .flow__step { display: grid; justify-items: center; }
.rag-flow .flow__btn { display: grid; justify-items: center; gap: 0.6rem; color: rgb(255 255 255 / 0.45); transition: color 0.4s; }
.rag-flow .flow__num { position: relative; display: grid; place-items: center; width: 2.5rem; aspect-ratio: 1; border: 1px solid rgb(255 255 255 / 0.25); border-radius: 50%; background: var(--black); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; transition: background-color 0.4s, border-color 0.4s, color 0.4s, transform 0.6s var(--ease-out); }
.rag-flow .flow__name { font-size: clamp(0.95rem, 0.8rem + 0.4vw, 1.25rem); font-weight: 600; letter-spacing: -0.02em; }
.rag-flow .flow__step.is-done .flow__btn { color: rgb(255 255 255 / 0.8); }
.rag-flow .flow__step.is-done .flow__num { border-color: var(--blue-bright); color: var(--blue-bright); }
.rag-flow .flow__step.is-active .flow__btn { color: var(--white); }
.rag-flow .flow__step.is-active .flow__num { border-color: var(--blue); background: var(--blue); color: var(--white); transform: scale(1.15); }
.rag-flow .flow__btn:is(:hover, :focus-visible) { color: var(--white); }

.rag-stages { display: grid; }
.rag-stage { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: center; gap: 2rem clamp(2rem, 5vw, 5rem); }
.rag-stage__n { display: block; font-size: clamp(2.8rem, 1.8rem + 3vw, 6rem); font-weight: 700; line-height: 1; letter-spacing: -0.05em; color: transparent; -webkit-text-stroke: 1.2px rgb(255 255 255 / 0.3); }
.rag-stage h3 { margin-top: 0.4rem; font-size: clamp(2rem, 1.1rem + 2.3vw, 3.75rem); font-weight: 700; letter-spacing: -0.05em; }
.rag-stage p { max-width: 26em; margin-top: 1rem; font-size: clamp(1rem, 0.88rem + 0.35vw, 1.25rem); line-height: 1.5; color: rgb(255 255 255 / 0.7); }
.rag-stage__facts { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.5rem; }
.rag-stage__facts li { padding: 0.42rem 0.75rem; border: 1px solid rgb(255 255 255 / 0.16); border-radius: 99em; font: 500 0.76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.72); }
.rag-stage__viz { padding: clamp(0.75rem, 2vw, 1.5rem); border: 1px solid rgb(255 255 255 / 0.1); border-radius: clamp(1rem, 1.5vw, 1.5rem); background: #07070a radial-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1.5px) 0 0 / 22px 22px; }
.rag-stage__viz svg { display: block; width: 100%; height: auto; overflow: visible; }

.rs-panel { fill: rgb(255 255 255 / 0.04); stroke: rgb(255 255 255 / 0.18); stroke-width: 1.2; }
.rs-hot { stroke: var(--blue-bright); }
.rs-text, .rs-text rect { fill: rgb(255 255 255 / 0.2); }
.rs-accent { fill: var(--blue); }
.rs-label, .rs-label text { font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.04em; fill: rgb(255 255 255 / 0.6); }
.rs-label--hot { fill: var(--blue-bright); }
.rs-label--b { fill: #b79cff; }
.rs-label--c { fill: #7fb2ff; }
.rs-label--warn { fill: #ff8080; }
.rs-label--inv, .rs-label--inv text { fill: var(--white); font-weight: 700; }
.rs-line, .rs-line path { fill: none; stroke: rgb(255 255 255 / 0.22); stroke-width: 1.4; }
.rs-line--hot, .rs-line--hot path { stroke: var(--blue-bright); stroke-width: 2; }
.rs-flow { fill: none; stroke: var(--blue-bright); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 8 200; stroke-dashoffset: 8; }
.rs-cut path { fill: none; stroke: var(--blue-bright); stroke-width: 1.5; stroke-dasharray: 6 5; }
.rs-bars rect { fill: rgb(255 255 255 / 0.16); }
.rs-bars .b { fill: #9b7cf0; }
.rs-bars .c { fill: var(--blue-bright); }
.rs-grid path { fill: none; stroke: rgb(255 255 255 / 0.06); }
.rs-dot { fill: rgb(255 255 255 / 0.75); }
.rs-dot--b { fill: #9b7cf0; }
.rs-dot--c { fill: var(--blue-bright); }
.rs-dim circle { fill: rgb(255 255 255 / 0.2); }
.rs-dot--hit { fill: var(--blue-bright); stroke: var(--white); stroke-width: 2; }
.rs-dot--blocked { fill: rgb(255 255 255 / 0.25); }
.rs-radius { fill: rgb(58 126 246 / 0.1); stroke: var(--blue-bright); stroke-dasharray: 4 4; }
.rs-x { fill: none; stroke: #ff8080; stroke-width: 2.5; stroke-linecap: round; }
.rs-query { fill: var(--white); }
.rs-cite rect { fill: var(--blue); }
.rs-draw { stroke-dasharray: 1; }
.rag-stage g, .rag-stage circle, .rs-radius { transform-box: fill-box; }
.rs-pop circle, .rs-radius, .rs-cite rect { transform-origin: center; }

@media (min-width: 64.0625em) {
  .rag-flow { --mark: 60svh; }
  .rag-flow .flow__stage {
    position: sticky; top: 0;
    height: 100svh;
    display: grid; grid-template-rows: auto auto minmax(0, 1fr);
    row-gap: clamp(1.25rem, 3.5vh, 2.75rem);
    padding: calc(var(--header-h) + 1vh) max(var(--gutter), (100% - var(--container)) / 2) clamp(1.5rem, 4vh, 3rem);
  }
  .rag-flow .flow__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; }
  .rag-flow .flow__markers { margin-top: -100svh; pointer-events: none; }
  .rag-flow .flow__markers i { display: block; height: var(--mark); }
  .rag-flow .flow__markers i:last-child { height: calc(var(--mark) + 40svh); }
  .rag-stages { min-height: 0; align-self: center; }
  .rag-stage__viz svg { max-height: calc(100svh - var(--header-h) - 20rem); }

  .rag-stage { grid-area: 1 / 1; visibility: hidden; opacity: 0; transform: translate3d(0, 1.25rem, 0) scale(0.98); transition: opacity 0.45s var(--ease-soft), transform 0.8s var(--ease-out), visibility 0s linear 0.8s; }
  .rag-stage.is-current { visibility: visible; opacity: 1; transform: none; transition-delay: 0.08s, 0.08s, 0s; }

  @media (prefers-reduced-motion: no-preference) {
    .rag-stage.is-current .rs-in { animation: rs-in 0.7s var(--ease-out) both; animation-delay: calc(var(--k) * 90ms + 0.15s); }
    .rag-stage.is-current .rs-slide { animation: rs-slide 0.8s var(--ease-out) both; animation-delay: calc(var(--k) * 110ms + 0.2s); }
    .rag-stage.is-current .rs-grow { transform-origin: 0 50%; animation: rs-grow 0.7s var(--ease-out) both; animation-delay: calc(var(--k) * 120ms + 0.2s); }
    .rag-stage.is-current .rs-pop circle { animation: rs-pop 0.5s var(--ease-out) both; animation-delay: calc(var(--k) * 45ms + 0.2s); }
    .rag-stage.is-current .rs-draw { animation: rs-draw 0.9s var(--ease-in-out) both; animation-delay: calc(var(--k, 0) * 150ms + 0.35s); }
    .rag-stage.is-current .rs-cite rect { animation: rs-pop 0.5s var(--ease-out) both 0.9s; }
    .rag-stage.is-current .rs-radius { animation: rs-breathe 2.4s ease-in-out infinite; }
    .rag-stage.is-current .rs-flow { animation: rs-flow 2.2s linear infinite; animation-delay: calc(var(--k, 0) * -0.7s); }
    .rag-flow.is-paused .rag-stage * { animation-play-state: paused; }

    @keyframes rs-in { from { opacity: 0; transform: translateX(24px); } }
    @keyframes rs-slide { from { opacity: 0; transform: translateX(-40px); } }
    @keyframes rs-grow { from { opacity: 0; transform: scaleX(0.15); } }
    @keyframes rs-pop { from { opacity: 0; transform: scale(0); } }
    @keyframes rs-draw { from { stroke-dashoffset: 1; } }
    @keyframes rs-breathe { 50% { transform: scale(1.08); } }
    @keyframes rs-flow { from { stroke-dashoffset: 8; } to { stroke-dashoffset: -200; } }
  }
}

@media (max-width: 64em) {
  .rag-flow { padding-block: clamp(4.5rem, 12vw, 7rem); }
  .rag-flow .flow__stage { width: min(var(--container), 100% - var(--gutter) * 2); margin-inline: auto; }
  .rag-flow .flow__steps, .rag-flow .flow__status, .rag-flow .flow__markers { display: none; }
  .rag-stages { gap: 3.5rem; margin-top: 3rem; }
  .rag-stage { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Knowledge sources — rows with a document peeking out on hover
   ========================================================================== */
.srcs { margin-top: clamp(3rem, 5.5vw, 6rem); border-top: 1px solid var(--black); }
.src {
  position: relative;
  display: grid;
  grid-template-columns: clamp(3.25rem, 6vw, 6.5rem) minmax(0, 1.1fr) minmax(0, 1fr) 9rem 5rem;
  align-items: center; gap: 1rem clamp(1rem, 2.5vw, 2.5rem);
  padding-block: clamp(1.25rem, 2.4vw, 2.3rem);
  border-bottom: 1px solid var(--border-light);
}
.src::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, var(--purple), var(--blue)); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.8s var(--ease-out); }
.src__num { font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.08em; color: #8a8a8a; transition: color 0.3s; }
.src__title { font-size: clamp(1.6rem, 0.75rem + 2.35vw, 3.75rem); font-weight: 600; line-height: 1; letter-spacing: -0.045em; transition: transform 0.7s var(--ease-out), color 0.35s; }
.src__text { max-width: 26em; line-height: 1.45; color: #5e5e5e; }
.src__peek { width: 100%; aspect-ratio: 160 / 110; opacity: 0; transform: translate3d(1.5rem, 0.5rem, 0) rotate(6deg) scale(0.85); transition: opacity 0.35s var(--ease-soft), transform 0.7s var(--ease-out); pointer-events: none; }
.src__peek svg { width: 100%; height: 100%; overflow: visible; }
.src__sync { justify-self: end; display: inline-flex; align-items: center; gap: 0.45rem; font: 500 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #2f7d3a; }
.src__sync i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: #3fb950; }
.src:hover::after { transform: none; }
.src:hover .src__num { color: var(--blue); }
.src:hover .src__title { color: var(--blue); transform: translateX(clamp(0.5rem, 1.2vw, 1.25rem)); }
.src:hover .src__peek { opacity: 1; transform: rotate(-4deg); }
.srcs:hover .src:not(:hover) .src__title { color: #9a9a9a; }

.pk-sheet, .pk-sheet path { fill: var(--white); stroke: rgb(0 0 0 / 0.18); stroke-width: 1.2; }
.pk-sheet--dark { fill: #0b0b0f; stroke: none; }
.pk-line rect { fill: rgb(0 0 0 / 0.16); }
.pk-hl { fill: rgb(58 126 246 / 0.28); }
.pk-accent, .pk-tag { fill: var(--blue); }
.pk-tagt { font: 700 9px/1 var(--font-body); letter-spacing: 0.06em; fill: var(--white); }
.pk-rule { fill: none; stroke: rgb(0 0 0 / 0.12); }
.pk-code { fill: #0b0b0f; }

/* ==========================================================================
   Trust & security — safeguards pinned to a real answer
   ========================================================================== */
.trust { background: var(--black); color: var(--white); padding-block: clamp(5rem, 9vw, 10rem); }
.trust__grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: center; gap: 3rem clamp(2rem, 6vw, 7rem); margin-top: clamp(3rem, 5.5vw, 6rem); }
.trust__list { border-top: 1px solid rgb(255 255 255 / 0.2); }
.trust__tab { width: 100%; display: flex; align-items: baseline; gap: 1rem; padding-block: clamp(0.85rem, 1.5vw, 1.2rem); border-bottom: 1px solid rgb(255 255 255 / 0.1); text-align: left; color: rgb(255 255 255 / 0.42); transition: color 0.35s; }
.trust__n { font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.08em; }
.trust__name { font-size: clamp(1.5rem, 0.85rem + 1.9vw, 3rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; transition: transform 0.6s var(--ease-out); }
.trust__tab:hover { color: rgb(255 255 255 / 0.8); }
.trust__tab[aria-selected="true"] { color: var(--white); }
.trust__tab[aria-selected="true"] .trust__n { color: var(--blue-bright); }
.trust__tab[aria-selected="true"] .trust__name { transform: translateX(0.6rem); }
.trust__panels { max-width: 30em; min-height: 5.5rem; margin-top: 1.5rem; font-size: clamp(1rem, 0.9rem + 0.3vw, 1.2rem); line-height: 1.5; color: rgb(255 255 255 / 0.72); }

.tc { display: grid; gap: 1.1rem; padding: clamp(1.25rem, 2.5vw, 2.25rem); border: 1px solid rgb(255 255 255 / 0.14); border-radius: clamp(1rem, 1.5vw, 1.5rem); background: #0b0b0f; }
.tc__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }
.tc__user { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.5rem 0.3rem 0.3rem; border-radius: 99em; font-size: 0.9rem; font-weight: 600; }
.tc__user small { margin-left: 0.2rem; font-size: 0.78rem; font-weight: 500; color: rgb(255 255 255 / 0.5); }
.tc__avatar { width: 1.9rem; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, #9b7cf0, #4f6ff0); }
.tc__tenant { padding: 0.4rem 0.75rem; border: 1px solid rgb(255 255 255 / 0.18); border-radius: 99em; font: 500 0.74rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.7); }
.tc__q { font-size: clamp(1.1rem, 0.85rem + 0.65vw, 1.5rem); font-weight: 600; letter-spacing: -0.02em; }
.tc__a { padding: 1.1rem 1.25rem; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 0.9rem; background: rgb(255 255 255 / 0.04); line-height: 1.6; color: rgb(255 255 255 / 0.85); }
.tc__cite { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; margin-left: 0.2rem; border-radius: 0.3rem; background: var(--blue); font-size: 0.7rem; font-weight: 700; line-height: 1; vertical-align: 0.15em; }
.tc__perm { display: inline-flex; margin-top: 0.9rem; padding: 0.35rem 0.75rem; border-radius: 99em; background: rgb(155 124 240 / 0.16); font-size: 0.74rem; font-weight: 600; color: #cdbbff; }
.tc__sources { display: grid; gap: 0.4rem; margin: -0.4rem; padding: 0.4rem; border-radius: 0.6rem; }
.tc__sources li { display: flex; align-items: center; gap: 0.6rem; font: 500 0.8rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.72); }
.tc__sources b { display: grid; place-items: center; flex: none; width: 1.3rem; height: 1.3rem; border-radius: 0.3rem; background: rgb(58 126 246 / 0.25); font-size: 0.7rem; color: var(--blue-bright); }
.tc__trace { padding: 0.9rem 0.4rem 0.4rem; margin-inline: -0.4rem; border-top: 1px dashed rgb(255 255 255 / 0.14); border-radius: 0 0 0.5rem 0.5rem; font: 500 0.74rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.5); }
.tc :is(.tc__perm, .tc__sources, .tc__cite, .tc__trace, .tc__user, .tc__tenant) { transition: box-shadow 0.45s var(--ease-soft); }
.trust:not([data-active]) .tc__perm,
.trust[data-active="0"] .tc__perm,
.trust[data-active="1"] .tc__sources,
.trust[data-active="2"] :is(.tc__cite, .tc__trace),
.trust[data-active="3"] .tc__user,
.trust[data-active="4"] .tc__tenant { box-shadow: 0 0 0 2px var(--blue-bright), 0 0 0 7px rgb(58 126 246 / 0.22); }

/* ==========================================================================
   Use cases — written as the questions people actually type
   ========================================================================== */
.uses { background: var(--off-white); color: var(--black); padding-block: clamp(5rem, 9vw, 10rem); }
.uses__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 5vw, 6rem); margin-top: clamp(3rem, 5.5vw, 6rem); border-top: 1px solid var(--black); }
.use { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-content: start; gap: 0.75rem 1rem; padding-block: clamp(1.75rem, 3vw, 2.75rem); border-bottom: 1px solid var(--border-light); }
.use__n { grid-row: 1 / span 3; padding-top: 0.5rem; font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.08em; color: #8a8a8a; }
.use__title { font-size: clamp(1.3rem, 0.9rem + 1vw, 2.1rem); font-weight: 600; letter-spacing: -0.035em; }
.use__q {
  position: relative;
  padding: 0.9rem 1.1rem 0.9rem 2.9rem;
  border: 1px solid rgb(0 0 0 / 0.08); border-radius: 0.9rem;
  background: var(--white);
  font-size: clamp(1.05rem, 0.88rem + 0.5vw, 1.4rem); line-height: 1.35; letter-spacing: -0.02em;
  color: #4d4d4d;
  transition: border-color 0.35s, color 0.35s, box-shadow 0.35s;
}
.use__q::before { content: ""; position: absolute; left: 1.1rem; top: 1.15rem; width: 0.8rem; height: 0.8rem; border: 2px solid #9a9a9a; border-radius: 50%; transition: border-color 0.35s; }
.use__q::after { content: ""; position: absolute; left: 1.72rem; top: 1.85rem; width: 0.45rem; height: 2px; background: #9a9a9a; rotate: 45deg; transition: background-color 0.35s; }
.use__meta { font: 500 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: #6d6d6d; }
.use:hover .use__q { border-color: var(--blue); color: var(--black); box-shadow: 0 0 0 4px rgb(58 126 246 / 0.12); }
.use:hover .use__q::before { border-color: var(--blue); }
.use:hover .use__q::after { background: var(--blue); }

/* ==========================================================================
   In practice — question → retrieved context → answer → sources
   ========================================================================== */
.ask { position: relative; background: var(--black); color: var(--white); padding-block: clamp(5rem, 9vw, 9rem); view-timeline: --ask; }
.ask__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.5rem 3rem; }
.ask__title { margin-top: 1rem; font-size: clamp(2.2rem, 1rem + 3.4vw, 5rem); font-weight: 700; line-height: 0.96; letter-spacing: -0.05em; }
.ask__title .mask { display: block; width: fit-content; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.ask__legend { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
.ask__legend li { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.92rem; font-weight: 600; color: var(--white); }
.ask__legend b { font-size: var(--fs-micro); letter-spacing: 0.1em; color: var(--blue-bright); }

.ask__ui { width: min(100%, 75rem); margin: clamp(2rem, 4vh, 3rem) auto 0; container-type: inline-size; }
.ask__canvas {
  position: relative;
  aspect-ratio: 12 / 7;
  font-size: 1.32cqi;
  border: 1px solid rgb(255 255 255 / 0.12); border-radius: clamp(1rem, 1.5vw, 1.5rem);
  background: #07070a radial-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1.5px) 0 0 / 22px 22px;
}
.ask__links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ask__link { fill: none; stroke: var(--blue-bright); stroke-width: 2; stroke-dasharray: 1; }
.ask__tag { display: block; margin-bottom: 0.7em; font-size: 0.7em; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue-bright); }

.ask__q { position: absolute; left: 3%; top: 4%; width: 94%; height: 11%; display: flex; flex-direction: column; justify-content: center; padding-inline: 1.4em; border: 1px solid rgb(255 255 255 / 0.16); border-radius: 0.9em; background: rgb(255 255 255 / 0.05); }
.ask__q .ask__tag { margin-bottom: 0.35em; }
.ask__q p { font-size: 1.35em; font-weight: 600; letter-spacing: -0.02em; }

.ask__ctx { position: absolute; inset: 0; pointer-events: none; }
.ask__ctx > .ask__tag { position: absolute; left: 3%; top: 18%; }
.ask__chunk { position: absolute; left: 3%; width: 34%; height: 20%; display: flex; flex-direction: column; gap: 0.55em; padding: 0.9em 1.1em; border: 1px solid rgb(255 255 255 / 0.14); border-radius: 0.9em; background: #0e0e12; overflow: hidden; pointer-events: auto; }
.ask__chunk:nth-of-type(1) { top: 23%; }
.ask__chunk:nth-of-type(2) { top: 47.5%; }
.ask__chunk:nth-of-type(3) { top: 72%; }
.ask__src { display: flex; align-items: center; gap: 0.6em; font: 500 0.72em/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.55); }
.ask__src b, .ask__sources b { display: grid; place-items: center; flex: none; width: 1.55em; height: 1.55em; border-radius: 0.3em; background: var(--blue); font-size: 0.9em; color: var(--white); }
.ask__src em { margin-left: auto; font-style: normal; color: var(--green); }
.ask__chunk p { font-size: 0.92em; line-height: 1.45; color: rgb(255 255 255 / 0.72); }
.ask__chunk mark { color: var(--white); background-image: linear-gradient(rgb(58 126 246 / 0.38), rgb(58 126 246 / 0.38)); }

.ask__answer { position: absolute; left: 49%; top: 17.5%; width: 48%; height: 57.5%; padding: 1.1em 1.5em; border: 1px solid rgb(91 150 255 / 0.45); border-radius: 0.9em; background: rgb(58 126 246 / 0.07); }
.ask__answer p { position: absolute; left: 1.5em; right: 1.5em; translate: 0 -50%; font-size: 1.12em; line-height: 1.4; letter-spacing: -0.01em; }
.ask__answer p:nth-of-type(1) { top: 29.4%; }
.ask__answer p:nth-of-type(2) { top: 48.9%; }
.ask__answer p:nth-of-type(3) { top: 68.2%; }
.ask__answer sup { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.4em; margin-left: 0.3em; border-radius: 0.3em; background: var(--blue); font-size: 0.68em; font-weight: 700; line-height: 1; vertical-align: 0.4em; }
.ask__grounded { position: absolute; left: 1.5em; bottom: 1em; padding: 0.35em 0.7em; border-radius: 99em; background: rgb(116 214 90 / 0.12); font-size: 0.72em; font-weight: 600; color: var(--green); }
.ask__sources { position: absolute; left: 49%; top: 79%; width: 48%; }
.ask__sources ol { display: flex; flex-wrap: wrap; gap: 0.5em; }
.ask__sources li { display: flex; align-items: center; gap: 0.45em; padding: 0.4em 0.75em 0.4em 0.4em; border: 1px solid rgb(255 255 255 / 0.16); border-radius: 99em; font: 500 0.74em/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: rgb(255 255 255 / 0.78); }

/* pinned and assembled by scroll on desktop */
@media (min-width: 64.0625em) and (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) and (animation-range: entry) {
    .ask { height: 260svh; padding-block: 0; }
    .ask__stage { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-top: var(--header-h); padding-bottom: 1.5rem; }
    .ask__ui { width: min(100%, 75rem, calc((100svh - var(--header-h) - 15rem) * 12 / 7)); }

    .ask__legend li { animation: ask-dim linear both; animation-timeline: --ask; animation-range: contain calc(var(--k) * 24%) contain calc(var(--k) * 24% + 8%); }
    .ask__q { animation: ask-fade linear both; animation-timeline: --ask; animation-range: contain 0% contain 10%; }
    .ask__ctx > .ask__tag { animation: ask-fade linear both; animation-timeline: --ask; animation-range: contain 8% contain 16%; }
    .ask__chunk { animation: ask-slide linear both; animation-timeline: --ask; animation-range: contain calc(12% + var(--k) * 6%) contain calc(24% + var(--k) * 6%); }
    .ask__chunk mark { animation: ask-mark linear both; animation-timeline: --ask; animation-range: contain calc(28% + var(--k) * 5%) contain calc(38% + var(--k) * 5%); }
    .ask__link { animation: ask-draw linear both; animation-timeline: --ask; animation-range: contain calc(40% + var(--k) * 6%) contain calc(52% + var(--k) * 6%); }
    .ask__answer { animation: ask-fade linear both; animation-timeline: --ask; animation-range: contain 36% contain 44%; }
    .ask__answer p { animation: ask-ghost linear both; animation-timeline: --ask; animation-range: contain calc(48% + var(--k) * 7%) contain calc(58% + var(--k) * 7%); }
    .ask__answer sup { animation: ask-pop linear both; animation-timeline: --ask; animation-range: contain calc(52% + var(--k) * 7%) contain calc(58% + var(--k) * 7%); }
    .ask__grounded { animation: ask-fade linear both; animation-timeline: --ask; animation-range: contain 70% contain 78%; }
    .ask__sources li { animation: ask-pop linear both; animation-timeline: --ask; animation-range: contain calc(76% + var(--k) * 5%) contain calc(84% + var(--k) * 5%); }

    @keyframes ask-dim { from { opacity: 0.3; } }
    @keyframes ask-fade { from { opacity: 0; transform: translateY(12px); } }
    @keyframes ask-slide { from { opacity: 0; transform: translateX(-32px); } }
    @keyframes ask-mark { from { background-size: 0% 100%; } }
    @keyframes ask-draw { from { stroke-dashoffset: 1; } }
    @keyframes ask-ghost { from { opacity: 0.08; } }
    @keyframes ask-pop { from { opacity: 0; transform: scale(0.6); } }
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 64em) {
  .kp__body { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: 2rem; }
  .kp__k { position: static; display: block; margin-bottom: 0.7rem; }
  .kp__fan { display: none; }
  .kp__docs { height: auto; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .kp__doc { margin: 0; }
  .kp__col--index, .kp__col--answer { translate: none; }
  .kp__wire { justify-self: center; width: 6px; height: 2rem; }
  .kp__wire::after { left: 2.5px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .kp__wire i { background: linear-gradient(transparent 36%, var(--blue-bright) 36% 64%, transparent 64%); animation-name: kp-y; }
  @keyframes kp-y { from { transform: translateY(-70%); } to { transform: translateY(70%); } }

  .rag-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .src { grid-template-columns: clamp(3rem, 7vw, 5rem) minmax(0, 1fr) minmax(0, 1fr); }
  .src__peek, .src__sync { display: none; }

  .trust__grid { grid-template-columns: 1fr; }
  .tc { order: -1; }
}

@media (max-width: 48em) {
  .rag-intro { text-align: left; }
  .rag-excerpt { margin-inline: 0; }
  .rag-notes { grid-template-columns: 1fr; }

  .src { grid-template-columns: 2.75rem minmax(0, 1fr); row-gap: 0.6rem; }
  .src__num { align-self: start; padding-top: 0.35rem; }
  .src__text { grid-column: 2; }

  .uses__grid { grid-template-columns: 1fr; }

  .ask__canvas { aspect-ratio: auto; display: grid; gap: 1rem; padding: 1rem; font-size: 0.95rem; }
  .ask__links { display: none; }
  .ask__q, .ask__ctx, .ask__chunk, .ask__answer, .ask__answer p, .ask__grounded, .ask__sources { position: static; width: auto; height: auto; translate: none; }
  .ask__q { padding-block: 0.9rem; }
  .ask__ctx { display: grid; gap: 0.6rem; pointer-events: auto; }
  .ask__ctx > .ask__tag { position: static; margin-bottom: 0; }
  .ask__answer { display: grid; gap: 0.6rem; }
  .ask__grounded { justify-self: start; }
}

@media (max-width: 30em) {
  .kp__doc { gap: 0.5rem; padding: 0.5rem; }
  .kp__doc small, .kp__tick { display: none; }
  .kp__cells { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
}
