/*
 * The illustrations: the hero's product mock, the phones, and the animated feature scenes.
 *
 * Loaded only on pages that draw one (Page.cshtml decides), so a policy page or a blog post pays
 * nothing for them.
 *
 * THE STILL FRAME IS THE FINISHED PICTURE. Every scene is drawn complete with no animation at all;
 * motion is layered on only while the scene carries .is-playing, which site.js adds when the scene
 * is on screen and removes when it scrolls away — and never adds under prefers-reduced-motion. So
 * a visitor who asked for less movement, a browser with scripting off, and a screenshot all see the
 * whole illustration, and an off-screen scene costs no animation work at all.
 *
 * Only transform and opacity are animated (and stroke offsets on a few lines), which the browser
 * composites without re-laying-out the page: these must never cost a Core Web Vitals point.
 *
 * Every colour is a theme token, so a theme change recolours every illustration with the site.
 * Transforms are applied only to elements that carry no transform attribute of their own — a CSS
 * transform REPLACES an SVG element's transform attribute, which would throw it across the scene —
 * which is why the markup always wraps a positioned group around an animated one.
 */

/* ---------------------------------------------------------------------------
   The frame every scene sits in
   --------------------------------------------------------------------------- */

.cms-scene {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: clamp(0.5rem, 2vw, 1.25rem);
    border: 1px solid color-mix(in srgb, var(--cms-accent) 14%, var(--cms-line));
    border-radius: var(--radius-xl, 22px);
    background:
        radial-gradient(circle at 14% 12%, color-mix(in srgb, var(--gold, #e0a526) 16%, transparent), transparent 42%),
        radial-gradient(circle at 88% 90%, color-mix(in srgb, var(--cms-accent) 16%, transparent), transparent 48%),
        color-mix(in srgb, var(--cms-accent-wash) 60%, var(--cms-surface));
    box-shadow: var(--shadow-md);
}

.cms-scene > *,
[data-animate] > * {
    transition: opacity 0.35s ease;
}

/* The replay: site.js fades the drawing out, restarts it, and fades it back in, so a loop starts
   again from the top instead of jumping. */
.cms-scene.is-fading > *,
[data-animate].is-fading > * {
    opacity: 0;
}

.sc-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    font-family: var(--cms-font-body);
}

.cms-scene > .mock {
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
}

/* ---------------------------------------------------------------------------
   Palette — every fill a token
   --------------------------------------------------------------------------- */

.sc-surface,
.sc-card,
.sc-card-flat,
.sc-bubble-in {
    fill: var(--cms-surface);
}

.sc-paper {
    fill: color-mix(in srgb, #ffffff 92%, var(--cms-accent-wash));
}

.sc-card,
.sc-bubble-in {
    filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--cms-ink) 10%, transparent));
}

.sc-card-accent {
    stroke: var(--cms-accent);
    stroke-width: 2;
}

.sc-accent { fill: var(--cms-accent); }
.sc-lift { fill: var(--cms-accent-lift); }
.sc-deep { fill: var(--cms-accent-deep); }
.sc-wash { fill: var(--cms-accent-wash); }
.sc-wash-strong { fill: color-mix(in srgb, var(--cms-accent) 24%, var(--cms-surface)); }
.sc-chat-bg { fill: color-mix(in srgb, var(--cms-accent-wash) 70%, var(--cms-surface)); }
.sc-line { fill: color-mix(in srgb, var(--cms-ink) 14%, transparent); }
.sc-ink { fill: var(--cms-ink); }
.sc-ink-solid { fill: #1c2321; }
.sc-ink-panel { fill: #101816; }
.sc-on-accent { fill: var(--cms-on-accent); }
.sc-ok { fill: var(--cms-healthy, #2e8b57); }
.sc-bad { fill: var(--cms-critical, #b3261e); }
.sc-due { fill: var(--gold, #e0a526); }
.sc-due-deep { fill: color-mix(in srgb, var(--gold, #e0a526) 70%, #000000); }
.sc-due-soft { fill: color-mix(in srgb, var(--gold, #e0a526) 24%, var(--cms-surface)); }
.sc-glass { fill: color-mix(in srgb, #bfe3ff 80%, #ffffff); }
.sc-road { fill: color-mix(in srgb, var(--cms-ink) 72%, var(--cms-surface)); }
.sc-page-hole { fill: var(--cms-page); stroke: var(--cms-line); }
.sc-star-empty { fill: color-mix(in srgb, var(--cms-accent) 16%, var(--cms-surface)); }
.sc-bubble-filled { fill: var(--cms-ink); }

.sc-dim { opacity: 0.6; }
.sc-faint { opacity: 0.35; }
.sc-dim-text { opacity: 0.8; }

.sc-tick,
.sc-on-accent-stroke,
.sc-accent-stroke,
.sc-line-stroke,
.sc-dash,
.sc-viewfinder,
.sc-flow,
.sc-pulse,
.sc-trend,
.sc-link,
.sc-wall,
.sc-ticks-read,
.sc-check-box,
.sc-bubble,
.sc-road-dash,
.sc-ring-track,
.sc-ring-fill,
.sc-ping {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sc-tick { stroke: #ffffff; stroke-width: 2.4; }
.sc-chat-icon { fill: #ffffff; }
.sc-on-accent-stroke { stroke: var(--cms-on-accent); stroke-width: 2; }
.sc-thick { stroke-width: 5; }
.sc-accent-stroke { stroke: var(--cms-accent); stroke-width: 2.5; }
.sc-line-stroke { stroke: color-mix(in srgb, var(--cms-ink) 30%, transparent); stroke-width: 1.5; }
.sc-dash { stroke: color-mix(in srgb, var(--cms-ink) 25%, transparent); stroke-dasharray: 4 4; }
.sc-viewfinder { stroke: #ffffff; stroke-width: 3; }
.sc-flow { stroke: var(--cms-accent); stroke-width: 2; stroke-dasharray: 5 6; }
.sc-pulse { stroke: var(--cms-critical, #b3261e); stroke-width: 2.5; }
.sc-trend { stroke: var(--gold, #e0a526); stroke-width: 3; }
.sc-link { stroke: color-mix(in srgb, var(--cms-accent) 45%, var(--cms-surface)); stroke-width: 2.5; }
.sc-wall { stroke: color-mix(in srgb, var(--cms-accent) 35%, transparent); stroke-width: 3; stroke-dasharray: 2 7; }
.sc-ticks-read { stroke: #34b7f1; stroke-width: 2; }
.sc-check-box { stroke: color-mix(in srgb, var(--cms-ink) 30%, transparent); stroke-width: 1.5; }
.sc-bubble { stroke: color-mix(in srgb, var(--cms-ink) 35%, transparent); stroke-width: 1.5; }
.sc-road-dash { stroke: #ffffff; stroke-width: 2; stroke-dasharray: 14 12; opacity: 0.7; }
.sc-ring-track { stroke: color-mix(in srgb, var(--cms-accent) 16%, var(--cms-surface)); stroke-width: 12; }
.sc-ring-fill { stroke: var(--cms-accent); stroke-width: 12; stroke-dasharray: 301.6; stroke-dashoffset: 84.4; }
.sc-ping { stroke: var(--cms-accent); stroke-width: 2; opacity: 0; }
.sc-glow { filter: drop-shadow(0 0 6px var(--cms-accent)); }

.sc-stamp-box { fill: none; stroke: var(--cms-critical, #b3261e); stroke-width: 3; }

.sc-ok-text { fill: var(--cms-healthy, #2e8b57); }
.sc-accent-text { fill: var(--cms-accent); }
.sc-bad-text { fill: var(--cms-critical, #b3261e); }

/* ---- Words inside a drawing. Short labels only; the figure's caption carries the meaning. ---- */

.sc-t-s { font-size: 11px; fill: var(--cms-muted); }
.sc-t-strong { font-weight: 600; fill: var(--cms-ink); }
.sc-t-b { font-size: 13px; font-weight: 700; fill: var(--cms-ink); }
.sc-t-xl { font-family: var(--cms-font-display); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; fill: var(--cms-ink); }
.sc-t-badge { font-size: 12px; font-weight: 800; fill: #ffffff; }
.sc-t-small-badge { font-size: 10px; }
.sc-t-onaccent { fill: var(--cms-on-accent); }
.sc-t-onok { fill: #ffffff; }
.sc-t-grade { font-size: 12px; font-weight: 800; fill: var(--cms-accent-deep); }
.sc-t-stamp { font-size: 22px; font-weight: 800; letter-spacing: 0.12em; fill: var(--cms-critical, #b3261e); }
.sc-t-stamp-small { font-size: 15px; }

/* ---------------------------------------------------------------------------
   The movement vocabulary. Each is one-shot and fills forwards; site.js replays
   the whole scene on a cycle while it stays on screen.
   --------------------------------------------------------------------------- */

.sc-r,
.sc-grow,
.sc-growx,
.sc-stamp,
.sc-slip,
.sc-balance,
.sc-book-out,
.sc-shield-pulse,
.sc-ping,
.sc-travel {
    transform-box: fill-box;
    transform-origin: center;
}

.sc-grow { transform-origin: 50% 100%; }
.sc-growx { transform-origin: 0 50%; }
.sc-stamp { transform: rotate(-12deg); }
.sc-book-out { transform: translateY(-34px); }
.sc-balance { transform-origin: 50% 0; }

.is-playing .sc-r {
    animation: sc-reveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

.is-playing .sc-grow {
    animation: sc-grow-y 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

.is-playing .sc-growx {
    animation: sc-grow-x 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

.is-playing .sc-draw {
    stroke-dasharray: var(--len, 300);
    animation: sc-draw 1.4s ease-out var(--d, 0s) both;
}

@keyframes sc-reveal {
    from { opacity: 0; transform: var(--from, translateY(12px)); }
    to { opacity: 1; transform: none; }
}

@keyframes sc-grow-y {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

@keyframes sc-grow-x {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes sc-draw {
    from { stroke-dashoffset: var(--len, 300); }
    to { stroke-dashoffset: 0; }
}

/* ---- Admissions: the family's card crossing the pipeline ---- */

.sc-journey {
    transform: translateX(336px);
}

.is-playing .sc-journey {
    animation: sc-journey 4.4s cubic-bezier(0.65, 0, 0.35, 1) 0.4s both;
}

.is-playing .sc-journey-done {
    animation: sc-reveal 0.5s ease-out 4.6s both;
    --from: scale(0.2);
}

.sc-journey-done {
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes sc-journey {
    0%, 12% { transform: translateX(0); }
    28%, 40% { transform: translateX(112px); }
    56%, 68% { transform: translateX(224px); }
    86%, 100% { transform: translateX(336px); }
}

/* ---- Register sheet: the scan line sweeping the page ---- */

.sc-scan {
    transform: translateY(140px);
    opacity: 0.9;
}

.is-playing .sc-scan {
    animation: sc-scan 2.8s ease-in-out 0.3s both;
}

@keyframes sc-scan {
    0% { transform: translateY(0); opacity: 0; }
    8% { opacity: 1; }
    92% { opacity: 1; }
    100% { transform: translateY(290px); opacity: 0; }
}

/* ---- Fees: the challan dropping in, stamped, and filed ---- */

.is-playing .sc-slip {
    animation: sc-slip 3.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
}

.is-playing .sc-stamp {
    animation: sc-stamp 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) 1.2s both;
}

@keyframes sc-slip {
    0% { transform: translateY(-40px); opacity: 0; }
    15% { transform: none; opacity: 1; }
    70% { transform: none; }
    100% { transform: translateY(64px); }
}

@keyframes sc-stamp {
    from { transform: scale(2.4) rotate(-30deg); opacity: 0; }
    to { transform: rotate(-12deg); opacity: 1; }
}

/* ---- Accounting: the beam settling level ---- */

.is-playing .sc-balance {
    animation: sc-balance 2.4s cubic-bezier(0.3, 1.2, 0.4, 1) 1.8s both;
}

@keyframes sc-balance {
    0% { transform: rotate(-11deg); }
    45% { transform: rotate(5deg); }
    70% { transform: rotate(-2deg); }
    100% { transform: rotate(0); }
}

/* ---- Transport: the bus driving the route ---- */

.sc-drive {
    transform: translateX(270px);
}

.is-playing .sc-drive {
    animation: sc-drive 5.6s cubic-bezier(0.45, 0, 0.25, 1) 0.2s both;
}

@keyframes sc-drive {
    from { transform: translateX(0); }
    to { transform: translateX(270px); }
}

/* ---- Library: the book drawn from the shelf ---- */

.is-playing .sc-book-out {
    animation: sc-book 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both;
}

@keyframes sc-book {
    from { transform: translateY(0); }
    to { transform: translateY(-34px); }
}

/* ---- Continuous: the pulse line, the shield, rings, and figures travelling ---- */

.sc-pulse {
    stroke-dasharray: 260;
    stroke-dashoffset: 0;
}

.is-playing .sc-pulse {
    animation: sc-pulse 2.2s linear infinite;
}

@keyframes sc-pulse {
    from { stroke-dashoffset: 260; }
    to { stroke-dashoffset: -260; }
}

.is-playing .sc-shield-pulse {
    animation: sc-breathe 2.4s ease-in-out infinite;
}

@keyframes sc-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.is-playing .sc-ping {
    animation: sc-ping 3s ease-out var(--d, 0s) infinite;
}

@keyframes sc-ping {
    from { transform: scale(0.7); opacity: 0.55; }
    to { transform: scale(1.7); opacity: 0; }
}

.sc-travel {
    opacity: 0;
}

.is-playing .sc-travel {
    animation: sc-travel 2.4s ease-in-out var(--d, 0s) infinite;
}

@keyframes sc-travel {
    0% { transform: translate(0, 0); opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)); opacity: 0; }
}

.is-playing .sc-ring-fill {
    animation: sc-ring 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

@keyframes sc-ring {
    from { stroke-dashoffset: 301.6; }
    to { stroke-dashoffset: 84.4; }
}

/* ---------------------------------------------------------------------------
   The hero's product mock — a dashboard window tilted in real 3D
   --------------------------------------------------------------------------- */

.mock {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
    aspect-ratio: 6 / 5;
    perspective: 1800px;
}

.mock-stage {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

.mock-window {
    position: absolute;
    inset: 7% 5% 11% 5%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--cms-line);
    border-radius: 18px;
    background: var(--cms-surface);
    box-shadow: var(--shadow-lg);
    transform: rotateX(9deg) rotateY(-15deg) rotateZ(1.5deg);
    transform-origin: 60% 50%;
}

[dir="rtl"] .mock-window {
    transform: rotateX(9deg) rotateY(15deg) rotateZ(-1.5deg);
}

.mock-top {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border-bottom: 1px solid var(--cms-line);
    background: color-mix(in srgb, var(--cms-accent-wash) 50%, var(--cms-surface));
}

.mock-top i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff5f57;
}

.mock-top i:nth-child(2) { background: #febc2e; }
.mock-top i:nth-child(3) { background: #28c840; }

.mock-url {
    width: 42%;
    height: 12px;
    margin-inline-start: 12px;
    border-radius: 6px;
    background: var(--cms-surface);
}

.mock-body {
    display: grid;
    flex: 1;
    grid-template-columns: 21% 1fr;
    min-height: 0;
}

.mock-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 10px;
    background: var(--cms-accent-deep);
}

.mock-side b {
    width: 62%;
    height: 16px;
    border-radius: 6px;
    background: var(--gold, #e0a526);
}

.mock-side span {
    height: 8px;
    border-radius: 5px;
    background: rgb(255 255 255 / 0.22);
}

.mock-side span.is-on {
    background: rgb(255 255 255 / 0.75);
}

.mock-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 12px;
}

.mock-greet {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mock-h {
    width: 44%;
    height: 11px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--cms-ink) 70%, transparent);
}

.mock-chip {
    padding: 3px 9px;
    border-radius: 99px;
    background: var(--cms-accent-wash);
    color: var(--cms-accent-deep);
    font-size: 10px;
    font-weight: 700;
}

.mock-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mock-kpi {
    display: grid;
    padding: 7px 9px;
    border: 1px solid var(--cms-line);
    border-radius: 10px;
    background: var(--cms-page);
}

.mock-kpi small {
    font-size: 9px;
    color: var(--cms-muted);
}

.mock-kpi b {
    font-family: var(--cms-font-display);
    font-size: clamp(13px, 2vw, 19px);
    font-variant-numeric: tabular-nums;
    color: var(--cms-ink);
}

.mock-kpi.is-warn b {
    color: var(--cms-critical, #b3261e);
}

.mock-panels {
    display: grid;
    flex: 1;
    grid-template-columns: 1.6fr 1fr;
    gap: 8px;
    min-height: 0;
}

.mock-panel {
    min-height: 0;
    padding: 10px;
    border: 1px solid var(--cms-line);
    border-radius: 10px;
    background: var(--cms-page);
}

.mock-bars {
    display: flex;
    align-items: flex-end;
    gap: 6%;
}

.mock-bars i {
    flex: 1;
    height: var(--h);
    border-radius: 4px 4px 2px 2px;
    background: color-mix(in srgb, var(--cms-accent) 32%, var(--cms-surface));
    transform-origin: 50% 100%;
}

.mock-bars i:nth-child(6) {
    background: var(--cms-accent);
}

.mock-donut {
    display: grid;
    place-items: center;
    gap: 4px;
}

.mock-donut small {
    font-size: 9px;
    color: var(--cms-muted);
}

.mock-ring {
    width: 68%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(var(--cms-accent) calc(var(--p) * 1%), var(--cms-accent-wash) 0);
    -webkit-mask: radial-gradient(circle, transparent 52%, #000 53%);
    mask: radial-gradient(circle, transparent 52%, #000 53%);
}

.mock-rows {
    display: grid;
    gap: 6px;
}

.mock-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mock-row i {
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--cms-accent-wash);
}

.mock-row span {
    flex: 1;
    height: 7px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--cms-ink) 12%, transparent);
}

.mock-row em {
    padding: 2px 7px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--gold, #e0a526) 24%, var(--cms-surface));
    color: #6b4d0a;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
}

.mock-row em.is-ok {
    background: color-mix(in srgb, var(--cms-healthy, #2e8b57) 18%, var(--cms-surface));
    color: var(--cms-healthy, #2e8b57);
}

.mock-float {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--cms-line);
    border-radius: 14px;
    background: var(--cms-surface);
    box-shadow: var(--shadow-md);
    transform: translateZ(80px);
    font-size: 12px;
    color: var(--cms-ink);
    white-space: nowrap;
}

.mock-float-a {
    inset-inline-start: 0;
    bottom: 12%;
}

.mock-float-b {
    inset-inline-end: 0;
    top: 3%;
}

.mock-float-text {
    display: grid;
    line-height: 1.25;
}

.mock-float-text b {
    font-size: 12.5px;
}

.mock-float-text small {
    font-size: 11px;
    color: var(--cms-muted);
}

.mock-wa {
    position: relative;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cms-healthy, #2e8b57);
}

.mock-wa::after {
    content: "";
    position: absolute;
    inset: 9px 8px 10px;
    border-radius: 4px 4px 4px 1px;
    background: #ffffff;
}

.mock-stamp {
    padding: 2px 7px;
    border: 2px solid currentColor;
    border-radius: 6px;
    color: var(--cms-healthy, #2e8b57);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transform: rotate(-8deg);
}

.is-playing .mock-bars i {
    animation: sc-grow-y 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

.is-playing .mock-kpi {
    animation: sc-reveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.is-playing .mock-kpi:nth-child(2) { animation-delay: 0.15s; }
.is-playing .mock-kpi:nth-child(3) { animation-delay: 0.3s; }

.is-playing .mock-float-a {
    animation: mock-bob 5s ease-in-out infinite;
}

.is-playing .mock-float-b {
    animation: mock-bob 5s ease-in-out 1.6s infinite;
}

@keyframes mock-bob {
    0%, 100% { transform: translateZ(80px) translateY(0); }
    50% { transform: translateZ(80px) translateY(-8px); }
}

/* ---- The phones: a pair for the app hero ---- */

.mock-phones {
    aspect-ratio: 1 / 1;
}

.mock-phones .cms-phone {
    position: absolute;
    width: 46%;
    max-width: none;
}

.mock-phone-back {
    top: 3%;
    inset-inline-start: 8%;
    transform: rotateY(20deg) rotateZ(-6deg) translateZ(-60px);
    opacity: 0.95;
}

.mock-phone-front {
    top: 9%;
    inset-inline-end: 8%;
    transform: rotateY(-16deg) rotateZ(3deg);
}

.mock-phones .mock-float-a {
    inset-inline-start: 2%;
    bottom: 6%;
}

/* ---------------------------------------------------------------------------
   A phone, and the app screens drawn inside it
   --------------------------------------------------------------------------- */

.cms-phone {
    position: relative;
    width: 100%;
    max-width: 250px;
    margin-inline: auto;
    aspect-ratio: 9 / 18.5;
    padding: 9px;
    border-radius: 38px;
    background: linear-gradient(145deg, #2a3330, #0b0f0e);
    box-shadow: var(--shadow-lg), inset 0 0 0 2px rgb(255 255 255 / 0.08);
}

.cms-phone::before {
    content: "";
    position: absolute;
    top: 17px;
    left: 50%;
    z-index: 2;
    width: 30%;
    height: 16px;
    border-radius: 12px;
    background: #0b0f0e;
    transform: translateX(-50%);
}

.cms-phone-screen {
    position: relative;
    height: 100%;
    overflow: hidden;
    border-radius: 30px;
    background: var(--cms-page);
}

.scr {
    display: flex;
    flex-direction: column;
    gap: 7px;
    height: 100%;
    padding: 36px 10px 12px;
    background: linear-gradient(180deg, var(--cms-accent-wash), var(--cms-page) 42%);
    color: var(--cms-ink);
    font-size: 11px;
    line-height: 1.3;
    text-align: start;
}

.scr-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.scr-bar-title {
    font-family: var(--cms-font-display);
    font-size: 14px;
    font-weight: 700;
}

.scr-chip {
    padding: 3px 8px;
    border-radius: 99px;
    background: var(--cms-accent);
    color: var(--cms-on-accent);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.scr-sub {
    font-size: 10px;
    color: var(--cms-muted);
}

.scr-card {
    padding: 8px 10px;
    border: 1px solid var(--cms-line);
    border-radius: 12px;
    background: var(--cms-surface);
    box-shadow: var(--shadow-sm);
}

.scr-card-label {
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cms-muted);
}

.scr-card-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 3px;
}

.scr-card-row b {
    font-variant-numeric: tabular-nums;
}

.scr-pill {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 7px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--gold, #e0a526) 25%, var(--cms-surface));
    color: #6b4d0a;
    font-size: 9px;
    font-weight: 700;
}

.scr-attend {
    display: flex;
    align-items: center;
    gap: 10px;
}

.scr-ring {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: conic-gradient(var(--cms-healthy, #2e8b57) calc(var(--p) * 1%), var(--cms-accent-wash) 0);
}

.scr-ring span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cms-surface);
    font-size: 9px;
    font-weight: 800;
}

.scr-ok {
    color: var(--cms-healthy, #2e8b57);
    font-weight: 700;
}

.scr-list,
.scr-periods {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.scr-list li,
.scr-periods li {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    border: 1px solid var(--cms-line);
    border-radius: 9px;
    background: var(--cms-surface);
}

.scr-ava {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cms-accent) 22%, var(--cms-surface));
}

.scr-name {
    flex: 1;
    font-size: 10.5px;
}

.scr-mark {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    color: #ffffff;
    font-size: 10px;
}

.scr-mark.is-p { background: var(--cms-healthy, #2e8b57); }
.scr-mark.is-a { background: var(--cms-critical, #b3261e); }
.scr-mark.is-l { background: var(--gold, #e0a526); }

.scr-button {
    margin-top: auto;
    padding: 8px;
    border-radius: 10px;
    background: var(--cms-accent);
    color: var(--cms-on-accent);
    font-weight: 700;
    text-align: center;
}

.scr-periods b {
    width: 30px;
    font-size: 10px;
    font-weight: 600;
    color: var(--cms-muted);
}

.scr-periods li.is-now {
    border-color: var(--cms-accent);
    background: var(--cms-accent-wash);
}

.scr-grade {
    color: var(--cms-accent-deep);
}

.scr-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.scr-tile {
    display: grid;
    padding: 8px;
    border: 1px solid var(--cms-line);
    border-radius: 10px;
    background: var(--cms-surface);
}

.scr-tile b {
    font-family: var(--cms-font-display);
    font-size: 16px;
}

.scr-tile span {
    font-size: 9px;
    color: var(--cms-muted);
}

.scr-tile.is-warn b {
    color: var(--cms-critical, #b3261e);
}

.scr-bars {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 54px;
    margin-top: 6px;
}

.scr-bars i {
    flex: 1;
    height: var(--h);
    border-radius: 3px;
    background: color-mix(in srgb, var(--cms-accent) 38%, var(--cms-surface));
}

.scr-bars i:nth-child(4) {
    background: var(--cms-accent);
}

.scr-meter {
    height: 6px;
    margin: 6px 0 2px;
    border-radius: 3px;
    background: var(--cms-accent-wash);
}

.scr-meter i {
    display: block;
    width: var(--w);
    height: 100%;
    border-radius: 3px;
    background: var(--cms-healthy, #2e8b57);
}

.scr-msg {
    border-inline-start: 3px solid var(--cms-accent);
    font-size: 10.5px;
}

.is-playing .scr-anim {
    animation: sc-reveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

/* ---------------------------------------------------------------------------
   Timetable — HTML cells turning over in 3D
   --------------------------------------------------------------------------- */

.tt {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    padding: 3%;
}

.tt-grid {
    display: grid;
    flex: 1;
    grid-template-columns: 22px repeat(5, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 5px;
    perspective: 700px;
}

.tt-corner {
    display: block;
}

.tt-day,
.tt-period {
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--cms-muted);
}

.tt-cell {
    display: grid;
    place-content: center;
    padding: 2px;
    border: 1px solid var(--cms-line);
    border-radius: 8px;
    background: var(--cms-surface);
    color: var(--cms-ink);
    font-size: clamp(8px, 1.5vw, 11.5px);
    line-height: 1.15;
    text-align: center;
    transform-origin: 50% 0;
    backface-visibility: hidden;
}

.tt-cell b {
    font-weight: 600;
}

.tt-cell small {
    font-size: 0.78em;
}

.tt-cell.t-a { background: color-mix(in srgb, var(--cms-accent) 18%, var(--cms-surface)); }
.tt-cell.t-b { background: color-mix(in srgb, var(--gold, #e0a526) 20%, var(--cms-surface)); }
.tt-cell.t-c { background: color-mix(in srgb, var(--cms-healthy, #2e8b57) 15%, var(--cms-surface)); }
.tt-cell.t-d { background: color-mix(in srgb, var(--cms-accent-lift) 10%, var(--cms-surface)); }
.tt-cell.t-e { background: color-mix(in srgb, var(--cms-critical, #b3261e) 9%, var(--cms-surface)); }

.tt-cell.is-cover {
    border-color: transparent;
    background: var(--gold, #e0a526);
    color: #3a2a05;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold, #e0a526) 35%, transparent);
}

.tt-note {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 99px;
    background: var(--cms-surface);
    box-shadow: var(--shadow-sm);
    color: var(--cms-accent-deep);
    font-size: 12px;
    font-weight: 600;
}

.tt-note i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cms-healthy, #2e8b57);
}

.is-playing .tt-cell {
    animation: tt-flip 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

.is-playing .tt-cell.is-cover {
    animation:
        tt-flip 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both,
        tt-cover 0.7s cubic-bezier(0.3, 1.4, 0.5, 1) 3.2s both;
}

@keyframes tt-flip {
    from { transform: rotateX(-95deg); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes tt-cover {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0); }
}

/* ---------------------------------------------------------------------------
   The app scene — one phone cycling through three people's screens
   --------------------------------------------------------------------------- */

.app-scene {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
}

.app-scene-phone {
    width: auto;
    height: 94%;
    max-width: none;
    padding: 7px;
    border-radius: 30px;
}

.app-scene-phone .cms-phone-screen {
    border-radius: 24px;
}

.app-slides {
    position: relative;
}

.app-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.app-slide:first-child {
    opacity: 1;
}

.is-playing .app-slide {
    animation: app-cycle 9s ease-in-out var(--d, 0s) infinite both;
}

@keyframes app-cycle {
    0% { opacity: 0; transform: translateX(14px); }
    4%, 30% { opacity: 1; transform: none; }
    34%, 100% { opacity: 0; transform: translateX(-14px); }
}

.app-scene-chip {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 99px;
    background: var(--cms-surface);
    box-shadow: var(--shadow-md);
    color: var(--cms-ink);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.app-scene-chip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cms-healthy, #2e8b57);
}

.app-scene-chip-a {
    top: 14%;
    inset-inline-start: 3%;
}

.app-scene-chip-b {
    bottom: 14%;
    inset-inline-end: 3%;
}

/* ---------------------------------------------------------------------------
   The 3D scenes — HTML layers in real perspective

   The newer illustrations are drawn in HTML rather than SVG, because SVG elements do not take
   3D transforms: here each card sits on its own plane (translateZ), the whole set is tilted on a
   stage that sways a few degrees while it plays, and things fly in from in front of the page
   rather than sliding across it. That depth is what makes them read as short animated clips
   rather than diagrams.

   ONE CANVAS, SCALED. Every scene is laid out on a 48 x 36em canvas, and the canvas's font size
   is the scene's width divided by 48 (container query units), so the whole drawing scales like
   an SVG viewBox — the same picture at 320px and at 640px, with nothing wrapping or overflowing.
   Positions are custom properties in em (--x, --y, --w, --h, --z) on .s3d-at, and they are
   INLINE-START offsets, so an Urdu page mirrors the layout by itself; the stage's tilt flips with
   it.

   The still frame is still the finished picture: every element's resting style is its final
   state, and the movement below runs only under .is-playing, which site.js never adds under
   reduced motion. Only transform and opacity animate. An element that animates is never the one
   that carries a position transform — .s3d-at places, its child moves — because an animation's
   transform replaces the element's own.
   --------------------------------------------------------------------------- */

@property --s3d-n {
    syntax: '<integer>';
    inherits: false;
    initial-value: 0;
}

.s3d {
    container-type: size;
    position: relative;
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: var(--cms-ink);
    font-family: var(--cms-font-body);
    line-height: 1.25;
    text-align: start;
}

.s3d-canvas {
    position: relative;
    width: 48em;
    height: 36em;
    font-size: min(calc(100cqw / 48), calc(100cqh / 36));
    perspective: 80em;
    perspective-origin: 50% 30%;
}

.s3d-tilt {
    --flip: 1;
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: rotateX(var(--rx, 12deg)) rotateY(calc(var(--ry, -14deg) * var(--flip)));
}

[dir="rtl"] .s3d-tilt {
    --flip: -1;
}

.is-playing .s3d-tilt {
    animation: s3d-sway 14s ease-in-out infinite;
}

@keyframes s3d-sway {
    0%, 100% { transform: rotateX(var(--rx, 12deg)) rotateY(calc(var(--ry, -14deg) * var(--flip))); }
    50% { transform: rotateX(calc(var(--rx, 12deg) - 4deg)) rotateY(calc((var(--ry, -14deg) + 9deg) * var(--flip))); }
}

/* A soft shadow on the "floor" under the stage — what makes the cards look lifted off it. */
.s3d-floor {
    position: absolute;
    inset-inline: 8%;
    bottom: 3%;
    height: 16%;
    border-radius: 50%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--cms-accent-deep) 26%, transparent), transparent);
    filter: blur(0.6em);
}

.s3d-at {
    position: absolute;
    top: calc(var(--y, 0) * 1em);
    inset-inline-start: calc(var(--x, 0) * 1em);
    width: calc(var(--w, 10) * 1em);
    transform: translateZ(calc(var(--z, 0) * 1em));
    transform-style: preserve-3d;
}

/* The sample words in a drawing are English. On an Urdu page the LAYOUT mirrors, but each label
   keeps its own reading order rather than having its full stop thrown to the wrong end. */
.s3d-card,
.s3d-chip,
.s3d-tag,
.s3d-row > span {
    unicode-bidi: plaintext;
}

.s3d-at[style*="--h"] {
    height: calc(var(--h) * 1em);
}

/* ---- Surfaces ---- */

.s3d-card {
    position: relative;
    height: 100%;
    padding: 1.1em 1.2em;
    border: 0.08em solid color-mix(in srgb, var(--cms-ink) 9%, transparent);
    border-radius: 1.2em;
    background: var(--cms-surface);
    box-shadow:
        0 1.8em 3em -1.4em color-mix(in srgb, var(--cms-accent-deep) 50%, transparent),
        0 0.3em 0.8em -0.3em color-mix(in srgb, var(--cms-ink) 20%, transparent);
}

.s3d-card.is-tight {
    padding: 0.7em 0.9em;
}

.s3d-card.is-accent {
    border-color: transparent;
    background: linear-gradient(150deg, var(--cms-accent-lift), var(--cms-accent) 55%, var(--cms-accent-deep));
    color: var(--cms-on-accent);
}

.s3d-card.is-wash {
    background: color-mix(in srgb, var(--cms-accent-wash) 70%, var(--cms-surface));
}

.s3d-card.is-paper {
    background: color-mix(in srgb, #ffffff 94%, var(--cms-accent-wash));
    color: #1c2321;
}

.s3d-card.is-dark {
    border-color: transparent;
    background: linear-gradient(160deg, #2a3532, #121a18);
    color: #e9f1ee;
}

.s3d-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    margin-bottom: 0.8em;
}

.s3d-title {
    font-size: 1.25em;
    font-weight: 700;
}

.s3d-sub {
    font-size: 0.95em;
    opacity: 0.72;
}

.s3d-big {
    font-family: var(--cms-font-display);
    font-size: 2.4em;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.s3d-num {
    font-family: var(--cms-font-numeric);
    font-variant-numeric: tabular-nums;
}

.s3d-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    padding: 0.45em 0;
    border-bottom: 0.08em dashed color-mix(in srgb, currentColor 18%, transparent);
    font-size: 1em;
}

.s3d-row:last-child {
    border-bottom: 0;
}

.s3d-row.is-total {
    margin-top: 0.3em;
    border-top: 0.12em solid color-mix(in srgb, currentColor 30%, transparent);
    border-bottom: 0;
    font-weight: 800;
}

.s3d-bar {
    display: block;
    width: calc(var(--w, 6) * 1em);
    max-width: 100%;
    height: 0.55em;
    border-radius: 1em;
    background: color-mix(in srgb, currentColor 16%, transparent);
}

.s3d-bar.is-short {
    height: 0.45em;
    opacity: 0.7;
}

.s3d-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.55em 0.95em;
    border-radius: 2em;
    background: var(--cms-surface);
    box-shadow: 0 1em 1.8em -0.9em color-mix(in srgb, var(--cms-accent-deep) 55%, transparent);
    color: var(--cms-ink);
    font-size: 1.05em;
    font-weight: 650;
    white-space: nowrap;
}

.s3d-chip i {
    flex: none;
    width: 0.7em;
    height: 0.7em;
    border-radius: 50%;
    background: var(--cms-healthy, #2e8b57);
}

.s3d-chip.is-due i { background: var(--cms-due, #c98a12); }
.s3d-chip.is-accent i { background: var(--cms-accent); }

.s3d-tag {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 0.5em;
    background: color-mix(in srgb, var(--cms-accent) 14%, transparent);
    color: var(--cms-accent-deep);
    font-size: 0.85em;
    font-weight: 700;
    white-space: nowrap;
}

.s3d-card.is-dark .s3d-tag,
.s3d-card.is-accent .s3d-tag {
    background: color-mix(in srgb, #ffffff 18%, transparent);
    color: inherit;
}

.s3d-tag.is-ok { background: color-mix(in srgb, var(--cms-healthy, #2e8b57) 16%, transparent); color: var(--cms-healthy, #2e8b57); }
.s3d-tag.is-due { background: color-mix(in srgb, var(--cms-due, #c98a12) 18%, transparent); color: color-mix(in srgb, var(--cms-due, #c98a12) 75%, var(--cms-ink)); }
.s3d-tag.is-bad { background: color-mix(in srgb, var(--cms-critical, #b3261e) 14%, transparent); color: var(--cms-critical, #b3261e); }

/* A filled circle with a tick, drawn in CSS so it needs no glyph from the face in use. */
.s3d-ok {
    position: relative;
    display: inline-block;
    flex: none;
    width: 1.5em;
    height: 1.5em;
    border-radius: 50%;
    background: var(--cms-healthy, #2e8b57);
    vertical-align: middle;
}

.s3d-ok::after {
    content: "";
    position: absolute;
    top: 0.33em;
    inset-inline-start: 0.52em;
    width: 0.36em;
    height: 0.66em;
    border: solid #ffffff;
    border-width: 0 0.16em 0.16em 0;
    transform: rotate(45deg);
}

[dir="rtl"] .s3d-ok::after {
    transform: rotate(45deg) scaleX(-1);
}

.s3d-ok.is-small {
    width: 1.15em;
    height: 1.15em;
}

.s3d-ok.is-small::after {
    top: 0.24em;
    inset-inline-start: 0.4em;
    width: 0.28em;
    height: 0.5em;
}

.s3d-icon {
    display: inline-grid;
    flex: none;
    width: 2.6em;
    height: 2.6em;
    place-items: center;
    border-radius: 0.8em;
    background: color-mix(in srgb, var(--cms-accent) 14%, var(--cms-surface));
    font-size: 1em;
    line-height: 1;
}

.s3d-icon.is-solid {
    background: var(--cms-accent);
    color: var(--cms-on-accent);
}

/* ---- The movement vocabulary for the 3D scenes ---- */

.is-playing .s3d-in {
    animation: s3d-in 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

@keyframes s3d-in {
    from { opacity: 0; transform: var(--from, translate3d(0, 1.4em, 4em)); }
    to { opacity: 1; transform: none; }
}

.is-playing .s3d-pop {
    animation: s3d-pop 0.55s cubic-bezier(0.3, 1.6, 0.5, 1) var(--d, 0s) both;
}

@keyframes s3d-pop {
    from { opacity: 0; transform: scale(0.2); }
    to { opacity: 1; transform: none; }
}

/* Flies in from far in front of the page, turning as it comes — the "landing" move. */
.is-playing .s3d-fly {
    animation: s3d-fly 1.1s cubic-bezier(0.2, 0.75, 0.25, 1) var(--d, 0s) both;
}

@keyframes s3d-fly {
    from { opacity: 0; transform: var(--from, translate3d(-6em, -5em, 14em) rotateY(-35deg) rotateZ(-8deg)); }
    60% { opacity: 1; }
    to { opacity: 1; transform: none; }
}

/* Turns over like a card, showing its face at the end. */
.is-playing .s3d-flip {
    animation: s3d-flip 0.9s cubic-bezier(0.3, 0.8, 0.3, 1) var(--d, 0s) both;
    backface-visibility: hidden;
}

@keyframes s3d-flip {
    from { opacity: 0; transform: rotateY(-100deg); }
    40% { opacity: 1; }
    to { opacity: 1; transform: none; }
}

.is-playing .s3d-float {
    animation: s3d-float 4.5s ease-in-out var(--d, 0s) infinite;
}

@keyframes s3d-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -0.7em, 1.2em); }
}

/* Grows from its base, for a bar. */
.s3d-grow {
    transform-origin: 50% 100%;
}

.is-playing .s3d-grow {
    animation: s3d-grow 1s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) both;
}

@keyframes s3d-grow {
    from { transform: scaleY(0); }
    to { transform: none; }
}

/* Fills from the start edge, for a progress line. */
.s3d-sweep {
    transform-origin: 0 50%;
}

[dir="rtl"] .s3d-sweep {
    transform-origin: 100% 50%;
}

.is-playing .s3d-sweep {
    animation: s3d-sweep var(--t, 1.2s) linear var(--d, 0s) both;
}

@keyframes s3d-sweep {
    from { transform: scaleX(0); }
    to { transform: none; }
}

/* A ring that keeps going out from something that is "live" — a speaker, a scanner. */
.s3d-ring {
    position: absolute;
    inset: 0;
    border: 0.15em solid var(--cms-accent);
    border-radius: 50%;
    opacity: 0;
}

.is-playing .s3d-ring {
    animation: s3d-ring 1.8s ease-out var(--d, 0s) infinite;
}

@keyframes s3d-ring {
    from { opacity: 0.7; transform: scale(1); }
    to { opacity: 0; transform: scale(2.1); }
}

/* Two states in one place: the "before" fades out at --d and the "after" in. The resting
   (still) frame is the after. */
.s3d-swap {
    display: inline-grid;
}

.s3d-swap > * {
    grid-area: 1 / 1;
}

.s3d-before {
    opacity: 0;
}

.is-playing .s3d-before {
    animation: s3d-out 0.35s ease-in var(--d, 0s) both;
}

.is-playing .s3d-after {
    animation: s3d-in-place 0.45s ease-out var(--d, 0s) both;
}

@keyframes s3d-out {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-0.4em); }
}

@keyframes s3d-in-place {
    from { opacity: 0; transform: translateY(0.4em); }
    to { opacity: 1; transform: none; }
}

/* A whole number counting up to --to. At rest it simply shows --to. */
.s3d-count {
    --s3d-n: var(--to, 0);
    counter-reset: s3d-n var(--s3d-n);
}

.s3d-count::after {
    content: counter(s3d-n);
}

.is-playing .s3d-count {
    animation: s3d-count var(--t, 1.6s) cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s) both;
}

@keyframes s3d-count {
    from { --s3d-n: var(--from-n, 0); }
    to { --s3d-n: var(--to, 0); }
}

/* ---- Voice notes ---- */

.vn-phone {
    padding: 0;
    overflow: hidden;
}

.vn-top {
    display: flex;
    align-items: center;
    gap: 0.7em;
    padding: 1em 1.1em;
    background: var(--cms-accent);
    color: var(--cms-on-accent);
}

.vn-ava {
    width: 2.4em;
    height: 2.4em;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cms-on-accent) 30%, transparent);
}

.vn-thread {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
    padding: 1.1em;
    background: color-mix(in srgb, var(--cms-accent-wash) 65%, var(--cms-surface));
    height: calc(100% - 4.4em);
}

.vn-bubble {
    max-width: 82%;
    padding: 0.65em 0.85em;
    border-radius: 1em;
    border-end-start-radius: 0.3em;
    background: var(--cms-surface);
    box-shadow: 0 0.4em 0.8em -0.5em color-mix(in srgb, var(--cms-ink) 30%, transparent);
    font-size: 1.05em;
}

.vn-bubble.is-mine {
    align-self: flex-end;
    border-end-start-radius: 1em;
    border-end-end-radius: 0.3em;
    background: color-mix(in srgb, var(--cms-accent) 16%, var(--cms-surface));
}

.vn-bubble.is-voice {
    width: 80%;
}

.vn-voice {
    display: flex;
    align-items: center;
    gap: 0.7em;
    width: 82%;
}

.vn-play {
    position: relative;
    flex: none;
    width: 2.4em;
    height: 2.4em;
    border-radius: 50%;
    background: var(--cms-accent);
}

/* A play triangle, drawn with borders. */
.vn-play::after {
    content: "";
    position: absolute;
    top: 0.68em;
    inset-inline-start: 0.92em;
    border-block: 0.52em solid transparent;
    border-inline-start: 0.8em solid var(--cms-on-accent);
}

.vn-wave {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.18em;
    height: 2.2em;
}

.vn-wave i {
    flex: 1;
    height: calc(var(--h, 50) * 1%);
    border-radius: 1em;
    background: color-mix(in srgb, var(--cms-accent) 75%, var(--cms-surface));
    transform-origin: 50% 50%;
}

.is-playing .vn-wave i {
    animation: vn-wave 0.9s ease-in-out calc(var(--i, 0) * -0.11s) infinite alternate;
}

@keyframes vn-wave {
    from { transform: scaleY(0.35); }
    to { transform: scaleY(1); }
}

.vn-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.35em;
    font-size: 0.85em;
    opacity: 0.7;
}

.vn-progress {
    display: block;
    height: 0.3em;
    margin-top: 0.4em;
    border-radius: 1em;
    background: color-mix(in srgb, var(--cms-accent) 18%, transparent);
    overflow: hidden;
}

.vn-progress i {
    display: block;
    width: 62%;
    height: 100%;
    border-radius: 1em;
    background: var(--cms-accent);
}

.vn-mic {
    position: relative;
    display: grid;
    width: 5.2em;
    height: 5.2em;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--cms-accent-lift), var(--cms-accent-deep));
    box-shadow: 0 1.4em 2.4em -1em color-mix(in srgb, var(--cms-accent-deep) 70%, transparent);
}

/* A microphone, drawn in CSS: a capsule and a stand. */
.vn-mic b {
    position: relative;
    width: 1.3em;
    height: 2.1em;
    border-radius: 1em;
    background: var(--cms-on-accent);
}

.vn-mic b::after {
    content: "";
    position: absolute;
    top: 1.2em;
    left: -0.45em;
    width: 2.2em;
    height: 1.4em;
    border: 0.22em solid var(--cms-on-accent);
    border-top: 0;
    border-radius: 0 0 1.2em 1.2em;
}

.vn-ticks {
    color: #34b7f1;
    font-weight: 800;
    letter-spacing: -0.15em;
}

/* ---- AI writing help ---- */

.ai-note {
    transform: rotate(-3deg);
}

.ai-scrawl {
    display: block;
    font-family: "Segoe Print", "Comic Sans MS", var(--cms-font-body);
    font-size: 1.15em;
    line-height: 1.55;
}

.ai-scrawl s {
    opacity: 0.55;
}

.ai-spark {
    position: relative;
    display: grid;
    width: 4.4em;
    height: 4.4em;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--gold, #e0a526) 60%, #ffffff), var(--gold, #e0a526) 60%, color-mix(in srgb, var(--gold, #e0a526) 70%, #000000));
    box-shadow: 0 0 2em color-mix(in srgb, var(--gold, #e0a526) 60%, transparent);
}

/* A four-pointed star, made from two rotated squares. */
.ai-spark b,
.ai-spark b::after {
    width: 1.3em;
    height: 1.3em;
    background: #ffffff;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.ai-spark b::after {
    content: "";
    display: block;
    transform: scale(0.5) translate(1.1em, -1.1em);
}

.is-playing .ai-spark {
    animation: ai-spin 3.6s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-line {
    display: block;
    margin-bottom: 0.45em;
    font-size: 1.02em;
}

.ai-urdu {
    direction: rtl;
    font-family: "Noto Nastaliq Urdu", var(--cms-font-body);
    font-size: 1em;
    line-height: 2.1;
    text-align: right;
}

.ai-speaker {
    position: relative;
    display: grid;
    width: 4.6em;
    height: 4.6em;
    place-items: center;
    border-radius: 50%;
    background: var(--cms-accent);
}

/* A loudspeaker, drawn in CSS: the box and the cone in one shape, then two arcs of sound. */
.ai-speaker b {
    position: relative;
    width: 1.5em;
    height: 1.7em;
    margin-inline-end: 0.6em;
    background: var(--cms-on-accent);
    clip-path: polygon(0 32%, 38% 32%, 100% 0, 100% 100%, 38% 68%, 0 68%);
}

.ai-speaker i {
    position: absolute;
    top: 50%;
    inset-inline-start: 58%;
    width: calc(var(--s) * 1em);
    height: calc(var(--s) * 1em);
    border: 0.2em solid var(--cms-on-accent);
    border-color: transparent var(--cms-on-accent) transparent transparent;
    border-radius: 50%;
    translate: -50% -50%;
}

[dir="rtl"] .ai-speaker b {
    transform: scaleX(-1);
}

[dir="rtl"] .ai-speaker i {
    border-color: transparent transparent transparent var(--cms-on-accent);
    translate: 50% -50%;
}

/* ---- Expenses and petty cash ---- */

.ex-box {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.ex-voucher {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75em;
    font-size: 1em;
}

.ex-amount {
    font-family: var(--cms-font-numeric);
    font-size: 1.1em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ex-stamp {
    display: inline-block;
    padding: 0.25em 0.7em;
    border: 0.18em solid var(--cms-healthy, #2e8b57);
    border-radius: 0.5em;
    color: var(--cms-healthy, #2e8b57);
    font-size: 1em;
    font-weight: 800;
    letter-spacing: 0.08em;
    transform: rotate(-8deg);
}

/* ---- Bank reconciliation ---- */

.rc-col .s3d-row {
    padding: 0.55em 0;
}

.rc-mark {
    display: inline-grid;
    width: 1.3em;
    height: 1.3em;
    place-items: center;
    border: 0.12em solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 0.35em;
}

.rc-mark .s3d-ok {
    width: 1.3em;
    height: 1.3em;
}

.rc-mark .s3d-ok::after {
    top: 0.25em;
    inset-inline-start: 0.44em;
    width: 0.3em;
    height: 0.55em;
}

.rc-link {
    position: absolute;
    height: 0.2em;
    border-radius: 1em;
    background: linear-gradient(90deg, transparent, var(--cms-accent), transparent);
    opacity: 0.85;
}

.rc-diff {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
}

/* ---- Budget against actual ---- */

.bg-chart {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: end;
    gap: 1.6em;
    height: 17em;
    padding: 0 0.6em;
    border-bottom: 0.15em solid color-mix(in srgb, var(--cms-ink) 25%, transparent);
    transform-style: preserve-3d;
}

.bg-col {
    position: relative;
    height: 100%;
    transform-style: preserve-3d;
}

/* A column with a real side and top face, so it reads as a solid block rather than a flat bar. */
.bg-bar {
    position: absolute;
    bottom: 0;
    inset-inline: 0.3em;
    height: calc(var(--v) * 1%);
    transform-style: preserve-3d;
}

.bg-bar > span {
    position: absolute;
    inset: 0;
    border-radius: 0.3em 0.3em 0 0;
    background: linear-gradient(180deg, var(--cms-accent-lift), var(--cms-accent));
}

.bg-bar > span::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: 100%;
    width: 1.4em;
    height: 100%;
    background: var(--cms-accent-deep);
    transform: skewY(-35deg);
    transform-origin: 0 0;
}

[dir="rtl"] .bg-bar > span::before {
    transform: skewY(35deg);
    transform-origin: 100% 0;
}

.bg-bar > span::after {
    content: "";
    position: absolute;
    bottom: 100%;
    inset-inline-start: 0;
    width: 100%;
    height: 1em;
    background: color-mix(in srgb, var(--cms-accent-lift) 70%, #ffffff);
    transform: skewX(-55deg);
    transform-origin: 0 100%;
}

[dir="rtl"] .bg-bar > span::after {
    transform: skewX(55deg);
    transform-origin: 100% 100%;
}

.bg-bar.is-over > span {
    background: linear-gradient(180deg, color-mix(in srgb, var(--cms-due, #c98a12) 70%, #ffffff), var(--cms-due, #c98a12));
}

.bg-bar.is-over > span::before {
    background: color-mix(in srgb, var(--cms-due, #c98a12) 65%, #000000);
}

.bg-bar.is-over > span::after {
    background: color-mix(in srgb, var(--cms-due, #c98a12) 45%, #ffffff);
}

.bg-target {
    position: absolute;
    bottom: calc(var(--t) * 1%);
    inset-inline: 0 -1.3em;
    height: 0;
    border-top: 0.22em dashed var(--cms-ink);
    opacity: 0.75;
}

.bg-label {
    position: absolute;
    top: 100%;
    inset-inline: -1em;
    padding-top: 0.5em;
    font-size: 0.95em;
    font-weight: 600;
    text-align: center;
}

.bg-flag {
    position: absolute;
    bottom: calc(var(--v) * 1% + 1.6em);
    inset-inline-start: 50%;
    translate: -50% 0;
    white-space: nowrap;
}

[dir="rtl"] .bg-flag {
    translate: 50% 0;
}

/* ---- Staff attendance ---- */

.sa-device {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    padding: 1.2em;
    border-radius: 1.4em;
}

.sa-screen {
    width: 100%;
    padding: 0.8em;
    border-radius: 0.7em;
    background: #0b1412;
    color: #8ff0c9;
    font-family: var(--cms-font-numeric);
    font-size: 1em;
    text-align: center;
}

.sa-screen b {
    display: block;
    font-size: 2em;
    letter-spacing: 0.05em;
}

.sa-pad {
    position: relative;
    width: 6.4em;
    height: 7.4em;
    overflow: hidden;
    border-radius: 45% 45% 40% 40%;
    background: repeating-radial-gradient(ellipse at 50% 60%, color-mix(in srgb, #8ff0c9 55%, transparent) 0 0.18em, transparent 0.18em 0.55em), #12302a;
}

.sa-scan {
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 0.4em;
    background: #8ff0c9;
    box-shadow: 0 0 1.2em 0.4em color-mix(in srgb, #8ff0c9 70%, transparent);
    opacity: 0;
}

.is-playing .sa-scan {
    animation: sa-scan 1.6s ease-in-out 0.3s infinite;
}

@keyframes sa-scan {
    0% { opacity: 0; transform: translateY(0); }
    10%, 85% { opacity: 1; }
    100% { opacity: 0; transform: translateY(7em); }
}

.sa-list .s3d-row {
    padding: 0.5em 0;
}

.sa-who {
    display: flex;
    align-items: center;
    gap: 0.6em;
}

.sa-ava {
    width: 1.9em;
    height: 1.9em;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cms-accent) 25%, var(--cms-surface));
}

/* ---- Payslip and settlement ---- */

.ps-sheet {
    font-size: 0.98em;
}

.ps-stack {
    position: absolute;
    inset: 0;
    border-radius: 1.2em;
    background: color-mix(in srgb, #ffffff 90%, var(--cms-accent-wash));
    box-shadow: 0 1em 2em -1.2em color-mix(in srgb, var(--cms-accent-deep) 50%, transparent);
}

.ps-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -1.1em -1.2em 0.9em;
    padding: 0.9em 1.2em;
    border-radius: 1.2em 1.2em 0 0;
    background: var(--cms-accent);
    color: var(--cms-on-accent);
}

.ps-pdf {
    display: grid;
    width: 4.2em;
    height: 5em;
    place-items: center;
    border-radius: 0.6em;
    background: var(--cms-critical, #b3261e);
    color: #ffffff;
    font-size: 1.05em;
    font-weight: 800;
    letter-spacing: 0.06em;
}

/* ---- Quizzes ---- */

.qz-option {
    display: flex;
    align-items: center;
    gap: 0.7em;
    margin-top: 0.6em;
    padding: 0.65em 0.8em;
    border: 0.12em solid color-mix(in srgb, var(--cms-ink) 14%, transparent);
    border-radius: 0.8em;
    font-size: 1.05em;
}

.qz-option b {
    display: inline-grid;
    width: 1.7em;
    height: 1.7em;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cms-accent) 12%, var(--cms-surface));
    font-size: 0.9em;
}

.qz-option {
    position: relative;
}

/* The chosen answer, drawn over its option so it lands exactly on it. */
.qz-pick {
    position: absolute;
    inset: -0.12em;
    margin: 0;
}

.qz-option.is-picked {
    border-color: var(--cms-healthy, #2e8b57);
    background: color-mix(in srgb, var(--cms-healthy, #2e8b57) 10%, var(--cms-surface));
}

.qz-option.is-picked b {
    background: var(--cms-healthy, #2e8b57);
    color: #ffffff;
}

.qz-timer {
    position: relative;
    display: grid;
    width: 3.4em;
    height: 3.4em;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--cms-accent) 0 72%, color-mix(in srgb, var(--cms-accent) 15%, transparent) 72% 100%);
    font-family: var(--cms-font-numeric);
    font-size: 0.95em;
    font-weight: 700;
}

.qz-timer::before {
    content: "";
    position: absolute;
    inset: 0.35em;
    border-radius: 50%;
    background: var(--cms-surface);
}

.qz-timer span {
    position: relative;
}

.qz-hand {
    margin-top: 1.1em;
    padding: 0.7em;
    border-radius: 0.8em;
    background: var(--cms-accent);
    color: var(--cms-on-accent);
    font-weight: 700;
    text-align: center;
}

.qz-score {
    display: flex;
    align-items: center;
    gap: 0.9em;
}

.qz-bars {
    display: grid;
    gap: 0.55em;
    margin-top: 0.4em;
}

.qz-bars div {
    display: grid;
    grid-template-columns: 2.6em 1fr 2.6em;
    align-items: center;
    gap: 0.5em;
    font-size: 0.95em;
}

.qz-bars .qz-track {
    display: block;
    height: 0.75em;
    border-radius: 1em;
    background: color-mix(in srgb, var(--cms-accent) 14%, transparent);
    overflow: hidden;
}

.qz-bars i {
    display: block;
    width: calc(var(--v) * 1%);
    height: 100%;
    border-radius: 1em;
    background: var(--cms-accent);
}

/* ---- Hostel ---- */

/* The floor plan lies flat and is seen from above at an angle — an isometric view in real 3D. */
.hs-plan {
    position: absolute;
    top: 7em;
    inset-inline-start: 3em;
    width: 26em;
    height: 22em;
    transform: rotateX(56deg) rotateZ(-38deg);
    transform-style: preserve-3d;
}

[dir="rtl"] .hs-plan {
    transform: rotateX(56deg) rotateZ(38deg);
}

.hs-floor {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.9em;
    padding: 0.9em;
    border-radius: 1em;
    background: color-mix(in srgb, var(--cms-accent-wash) 80%, var(--cms-surface));
    box-shadow:
        0.6em 0.6em 0 color-mix(in srgb, var(--cms-accent) 30%, var(--cms-surface)),
        1.6em 1.6em 2em color-mix(in srgb, var(--cms-accent-deep) 30%, transparent);
    transform-style: preserve-3d;
}

.hs-room {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5em;
    padding: 0.6em;
    border: 0.18em solid color-mix(in srgb, var(--cms-accent) 40%, var(--cms-surface));
    border-radius: 0.6em;
    background: var(--cms-surface);
    transform-style: preserve-3d;
}

.hs-room > small {
    position: absolute;
    top: -1.4em;
    inset-inline-start: 0.2em;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--cms-accent-deep);
}

.hs-bed {
    border-radius: 0.35em;
    background: color-mix(in srgb, var(--cms-ink) 10%, transparent);
    transform-style: preserve-3d;
}

/* An occupied bed stands up off the floor: a block with a pillow. */
.hs-bed.is-taken > i {
    display: block;
    height: 100%;
    border-radius: 0.35em;
    background: linear-gradient(180deg, #ffffff 0 22%, var(--cms-accent) 22% 100%);
    box-shadow: 0.25em 0.25em 0 var(--cms-accent-deep);
    transform: translateZ(0.8em);
}

.is-playing .hs-bed.is-taken > i {
    animation: hs-drop 0.6s cubic-bezier(0.3, 1.4, 0.5, 1) var(--d, 0s) both;
}

@keyframes hs-drop {
    from { opacity: 0; transform: translateZ(9em); }
    to { opacity: 1; transform: translateZ(0.8em); }
}

/* ---- Automatic payment matching ---- */

.am-ref {
    font-family: var(--cms-font-numeric);
    font-size: 0.92em;
    letter-spacing: 0.02em;
}

.am-challan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8em;
}

.am-state {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3em;
}

.am-state .s3d-swap {
    justify-items: end;
}

.am-notice {
    display: flex;
    align-items: center;
    gap: 0.8em;
}

/* Under 600px the stage is small enough that the sway reads as wobble; keep it still there. */
@media (max-width: 599.98px) {
    .is-playing .s3d-tilt {
        animation: none;
    }
}

/* ---------------------------------------------------------------------------
   Narrow screens and reduced motion
   --------------------------------------------------------------------------- */

@media (max-width: 599.98px) {
    /* A showcase phone the full width of a phone is a page of nothing but phone. Smaller, with the
       next one peeking in from the side so the row reads as something to swipe. */
    .cms-phone-card .cms-phone {
        max-width: 190px;
    }

    .mock-float {
        padding: 8px 10px;
        font-size: 11px;
    }

    .mock-float-b {
        top: 0;
    }

    .app-scene-chip {
        font-size: 10.5px;
    }
}

/* The floor under everything above: a visitor who asked for less movement gets the still frame,
   whatever the theme says and whether or not the script ran. */
@media (prefers-reduced-motion: reduce) {
    .is-playing,
    .is-playing * {
        animation: none !important;
    }
}
