/* The entry stage (A2, 2026-11; slice S4a): Get started's level-first pages, GS-D "one take".
   templates/showcase/level_first.html (the question: "New to Farsi?") and level_phrases.html (the
   phrase check), on the board's stage: mirror ground (canvas.fld[data-field="mirror"]), the brand
   top left and Sign in top right, the riders on the left, the thread at the foot, the question at
   left 46%. The answer's pearl leaves its button and lands on the thread; the riders trot up to it;
   it opens (static/js/a2/entry.js). Board: .scratch/ui_wave1/project/Start-D.dc.html; the signed-out
   home (Welcome.dc.html) ends in exactly this state, so the two pages share the top band and the
   riders (templates/showcase/partials/entry_top.html, entry_riders.html) and their view-transition
   names. Every board-local class carries the en- prefix; kit classes (.tb .ans .spr .go .qa .gb
   .spk .grow .in1 .in2) come from a2.css. */

/* Cross-document view transitions (Chrome 126+, Safari 18.2+): from the home page to the question,
   the question to the phrases and back, the stage stays put and only the words change. Elsewhere it
   is a plain page load onto an identical stage. */
@view-transition{navigation:auto}
::view-transition-old(root),::view-transition-new(root){animation-duration:.4s}

/* -- the stage ------------------------------------------------------------------------------------ */

.en{height:100vh;height:100dvh;min-height:640px;color:var(--ink)}
/* The phrases page grows with its lines (they wrap on narrower screens) and keeps the foot clear:
   the check is in the flow at the question's place, the foot is drawn in the reserved bottom band. */
.en.en-ph{height:auto;min-height:100vh;min-height:100dvh;padding-bottom:276px}
.en .tb{view-transition-name:en-tb}
/* The way home on the level-first pages (owner TW-42, 2026-11-14: "this page still has the old polygoft logo as
   well"): the renewed app's one home button (templates/a2/home.html, drawn by showcase/partials/entry_top.html;
   its look and press are the shell's, static/css/a2/chrome.css and static/js/a2/dock.js) at its place on every
   renewed page, but in the band rather than on the viewport (absolute, not fixed: the band does not stay on
   screen when the phrases scroll); the band's words share its centre line. The signed-out home
   (dashboard/welcome.html) still draws the brand (.en-br below). */
.en-tbh{align-items:flex-start;padding-top:calc(var(--af-wm-edge) + (var(--af-wm-size) - 44px) / 2)}
.en-tbh .a2-home{position:absolute}
.en-br{display:flex;align-items:center;gap:12px;color:var(--ink);text-decoration:none}
.en-br svg{display:block;flex:none}
.en-mk{width:42px;height:42px;border-radius:10px}
.en-wd{display:flex;color:var(--ink)}
/* A signed-in account held at the level question: Settings and Log out where a visitor's Sign in sits (R1-1). */
.en-ac{display:flex;align-items:center;gap:18px}
.en-acf{display:contents}
.en .en-ac button.qa{border:0;background-color:transparent;cursor:pointer}
.en .en-ac .qa:focus-visible{outline:2px solid rgba(28,57,187,.45);outline-offset:3px;border-radius:6px}

/* -- the question --------------------------------------------------------------------------------- */

.en-q{position:absolute;left:46%;top:19%;right:3%;z-index:3;transition:opacity .45s .5s}
.en-q.leaving{opacity:0;pointer-events:none}
.en-h1{margin:0;font:800 96px/.95 var(--fd);letter-spacing:-.02em;white-space:nowrap}
.en-qr{display:flex;gap:18px;margin-top:44px}
.en-qr form{display:contents}
.en .ans:focus-visible{background:var(--ink);color:#fff}
.en .ans.sel canvas{opacity:0;transition:none}
.en-hint{height:28px;margin-top:18px;font:600 19px/28px var(--fb);color:#5B6172}

/* -- the foot: the riders, the thread, the pearl that lands on it, the GO, the clickwrap ----------- */

.en-ft{position:absolute;inset:0;z-index:2;pointer-events:none}
.en-th{position:absolute;left:0;right:0;bottom:166px;height:2px;margin-bottom:-1px;background:rgba(21,23,30,.2);view-transition-name:en-th}

/* The riders: GS-D's three sprite sheets at GS-D's place and scale (--rs). The arrival sheet is only
   loaded once the page asks for it (data-en-warm), so a visitor who never answers never fetches it. */
.en-rd{--rs:1.3;position:absolute;left:6%;bottom:150px;width:600px;height:384px;transform:translateX(var(--rx,0px)) scale(var(--rs));transform-origin:0 100%;pointer-events:none;view-transition-name:en-rd}
.en-rd .spr{opacity:0}
.en-rd .spr.on{opacity:1}
.en-s1{width:468px;height:384px;background-image:url("../../img/a2/riders/idle.e4d2e7928a97.webp");background-size:3744px 2304px}
.en-s2{left:12px;width:480px;height:384px;background-image:url("../../img/a2/riders/go.cd1e9caad69e.webp");background-size:3360px 1152px}
.en-s3{left:66px;width:520px;height:384px;background-size:4160px 3072px}
.en[data-en-warm] .en-s3{background-image:url("../../img/a2/riders/arrive.48b6fb263007.webp")}
/* Rostam rides up to the pearl (owner TW-42, 2026-11-14: "when rostam walks up to it and rakhsh stumps it
   feet"). The arrival sheet's own trot carries Rakhsh about 140 of its 520px forward (frames 0-21, 1.24 s at
   17 fps) and he rears with his front at 506 of 520, which reaches the pearl only at the board's 1440px.
   Wherever the pearl is further on (a wider screen, a phone, the phrases' next pearl), static/js/a2/entry.js
   writes the rest of the way as --rx and the riders cover it in those same trot frames, so Rakhsh always
   rears just in front of the pearl. */
.en-rd.walk{transition:transform 1.24s cubic-bezier(.45,.05,.55,.95)}
.en.open .en-rd{opacity:0;transition:opacity .25s 1.375s,transform 1.24s cubic-bezier(.45,.05,.55,.95)}

/* The answer's pearl, landed on the thread (.dpl on the board). entry.js measures the pressed
   button's pearl and sets --fx/--fy/--fs, so it starts exactly where that pearl was at any size:
   the outer box carries the sideways travel, <i> the fall and its bounces, <b> the growth and,
   when it opens, the swell that hands over to the reveal. */
.en-dp{position:absolute;left:61%;bottom:166px;width:88px;height:88px;margin-left:-44px;pointer-events:none;opacity:0}
.en-dp i,.en-dp b{display:block;width:88px;height:88px}
.en-dp canvas{display:block;width:88px;height:88px;border-radius:50%;filter:drop-shadow(0 10px 10px rgba(21,23,30,.3))}
.en-dp.on{opacity:1;view-transition-name:en-dp}
.en-dp.fly{animation:en-door-x .9s cubic-bezier(.2,.7,.3,1) backwards}
.en-dp.fly i{animation:en-door-fall .9s backwards}
.en-dp.fly b{animation:en-door-grow .5s backwards}
/* the swell into the reveal, 1.25x the take it was (owner TW-42: "just a notch slower"; was .8s, the fade .45s after .15s) */
.en-dp b{transition:transform 1s cubic-bezier(.6,0,.2,1),opacity .56s .19s}
.en.open .en-dp b{transform:scale(9);opacity:0}
/* "I know some"'s pearl lands where the phrases' next pearl sits (--go-x, below), at its size, and becomes it
   there (the view transition pairs the two): no gold pearl waits on the phrases' thread (owner TW-42). */
.en-dp.en-dp-go{left:var(--go-x);width:77px;height:77px;margin-left:-38.5px}
.en-dp.en-dp-go i,.en-dp.en-dp-go b,.en-dp.en-dp-go canvas{width:77px;height:77px}
@keyframes en-door-x{from{transform:translateX(var(--fx,0px))}to{transform:translateX(0)}}
@keyframes en-door-fall{0%{transform:translateY(var(--fy,0px));animation-timing-function:cubic-bezier(.55,0,1,.6)}52%{transform:translateY(0);animation-timing-function:cubic-bezier(0,.5,.5,1)}68%{transform:translateY(-34px);animation-timing-function:cubic-bezier(.5,0,1,.5)}84%{transform:translateY(0);animation-timing-function:cubic-bezier(0,.5,.5,1)}92%{transform:translateY(-9px);animation-timing-function:cubic-bezier(.5,0,1,.5)}100%{transform:translateY(0)}}
@keyframes en-door-grow{from{transform:scale(var(--fs,.68))}to{transform:scale(1)}}

/* THE NEXT PEARL (owner TW-42, 2026-11-14: "instead of a gold pearl pre-existing there the next button should
   be a bit larger and become a solid gold pearl after submission"): the phrases' GO, the one pearl on the
   thread (as every door's GO sits on its thread), at --go-x, 1.2x the kit's GO (77px, its arrow with it): a
   grey seed until a phrase is ticked, blue once one is. Pressed (.going), it stays where it is and turns
   into the solid gold pearl: its two upper canvases fade in over it, the nacre one (.en-lit) first, then the
   gold one (.en-gold), so the blue brightens and warms into gold (blue straight into gold passes through a
   muddy grey); the arrow goes and the hover's lean is undone; Rostam rides up to it; then (.open) it swells
   into the reveal, as a landed pearl does. One shadow for the three (on the box, not on each canvas, so the
   stack never darkens it). The box carries the landed pearl's view-transition name. */
.en{--go-x:calc(61% + 150px)}
.en-go{position:absolute;left:var(--go-x);bottom:166px;width:0;height:0;pointer-events:auto}
/* the box is the pearl alone: no trailing dash here, so none of the kit's room for it (24px that ran past a
   phone's right edge, where a focus or a tap scrolled the stage sideways to show it) */
.en-go .go{position:absolute;left:-38.5px;bottom:0;height:77px;margin:0;padding:0;background:none;filter:drop-shadow(0 9px 9px rgba(21,23,30,.34))}
.en-go .go.wait{filter:none}
.en-go .go::before{display:none}
.en-go .go canvas{width:77px;height:77px;filter:none}
.en-go .go::after{right:33.5px;width:15.5px;height:15.5px;margin-top:-7.75px;border-top-width:4.8px;border-right-width:4.8px}
.en-go .go:disabled{cursor:default}
/* the landed pearl's view-transition partner: the GO's box, which is the pearl's box (a name on the first canvas
   would lift it over the two layers above it) */
.en-ph .en-go .go{view-transition-name:en-dp}
/* the two layers sit over the GO's own pearl: z-index 1 in the box's stacking context (measured: without it the
   in-flow canvas painted over them while its own fade was pending); the arrow, z-index 1 and later, stays over both */
.en-go .go .en-lit,.en-go .go .en-gold{position:absolute;z-index:1;left:0;top:0;opacity:0;pointer-events:none;transition:opacity .2s,transform .45s cubic-bezier(.3,1.6,.5,1)}
.en.going .en-go{pointer-events:none}
.en.going .en-go .go canvas{transform:none}
.en.going .en-go .go::after{opacity:0}
.en.going .en-go .go .en-lit{opacity:1;transition:opacity .25s ease-in,transform .45s cubic-bezier(.3,1.6,.5,1)}
.en.going .en-go .go .en-gold{opacity:1;transition:opacity .4s ease-out .2s,transform .45s cubic-bezier(.3,1.6,.5,1)}
.en.going .en-go .go canvas:first-child{opacity:0;transition:transform .45s cubic-bezier(.3,1.6,.5,1),opacity 0s .3s}
.en.open .en-go .go .en-lit{opacity:0;transition:none}
.en.open .en-go .go .en-gold{transform:scale(9);opacity:0;transition:transform 1s cubic-bezier(.6,0,.2,1),opacity .56s .19s}

/* The guest's clickwrap, where GS-D and the home page keep it: bottom right, its words the app's own. */
.en-fr{position:absolute;right:32px;bottom:22px;max-width:560px;margin:0;text-align:right;font:500 13px/1.45 var(--fb);color:#686E81;pointer-events:auto;view-transition-name:en-fr}
.en-fr a{color:var(--ink);font-weight:700;text-decoration:none;box-shadow:inset 0 -1.5px 0 rgba(21,23,30,.3)}
.en-fr a:hover{box-shadow:inset 0 -2px 0 var(--ink)}
/* While reCAPTCHA is on, Google's disclosure ends the clickwrap on its own line, and chrome.css hides Google's badge
   (owner, 2026-11-24: "if it's allowed to be hidden then hide it everywhere"), so the clickwrap keeps its corner. */
.en-rc{display:block;margin-top:2px;font-size:12px}

/* The pearl opens onto the road: the land spreads from it in a circle with a thin ink rim ahead of
   it (.rim/.rdl on the board), then the road's own page loads. The circle's centre is the pearl's own
   centre from its first frame (owner TW-42, 2026-11-14: "the transition isn't exactly cetnered on the gold
   ball"): entry.js measures it in the layers' own box and writes --ox/--oy BEFORE .open, since a centre
   written with the class made the circle slide in from these defaults while it grew. A notch slower
   (owner: "just a notch slower"): 1.19 s, 1.25x the .95 s it was. */
.en-rim,.en-rv{position:fixed;inset:0;pointer-events:none;clip-path:circle(0px at var(--ox,61%) var(--oy,70%))}
.en-rim{z-index:49;background:#15171E}
.en-rv{z-index:50;background:linear-gradient(180deg,#5FB1B8 0,#86BFB0 32%,#8CB98A 46%,#8CAF76 100%)}
.en.open .en-rim{clip-path:circle(calc(150% + 4px) at var(--ox,61%) var(--oy,70%));transition:clip-path 1.19s cubic-bezier(.6,0,.2,1)}
.en.open .en-rv{clip-path:circle(150% at var(--ox,61%) var(--oy,70%));transition:clip-path 1.19s cubic-bezier(.6,0,.2,1)}

/* -- the phrase check (an undrawn state in GS-D's grammar) ----------------------------------------- */

.en-q.en-pq{position:relative;left:auto;top:auto;right:auto;margin:clamp(8px,4vh,40px) 3% 0 46%}
.en-pt{display:flex;align-items:center;gap:6px;margin-left:-4px}
.en-sw{display:flex;align-items:center;gap:18px}
.en-sw .qa[aria-pressed="true"]{color:var(--ink);background-size:100% 2px}
.en-sw .qa[lang="fa"]{font-family:var(--ffa);font-weight:600}
.en-h2{margin:12px 0 0;max-width:760px;font:800 56px/1 var(--fd);letter-spacing:-.015em;text-wrap:balance}
.en-ls{list-style:none;margin:24px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;max-width:760px}
.en-li{display:flex;align-items:center;gap:12px;min-height:60px}
.en-li .spk[data-playing="true"],.en-li .spk.on{background:var(--blue)}
.en-li .spk[data-play]{flex:none}
.en-lb{position:relative;display:flex;align-items:center;gap:14px;flex:1;min-width:0;min-height:56px;padding:0 10px 0 4px;border-radius:16px;cursor:pointer;transition:background .15s}
@media (hover:hover){
  .en-lb:hover{background:rgba(21,23,30,.04)}
}
.en-lb:has(:focus-visible){outline:3px solid var(--blue);outline-offset:2px}
.en-lb canvas{display:block;flex:none;width:30px;height:30px;border-radius:50%;transition:transform .35s cubic-bezier(.3,1.7,.5,1)}
.en-lb:has(:checked) canvas{transform:scale(1.15)}
.en-tx{flex:0 1 auto;min-width:0;font:600 24px/1.3 var(--fb);color:var(--mut);transition:color .2s,background-size .25s;background:linear-gradient(currentColor,currentColor) 0 100%/0 2px no-repeat;padding-bottom:3px}
.en-tx[lang="fa"]{font-family:var(--ffa);font-weight:600;font-size:25px}
.en-lb:has(:checked) .en-tx{color:var(--ink);background-size:100% 2px}
.en-tx[dir="rtl"]{margin-left:auto;background-position:100% 100%}

/* -- in between: the structure stays, the riders step back ---------------------------------------- */

@media (max-height:819px){
  .en-rd{--rs:1.05}
}
@media (max-height:760px) and (min-width:700px) and (orientation:landscape),(max-height:760px) and (min-width:1200px){
  .en.en-ph{padding-bottom:262px}
  .en-q.en-pq{margin-top:8px}
  .en-h2{font-size:44px}
  .en-ls{margin-top:16px;gap:0}
  .en-li{min-height:54px}
  .en-lb{min-height:50px}
}
@media (max-height:679px){
  .en-rd{--rs:.85}
}
@media (max-width:1099px){
  .en-rd{--rs:.72}
  .en-h1{font-size:clamp(56px,7vw,96px)}
  .en-qr{flex-direction:column;align-items:flex-start;gap:14px;margin-top:32px}
  .en-h2{font-size:44px}
  .en-tx{font-size:21px}
}

/* -- below 700px: one column, the riders and the thread at the foot ------------------------------- */

@media (max-width:699px),(orientation:portrait) and (max-width:1199px){
  .en,.en.en-ph{height:auto;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
  .en .tb{height:64px;padding:0 16px;gap:12px}
  .en .tb.en-tbh{padding-top:calc(var(--af-wm-edge) + (var(--af-wm-size) - 44px) / 2)}
  .en-ac{gap:10px}
  .en-mk{width:36px;height:36px;border-radius:9px}
  .en-wd svg{width:85px;height:24px}
  .en-q,.en-q.en-pq{position:relative;left:auto;top:auto;right:auto;margin:0;padding:28px 16px 0}
  .en.en-ph{padding-bottom:0}
  .en-h1{font-size:46px;white-space:normal}
  .en-qr{gap:12px;margin-top:28px;align-items:stretch}
  .en .ans{width:100%;height:72px;font-size:28px}
  .en .ans canvas{width:52px;height:52px}
  .en-hint{display:none}
  .en-ft{position:relative;inset:auto;flex:none;height:300px;margin-top:auto}
  .en-th{bottom:110px}
  .en-rd{--rs:.42;left:0;bottom:105px}
  .en-dp{left:68%;bottom:110px;width:72px;height:72px;margin-left:-36px}
  .en-dp i,.en-dp b,.en-dp canvas{width:72px;height:72px}
  /* the next pearl at its own place on a phone (the landed "I know some" with it): its right edge as far in from
     the right as Rakhsh's tail is from the left, about 38px (owner, 2026-11-17, at 375px: "this button can move
     slightly to the left so it's symmetric with where rostam and rakhsh are standing") */
  .en{--go-x:calc(100% - 77px)}
  .en-go{bottom:110px}
  .en-fr{left:16px;right:16px;bottom:12px;max-width:none;text-align:center;font-size:12px}
  .en-rc{font-size:11px}
  .en-pt{gap:2px}
  .en-sw{gap:14px}
  .en-h2{margin-top:8px;font-size:32px;line-height:1.05}
  .en-ls{margin-top:18px;gap:2px}
  .en-li{gap:8px;min-height:56px}
  .en-lb{gap:10px;min-height:52px;padding:0 6px 0 2px}
  .en-lb canvas{width:26px;height:26px}
  .en-tx{font-size:18px}
  .en-tx[lang="fa"]{font-size:19px}
}
@media (max-width:699px) and (max-height:700px),(orientation:portrait) and (max-width:1199px) and (max-height:700px){
  .en-ft{height:250px}
}

@media (prefers-reduced-motion:reduce){
  .en-q,.en-dp b,.en-rim,.en-rv,.en.open .en-rd,.en-rd.walk,.en-go .go canvas,.en-go .go .en-lit,.en-go .go .en-gold,.en.going .en-go .go .en-lit,.en.going .en-go .go .en-gold,.en.going .en-go .go canvas:first-child,.en.open .en-go .go .en-gold{transition:none}
  ::view-transition-old(root),::view-transition-new(root){animation:none}
}
