/* Kasada AI training: shared look for every product's visual training (training/<product>/index.html).
   Works offline: no external fonts or scripts. Components are documented in training/README.md. */
@font-face { font-family: "Jakarta"; src: url("fonts/jakarta-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("fonts/jakarta-latin-ext.woff2") format("woff2"); font-weight: 200 800; font-display: swap; unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20C0; }

:root {
  --ink: #0b1033; --text: #3b4066; --muted: #6b7094; --faint: #9a9fbd;
  --line: #e9ebf3; --line-2: #dfe2ee; --bg: #ffffff; --soft: #f7f8fb; --card: #ffffff;
  --blue: #136bff; --blue-ink: #0a4fd1; --blue-soft: #eef4ff;
  --green: #0e9f6e; --green-soft: #e8f7f1; --amber: #f5a524; --amber-soft: #fff6e5;
  --red: #e11d48; --red-soft: #ffeef2; --violet: #7c3aed; --violet-soft: #f3edff; --cyan: #0bbfba;
  --grad: linear-gradient(100deg, #12d6d0 0%, #136bff 50%, #f500e4 100%);
  --accent: var(--blue); --accent-soft: var(--blue-soft);
  --shadow: 0 1px 2px rgba(11,16,51,.06), 0 8px 24px rgba(11,16,51,.06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2f4ff; --text: #c9cde6; --muted: #9aa0c3; --faint: #6d7399;
    --line: #262b4d; --line-2: #2f3560; --bg: #0b0e24; --soft: #121634; --card: #151a3d;
    --blue-soft: #16224d; --green-soft: #0f2b26; --amber-soft: #2d2410; --red-soft: #33141f; --violet-soft: #231a45;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f2f4ff; --text: #c9cde6; --muted: #9aa0c3; --faint: #6d7399;
  --line: #262b4d; --line-2: #2f3560; --bg: #0b0e24; --soft: #121634; --card: #151a3d;
  --blue-soft: #16224d; --green-soft: #0f2b26; --amber-soft: #2d2410; --red-soft: #33141f; --violet-soft: #231a45;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
/* Per-product accent: set on <body data-product="..."> */
body[data-product="core"] { --accent: #136bff; --accent-soft: var(--blue-soft); }
body[data-product="resto"] { --accent: #f97316; --accent-soft: var(--amber-soft); }
body[data-product="callcenter"] { --accent: #0bbfba; --accent-soft: var(--green-soft); }
body[data-product="billing"] { --accent: #7c3aed; --accent-soft: var(--violet-soft); }
body[data-product="platform"] { --accent: #0e9f6e; --accent-soft: var(--green-soft); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Jakarta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px; line-height: 1.65; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .5em; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
  background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: .1em .4em; }
img { max-width: 100%; }

/* Layout */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; gap: 0; } .toc { display: none; } }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap, .topbar-in { display: flex; align-items: center; gap: 14px; height: 60px; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.topbar img { height: 26px; }
.topbar .crumb { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb a { color: var(--muted); text-decoration: none; }
.topbar .spacer { flex: 1; }
.progress-pill { font-size: .8rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .25em .8em; white-space: nowrap; }
.theme-btn { border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: 999px; padding: .3em .7em; cursor: pointer; font: inherit; font-size: .8rem; }

/* Hero */
.hero { padding: 56px 0 36px; border-bottom: 1px solid var(--line); background:
  radial-gradient(900px 300px at 85% -10%, var(--accent-soft), transparent 70%); }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .8em; }
.lead { font-size: 1.15rem; color: var(--text); max-width: 760px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--ink);
  background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: .3em .8em; }

/* Side table of contents */
.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; padding: 24px 0; font-size: .9rem; }
.toc h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .6em; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: m; }
.toc li { counter-increment: m; }
.toc a { display: flex; gap: 8px; padding: .38em .6em; border-radius: 8px; color: var(--text); text-decoration: none; }
.toc a::before { content: counter(m); font-weight: 700; color: var(--faint); min-width: 1.2em; }
.toc a:hover, .toc a.active { background: var(--accent-soft); color: var(--ink); }
.toc a.done::after { content: "✓"; margin-left: auto; color: var(--green); font-weight: 700; }

/* Modules */
main { min-width: 0; padding: 24px 0 80px; }
.module { padding: 36px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 72px; }
.module:last-child { border-bottom: 0; }
.module-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.module-num { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: var(--accent); }
.module-head p { color: var(--muted); margin: 0; }
.objectives { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 22px; }
.objectives strong { color: var(--ink); }
.objectives ul { margin: .4em 0 0; padding-left: 1.2em; }
.mark-done { margin-top: 18px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: .55em 1em; font: inherit; font-weight: 600; cursor: pointer; }
.mark-done[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green); color: var(--green); }

/* Cards and grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card .icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; font-size: 1.2rem; }
a.card { display: block; text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }

/* Role badges */
.role { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-radius: 6px; padding: .15em .5em; background: var(--accent-soft); color: var(--accent); margin-right: 4px; }

/* Click path: Menu → Tab → Button */
.path { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: .2em 0; }
.path span { font-size: .85rem; font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--line-2);
  border-radius: 8px; padding: .2em .6em; box-shadow: 0 1px 0 var(--line-2); }
.path span + span::before { content: "→"; margin: 0 6px 0 -2px; color: var(--faint); font-weight: 400; }
.path .url { font-family: ui-monospace, Menlo, monospace; font-weight: 500; }

/* Numbered steps */
.steps { list-style: none; margin: 0 0 1em; padding: 0; counter-reset: s; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 48px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent); }
.steps > li::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 2px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps > li strong:first-child { color: var(--ink); }

/* Callouts */
.callout { border-radius: 12px; padding: 12px 16px; margin: 14px 0; border: 1px solid; display: flex; gap: 10px; }
.callout::before { font-weight: 800; }
.callout.tip { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.callout.tip::before { content: "Tip"; color: var(--green); }
.callout.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.callout.warn::before { content: "Careful"; color: #b26b00; }
.callout.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.callout.info::before { content: "Note"; color: var(--blue); }
.callout.stop { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.callout.stop::before { content: "Never"; color: var(--red); }
.callout > div { min-width: 0; }

/* Mock screens: a browser window with an optional app sidebar */
.screen { border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); margin: 16px 0; }
.screen-bar { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--soft); border-bottom: 1px solid var(--line); }
.screen-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.screen-bar i:nth-child(1) { background: #ff5f57; } .screen-bar i:nth-child(2) { background: #febc2e; } .screen-bar i:nth-child(3) { background: #28c840; }
.screen-bar .addr { flex: 1; margin-left: 8px; font-size: .78rem; color: var(--muted); background: var(--card); border: 1px solid var(--line);
  border-radius: 7px; padding: .2em .7em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: ui-monospace, Menlo, monospace; }
.screen-body { display: grid; grid-template-columns: 170px minmax(0, 1fr); min-height: 260px; }
.screen-body.full { grid-template-columns: 1fr; }
@media (max-width: 640px) { .screen-body { grid-template-columns: 1fr; } .screen-side { display: none; } }
.screen-side { background: var(--soft); border-right: 1px solid var(--line); padding: 12px 8px; font-size: .8rem; }
.screen-side .brand { font-weight: 800; color: var(--ink); padding: 4px 8px 10px; }
.screen-side div.item { padding: 6px 8px; border-radius: 7px; color: var(--text); }
.screen-side div.item.on { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.screen-main { padding: 16px; font-size: .86rem; min-width: 0; }
.screen-main h5 { font-size: 1rem; color: var(--ink); margin: 0 0 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs span { padding: 6px 10px; font-size: .8rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs span.on { color: var(--ink); font-weight: 700; border-color: var(--accent); }
.ui-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--card); }
.ui-card b { color: var(--ink); }
.ui-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.ui-field { flex: 1; min-width: 140px; }
.ui-field label { display: block; font-size: .72rem; color: var(--muted); margin-bottom: 3px; }
.ui-input { border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 8px; background: var(--bg); color: var(--ink); font-size: .8rem; min-height: 30px; }
.ui-btn { display: inline-block; border-radius: 8px; padding: 6px 12px; font-size: .78rem; font-weight: 700; background: var(--accent); color: #fff; }
.ui-btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.ui-switch { display: inline-block; width: 34px; height: 20px; border-radius: 999px; background: var(--accent); position: relative; vertical-align: middle; }
.ui-switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.ui-switch.off { background: var(--line-2); } .ui-switch.off::after { right: auto; left: 3px; }
.ui-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.ui-table th, .ui-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ui-table th { color: var(--muted); font-weight: 600; }
.ui-badge { display: inline-block; border-radius: 999px; padding: .05em .55em; font-size: .7rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.ui-badge.green { background: var(--green-soft); color: var(--green); } .ui-badge.amber { background: var(--amber-soft); color: #b26b00; } .ui-badge.red { background: var(--red-soft); color: var(--red); }
/* Numbered hotspot pins on a mock screen, matched to a numbered legend */
.pin { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 800; vertical-align: middle; margin: 0 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 25%, transparent); }
.legend { list-style: none; padding: 0; margin: 8px 0 0; font-size: .9rem; }
.legend li { display: flex; gap: 8px; align-items: baseline; margin: 4px 0; }

/* Flow diagrams: boxes joined by arrows, wrapping on small screens */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 16px 0; }
.flow .node { flex: 1 1 140px; background: var(--card); border: 1px solid var(--line-2); border-top: 3px solid var(--accent);
  border-radius: 12px; padding: 12px; box-shadow: var(--shadow); font-size: .88rem; }
.flow .node b { display: block; color: var(--ink); margin-bottom: 2px; }
.flow .arrow { flex: none; align-self: center; color: var(--faint); font-size: 1.4rem; }
@media (max-width: 640px) { .flow { flex-direction: column; } .flow .arrow { transform: rotate(90deg); } }
.diagram { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; overflow-x: auto; }
.diagram svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.diagram svg text { fill: var(--ink); font-family: inherit; }
.diagram svg .muted { fill: var(--muted); }
.diagram svg .box { fill: var(--card); stroke: var(--line-2); }
.diagram svg .accent { fill: var(--accent-soft); stroke: var(--accent); }
.diagram svg .line { stroke: var(--faint); fill: none; }

/* Do / don't */
.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
@media (max-width: 700px) { .dodont { grid-template-columns: 1fr; } }
.dodont > div { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); }
.dodont .do { background: var(--green-soft); } .dodont .dont { background: var(--red-soft); }
.dodont h4 { margin: 0 0 6px; } .dodont .do h4 { color: var(--green); } .dodont .dont h4 { color: var(--red); }
.dodont ul { margin: 0; padding-left: 1.1em; }

/* Glossary and tables */
table.ref { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .92rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.ref th, table.ref td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.ref th { background: var(--soft); color: var(--ink); font-size: .82rem; }
.table-scroll { overflow-x: auto; }
dl.glossary { display: grid; grid-template-columns: 200px 1fr; gap: 8px 18px; }
dl.glossary dt { font-weight: 700; color: var(--ink); } dl.glossary dd { margin: 0; }
@media (max-width: 640px) { dl.glossary { grid-template-columns: 1fr; } dl.glossary dd { margin-bottom: 8px; } }

/* Quiz: <div class="quiz" data-answer="b"> with .q and buttons data-k="a|b|c" and .why */
.quiz { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.quiz .q { font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.quiz button { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }
.quiz button:hover { border-color: var(--accent); }
.quiz button.right { background: var(--green-soft); border-color: var(--green); color: var(--ink); }
.quiz button.wrong { background: var(--red-soft); border-color: var(--red); }
.quiz .why { display: none; margin-top: 8px; font-size: .92rem; color: var(--muted); }
.quiz.answered .why { display: block; }

/* Scenario / role-play box */
.scenario { border-left: 4px solid var(--accent); background: var(--soft); border-radius: 0 12px 12px 0; padding: 12px 16px; margin: 14px 0; }
.scenario .who { font-weight: 700; color: var(--ink); }
.chat { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.chat .m { max-width: 80%; padding: 8px 12px; border-radius: 14px; font-size: .9rem; }
.chat .m.ai { background: var(--accent-soft); color: var(--ink); border-bottom-left-radius: 4px; align-self: flex-start; }
.chat .m.me { background: var(--soft); border: 1px solid var(--line); border-bottom-right-radius: 4px; align-self: flex-end; }
.chat .m small { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; }

/* Checklist (saved per browser) */
.checklist { list-style: none; padding: 0; margin: 10px 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.checklist input { margin-top: .35em; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* Hub page */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin: 28px 0 60px; }
.product-card { border-top: 4px solid var(--accent); }

footer.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 24px 0 40px; }

@media print {
  .topbar, .toc, .mark-done, .theme-btn, .quiz button { display: none !important; }
  .layout { display: block; } .module { break-inside: avoid-page; }
  body { font-size: 12pt; background: #fff; color: #000; }
  .quiz .why { display: block; }
}

/* ---------------------------------------------------------------------------------------------------------------
   Animation (training.js adds the classes). Everything is off for prefers-reduced-motion and in print.
   --------------------------------------------------------------------------------------------------------------- */
@keyframes tr-fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes tr-pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes tr-pulse { 0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 25%, transparent); } 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--red) 0%, transparent); } }
@keyframes tr-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes tr-dots { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes tr-shimmer { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }
@keyframes tr-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes tr-dash { to { stroke-dashoffset: -24; } }
@keyframes tr-confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

.anim-ready .reveal { opacity: 0; }
.anim-ready .reveal.in { animation: tr-fade-up .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d, 0s); }

/* Hero: moving gradient text and a gently floating accent glow */
.anim-ready .grad { background-size: 200% auto; animation: tr-shimmer 6s linear infinite; }
.anim-ready .hero, .anim-ready .hub-hero { position: relative; overflow: hidden; }
.anim-ready .hero::after, .anim-ready .hub-hero::after { content: ""; position: absolute; width: 340px; height: 340px; right: -80px; top: -120px;
  border-radius: 50%; background: var(--accent); opacity: .08; filter: blur(30px); animation: tr-float 7s ease-in-out infinite; pointer-events: none; }
.anim-ready .module-num { transition: transform .3s; }
.anim-ready .module.in-view .module-num { animation: tr-pop .6s both; }

/* Steps appear one after another */
.anim-ready .steps > li { opacity: 0; transform: translateX(-10px); transition: opacity .45s, transform .45s; transition-delay: var(--d, 0s); }
.anim-ready .steps.in > li { opacity: 1; transform: none; }
.anim-ready .steps > li::after { transform-origin: top; transform: scaleY(0); transition: transform .5s; transition-delay: calc(var(--d, 0s) + .2s); }
.anim-ready .steps.in > li::after { transform: scaleY(1); }

/* Flow diagrams: nodes arrive in order, then a signal travels along them */
.anim-ready .flow .node, .anim-ready .flow .arrow { opacity: 0; transform: translateY(10px); transition: opacity .45s, transform .45s, box-shadow .3s, border-color .3s; transition-delay: var(--d, 0s); }
.anim-ready .flow.in .node, .anim-ready .flow.in .arrow { opacity: 1; transform: none; }
.flow .node.lit { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); transform: translateY(-3px) !important; }
.flow .arrow.lit { color: var(--accent); }

/* SVG diagrams: lines draw themselves, then show a moving dash */
.anim-ready .diagram svg .line.drawn { stroke-dasharray: 6 6; animation: tr-dash 1.2s linear infinite; }
.anim-ready .diagram svg .box, .anim-ready .diagram svg .accent { transition: opacity .5s; }

/* Pins pulse; a mock screen can play a guided walkthrough */
.anim-ready .screen .pin { animation: tr-pulse 2.2s ease-in-out infinite; }
.screen { position: relative; }
.walk-btn { position: absolute; right: 10px; top: 6px; z-index: 3; border: 0; border-radius: 999px; padding: .3em .8em; font: inherit;
  font-size: .75rem; font-weight: 700; color: #fff; background: var(--accent); cursor: pointer; box-shadow: var(--shadow); }
.walk-btn:hover { filter: brightness(1.08); }
.screen.walking .screen-bar .addr { margin-right: 120px; }
.screen:has(.walk-btn) .screen-bar .addr { margin-right: 120px; }
.walk-cursor { position: absolute; z-index: 4; width: 22px; height: 22px; pointer-events: none; left: 0; top: 0; opacity: 0;
  transition: transform .8s cubic-bezier(.4,.1,.2,1), opacity .3s; }
.walk-cursor svg { width: 22px; height: 22px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.walk-cursor.click::after { content: ""; position: absolute; left: -9px; top: -9px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--accent); animation: tr-pop .5s ease-out; }
.walk-focus { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; background: var(--accent-soft); transition: background .3s; }
.legend li { transition: background .3s, transform .3s; border-radius: 8px; padding: 2px 6px; margin-left: -6px; }
.legend li.walk-on { background: var(--accent-soft); transform: translateX(4px); }
.walk-caption { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 4; max-width: 90%; background: var(--ink); color: var(--bg);
  font-size: .78rem; padding: 6px 12px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transition: opacity .3s; pointer-events: none; }
.walk-caption.on { opacity: .95; }

/* Toggle switches flick on when the screen comes into view */
.anim-ready .ui-switch { transition: background .4s; }
.anim-ready .ui-switch::after { transition: left .4s, right .4s; }
.anim-ready .screen:not(.in) .ui-switch:not(.off) { background: var(--line-2); }
.anim-ready .screen:not(.in) .ui-switch:not(.off)::after { right: 17px; }

/* Chat: bubbles arrive in turn, with a typing indicator before the AI speaks */
.anim-ready .chat .m { opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
.anim-ready .chat .m.shown { opacity: 1; transform: none; }
.typing { align-self: flex-start; background: var(--accent-soft); border-radius: 14px; padding: 9px 12px; display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: tr-dots 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.replay-btn { border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: 999px; padding: .25em .8em; font: inherit; font-size: .75rem; cursor: pointer; margin-top: 4px; }

/* Quiz and progress feedback */
.quiz button.wrong { animation: tr-shake .4s; }
.quiz button.right { animation: tr-pop .4s; }
.mark-done[aria-pressed="true"] { animation: tr-pop .4s; }
.progress-bar { position: fixed; left: 0; top: 0; height: 3px; z-index: 30; background: var(--grad); width: 0; transition: width .2s; }
.confetti { position: fixed; z-index: 50; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: tr-confetti 1.1s ease-out forwards; }
.card, a.card { transition: transform .2s, box-shadow .2s, border-color .2s; }
.card:hover { box-shadow: 0 2px 4px rgba(11,16,51,.06), 0 14px 32px rgba(11,16,51,.1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .anim-ready .reveal, .anim-ready .steps > li, .anim-ready .flow .node, .anim-ready .flow .arrow, .anim-ready .chat .m { opacity: 1 !important; transform: none !important; }
  .walk-btn, .replay-btn { display: none; }
}
@media print {
  .anim-ready .reveal, .anim-ready .steps > li, .anim-ready .flow .node, .anim-ready .flow .arrow, .anim-ready .chat .m { opacity: 1 !important; transform: none !important; animation: none !important; }
  .walk-btn, .walk-cursor, .walk-caption, .progress-bar, .replay-btn, .typing { display: none !important; }
}
