/*
 * assets/page-v2.css: version 2 of the long product pages (site decision S54, docs/site/notes/2026-11-02-pages-v2-memory.md).
 * Every rule here waits for <html data-v2> (tools/site-v2.py writes it); without it the page is version 1.
 *
 * The rails (data-v2 holds "rails"): a list marked data-rail scrolls sideways and stands in one screen: its height is
 * the small viewport height (the browser's bars shown) less the header (--mast) and the bar under the rail. From
 * 1000 px a card is one snap point, its words and its picture side by side, the picture sized to the card's height
 * as well as its width. Below 1000 px a card is two panels side by side, the words and the picture, each a snap point
 * almost a screen wide, so either fits the screen. The next card shows at the right edge. All the words stay in the
 * page, nothing is hidden; a card's words scroll inside it only where a screen is too short for them.
 */

/* ── the preview's band at the top of the page (preview pages only) ── */
.v2-band{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 14px;padding:9px var(--gut,16px);
  font:500 12.5px/1.4 var(--mono,monospace);letter-spacing:.04em;color:#101507;background:var(--led,#FFB020)}
.v2-band b{font-weight:700;letter-spacing:.12em;text-transform:uppercase}
.v2-band a{color:inherit;text-decoration:underline;text-underline-offset:3px}
.v2-band a:focus-visible{outline:2px solid #101507;outline-offset:2px}

/* ── the rails ── */
html[data-v2~="rails"] [data-rail]{
  --peek:clamp(28px,4vw,64px);
  --gap:var(--gut,16px);   /* as wide as the margin, so the card before never shows in it */
  --ctl:48px;
  --rail-h:calc(100vh - var(--mast,66px) - var(--ctl) - 30px);
  --rail-h:calc(100svh - var(--mast,66px) - var(--ctl) - 30px);
  display:flex;flex-direction:row;align-items:stretch;gap:var(--gap);
  height:var(--rail-h);min-height:360px;
  margin-inline:calc(var(--gut,16px) * -1);padding-inline:var(--gut,16px);scroll-padding-inline:var(--gut,16px);
  margin-bottom:62px;   /* the bar's place (48 px and 14 above it), kept before the script puts the bar in */
  overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;
  scroll-snap-type:x mandatory;scrollbar-width:none;
  container-type:size;
  scroll-margin-top:0;   /* the page's scroll-padding-top already leaves the header's height */
  border-radius:4px;
}
html[data-v2~="rails"] [data-rail]::-webkit-scrollbar{display:none}
html[data-v2~="rails"] [data-rail]:focus-visible{outline:2px solid var(--led,#FFB020);outline-offset:6px}
@media (prefers-reduced-motion:no-preference){html[data-v2~="rails"] [data-rail]{scroll-behavior:smooth}}
@media (prefers-reduced-motion:no-preference) and (min-width:900px){
  html[data-v2~="rails"].snap [data-rail]{scroll-snap-align:start}
}

/* a card: one screen of the rail, less the edge of the next one */
html[data-v2~="rails"] [data-rail]>article{
  flex:0 0 calc(100cqw - var(--peek));min-width:0;height:100%;margin:0;
  scroll-snap-align:start;scroll-snap-stop:always;scroll-margin:0;
}
/* the picture's frame fills its place and the plate inside is sized to the frame both ways */
html[data-v2~="rails"] [data-rail] .rt-tray,
html[data-v2~="rails"] [data-rail] .bv-tray{
  container-type:size;display:grid;place-items:center;min-width:0;min-height:0;
  padding:0;border:0;border-radius:0;background:none;box-shadow:none;
}
html[data-v2~="rails"] [data-rail] .rt-plate,
html[data-v2~="rails"] [data-rail] .bv-plate{
  --lip2:calc(var(--lip,5px) + 1px);
  width:min(100cqw - var(--lip2) * 2, (100cqh - var(--lip2) * 2) * var(--w) / var(--h));
  box-shadow:0 0 0 var(--lip,5px) #12191d,0 0 0 var(--lip2) var(--rule,#222D34),0 26px 60px -30px rgba(0,0,0,.95);
}
/* the words: up to the card's height, scrolling inside it only when a short screen cannot hold them */
html[data-v2~="rails"] [data-rail] .rt-copy,
html[data-v2~="rails"] [data-rail] .bv-copy,
html[data-v2~="rails"] [data-rail] .bv-side{
  max-height:100%;overflow-y:auto;overscroll-behavior-y:auto;scrollbar-width:thin;scrollbar-color:var(--rule-hi,#33424B) transparent;
  padding-right:4px;
}

/* the words a little tighter in a card than in a long column (the same words, the same sizes from 1000 px) */
html[data-v2~="rails"] [data-rail] .rt-copy h3,html[data-v2~="rails"] [data-rail] .bv-copy h3{margin:10px 0 12px}
html[data-v2~="rails"] [data-rail] .rt-copy p,html[data-v2~="rails"] [data-rail] .bv-copy p{margin-bottom:11px}

/* words that go on below the card's edge fade out there (assets/page-v2.js sets v2-more until the end is reached) */
html[data-v2~="rails"] [data-rail] .v2-more{
  -webkit-mask-image:linear-gradient(#000 calc(100% - 56px),transparent);mask-image:linear-gradient(#000 calc(100% - 56px),transparent)}

/* from 1000 px: words and picture side by side in one card */
@media (min-width:1000px){
  html[data-v2~="rails"] [data-rail]>article:not(.bv-wide){grid-template-rows:minmax(0,100%);align-items:center}
  html[data-v2~="rails"] [data-rail]>article:not(.bv-wide)>figure{height:100%;width:100%}
  html[data-v2~="rails"] [data-rail]>.rt-feat .rt-warn{margin-top:16px}
  /* a card whose words carry a picture of their own (the Explorer window, the files to drop) shares the width evenly */
  html[data-v2~="rails"] [data-rail]>.rt-feat:has(.rt-win, .rt-files){grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  html[data-v2~="rails"] [data-rail] .rt-win{margin-top:18px;max-width:480px}
}

/* panels: a card in several screens side by side, each a snap point. Below 1000 px every card (the words, then the
   picture); from 1000 px the wide Bucket & Code cards (the words and the list together, then each picture). */
@media (max-width:999px){
  html[data-v2~="rails"] [data-rail]>article{flex:0 0 auto;display:flex;flex-direction:row;gap:var(--gap);scroll-snap-align:none}
  html[data-v2~="rails"] [data-rail]>article>:is(.rt-copy,.rt-tray,.bv-copy,.bv-side,.bv-tray){
    flex:0 0 calc(100cqw - var(--peek));width:calc(100cqw - var(--peek));height:100%;margin:0;padding-top:0;
    scroll-snap-align:start;scroll-snap-stop:always;order:0;
  }
  html[data-v2~="rails"] [data-rail]>article>.rt-copy,
  html[data-v2~="rails"] [data-rail]>article>.bv-copy,
  html[data-v2~="rails"] [data-rail]>article>.bv-side{height:auto;max-height:100%;padding-top:6px}
  html[data-v2~="rails"] [data-rail]>article .rt-warn{margin-top:14px}
}
@media (min-width:1000px){
  html[data-v2~="rails"] [data-rail]>article.bv-wide{flex:0 0 auto;display:flex;flex-direction:row;gap:var(--gap);scroll-snap-align:none}
  html[data-v2~="rails"] [data-rail]>article.bv-wide>:is(.bv-copy,.bv-side,.bv-tray){
    flex:0 0 calc(100cqw - var(--peek));width:calc(100cqw - var(--peek));height:100%;margin:0;
    scroll-snap-align:start;scroll-snap-stop:always;
  }
  html[data-v2~="rails"] [data-rail]>article.bv-wide>.bv-copy,
  html[data-v2~="rails"] [data-rail]>article.bv-wide>.bv-side{
    flex-basis:calc((100cqw - var(--peek) - var(--gap)) / 2);width:auto;height:auto;max-height:100%;align-self:center;padding-top:0}
  html[data-v2~="rails"] [data-rail]>article.bv-wide>.bv-side{scroll-snap-align:none}
}
@media (max-width:720px){
  /* the header slides away while the page scrolls down on a phone (site.js .mast.tuck): the rail takes its place */
  html[data-v2~="rails"] [data-rail]{--rail-h:calc(100vh - var(--ctl) - 40px);--rail-h:calc(100svh - var(--ctl) - 40px)}
  html[data-v2~="rails"] [data-rail] .rt-copy h3,html[data-v2~="rails"] [data-rail] .bv-copy h3{font-size:clamp(24px,7vw,30px)}
  html[data-v2~="rails"] [data-rail] .rt-copy p,html[data-v2~="rails"] [data-rail] .bv-copy p{font-size:15px;line-height:1.56}
}

/* the bar under a rail (assets/page-v2.js): previous, where the rail stands, next, and a line for how far along */
html[data-v2~="rails"] .v2-ctl{
  position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;
  height:48px;margin-top:-48px;
}
html[data-v2~="rails"] .v2-ctl button{
  appearance:none;display:grid;place-items:center;width:44px;height:44px;border-radius:999px;cursor:pointer;
  border:1px solid var(--rule-hi,#33424B);background:var(--panel,#151C21);color:var(--ink,#D8E0E4);
  transition:border-color .25s var(--ease-seat,ease),color .25s var(--ease-seat,ease),opacity .25s;
}
html[data-v2~="rails"] .v2-ctl button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
html[data-v2~="rails"] .v2-ctl button:hover:not(:disabled){border-color:var(--led,#FFB020);color:var(--led,#FFB020)}
html[data-v2~="rails"] .v2-ctl button:focus-visible{outline:2px solid var(--led,#FFB020);outline-offset:3px}
html[data-v2~="rails"] .v2-ctl button:disabled{opacity:.35;cursor:default}
html[data-v2~="rails"] .v2-pos{margin:0;min-width:0;display:flex;align-items:baseline;justify-content:center;gap:12px;
  font:500 12px/1.3 var(--mono,monospace);letter-spacing:.14em;text-transform:uppercase;color:var(--dim,#7C8B93);white-space:nowrap}
html[data-v2~="rails"] .v2-pos b{color:var(--led,#FFB020);font-weight:600}
html[data-v2~="rails"] .v2-pos span{overflow:hidden;text-overflow:ellipsis}
html[data-v2~="rails"] .v2-run{position:absolute;left:56px;right:56px;bottom:0;height:2px;background:var(--rule,#222D34);border-radius:2px;overflow:hidden}
html[data-v2~="rails"] .v2-run i{position:absolute;inset:0;background:var(--led,#FFB020);transform-origin:0 50%;transform:scaleX(0)}
@media (max-width:520px){html[data-v2~="rails"] .v2-pos span{display:none}}
@media (scripting:none){html[data-v2~="rails"] .v2-ctl{display:none}}

/* ── media (data-v2 holds "media", assets/page-v2.js) ── */
/* a cut-out's still picture under its frame (on a phone, Rtorrent 16); the frame shows once its page has loaded */
html[data-v2~="media"] .v2-still{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
html[data-v2~="media"] .v2-wait iframe{visibility:hidden}
/* the page's own animations stopped while far from the screen */
html[data-v2~="media"] .v2-stop,html[data-v2~="media"] .v2-stop *,
html[data-v2~="media"] .v2-stop *::before,html[data-v2~="media"] .v2-stop *::after{animation:none!important}
