/* Shared styles of the animated pages (docs/specs.md PUB-15). */
@font-face { font-family: "Research Devanagari"; src: url("fonts/devanagari-sans.ttf") format("truetype"); font-weight: 100 900; }
@font-face { font-family: "Research Malayalam"; src: url("fonts/malayalam-sans.ttf") format("truetype"); font-weight: 100 900; }
:root {
  --bg: #0b0d17; --ink: #eadbb0; --dim: #8d8672; --digit: #7fe3ff; --accent: #f2b45a;
  --bad: #ff5d6c; --grid: #2a2e44; --panel: #141829ee;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --deva: "Research Devanagari", "Research Malayalam", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; font-family: var(--sans); }
/* Fixed, so the 1600px stage never widens a phone's layout viewport (which
   would make the browser zoom the whole page out). */
#stage { position: fixed; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0;
  background: var(--bg); }
/* The gradient has a layer of its own, which never repaints: repainted
   with the stage, it can come out a colour level off, depending on what
   was drawn before, and two captures at the same time would differ
   (PUB-16.1). */
#stage::before { content: ""; position: absolute; inset: 0; z-index: -1; will-change: transform;
  background: radial-gradient(ellipse at 50% 40%, #161a2e 0%, var(--bg) 70%); }
#stage.nofx *, #stage.nofx { transition: none !important; }
#cap { position: absolute; left: 70px; top: 26px; width: 1460px; transition: opacity .5s; }
#cap .k { font-size: 16px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
#cap h1 { margin: 4px 0 0; font-weight: 500; font-size: 46px; letter-spacing: .01em; line-height: 1.15; }
#cap p { margin: 8px 0 0; font-size: 25px; color: #b9b19a; max-width: 1460px; line-height: 1.35; }
/* A tall screen (a phone held upright): the caption sits above the picture
   at its own size instead of being scaled down with it. */
body.tall #cap { position: fixed; left: 0; right: 0; top: 0; width: auto; min-height: 196px; padding: 14px 16px 10px;
  background: var(--bg); border-bottom: 1px solid #1d2135; z-index: 2; }
body.tall #cap .k { font-size: 11px; }
body.tall #cap h1 { font-size: 22px; }
body.tall #cap p { font-size: 15.5px; }
body.tall #cap::after { content: "Turn the phone sideways for a larger picture."; display: block; margin-top: 8px; font-size: 12px; color: #5d5848; }
#page { position: absolute; left: 70px; top: 150px; width: 1460px; height: 710px; overflow: hidden;
  font-family: var(--deva); line-height: 1.75; text-align: justify; opacity: 0; transition: opacity 1s; }
#page.dim .v { opacity: .14; }
#page .v { transition: opacity .6s, color .6s, text-shadow .6s; }
#page .v.hot { opacity: 1 !important; color: #fff3cf; text-shadow: 0 0 14px #f2b45a99; }
.w { white-space: nowrap; }
.sy { position: relative; display: inline-block; }
.sy .s { transition: opacity .45s; }
.sy .d { position: absolute; left: 0; right: 0; top: 52%; transform: translateY(-50%) scale(.6); text-align: center;
  font-family: var(--mono); font-size: .9em; color: var(--digit); opacity: 0; transition: opacity .45s, transform .45s; }
.sy.on .s { opacity: .08; }
.sy.on .d { opacity: 1; transform: translateY(-50%) scale(1); }
.sy.mute.on .d { opacity: 0; }
.sep { color: #5d5848; font-size: .8em; margin: 0 .25em; }
#panel { position: absolute; left: 200px; top: 185px; width: 1200px; padding: 30px 40px; border-radius: 18px;
  background: var(--panel); border: 1px solid #343a58; box-shadow: 0 30px 80px #000a; opacity: 0;
  transform: translateY(14px); transition: opacity .6s, transform .6s; pointer-events: none; }
#panel.show { opacity: 1; transform: none; }
.big { display: flex; gap: calc(var(--bs, 74px) * .3); justify-content: center; align-items: flex-end; }
.big .col { display: flex; flex-direction: column; align-items: center; }
.big .s { font-family: var(--deva); font-size: var(--bs, 74px); line-height: 1.3; }
.big .d { font-family: var(--mono); font-size: calc(var(--bs, 74px) * .68); color: var(--digit); opacity: 0; transform: translateY(-10px); transition: opacity .35s, transform .35s; min-height: 62px; }
.big .d.on { opacity: 1; transform: none; }
.big .gap { width: 26px; }
.tr { text-align: center; margin-top: 12px; font-size: 25px; color: var(--dim); font-style: italic; }
.tr b { color: var(--ink); font-style: normal; font-weight: 500; }
.off { display: none !important; }
.key { margin-top: 26px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 12px 8px; font-size: 24px;
  opacity: 0; transition: opacity .6s; }
.key.on { opacity: 1; }
.key span { display: flex; flex-direction: column; align-items: center; font-family: var(--deva); line-height: 1.2; }
.key i { font-style: normal; font-family: var(--mono); color: var(--digit); font-size: 18px; }
.keynote { margin-top: 16px; font-size: 21px; color: var(--dim); text-align: center; opacity: 0; transition: opacity .6s; }
.keynote.on { opacity: 1; }
.rev { margin-top: 18px; opacity: 0; transition: opacity .6s; display: flex; justify-content: center; font-family: var(--mono); font-size: 70px; color: var(--digit); height: 110px; align-items: center; }
.rev span { display: inline-block; width: 52px; text-align: center; transition: transform .9s cubic-bezier(.6,0,.2,1), margin .6s; }
.rev span.g { margin-left: 34px; }
.rev.on { opacity: 1; }
.lab { display: flex; justify-content: center; gap: 0; font-size: 20px; color: var(--accent); opacity: 0; transition: opacity .6s; }
.lab.on { opacity: 1; }
.lab div { text-align: center; }
.res { text-align: center; font-size: 36px; margin-top: 22px; opacity: 0; transition: opacity .6s; }
.res.on { opacity: 1; }
#layer { position: absolute; inset: 0; pointer-events: none; }
.tok { position: absolute; left: 0; top: 0; width: 172px; height: 22px; border-radius: 3px; font-family: var(--mono);
  font-size: 14.5px; line-height: 22px; white-space: nowrap; color: var(--ink); opacity: 0;
  transition: transform 1.1s cubic-bezier(.65,0,.25,1), width .8s, height .8s, border-radius .8s, background .8s, opacity .6s, box-shadow .6s; }
.tok b { color: #5d5848; font-weight: 400; display: inline-block; width: 34px; text-align: right; margin-right: 10px; }
.tok .t { transition: opacity .4s; }
.tok.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--digit); overflow: hidden; }
.tok.dot .t { opacity: 0; }
.tok.bad { background: var(--bad) !important; box-shadow: 0 0 0 5px #ff5d6c40, 0 0 18px #ff5d6c; }
#chart { position: absolute; inset: 0; width: 1600px; height: 900px; pointer-events: none; overflow: visible; }
#chart text { fill: var(--dim); font: 17px var(--sans); }
#chart .ax { stroke: #4a4f6c; stroke-width: 1.2; }
#chart .gl { stroke: var(--grid); stroke-width: 1; }
#chart g.layer { transition: opacity .8s; }
#chart .ann { fill: var(--ink); font-size: 21px; }
#chart .bad { fill: var(--bad); font-size: 16px; }
#chart .wave { fill: var(--accent); font: 600 20px var(--sans); }
#chart .rasi { fill: var(--ink); font: 22px var(--deva); }
#chart .rasi-en { fill: var(--dim); font-size: 15px; }
#note { position: absolute; left: 70px; bottom: 34px; width: 1460px; font-size: 23px; line-height: 1.5; opacity: 0; transition: opacity .6s; }
#note.on { opacity: 1; }
#note .m { font-family: var(--mono); color: var(--digit); }
#src { position: absolute; right: 70px; bottom: 10px; font-size: 12.5px; color: #5d5848; }
#ctl { position: fixed; left: 0; right: 0; bottom: 0; height: 52px; z-index: 3; display: flex; gap: 10px; align-items: center; justify-content: center;
  background: #080a12; border-top: 1px solid #1d2135; font: 14px var(--sans); color: var(--dim); }
#ctl button { background: #151a2c; color: var(--ink); border: 1px solid #2b3150; border-radius: 8px; padding: 7px 13px; font: inherit; cursor: pointer; }
#ctl a.home { color: var(--dim); text-decoration: none; margin: 0 6px; }
@media (max-width: 640px) { #ctl a.home, #ctl .dots { display: none; } }
#ctl a.home:hover { color: var(--accent); }
#ctl button:hover { border-color: var(--accent); }
#ctl .dots { display: flex; gap: 7px; margin: 0 8px; }
#ctl .dots button { width: 12px; height: 12px; padding: 0; border-radius: 50%; }
#ctl .dots button.cur { background: var(--accent); border-color: var(--accent); }
.sy.cor .d, .big .col.cor .s, .big .col.cor .d, .rev span.aside { color: var(--accent); }
.rev span.aside { opacity: .75; }
#chart .ev { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 5; }
#chart .evt { fill: var(--accent); font: 22px var(--deva); }
#chart .evt-en { fill: #b9b19a; font: 18px var(--sans); }
.tok.small:not(.dot) { width: 92px; font-size: 12.5px; height: 17px; line-height: 17px; }
.tl { position: absolute; font-size: 15px; color: var(--dim); }
.sy.hot .s, .v.hot .s { color: #fff3cf; }
.big .d { min-width: 1ch; }
.cmp { font-size: 2.5em; margin: .3em 0; }
.cmp span.l { color: var(--dim); font-size: .55em; display: inline-block; width: 300px; text-align: right; margin-right: 24px; }
.cmp span.n { font-family: var(--mono); }
.cmp i { font-style: normal; color: var(--digit); }
.cmp em { font-style: normal; color: var(--dim); }
.cmpnote { margin-top: 14px; font-size: 21px; color: var(--dim); text-align: center; }
#ctl .stepn { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink); }
/* Narrow screens: keep only the step controls (after the rules above, so it wins). */
@media (max-width: 640px) { #ctl a.home, #ctl .dots { display: none; } #ctl { gap: 8px; } #ctl .stepn { min-width: 52px; } }
/* Progress of the step on screen: a 3px line on the control bar's top edge. */
#ctl .prog { position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: #1d2135; overflow: hidden; }
#ctl .prog i { position: absolute; inset: 0; background: var(--digit); opacity: .75; transform-origin: 0 50%; transform: scaleX(0); }
/* Embedded (?embed): no controls; the stage uses the whole frame. */
body.embed #ctl { display: none; }
/* The tall format (body[data-format=tall]): its own 900 × 1600 stage,
   stacked as a caption band, a picture and a readout band (PUB-16). */
#readout { display: none; }
[data-format=tall] #stage { width: 900px; height: 1600px; }
/* The phone type scale (PUB-16.6), in stage px; a 390 px phone shows the
   stage at 0.43, so 28 px is about 12 px on screen. Zones: caption 0-400,
   picture 400-1210, readout 1210-1450, source line 1450-1600. */
[data-format=tall] #cap { left: 44px; top: 40px; width: 812px; }
[data-format=tall] #cap .k { font-size: 30px; letter-spacing: .14em; }
[data-format=tall] #cap h1 { font-size: 60px; line-height: 1.1; margin-top: 8px; }
[data-format=tall] #cap p { font-size: 36px; line-height: 1.3; max-width: 812px; margin-top: 12px; }
[data-format=tall] #page { left: 44px; top: 420px; width: 812px; height: 770px; }
[data-format=tall] #panel { left: 30px; top: 412px; width: 840px; padding: 22px 26px; }
[data-format=tall] .big { flex-wrap: wrap; row-gap: 6px; --bs: 84px !important; }
[data-format=tall] .big .d { min-height: 50px; }
/* A long passage (the π verse) on a phone: smaller syllables, still well
   above the phone type scale, so it fits the picture zone. */
[data-format=tall] #panel.long .big { --bs: 60px !important; }
[data-format=tall] #panel.long .big .d { min-height: 40px; }
[data-format=tall] #panel.long .big .gap { flex-basis: 28px; }
[data-format=tall] #panel.long .rev { font-size: 50px; height: 70px; }
[data-format=tall] .rev { height: 86px; font-size: 60px; margin-top: 8px; }
[data-format=tall] .lab { display: none !important; }
[data-format=tall] .big .gap { flex-basis: 100%; height: 0; }
[data-format=tall] .tr { font-size: 34px; }
[data-format=tall] .key { font-size: 44px; grid-template-columns: repeat(6, 1fr); }
[data-format=tall] .key i { font-size: 32px; }
[data-format=tall] .key span:empty { display: none; }
[data-format=tall] .keynote { font-size: 30px; }
[data-format=tall] .lab { font-size: 30px; }
[data-format=tall] .res { font-size: 48px; }
[data-format=tall] #readout { display: block; position: absolute; left: 44px; top: 1220px; width: 812px; height: 225px;
  overflow: hidden; text-align: center; font-size: 36px; line-height: 1.3; color: #b9b19a; opacity: 0; transition: opacity .6s; }
[data-format=tall] #readout.on { opacity: 1; }
#readout .n { font-family: var(--mono); font-size: 104px; line-height: 1.05; color: var(--digit); }
#readout .n.a { color: var(--accent); }
#readout .s { font-size: 36px; color: var(--dim); }
#readout .row { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 0 40px; line-height: 1.18; }
#readout .row .m { font-family: var(--mono); color: var(--digit); font-size: 44px; white-space: nowrap; }
#readout .row .l { font-size: 36px; color: var(--dim); text-align: right; }
#readout .tx { font-family: var(--sans); font-style: italic; color: var(--ink); font-size: 40px; }
#readout .hl { color: var(--bad); }
[data-format=tall] .tok.dot { width: 14px; height: 14px; }
/* Text chips on a phone: a count or a date, at the phone type scale. */
[data-format=tall] .tok.big-tall { width: 340px; height: 44px; font-size: 32px; line-height: 44px; text-align: center; }
[data-format=tall] .tok.big-tall.hot-text { color: var(--accent); }
/* Comparison rows (a number against another) on a phone: the label above. */
[data-format=tall] .cmp { font-size: 50px; margin: 0 0 .5em; }
[data-format=tall] .cmp span.l { display: block; width: auto; margin: 0 0 4px; text-align: left; font-size: 32px; }
.tok.hot { background: #fff3cf !important; box-shadow: 0 0 0 6px #f2b45a55, 0 0 22px #f2b45a; z-index: 1; }
[data-format=tall] #chart text { font-size: 30px; }
[data-format=tall] #chart .wave { font-size: 32px; }
[data-format=tall] #chart .rasi { font-size: 36px; }
[data-format=tall] #chart .rasi-en { font-size: 30px; }
[data-format=tall] #src { left: 44px; right: 44px; top: 1460px; bottom: auto; font-size: 28px; line-height: 1.25; text-align: center; }
