/*
 * The StorageDiag box (site decision S59): at the top of each StorageDiag guide, the program the guide is about, with
 * StorageDiag's own screen beside the words. tools/site_sdbox.py writes the markup; tools/site-v2.py puts it on the
 * page (the part "sdbox"); docs/site/sdbox/README.md explains the parts.
 *
 * The scene is StorageDiag 1.6.10045 as a fresh install draws it: the dark theme "mono", the compact taskbar at the
 * top, the "signature" wallpaper of the guides' pictures. Every size, colour and font below was read from the running
 * program (computed styles in a browser) and is written here in its own pixels: 1em of .sdbox-stage is 10 of
 * StorageDiag's pixels, so the stage (500 x 412 of them) scales with the box through one container unit and no script.
 *
 * The motion, one 12 s cycle played three times and then held on its first frame: the program's icon with its
 * caption, the pointer to Menu, the menu unfolding out of it, the section, the flyout, the program, the menu folding
 * away, back to the icon. The pointer is the films' (twice the size, rounded, a shadow, eased on a slight arc, a
 * press and a ring on each click, a small zoom of the view). assets/sdbox.js takes the stage out of the rendering
 * while the box is half a screen or more away from the view; it starts over when the box comes back.
 * prefers-reduced-motion: no motion; one still frame shows the open menu with the program picked.
 */
@font-face{font-family:"SD Inter";font-style:normal;font-weight:100 900;font-display:swap;
  src:url("howto/fonts/Inter-latin.woff2") format("woff2");
  unicode-range:U+0-FF,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"SD Inter";font-style:normal;font-weight:100 900;font-display:swap;
  src:url("howto/fonts/Inter-latin-ext.woff2") format("woff2");
  unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}

/* ── the box: the site's enclosure (outer tray, inner plate), the scene and the words side by side ─────────────── */
.ht-art > .sdbox{margin:6px 0 clamp(26px,3vw,36px)}
.sdbox{
  --sdb-t:12s;
  position:relative;padding:var(--lip,5px);border:1px solid var(--rule);border-radius:var(--tray,14px);
  background:linear-gradient(180deg,rgba(255,255,255,.05),rgba(255,255,255,.012) 42%,transparent);
  box-shadow:0 1px 0 rgba(255,255,255,.045) inset,0 18px 44px -30px rgba(0,0,0,.9);
}
.sdbox-core{
  display:grid;grid-template-columns:minmax(0,1fr);overflow:hidden;
  border:1px solid var(--rule);border-radius:calc(var(--tray,14px) - var(--lip,5px));
  background:var(--panel);box-shadow:inset 0 1px 0 rgba(255,255,255,.055);
}
.sdbox-scene{
  position:relative;aspect-ratio:5/3;overflow:hidden;container-type:inline-size;isolation:isolate;
  background:#0a0a0a;border-bottom:1px solid var(--rule);
}
@media (min-width:760px){
  .sdbox-core{grid-template-columns:minmax(0,1.12fr) minmax(0,1fr)}
  .sdbox-scene{border-bottom:0;border-right:1px solid var(--rule)}
}

/* the words (scoped under the article: the guides' own paragraph rules would win otherwise) */
.ht-art .sdbox .sdbox-text{display:flex;flex-direction:column;justify-content:center;gap:10px;padding:clamp(16px,2.4vw,30px) clamp(16px,2.6vw,34px)}
@media (min-width:760px){.ht-art .sdbox .sdbox-text{gap:12px}}
.ht-art .sdbox p.sdbox-lead{margin:0;font-size:15px;line-height:1.55;color:var(--dim);text-wrap:pretty}
.ht-art .sdbox a.sdbox-suite{color:var(--ink);text-decoration:none;border-bottom:1px solid rgba(255,176,32,.5);transition:color .2s,border-color .2s}
.ht-art .sdbox a.sdbox-suite:hover,.ht-art .sdbox a.sdbox-suite:focus-visible{color:var(--led);border-color:var(--led)}
.ht-art .sdbox p.sdbox-name{margin:0;font-family:var(--cond);font-weight:600;font-size:clamp(25px,2.6vw,36px);line-height:1.1;
  letter-spacing:-.012em;color:var(--ink);text-wrap:balance}
.ht-art .sdbox .sdbox-dot{color:var(--led)}
.ht-art .sdbox p.sdbox-path{margin:2px 0 0;display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;font-size:13.5px;line-height:1.4}
.ht-art .sdbox .sdbox-where{font-family:var(--mono);font-size:11.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--dim)}
.ht-art .sdbox .sdbox-chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px 8px}
.ht-art .sdbox .sdbox-chip{display:inline-flex;align-items:center;padding:3px 9px;border:1px solid var(--rule-hi);border-radius:6px;
  background:rgba(255,255,255,.03);color:var(--ink);font-family:var(--sans);font-weight:500}
.ht-art .sdbox .sdbox-next{display:inline-flex;align-items:center;gap:8px}
.ht-art .sdbox .sdbox-next > i{font-style:normal;font-weight:600;color:var(--led)}
.ht-art .sdbox .sdbox-next:last-child .sdbox-chip{color:var(--led);border-color:rgba(255,176,32,.42);background:var(--led-soft)}
.sdbox ::selection{background:rgba(255,176,32,.32);color:#fff}

/* ── the scene: StorageDiag's screen, 1em = 10 of its pixels ─────────────────────────────────────────────────────── */
.sdbox-stage{
  position:absolute;left:0;top:0;width:50em;height:41.2em;font-size:calc(100cqw / 50);
  transform-origin:0 0;pointer-events:none;user-select:none;-webkit-user-select:none;
  font-family:"SD Inter","Inter","Segoe UI",system-ui,-apple-system,sans-serif;font-weight:400;line-height:normal;
  color:#fafafa;-webkit-font-smoothing:antialiased;text-rendering:geometricPrecision;--ic-ink:#fafafa;
}
.sdbox-stage *{box-sizing:border-box}
.sdbox-stage svg{display:block;flex:none;overflow:visible}
.sdbox-stage kbd{font:inherit}
/* the "signature" wallpaper: black, a hairline every 48 px, a white breath from the top. Desk and taskbar run two
   grid cells past the stage on both sides, so the still frame (the whole stage scaled into the window) has no edge */
.sdb-desk{position:absolute;left:-9.6em;top:2.4em;width:69.2em;height:38.8em;
  background:
    radial-gradient(100.8em 43.8em at 81.6em -8.8em,rgba(255,255,255,.06) 0%,transparent 60%),
    repeating-linear-gradient(to right,rgba(255,255,255,.027) 0 1px,transparent 1px 4.8em),
    repeating-linear-gradient(to bottom,rgba(255,255,255,.027) 0 1px,transparent 1px 4.8em),
    #0a0a0a}

/* desktop icons: an 88 px cell, the 32 px icon over its 11 px caption */
.sdb-di{position:absolute;left:calc(var(--x) * .1em);top:calc(var(--y) * .1em);width:8.8em;height:8.8em;
  display:flex;flex-direction:column;align-items:center;gap:.5em;padding:.8em .4em;
  border:1px solid transparent;border-radius:.8em;opacity:.5}
.sdb-di svg{width:3.2em;height:3.2em;filter:drop-shadow(0 .2em .5em rgba(0,0,0,.55))}
.sdb-di span{display:block;max-width:7.273em;font-size:1.1em;font-weight:500;line-height:1.3;letter-spacing:.01em;
  text-align:center;color:#fff;text-shadow:0 1px 1px #000;overflow-wrap:break-word}
.sdb-di.sdb-hero{opacity:1;background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.14);box-shadow:0 .4em 1.6em rgba(0,0,0,.28)}

/* the taskbar and its Menu button */
.sdb-bar{position:absolute;left:-9.6em;top:0;width:69.2em;height:2.4em;background:rgba(10,10,10,.96);border-bottom:1px solid rgba(255,255,255,.08);z-index:3}
.sdb-start{position:absolute;left:10.2em;top:.2em;height:1.9em;display:inline-flex;align-items:center;gap:.6em;padding:0 .9em;
  border:1px solid rgba(255,255,255,.14);border-radius:.5em;background:#171717;color:#d4d4d4}
.sdb-start svg{width:1.2em;height:1.2em;color:#fafafa}
.sdb-start b{font-size:1.1em;font-weight:600;letter-spacing:.04em;line-height:1}

/* the Start menu (compact, 248 px), its rows placed where StorageDiag places them */
.sdb-menu{position:absolute;left:0;top:2.4em;width:24.8em;height:41.33em;z-index:2;
  background:#141414;border:1px solid rgba(255,255,255,.12);border-radius:0 0 .8em .8em;
  box-shadow:0 2.4em 6.4em -2.4em rgba(0,0,0,.8),0 0 0 1px rgba(255,255,255,.14);
  opacity:0;clip-path:inset(0 -8em 100% -8em);transform:translateY(-.6em)}
.sdb-menu > *{position:absolute}
.sdb-search{left:1.2em;top:.8em;width:22.2em;height:2.4em;display:flex;align-items:center;gap:.8em;padding:0 1em;
  border:1px solid rgba(255,255,255,.14);border-radius:.6em;background:rgba(255,255,255,.04);color:#a3a3a3}
.sdb-search svg{width:1.4em;height:1.4em}
.sdb-search span{font-size:1.2em;color:#737373}
.sdb-upload{left:1em;top:3.8em;width:22.2em;height:2.8em;display:flex;align-items:center;gap:.9em;padding:.4em .9em;
  border:1px solid rgba(255,255,255,.08);border-radius:.6em;background:rgba(255,255,255,.04);color:#d4d4d4}
.sdb-upload svg{width:1.4em;height:1.4em;color:#60a5fa}
.sdb-upload span{flex:1;font-size:1.2em;white-space:nowrap;overflow:hidden}
.sdb-upload kbd{padding:.1em .5em;border:1px solid rgba(255,255,255,.14);border-radius:.4em;color:#737373;
  font-family:var(--mono);font-size:.9em;line-height:1.5}
.sdb-mode{left:1em;top:6.9em;width:22.2em;height:3.73em;display:flex;align-items:center;gap:.9em;padding:.4em .9em;
  border:1px solid rgba(255,255,255,.08);border-radius:.6em;color:#737373}
.sdb-mode svg{width:1.3em;height:1.3em}
.sdb-seg{flex:1;display:flex;gap:.2em;padding:.2em;border:1px solid rgba(255,255,255,.08);border-radius:.4em;background:rgba(255,255,255,.04)}
.sdb-seg span{flex:1;padding:.2em .8em;border-radius:.2em;text-align:center;font-size:1.15em;font-weight:500;color:#737373;line-height:1.5}
.sdb-seg span.on{font-weight:600;color:#fafafa;background:rgba(250,250,250,.16);box-shadow:inset 0 0 0 1px rgba(250,250,250,.45)}
.sdb-cat{left:.6em;top:calc(10.83em + var(--i) * 2.43em);width:23.4em;height:2.33em;display:flex;align-items:center;gap:.8em;
  padding:.3em .8em;border-radius:.6em;color:#d4d4d4}
.sdb-cat .ci{width:1.4em;height:1.4em;margin:0 .15em;color:#a3a3a3}
.sdb-cat .lb{flex:1;font-size:1.15em;font-weight:600;letter-spacing:.02em;white-space:nowrap;overflow:hidden}
.sdb-cat .ct{font-family:var(--mono);font-size:.95em;color:#737373}
.sdb-cat .ch{width:1.1em;height:1.1em;color:#737373}
.sdb-user{left:0;top:35.38em;width:24.6em;height:2.55em;display:flex;align-items:center;gap:.8em;padding:.4em 1.4em .3em;
  border-top:1px solid rgba(250,250,250,.08);color:#d4d4d4}
.sdb-user svg{width:1.6em;height:1.6em;opacity:.7}
.sdb-user b{font-size:1.15em;font-weight:700;color:#fff}
.sdb-user .role{margin-left:1.4em;padding:.2em .8em;border-radius:1em;background:rgba(42,138,255,.15);color:rgba(150,178,228,.9);
  font-size:.9em;font-weight:700;letter-spacing:.1em;text-transform:uppercase;line-height:1.5}
.sdb-user .ver{margin-left:auto;font-family:var(--mono);font-size:1.05em;letter-spacing:.02em;color:#a3a3a3}
.sdb-strip{left:0;top:37.93em;width:24.6em;height:3.2em;border-top:1px solid rgba(255,255,255,.08)}

/* the flyout of the section: 236 px beside the menu, level with its row */
.sdb-fly{position:absolute;left:24.7em;top:calc(var(--fly) * .1em);width:23.6em;z-index:2;padding:0 0 .61em;
  background:rgba(26,26,26,.98);border:1px solid rgba(255,255,255,.14);border-radius:0 0 .8em 0;
  box-shadow:0 2.4em 6.4em -2.4em rgba(0,0,0,.8),0 0 0 1px rgba(255,255,255,.14);opacity:0}
.sdb-fly-hd{height:2.93em;display:flex;align-items:center;gap:.9em;padding:.6em 1.2em .5em;margin-bottom:.29em;
  border-bottom:1px solid rgba(255,255,255,.08);color:#fafafa}
.sdb-fly-hd svg{width:1.6em;height:1.6em;color:#60a5fa}
.sdb-fly-hd span{font-size:1.15em;font-weight:600}
.sdb-it{height:2.6em;display:flex;align-items:center;gap:.8em;padding:.4em 1.4em;color:#d4d4d4}
.sdb-it svg{width:1.4em;height:1.4em}
.sdb-it span{font-size:1.2em;white-space:nowrap}

/* the pointer: the films' arrow, 44 px, its tip on the point */
.sdb-ptr,.sdb-ptr-y{position:absolute;left:0;top:0;z-index:4}
.sdb-ptr{transform:translateX(calc(var(--rx) * .1em))}
.sdb-ptr-y{transform:translateY(calc(var(--ry) * .1em))}
.sdb-arrow{position:absolute;left:-.8em;top:-.52em;width:4.4em;height:4.4em;transform-origin:.6em .4em;
  filter:drop-shadow(0 .4em .6em rgba(0,0,0,.45)) drop-shadow(0 .1em .1em rgba(0,0,0,.35))}
.sdb-ring{position:absolute;left:-2.4em;top:-2.4em;width:4.8em;height:4.8em;border-radius:50%;
  border:.3em solid rgba(255,196,64,.9);opacity:0;transform:scale(.3)}

/* ── the motion ───────────────────────────────────────────────────────────────────────────────────────────────────
   One clock for every part (--sdb-t, three plays, held on the first frame after). Moves ease in and out; the pointer's
   x and y take two different curves, so it travels on a slight arc. Points come from the stage's style attribute
   (tools/site_sdbox.py): --rx/--ry the rest on the icon, --mx/--my Menu, --gx/--gy the section, --ix/--iy the program,
   --pan how far the view follows the flyout down. */
.sdbox-stage,.sdbox-stage .sdb-hero,.sdb-start,.sdb-menu,.sdb-cat.sdb-on,.sdb-cat.sdb-on .ci,.sdb-fly,.sdb-it.sdb-pick,
.sdb-ptr,.sdb-ptr-y,.sdb-arrow,.sdb-ring{
  animation-duration:var(--sdb-t);animation-iteration-count:3;animation-fill-mode:both;animation-delay:.6s;
  animation-timing-function:linear}
.sdbox-stage{animation-name:sdb-cam}
.sdbox-stage .sdb-hero{animation-name:sdb-hero}
.sdb-start{animation-name:sdb-btn}
.sdb-menu{animation-name:sdb-menu}
.sdb-cat.sdb-on{animation-name:sdb-row}
.sdb-cat.sdb-on .ci{animation-name:sdb-rowic}
.sdb-fly{animation-name:sdb-fly}
.sdb-it.sdb-pick{animation-name:sdb-pick}
.sdb-ptr{animation-name:sdb-x}
.sdb-ptr-y{animation-name:sdb-y}
.sdb-arrow{animation-name:sdb-press}
.sdb-ring{animation-name:sdb-ring}
.sdbox.is-off .sdbox-stage{display:none}   /* far from the screen: no layers, no animation (assets/sdbox.js) */

@keyframes sdb-x{
  0%,9%{transform:translateX(calc(var(--rx) * .1em));animation-timing-function:cubic-bezier(.65,0,.35,1)}
  19%,25%{transform:translateX(calc(var(--mx) * .1em));animation-timing-function:cubic-bezier(.65,0,.35,1)}
  33%,37%{transform:translateX(calc(var(--gx) * .1em));animation-timing-function:cubic-bezier(.65,0,.35,1)}
  46%,56%{transform:translateX(calc(var(--ix) * .1em));animation-timing-function:cubic-bezier(.65,0,.35,1)}
  66%,100%{transform:translateX(calc(var(--rx) * .1em))}
}
@keyframes sdb-y{
  0%,9%{transform:translateY(calc(var(--ry) * .1em));animation-timing-function:cubic-bezier(.3,0,.25,1)}
  19%,25%{transform:translateY(calc(var(--my) * .1em));animation-timing-function:cubic-bezier(.45,0,.2,1)}
  33%,37%{transform:translateY(calc(var(--gy) * .1em));animation-timing-function:cubic-bezier(.5,0,.75,1)}
  46%,56%{transform:translateY(calc(var(--iy) * .1em));animation-timing-function:cubic-bezier(.3,0,.25,1)}
  66%,100%{transform:translateY(calc(var(--ry) * .1em))}
}
@keyframes sdb-press{
  0%,19.6%,21.6%,47.6%,49.6%,100%{transform:scale(1)}
  20.4%,48.4%{transform:scale(.82)}
}
@keyframes sdb-ring{
  0%,19.9%{opacity:0;transform:scale(.3)}
  20%{opacity:.95;transform:scale(.3);animation-timing-function:cubic-bezier(.16,1,.3,1)}
  24.6%,47.9%{opacity:0;transform:scale(1.35)}
  48%{opacity:.95;transform:scale(.3);animation-timing-function:cubic-bezier(.16,1,.3,1)}
  52.6%,100%{opacity:0;transform:scale(1.35)}
}
/* the view: a small zoom on each click (around the click), and a pan that follows the flyout down and back */
@keyframes sdb-cam{
  0%,20%{transform:translate(0,0) scale(1);animation-timing-function:cubic-bezier(.33,0,.2,1)}
  21.6%{transform:translate(calc(var(--mx) * -.006em),calc(var(--my) * -.006em)) scale(1.06);animation-timing-function:cubic-bezier(.4,0,.2,1)}
  25%,27%{transform:translate(0,0) scale(1);animation-timing-function:cubic-bezier(.65,0,.35,1)}
  40%,48%{transform:translate(0,calc(var(--pan) * -.1em)) scale(1);animation-timing-function:cubic-bezier(.33,0,.2,1)}
  49.6%{transform:translate(calc(var(--ix) * -.006em),calc(var(--iy) * -.006em - var(--pan) * .1em)) scale(1.06);animation-timing-function:cubic-bezier(.4,0,.2,1)}
  53%,55%{transform:translate(0,calc(var(--pan) * -.1em)) scale(1);animation-timing-function:cubic-bezier(.65,0,.35,1)}
  66%,100%{transform:translate(0,0) scale(1)}
}
@keyframes sdb-hero{
  0%,10%,65.5%,100%{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.14);box-shadow:0 .4em 1.6em rgba(0,0,0,.28)}
  11%,64.5%{background:transparent;border-color:transparent;box-shadow:0 .4em 1.6em transparent}
}
@keyframes sdb-btn{
  0%,18.4%,53.6%,100%{background:#171717;border-color:rgba(255,255,255,.14);color:#d4d4d4}
  19%,20.2%{background:rgba(255,255,255,.05);border-color:rgba(255,255,255,.08);color:#fafafa}
  20.6%,53%{background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.28);color:#fff}
}
/* the menu unfolds out of the button: a reveal from its top edge with StorageDiag's own rise (8 px, 0.985) */
@keyframes sdb-menu{
  0%,20.8%{opacity:0;clip-path:inset(0 -8em 100% -8em);transform:translateY(-.6em) scale(.985);animation-timing-function:cubic-bezier(.16,1,.3,1)}
  24.4%,53%{opacity:1;clip-path:inset(0 -8em -8em -8em);transform:none;animation-timing-function:cubic-bezier(.4,0,1,1)}
  54.6%,100%{opacity:0;clip-path:inset(0 -8em -8em -8em);transform:translateY(-.3em)}
}
@keyframes sdb-row{
  0%,33.6%,54.6%,100%{background:transparent;color:#d4d4d4}
  34.2%,53%{background:rgba(255,255,255,.09);color:#60a5fa}
}
@keyframes sdb-rowic{
  0%,33.6%,54.6%,100%{color:#a3a3a3}
  34.2%,53%{color:#60a5fa}
}
@keyframes sdb-fly{
  0%,35%{opacity:0;transform:translateX(-.4em)}
  36.2%,53%{opacity:1;transform:none;animation-timing-function:cubic-bezier(.4,0,1,1)}
  54.6%,100%{opacity:0;transform:none}
}
@keyframes sdb-pick{
  0%,45%,54.6%,100%{background:transparent;color:#d4d4d4}
  45.6%,53%{background:rgba(255,255,255,.09);color:#fafafa}
}

/* ── reduced motion: one still frame, the open menu with the program picked and the pointer on it ──────────────── */
@media (prefers-reduced-motion:reduce){
  .sdbox-stage,.sdbox-stage *{animation:none!important}
  .sdbox-stage{transform:translate(calc(var(--fitx) * .1em),0) scale(var(--fit))}
  .sdbox-stage .sdb-hero{background:transparent;border-color:transparent;box-shadow:none}
  .sdb-start{background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.28);color:#fff}
  .sdb-menu{opacity:1;clip-path:none;transform:none}
  .sdb-cat.sdb-on{background:rgba(255,255,255,.09);color:#60a5fa}
  .sdb-cat.sdb-on .ci{color:#60a5fa}
  .sdb-fly{opacity:1;transform:none}
  .sdb-it.sdb-pick{background:rgba(255,255,255,.09);color:#fafafa}
  .sdb-ptr{transform:translateX(calc(var(--ix) * .1em))}
  .sdb-ptr-y{transform:translateY(calc(var(--iy) * .1em))}
}
