/* Leemanism public site. Plain CSS, no frameworks. */
:root {
  color-scheme: light dark;
  --paper: #f6f3ee; --ink: #26221d; --muted: #70675c; --line: #d9d2c6; --accent: #5b3fa6;
  --margin-colour: #ebe6dd;
  --radius: 0;            /* one site-wide corner radius (Appearance setting later) */
  --measure: 68ch;        /* reading width (per-site setting later) */
  --maxsite: 1800px;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #1b1916; --ink: #ece7df; --muted: #a79d90; --line: #3a352e; --accent: #b6a0f0; --margin-colour: #14120f; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body.site {
  margin: 0; background: var(--margin-colour); color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, .96rem + .3vw, 1.35rem);
  line-height: 1.7;
}
body.site > main, body.site > header {
  max-width: var(--maxsite); margin-inline: auto; background: var(--paper);
}
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--contrast, var(--accent)) 35%, transparent); }
.muted { color: var(--muted); }

/* title page */
body.site > header.cover {
  max-width: none; margin: 0; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(160deg, #1f3a4d 0%, #35566b 45%, #6e8a97 100%); color: #fff; padding: 3rem 1.25rem;
}
.cover h1 { font-size: clamp(2.6rem, 9vw, 7rem); font-weight: 400; letter-spacing: .01em; margin: 0 0 1.6rem; line-height: 1.05; text-shadow: 0 2px 24px rgba(0,0,0,.35); }
.cover-note { margin: 0; opacity: .85; }
.begin {
  display: inline-block; padding: .8rem 2rem; border: 2px solid #fff; color: #fff; text-decoration: none;
  font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; border-radius: var(--radius);
}
.begin:hover, .begin:focus-visible { background: #fff; color: #1f3a4d; }
.shelf-wrap { padding: 3rem 1.25rem 7rem; }
.shelf-title { text-align: center; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; font-size: .9rem; color: var(--muted); margin: 0 0 1.6rem; }
.shelf { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; max-width: 70rem; }
.spine {
  display: flex; flex-direction: column; justify-content: flex-end; aspect-ratio: 3 / 4; padding: 1rem;
  color: #fff; text-decoration: none; border-radius: var(--radius); line-height: 1.25;
}
.spine:hover, .spine:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.spine-label { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.spine-title { font-size: 1.25rem; margin: .3rem 0; }
.spine-count { font-size: .8rem; opacity: .8; }
.h0 { background: #7a2e3a; } .h1 { background: #8a4b1f; } .h2 { background: #7a6a1a; } .h3 { background: #4d6b1f; }
.h4 { background: #1f6b4a; } .h5 { background: #1f6b6b; } .h6 { background: #1f4f7a; } .h7 { background: #3a3a8a; }
.h8 { background: #5b3fa6; } .h9 { background: #8a2f7a; } .h10 { background: #7a2f5a; } .h11 { background: #4a4a4a; }
.pagelinks { text-align: center; margin: 2.5rem 0 0; color: var(--muted); }

/* reader */
main.reader { padding: 2.5rem max(1.25rem, calc((100% - var(--measure)) / 2)) 8rem; }
.crumbs { font-size: .8em; color: var(--muted); margin-bottom: 1.4rem; }
.crumbs a { color: inherit; }
main.reader h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 3.2rem); font-weight: 400; line-height: 1.15; margin: 0 0 .4rem; }
.stamp { font-size: .78em; color: var(--muted); margin-bottom: 2rem; font-style: italic; }
.prose h2 { font-size: 1.5em; font-weight: 400; margin: 2.4rem 0 .6rem; line-height: 1.25; }
.prose h3 { font-size: 1.15em; font-weight: 600; margin: 1.8rem 0 .4rem; }
.hnum { color: var(--muted); font-weight: 400; margin-right: .2em; }
.prose p { margin: 0 0 1.1em; }
.prose blockquote { margin: 1.4em 0; padding-left: 1.2em; border-left: 3px solid var(--line); color: var(--muted); }
.prose blockquote p { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4rem 0; }
.prose code { font-size: .9em; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: .1em .3em; }
.toc { list-style: none; padding: 0; margin: 2rem 0; }
.toc li { border-bottom: 1px solid var(--line); }
.toc a { display: block; padding: .7rem 0; text-decoration: none; color: inherit; }
.toc a:hover, .toc a:focus-visible { color: var(--accent); }
.toc-n { color: var(--muted); margin-right: .6em; font-size: .85em; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.pager a { text-decoration: none; color: inherit; max-width: 48%; }
.pager a:hover, .pager a:focus-visible { color: var(--accent); }
.pager small { display: block; font-size: .7em; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pager .next { margin-left: auto; text-align: right; }
.searchform { display: flex; gap: .5rem; margin: 1rem 0 1.6rem; }
.searchform input { flex: 1; padding: .6rem .7rem; font: inherit; border: 1px solid var(--line); background: var(--paper); color: inherit; border-radius: var(--radius); }
.searchform button { padding: .6rem 1.2rem; font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--paper); cursor: pointer; border-radius: var(--radius); }
.results { list-style: none; padding: 0; }
.results li { margin-bottom: 1.2rem; }
.results p { margin: .2rem 0 0; color: var(--muted); font-size: .9em; }

/* floating bar: icon plus word, bottom right */
.bar {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 10; display: flex; gap: .15rem; padding: .25rem;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0,0,0,.18);
  border-radius: var(--radius); font: 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.bar-item { display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 3.6rem; padding: .5rem .4rem; text-decoration: none; color: inherit; border-radius: var(--radius); }
.bar-item:hover, .bar-item:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); outline: none; }
.bar-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) {
  .bar { right: .5rem; bottom: .5rem; }
  .bar-item { min-width: 3rem; padding: .45rem .3rem; font-size: 12px; }
}

/* cover picture: edge to edge behind the title */
body.site > header.cover { position: relative; overflow: hidden; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.18), rgba(0,0,0,.42)); }
.cover-inner { position: relative; z-index: 1; }

/* book covers on the shelf */
.spine { position: relative; overflow: hidden; }
.spine > span { position: relative; z-index: 1; }
.spine-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spine.has-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,.05) 60%); }

/* chapters: text column, art layouts */
main.reader.chapter { padding: 0; }
.rt { padding: 2.5rem max(2.6rem, calc((100% - var(--measure)) / 2)) 8rem max(1.25rem, calc((100% - var(--measure)) / 2)); }
.art-slot { position: relative; overflow: hidden; background: #777; }
.art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .7s ease; }
.art-img.on { opacity: 1; }
.art-wrap { transition: background-color .7s ease; }
@media (prefers-reduced-motion: reduce) { .art-img, .art-wrap { transition: none; } }
.art-stop { height: 0; margin: 0; }

/* strip: a band across the top (bottom when mirrored) */
main.p-strip .art-slot { height: 46vh; }
main.p-strip.mirror { display: flex; flex-direction: column-reverse; }

/* framed: a square picture on a colour taken from the picture */
main.p-framed .art-wrap { padding: 3rem 1.25rem; display: flex; justify-content: center; }
main.p-framed .art-slot { width: min(72vh, 100%); aspect-ratio: 1 / 1; }

/* split: picture beside the text, held in place while the text scrolls */
@media (min-width: 900px) {
  main.p-split { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  main.p-split .art-wrap { position: sticky; top: 0; height: 100vh; }
  main.p-split .art-slot { height: 100%; }
  main.p-split.mirror .art-wrap { order: 2; }
}
/* phones: every layout becomes a band that stays at the top while reading */
@media (max-width: 899px) {
  main.has-art { display: block; }
  main.has-art .art-wrap { position: sticky; top: 0; z-index: 2; padding: 0; display: block; }
  main.has-art .art-slot { height: 32vh; width: 100%; aspect-ratio: auto; }
}

/* chapter rail: the chapter as a line down the right edge */
.rail { position: fixed; right: 14px; top: 18vh; height: 58vh; width: 18px; z-index: 5; }
.rail::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.rail a { position: absolute; display: block; transform: translateY(-50%); }
.rail .r-sec { right: 3px; width: 12px; height: 12px; }
.rail .r-sec::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--muted); }
.rail .r-sub { right: 6px; width: 6px; height: 6px; display: none; }
.rail .r-sub::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--muted); }
.rail .r-sub.show { display: block; }
.rail .r-art { right: 3px; width: 12px; height: 12px; }
.rail .r-art::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); background: var(--paper); }
.rail a:hover::before, .rail a:focus-visible::before { background: var(--accent); }
.rail a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.rail .r-label { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--paper); color: var(--ink); border: 1px solid var(--line); padding: .15rem .5rem; font: 13px/1.3 system-ui, sans-serif; opacity: 0; pointer-events: none; border-radius: var(--radius); }
.rail a:hover .r-label, .rail a:focus-visible .r-label { opacity: 1; }
.rail .r-here { position: absolute; right: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--contrast, var(--accent)); transform: translateY(-50%); pointer-events: none; box-shadow: 0 0 0 3px var(--paper); }
@media (max-width: 899px) { .rail { right: 4px; width: 8px; } .rail .r-sec, .rail .r-sub, .rail .r-art { display: none; } .rail .r-here { right: 0; width: 8px; height: 8px; box-shadow: none; } .rail::before { left: 3px; } }
@media print { .rail, .bar { display: none; } }
