/* Progressive reading is mobile-only. The photographed desktop remains intact. */
.mobile-home, .mobile-skip { display:none; }
@media (max-width:760px) {
  html:has(body.homepage) { background:#e8e5dc; color-scheme:light; }
  body.homepage {
    color-scheme:light; --ground:#e8e5dc; --ink:#20344c; --quiet:#536172;
    --accent:#98751c; --rule:#20344c26; --footer:#e8e5dcf5;
    height:auto; min-height:100svh; overflow:auto;
  }
  body.homepage::before { background:radial-gradient(ellipse at 70% 20%,#fffdf133,transparent 70%); }
  .homepage .grain { mix-blend-mode:multiply; opacity:.018; }
  .homepage .prototype-current { position:relative; inset:auto; }
  .homepage .paper-scene, .homepage .desktop-skip { display:none; }
  .homepage .mobile-skip { display:block; }
  .homepage .prototype-masthead,
  .homepage.reading-layout .prototype-masthead,
  .homepage:not(.scene-ready) .prototype-masthead {
    position:relative; inset:auto; width:calc(100% - 48px); margin:0 auto;
    max-width:650px; border-bottom:1px solid var(--rule);
  }
  .mobile-home { display:block; max-width:650px; }
  /* The machine never stretches. The paper can extend upward for long copy,
     font substitution or text zoom, rather than clipping or shrinking text. */
  .mobile-typewriter-header {
    container-type:inline-size;
    width:min(100%,460px); margin:24px auto 28px;
  }
  .mobile-typewriter-sheet {
    position:relative; isolation:isolate;
    display:grid; grid-template-rows:minmax(32.184cqw,auto) 43.104cqw;
  }
  .mobile-typewriter-sheet::before {
    content:""; position:absolute; z-index:1;
    top:.805cqw; bottom:43.104cqw; left:14.95%; right:15.52%;
    /* Reuse only the blank paper texture; no new image or altered artwork. */
    background:#d9bea0 url('/assets/typewriter-mobile.png') center 2% / 143.82% 250% no-repeat;
  }
  .mobile-typewriter {
    display:block; grid-area:1 / 1 / 3 / 2; align-self:end;
    width:100%; height:auto; margin:0; z-index:0;
  }
  .mobile-paper-copy {
    grid-area:1 / 1 / 2 / 2; align-self:center; z-index:2;
    width:64%; margin:0 auto; padding:3cqw 0;
    color:#20344c; text-align:center;
    font:400 clamp(.75rem,3.48cqw,1rem)/1.25 "secret-service-typewriter","Courier New",monospace;
    letter-spacing:-.025em; overflow-wrap:anywhere;
  }
  .mobile-chapter-heading { font:inherit; letter-spacing:inherit; text-wrap:wrap; margin:0; padding:0; border:0; }
  .mobile-chapter-number, .mobile-chapter-title { display:block; }
  .mobile-chapter-teaser { font:inherit; letter-spacing:inherit; margin:2cqw 0 0; }
  .mobile-home .rich-content { padding:0; max-width:none; }
  .mobile-home .entry-body {
    font:400 23px/1.65 var(--type); letter-spacing:-.025em;
    white-space:pre-wrap; overflow-wrap:anywhere; max-width:none;
  }
  .mobile-home :is(li, blockquote) { font:400 23px/1.65 var(--type); overflow-wrap:anywhere; }
  .mobile-home .margin-note :is(li, blockquote) { font:inherit; letter-spacing:inherit; }
  .mobile-home pre { max-width:100%; overflow-x:auto; }
  .mobile-home .rich-figure img { max-width:100%; }
  .mobile-home .archive { display:block; max-width:650px; margin:64px auto 0; padding:38px 0 calc(130px + env(safe-area-inset-bottom)); }
  .mobile-home .archive-heading { padding:0; margin:0 0 44px; }
  .mobile-home .fragments a { font-size:21px; overflow-wrap:anywhere; }
  .homepage .permanent,
  .homepage.reading-layout .permanent,
  .homepage:not(.scene-ready) .permanent { position:fixed; inset:auto 0 0; padding-bottom:env(safe-area-inset-bottom); }
  .homepage .footer-inner { max-width:650px; border-top:1px solid var(--rule); }
  .mobile-typing-source {
    position:absolute!important; width:1px!important; height:1px!important;
    padding:0!important; margin:-1px!important; overflow:hidden!important;
    clip:rect(0,0,0,0); clip-path:inset(50%); white-space:normal;
  }
  .mobile-typed-visual { overflow-anchor:none; }
}
@media print {
  .mobile-typed-visual { display:none!important; }
  .mobile-post-source { position:static!important; width:auto!important; height:auto!important; margin:0!important; overflow:visible!important; clip:auto!important; clip-path:none!important; }
}

/* Printing keeps the full chapter when the dialog changes the viewport width. */
@media print {
  .homepage.printing-mobile-home .mobile-home { display:block; width:100%; max-width:none; }
  .homepage.printing-mobile-home .paper-scene,
  .homepage.printing-mobile-home .mobile-typewriter { display:none!important; }
  .homepage.printing-mobile-home .mobile-typewriter-header { display:block; width:auto; margin:0 0 24px; }
  .homepage.printing-mobile-home .mobile-typewriter-sheet { display:block; }
  .homepage.printing-mobile-home .mobile-typewriter-sheet::before { display:none; }
  .homepage.printing-mobile-home .mobile-paper-copy { width:auto; padding:0; color:#20344c; font:400 16px/1.4 var(--type); text-align:left; }
  .homepage.printing-mobile-home .mobile-chapter-heading { font:inherit; letter-spacing:inherit; margin:0; padding:0; border:0; }
  .homepage.printing-mobile-home .mobile-chapter-number,
  .homepage.printing-mobile-home .mobile-chapter-title { display:block; }
  .homepage.printing-mobile-home .mobile-chapter-teaser { font:inherit; margin:8px 0 0; }
  .homepage.printing-mobile-home .rich-content { padding:0; max-width:none; }
  .homepage.printing-mobile-home .entry-body { font:400 20px/1.6 var(--type); white-space:pre-wrap; }
  .homepage.printing-mobile-home .margin-note .entry-body { font:inherit; }
}
