/* My Home Booklet walkthrough */
:root { --navy: #1f3a5f; --navy2: #2c5282; --copper: #b8682f; --bg: #f6f4ef; --line: #e3e0d8; --muted: #646b75; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: #22252a; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.demo { min-height: 100%; display: flex; flex-direction: column; }
.stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 48px; padding: 28px 20px; flex-wrap: wrap; }

/* phone */
.phone { width: 300px; height: 600px; border-radius: 44px; background: #111; padding: 12px; box-shadow: 0 20px 60px rgba(20,30,50,.25); position: relative; flex: 0 0 auto; }
.notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 92px; height: 24px; border-radius: 14px; background: #111; z-index: 3; }
.screen { position: relative; height: 100%; border-radius: 34px; overflow: hidden; background: var(--bg); }
.appbar { background: var(--navy); color: #fff; padding: 46px 16px 12px; }
.appbar b { display: block; font-size: 16px; }
.appbar span { font-size: 11px; opacity: .8; }

.scene { position: absolute; inset: 104px 0 0; padding: 12px; opacity: 0; transform: translateX(24px); transition: opacity .45s, transform .45s; pointer-events: none; }
.scene.on { opacity: 1; transform: none; }

.card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(20,30,50,.06), 0 4px 16px rgba(20,30,50,.05); }
.center { text-align: center; }
.h { font-weight: 700; color: var(--navy); font-size: 17px; margin-bottom: 6px; }
.h.sm { font-size: 15px; }
.m { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.eyebrow { color: var(--copper); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.btn { background: var(--navy); color: #fff; border-radius: 10px; text-align: center; padding: 10px; font-weight: 600; font-size: 14px; margin-top: 12px; position: relative; }
.field { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; margin-top: 8px; font-size: 12px; }
.field span { display: block; color: var(--muted); font-size: 10px; }
.field b { font-size: 13px; }
.row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.row b { color: var(--navy); }

/* mail */
.mail-top { font-weight: 700; font-size: 18px; margin: 0 4px 8px; }
.mail-card { background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 8px; font-size: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.mail-card p { margin: 6px 0; color: #444; }
.mail-from { font-weight: 700; }
.mail-subj { color: var(--navy); font-weight: 600; }

/* code */
.code { display: flex; gap: 6px; justify-content: center; margin: 6px 0 4px; }
.code i { font-style: normal; width: 32px; height: 42px; border: 1px solid #cfcbc2; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--navy); opacity: 0; }
.on .code i { animation: digit .3s forwards; }
.on .code i:nth-child(1) { animation-delay: .6s; } .on .code i:nth-child(2) { animation-delay: .9s; } .on .code i:nth-child(3) { animation-delay: 1.2s; }
.on .code i:nth-child(4) { animation-delay: 1.5s; } .on .code i:nth-child(5) { animation-delay: 1.8s; } .on .code i:nth-child(6) { animation-delay: 2.1s; }
@keyframes digit { to { opacity: 1; } }

/* typing */
.type { display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom; max-width: 0; }
.on .type { animation: type 1.4s .5s steps(24) forwards; }
@keyframes type { to { max-width: 100%; } }
.grow { opacity: 0; }
.on .grow { animation: digit .4s forwards; }
.on .g1 { animation-delay: 2.1s; } .on .g2 { animation-delay: 2.4s; } .on .g3 { animation-delay: 2.7s; }

/* photos */
.photos { display: flex; gap: 8px; margin-top: 10px; }
.ph { width: 64px; height: 64px; border-radius: 10px; background: linear-gradient(135deg, #cfd6df, #9aa7b6); position: relative; }
.ph::after { content: ""; position: absolute; left: 22%; top: 18%; width: 3px; height: 60%; background: #5b6470; transform: rotate(28deg); border-radius: 2px; }
.ph.add { background: #fff; border: 2px dashed #cfcbc2; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 24px; }
.ph.add::after { display: none; }
.pop { transform: scale(0); }
.on .pop { animation: pop .4s 1.9s forwards; }
.on .pop.d2 { animation-delay: 2.3s; }
@keyframes pop { 70% { transform: scale(1.08); } to { transform: scale(1); } }

/* tap ripple */
.tap::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: rgba(255,255,255,.7); opacity: 0; }
.on .tap::after { animation: tap .8s 3.4s 2; }
@keyframes tap { 0% { opacity: .9; transform: scale(.3); } 100% { opacity: 0; transform: scale(3); } }

/* options + toast */
.opt { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: 13px; position: relative; padding-left: 32px; }
.opt::before { content: ""; position: absolute; left: 10px; top: 12px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #9aa3ad; }
.opt.on::before, .on .opt.on::before { border-color: var(--navy2); background: radial-gradient(var(--navy2) 45%, #fff 50%); }
.opt small { display: block; color: var(--muted); font-size: 11px; }
.toast { position: absolute; left: 12px; right: 12px; bottom: 18px; background: #e8f4ec; color: #2f7d4f; border-radius: 10px; padding: 10px 12px; font-size: 12px; opacity: 0; transform: translateY(12px); }
.on .toast { animation: toast .5s 4.2s forwards; }
@keyframes toast { to { opacity: 1; transform: none; } }

/* facts */
.fact { border-top: 1px solid var(--line); padding: 8px 0; font-size: 12px; position: relative; }
.fact span { display: block; color: var(--muted); font-size: 10px; }
.thumb { position: absolute; right: 0; top: 8px; width: 40px; height: 40px; border-radius: 8px; background: linear-gradient(135deg, #b9c6d6, #7f91a8); }
.fact.f1 b { display: block; padding-right: 48px; }
.on .thumb { animation: pop .4s 1s forwards; }

/* mail slide-in */
.slide { opacity: 0; transform: translateY(-14px); }
.on .slide { animation: toast .5s .5s forwards; }
.on .slide.d2 { animation-delay: 1.6s; }

/* home screen */
.homescreen { position: absolute; inset: -104px 0 0; background: linear-gradient(160deg, #345a86, #b8682f); padding: 70px 20px; }
.apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 12px; }
.apps i { display: block; aspect-ratio: 1; border-radius: 13px; background: rgba(255,255,255,.35); }
.myapp { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-size: 10px; font-weight: 600; font-style: normal; white-space: nowrap; }
.myapp em { width: 100%; aspect-ratio: 1; border-radius: 13px; background: #1f3a5f url("../icon-192.png") center/cover; box-shadow: 0 0 0 3px rgba(255,255,255,.9); }
.on .myapp { animation: pop .5s 1s forwards; }

/* lock */
.lock { width: 56px; height: 56px; margin: 6px auto 10px; border-radius: 14px; background: var(--navy); position: relative; }
.lock::before { content: ""; position: absolute; left: 17px; top: -12px; width: 22px; height: 24px; border: 5px solid var(--navy); border-bottom: 0; border-radius: 14px 14px 0 0; }
.lock::after { content: ""; position: absolute; left: 24px; top: 20px; width: 8px; height: 14px; border-radius: 4px; background: #fff; }

/* captions */
.captions { max-width: 380px; }
.step { color: var(--copper); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.captions h1 { color: var(--navy); font-size: 30px; line-height: 1.2; margin: 6px 0 12px; }
.captions p { font-size: 18px; color: #3a3f46; margin: 0 0 22px; min-height: 5.6em; }
.controls { display: flex; gap: 10px; }
.controls button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid #c9cfd8; background: #fff; color: var(--navy); font-size: 20px; cursor: pointer; }
.controls button:hover { background: #eef2f7; }
.bar { height: 5px; background: #e3e0d8; }
.bar span { display: block; height: 100%; width: 0; background: var(--copper); }
.paused .scene * { animation-play-state: paused !important; }

/* small screens and in-app embed: phone above captions */
@media (max-width: 720px) {
	.stage { gap: 18px; padding: 16px; }
	.phone { width: 250px; height: 500px; border-radius: 38px; }
	.screen { border-radius: 28px; }
	.captions { text-align: center; }
	.captions h1 { font-size: 22px; }
	.captions p { font-size: 16px; min-height: 6.5em; margin-bottom: 14px; }
	.controls { justify-content: center; }
}
html.embed body { background: #fff; }
@media (prefers-reduced-motion: reduce) { .scene { transition: none; } }
