/* Bookend. Warm paper, soft charcoal ink, one rose-maroon accent, Bodoni throughout.
   Modelled on a printed book: a charcoal title band, paper pages, small caps for
   bylines, big tight display type. */

:root {
  --outside: #121212;             /* the table the book sits on */
  --paper: #e2ddda;               /* page */
  --paper-2: #d9d3cf;             /* strips, inputs */
  --paper-3: #ece8e5;             /* raised: cards, inputs on focus */
  --band: #323232;                /* charcoal title band */
  --on-band: #e2ddda;
  --ink: #323232;                 /* text on paper: soft charcoal, never pure black */
  --ink-2: #5e5854;
  --muted: #8c8580;
  --line: #c6bfba;
  --accent: #9a3346;              /* rose-maroon */
  --accent-deep: #6e2231;
  --accent-soft: rgba(154, 51, 70, 0.10);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --col: 680px;
  /* faint paper grain, drawn in SVG (no image download) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .18 0 0 0 0 .16 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--outside); color: var(--ink); font: 500 17px/1.6 var(--serif);
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--accent); color: var(--paper); }

/* Weights: Bodoni Moda's optical-size axis gives sturdy cuts at small sizes and
   fine ones at display sizes, so the weights below can stay modest. It has no
   true small caps; the browser shrinks capitals, which thins them out, so small
   caps get a step more weight to sit level with the text around them. */
h1, h2, h3 { font-weight: 600; }
.sc { font-variant: small-caps; font-variant-numeric: oldstyle-nums; letter-spacing: .05em; font-weight: 600; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .88em; font-family: var(--sans); }
.empty { color: var(--ink-2); font-style: italic; font-size: 1.15rem; padding: 0 1.5rem; }

/* One narrow column of paper on a dark table */
.page { max-width: var(--col); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper) var(--grain); box-shadow: 0 0 60px rgba(0,0,0,.5); }
main { padding: 0 0 3rem; flex: 1; }

/* Masthead: charcoal like the reader's top bar */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.5rem; background: var(--band); color: var(--on-band); }
.brand { font-size: 1.55rem; font-weight: 600; color: var(--on-band); letter-spacing: .01em; line-height: 1;
  display: inline-flex; align-items: center; gap: .45rem; }
.brand::before, .brand::after { content: ""; width: .32rem; height: 1.15em; background: var(--on-band); border-radius: 1px; }
.brand::before { transform: skewY(-12deg); }
.brand::after { transform: skewY(12deg); }
.brand span { display: none; }
.brand:hover { color: var(--on-band); text-decoration: none; }
.masthead nav { display: flex; align-items: baseline; gap: 1.2rem; font-size: 1.1rem; }
.masthead nav a, .masthead button.link { color: #b9b3af; }
.masthead nav a:hover, .masthead button.link:hover { color: var(--on-band); text-decoration: none; }

/* Hero / title page: charcoal band, giant tight Bodoni, byline right in small caps */
.hero, .title-page { background: var(--band); color: var(--on-band); padding: .4rem 1.5rem 1.1rem;
  border-top: 1px solid #444; }
.hero h1, .title-page h1 { font-size: clamp(3.6rem, 13vw, 6rem); font-weight: 600; line-height: .95;
  letter-spacing: -.015em; margin: 0; }
.title-page h1 { font-size: clamp(2.8rem, 10vw, 4.6rem); }
.byline-right { text-align: right; margin: .7rem 0 0; font-size: 1.55rem; }
.byline-right a, .byline-right a:hover { color: var(--on-band); }

/* The strip: like the chapter-number bar under the title */
.strip { display: flex; align-items: baseline; gap: 1.1rem; flex-wrap: wrap; padding: .5rem 1.5rem;
  background: var(--paper-2); border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.strip > span:first-child { color: var(--muted); }
.strip a { color: var(--ink-2); }
.strip a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.strip a:hover { color: var(--accent); text-decoration: none; }
.strip .rating { margin-right: auto; }

/* Notices: the coloured bar under the title */
.notice { margin: 0; padding: .6rem 1.5rem; background: #e3cf72; color: var(--ink); font-weight: 500; font-size: 1.02rem; }
.notice.blurb { background: var(--paper-3); color: var(--ink-2); font-style: italic; font-weight: 400;
  border-left: 3px solid var(--accent); border-bottom: 1px solid var(--line); }

/* Shelf: big italic oldstyle numerals in the margin */
.shelf { list-style: none; margin: 0; padding: .4rem 1.5rem 0; }
.shelf li { display: grid; grid-template-columns: 3rem 1fr; gap: .7rem; padding: 1.15rem 0; border-bottom: 1px solid var(--line); }
.shelf li:last-child { border-bottom: 0; }
.num { font-size: 2.8rem; font-weight: 600; font-style: normal; line-height: .9; color: var(--accent);
  font-variant-numeric: oldstyle-nums; text-align: right; }
.title { display: inline-block; font-size: 1.8rem; font-weight: 600; line-height: 1.08; color: var(--ink); letter-spacing: -.005em; }
.title:hover { color: var(--accent); text-decoration: none; }
.author { color: var(--ink-2); font-size: 1.1rem; margin-top: .15rem; }
.author a { color: var(--ink-2); }
.shelf p { margin: .4rem 0 .3rem; color: var(--ink-2); font-size: 1.02rem; }

.stars { color: var(--accent); letter-spacing: 2px; margin-right: .35rem; font-family: var(--sans); font-size: .95em; }
.stars .dim { color: #c4bcb7; }

/* Reading area: the page itself, set like 1984 chapter pages */
.paper { padding: 2.2rem clamp(1.2rem, 6vw, 3rem) 1.5rem; }
.reader { font-size: 1.1rem; line-height: 1.6; font-weight: 500; text-align: justify; hyphens: auto; }
.reader p { margin: 0 0 1em; }
.reader p + p { text-indent: 1.6em; }
.reader > p:first-of-type::first-letter, .reader > h1 + p::first-letter, .reader > h2 + p::first-letter {
  float: left; font-size: 3.4em; line-height: .8; font-weight: 500; padding: .07em .07em 0 0; color: var(--ink); }
.reader > p:first-of-type, .reader > h1 + p, .reader > h2 + p { min-height: 2.6em; text-indent: 0; }
.reader blockquote, .reader h1, .reader h2, .reader h3, .reader hr { clear: both; }
.reader h1, .reader h2, .reader h3 { text-align: center; font-weight: 600; font-size: 2.1rem; line-height: 1.1;
  margin: 2rem 0 1.6rem; color: var(--ink); }
.reader h1:first-child, .reader h2:first-child { margin-top: .2rem; }
.reader strong { font-weight: 800; }
.reader blockquote { margin: 1.2rem 0; padding: 0 1.2rem; border-left: 2px solid var(--accent); font-style: italic; color: var(--ink-2); }
.reader hr { border: 0; text-align: center; margin: 2rem 0; }
.reader hr::after { content: "❧"; color: var(--accent); font-size: 1.4rem; }
.reader code { font-family: ui-monospace, monospace; font-size: .85em; background: var(--paper-2); padding: .1rem .3rem; }
.fin { text-align: center; color: var(--muted); font-size: 1.15rem; margin: 2rem 0 0; font-style: italic; font-weight: 400; }
.fin a { color: var(--accent); text-decoration: underline; }
.pdf { width: 100%; height: 80vh; border: 1px solid var(--line); background: #fff; }

/* Reviews */
.reviews { padding: 1.5rem 1.5rem 0; border-top: 1px solid var(--line); }
.reviews h2 { font-size: 2rem; letter-spacing: -.01em; margin: 0 0 1rem; }
.review { padding: .85rem 0; border-top: 1px solid var(--line); }
.review .who { font-size: 1.2rem; color: var(--ink); margin-right: .4rem; }
.review p { margin: .3rem 0 0; font-style: italic; font-size: 1.08rem; color: var(--ink-2); }
.rate { display: grid; gap: .7rem; margin-bottom: 1.5rem; }
.rate button { justify-self: start; }
.star-pick { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; font-size: 2rem; }
.star-pick input { position: absolute; opacity: 0; pointer-events: none; }
.star-pick label { color: #c9c1bc; cursor: pointer; padding: 0 .08rem; transition: color .1s, transform .1s; }
.star-pick label:hover { transform: rotate(-8deg) scale(1.1); }
.star-pick label:hover, .star-pick label:hover ~ label, .star-pick input:checked ~ label { color: var(--accent); }
.star-pick input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

/* Buttons: ink stamps */
button, .button { background: var(--ink); color: var(--paper); border: 0; border-radius: 0; padding: .5rem 1.1rem;
  font: 600 1.1rem var(--serif); font-variant: small-caps; letter-spacing: .06em; cursor: pointer;
  box-shadow: 3px 3px 0 var(--accent); transition: transform .08s, box-shadow .08s; }
button:hover, .button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--accent); color: var(--paper); text-decoration: none; }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--accent); }
button.link { background: none; padding: 0; box-shadow: none; font-size: 1.1rem; color: var(--ink-2); }
button.link:hover { transform: none; box-shadow: none; color: var(--accent); }
button.danger-link:hover { text-decoration: line-through; }
form.inline { display: inline; }

/* Forms (submit, login, join) */
main > h1 { font-size: clamp(2.8rem, 10vw, 4.3rem); line-height: .98; letter-spacing: -.015em;
  margin: 0; padding: .4rem 1.5rem 1.2rem; background: var(--band); color: var(--on-band); border-top: 1px solid #444; }
main > p { padding: 0 1.5rem; color: var(--ink-2); }
.stack { display: grid; gap: 1.2rem; padding: 1.6rem 1.5rem 1rem; }
.stack.narrow { max-width: 420px; }
.stack label { display: grid; gap: .35rem; font-variant: small-caps; letter-spacing: .05em; font-size: 1.2rem; font-weight: 600; }
.stack label .muted { font-variant: normal; letter-spacing: 0; font-size: .78rem; }
.stack label.check { display: flex; gap: .5rem; align-items: center; }
.stack button { justify-self: start; }
input, textarea { font: 400 1rem var(--sans); padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 0;
  background: var(--paper-3); color: var(--ink); width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 3px 3px 0 var(--accent-soft); background: #f3f0ee; }
textarea { resize: vertical; }
textarea[name=body], textarea[name=review] { font: 400 1.08rem/1.6 var(--serif); }
input[type=file], input[type=checkbox], input[type=radio] { width: auto; }
input[type=checkbox] { accent-color: var(--accent); }
input[type=file] { background: none; border: 0; padding: 0; color: var(--ink-2); }
input[type=file]::file-selector-button { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line);
  padding: .4rem .8rem; margin-right: .7rem; font: 600 1rem var(--serif); font-variant: small-caps; cursor: pointer; }

/* Colophon */
.colophon { text-align: center; color: var(--muted); font-size: 1rem; padding: 1.3rem 1rem 1.5rem; border-top: 1px solid var(--line); }

@media (max-width: 520px) {
  .shelf li { grid-template-columns: 2.3rem 1fr; }
  .num { font-size: 2.1rem; }
  .title { font-size: 1.5rem; }
  .reader { text-align: left; }
}
