/* /bring-your-ai (10 Nov 2026): the instrument is a generic AI assistant's window (bring-your-ai.aspx.vb), one layer
   per state, shown by the run (sub.js) from .yw[data-st]. Built on the /pallas window's grammar so the two read as one
   family; no vendor's look. Scenes are CSS animations; reduced motion shows the end state. Tokens only. */
.yw { --yw-r: 14px; width: 100%; max-width: 620px; margin-inline: auto; }
.yw-win { border: 1px solid var(--lp-rule-2); border-radius: var(--yw-r); background: var(--lp-paper); overflow: hidden; box-shadow: 0 18px 50px -28px color-mix(in srgb, var(--lp-ink) 45%, transparent); }
.yw-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--lp-rule); }
.yw-name { display: flex; align-items: center; gap: 8px; margin-inline-end: auto; font: 600 12px var(--tos-font-mono); letter-spacing: .14em; color: var(--lp-ink-2); }
.yw-name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lp-ink-2); opacity: .45; }
.yw-chip { font-size: 12px; padding: 5px 10px; border: 1px solid var(--lp-rule-2); border-radius: 7px; color: var(--lp-ink); background: var(--lp-paper); white-space: nowrap; }
.yw-chip.on { display: inline-flex; align-items: center; gap: 6px; color: var(--lp-accent); border-color: color-mix(in srgb, var(--lp-accent) 40%, transparent); background: color-mix(in srgb, var(--lp-accent) 9%, var(--lp-paper)); }
.yw-chip.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lp-accent); }
.yw-body { position: relative; height: 412px; background: color-mix(in srgb, var(--lp-paper-2) 55%, var(--lp-paper)); }
.yw-ly { position: absolute; inset: 0; padding: 18px; display: flex; flex-direction: column; gap: 12px; opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; }
.yw[data-st="hd"] .ly-hd, .yw[data-st="ask"] .ly-ask, .yw[data-st="connect"] .ly-connect, .yw[data-st="control"] .ly-control { opacity: 1; visibility: visible; transition: opacity .3s ease .1s, visibility 0s; }
.yw-comp { margin: 0 12px 12px; border: 1px solid var(--lp-rule-2); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; background: var(--lp-paper); }
.yw-comp .ph { flex: 1; font-size: 14px; color: var(--lp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yw-comp .go { width: 30px; height: 30px; border-radius: 8px; background: var(--lp-ink); opacity: .2; flex: none; }

/* conversation */
.yw-me { align-self: flex-end; max-width: 82%; background: var(--lp-ink); color: var(--lp-paper); border-radius: 12px 12px 3px 12px; padding: 9px 13px; font-size: 14px; }
.yw-tool { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font: 500 12px var(--tos-font-mono); color: var(--lp-ink-2); padding: 6px 10px; border: 1px dashed color-mix(in srgb, var(--lp-accent) 55%, var(--lp-rule-2)); border-radius: 8px; background: var(--lp-paper); }
.yw-tool i { width: 8px; height: 8px; background: var(--lp-accent); flex: none; }
.yw-tool span { color: var(--lp-muted); }
.yw-ai { align-self: flex-start; max-width: 92%; display: grid; gap: 8px; }
.yw-ai p { margin: 0; font-size: 14px; line-height: 1.5; background: var(--lp-paper); border: 1px solid var(--lp-rule); border-radius: 12px 12px 12px 3px; padding: 10px 13px; }
.yw-src { display: flex; flex-wrap: wrap; gap: 6px; }
.yw-src span { font: 400 11px var(--tos-font-mono); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--lp-rule-2); color: var(--lp-ink-2); background: var(--lp-paper); }

/* 01: questions, each answered from Timer */
.yw-q { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--lp-rule); border-radius: 10px; background: var(--lp-paper); padding: 12px 14px; font-size: 14px; color: var(--lp-ink); }
.yw-q em { font: 500 11px var(--tos-font-mono); font-style: normal; color: var(--lp-accent); white-space: nowrap; }

/* cards */
.yw-card { border: 1px solid var(--lp-rule); border-radius: 12px; background: var(--lp-paper); padding: 13px 15px; display: grid; gap: 7px; }
.yw-k { display: flex; justify-content: space-between; gap: 10px; font: 600 11px var(--tos-font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--lp-accent); }
.yw-k span { color: var(--lp-muted); letter-spacing: 0; text-transform: none; font-weight: 400; }
.yw-card b { font-size: 15px; line-height: 1.3; color: var(--lp-ink); }
.yw-card p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--lp-ink-2); }
.yw-field { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 13.5px; }
.yw-field small { color: var(--lp-muted); font-size: 12px; }
.yw-field span { border: 1px solid var(--lp-rule-2); border-radius: 7px; padding: 6px 9px; color: var(--lp-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--tos-font-mono); font-size: 12.5px; }
.yw-consent { border-color: var(--lp-ink); }
.yw-opts { display: flex; gap: 6px; }
.yw-opts span { font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--lp-rule-2); border-radius: 7px; color: var(--lp-ink-2); background: var(--lp-paper); }
.yw-opts span.on { color: var(--lp-ink); border-color: var(--lp-ink); font-weight: 600; }
.yw-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.yw-code small { color: var(--lp-muted); font-size: 12px; }
.yw-code span { display: flex; gap: 5px; }
.yw-code i { width: 18px; height: 22px; border: 1px solid var(--lp-rule-2); border-radius: 5px; position: relative; }
.yw-code i::after { content: ""; position: absolute; inset: 0; margin: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--lp-ink); }
.yw-acts { display: flex; gap: 8px; }
.yw-btn { font: 600 12.5px var(--tos-font-body); padding: 6px 12px; border: 1px solid var(--lp-rule-2); border-radius: 8px; color: var(--lp-ink); background: var(--lp-paper); white-space: nowrap; }
.yw-btn.p { background: var(--lp-accent); border-color: var(--lp-accent); color: var(--lp-on-accent); }
.yw-pill { align-self: center; font: 600 11px var(--tos-font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; color: var(--lp-accent); background: color-mix(in srgb, var(--lp-accent) 10%, var(--lp-paper)); }

/* 03: the connected list and the record */
.yw-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--lp-rule); padding-top: 9px; }
.yw-row b { display: block; font-size: 14px; }
.yw-row small { font-size: 12px; color: var(--lp-muted); }
.yw-log { display: grid; gap: 6px; border: 1px solid var(--lp-rule); border-radius: 12px; background: var(--lp-paper); padding: 13px 15px; }
.yw-log p { margin: 0; display: flex; gap: 10px; font-size: 13px; color: var(--lp-ink-2); }
.yw-log p span { font: 400 12px var(--tos-font-mono); color: var(--lp-muted); flex: none; }

/* the scenes: each state's pieces arrive in order when the state is reached */
@keyframes yw-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes yw-type { from { max-width: 0; } to { max-width: 100%; } }
@keyframes yw-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lp-accent) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: no-preference) {
  .yw[data-st] .yw-ly .s1 { animation: yw-in .45s ease .7s both; }
  .yw[data-st] .yw-ly .s2 { animation: yw-in .45s ease 1.4s both; }
  .yw[data-st] .yw-ly .s3 { animation: yw-in .45s ease 2.1s both; }
  .yw[data-st] .yw-ly .s4 { animation: yw-in .45s ease 2.7s both; }
  .yw[data-st="ask"] .yw-ly .s1 { animation-delay: .2s; } .yw[data-st="ask"] .yw-ly .s2 { animation-delay: .7s; }
  .yw[data-st="ask"] .yw-ly .s3 { animation-delay: 1.2s; } .yw[data-st="ask"] .yw-ly .s4 { animation-delay: 1.7s; }
  .yw[data-st="hd"] .ly-hd .yw-me { overflow: hidden; white-space: nowrap; animation: yw-type .7s steps(34, end) .1s both; }
  .yw[data-st="connect"] .ly-connect .yw-btn.p { animation: yw-pulse 1.4s ease 1.9s 2; }
  .yw[data-st="hd"] .yw-chip.on, .yw[data-st="connect"] .yw-chip.on { animation: yw-pulse 1.2s ease .3s 2; }
}

/* on a phone the chapter copies do not pin: a window is too tall for the reading band */
.sp.js .run .inst.yw:not(.is-hero) { position: static; border: 0; padding: 0; margin-inline: 0; background: transparent; }
.sp .inst.yw.is-hero { margin-top: 22px; }
/* a phone copy (or no JavaScript) shows one scene only, so its body fits that scene instead of the tallest one */
.inst.yw .yw-body { height: auto; }
.inst.yw .yw-ly { position: static; display: none; opacity: 1; visibility: visible; }
.inst.yw[data-st="hd"] .ly-hd, .inst.yw[data-st="ask"] .ly-ask, .inst.yw[data-st="connect"] .ly-connect, .inst.yw[data-st="control"] .ly-control { display: flex; }
.stage.yw .yw-body { height: 412px; }
.ly-connect { gap: 10px; }
.yw .ro-set { text-align: start; }
@media (max-width: 520px) {
  .yw-chip:not(.on) { display: none; }
  .yw[data-st="hd"] .ly-hd .yw-me { white-space: normal; animation: yw-in .45s ease .1s both; }
  .yw-q { flex-direction: column; align-items: flex-start; gap: 4px; }
  .yw-row .yw-btn { padding: 5px 9px; }
}

/* 02: the steps and the address. Prefixed with .sp where sub.css resets the element (".sp ol" / ".sp p" set
   margin and padding to 0 and would otherwise win: the steps lost their top padding and touched the rule). */
.sp .by-steps { display: grid; gap: 22px; counter-reset: by; border-top: 1px solid var(--lp-ink); padding-top: 22px; }
.by-steps li { counter-increment: by; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 14px; row-gap: 6px; }
.by-steps li::before { content: counter(by); grid-row: span 3; width: 30px; height: 30px; display: grid; place-items: center; font: 600 13px var(--tos-font-mono); color: var(--lp-paper); background: var(--lp-ink); }
.by-steps b { color: var(--lp-ink); font-size: 18px; font-weight: 600; }
.by-steps p { color: var(--lp-ink-2); max-width: 60ch; }
.by-addr { display: flex; align-items: stretch; margin-top: 8px; max-width: 520px; border: 1px solid var(--lp-ink); }
.by-addr code { flex: 1; min-width: 0; padding: 12px 14px; font: 500 14px var(--tos-font-mono); color: var(--lp-ink); background: var(--lp-paper); overflow-x: auto; white-space: nowrap; user-select: all; }
.sp .by-copy { flex: none; min-width: 84px; min-height: 44px; padding: 0 16px; font: 600 14px var(--tos-font-body); color: var(--lp-on-accent); background: var(--lp-accent); }
.sp .by-copy:hover { filter: brightness(.95); }
.by-page #connect .note { margin-top: 22px; }
.by-page #control .cta { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* 04 questions */
.pq-list { display: grid; border-top: 1px solid var(--lp-ink); }
.pq { border-bottom: 1px solid var(--lp-rule); }
.pq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; font-weight: 600; font-size: 17px; color: var(--lp-ink); }
.pq summary::-webkit-details-marker { display: none; }
.pq summary::after { content: "+"; font-weight: 400; color: var(--lp-muted); }
.pq[open] summary::after { content: "\2212"; }
.sp .pq p { margin: 0 0 18px; color: var(--lp-ink-2); max-width: 60ch; }

/* the trademark notice: quiet, last on the page, above the close */
.sp .by-tm { padding-block: 8px 48px; }
.sp .by-tm p { max-width: 72ch; font-size: 13px; line-height: 1.55; color: var(--lp-muted); border-top: 1px solid var(--lp-rule); padding-top: 16px; }

/* on a phone the address gets its own full line, with Copy under it: never a cut-off address */
@media (max-width: 520px) {
  .by-addr { flex-direction: column; }
  .by-addr code { white-space: normal; overflow-wrap: anywhere; }
  .sp .by-copy { width: 100%; }
}
