/* Home v0.5: #owner as a scroll story. One sticky stage; each scroll segment shows one stage of the same owner working with the client.
   data-mode="pin": sticky stage, scenes swap in place. data-mode="flow": scenes stack (short screens, reduced motion). No data-mode: static, all visible. */

.owner { padding-bottom: 72px; }
.owner-lede { margin-top: 20px; max-width: 34em; font-size: 17px; line-height: 1.7; color: var(--muted); }

.os { position: relative; margin-top: 40px; }
.os[data-mode="pin"] { height: calc(100vh + var(--n) * 62vh); height: calc(100svh + var(--n) * 62svh); }
.os[data-mode="pin"] .os-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.os-pin > .wrap { width: 100%; padding-top: 24px; padding-bottom: 24px; }

/* Progress bar: five stops, the owner's avatar rides on the current stop. */
.os-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 32px; }
.os-cur { display: none; }
.os-nav { position: relative; min-width: 0; }
.os-steps { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.os-line { position: absolute; z-index: 0; left: calc(50% / var(--n)); right: calc(50% / var(--n)); top: 21px; height: 2px; background: #D5D8D4; }
.os-line i { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(calc(var(--i) / (var(--n) - 1))); transition: transform 480ms cubic-bezier(.22,1,.36,1); }
.os-rider { position: absolute; z-index: 2; top: 5px; left: calc((var(--i) + .5) * 100% / var(--n)); width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; background: var(--ink); color: #fff; box-shadow: 0 0 0 4px #F4F5F2, 0 0 0 6px var(--accent); display: grid; place-items: center; font-size: 14px; font-weight: 600; line-height: 1; pointer-events: none; transition: left 480ms cubic-bezier(.22,1,.36,1); }
.os-step { min-width: 0; }
.os-step button { width: 100%; min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px 4px; border: 0; border-radius: 4px; background: none; color: var(--muted); font: inherit; text-align: center; cursor: pointer; }
.os-step button:focus { outline: none; }
.os-step button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.os-dot { display: grid; place-items: center; width: 20px; height: 20px; margin-bottom: 18px; }
.os-dot::before { content: ""; box-sizing: border-box; width: 16px; height: 16px; border-radius: 50%; background: #F4F5F2; border: 2.5px solid #B8BEC2; transition: border-color 200ms ease, border-width 200ms ease; }
.os-step-opt .os-dot::before { border-style: dashed; }
.os-step.is-done .os-dot::before { border-color: var(--ink); border-width: 6px; }
.os-step-opt.is-done .os-dot::before { border-width: 2.5px; border-style: dashed; border-color: var(--ink); }
.os-step-no { font-size: 11px; line-height: 16px; color: #8B9399; }
.os-step-name { font-size: 15px; line-height: 1.35; font-weight: 500; transition: color 200ms ease; }
.os-step-tag { margin-top: 2px; font-style: normal; font-size: 11px; line-height: 18px; padding: 0 5px; border: 1px solid rgba(29,36,42,.24); border-radius: 4px; color: var(--muted); white-space: nowrap; }
.os-step button:hover .os-step-name { color: var(--accent); }
.os-step.is-done button { color: var(--ink); }
.os-step.is-current button { color: var(--ink); }
.os-step.is-current .os-step-name { font-weight: 600; }
.os-step.is-current .os-step-no { color: var(--accent); }
.os-reset { margin-top: 2px; }
.os-reset svg { width: 16px; height: 16px; }

/* Scenes: copy on the left, the conversation panel on the right. In pin mode all scenes share one grid cell. */
.os-scenes { margin-top: 36px; display: grid; }
.os[data-mode="pin"] .os-scene { grid-area: 1 / 1; visibility: hidden; transition: visibility 0s linear 320ms; }
.os[data-mode="pin"] .os-scene.is-active { z-index: 2; visibility: visible; transition: none; }
.os[data-mode="pin"] .os-copy, .os[data-mode="pin"] .os-thread { opacity: 0; transform: translateY(10px); transition: opacity 320ms ease, transform 420ms cubic-bezier(.22,1,.36,1); }
.os[data-mode="pin"] .is-active .os-copy, .os[data-mode="pin"] .is-active .os-thread { opacity: 1; transform: none; }
.os-scene { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 56px; align-items: stretch; min-width: 0; }
.os-copy { min-width: 0; padding-top: 8px; }
.os-no { font-size: 12px; color: var(--accent); }
.os-copy h3 { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 30px; line-height: 1.3; font-weight: 600; }
.os-tag { font-style: normal; font-size: 13px; font-weight: 500; line-height: 22px; padding: 0 7px; border: 1px solid rgba(29,36,42,.3); border-radius: 4px; color: var(--muted); }
.os-lede { margin-top: 14px; font-size: 17px; line-height: 1.7; color: var(--muted); max-width: 22em; }
.os-motto { display: block; margin-bottom: 8px; font-size: 20px; line-height: 1.45; font-weight: 600; color: var(--ink); }
.os-note { margin-top: 18px; display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.os-note svg, .os-more svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.os-more { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); }
.os-more svg { margin-top: 0; }
.os-more:hover { color: var(--accent); border-color: var(--accent); }

.os-panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 0 28px 24px; }
.os-who { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0 16px; border-bottom: 1px solid var(--line); }
.os-me { display: flex; align-items: center; gap: 12px; min-width: 0; }
.os-me-tx { display: flex; flex-direction: column; min-width: 0; }
.os-me-tx b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 16px; line-height: 1.4; font-weight: 600; }
.os-me-tx > span { font-size: 13px; line-height: 1.5; color: var(--muted); }
.os-demo { font-style: normal; font-size: 11px; font-weight: 500; line-height: 18px; padding: 0 5px; border: 1px solid rgba(29,36,42,.24); border-radius: 4px; color: var(--muted); }
.os-you { display: flex; align-items: center; gap: 10px; flex: none; font-size: 14px; color: var(--muted); }
.os-av { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; line-height: 1; }
.os-av-lg { width: 44px; height: 44px; font-size: 17px; box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--accent); }
.os-av-you { background: #EEF0ED; color: var(--muted); border: 1px solid var(--line); }
.os-av-you svg { width: 18px; height: 18px; }

.os-thread { list-style: none; margin: 0; padding: 20px 0 0; display: flex; flex-direction: column; gap: 14px; }
.os-msg { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.os-c { justify-content: flex-end; }
.os-bub { min-width: 0; max-width: 78%; padding: 12px 16px; border-radius: 8px; font-size: 15px; line-height: 1.6; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.os-o .os-bub { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.os-c .os-bub { background: #E9EDFB; color: var(--ink); border-bottom-right-radius: 2px; }
.os-bub > b { font-weight: 600; }
.os-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.os-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.os-chips > span { font-size: 13px; line-height: 24px; padding: 0 8px; border-radius: 4px; background: var(--white); border: 1px solid var(--line); }
.os-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px; border-radius: 4px; background: var(--white); border: 1px solid var(--line); font-size: 14px; }
.os-file svg, .os-ok svg, .os-verdict svg, .os-pick svg, .os-link svg { width: 16px; height: 16px; flex: none; }
.os-file svg { color: var(--accent); }
.os-ok { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.os-ok svg { color: var(--accent); }
.os-photos { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; }
.os-photos > span { height: 44px; border-radius: 4px; background: #E3E5E1; color: #8B9399; display: grid; place-items: center; }
.os-photos svg { width: 18px; height: 18px; }
.os-verdict { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.os-verdict > span { display: inline-flex; align-items: center; gap: 8px; }
.os-pass svg { color: var(--accent); }
.os-fix { color: var(--muted); }
.os-pick-k { font-size: 13px; color: var(--muted); }
.os-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.os-pick > span { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 4px; background: var(--white); border: 1px solid rgba(35,70,216,.35); font-size: 14px; font-weight: 500; }
.os-pick > span:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.os-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; width: 100%; min-width: 220px; font-size: 12px; color: var(--muted); }
.os-track > span { padding-top: 6px; border-top: 3px solid var(--ink); }
.os-track > span:last-child { border-top-color: var(--accent); color: var(--accent); font-weight: 500; }
.os-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }

/* Golden sample record inside the owner's message: rows lock one by one. */
.os-msg:has(.os-seal) .os-bub { max-width: 88%; width: 100%; }
.os-seal { width: 100%; }
.os-seal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.os-seal-top > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.os-seal-top svg { width: 16px; height: 16px; color: var(--accent); }
.os-seal-top b { font-size: 15px; font-weight: 600; }
.os-stamp { font-size: 12px; font-weight: 600; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 4px; padding: 0 6px; line-height: 20px; white-space: nowrap; }
.os-seal ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.os-seal li { break-inside: avoid; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 36px; border-bottom: 1px dotted #C3C8CC; font-size: 14px; }
.os-ck { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }

/* Play: messages enter in order; seal rows tick, then the stamp lands. Only applies when JS has set a mode. */
.os[data-mode] .os-msg { opacity: 0; transform: translateY(8px); transition: opacity 320ms ease, transform 360ms cubic-bezier(.22,1,.36,1); }
.os[data-mode] .is-play .os-msg { opacity: 1; transform: none; transition-delay: calc(var(--k) * 420ms + 160ms); }
.os[data-mode] .os-ck { opacity: 0; transform: scale(.5); transition: opacity 200ms ease, transform 260ms cubic-bezier(.22,1,.36,1); }
.os[data-mode] .is-play .os-ck { opacity: 1; transform: none; transition-delay: calc(var(--r) * 130ms + 520ms); }
.os[data-mode] .os-stamp { opacity: 0; transform: scale(1.2); transition: opacity 200ms ease, transform 260ms ease; }
.os[data-mode] .is-play .os-stamp { opacity: 1; transform: none; transition-delay: 1500ms; }

/* Flow mode: progress stays on top, scenes follow one after another. */
.os[data-mode="flow"] .os-bar { position: sticky; top: 0; z-index: 5; background: #F4F5F2; padding: 12px 0 8px; border-bottom: 1px solid var(--line); }
.os[data-mode="flow"] .os-scenes { margin-top: 0; }
.os-scene { scroll-margin-top: var(--os-bar-h, 120px); }
.os[data-mode="flow"] .os-scene, .os:not([data-mode]) .os-scene { padding: 40px 0; border-bottom: 1px solid var(--line); }
.os[data-mode="flow"] .os-scene:last-child, .os:not([data-mode]) .os-scene:last-child { border-bottom: 0; }
.os[data-mode="flow"] .os-scene { opacity: 0; transform: translateY(16px); transition: opacity 420ms ease, transform 480ms cubic-bezier(.22,1,.36,1); }
.os[data-mode="flow"] .os-scene.is-seen { opacity: 1; transform: none; }
.os-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1199px) {
  .os-scene { gap: 40px; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .os-copy h3 { font-size: 26px; }
}
/* Narrow: current stage name above the dots, scene copy above its panel. */
@media (max-width: 899px) {
  .os { margin-top: 32px; }
  .os[data-mode="pin"] { height: calc(100vh + var(--n) * 56vh); height: calc(100svh + var(--n) * 56svh); }
  .os-pin > .wrap { padding-top: 12px; padding-bottom: 12px; }
  .os-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
  .os-cur { display: flex; align-items: baseline; gap: 10px; min-width: 0; font-size: 16px; line-height: 1.4; }
  .os-cur .mono { color: var(--accent); flex: none; }
  .os-cur b { font-weight: 600; min-width: 0; }
  .os-nav { grid-column: 1 / -1; grid-row: 2; }
  .os-reset { grid-column: 2; grid-row: 1; margin-top: 0; min-height: 40px; padding: 0 12px; }
  .os-step button { padding-top: 12px; }
  .os-dot { margin-bottom: 14px; }
  .os-step-name, .os-step-tag { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .os-scenes { margin-top: 16px; }
  .os-scene { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .os-copy { padding-top: 0; }
  .os-no { display: none; }
  .os-copy h3 { margin-top: 0; font-size: 22px; }
  .os-lede { margin-top: 6px; font-size: 15px; line-height: 1.6; max-width: none; }
  .os-motto { font-size: 17px; margin-bottom: 4px; }
  .os-note, .os-more { margin-top: 6px; font-size: 13px; }
  .os-more { min-height: 32px; }
  .os-panel { padding: 0 14px 16px; }
  .os-who { padding: 12px 0; }
  .os-av-lg { width: 38px; height: 38px; font-size: 15px; }
  .os-me-tx b { font-size: 15px; }
  .os-thread { padding-top: 14px; gap: 10px; }
  .os-bub { max-width: 86%; padding: 10px 12px; font-size: 14px; gap: 6px; }
  .os-av { width: 28px; height: 28px; font-size: 12px; }
  .os-msg:has(.os-seal) .os-bub { max-width: 92%; }
  .os-seal ul { columns: 1; }
  .os-seal li { min-height: 30px; font-size: 13px; }
  .os-track { min-width: 0; }
  .os[data-mode="flow"] .os-scene, .os:not([data-mode]) .os-scene { padding: 28px 0; }
}
@media (max-width: 479px) {
  .os-you > span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .os *, .os-scene { transition: none !important; }
  .os[data-mode="flow"] .os-scene { opacity: 1; transform: none; }
}
