/* The ontology scroll scene (section#onto-system). Without html.onto-scene-on (script off, reduced motion, or a window too short
   for the pinned drawing, see js/ontology-scroll.js) the section keeps its normal height, the drawing shows the open stack with
   every record and the step list reads as a plain list. */

/* Drawing colours, from the page's --og-* tokens (spec 3.1). */
.onto-scene-art :is(line, polyline, polygon, ellipse, circle) { vector-effect: non-scaling-stroke; stroke-width: 1; }
.onto-scene-art .os-stop-a { stop-color: var(--og-top-a); }
.onto-scene-art .os-stop-b { stop-color: var(--og-top-b); }
.onto-scene-art .os-left { fill: var(--og-left); }
.onto-scene-art .os-right { fill: var(--og-right); }
.onto-scene-art .os-edge { fill: none; stroke: var(--og-edge); stroke-opacity: .5; }
.onto-scene-art .os-lift-fill { fill: var(--og-top-a); fill-opacity: .9; }
.onto-scene-art .os-lift { fill: none; stroke: var(--og-link); }
.onto-scene-art .os-key-ring { fill: none; stroke: var(--og-link); }
.onto-scene-art .os-leader { fill: none; stroke: var(--og-edge); stroke-opacity: .65; }
.onto-scene-art .os-leader-dot { fill: var(--og-node-key); }
.onto-scene-art text { fill: var(--og-label); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.onto-scene-art .os-name-text { font-size: 13px; }
/* Hebrew has no glyphs in the mono stack; the page's own face keeps the words whole. */
.onto-scene-art .os-name-text[direction="rtl"] { font-family: inherit; letter-spacing: 0; font-size: 15px; }
/* Codes are capitals already; "kg" must stay lower case. */
.onto-scene-art .os-code { font-size: 12px; fill-opacity: .8; text-transform: none; direction: ltr; unicode-bidi: isolate; paint-order: stroke fill; stroke: var(--og-top-a); stroke-width: 4; stroke-linejoin: round; }
.onto-scene-art .os-ltr { direction: ltr; unicode-bidi: isolate; }
.onto-scene-art .os-link { fill: none; stroke: var(--og-line); stroke-opacity: .72; }
.onto-scene-art .os-scan-seg { fill: none; stroke: var(--og-link); stroke-width: 2; stroke-linecap: square; }
.onto-scene-art .os-pad { fill: var(--og-node); }
.onto-scene-art .os-pad-flag { fill: var(--og-flag); }
.onto-scene-art .os-pad-review { fill: var(--og-top-a); stroke: var(--og-node-key); stroke-dasharray: 3 2; }
.onto-scene-art .os-pulse { fill: none; stroke: var(--og-flag); }
.onto-scene-art .os-key { fill: var(--og-node-key); }
.onto-scene-art .os-glow { fill: var(--og-glow); }

/* The figure at rest, as the page draws it without script. */
.onto-page .onto-scene { width: min(86.087%, 1188px); margin-block-start: auto; }
.onto-scene-art { display: block; width: 100%; height: auto; }
.onto-scene-cap { display: none; }
.onto-scene-steps, .onto-scene-end {
  box-sizing: border-box;
  max-width: 1380px;
  margin: 0 auto;
  padding-inline: 5%;
  color: var(--ref-text);
  font-size: 15px;
  line-height: 22px;
}
.onto-scene-steps { display: grid; gap: 8px; padding-block: 24px 8px; list-style: none; }
.onto-scene-end { padding-block: 8px 24px; }
.onto-scene-no, .onto-scene-cap .onto-scene-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--og-link);
  margin-inline-end: 8px;
}
.onto-scene-name { font-weight: 500; }
.onto-scene-name::after { content: " ·"; }
.onto-scene-fact { color: var(--ref-muted); }
.onto-scene-code { unicode-bidi: isolate; direction: ltr; }
@media (max-width: 880px) {
  .onto-page .onto-scene { width: 84.3%; }
}
@media (max-width: 800px) {
  .onto-scene-art :is(.os-names, .os-code) { display: none; }
  .onto-scene-steps, .onto-scene-end { padding-inline: 0; }
}

/* The scene: the section is the scroll track, the panel holds still and the drawing moves with the scroll. */
@media screen {
  html.onto-scene-on .onto-scene-sec { height: 400vh; box-sizing: border-box; }
  html.onto-scene-on .onto-scene-sec .onto-panel {
    position: sticky;
    inset-block-start: var(--rp-pin, 129px);
    box-sizing: border-box;
    height: calc(100svh - var(--rp-pin, 129px) - 30px);
    min-height: 0;
    padding-block-start: 40px;
    overflow: hidden;
  }
  html.onto-scene-on .onto-scene-sec .onto-scene {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    margin: 0;
    padding-block: 12px 20px;
    box-sizing: border-box;
  }
  html.onto-scene-on .onto-scene-sec .onto-scene-art { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; }
  html.onto-scene-on .onto-scene-cap {
    position: absolute;
    inset-block-end: 30px;
    inset-inline-start: 30px;
    display: grid;
    width: min(330px, calc(100% - 60px));
    margin: 0;
    color: var(--ref-text);
    font-size: 15px;
    line-height: 22px;
    text-align: start;
    pointer-events: none;
  }
  html.onto-scene-on .onto-scene-slot {
    grid-area: 1 / 1;
    align-self: end;
    opacity: 0;
    transition: opacity .2s linear;
  }
  html.onto-scene-on .onto-scene-slot[data-on] { opacity: 1; }
  html.onto-scene-on .onto-scene-slot .onto-scene-no { display: block; margin-block-end: 6px; font-size: 13px; }
  html.onto-scene-on .onto-scene-slot .onto-scene-name { display: block; font-size: 17px; line-height: 24px; }
  html.onto-scene-on .onto-scene-slot .onto-scene-name::after { content: none; }
  html.onto-scene-on :is(.onto-scene-steps, .onto-scene-end) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media screen and (max-width: 880px) {
  html.onto-scene-on .onto-scene-sec { height: 320vh; }
  /* The site's phone bar (Contact, language, menu) is fixed at the bottom: the panel ends above it. */
  html.onto-scene-on .onto-scene-sec .onto-panel {
    height: calc(100svh - var(--rp-pin, 118px) - var(--ref-bar-space, 30px));
    padding-block-start: 24px;
  }
}
/* Up to 1100 px the drawing fills the panel's width, so its lowest plate reaches the bottom start corner: the caption moves
   under the drawing instead. */
@media screen and (max-width: 1100px) {
  html.onto-scene-on .onto-scene-sec .onto-scene { flex-direction: column; padding-block: 8px 16px; }
  html.onto-scene-on .onto-scene-cap {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    max-width: 560px;
    min-height: 92px;
    padding-inline: 30px;
    box-sizing: border-box;
  }
  html.onto-scene-on .onto-scene-slot { align-self: start; }
}
@media screen and (max-width: 540px) {
  html.onto-scene-on .onto-scene-cap { min-height: 88px; padding-inline: 20px; font-size: 14px; line-height: 20px; }
  html.onto-scene-on .onto-scene-slot .onto-scene-name { font-size: 16px; line-height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html.onto-scene-on .onto-scene-slot { transition: none; }
}

@media (forced-colors: active) {
  .onto-page figure svg.onto-scene-art { forced-color-adjust: none; }
  .onto-scene-art :is(.os-stop-a, .os-stop-b) { stop-color: Canvas; }
  .onto-scene-art :is(.os-left, .os-right, .os-lift-fill) { fill: Canvas; fill-opacity: 1; }
  /* The lifted outline is drawn above the whole stack: an outline only, so the plates above the lifted one stay on top. */
  .onto-scene-art .os-lift { fill: none; }
  .onto-scene-art :is(.os-edge, .os-leader, .os-link) { stroke: CanvasText; stroke-opacity: 1; }
  .onto-scene-art :is(.os-lift, .os-scan-seg, .os-pulse, .os-key-ring) { stroke: Highlight; }
  .onto-scene-art :is(.os-pad, .os-leader-dot) { fill: CanvasText; }
  .onto-scene-art :is(.os-pad-flag, .os-key) { fill: Highlight; }
  .onto-scene-art .os-pad-review { fill: Canvas; stroke: CanvasText; }
  .onto-scene-art .os-glow { display: none; }
  .onto-scene-art text { fill: CanvasText; fill-opacity: 1; }
  .onto-scene-art .os-code { stroke: Canvas; }
}

@media print {
  .onto-page :is(.onto-scene-art, .onto-scene-steps) {
    --og-top-a:#f2f1fd; --og-top-b:#dfdaf6; --og-left:#e8e5f9; --og-right:#cec8f0; --og-edge:#1e2124; --og-line:#1e2124;
    --og-node:#3c3552; --og-node-key:#1e2124; --og-label:#1e2124; --og-link:#6e4eef; --og-glow:#b9aafa;
  }
}
