/*
  VOICE   Literary, a little theatrical: a book jacket, not a web app.
  IDEA    Two worlds side by side. Each book lives in its own colour world taken from its cover:
          Ghostblood's rust-red desert city, North Star's violet ice. White pages and black type between them.
  PICTURE The covers themselves, set on a blurred, full-bleed field of their own art (as on the Wix site).
  TYPE    Bodoni Moda italic for the wordmark and titles (the old site's Didone italic), Crimson Pro to read,
          Raleway for navigation and buttons only.
  LAYOUT  Giant wordmark running off both edges, centred nav, then the split. Everything else is white, centred, calm.
*/
@font-face { font-family: "Bodoni Moda"; font-style: italic; font-weight: 400; src: url("/assets/fonts/bodoni-moda-latin-400-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Bodoni Moda"; font-style: italic; font-weight: 500; src: url("/assets/fonts/bodoni-moda-latin-500-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Bodoni Moda"; font-style: normal; font-weight: 400; src: url("/assets/fonts/bodoni-moda-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Crimson Pro"; font-weight: 400; src: url("/assets/fonts/crimson-pro-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Crimson Pro"; font-style: italic; font-weight: 400; src: url("/assets/fonts/crimson-pro-latin-400-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Crimson Pro"; font-weight: 600; src: url("/assets/fonts/crimson-pro-latin-600-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Raleway"; font-weight: 400; src: url("/assets/fonts/raleway-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Raleway"; font-weight: 500; src: url("/assets/fonts/raleway-latin-500-normal.woff2") format("woff2"); font-display: swap; }

:root {
  --paper: #ffffff;
  --ink: #000000;
  --grey: #5b5b5b;
  --line: #d6d6d6;
  /* Each book's colours (deep, mid, light) come from its "palette" in site.json */
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --text: "Crimson Pro", Georgia, serif;
  --ui: "Raleway", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; font: 400 clamp(1.12rem, 1.02rem + 0.35vw, 1.28rem)/1.6 var(--text); overflow-x: clip; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-family: var(--display); font-style: italic; font-weight: 400; line-height: 1.04; margin: 0; text-wrap: balance; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 10; }

/* Masthead: the wordmark runs off both edges, as on the original site */
.masthead { text-align: center; padding: clamp(1.4rem, 4vw, 3rem) 0 1rem; overflow: hidden; }
.wordmark {
  display: block; font-family: var(--display); font-style: italic; font-weight: 400;
  text-transform: uppercase; white-space: nowrap; text-decoration: none; line-height: 0.92;
  font-size: 9.2vw; letter-spacing: -0.03em;
  width: max-content; margin-left: 50%; transform: translateX(-50%);
}
.masthead.compact .wordmark { font-size: clamp(1.5rem, 7.2vw, 6.4rem); letter-spacing: -0.025em; }
.nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem 2rem; margin-top: clamp(0.9rem, 2vw, 1.5rem); font: 400 0.95rem var(--ui); }
.nav a { text-decoration: none; padding: 0.4rem 0; }
.nav a:hover, .nav a[aria-current="page"] { text-decoration: underline; }

/* Lead line under the masthead */
.lede { text-align: center; max-width: 44rem; margin: 0 auto; padding: clamp(1.5rem, 4vw, 2.8rem) 1.5rem clamp(2rem, 4vw, 3rem); }
.lede h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.2rem); margin-bottom: 0.45em; }
.lede p { color: var(--grey); margin: 0; }

/* The two worlds */
.worlds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }
.world { position: relative; isolation: isolate; overflow: hidden; color: #fff; text-align: center;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4.5rem); display: flex; flex-direction: column; align-items: center; }
.world::before { content: ""; position: absolute; inset: -12%; z-index: -2; background: var(--art) center / cover no-repeat, var(--w-mid);
  filter: blur(26px) saturate(1.25); transform: scale(1.1); }
.world::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--w-deep) 45%, transparent) 0%, color-mix(in srgb, var(--w-deep) 82%, transparent) 70%); }
.w-none { --w-deep: #111; --w-mid: #3a3a3a; --w-light: #fff; }
.worlds .world + .world { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.55); }

.world .cover { width: clamp(10rem, 19vw, 16rem); margin-bottom: 2rem; }
.cover { aspect-ratio: 2 / 3; background: var(--w-mid, #444); box-shadow: 0 1.6rem 3rem -1.2rem rgba(0, 0, 0, 0.7); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.world h2 { font-size: clamp(2.6rem, 1.6rem + 3.6vw, 4.8rem); }
.world h2 a { text-decoration: none; }
.world .hook { font-family: var(--display); font-style: italic; font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); color: var(--w-light); margin: 0.5rem 0 1.1rem; max-width: 24em; }
.world .short { max-width: 30em; margin-bottom: 1.2rem; }
.world .foot { margin-top: auto; width: 100%; }
.world .formats { font: 400 0.85rem/1.4 var(--ui); opacity: 0.85; margin-bottom: 1.3rem; }
.world .more { font: 400 0.9rem var(--ui); margin-top: 1rem; }

/* Buttons and the store picker */
.btn { display: inline-block; font: 500 0.95rem/1 var(--ui); padding: 1rem 1.6rem; text-decoration: none; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn:hover { background: #2a2a2a; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: rgba(0, 0, 0, 0.05); }
.world .btn { background: var(--w-light); color: var(--w-deep); border-color: var(--w-light); }
.world .btn:hover { background: #fff; }
.buy { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: center; justify-content: center; }
.store { display: inline-flex; gap: 0.5rem; align-items: center; font: 400 0.85rem var(--ui); }
.store select { font: 400 0.9rem var(--ui); color: inherit; background: transparent; border: 1px solid currentColor; padding: 0.55rem 0.5rem; min-height: 44px; }
.store select option { color: #000; }
details.stores { margin-top: 1.4rem; font: 400 0.9rem var(--ui); color: var(--grey); }
details.stores summary { cursor: pointer; }
details.stores ul { columns: 2; padding-left: 1.1em; margin: 0.7em 0 0; line-height: 1.9; }

/* White sections */
.section { padding: clamp(3rem, 7vw, 6rem) 1.5rem; }
.section > .head { text-align: center; max-width: 40rem; margin: 0 auto clamp(2rem, 4vw, 3.2rem); }
.section > .head h2 { font-size: clamp(2.6rem, 1.6rem + 3.4vw, 4.6rem); margin-bottom: 0.3em; }
.section > .head p { color: var(--grey); margin: 0; }
.section + .section { border-top: 1px solid var(--line); }

/* Codex list: a coloured edge says which world an entry belongs to */
.codex-list { list-style: none; margin: 0 auto; padding: 0; max-width: 68rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3.5rem; }
.codex-list li { border-top: 1px solid var(--line); padding: 1.3rem 0 1.4rem 1.2rem; position: relative; }
.codex-list li::before { content: ""; position: absolute; left: 0; top: 1.5rem; bottom: 1.5rem; width: 3px; background: var(--w-mid); }
.codex-list a.t { font-family: var(--display); font-style: italic; font-size: 1.75rem; text-decoration: none; line-height: 1.1; }
.codex-list a.t:hover { text-decoration: underline; }
.codex-list p { margin: 0.35rem 0 0; }
.codex-list .from { font: 400 0.82rem var(--ui); color: var(--grey); margin-top: 0.5rem; }
.center { text-align: center; margin-top: 2.2rem; }

/* Codex index: one coloured band per world */
.jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.6rem; margin-top: 1.4rem; font: 400 0.92rem var(--ui); }
.group-head { padding-block: clamp(2.2rem, 5vw, 3.5rem); }
.group-head h2 { font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3.6rem); }
.group-head p { margin: 0.6rem 0 0; max-width: 34em; }
.group-head .group-book { font: 400 0.9rem var(--ui); margin-top: 0.8rem; }
.codex-group .section { padding-top: clamp(2rem, 4vw, 3rem); }
.codex-group + .codex-group { border-top: 0; }

/* Still being written: a typographic list */
.works { max-width: 68rem; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3.5rem; }
.works > div { border-top: 1px solid var(--ink); padding: 1.4rem 0 2rem; }
.works h3 { font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); }
.works .kind { font: 400 0.85rem var(--ui); color: var(--grey); margin: 0.5rem 0 0.8rem; }
.works .opening { font-style: italic; }

/* About band: black, the old site's other colour */
.about-band { background: var(--ink); color: var(--paper); padding: clamp(3rem, 7vw, 5.5rem) 1.5rem; }
.about-band .in { max-width: 56rem; margin: 0 auto; display: grid; grid-template-columns: 11rem 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.about-band h2 { font-size: clamp(2rem, 1.5rem + 1.6vw, 3rem); margin-bottom: 0.4em; }
.portrait { aspect-ratio: 4 / 5; background: #333; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }

/* Book page */
.book-hero { display: grid; grid-template-columns: auto minmax(0, 34rem); justify-content: center; gap: clamp(2rem, 6vw, 5rem); align-items: center; text-align: left; padding-block: clamp(3rem, 8vw, 6.5rem); }
.book-hero .cover { width: clamp(12rem, 24vw, 19rem); margin: 0; }
.book-hero h1 { font-size: clamp(3.2rem, 2rem + 4.6vw, 6.2rem); }
.book-hero .by { font: 400 0.95rem var(--ui); opacity: 0.85; margin: 0.6rem 0 1.4rem; }
.book-hero .epigraph { font-family: var(--display); font-style: italic; font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem); line-height: 1.45; color: var(--w-light); margin: 0; }
.award { display: inline-block; font: 500 0.85rem var(--ui); border: 1px solid var(--w-light); color: var(--w-light); padding: 0.45rem 0.8rem; margin-bottom: 1.3rem; }
.blurb { max-width: 36rem; margin: 0 auto; }
.blurb > p:first-child::first-letter { font-family: var(--display); font-style: italic; float: left; font-size: 4.6em; line-height: 0.82; padding: 0.06em 0.12em 0 0; }
.blurb .notes { color: var(--grey); font-style: italic; }
.blurb .buy { justify-content: flex-start; margin-top: 1.8rem; }
.facts { font: 400 0.85rem/1.8 var(--ui); color: var(--grey); border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1rem; }
.other-world { padding-block: clamp(3rem, 6vw, 4.5rem); }
.other-world .label { font: 400 0.9rem var(--ui); opacity: 0.85; margin-bottom: 1.4rem; }

/* Codex entry */
.entry-head { padding-block: clamp(3.5rem, 9vw, 7rem); }
.entry-head .crumb { font: 400 0.9rem var(--ui); margin-bottom: 1.4rem; opacity: 0.85; }
.entry-head h1 { font-size: clamp(3rem, 1.8rem + 5vw, 6.4rem); }
.entry-head .from { font-family: var(--display); font-style: italic; font-size: 1.25rem; color: var(--w-light); margin: 0.8rem 0 0; }
.prose { max-width: 36rem; margin: 0 auto; }
.prose h2 { font-size: 2.1rem; margin: 1.8em 0 0.45em; }
.prose dt { font-family: var(--display); font-style: italic; font-size: 1.45rem; margin-top: 1.1em; }
.prose dd { margin: 0.25em 0 0; }
.prose > p:first-child::first-letter { font-family: var(--display); font-style: italic; float: left; font-size: 4.6em; line-height: 0.82; padding: 0.06em 0.12em 0 0; }

/* Free stories */
.story { font-size: 1.06em; }
.story hr { border: 0; text-align: center; margin: 2.2em 0; }
.story hr::after { content: "⁂"; font-family: var(--display); font-size: 1.4rem; color: var(--grey); }
.works h3 a { text-decoration: none; }
.works h3 a:hover { text-decoration: underline; }

/* About page */
.about-page { max-width: 62rem; margin: 0 auto; display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about-page h1 { font-size: clamp(2.6rem, 1.8rem + 3vw, 4.4rem); margin-bottom: 0.5em; }
.about-page h2 { font-size: 2rem; margin: 1.6em 0 0.4em; }
blockquote { margin: 1.8rem 0; padding: 0; font-family: var(--display); font-style: italic; font-size: 1.15em; line-height: 1.5; }

/* Footer */
.footer { text-align: center; font: 400 0.85rem/1.9 var(--ui); color: var(--grey); padding: 2.4rem 1.5rem 3rem; border-top: 1px solid var(--line); }
.footer a { margin: 0 0.8rem; }

/* One moment: the two worlds open outward from the seam on load */
@media (prefers-reduced-motion: no-preference) {
  .worlds .world:first-child { animation: from-seam-l 1.1s cubic-bezier(.2,.7,.2,1) both; }
  .worlds .world:last-child  { animation: from-seam-r 1.1s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes from-seam-l { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
  @keyframes from-seam-r { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
}

@media (max-width: 820px) {
  .worlds { grid-template-columns: 1fr; }
  .worlds .world + .world { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55); }
  .book-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .codex-list, .works { grid-template-columns: 1fr; }
  .about-band .in { grid-template-columns: 7rem 1fr; }
  .about-page { grid-template-columns: 1fr; }
  .about-page .portrait { max-width: 13rem; }
}

/* Codex extras */
.spoiler { font: 500 0.9rem/1.5 var(--ui); background: #f3f0ea; border-left: 3px solid var(--ink); padding: 0.7rem 1rem; }
.prose > p.spoiler:first-child::first-letter { all: unset; }
.see-also { font: 400 0.95rem var(--ui); color: var(--grey); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 2rem; }
.prose ul { padding-left: 1.2em; }

/* Codex entry with its own picture: shown sharp, darkened at the bottom for the title */
.world.photo::before { inset: 0; filter: none; transform: none; background-position: center; }
.world.photo::after { background: linear-gradient(180deg, color-mix(in srgb, var(--w-deep) 15%, transparent) 0%, color-mix(in srgb, var(--w-deep) 80%, transparent) 100%); }
.entry-head.photo { min-height: clamp(20rem, 42vw, 34rem); justify-content: flex-end; }
