/* Nandi "moments": small built-in mocks of real app moments (index.html, personal.html).
   No images: HTML, inline SVG and CSS only. Loaded after css/nest.css.

   How a moment reads:
   - Without animation (prefers-reduced-motion, or "Show every step"), every frame shows
     as a numbered storyboard, one under the other.
   - With animation, the frames stack in one place and cross-fade in turn.
   Colours follow the brand kit: amber means "waiting on a person" only, green means
   agent work. */

:root {
    --mo-bg: rgba(10, 8, 20, 0.88);
    --mo-panel: rgba(30, 17, 44, 0.75);
    --mo-line: #312A36;
    --mo-text: var(--white-color);
    --mo-muted: var(--para-color);
    --mo-accent: #c79bff;
    --mo-gate: #EF9F27;        /* At the gate: pending approval only */
    --mo-work: #2E8A70;        /* Agent work: fills */
    --mo-work-text: #5FD3AE;   /* Agent work: text on the dark panel */
    --mo-stop: #FF8A8A;        /* Refused or broken */
    --mo-mono: "Cascadia Code", Consolas, ui-monospace, monospace;
}

/* A grid of moments */
.mo_grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.4rem;
}
.mo_card {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    padding: 2.4rem;
    border-radius: 20px;
    border: 1px solid rgba(160, 68, 255, 0.18);
    background: rgba(255, 255, 255, 0.03);
    min-width: 0;
}
.mo_card h3 {
    color: var(--white-color);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}
.mo_card > p {
    color: var(--para-color);
    font-size: 1.5rem;
    line-height: 1.7;
    margin: 0;
}
.mo_card > p b {
    color: var(--white-color);
}
.mo_more {
    margin-top: auto !important;
    font-size: 1.4rem !important;
}

/* The pause control: shown by js/nandi-moments.js */
.mo_controls {
    display: flex;
    justify-content: center;
    margin: 0 0 2.4rem;
}
.mo_toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.6rem;
    border-radius: 999px;
    border: 1px solid rgba(160, 68, 255, 0.5);
    background: transparent;
    color: var(--mo-accent);
    font-size: 1.4rem;
    cursor: pointer;
}
.mo_toggle:hover {
    background: rgba(160, 68, 255, 0.12);
}
.mo_toggle:focus-visible {
    outline: 2px solid var(--purple-color);
    outline-offset: 3px;
}

/* The mock screen */
.mo {
    margin: 0;
    border-radius: 16px;
    border: 1px solid var(--mo-line);
    background: var(--mo-bg);
    overflow: hidden;
    color: var(--mo-text);
    font-size: 1.4rem;
    line-height: 1.5;
}
.mo_bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.4rem;
    border-bottom: 1px solid var(--mo-line);
    color: var(--mo-muted);
    font-size: 1.3rem;
}
.mo_bar img {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 4px;
}
.mo_body {
    padding: 1.4rem;
}
.mo figcaption,
.mo_caption {
    padding: 0 1.4rem 1.2rem;
    color: var(--mo-muted);
    font-size: 1.3rem;
}

/* Frames: a storyboard by default */
.mo_frames {
    display: grid;
    gap: 1.2rem;
}
.mo_frame {
    min-width: 0;
}
.mo_step {
    display: block;
    margin: 0 0 0.6rem;
    color: var(--mo-accent);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Rows, chips and buttons inside a mock */
.mo_row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--mo-line);
    background: var(--mo-panel);
}
.mo_row + .mo_row {
    margin-top: 0.8rem;
}
.mo_row > div {
    min-width: 0;
    flex: 1;
}
.mo_row strong {
    display: block;
    color: var(--mo-text);
    font-weight: 600;
}
.mo_row small,
.mo_sub {
    display: block;
    color: var(--mo-muted);
    font-size: 1.3rem;
}
.mo_code {
    font-family: var(--mo-mono);
    font-size: 1.25rem;
    overflow-wrap: anywhere;
}
.mo_dot {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin-top: 0.55rem;
    border-radius: 50%;
    background: var(--mo-muted);
}
.mo_dot.is-gate { background: var(--mo-gate); }
.mo_dot.is-work { background: var(--mo-work); }
.mo_dot.is-stop { background: var(--mo-stop); }

.mo_chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--mo-line);
    color: var(--mo-muted);
    font-size: 1.2rem;
    white-space: nowrap;
}
.mo_chip.is-gate { color: var(--mo-gate); border-color: rgba(239, 159, 39, 0.5); }
.mo_chip.is-work { color: var(--mo-work-text); border-color: rgba(46, 138, 112, 0.7); }
.mo_chip.is-stop { color: var(--mo-stop); border-color: rgba(255, 138, 138, 0.5); }
.mo_chip.is-accent { color: var(--mo-accent); border-color: rgba(160, 68, 255, 0.5); }

.mo_btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}
.mo_btn {
    display: inline-block;
    padding: 0.35rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--mo-line);
    color: var(--mo-text);
    font-size: 1.3rem;
}
.mo_btn.is-primary {
    border-color: transparent;
    background: linear-gradient(90deg, #6A3093 0%, #A044FF 100%);
}
.mo_status {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
    font-size: 1.3rem;
}
.mo_status.is-gate { color: var(--mo-gate); }
.mo_status.is-work { color: var(--mo-work-text); }
.mo_status.is-stop { color: var(--mo-stop); }

.mo_meter {
    height: 0.6rem;
    margin-top: 0.8rem;
    border-radius: 999px;
    background: var(--mo-line);
    overflow: hidden;
}
.mo_meter span {
    display: block;
    height: 100%;
    width: var(--mo-fill, 60%);
    border-radius: inherit;
    background: var(--mo-work);
}

/* Lists inside a mock (consent items, what works alone) */
.mo_list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}
.mo_list li {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    color: var(--mo-text);
    font-size: 1.35rem;
}
.mo_list li i {
    width: 1.4rem;
    flex: none;
    text-align: center;
}
.mo_list .is-off {
    color: var(--mo-muted);
}
.mo_list .is-new {
    color: var(--mo-gate);
}
.mo_label {
    margin: 1rem 0 0.4rem;
    color: var(--mo-muted);
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Audit lines */
.mo_log {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: var(--mo-mono);
    font-size: 1.2rem;
    line-height: 1.6;
}
.mo_log li {
    display: grid;
    grid-template-columns: 2.2rem minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
}
.mo_log li + li {
    margin-top: 0.3rem;
}
.mo_log li > span:first-child {
    color: var(--mo-muted);
}
.mo_log li > span:last-child {
    overflow-wrap: anywhere;
}
.mo_log em {
    font-style: normal;
    color: var(--mo-accent);
}
.mo_log .is-edited {
    background: rgba(255, 138, 138, 0.1);
    outline: 1px dashed rgba(255, 138, 138, 0.6);
}
.mo_log .is-edited em,
.mo_log .is-broken em {
    color: var(--mo-stop);
}

/* Inline SVG flows */
.mo_svg {
    display: block;
    width: 100%;
    max-width: 38rem;
    height: auto;
    margin: 0 auto;
}
.mo_svg text {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    fill: var(--mo-text);
    font-size: 12px;
}
.mo_svg .t-muted { fill: var(--mo-muted); font-size: 11px; }
.mo_svg .t-small { font-size: 10.5px; }
.mo_svg .t-ok { fill: var(--mo-work-text); }
.mo_svg .t-stop { fill: var(--mo-stop); }
.mo_svg .t-accent { fill: var(--mo-accent); }
.mo_svg .box { fill: var(--mo-panel); stroke: var(--mo-line); stroke-width: 1.5; }
.mo_svg .box-host { fill: rgba(160, 68, 255, 0.06); stroke: rgba(160, 68, 255, 0.45); stroke-width: 1.5; stroke-dasharray: 5 4; }
.mo_svg .box-sandbox { fill: rgba(46, 138, 112, 0.12); stroke: var(--mo-work); stroke-width: 1.5; }
.mo_svg .line { fill: none; stroke: var(--mo-muted); stroke-width: 1.5; }
.mo_svg .line-ok { fill: none; stroke: var(--mo-work-text); stroke-width: 2; }
.mo_svg .line-stop { fill: none; stroke: var(--mo-stop); stroke-width: 2; stroke-dasharray: 4 4; }
.mo_svg .packet { fill: var(--mo-work-text); }
.mo_svg .packet-stop { fill: var(--mo-stop); }
.mo_svg .packet,
.mo_svg .packet-stop {
    transform-box: view-box;
}

/* A day in the life (personal.html) */
.mo_day {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 2.4rem;
    position: relative;
}
.mo_day > li {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.4rem;
    align-items: start;
}
.mo_time {
    color: var(--mo-accent);
    font-family: var(--mo-mono);
    font-size: 1.8rem;
    font-weight: 700;
    padding-top: 0.2rem;
}
.mo_day h3 {
    color: var(--white-color);
    font-size: 2.2rem;
    font-weight: 600;
    margin: 0 0 0.8rem;
}
.mo_day p {
    color: var(--para-color);
    font-size: 1.6rem;
    line-height: 1.7;
    margin: 0;
}

/* Animation: only when the visitor allows motion and hasn't asked to see every step */
@media (prefers-reduced-motion: no-preference) {
    .mo_scope:not([data-steps="all"]) .mo_frames {
        gap: 0;
    }
    .mo_scope:not([data-steps="all"]) .mo_frames > .mo_frame {
        grid-area: 1 / 1;
        animation-duration: var(--mo-dur, 10s);
        animation-iteration-count: infinite;
        animation-timing-function: ease-in-out;
        animation-fill-mode: both;
    }
    .mo_scope:not([data-steps="all"]) .mo_frames--2 > .mo_frame { animation-name: mo-show-2; }
    .mo_scope:not([data-steps="all"]) .mo_frames--3 > .mo_frame { animation-name: mo-show-3; }
    .mo_scope:not([data-steps="all"]) .mo_frames--4 > .mo_frame { animation-name: mo-show-4; }
    .mo_scope:not([data-steps="all"]) .mo_frames--2 > .mo_frame:nth-child(2) { animation-delay: calc(var(--mo-dur, 10s) * -1 / 2); }
    .mo_scope:not([data-steps="all"]) .mo_frames--3 > .mo_frame:nth-child(2) { animation-delay: calc(var(--mo-dur, 10s) * -2 / 3); }
    .mo_scope:not([data-steps="all"]) .mo_frames--3 > .mo_frame:nth-child(3) { animation-delay: calc(var(--mo-dur, 10s) * -1 / 3); }
    .mo_scope:not([data-steps="all"]) .mo_frames--4 > .mo_frame:nth-child(2) { animation-delay: calc(var(--mo-dur, 10s) * -3 / 4); }
    .mo_scope:not([data-steps="all"]) .mo_frames--4 > .mo_frame:nth-child(3) { animation-delay: calc(var(--mo-dur, 10s) * -2 / 4); }
    .mo_scope:not([data-steps="all"]) .mo_frames--4 > .mo_frame:nth-child(4) { animation-delay: calc(var(--mo-dur, 10s) * -1 / 4); }

    /* Packets in the SVG flows travel; at rest they sit at their end point */
    .mo_scope:not([data-steps="all"]) .mo_svg .packet,
    .mo_scope:not([data-steps="all"]) .mo_svg .packet-stop {
        animation: var(--mo-path) var(--mo-dur, 6s) ease-in-out infinite both;
    }

    /* A slow pulse on the "waiting on a person" dot */
    .mo_scope:not([data-steps="all"]) .mo_dot.is-gate {
        animation: mo-pulse 2.4s ease-in-out infinite;
    }
    .mo_scope:not([data-steps="all"]) .mo_meter span {
        animation: mo-fill var(--mo-dur, 6s) ease-in-out infinite both;
    }
}

@keyframes mo-show-2 {
    0% { opacity: 0; }
    5%, 45% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
@keyframes mo-show-3 {
    0% { opacity: 0; }
    3%, 30% { opacity: 1; }
    33.4%, 100% { opacity: 0; }
}
@keyframes mo-show-4 {
    0% { opacity: 0; }
    2.5%, 22.5% { opacity: 1; }
    25%, 100% { opacity: 0; }
}
@keyframes mo-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 159, 39, 0.55); }
    50% { box-shadow: 0 0 0 0.6rem rgba(239, 159, 39, 0); }
}
@keyframes mo-fill {
    0% { width: 0; }
    70%, 100% { width: var(--mo-fill, 60%); }
}

@media (max-width: 996px) {
    .mo_grid {
        grid-template-columns: 1fr;
    }
    .mo_day > li {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.2rem;
    }
}
@media (max-width: 480px) {
    .mo_card {
        padding: 1.6rem;
    }
    .mo_body {
        padding: 1.1rem;
    }
}

/* Packet paths for the sandbox flow (index.html). Each circle sits at its end point;
   the keyframes move it there from the agent's container, through the proxy. */
@keyframes mo-path-ok {
    0% { transform: translate(0, -122px); opacity: 0; }
    6% { opacity: 1; }
    30%, 45% { transform: translate(0, -72px); }
    75%, 100% { transform: translate(0, 0); opacity: 1; }
}
@keyframes mo-path-stop {
    0%, 20% { transform: translate(-148px, -84px); opacity: 0; }
    26% { opacity: 1; }
    45% { transform: translate(-148px, -34px); }
    65% { transform: translate(0, -34px); }
    80%, 100% { transform: translate(0, 0); opacity: 1; }
}
