/* Reading flow is the baseline. JavaScript opts into the photographed scene. */
.homepage:not(.scene-ready) { height:auto; min-height:100svh; overflow:auto; }
.homepage:not(.scene-ready) .prototype-current { position:relative; inset:auto; }
.homepage:not(.scene-ready) .prototype-masthead { position:relative; inset:auto; width:calc(100% - 48px); margin:24px auto 40px; }
.homepage:not(.scene-ready) .paper-scene { position:relative; inset:auto; width:calc(100% - 48px); height:auto; margin:0 auto 45px; overflow:visible; }
.homepage:not(.scene-ready) .paper-scene img { display:none; }
.homepage:not(.scene-ready) .paper-message { position:relative; inset:auto; transform:none; display:block; width:100%; max-width:650px; height:auto; margin:auto; padding:28px; color:var(--ink); background:#e9d3b5; }
.homepage:not(.scene-ready) .paper-heading h1 { white-space:normal; text-wrap:wrap; overflow-wrap:anywhere; }
.homepage:not(.scene-ready) .paper-body-wrap { margin-top:38px; }
.homepage:not(.scene-ready) .permanent { position:relative; inset:auto; padding:15px 0 28px; background:none; }
.homepage .prototype-masthead,.homepage .footer-inner { flex-wrap:wrap; row-gap:8px; }
.homepage .paper-body { overflow-wrap:anywhere; }
.homepage .paper-message:focus-visible { outline:2px solid #21334a; outline-offset:-6px; }
.homepage .compact-note a { color:inherit; text-decoration:underline; }
.homepage .compact-note a:focus-visible { outline:2px solid #21334a; outline-offset:3px; }
.homepage .paper-body-wrap { min-width:0; }
@media print {
 .homepage { height:auto!important; overflow:visible!important; color:#111; background:white; }
 .homepage .prototype-current,.homepage .paper-scene,.homepage .paper-message { position:static!important; width:auto!important; height:auto!important; margin:0!important; transform:none!important; overflow:visible!important; background:white!important; }
 .homepage .paper-message { padding:0!important; display:block!important; }
 .homepage .paper-heading h1 { white-space:normal!important; }
 .homepage .paper-scene img,.homepage .grain,.homepage .prototype-masthead,.homepage .permanent,.homepage .compact-note,.homepage .typing-replay { display:none!important; }
}

/* On narrow or short windows, keep the photograph above a readable excerpt. */
.homepage.reading-layout {height:auto;min-height:100svh;overflow:auto;}
.homepage.reading-layout .prototype-current {position:relative;inset:auto;}
.homepage.reading-layout .prototype-masthead {position:relative;inset:auto;margin:20px 24px;}
.homepage.reading-layout .paper-scene {position:relative;inset:auto;width:100%;height:auto;overflow:visible;}
.homepage.reading-layout .paper-scene > img:not(.moving-ball) {position:relative;left:auto;top:auto;width:100%;height:auto;display:block;}
.homepage.reading-layout .paper-scene img.moving-ball {display:none;}
.homepage.reading-layout .paper-message {position:relative;inset:auto;width:calc(100% - 32px);max-width:650px;height:auto;margin:16px auto;padding:24px;background:#e9d3b5;overflow:visible;}
.homepage.reading-layout .paper-heading h1 {font-size:16px;}
.homepage.reading-layout .paper-body-wrap {margin-top:20px;overflow:visible;}
.homepage.reading-layout .paper-body {font-size:20px;max-height:none;overflow:visible;}
.homepage.reading-layout .paper-actions {margin-top:16px;gap:12px;font-size:14px;}
.homepage.reading-layout .paper-actions .read-chapter-link {font-size:14px;}
.homepage.reading-layout .permanent {position:relative;inset:auto;}
.homepage:not(.scene-ready) .paper-body {max-height:none;overflow:visible;}
.homepage:not(.scene-ready) .paper-body-wrap {overflow:visible;}

/* Compact, matching chrome; narrow screens retain room for wrapped links. */
.homepage { --homepage-bar-height:28px; }
.homepage .prototype-masthead,
.homepage.reading-layout .prototype-masthead,
.homepage:not(.scene-ready) .prototype-masthead {
 inset:0 28px auto; min-height:var(--homepage-bar-height); margin:0;
 width:auto; padding:0; align-items:center;
}
.homepage.reading-layout .prototype-masthead,
.homepage:not(.scene-ready) .prototype-masthead { inset:auto; margin:0 24px; }
.homepage .permanent,
.homepage:not(.scene-ready) .permanent {
 min-height:var(--homepage-bar-height); padding:0; display:flex; align-items:center;
 background:var(--ground);
}
.homepage .footer-inner { min-height:0; padding:0; gap:0 13px; }
.homepage .notebook-link { flex-basis:auto; }
@media(max-width:360px) { .homepage { --homepage-bar-height:48px; } }
