/* Die Verwandlung — its own look: a 1915 German booklet. Paper, ink, upright roman titles.
   The walls of the room close in around the text as the story goes on, and open again for the tram ride.
   Everything is scoped to html[data-book="metamorphosis"]. */
@import url('/fonts/book-metamorphosis.css');

html[data-book="metamorphosis"] { --wall: #3b2a1c; }
html[data-book="metamorphosis"]:is([lang=en],[lang=es],[lang=pt],[lang=fr],[lang=de],[lang=it],[lang=pl],[lang=cs],[lang=hr],[lang=tr],[lang=id],[lang=ru],[lang=sr]) { --body: 'Spectral', 'Literata', Georgia, serif; }

html[data-book="metamorphosis"] body[data-theme='paper'] { --bg: #ebe4d6; --ink: #1c1712; --muted: #6e6354; --accent: #8a2e1c; --card: rgba(246, 241, 231, .92); --line: rgba(28, 23, 18, .16); }
html[data-book="metamorphosis"] body[data-theme='brown'] { --bg: #d6c6aa; --ink: #22190f; --muted: #614f3b; --accent: #7a3218; --card: rgba(234, 223, 202, .93); --line: rgba(34, 25, 15, .18); }
html[data-book="metamorphosis"] body[data-theme='ash']   { --bg: #1a1714; --ink: #e6dccd; --muted: #948776; --accent: #c06a54; --card: rgba(26, 22, 19, .88); }

/* ---------- titles: upright, spaced roman caps like a 1915 title page (readable in every alphabet) ---------- */
html[data-book="metamorphosis"] :is(.cover h1, .part h2, .fin h2) { font-style: normal; font-weight: 500; letter-spacing: .02em; }
html[data-book="metamorphosis"] .h { font-style: normal; font-weight: 600; letter-spacing: .01em; }
html[data-book="metamorphosis"] .p.drop::first-letter { font-style: normal; font-weight: 500; }
html[data-book="metamorphosis"] .cover h1 { font-size: clamp(48px, 9vw, 150px); line-height: 1; }

/* part headers: the title page of a small book, inside a ruled frame */
html[data-book="metamorphosis"] .part { min-height: 96vh; }
html[data-book="metamorphosis"] .part::before { content: ''; position: absolute; inset: 14vh max(6vw, calc(50% - 22rem)); border: 1px solid var(--line); outline: 1px solid var(--line); outline-offset: 7px; pointer-events: none; }
html[data-book="metamorphosis"] .part-n { -webkit-text-stroke: 0; color: var(--ink); opacity: .07; font-size: clamp(260px, 40vw, 560px); }
html[data-book="metamorphosis"] .part h2 { font-size: clamp(64px, 9.5vw, 140px); }
html[data-book="metamorphosis"] .part .kicker { letter-spacing: .4em; }
html[data-book="metamorphosis"] .h { text-align: center; }
html[data-book="metamorphosis"] .h::before { margin: 0 auto .7em; width: 1px; height: 34px; }

/* "The ceiling": Gregor has learned to hang from it */
html[data-book="metamorphosis"] .h[data-i="35"].reveal { transform: rotate(180deg) translateY(22px); }
html[data-book="metamorphosis"] .h[data-i="35"].reveal.in { transform: rotate(180deg); transition: opacity .9s ease, transform 1.6s cubic-bezier(.6, 0, .2, 1); }

/* quotes: a ruled box like a page of the 1915 booklet */
html[data-book="metamorphosis"] .q:not(.hero) blockquote::before { content: '»'; font-size: 1.2em; height: auto; line-height: 1; margin-bottom: .2em; }
html[data-book="metamorphosis"] .q.hero blockquote::before { content: none; }

/* characters: oval portraits, like family photographs */
html[data-book="metamorphosis"] .char { border-radius: 2px; text-align: center; }
html[data-book="metamorphosis"] .char svg { width: 74px; height: 92px; padding: 18px 14px; border: 1px solid var(--line); border-radius: 50%; box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--ink) 4%, transparent); }
html[data-book="metamorphosis"] .char.main { display: block; }
html[data-book="metamorphosis"] .char.main svg { width: 96px; height: 120px; padding: 24px 20px; }

/* timeline: tear-off calendar sheets */
html[data-book="metamorphosis"] .tl { padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; max-width: 64rem; }
html[data-book="metamorphosis"] .tl::before { content: none; }
html[data-book="metamorphosis"] .tl-i { padding: 0 1em 1.1em; background: var(--card); border: 1px solid var(--line); border-top: 0; }
html[data-book="metamorphosis"] .tl-i::before { position: static; display: block; width: auto; height: 6px; border: 0; border-radius: 0; margin: 0 -1em 1em; background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 14px); }

/* ---------- the walls ---------- */
html[data-book="metamorphosis"] .step { padding-inline: calc(clamp(16px, 6vw, 100px) + var(--wallw, 0px)); transition: padding .3s; }
html[data-book="metamorphosis"] .dots { inset-inline-end: calc(18px + var(--wallw, 0px)); }
.m-walls i { position: fixed; z-index: 30; pointer-events: none; background: var(--wall); transition: width 1.2s ease, height 1.2s ease, opacity 1.2s;
  background-image: repeating-linear-gradient(90deg, rgba(255, 230, 190, .05) 0 2px, transparent 2px 22px), radial-gradient(circle at 50% 50%, rgba(255, 230, 190, .06) 0 2px, transparent 3px);
  background-size: auto, 22px 30px; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
.m-walls .w-l { left: 0; top: 0; bottom: 0; width: 0; }
.m-walls .w-r { right: 0; top: 0; bottom: 0; width: 0; }
.m-walls .w-t { left: 0; right: 0; top: 0; height: 0; }
.m-walls .w-b { left: 0; right: 0; bottom: 0; height: 0; }
.m-walls .w-l::after, .m-walls .w-r::after { content: ''; position: absolute; top: 0; bottom: 0; width: 18px; }
.m-walls .w-l::after { right: 0; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .35)); }
.m-walls .w-r::after { left: 0; background: linear-gradient(-90deg, transparent, rgba(0, 0, 0, .35)); }

/* the apple that stays in his back */
.m-apple { position: fixed; z-index: 31; top: 58%; right: 0; width: 46px; height: 46px; pointer-events: none; opacity: 0; transform: translate(40%, 0) rotate(-18deg) scale(.6); transition: opacity .6s, transform .7s cubic-bezier(.3, 1.5, .5, 1), right 1.2s ease, filter 1.2s; }
.m-apple.on { opacity: 1; transform: translate(40%, 0) rotate(-18deg); }
.m-apple svg { width: 100%; height: 100%; display: block; }
@media (max-width: 760px) { .m-apple { width: 30px; height: 30px; } }

@media (prefers-reduced-motion: reduce) {
  html[data-book="metamorphosis"] .h[data-i="35"].reveal { transform: rotate(180deg) !important; }
}
