/* ==========================================================================
   NEXBOOK — premium-v5.css  (navbar life, hero motion, ticker, resources, buy books)
   ========================================================================== */

/* ---------- 1. Navbar: backpack with weight + sliding ink underline ---------- */
.nb-bag { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; margin-right: 6px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; }
.nb-bag:hover { background: rgba(17,17,16,0.06); }
.nb-bag svg { width: 22px; height: 22px; stroke: #111110; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform: translateY(calc(var(--w, 0) * 1px)); transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.nb-bag svg .strap { transform-box: fill-box; transform-origin: top center; transform: scaleY(calc(1 + var(--w, 0) * 0.12)); transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.nb-bag svg .body { transform-box: fill-box; transform-origin: top center; transform: scaleY(calc(1 + var(--w, 0) * 0.03)); transition: transform 0.5s; }
.nb-bag b { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #dc2626; color: #fff; font: 800 0.62rem/17px var(--font-ui, Inter, system-ui); text-align: center; transform: scale(0); transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1); box-shadow: 0 0 0 2px #fff; }
.nb-bag.has b { transform: scale(1); }
.nb-bag.bump b { animation: nbBump 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.nb-bag.bump svg { animation: nbSag 0.6s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes nbBump { 30% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes nbSag { 30% { transform: translateY(4px) rotate(-3deg); } 100% { transform: translateY(calc(var(--w, 0) * 1px)); } }
#navbarI nav.hidden.md\:flex { position: relative; }
.nb-ink { position: absolute; bottom: 2px; height: 2px; border-radius: 2px; background: #111110; left: 0; width: 0; opacity: 0; transition: left 0.45s cubic-bezier(0.22,1,0.36,1), width 0.45s cubic-bezier(0.22,1,0.36,1), opacity 0.3s; pointer-events: none; }
.nb-ink.is-on { opacity: 1; }

/* ---------- 2. Hero: sky by time, walking student, paper plane, split-flap ---------- */
html.nb-illus .nb-campus { background: var(--sky, #fbfbfa); transition: background 1s; }
html.nb-illus.nb-sky-morning .nb-campus { --sky: linear-gradient(180deg, #fff4e3, #fbfbfa 70%); }
html.nb-illus.nb-sky-day .nb-campus { --sky: linear-gradient(180deg, #eef5ff, #fbfbfa 70%); }
html.nb-illus.nb-sky-evening .nb-campus { --sky: linear-gradient(180deg, #ffe1c7, #fbe9dc 60%, #fbfbfa); }
html.nb-illus.nb-sky-night .nb-campus { --sky: linear-gradient(180deg, #0f172a, #1e293b 70%, #fbfbfa); }
html.nb-illus.nb-sky-night .nb-campus path, html.nb-illus.nb-sky-night .nb-campus rect, html.nb-illus.nb-sky-night .nb-campus circle, html.nb-illus.nb-sky-night .nb-campus ellipse { stroke: #e2e8f0; }
html.nb-illus.nb-sky-night .nb-campus .win { fill: #f5c542; fill-opacity: 0.85; stroke: #f5c542; animation: nbWin 4s ease-in-out infinite; }
html.nb-illus.nb-sky-night #top h1, html.nb-illus.nb-sky-night #top p { color: #f8fafc !important; }
html.nb-illus.nb-sky-night #top > .absolute.inset-0.bg-gradient-to-t { background: linear-gradient(to top, #fbfbfa 0%, rgba(15,23,42,0) 40%) !important; }
.nb-sky-tag { position: absolute; left: 16px; bottom: 14px; z-index: 6; display: none; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.8); font: 600 0.66rem/1 var(--font-ui, Inter, system-ui); letter-spacing: 0.12em; text-transform: uppercase; color: #111110; }
html.nb-illus .nb-sky-tag { display: inline-flex; gap: 6px; align-items: center; }

.nb-walker { display: none; }
.nb-walker svg { width: 100%; height: 100%; overflow: visible; stroke: #111110; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nb-walker .legA, .nb-walker .legB, .nb-walker .armA { transform-box: fill-box; transform-origin: top center; animation: nbLeg 0.7s ease-in-out infinite alternate; }
.nb-walker .legB, .nb-walker .armA { animation-delay: -0.35s; }
.nb-walker .bag { fill: #2563eb; fill-opacity: 0.85; stroke: #111110; }
@keyframes nbWalk { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 240px)); } }
@keyframes nbLeg { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@media (max-width: 767px) { .nb-walker { width: 40px; height: 66px; bottom: 4px; } }
html.nb-no-motion .nb-walker { display: none; }

.nb-plane { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; pointer-events: none; z-index: 9; opacity: 0; offset-path: path('M0 0 C 40 -60, 120 -90, 220 -140'); offset-rotate: auto; }
.nb-plane svg { width: 100%; height: 100%; stroke: #111110; fill: #fff; stroke-width: 1.4; stroke-linejoin: round; }
.nb-plane.fly { animation: nbFly 1.1s cubic-bezier(0.22,1,0.36,1) forwards; }
@keyframes nbFly { 0% { opacity: 0; offset-distance: 0%; } 10% { opacity: 1; } 100% { opacity: 0; offset-distance: 100%; } }
#top a.button-animation { position: relative; display: inline-block; }

.nb-flap { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 4px; }
.nb-flap span { position: relative; display: inline-block; width: 0.72em; height: 1.15em; line-height: 1.15em; text-align: center; border-radius: 3px; background: #111110; color: #fff; font-weight: 800; font-family: var(--font-ui, Inter, system-ui); overflow: hidden; perspective: 200px; }
.nb-flap span::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255,255,255,0.2); }
.nb-flap span i { display: block; font-style: normal; transform-origin: center; }
.nb-flap span.flip i { animation: nbFlap 0.18s ease-in-out; }
@keyframes nbFlap { 0% { transform: rotateX(0); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
.nb-flap span.sep { width: auto; min-width: 0.35em; padding: 0 1px; background: transparent; color: #111110; font-weight: 800; }
.nb-flap span i { font-variant-numeric: tabular-nums; }

/* ---------- 3. Ticker: icons + peek ---------- */
.nb-ticker__item { transition: padding 0.3s, background 0.3s; border-radius: 999px; cursor: pointer; pointer-events: auto; }
.nb-ticker { pointer-events: auto; }
.nb-ticker__ico { width: 14px; height: 14px; flex: none; align-self: center; stroke: rgba(17,17,16,0.5); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 1; transition: stroke 0.3s; }
.nb-ticker__item .go { display: inline-block; max-width: 0; overflow: hidden; opacity: 0; white-space: nowrap; font-weight: 700; color: #2563eb; transition: max-width 0.35s cubic-bezier(0.22,1,0.36,1), opacity 0.3s, margin 0.3s; }
.nb-ticker__item:hover { background: rgba(17,17,16,0.05); }
.nb-ticker__item:hover .nb-ticker__ico { stroke: rgba(17,17,16,0.85); }
.nb-ticker__item:hover .go { max-width: 80px; opacity: 1; margin-left: 6px; }

/* ---------- 4. Free Resources: back-face on hold + confetti ---------- */
[id^="freeResource"], #pgComingSoonBtn { transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), box-shadow 0.3s !important; }
.nb-fr-back { position: absolute; inset: 0; z-index: 3; border-radius: inherit; background: #111110; color: #fff; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; transform: rotateY(180deg); text-align: center; }
[id^="freeResource"].is-back .nb-fr-back, #pgComingSoonBtn.is-back .nb-fr-back { display: flex; }
.nb-fr-back b { font: 600 0.58rem/1 var(--font-ui, Inter, system-ui); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.nb-fr-back span { font: 700 0.8rem/1.25 var(--font-ui, Inter, system-ui); }
.nb-fr-back small { font: 500 0.66rem/1.3 var(--font-ui, Inter, system-ui); color: rgba(255,255,255,0.55); }
[id^="freeResource"].is-back, #pgComingSoonBtn.is-back { transform: rotateY(180deg) !important; }
[id^="freeResource"].is-back > :not(.nb-fr-back), #pgComingSoonBtn.is-back > :not(.nb-fr-back) { visibility: hidden; }

.nb-hold { position: absolute; left: 10px; right: 10px; bottom: 8px; height: 2px; border-radius: 2px; background: rgba(17,17,16,0.12); overflow: hidden; z-index: 3; opacity: 0; transition: opacity 0.2s; }
.nb-hold i { display: block; height: 100%; width: 0; background: #111110; }
[id^="freeResource"].holding .nb-hold, #pgComingSoonBtn.holding .nb-hold { opacity: 1; } [id^="freeResource"].holding .nb-hold i, #pgComingSoonBtn.holding .nb-hold i { animation: nbHold 0.6s linear forwards; }
@keyframes nbHold { to { width: 100%; } }
.nb-bits { position: absolute; left: 50%; top: 40%; z-index: 5; pointer-events: none; }
.nb-bits i { position: absolute; width: 6px; height: 9px; border-radius: 1px; opacity: 0; animation: nbBit 1.2s cubic-bezier(0.22,1,0.36,1) forwards; }
@keyframes nbBit { 0% { opacity: 1; transform: translate(0,0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(360deg); } }

/* ---------- 5. Buy Books: dust motes, page curl, price swing, popular badge ---------- */
.nb-dust { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.nb-dust i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: 0; box-shadow: 0 0 6px 2px rgba(255,255,255,0.6); animation: nbMote var(--d, 9s) ease-in-out var(--s, 0s) infinite; left: var(--x); top: var(--y); }
@keyframes nbMote { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: 0.35; } 50% { opacity: 0.2; transform: translate(14px, -18px); } 80% { opacity: 0.3; } 100% { opacity: 0; transform: translate(-6px, -40px); } }
html.nb-no-motion .nb-dust { display: none; }
#courseModalContent { perspective: 1600px; }
#courseModalContent > div.nb-page-in { animation: nbCurl 0.7s cubic-bezier(0.22,1,0.36,1) both; transform-origin: left center; backface-visibility: hidden; }
@keyframes nbCurl { 0% { transform: rotateY(-70deg) translateX(20px); opacity: 0; box-shadow: -30px 0 40px -20px rgba(0,0,0,0.3); } 60% { opacity: 1; } 100% { transform: none; opacity: 1; box-shadow: none; } }
.nb-price.swing { animation: nbSwing 1.6s cubic-bezier(0.34,1.56,0.64,1) both; transform-origin: -10px 30%; }
@keyframes nbSwing { 0% { transform: rotate(-4deg); } 35% { transform: rotate(3deg); } 65% { transform: rotate(-1.5deg); } 100% { transform: rotate(0); } }
.nb-popular { position: absolute; top: 14px; right: 16px; z-index: 3; display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; background: #111110; color: #fff; font: 700 0.62rem/1 var(--font-ui, Inter, system-ui); letter-spacing: 0.12em; text-transform: uppercase; box-shadow: 0 6px 14px -6px rgba(0,0,0,0.5); }
.nb-popular svg { width: 12px; height: 14px; stroke: #f5c542; fill: rgba(245,197,66,0.35); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; animation: nbFlick 1.4s ease-in-out infinite alternate; transform-origin: 50% 100%; }

@media (prefers-reduced-motion: reduce) { .nb-walker, .nb-plane, .nb-dust { display: none !important; } .nb-flap span.flip i, .nb-price.swing, #courseModalContent > div.nb-page-in { animation: none !important; } }
