/* Fonts are served from this site (SIL Open Font License), not from Google. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%; src: url(../fonts/bricolage-grotesque-latin-standard-normal.woff2) format("woff2-variations"); }
@font-face { font-family: "Literata"; font-style: normal; font-display: swap; font-weight: 200 900; src: url(../fonts/literata-latin-opsz-normal.woff2) format("woff2-variations"); }
@font-face { font-family: "Literata"; font-style: italic; font-display: swap; font-weight: 200 900; src: url(../fonts/literata-latin-opsz-italic.woff2) format("woff2-variations"); }

/* Locus Dreams, v2.
   Concept: the multiverse is the shelf. The hero is a drifting wall of every cover in the universe;
   everything after it is quiet so the covers stay the loudest thing on the page.
   Colours come from the logo: night sky, the orange starburst, the blue-green planet, the magenta edge. */
:root {
  --night: #170d2b;
  --night-2: #21143d;
  --line: #3a2763;
  --ink: #f1ecfa;
  --dim: #b4a8cf;
  --flare: #f2622e;        /* starburst orange: primary actions only */
  --p1: #7cbf55;           /* planet green */
  --p2: #4a7be0;           /* planet blue */
  --p3: #d0407a;           /* starburst magenta */

  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --read: "Literata", Georgia, "Times New Roman", serif;

  /* 1.25 scale */
  --t-sm: 0.875rem;
  --t-md: 1.0625rem;
  --t-lg: 1.3rem;
  --t-xl: clamp(1.6rem, 3.2vw, 2.1rem);
  --t-2xl: clamp(2.1rem, 5vw, 3.3rem);
  --t-hero: clamp(2.5rem, 6.6vw, 5.4rem);

  --free-ink: #ff9a72;
  color-scheme: dark;
}
/* logo in the hero and footer */
.hero-logo { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: clamp(16px, 3vw, 36px); width: clamp(120px, 20vw, 260px); height: auto; filter: drop-shadow(0 12px 28px rgba(0,0,0,.6)); }
@media (max-width: 760px) { .hero .wrap { padding-bottom: 104px; } }
.foot-logo { width: clamp(180px, 26vw, 300px); height: auto; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { background: var(--night); color: var(--ink); font-family: var(--display); font-size: var(--t-md); line-height: 1.55; }
a { color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--flare); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-family: var(--display); text-wrap: balance; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
.wrap {
  max-width: 1200px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--flare); color: var(--night); padding: 8px 14px; border-radius: 6px; z-index: 50; font-weight: 700; }
.skip:focus { left: 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border-radius: 999px; font: 700 1rem var(--display); text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn-main { background: var(--flare); color: #1d0b03; }
.btn-main:hover { background: #ff7a48; }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--night); }

/* header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--night); }
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--night) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.site-head .logo img { height: 42px; width: auto; }
.site-head nav ul { display: flex; gap: 2px; flex-wrap: wrap; }
.site-head nav a { display: block; padding: 10px 12px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.95rem; color: var(--dim); }
.site-head nav a:hover { color: var(--ink); background: var(--night-2); }
@media (max-width: 680px) { .site-head nav .more { display: none; } }

/* hero: the cover wall */
.hero { position: relative; overflow: hidden; isolation: isolate; border-bottom: 1px solid var(--line); }
.wall { position: absolute; inset: -12% -10%; display: grid; gap: 14px; align-content: center; transform: rotate(-7deg); z-index: -2; opacity: .55; }
.wall .row { overflow: hidden; }
.wall .track { display: flex; width: max-content; animation: drift 240s linear infinite; }
.wall .r1 .track { animation-direction: reverse; animation-duration: 280s; }
.wall .r2 .track { animation-duration: 320s; }
.wall img { margin-right: 14px; width: clamp(110px, 12vw, 170px); height: auto; aspect-ratio: 560 / 896; border-radius: 4px; }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wall .track { animation: none; } }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--night) 18%, color-mix(in srgb, var(--night) 82%, transparent) 50%, color-mix(in srgb, var(--night) 35%, transparent) 100%); }
@media (max-width: 760px) { .hero::after { background: linear-gradient(180deg, color-mix(in srgb, var(--night) 55%, transparent), var(--night) 62%); } }
.hero .wrap { padding-block: clamp(72px, 12vw, 150px); }
.hero-copy { max-width: 44rem; display: grid; gap: 22px; }
.hero h1 { font-size: var(--t-hero); font-weight: 800; font-stretch: 78%; font-variation-settings: "wdth" 78; line-height: .95; letter-spacing: -0.01em; }
.hero .by { font-family: var(--read); font-size: var(--t-lg); color: var(--dim); }
.hero .by strong { color: var(--ink); font-weight: 500; }
.hero .newhere { font-family: var(--read); max-width: 34rem; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* sections */
.sec { padding-block: clamp(64px, 9vw, 112px); }
.sec-title { font-size: var(--t-2xl); font-weight: 800; font-variation-settings: "wdth" 85; line-height: 1.02; }
.sec-intro { font-family: var(--read); color: var(--dim); max-width: 40rem; margin-top: 12px; }

/* new release */
.newrel { background: var(--night); border-bottom: 1px solid var(--line); }
.newrel .wrap { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
@media (max-width: 760px) { .newrel .wrap { grid-template-columns: minmax(0, 1fr); } }
.newbtn { display: block; width: 100%; max-width: 360px; margin-inline: auto; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; }
@media (max-width: 760px) { .newbtn { max-width: 230px; } }
.newrel .newcover { width: 100%; height: auto; border-radius: 4px 8px 8px 4px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.06); transform: rotate(-2.5deg); cursor: pointer; }
.newrel .text { display: grid; gap: 16px; max-width: 38rem; }
.newrel .kicker { color: var(--p3); font-weight: 700; }
.newrel .meta { color: var(--dim); }
.newrel .blurb { font-family: var(--read); display: grid; gap: 12px; line-height: 1.7; }

/* free */
.free-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 32px); margin-top: 36px; max-width: 900px; }
@media (max-width: 600px) { .free-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.freebook { display: grid; gap: 6px; text-decoration: none; }
.freebook img { width: 100%; height: auto; border-radius: 4px; margin-bottom: 8px; }
.freebook:hover img { box-shadow: 0 0 0 2px var(--flare); }
.freebook .link { color: var(--flare); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* universe */
.universe { background: var(--night-2); border-block: 1px solid var(--line); }
.filters { margin-top: 32px; display: grid; gap: 10px; }
.filters p { font-weight: 600; color: var(--dim); font-size: var(--t-sm); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--night); color: var(--ink); font: 600 0.92rem var(--display); cursor: pointer; }
.chip:hover { border-color: var(--dim); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--night); border-color: var(--ink); }
.status { margin-top: 14px; color: var(--dim); font-size: var(--t-sm); min-height: 1.4em; }
.phase { margin-top: 56px; }
.phase[data-phase="1"] { --c: var(--p1); }
.phase[data-phase="2"] { --c: var(--p2); }
.phase[data-phase="3"] { --c: var(--p3); }
.phase-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 26px; }
.pnum { font-weight: 800; font-variation-settings: "wdth" 75; font-size: clamp(4rem, 10vw, 6.5rem); line-height: .78; color: var(--c); }
.phase-head h3 { font-size: var(--t-xl); font-weight: 800; font-variation-settings: "wdth" 85; }
.phase-head p { font-family: var(--read); color: var(--dim); max-width: 42rem; margin-top: 6px; }
.phase-head .count { font-family: var(--display); color: var(--c); font-weight: 700; font-size: var(--t-sm); }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(44%, 160px), 1fr)); gap: 30px 18px; }
.book { display: grid; gap: 4px; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.jacket { display: block; margin-bottom: 8px; border-radius: 3px 6px 6px 3px; overflow: hidden; box-shadow: 0 16px 28px -16px rgba(0,0,0,.9); transition: box-shadow .15s; }
.jacket img { width: 100%; height: auto; aspect-ratio: 560 / 896; object-fit: cover; }
.book:hover .jacket { box-shadow: 0 0 0 2px var(--c, var(--dim)), 0 16px 28px -16px rgba(0,0,0,.9); }
.book:hover .bt { text-decoration: underline; text-underline-offset: 3px; }
.bn { color: var(--c, var(--dim)); font-weight: 700; font-size: var(--t-sm); }
.bt { font-weight: 700; line-height: 1.25; }
.free { justify-self: start; margin-top: 4px; font-size: 0.8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--flare) 18%, transparent); color: var(--free-ink); }

/* collections */
.coll-row { margin-top: 36px; }
.coll { --c: var(--dim); }
.coll[data-phase="1"] { --c: var(--p1); }
.coll[data-phase="2"] { --c: var(--p2); }
.coll[data-phase="3"] { --c: var(--p3); }

/* about */
.about { border-top: 1px solid var(--line); }
.about .wrap { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
@media (max-width: 800px) { .about .wrap { grid-template-columns: minmax(0, 1fr); } .about figure { max-width: 320px; } }
.about figure { margin: 0; }
.about figure img { width: 100%; height: auto; border-radius: 8px; filter: grayscale(1); }
.about .text { display: grid; gap: 16px; max-width: 38rem; font-family: var(--read); line-height: 1.75; }
.about .text .lead { font-size: var(--t-lg); line-height: 1.5; }
.about .text p:not(.lead) { color: var(--dim); }
.about .sign { font-family: var(--display); font-weight: 700; color: var(--ink) !important; }

/* faq */
.faq { background: var(--night-2); border-block: 1px solid var(--line); }
.faq .wrap { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: 40px; }
@media (max-width: 860px) { .faq .wrap { grid-template-columns: minmax(0, 1fr); } }
.faq-list { display: grid; gap: 30px; }
.faq-group h3 { font-size: var(--t-lg); font-weight: 800; margin-bottom: 4px; }
details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; list-style: none; padding: 16px 36px 16px 0; font-weight: 600; position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; position: absolute; right: 8px; top: 24px; width: 10px; height: 10px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(45deg); transition: transform .2s; }
details[open] summary::after { transform: rotate(-135deg); top: 28px; }
details p { padding-bottom: 18px; font-family: var(--read); color: var(--dim); max-width: 42rem; }

/* footer */
.foot { padding-block: 64px 40px; }
.foot .wrap { display: grid; gap: 32px; }
.foot-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 24px; }
.foot h2 { font-size: var(--t-2xl); font-weight: 800; font-variation-settings: "wdth" 85; max-width: 16ch; line-height: 1.02; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.mail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mail span { color: var(--dim); }
.mail code { font-family: var(--display); font-size: var(--t-lg); font-weight: 600; user-select: all; word-break: break-all; }
.copy { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 600 0.9rem var(--display); cursor: pointer; }
.copy:hover { border-color: var(--ink); }
.poseidon { color: var(--dim); font-family: var(--read); font-size: var(--t-sm); }
.foot-bottom { padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--dim); font-size: var(--t-sm); }

/* reader */
dialog { width: min(980px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--night-2); color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(5, 6, 18, .8); backdrop-filter: blur(4px); }
dialog[open] { animation: open .2s ease-out; }
@keyframes open { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
.rbar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--night-2); border-bottom: 1px solid var(--line); }
.rbar div { display: flex; gap: 8px; }
.rbar button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 600 0.9rem var(--display); cursor: pointer; }
.rbar button:hover:not(:disabled) { border-color: var(--ink); }
.rbar button:disabled { opacity: .35; cursor: default; }
.rbody { display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 1fr); gap: 32px; padding: 28px; }
@media (max-width: 700px) { .rbody { grid-template-columns: minmax(0, 1fr); padding: 20px; } .rbody .rc { max-width: 200px; } }
.rbody .rc img { width: 100%; height: auto; border-radius: 4px; }
.rbody .rt { display: grid; gap: 14px; align-content: start; }
.rbody .rmeta { font-weight: 700; color: var(--c); }
.rbody h2 { font-size: var(--t-xl); font-weight: 800; font-variation-settings: "wdth" 85; line-height: 1.05; }
.rbody .tagline { font-family: var(--display); font-weight: 700; font-size: var(--t-lg); }
.rbody .blurb strong { font-family: var(--display); }
.rbody .blurb { font-family: var(--read); display: grid; gap: 12px; line-height: 1.7; color: var(--ink); }
dialog[data-phase="1"] { --c: var(--p1); }
dialog[data-phase="2"] { --c: var(--p2); }
dialog[data-phase="3"] { --c: var(--p3); }

/* 404 page */
.nf-logo { width: 200px; height: auto; margin-bottom: 32px; }
.nf-actions { margin-top: 28px; }

/* keep anchored sections clear of the sticky header */
[id] { scroll-margin-top: 84px; }

/* ---- phones: shelves become swipeable rows so the page stays short ---- */
@media (max-width: 640px) {
  .shelf, .free-row {
    display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 40%;
    gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); scroll-padding-inline: max(16px, env(safe-area-inset-left, 0px));
    padding-inline: max(16px, env(safe-area-inset-left, 0px)); padding-bottom: 8px; scrollbar-width: none;
  }
  .shelf::-webkit-scrollbar, .free-row::-webkit-scrollbar { display: none; }
  .shelf > li, .free-row > li { scroll-snap-align: start; }
  .shelf li[hidden] { display: none; }
  .phase { margin-top: 40px; }
  .phase-head { gap: 14px; margin-bottom: 18px; }
  .pnum { font-size: 3.6rem; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; padding-bottom: 4px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .newbtn { max-width: 200px; }
  .rbody .rc { max-width: 150px; }
  .rbar { padding: 10px 12px; }
  .swipe-hint { display: block; }
}
.swipe-hint { display: none; color: var(--dim); font-size: var(--t-sm); margin-top: -8px; margin-bottom: 14px; }

/* links styled as book cards */
a.book { text-decoration: none; }

/* ---- book pages ---- */
.bookpage[data-phase="1"] { --c: var(--p1); }
.bookpage[data-phase="2"] { --c: var(--p2); }
.bookpage[data-phase="3"] { --c: var(--p3); }
.crumbs { color: var(--dim); font-size: var(--t-sm); margin-bottom: 28px; }
.crumbs a { color: var(--ink); }
.bp-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
@media (max-width: 720px) { .bp-grid { grid-template-columns: minmax(0, 1fr); } .bp-cover { max-width: 220px; } }
.bp-cover { width: 100%; height: auto; border-radius: 4px 8px 8px 4px; box-shadow: 0 24px 48px -20px rgba(0,0,0,.8); }
.bp-text { display: grid; gap: 16px; max-width: 40rem; }
.bp-text .rmeta { font-weight: 700; color: var(--c); }
.bp-text h1 { font-size: var(--t-2xl); font-weight: 800; font-variation-settings: "wdth" 85; line-height: 1.02; }
.bp-text .blurb { font-family: var(--read); display: grid; gap: 12px; line-height: 1.75; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.prevnext .pn { display: grid; gap: 4px; text-decoration: none; padding: 14px 0; }
.prevnext .pn:last-child { text-align: right; }
.prevnext .pn:hover .bt { text-decoration: underline; text-underline-offset: 3px; }
.more-books { margin-top: 56px; }
.more-books h2 { font-size: var(--t-xl); font-weight: 800; font-variation-settings: "wdth" 85; margin-bottom: 20px; }
.about figure { max-width: 420px; }
@media (max-width: 800px) { .about figure { max-width: 220px; } }
