/* Between Bones. Look from the cover: ivory paper, cracked gold bone, thin wide capitals, one gold accent. */

@font-face { font-family: Josefin; src: url(/assets/fonts/josefin.woff2) format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: Montserrat; src: url(/assets/fonts/montserrat.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Delafield; src: url(/assets/fonts/delafield.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Garamond; src: url(/assets/fonts/garamond.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Garamond; src: url(/assets/fonts/garamond-italic.woff2) format('woff2'); font-style: italic; font-display: swap; }
/* fallbacks that take the same room, measured in Chromium against each web font at 100 px; the two sans faces are
   only ever set in capitals here, so they were measured on capitals: Josefin Sans Light 99.9% of Arial (ascent .75,
   descent .25), Montserrat Medium 105.7% (.97, .25); on a mixed sentence EB Garamond is 96.2% of
   Times (1.01, .30), its italic 94.8% of Times italic, Mrs Saint Delafield 80.3% of Times italic (.91, .62) */
@font-face { font-family: 'Josefin fb'; src: local('Arial'), local('Liberation Sans'), local('Helvetica'); size-adjust: 99.9%; ascent-override: 75.1%; descent-override: 25%; line-gap-override: 0%; }
@font-face { font-family: 'Montserrat fb'; src: local('Arial'), local('Liberation Sans'), local('Helvetica'); size-adjust: 105.7%; ascent-override: 91.8%; descent-override: 23.7%; line-gap-override: 0%; }
@font-face { font-family: 'Garamond fb'; src: local('Times New Roman'), local('Liberation Serif'), local('Times'); size-adjust: 96.2%; ascent-override: 105%; descent-override: 31.2%; line-gap-override: 0%; }
@font-face { font-family: 'Garamond fb'; src: local('Times New Roman Italic'), local('Liberation Serif Italic'), local('Times-Italic'); font-style: italic; size-adjust: 94.8%; ascent-override: 106.5%; descent-override: 31.6%; line-gap-override: 0%; }
@font-face { font-family: 'Delafield fb'; src: local('Times New Roman Italic'), local('Liberation Serif Italic'), local('Times-Italic'); size-adjust: 80.3%; ascent-override: 113%; descent-override: 77%; line-gap-override: 0%; }

:root {
  --ivory: #fffcf1; --paper: #fbf5e6; --char: #282828; --night: #181818; --ink: #3a3631;
  --gold: #d99a3a; --gold-t: #a8721f; --gold-l: #e8c060; --bone-d: #7a5524;
  --thin: Josefin, 'Josefin fb', Arial, sans-serif; --label: Montserrat, 'Montserrat fb', Arial, sans-serif;
  --read: Garamond, 'Garamond fb', 'Times New Roman', serif; --script: Delafield, 'Delafield fb', cursive;
  --tape-h: 48px;
}
* { box-sizing: border-box; }
html { background: var(--ivory); color: var(--char); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--read); font-size: 18px; line-height: 1.6; overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
h1, h2 { font-weight: 300; margin: 0; }
p { margin: 0; }
a { color: inherit; }
em { font-style: normal; color: var(--gold-t); }
.sr-only { position: absolute; left: 0; top: 0; margin: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: normal; opacity: 0; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 60; background: var(--char); color: var(--ivory); padding: 12px 16px; font: 500 14px/1 var(--label); text-decoration: none; }
.skip:focus { top: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 30px; border-radius: 2px;
  background: var(--char); color: var(--ivory); font: 500 14px/1 var(--label); letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--char), inset 0 0 0 3px var(--char), inset 0 0 0 4px var(--gold); transition: background .2s, color .2s; }
.btn:hover, .btn:focus-visible { background: var(--gold); color: var(--night); }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-t); outline-offset: 3px; }

/* ---------- the small buy control that stays for the whole page ---------- */
.corner { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 40; display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 4px 16px 4px 4px; background: rgba(255, 252, 241, .92); border: 1px solid rgba(169, 114, 31, .45); border-radius: 2px;
  font: 500 13px/1 var(--label); letter-spacing: .16em; text-transform: uppercase; text-decoration: none; color: var(--char);
  transition: opacity .35s, transform .35s; }
.corner img { width: 29px; height: 44px; box-shadow: 0 2px 6px rgba(40, 30, 10, .25); }
.corner.gone { opacity: 0; pointer-events: none; transform: translateY(-8px); }
html.js .corner { opacity: 0; pointer-events: none; }
html.js .corner.on { opacity: 1; pointer-events: auto; }
html.js .corner.on.gone { opacity: 0; pointer-events: none; }

/* ---------- the story ---------- */
.story { position: relative; }
.stage { position: relative; overflow: hidden; background: var(--ivory); }
html.film .story { height: 1600svh; }
html.film .stage { position: sticky; top: 0; height: 100svh; }
.dark, .ground, .web, .bones, .skull, .frame { display: none; }
html.film .dark, html.film .ground, html.film .web, html.film .bones, html.film .skull, html.film .frame { display: block; }
.dark { position: absolute; inset: 0; background: var(--night); clip-path: inset(100% 0 0 0); }
.surface { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 12%, var(--gold-l) 50%, var(--gold) 88%, transparent); opacity: 0; }
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(to top, rgba(122, 85, 36, .28), rgba(122, 85, 36, 0)); opacity: 0; transform-origin: bottom; }
.web { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.web path { fill: none; stroke: var(--gold); stroke-width: 1.2; stroke-linecap: round; }
.web circle { fill: var(--gold); }
.bones, .skull { position: absolute; inset: 0; pointer-events: none; }
.bone { position: absolute; left: 0; top: 0; width: 100px; height: auto; opacity: 0; will-change: transform, opacity; }
.tag { position: absolute; left: 0; top: 0; font: 500 12px/1.2 var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-t);
  white-space: nowrap; opacity: 0; padding-left: 26px; }
.tag::before { content: ''; position: absolute; left: 0; top: 50%; width: 20px; height: 1px; background: var(--gold); }
.skull img { position: absolute; left: 0; top: 0; max-width: none; opacity: 0; will-change: transform, opacity; }
.skull img:not(.ok) { visibility: hidden; }
.skull.lit .frag { filter: drop-shadow(0 0 5px rgba(232, 192, 96, .5)); }
.dark, .ground { z-index: 1; } .web { z-index: 2; } .hero { z-index: 3; } .frame { z-index: 4; } .bones { z-index: 5; } .skull { z-index: 6; }
html.film .line, html.film .nodes { z-index: 7; }

/* the first bone, already floating where the story starts: placed by the stylesheet so it never moves on load */
html.film .b-forearm { --bw: min(34vw, 54svh); width: var(--bw); left: calc(50% - var(--bw) / 2); top: calc(47% - var(--bw) * .159); opacity: 1; }

/* the opening screen */
.hero { position: relative; height: 100svh; min-height: 520px; }
html.film .hero { position: absolute; inset: 0; min-height: 0; }
.promise { position: absolute; left: 7vw; top: 15svh; font: 500 14px/1.4 var(--label); letter-spacing: .32em; text-transform: uppercase; }
.title { position: absolute; left: 7vw; top: calc(15svh + 34px); font: 300 clamp(44px, 5.6vw, 92px)/.98 var(--thin); letter-spacing: .06em; text-transform: uppercase; }
.title span { display: block; }
.t-gold { color: var(--gold); }
.hero-cta { position: absolute; left: 7vw; top: calc(15svh + 34px + clamp(44px, 5.6vw, 92px) * 2.2); }
.out { margin-top: 14px; font: 500 13px/1 var(--label); letter-spacing: .2em; text-transform: uppercase; color: var(--ink); }
.hero-book { position: absolute; right: 9vw; bottom: 13svh; height: 46svh; }

/* a book made of a cover and its edges: the unaltered cover on the front */
.book3d { aspect-ratio: 2 / 3; perspective: 1400px; }
.b-body { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateY(-24deg) rotateX(4deg); }
.b-body > * { position: absolute; }
.b-front { inset: 0; width: 100%; height: 100%; transform: translateZ(9px); box-shadow: 0 1px 0 rgba(0, 0, 0, .06); }
.b-spine { top: 0; bottom: 0; left: -9px; width: 18px; transform: rotateY(-90deg); background: linear-gradient(90deg, #ece2c8, #fffcf1 45%, #e6dbbf); }
.b-pages { top: 2px; bottom: 2px; right: -8px; width: 16px; transform: rotateY(90deg); background: repeating-linear-gradient(90deg, #f6efdc 0 1px, #e3d8bd 1px 2px); }
.b-back { inset: 0; transform: translateZ(-9px) rotateY(180deg); background: #efe6cf; box-shadow: 18px 26px 40px rgba(60, 40, 10, .28); }
.hero-book::after { content: ''; position: absolute; left: 6%; right: 6%; bottom: -5%; height: 6%; border-radius: 50%; background: radial-gradient(closest-side, rgba(60, 40, 10, .28), transparent); z-index: -1; }

/* the story's lines */
.line { font: 300 clamp(30px, 3.7vw, 58px)/1.08 var(--thin); letter-spacing: .07em; text-transform: uppercase; text-align: center; }
.line .k { font-size: 1.45em; color: var(--gold-t); }
.line .g { color: var(--gold-t); }
.r { display: block; }
html.film .line { position: absolute; left: 0; right: 0; margin: 0 auto; opacity: 0; padding: 0 5vw; pointer-events: none; }
html.film .line .w { display: inline-block; will-change: transform, opacity; }
html.film .line .r { display: block; }
html.film .s1 { top: 68%; }
html.film .s2 { top: 40%; }
html.film .s3 { top: 9%; color: var(--gold-l); }
html.film .s3 .k { color: var(--gold); }
html.film .s4 { top: 41%; }
html.film .s5a { left: 6vw; right: auto; width: 32vw; text-align: left; top: 38%; padding: 0; }
html.film .s5b { left: auto; right: 6vw; width: 34vw; text-align: right; top: 30%; padding: 0; }
.s5b .w-between, .s5b .w-the, .s5b .g { font-size: 1.3em; }
.nodes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 34px; font: 500 15px/1 var(--label); letter-spacing: .32em; text-transform: uppercase; }
.node-k { color: var(--gold-t); font-size: 18px; }
html.film .nodes { display: block; }
html.film .node { position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; white-space: nowrap; background: var(--ivory); padding: 6px 10px; }

/* the cover, rebuilt: lettering sized from the frame's height (--fh), measured on the cover */
.frame { position: absolute; left: 0; top: 0; width: 200px; height: 300px; perspective: 1800px; opacity: 0; pointer-events: none; }
.f-body { position: absolute; inset: 0; transform-style: preserve-3d; }
.f-face { position: absolute; inset: 0; transform: translateZ(calc(var(--fh, 300px) * .02)); }
.frame.booked .f-face { box-shadow: 16px 24px 50px rgba(60, 40, 10, .3); }
.f-cover { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.lk { position: absolute; left: 0; right: 0; text-align: center; white-space: nowrap; text-transform: uppercase; opacity: 0; }
.lk-tag { top: 11.4%; font: 500 calc(var(--fh) * .0243)/1 var(--label); letter-spacing: .2em; }
.lk-between { top: 26.3%; font: 300 calc(var(--fh) * .0878)/1 var(--thin); color: var(--gold); letter-spacing: .06em; }
.lk-bones { top: 37.6%; font: 300 calc(var(--fh) * .138)/1 var(--thin); letter-spacing: .05em; }
.lk-novel { top: 69%; font: calc(var(--fh) * .068)/1 var(--script); color: var(--gold); text-transform: none; clip-path: inset(0 100% 0 0); }
.lk-author { top: 86.6%; font: 300 calc(var(--fh) * .052)/1 var(--thin); letter-spacing: .12em; }
.f-spine { top: 0; bottom: 0; left: calc(var(--fh) * -.02); width: calc(var(--fh) * .04); transform: rotateY(-90deg); background: linear-gradient(90deg, #ece2c8, #fffcf1 45%, #e6dbbf); }
.f-pages { top: .6%; bottom: .6%; right: calc(var(--fh) * -.018); width: calc(var(--fh) * .036); transform: rotateY(90deg); background: repeating-linear-gradient(90deg, #f6efdc 0 1px, #e3d8bd 1px 2px); }
.f-back { inset: 0; transform: translateZ(calc(var(--fh) * -.02)) rotateY(180deg); background: #efe6cf; }
.f-spine, .f-pages, .f-back { position: absolute; backface-visibility: hidden; }
.b-spine, .b-pages, .b-back { backface-visibility: hidden; }

/* the still story (no JavaScript, or reduced motion): every line in order, with the bones as still pictures */
.still-art { width: min(70vw, 420px); margin: 0 auto; }
.still-skull { width: min(56vw, 300px); }
html.film .still-art { display: none; }
html:not(.film) .line, html:not(.film) .nodes { margin: 14svh auto; max-width: 900px; padding: 0 24px; }
html:not(.film) .s3 { background: var(--night); color: var(--gold-l); padding: 12svh 24px; max-width: none; margin: 0; }
html:not(.film) .frame { display: none; }

/* ---------- the reveal panel: rises over the last screen of the story ---------- */
.own { position: relative; z-index: 2; padding: 10svh 7vw; }
.own-cover { width: min(60vw, 300px); height: auto; margin: 0 auto 40px; box-shadow: 12px 18px 40px rgba(60, 40, 10, .25); }
html.film .own-cover { display: none; }
html.film .own { margin-top: -100svh; min-height: 100svh; display: flex; align-items: center; padding: 8svh 6vw calc(var(--tape-h) + 6svh) 54vw; }
.own-in { max-width: 520px; }
.own h2 { font: 300 clamp(32px, 3.2vw, 50px)/1.1 var(--thin); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 22px; }
.synopsis { font-size: 19px; line-height: 1.6; color: var(--ink); }
.price { margin-top: 22px; font: 500 14px/1.5 var(--label); letter-spacing: .14em; text-transform: uppercase; }
.own .btn { margin-top: 18px; }
.small { margin-top: 12px; font: 500 13px/1 var(--label); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-t); }

/* ---------- the first fragment ---------- */
.fragment { padding: 14svh 6vw 10svh; background: linear-gradient(var(--ivory), var(--paper) 18%); }
.page { max-width: 620px; margin: 0 auto; text-align: center; }
.ornament { width: 150px; margin: 0 auto; }
.tag-still { margin-top: 10px; font: 500 12px/1 var(--label); letter-spacing: .24em; text-transform: uppercase; color: var(--gold-t); }
.fragment h2 { margin: 18px 0 34px; font: 300 clamp(30px, 3vw, 44px)/1.1 var(--thin); text-transform: uppercase; letter-spacing: .08em; }
.excerpt { text-align: left; font-size: 19px; line-height: 1.75; }
.excerpt p + p { margin-top: 1em; text-indent: 1.4em; }
.excerpt p:first-child::first-letter { font: 300 3.4em/.8 var(--thin); float: left; margin: .08em .1em 0 0; color: var(--gold-t); }
.more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 30px; font: 500 14px/1.3 var(--label); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-t); text-underline-offset: 6px; }
.fragment .btn { margin-top: 18px; }

/* ---------- the catalogue ---------- */
.calm { background: var(--paper); padding: 4svh 6vw calc(var(--tape-h) + 40px); }
.calm > div { max-width: 1040px; margin: 0 auto; padding: 9svh 0; border-top: 1px solid rgba(169, 114, 31, .4); }
.calm h2 { font: 300 clamp(28px, 2.6vw, 40px)/1.15 var(--thin); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 22px; }
.buy-block { display: grid; grid-template-columns: 200px 1fr; gap: 56px; align-items: center; }
.calm-book { width: 200px; }
.readers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 40px; }
.readers h2 { grid-column: 1 / -1; }
.readers figure { margin: 0; }
.readers blockquote { margin: 0; font-size: 20px; line-height: 1.5; font-style: italic; }
.readers figcaption { margin-top: 12px; font: 500 12px/1.4 var(--label); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-t); }
.letters p { max-width: 560px; }
.mail { display: grid; grid-template-columns: minmax(0, 360px) auto; gap: 10px 12px; margin-top: 26px; max-width: 640px; }
.mail label { grid-column: 1 / -1; font: 500 13px/1 var(--label); letter-spacing: .16em; text-transform: uppercase; }
.mail input { height: 52px; padding: 0 16px; border: 1px solid #b9a77f; border-radius: 2px; background: #fffdf7; font: 18px var(--read); color: var(--char); }
.form-note { grid-column: 1 / -1; min-height: 1.6em; font-size: 17px; color: var(--ink); }
.author p { max-width: 640px; }
.link-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 18px; padding: 0 22px; border: 1px solid var(--char); border-radius: 2px;
  font: 500 13px/1 var(--label); letter-spacing: .16em; text-transform: uppercase; text-decoration: none; }
.rest { width: min(64vw, 380px); margin: 44px auto 0; opacity: .95; }
.foot { max-width: 1040px; margin: 0 auto; padding-top: 24px; font-size: 16px; color: var(--ink); text-align: center; }

/* ---------- phones, and any screen taller than it is wide: designed for the hand that holds it ---------- */
@media (max-aspect-ratio: 9/10) {
  body { font-size: 17px; }
  html.film .b-forearm { --bw: min(74vw, 480px); top: calc(25.5svh - var(--bw) * .159); }
  .promise { left: 0; right: 0; top: 4.5svh; text-align: center; font-size: 13px; letter-spacing: .3em; }
  .title { left: 0; right: 0; top: calc(4.5svh + 28px); text-align: center; font-size: clamp(40px, 12.4vw, 66px); }
  .hero-book { right: auto; left: calc(50% - min(14svh, 30.6vw)); top: 27svh; bottom: auto; height: min(42svh, 92vw); }
  html.film .story { height: 1400svh; }
  .hero-cta { left: 24px; right: 24px; top: auto; bottom: calc(var(--tape-h) + 4svh); text-align: center; }
  .hero-cta .btn { width: 100%; max-width: 440px; }
  .line { font-size: clamp(28px, 8.4vw, 44px); }
  html.film .line { padding: 0 22px; }
  html.film .s1, html.film .s2, html.film .s3, html.film .s4 { top: 5svh; }
  html.film .s5a, html.film .s5b { left: 0; right: 0; width: auto; text-align: center; top: 5svh; padding: 0 22px; }
  html.film .s5b .w-between { display: block; }
  .node { font-size: 14px; }
  .own { padding: 8svh 24px; }
  html.film .own { margin-top: -54svh; min-height: 54svh; display: block; padding: 2svh 24px 6svh; }
  .own-in { margin: 0 auto; max-width: 480px; }
  .own h2 { font-size: clamp(26px, 7.4vw, 36px); margin-bottom: 14px; }
  .synopsis { font-size: 17px; }
  .btn-wide { width: 100%; max-width: 440px; }
  .fragment { padding: 12svh 24px 8svh; }
  .excerpt { font-size: 18px; }
  .calm { padding: 2svh 24px calc(var(--tape-h) + 32px); }
  .buy-block { grid-template-columns: 1fr; gap: 26px; text-align: center; }
  .calm-book { width: 150px; margin: 0 auto; }
  .readers { grid-template-columns: 1fr; }
  .mail { grid-template-columns: 1fr; }
  /* on a phone the corner control sits in the thumb's reach, above the tape, clear of the story's lines at the top */
  .corner { top: auto; bottom: calc(var(--tape-h) + 12px); right: 12px; }
  html:not(.js) .corner { display: none; }
  /* after the story every section has its own full-width button, and the control would sit over the reading text */
  html.js.past-story .corner.on, html.js.still-past .corner.on { opacity: 0; pointer-events: none; }
}

/* ---------- concept tape ---------- */
.tape { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: var(--tape-h); display: flex; align-items: center; gap: 8px;
  padding: 0 8px env(safe-area-inset-bottom); background: rgba(250, 204, 21, .92); color: #111; font: 700 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif; pointer-events: none; }
.tape-run { flex: 1; overflow: hidden; height: 22px; display: flex; align-items: center; border-radius: 3px;
  background: repeating-linear-gradient(135deg, rgba(0, 0, 0, .08) 0 10px, transparent 10px 20px); }
.tape-track { display: flex; white-space: nowrap; animation: tape 40s linear infinite; }
.tape-track span { padding: 0 1.2em; letter-spacing: .04em; text-transform: uppercase; }
.tape.paused .tape-track { animation-play-state: paused; }
@keyframes tape { to { transform: translateX(-50%); } }
.tape-pause { pointer-events: auto; flex: none; width: 44px; height: 44px; border: 0; padding: 0; border-radius: 8px; background: #111; color: #facc15; display: grid; place-items: center; cursor: pointer; }
.tape-pause span { display: grid; place-items: center; }
.tape-cta { pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border-radius: 8px;
  background: #111; color: #facc15; text-decoration: none; font: 700 12px/1.15 system-ui, -apple-system, "Segoe UI", sans-serif; white-space: nowrap; }
.tape-cta small { font-size: 12px; font-weight: 500; color: #fff; }
@media (prefers-reduced-motion: reduce) { .tape-track { animation: none; } html { scroll-behavior: auto; } }
