/* Homepage hero: a field of real books behind one opening that is read in front.
   Ground, drift, scrim and copy come from hero-grid.css. Nothing is cropped: every book sits
   whole in its cell at its own proportions. */
/* the field: columns of whole books, alternate columns drifting up and down, seamless */
.hb-cols{position:absolute;left:0;top:0;bottom:0;z-index:1;display:flex;gap:var(--gap);padding-left:var(--gap);overflow:hidden;
  -webkit-mask-image:linear-gradient(180deg,transparent,#000 9%,#000 91%,transparent);mask-image:linear-gradient(180deg,transparent,#000 9%,#000 91%,transparent)}
.hb-col{flex:none;width:var(--cw);height:100%;overflow:hidden}
.hb-track{display:flex;flex-direction:column;animation:hbUp var(--dur) linear infinite;animation-delay:calc(var(--dur) * var(--off) / 100)}
.hb-col.down .hb-track{animation-direction:reverse}
.hb-cols.paused .hb-track{animation-play-state:paused}
@keyframes hbUp{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,-50%,0)}}
.hb-it{flex:none;width:100%;aspect-ratio:var(--ar);margin-bottom:var(--gap);background:#211f1c;filter:brightness(.6) saturate(.85);box-shadow:0 14px 26px -12px rgba(0,0,0,.85)}
.hb-it.book{border-radius:1px 4px 4px 1px}
.hb-it img{display:block;width:100%;height:100%}

/* the reading in front */
.fx{position:absolute;z-index:6;pointer-events:none;transition:opacity .6s ease}
.fx.out{opacity:0}
.fx.in{opacity:1}
.fx-page{position:relative;background:#1b1a18;box-shadow:0 40px 80px -30px rgba(0,0,0,.95),0 8px 24px -8px rgba(0,0,0,.7)}
.fx-page img{display:block;width:100%;height:100%;object-fit:contain}
.fx-scan{position:absolute;left:0;right:0;top:0;height:14%;background:linear-gradient(180deg,rgba(142,162,255,0),rgba(142,162,255,.22) 60%,rgba(170,186,255,.5) 62%,rgba(142,162,255,0) 64%);opacity:0}
.fx.scan .fx-scan{animation:fxScan 1.4s cubic-bezier(.4,0,.2,1) forwards}
@keyframes fxScan{0%{opacity:1;top:-14%}85%{opacity:1}100%{opacity:0;top:100%}}
.fx-marks{position:absolute;inset:0}
.fx-box{position:absolute;opacity:0;transform:scale(1.04);transition:opacity .5s ease,transform .6s cubic-bezier(.2,.7,.2,1)}
.fx-box.line{border:1.5px solid #8ea2ff;background:rgba(80,110,255,.14);box-shadow:0 0 0 1px rgba(0,0,0,.25)}
.fx.s1 .fx-box.line{opacity:1;transform:none}
.fx-box.ent{border-bottom:2px solid #ffc861;background:rgba(255,190,70,.22)}
.fx-box.plate{border:1.5px solid #7fe0b4;box-shadow:0 0 0 1px rgba(0,0,0,.3)}
.fx.s3 .fx-box.ent,.fx.s3 .fx-box.plate{opacity:1;transform:none}
.fx.s3 .fx-box.ent:nth-of-type(2){transition-delay:.15s}.fx.s3 .fx-box.ent:nth-of-type(3){transition-delay:.3s}.fx.s3 .fx-box.ent:nth-of-type(4){transition-delay:.45s}
.fx.s3 .fx-box.plate{transition-delay:.6s}
.fx-lab{position:absolute;left:-2px;bottom:100%;white-space:nowrap;font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:2px 6px;line-height:1.3}
.fx-box.ent .fx-lab{background:#ffc861;color:#2a1c00}
.fx-box.side-r .fx-lab{left:calc(100% + 4px);bottom:auto;top:50%;translate:0 -50%}
.fx-box.side-l .fx-lab{left:auto;right:calc(100% + 4px);bottom:auto;top:50%;translate:0 -50%}
.fx-box.plate .fx-lab{left:-1.5px;top:-1.5px;bottom:auto;background:#7fe0b4;color:#06301d}
.fx-lead{position:absolute;left:0;top:0;overflow:visible;opacity:0;transition:opacity .5s ease .2s}
.fx-lead line{stroke:#8ea2ff;stroke-width:1.2;stroke-dasharray:3 3}
.fx.s1 .fx-lead{opacity:1}

.fx-card{margin-top:14px;background:rgba(14,16,26,.88);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.09);padding:14px 18px 16px;color:#e9ebf5}
.fx-head{display:flex;justify-content:space-between;align-items:baseline;gap:16px;font-size:11.5px;color:rgba(255,255,255,.55);padding-bottom:10px;border-bottom:1px solid rgba(255,255,255,.08)}
.fx-title{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fx-title b{color:#fff;font-weight:600}
.fx-steps{display:flex;gap:12px;flex:none}
.fx-steps i{font-style:normal;font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:rgba(255,255,255,.28);transition:color .4s}
.fx-steps i::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:currentColor;margin-right:6px;vertical-align:1px}
.fx.s1 .fx-steps [data-s="1"]{color:#8ea2ff}.fx.s2 .fx-steps [data-s="2"]{color:#fff}.fx.s3 .fx-steps [data-s="3"]{color:#ffc861}
.fx-row{display:grid;grid-template-columns:118px 1fr;gap:14px;align-items:baseline;padding-top:10px;opacity:.25;transition:opacity .5s}
.fx.s1 .r1,.fx.s2 .r2,.fx.s3 .r3{opacity:1}
.fx-k{font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:#8ea2ff}
.r2 .fx-k{color:rgba(255,255,255,.75)}.r3 .fx-k{color:#ffc861}
.fx-orig,.fx-en{margin:0;font-family:var(--fo-serif,Georgia,serif);font-size:14.5px;line-height:1.45;min-height:1.45em}
.fx-orig{font-style:italic;color:#c3c8dc}
.fx-en{color:#fff}
.fx-tags{display:flex;flex-wrap:wrap;gap:5px;min-height:22px}
.tg{display:inline-flex;align-items:baseline;gap:6px;font-size:11.5px;padding:3px 8px;background:rgba(255,255,255,.07);color:#fff;opacity:0;transform:translateY(4px);animation:tgIn .4s cubic-bezier(.2,.7,.2,1) forwards;animation-delay:calc(var(--i) * 90ms)}
.tg em{font-style:normal;font-size:9px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:#ffc861}
.tg.k-plate em{color:#7fe0b4}.tg.k-subject em{color:#aab6ff}
@keyframes tgIn{to{opacity:1;transform:none}}

@media (max-width:1180px){ .fx-row{grid-template-columns:96px 1fr} .fx-orig,.fx-en{font-size:13.5px} }
@media (max-width:820px){
  .fx-card{padding:10px 12px 12px;margin-top:10px}
  .fx-head .fx-steps{display:none}
  .fx-row{grid-template-columns:1fr;gap:3px;padding-top:7px}
  .fx-orig,.fx-en{font-size:12.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .fx .r3{display:none}
  .fx-lab{font-size:8px;padding:1px 4px}
  .fx-box.plate .fx-lab,.fx-box.side-l .fx-lab,.fx-box.side-r .fx-lab{display:none}
}
@media (prefers-reduced-motion:reduce){ .hb-track{animation:none} .tg{animation:none;opacity:1;transform:none} }

/* a narrow reading (short or small screens): labels above the text, no step names */
.fx.compact .fx-row{grid-template-columns:1fr;gap:2px;padding-top:8px}
.fx.compact .fx-head .fx-steps{display:none}
.fx.compact .fx-orig,.fx.compact .fx-en{font-size:13px}
.fx.compact .tg{font-size:10.5px}

/* the card keeps one height whatever it holds: two lines per language, one row of tags */
.fx-orig,.fx-en{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.9em}
.fx-tags{flex-wrap:nowrap;overflow:hidden;-webkit-mask-image:linear-gradient(90deg,#000 85%,transparent);mask-image:linear-gradient(90deg,#000 85%,transparent)}
.tg{flex:none}

/* phones: the book columns as a band on top, then the copy, then the reading demo, in normal flow */
@media (max-width:820px){
  .hgrid.home{height:auto;min-height:0;display:flex;flex-direction:column;padding-bottom:28px}
  .hgrid.home .hg-scrim{display:none}
  .hgrid.home .hb-cols{position:relative;left:auto;top:auto;bottom:auto;width:100%!important;height:260px;flex:none;order:0;
    -webkit-mask-image:linear-gradient(180deg,#000 55%,transparent);mask-image:linear-gradient(180deg,#000 55%,transparent)}
  .hgrid.home .hb-it{filter:brightness(.8) saturate(.9)}
  .hgrid.home .hg-wrap{position:static;display:flex;flex-direction:column;gap:26px;padding:0 20px;margin-top:-40px;z-index:5}
  .hgrid.home .hg-copy{position:static;transform:none;max-width:none;left:auto;right:auto;bottom:auto}
  .hgrid.home .fx{position:relative;left:auto!important;top:auto!important;width:100%!important;order:2}
  .hgrid.home .fx .r3{display:grid}
}

/* loading: each book fades in once its image is decoded, instead of popping in over a grey box */
.hb-it{background:transparent;box-shadow:none;transition:box-shadow .6s ease}
.hb-it img{opacity:0;transition:opacity .7s ease}
.hb-it.ok{box-shadow:0 14px 26px -12px rgba(0,0,0,.85)}
.hb-it.ok img{opacity:1}
/* the reading reserves its space from first paint (the first opening is 1.308 wide) */
.fx .fx-page{aspect-ratio:1.308}
@media (max-width:820px){
  .hgrid.home .fx-card{min-height:214px}
  .hgrid.home .fx-tags{flex-wrap:nowrap}
}
@media (prefers-reduced-motion:reduce){ .hb-it img{opacity:1;transition:none} }

/* phones and tablets: the page always spans the full width of the reading, so the card
   underneath is exactly as wide as the book, never wider */
@media (max-width:820px){
  .hgrid.home .fx{max-width:600px}
  .hgrid.home .fx .fx-page{width:100%;height:auto!important;aspect-ratio:var(--ar,1.308)}
}
/* phones: the copy column and the reading card never grow past the screen (a long nowrap
   title in the card was pushing the whole column to 457px) */
@media (max-width:820px){
  .hgrid.home .hg-wrap{width:100%;min-width:0;max-width:100vw;box-sizing:border-box}
  .hgrid.home .hg-wrap>*{min-width:0;max-width:100%}
  .hgrid.home .fx-card{min-width:0;overflow:hidden}
}
