/* Suite3D site.
 *
 * Palette lifted from the 3D viewer's own UI so the embedded canvas is continuous with
 * the page instead of a black rectangle on paper:
 *     ground #111, text #ddd, panel #2a2f3a, hairline #3a4150, accent #6cf.
 * Square corners throughout: no border-radius anywhere in this file.
 */

:root {
  --ground: #111318;
  --panel:  #191c23;
  --raise:  #2a2f3a;
  --line:   #3a4150;
  --text:   #ddd;
  --dim:    #8a90a0;
  --faint:  #666c7a;
  --accent: #6cf;
}

* { box-sizing: border-box; }

body {
  background: var(--ground);
  color: var(--text);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  margin: 0;
  padding: 0 1em 4em;
}

.page { max-width: 820px; margin: 0 auto; padding: 2.2em 0 0; }
.page.wide { max-width: 1060px; }

h1, h2, h3 { color: #fff; font-weight: bold; letter-spacing: -0.4px; }
h1 { font-size: 27px; line-height: 1.25; margin: 0 0 .1em; }
h2 { font-size: 18px; margin: 2.2em 0 .5em; }
h3 { font-size: 15px; margin: 1.6em 0 .3em; }
p, li, td, th { color: var(--text); }

a, a:visited, a:active { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
img { max-width: 100%; height: auto; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--panel); color: #cfd4e0; padding: .05em .3em; border: 1px solid var(--line); }
pre { background: var(--panel); border: 1px solid var(--line); padding: .85em 1em;
      overflow-x: auto; line-height: 1.5; color: #cfd4e0; }
/* a highlighted block: the <div class=highlight> carries the box, the <pre> is bare */
div.highlight { border: 1px solid var(--line); padding: .85em 1em; overflow-x: auto; margin: 1em 0; }
pre code { background: none; border: 0; padding: 0; }

table { border-collapse: collapse; font-size: 14px; margin: 1em 0; }
td, th { border: 1px solid var(--line); padding: 5px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel); color: #fff; font-weight: bold; }
.scrollx { overflow-x: auto; }

/* ---------- masthead ---------- */
.masthead { padding-bottom: 1.1em; border-bottom: 1px solid var(--line); margin-bottom: 1.6em; }
.masthead .title { font-size: 26px; font-weight: bold; letter-spacing: -0.4px; }
.masthead .title a { color: #fff; }
.masthead .sub { color: var(--dim); font-size: 13.5px; margin-top: .15em; }
.sitenav { margin-top: .8em; font-size: 14px; }
.sitenav a { margin-right: 1.2em; }
.sitenav a[aria-current] { color: var(--text); font-weight: bold; }

footer { max-width: 820px; margin: 2.5em auto 0; padding-top: 1em;
         border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); }
footer a { color: var(--faint); text-decoration: underline; }

/* ---------- placeholder ---------- */
.todo { border-left: 2px solid var(--faint); background: var(--panel);
        padding: .55em .9em; margin: 1em 0; font-size: 14px; color: var(--dim); }

/* ---------- demo index ---------- */
.demolist { margin: 1em 0 0; padding: 0; list-style: none; }
.demolist > li { border-top: 1px solid var(--line); padding: .9em 0; }
.demolist .name { font-weight: bold; font-size: 15.5px; color: #fff; }
.demolist .meta { color: var(--dim); font-size: 13px; margin: .1em 0 .4em;
                  font-variant-numeric: tabular-nums; }
.demolist .links a { margin-right: 1em; font-size: 14px; }

/* The processing-steps preview: the three panels of the page it links to, at t=0 on the
   middle plane. No extra assets -- these are the page's own frames. */
.demolist > li.haspreview { display: grid; grid-template-columns: 300px 1fr; gap: 1.2em; }
@media (max-width: 620px) { .demolist > li.haspreview { grid-template-columns: 1fr; } }
.demolist .preview { display: block; border: 1px solid var(--line); background: #000; }
.demolist .preview:hover { border-color: var(--accent); }
.demolist .preview .strip { display: grid; grid-template-columns: repeat(3, 1fr);
                            gap: 1px; line-height: 0; }
.demolist .preview img { display: block; width: 100%; aspect-ratio: 1;
                         object-fit: cover; image-rendering: pixelated; }
/* Own line-height: the strip sets 0, and an inherited 0 clips this to a sliver. */
.demolist .preview .cue { display: block; padding: .45em .5em .5em; text-align: center;
                          color: var(--dim); font-size: 12px; line-height: 1.4; }
.demolist .preview:hover .cue { color: #fff; }
.demolist .preview:hover img { opacity: .85; }

/* ---------- per-page nav ---------- */
.subnav { font-size: 14px; margin: .5em 0 1.6em; padding-bottom: .55em;
          border-bottom: 1px solid var(--line); }
.subnav a { margin-right: 1.2em; }
.subnav a[aria-current] { color: var(--text); font-weight: bold; }
.demohdr .meta { color: var(--dim); font-size: 13.5px; margin: .1em 0 0;
                 font-variant-numeric: tabular-nums; }

/* ---------- notices ---------- */
.note { border-left: 2px solid var(--accent); background: var(--panel);
        padding: .6em 1em; margin: 1.2em 0; font-size: 14px; color: var(--dim); }
.note code { background: var(--ground); }

/* ---------- embeds ---------- */
.frame { width: 100%; height: 560px; border: 1px solid var(--line); background: #111; display: block; }

.nblinks { font-size: 14px; color: var(--faint); }
/* JS sizes this to the notebook's own height. Without JS it stays 900px and scrolls --
   it must not `overflow: hidden`, or the notebook becomes unreachable. */
.nbframe { width: 100%; height: 900px; border: 1px solid var(--line);
           background: #111; display: block; }

/* ---------- processing steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1em; align-items: start; }
.steps:has(.panel:nth-child(2):last-child) { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

.panel { margin: 0; }
/* The overlay canvas is full-resolution and the frame may be block-meaned; stacking them
   and letting both fill the stage is what keeps the ROI outlines crisp.
   `.zoom` wraps BOTH, so one transform moves them together and the overlay can never
   drift off the pixels it outlines. */
.stage { position: relative; line-height: 0; overflow: hidden;
         background: #000; border: 1px solid var(--line); touch-action: none; }
.zoom { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
/* NOT `.frame`: that class is the 3D viewer iframe, and it carries height:560px,
   which silently stretches every movie panel to 560px tall. */
.zoom img.movie { display: block; width: 100%; height: 100%; object-fit: fill;
                  image-rendering: pixelated; }
.zoom canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.panel:has(.roi-toggle) .stage { cursor: crosshair; }

/* An undecoded frame keeps the previous one on screen, which reads as a frozen movie
   unless the panel says otherwise. */
.stage.loading::after {
  content: "loading…"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); font: 12px Helvetica, Arial, sans-serif;
  line-height: 1; color: var(--text); background: rgba(0, 0, 0, .65);
  border: 1px solid var(--line); padding: .4em .6em; pointer-events: none;
}

.panel figcaption { font-size: 13px; color: var(--dim); padding-top: .4em;
                    display: flex; align-items: baseline; gap: .6em; flex-wrap: wrap; }
.panel figcaption b { color: var(--text); font-weight: 600; }
.panel figcaption .sub { font-family: ui-monospace, monospace; font-size: 12px;
                         color: var(--faint); }
.roi-toggle { margin-left: auto; font: inherit; font-size: 12px; padding: 2px 8px;
              cursor: pointer; background: none; color: var(--dim);
              border: 1px solid var(--line); }
.roi-toggle:hover { border-color: var(--accent); color: var(--text); }
.roi-toggle[aria-pressed="true"] { background: var(--raise); color: var(--text);
                                   border-color: var(--accent); }

/* Height must be fixed in CSS: fitCanvas() rewrites the intrinsic height for devicePixelRatio,
   and without this the element would grow to match it, then grow again on the next resize. */
.plot { display: block; width: 100%; height: 240px; margin: .2em 0 .6em; }
kbd { font: 12px ui-monospace, monospace; background: var(--raise); color: var(--text);
      border: 1px solid var(--line); padding: 0 .35em; }
#zoomout { color: var(--accent); min-width: 3.5em; }
#tracehdr { margin: .8em 0 .2em; }

.ctrl { display: flex; align-items: center; gap: .9em; margin-top: 1em; flex-wrap: wrap; font-size: 14px; }
.ctrl input[type=range] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.ctrl label { color: var(--dim); }
.ctrl output { font-family: ui-monospace, monospace; min-width: 5.5em; }
.ctrl .sub { color: var(--faint); font-size: 12px; min-width: 10em; }
.ctrl select, .ctrl button {
  font: inherit; font-size: 13px; padding: 3px 8px; cursor: pointer;
  background: var(--raise); color: var(--text); border: 1px solid var(--line);
}
.ctrl select:hover, .ctrl button:hover { border-color: var(--accent); color: #fff; }

@media (max-width: 640px) {
  body { padding: 0 .7em 2em; }
  .ctrl { gap: .6em; }
}
