/**
 * E-Library — public pages (home, study material, book pages).
 * Tailwind handles layout; this file holds what Tailwind can't express:
 * the animated "How it works" demo, hero mock-up details, FAQ styling,
 * and a few reusable surface treatments.
 */

html { scroll-padding-top: 5.5rem; }
body { -webkit-font-smoothing: antialiased; }

/* ---------- Surfaces ---------- */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(99, 102, 241, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
}
.card-lift { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.card-lift:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -18px rgba(49, 46, 129, 0.35); border-color: #a5b4fc; }
.text-balance { text-wrap: balance; }
.eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #4f46e5; }

/* ---------- Sample text marks (used in feature cards + hero) ---------- */
.mk-y { background: #fef08a; padding: 0 2px; border-radius: 3px; }
.mk-g { background: #bbf7d0; padding: 0 2px; border-radius: 3px; }
.mk-b { background: #bfdbfe; padding: 0 2px; border-radius: 3px; }
.mk-r { background: #fecaca; padding: 0 2px; border-radius: 3px; }
.mk-p { background: #fbcfe8; padding: 0 2px; border-radius: 3px; }
.chip-dot { width: 1.05rem; height: 1.05rem; border-radius: 9999px; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; display: inline-block; }

/* ---------- Hero reader mock-up ---------- */
.mock-window { border-radius: 1.1rem; background: #fff; border: 1px solid #e2e8f0; overflow: hidden; box-shadow: 0 30px 80px -30px rgba(49, 46, 129, 0.45); }
.mock-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.65rem 0.9rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.mock-bar i { width: 0.65rem; height: 0.65rem; border-radius: 9999px; display: inline-block; }
.mock-url { margin-left: 0.75rem; flex: 1; max-width: 22rem; font-size: 0.7rem; color: #64748b; background: #fff; border: 1px solid #e2e8f0; border-radius: 9999px; padding: 0.2rem 0.8rem; text-align: left; }
.mock-side { background: #f8fafc; border-right: 1px solid #e2e8f0; }
.mock-node { display: flex; align-items: center; gap: 0.45rem; font-size: 0.74rem; font-weight: 600; color: #64748b; padding: 0.35rem 0.5rem; border-radius: 0.45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock-node.is-on { background: #fff; color: #4f46e5; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); border: 1px solid #e0e7ff; }
.mock-page { background: #fff; text-align: left; }
.mock-menu { display: inline-flex; align-items: center; gap: 0.25rem; background: #0f172a; color: #fff; border-radius: 0.6rem; padding: 0.3rem 0.45rem; font-size: 0.7rem; font-weight: 700; box-shadow: 0 10px 25px -8px rgba(15, 23, 42, 0.6); }
.mock-simple { border-left: 4px solid #6366f1; background: #eef2ff; border-radius: 0 0.6rem 0.6rem 0; padding: 0.7rem 0.9rem; font-size: 0.78rem; color: #1e293b; }

/* ---------- How it works: animated demo ---------- */
.demo-steps { display: flex; flex-direction: column; gap: 0.6rem; }
.demo-step {
  position: relative; text-align: left; width: 100%;
  padding: 1rem 1.1rem 1.05rem 3.6rem; border-radius: 1rem;
  background: #fff; border: 1px solid #e2e8f0; overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}
.demo-step:hover { border-color: #a5b4fc; }
.demo-step .num {
  position: absolute; left: 1rem; top: 1rem; width: 2rem; height: 2rem; border-radius: 0.6rem;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem;
  background: #f1f5f9; color: #64748b; transition: background-color 0.2s ease, color 0.2s ease;
}
.demo-step h4 { font-weight: 800; color: #0f172a; font-size: 0.98rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.demo-step p { color: #64748b; font-size: 0.85rem; line-height: 1.5; margin-top: 0.2rem; }
.demo-step .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: linear-gradient(90deg, #6366f1, #9333ea); }
.demo-step.is-active { border-color: #818cf8; background: #fafaff; box-shadow: 0 12px 30px -16px rgba(79, 70, 229, 0.5); }
.demo-step.is-active .num { background: linear-gradient(135deg, #4f46e5, #9333ea); color: #fff; }
.demo-step.is-active .bar { animation: demoBar var(--dur, 6s) linear forwards; }
.demo.is-paused .demo-step.is-active .bar { animation-play-state: paused; }
@keyframes demoBar { from { width: 0; } to { width: 100%; } }

.demo-window { border-radius: 1.25rem; background: #fff; border: 1px solid #e2e8f0; overflow: hidden; box-shadow: 0 30px 70px -28px rgba(49, 46, 129, 0.5); }
.demo-stage { position: relative; height: 25rem; background: linear-gradient(180deg, #f8fafc, #fff); }
.scene { position: absolute; inset: 0; display: none; padding: 1.1rem; }
.scene.is-active { display: block; animation: sceneIn 0.35s ease both; }
@keyframes sceneIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Scene 1: choose a book -> syllabus */
.s1-grid { display: grid; grid-template-columns: 11rem 1fr; gap: 0.9rem; height: 100%; }
.s1-side { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.8rem; padding: 0.6rem; overflow: hidden; }
.s1-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.38rem 0.5rem; border-radius: 0.45rem; font-size: 0.72rem; font-weight: 600; color: #475569; opacity: 0; transform: translateX(-8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene.is-active .s1-row { animation: rowIn 0.4s ease forwards; animation-delay: calc(var(--i) * 0.45s + 0.2s); }
.s1-row.l1 { padding-left: 1.2rem; } .s1-row.l2 { padding-left: 1.9rem; }
.s1-row.is-pick { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
@keyframes rowIn { to { opacity: 1; transform: none; } }
.s1-page { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.8rem; padding: 1rem; overflow: hidden; }
.skel { height: 0.55rem; border-radius: 9999px; background: #e2e8f0; margin-top: 0.55rem; width: 0; }
.scene.is-active .skel { animation: skelIn 0.8s ease forwards; animation-delay: calc(var(--i) * 0.18s + 1.9s); }
@keyframes skelIn { to { width: var(--w, 100%); } }
.s1-title { font-weight: 800; font-size: 1rem; color: #0f172a; opacity: 0; }
.scene.is-active .s1-title { animation: rowIn 0.5s ease forwards; animation-delay: 1.7s; }

/* Scene 2: read and mark */
.s2-tool { display: inline-flex; align-items: center; gap: 0.5rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 0.7rem; padding: 0.35rem 0.55rem; font-size: 0.78rem; color: #475569; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05); }
.s2-tool .sw { width: 1rem; height: 1rem; border-radius: 9999px; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; }
.s2-tool .sw.pulse { animation: swPulse 1.2s ease-in-out infinite; }
@keyframes swPulse { 50% { transform: scale(1.3); } }
.s2-page { margin-top: 0.8rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 0.8rem; padding: 1.1rem 1.2rem; font-size: 0.86rem; line-height: 2; color: #334155; text-align: left; }
.s2-page h5 { font-weight: 800; color: #0f172a; font-size: 0.98rem; margin-bottom: 0.2rem; }
.mark { background-repeat: no-repeat; background-position: left center; background-size: 0% 100%; border-radius: 3px; padding: 1px 2px; }
.scene.is-active .mark { animation: markIn 0.7s ease forwards; animation-delay: var(--d); }
@keyframes markIn { to { background-size: 100% 100%; } }
.mark.m-y { background-image: linear-gradient(#fef08a, #fef08a); }
.mark.m-g { background-image: linear-gradient(#bbf7d0, #bbf7d0); }
.mark.m-b { background-image: linear-gradient(#bfdbfe, #bfdbfe); }
.mark.m-r { background-image: linear-gradient(#fecaca, #fecaca); }
.fx-bold { font-weight: 400; }
.scene.is-active .fx-bold { animation: boldIn 0.01s forwards; animation-delay: var(--d); }
@keyframes boldIn { to { font-weight: 800; color: #0f172a; } }
.fx-u { text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.scene.is-active .fx-u { animation: uIn 0.4s forwards; animation-delay: var(--d); }
@keyframes uIn { to { text-decoration-color: #4f46e5; } }

/* Scene 3: AI simplify */
.s3-page { margin-top: 1.5rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 0.8rem; padding: 1rem 1.15rem; font-size: 0.84rem; line-height: 1.85; color: #334155; text-align: left; position: relative; }
.sel { background: #c7d2fe; border-radius: 3px; padding: 1px 2px; }
.s3-menu { position: absolute; right: 1rem; top: -0.9rem; opacity: 0; transform: translateY(6px); }
.scene.is-active .s3-menu { animation: popIn 0.35s ease forwards; animation-delay: 1.1s; }
.s3-menu .go { background: #4f46e5; border-radius: 0.4rem; padding: 0.15rem 0.5rem; }
.scene.is-active .s3-menu .go { animation: pressBtn 0.4s ease forwards; animation-delay: 2.2s; }
@keyframes popIn { to { opacity: 1; transform: none; } }
@keyframes pressBtn { 50% { transform: scale(0.88); background: #7c3aed; } }
.s3-out { margin-top: 0.9rem; opacity: 0; transform: translateY(10px); }
.scene.is-active .s3-out { animation: popIn 0.5s ease forwards; animation-delay: 2.7s; }
.s3-out li { opacity: 0; list-style: none; padding-left: 1.1rem; position: relative; margin-top: 0.3rem; }
.s3-out li::before { content: ''; position: absolute; left: 0.1rem; top: 0.5rem; width: 0.4rem; height: 0.4rem; border-radius: 9999px; background: #6366f1; }
.scene.is-active .s3-out li { animation: rowIn 0.4s ease forwards; animation-delay: calc(3.1s + var(--i) * 0.5s); }

/* Scene 4: quiz */
.s4-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.9rem; padding: 1rem 1.1rem; text-align: left; }
.s4-q { font-weight: 800; color: #0f172a; font-size: 0.92rem; line-height: 1.4; }
.s4-opt { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; padding: 0.55rem 0.7rem; border: 1px solid #e2e8f0; border-radius: 0.65rem; font-size: 0.82rem; font-weight: 600; color: #334155; background: #fff; }
.s4-opt b { width: 1.4rem; height: 1.4rem; border-radius: 9999px; background: #f1f5f9; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; color: #64748b; flex-shrink: 0; }
.s4-opt .tick { margin-left: auto; opacity: 0; color: #16a34a; }
.scene.is-active .s4-opt.pick { animation: optPick 0.4s ease forwards; animation-delay: 1.6s; }
.scene.is-active .s4-opt.pick .tick { animation: popIn 0.3s ease forwards; animation-delay: 1.9s; }
@keyframes optPick { to { background: #dcfce7; border-color: #4ade80; color: #14532d; } }
.s4-why { margin-top: 0.7rem; font-size: 0.78rem; color: #475569; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 0.6rem; padding: 0.5rem 0.7rem; opacity: 0; }
.scene.is-active .s4-why { animation: popIn 0.5s ease forwards; animation-delay: 2.3s; }
.s4-score { position: absolute; right: 1.1rem; top: 1.1rem; font-size: 0.7rem; font-weight: 800; background: #eef2ff; color: #4338ca; border-radius: 9999px; padding: 0.2rem 0.6rem; }

/* Scene 5: print on demand */
.s5-wrap { display: flex; align-items: center; justify-content: center; gap: 1.2rem; height: 100%; flex-wrap: wrap; align-content: center; }
.book3d { overflow: hidden; width: 7.2rem; height: 9.4rem; border-radius: 0.3rem 0.7rem 0.7rem 0.3rem; background: linear-gradient(135deg, #3730a3, #7e22ce); border-left: 6px solid #818cf8; color: #fff; padding: 0.8rem 0.7rem; display: flex; flex-direction: column; box-shadow: 10px 14px 28px -10px rgba(49, 46, 129, 0.7); transform: rotate(-4deg) scale(0.6); opacity: 0; }
.scene.is-active .book3d { animation: bookIn 0.7s cubic-bezier(.2, .9, .3, 1.2) forwards; animation-delay: 0.3s; }
@keyframes bookIn { to { opacity: 1; transform: rotate(-4deg) scale(1); } }
.s5-info { min-width: 11rem; text-align: left; }
.s5-line { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.78rem; padding: 0.38rem 0; border-bottom: 1px dashed #e2e8f0; opacity: 0; }
.scene.is-active .s5-line { animation: rowIn 0.4s ease forwards; animation-delay: calc(1s + var(--i) * 0.35s); }
.s5-road { position: absolute; left: 1.5rem; right: 1.5rem; bottom: 1.6rem; height: 2.2rem; }
.s5-road::before { content: ''; position: absolute; left: 1.4rem; right: 1.6rem; top: 1.25rem; border-top: 2px dashed #c7d2fe; }
.s5-truck { position: absolute; left: 0; top: 0; font-size: 1.15rem; color: #4f46e5; opacity: 0; }
.scene.is-active .s5-truck { animation: truckGo 2.2s ease-in-out forwards; animation-delay: 2.4s; }
@keyframes truckGo { 0% { opacity: 1; left: 0; } 100% { opacity: 1; left: calc(100% - 4.2rem); } }
.s5-home { position: absolute; right: 0; top: 0; font-size: 1.15rem; color: #16a34a; }
.s5-done { position: absolute; right: 2rem; top: -1.25rem; font-size: 0.7rem; font-weight: 800; color: #166534; background: #dcfce7; border-radius: 9999px; padding: 0.15rem 0.55rem; opacity: 0; }
.scene.is-active .s5-done { animation: popIn 0.4s ease forwards; animation-delay: 4.6s; }

/* Small screens: shrink the demo so nothing wraps or overflows */
@media (max-width: 640px) {
  .demo-stage { height: 27rem; }
  .s5-wrap .book3d span.text-\[15px\] { font-size: 12.5px; }
  .scene { padding: 0.8rem; }
  .s1-grid { grid-template-columns: 8.2rem 1fr; gap: 0.6rem; }
  .s1-row { font-size: 0.66rem; }
  .s2-page { font-size: 0.78rem; padding: 0.8rem; }
  .s3-page { font-size: 0.78rem; }
  .s5-info { min-width: 9rem; }
  .book3d { width: 6rem; height: 8rem; }
}

/* ---------- FAQ ---------- */
.faq details { border: 1px solid #e2e8f0; border-radius: 1rem; background: #fff; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.faq details[open] { border-color: #a5b4fc; box-shadow: 0 10px 30px -18px rgba(79, 70, 229, 0.45); }
.faq summary { cursor: pointer; list-style: none; padding: 1.1rem 1.25rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus { flex-shrink: 0; width: 1.6rem; height: 1.6rem; border-radius: 9999px; background: #eef2ff; color: #4f46e5; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; transition: transform 0.2s ease; }
.faq details[open] summary .plus { transform: rotate(45deg); }
.faq .ans { padding: 0 1.25rem 1.2rem; color: #475569; line-height: 1.7; font-size: 0.95rem; }

/* ---------- Study-material pages ---------- */
.prose-lib h2 { font-size: 1.6rem; font-weight: 800; color: #0f172a; letter-spacing: -0.01em; margin: 2.6rem 0 0.8rem; }
.prose-lib h3 { font-size: 1.15rem; font-weight: 800; color: #1e293b; margin: 1.6rem 0 0.5rem; }
.prose-lib p { color: #475569; line-height: 1.8; margin: 0.7rem 0; }
.prose-lib ul { margin: 0.6rem 0 1rem 0; padding: 0; list-style: none; }
.prose-lib ul li { position: relative; padding-left: 1.5rem; margin: 0.45rem 0; color: #475569; line-height: 1.7; }
.prose-lib ul li::before { content: ''; position: absolute; left: 0.2rem; top: 0.62rem; width: 0.45rem; height: 0.45rem; border-radius: 9999px; background: #6366f1; }
.prose-lib table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.4rem; font-size: 0.92rem; background: #fff; border-radius: 0.8rem; overflow: hidden; border: 1px solid #e2e8f0; }
.prose-lib th { background: #eef2ff; color: #312e81; text-align: left; font-weight: 800; padding: 0.65rem 0.9rem; border-bottom: 1px solid #c7d2fe; }
.prose-lib td { padding: 0.6rem 0.9rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: top; }
.prose-lib tr:last-child td { border-bottom: none; }
.prose-lib a { color: #4f46e5; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.table-wrap { overflow-x: auto; }
.toc a { display: block; padding: 0.4rem 0.7rem; border-radius: 0.5rem; font-size: 0.85rem; font-weight: 600; color: #475569; border-left: 2px solid #e2e8f0; }
.toc a:hover { color: #4338ca; background: #eef2ff; border-left-color: #6366f1; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .animate-float, .animate-pulse-slow { animation: none !important; }
  .scene.is-active, .scene.is-active * { animation-duration: 0.01s !important; animation-delay: 0s !important; }
  .demo-step.is-active .bar { animation: none; width: 100%; }
  .card-lift, .card-lift:hover { transition: none; transform: none; }
}
