.ontology-scene {
    --scene-ink: #172f37;
    position: relative;
    isolation: isolate;
    color: var(--scene-ink);
}

.ontology-scene__toolbar {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 10px;
}

.ontology-scene__toolbar p {
    max-width: 62ch;
    margin: 0;
    color: #425860;
    font-size: 13px;
    font-weight: 760;
}

.ontology-scene__control {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid #cfdadd;
    border-radius: 999px;
    color: #304951;
    background: rgba(255, 255, 255, .82);
    font-size: 12px;
    font-weight: 780;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.ontology-scene__control[hidden] { display: none; }
.ontology-scene__control:hover { color: #162f37; background: #fff; transform: translateY(-1px); }
.ontology-scene__control:focus-visible { outline: 3px solid rgba(80, 111, 150, .36); outline-offset: 4px; }
.ontology-scene__control svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.ontology-scene__control-play { display: none; fill: currentColor !important; stroke: none !important; }
.ontology-scene[data-scene-state="paused"] .ontology-scene__control-pause { display: none; }
.ontology-scene[data-scene-state="paused"] .ontology-scene__control-play { display: block; }

.ontology-cinematic {
    --scene-tilt-x: 0deg;
    --scene-tilt-y: 0deg;
    position: relative;
    width: 100%;
    aspect-ratio: 1672 / 941;
    overflow: hidden;
    isolation: isolate;
    transform: perspective(1800px) rotateX(var(--scene-tilt-x)) rotateY(var(--scene-tilt-y));
    transform-style: preserve-3d;
    transition: transform 650ms cubic-bezier(.2, .7, .2, 1);
    will-change: transform;
}

.ontology-scene .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.ontology-cinematic__expand {
    position: absolute;
    inset: 0;
    display: block;
    color: inherit;
    cursor: zoom-in;
}

.ontology-cinematic__expand:focus-visible {
    outline: 3px solid rgba(16, 153, 191, .72);
    outline-offset: 4px;
}

.ontology-cinematic__art,
.ontology-cinematic__motion {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.ontology-cinematic__art {
    z-index: 0;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.ontology-cinematic__motion {
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.ontology-cinematic__orbit {
    fill: none;
    stroke: rgba(0, 173, 210, .82);
    stroke-width: 2.4;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 40 9 5 9;
    opacity: .72;
    filter: drop-shadow(0 0 5px rgba(0, 174, 211, .52));
}

.ontology-cinematic__orbit--inner {
    stroke: rgba(0, 157, 189, .7);
    stroke-width: 1.8;
    stroke-dasharray: 3 11;
    opacity: .66;
}

.ontology-scene[data-scene-state="active"] .ontology-cinematic__orbit--outer { animation: ontology-art-dash 8s linear infinite; }
.ontology-scene[data-scene-state="active"] .ontology-cinematic__orbit--inner { animation: ontology-art-dash-reverse 6s linear infinite; }

.ontology-cinematic__flow-track {
    fill: none;
    stroke: rgba(0, 181, 211, .32);
    stroke-width: 2;
    stroke-dasharray: 5 12;
    vector-effect: non-scaling-stroke;
}
.ontology-scene[data-scene-state="active"] .ontology-cinematic__flow-track { animation: ontology-art-dash 4s linear infinite; }
.ontology-cinematic__flow-packet { fill: #00b8d3; filter: drop-shadow(0 0 5px rgba(0, 157, 220, .9)); }
.ontology-cinematic__flow-packet--second { fill: #ffffff; }
.ontology-cinematic__core-field {
    position: absolute; z-index: 2; left: 50%; top: 41.5%; width: 38%; height: 25%;
    border: 2px solid rgba(0, 180, 211, .75); border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 166, 204, .32), inset 0 0 15px rgba(0, 166, 204, .14);
    opacity: .55; transform: translate(-50%, -50%) rotateX(66deg); transform-style: preserve-3d; pointer-events: none;
}
.ontology-cinematic__core-field::before {
    position: absolute; inset: 12% -2%; border: 1px dashed rgba(0, 173, 210, .8);
    border-radius: 50%; content: ""; transform: rotateY(58deg);
}
.ontology-scene[data-scene-state="active"] .ontology-cinematic__core-field {
    animation: ontology-core-spin 7s linear infinite, ontology-core-breathe 2.8s ease-in-out infinite alternate;
}
.ontology-cinematic__detail-track {
    fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 5 9; opacity: .38; vector-effect: non-scaling-stroke;
}
.ontology-scene[data-scene-state="active"] .ontology-cinematic__detail-track {
    opacity: .88; animation: ontology-art-dash 2.4s linear infinite;
}
.ontology-cinematic__detail-track--access { stroke: #159cc5; }
.ontology-cinematic__detail-track--allow { stroke: #10a36f; }
.ontology-cinematic__detail-track--restricted,
.ontology-cinematic__detail-track--deny { stroke: #dc4960; }
.ontology-cinematic__detail-track--pipeline { stroke: #00a9c4; stroke-width: 3.2; opacity: .5; }
.ontology-cinematic__detail-packet { opacity: 0; pointer-events: none; }
.ontology-scene[data-scene-state="active"] .ontology-cinematic__detail-packet {
    opacity: 1; filter: drop-shadow(0 0 5px currentColor);
}
.ontology-cinematic__detail-packet--access { fill: #118ec0; color: #118ec0; }
.ontology-cinematic__detail-packet--allow { fill: #12a873; color: #12a873; }
.ontology-cinematic__detail-packet--restricted,
.ontology-cinematic__detail-packet--deny { fill: #e43f59; color: #e43f59; }
.ontology-cinematic__detail-packet--pipeline { fill: #00b4cd; color: #00b4cd; }
.ontology-cinematic__pulse {
    position: absolute;
    z-index: 2;
    left: var(--pulse-x);
    top: var(--pulse-y);
    width: clamp(12px, 1.05vw, 18px);
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, .98);
    border-radius: 50%;
    background: #00b9ce;
    box-shadow: 0 0 0 0 rgba(0, 180, 207, .38), 0 0 14px rgba(0, 177, 215, .62);
    opacity: 0;
    transform: translate(-50%, -50%) scale(.7);
    pointer-events: none;
}

.ontology-cinematic__pulse--client { --pulse-x: 50%; --pulse-y: 35.8%; }
.ontology-cinematic__pulse--mission { --pulse-x: 44.5%; --pulse-y: 38.8%; }
.ontology-cinematic__pulse--drone { --pulse-x: 55.4%; --pulse-y: 38.9%; }
.ontology-cinematic__pulse--quote { --pulse-x: 45.6%; --pulse-y: 47.2%; }
.ontology-cinematic__pulse--invoice { --pulse-x: 54.6%; --pulse-y: 47.2%; }

.ontology-scene[data-scene-state="active"] .ontology-cinematic__pulse { animation: ontology-art-pulse 2.6s ease-out infinite; }
.ontology-scene[data-scene-state="active"] .ontology-cinematic__pulse--mission { animation-delay: .65s; }
.ontology-scene[data-scene-state="active"] .ontology-cinematic__pulse--drone { animation-delay: 1.3s; }
.ontology-scene[data-scene-state="active"] .ontology-cinematic__pulse--quote { animation-delay: 1.95s; }
.ontology-scene[data-scene-state="active"] .ontology-cinematic__pulse--invoice { animation-delay: 2.6s; }

.ontology-cinematic__zoom-hint { display: none; }

@keyframes ontology-art-dash { to { stroke-dashoffset: -120; } }
@keyframes ontology-art-dash-reverse { to { stroke-dashoffset: 110; } }
@keyframes ontology-core-spin {
    from { transform: translate(-50%, -50%) rotateX(66deg) rotateZ(0deg); }
    to { transform: translate(-50%, -50%) rotateX(66deg) rotateZ(360deg); }
}
@keyframes ontology-core-breathe {
    from { opacity: .3; box-shadow: 0 0 9px rgba(0, 166, 204, .2), inset 0 0 8px rgba(0, 166, 204, .1); }
    to { opacity: .82; box-shadow: 0 0 24px rgba(0, 166, 204, .52), inset 0 0 22px rgba(0, 166, 204, .24); }
}
@keyframes ontology-art-pulse {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.65); box-shadow: 0 0 0 0 rgba(0, 180, 207, .38), 0 0 14px rgba(0, 177, 215, .62); }
    18% { opacity: .95; }
    70% { opacity: .72; transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 0 0 13px rgba(0, 180, 207, 0), 0 0 17px rgba(0, 177, 215, .34); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(.76); box-shadow: 0 0 0 17px rgba(0, 180, 207, 0), 0 0 9px rgba(0, 177, 215, .08); }
}

@media (max-width: 820px) {
    .ontology-scene__toolbar { align-items: flex-start; }
    .ontology-scene__toolbar p { max-width: 42ch; }
    .ontology-scene__control span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .ontology-scene__control { width: 40px; padding: 0; border-radius: 50%; }
    .ontology-cinematic__zoom-hint {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 7px;
        width: fit-content;
        min-height: 38px;
        margin: 8px auto 0;
        padding: 0 13px;
        border: 1px solid rgba(70, 104, 124, .2);
        border-radius: 999px;
        color: #31526b;
        font-size: 12px;
        font-weight: 700;
        text-decoration: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ontology-cinematic { transform: none !important; transition: none !important; will-change: auto; }
    .ontology-scene:not([data-user-playing="true"]) .ontology-cinematic__orbit,
    .ontology-scene:not([data-user-playing="true"]) .ontology-cinematic__flow-track,
    .ontology-scene:not([data-user-playing="true"]) .ontology-cinematic__detail-track,
    .ontology-scene:not([data-user-playing="true"]) .ontology-cinematic__core-field,
    .ontology-scene:not([data-user-playing="true"]) .ontology-cinematic__pulse { animation: none !important; }
    .ontology-scene:not([data-user-playing="true"]) .ontology-cinematic__orbit { opacity: .2; }
}

/* Extra contrast for the three user-highlighted animated routes. */
.ontology-cinematic__detail-packet--targeted {
    stroke: #f7fffe;
    stroke-width: 2.25px;
    filter: drop-shadow(0 0 8px currentColor);
}

/* Directional scrolling dashes on the three highlighted paths. */
.ontology-cinematic__detail-track--scrolling {
    stroke-dasharray: 8 8;
    stroke-width: 3.2;
    stroke-linecap: round;
}
.ontology-scene[data-scene-state="active"] .ontology-cinematic__detail-track--scrolling {
    opacity: .96;
    animation: alti360-path-scroll 1.4s linear infinite;
}
@keyframes alti360-path-scroll {
    to { stroke-dashoffset: -32; }
}
