/* ============================================================================
   The ONLY hand-written stylesheet, and deliberately tiny.
   proto.css is the prototype copied verbatim and must not be edited — change the prototype and
   re-run `npm run sync-css`. Anything the real site needs that the prototype never had lives here,
   loaded after it, so the two never have to be reconciled by hand.
   ============================================================================ */

/* A ranked book with no review of its own. Eleven of 2019's books are like this — that year was
   written up entirely inside the list post — plus 2022's #11-#20 and one Top 50 entry. It keeps the
   row's shape so the ranking still reads as one sequence, and only loses the affordances that would
   lie: no hover, no pointer, and the genre cell says why instead of showing an em dash. */
.lrow.unreviewed { cursor: default; }
.lrow.unreviewed:hover { background: transparent; }
.lrow.unreviewed .t { color: var(--navy); }
.lrow.unreviewed .tag { font-style: italic; opacity: .7; }

/* The drop cap. proto.css has `.body p:first-child:first-letter`, which was written when a review
   body was one paragraph of placeholder text. Against a real body it also matches the <p> inside every
   <li> — because that paragraph IS its list item's first child — so a bulleted list rendered with a
   58px serif capital on each row and a staircase of floats. Restricted to a direct child of .body,
   and explicitly cleared for anything nested. */
.body p:first-child:first-letter { font-family: inherit; font-size: inherit; float: none; padding: 0; color: inherit; line-height: inherit; }
.body > p:first-child:first-letter {
  font-family: var(--disp2); font-size: 58px; float: left; line-height: .82;
  padding: 4px 10px 0 0; color: var(--navy);
}

/* ---------- images inside a review body ----------
   The prototype's review body is prose and nothing else, so no rule here ever styled an image. It
   didn't need one: the Ricos reader was quietly returning '' for image ids in a shape it didn't
   recognise, so every embedded image was dropped before it reached the page. Fixing the reader
   made them real, and they arrived unstyled — rendering at natural size, full-bleed, ignoring the
   column. The cover is removed upstream; this bounds whatever else Greg embeds. */
.body figure { margin: 24px 0; }
.body figure img { display: block; max-width: 100%; height: auto; border-radius: 2px; }
.body figcaption { font-family: var(--sans); font-size: 12.5px; color: var(--mute);
  margin-top: 8px; text-align: center; }

/* ---------- "not reviewed on Barlin's Books yet" ----------
   Sits in the MY RATING column and spans into GENRE, which is empty for a book with no review. A
   sentence in a 104px column wraps to four lines and reads like a mistake. The row emits four cells
   instead of five in this case, so the span lands cleanly rather than pushing an empty cell onto a
   new grid line. */
.lrow .s.nrn { grid-column: span 2; padding-top: 3px; }
.lrow .s.nrn .tag { opacity: .45; white-space: normal; font-style: italic; }

/* ---------- multi-paragraph list commentary ----------
   Greg's write-ups on the list posts often run to two paragraphs: a one-line summary, then what he
   actually thought. The row's verdict cell is a text field, so the break is carried as a blank line
   rather than as markup smuggled through escaping. */
.lrow .v { white-space: pre-line; }

/* The verdict cell can now hold real paragraphs, because list commentary is rendered rather than
   flattened — Greg links other reviews from inside it. */
.lrow .v p { margin: 0 0 .55em; }
.lrow .v p:last-child { margin-bottom: 0; }
.lrow .v a { color: inherit; text-decoration: underline; text-decoration-color: var(--gold);
  text-underline-offset: 2px; }
.lrow .v a:hover { color: var(--navy); }

/* A cross-reference inside a linked row: the row is already the click target, so this is styled to
   read as a title rather than as something clickable. */
.lrow .v .xref { text-decoration: underline; text-decoration-color: var(--line);
  text-underline-offset: 2px; }

/* ---------- indented paragraphs and lists in a review body ----------
   The renderer has always emitted these correctly — indent-N classes and real <ul>/<ol> — and the
   stylesheet has never had a rule for either, because the prototype's review body is plain prose.
   So Greg's block quotes sat flush against the margin and his bullets rendered as unmarked
   paragraphs: nothing broken, nothing logged, just his formatting quietly discarded.

   Indentation is his way of setting off a long quotation, so it is given room and a rule rather
   than a bare margin — but no italics or quote marks are added, because he already styles the text
   himself in Wix and the page should not editorialise on top of that. */
.body { --indent-step: 32px; }

/* A single level of indentation is how Greg sets off a quotation from the book, so it is treated as
   one rather than merely nudged right: a gold rule, a sand ground, and room to breathe. Deeper
   indents stay plain indentation, because those are nesting inside the quote, not a new quote.

   No quote marks are added and nothing is italicised. His excerpts already carry their own
   punctuation and he styles the text in Wix; a decorative opening quote would sit next to a real
   one, and forcing italics would fight what he chose. */
.body .indent-1 {
  margin: 0;
  padding: 7px 22px 7px 21px;
  border-left: 3px solid var(--gold);
  background: var(--paper-2);
  max-width: 64ch;
}
/* Consecutive indented lines are ONE quotation — a run of dialogue, most often — so they join into
   a single block instead of repeating the rule with a gap punched through it. The spacing is put on
   the unindented paragraphs either side, which needs no :has() and no first/last-of-type guessing
   about where a run begins. */
.body p:not([class]) + .indent-1,
.body h2 + .indent-1, .body h3 + .indent-1, .body h4 + .indent-1 { margin-top: 19px; }
.body .indent-1:first-child { margin-top: 0; }
.body .indent-1 + p:not([class]),
.body .indent-1 + ul, .body .indent-1 + ol { margin-top: 19px; }
.body .indent-1 + p:not([class]) { padding-top: 0; }

.body .indent-2, .body .indent-3, .body .indent-4, .body .indent-5, .body .indent-6 {
  margin-left: var(--indent-step);
  max-width: 62ch;
}
.body .indent-3 { margin-left: calc(var(--indent-step) * 1.5); }
.body .indent-4 { margin-left: calc(var(--indent-step) * 2); }
.body .indent-5 { margin-left: calc(var(--indent-step) * 2.5); }
.body .indent-6 { margin-left: calc(var(--indent-step) * 3); }

.body ul, .body ol { margin: 0 0 19px; padding-left: 1.4em; }
.body ul { list-style: disc; }
.body ol { list-style: decimal; }
.body li { margin-bottom: 9px; padding-left: 4px; }
.body li:last-child { margin-bottom: 0; }
/* A LIST_ITEM wraps its text in a paragraph, which would otherwise inherit the 19px gap and space
   the bullets out like separate paragraphs. */
.body li > p { margin-bottom: 0; }
.body li > p + p { margin-top: 9px; }
.body li ul, .body li ol { margin: 9px 0 0; }

@media (max-width: 700px) {
  .body { --indent-step: 16px; }
  .body .indent-1 { padding-left: 15px; padding-right: 12px; }
}

/* ---------- compact subscribe on the review share row ----------
   The full navy block reads as an ending, which is right on a hub and wrong straight after a review:
   it walls off the run into the next book. Same promise, same endpoint, one line — pushed to the far
   end of the share row so the share controls keep their grouping. */
.share .submini { display: flex; align-items: center; gap: 8px; margin-left: auto; }
/* Matches the SHARE label on the same line — same size, weight, tracking and case. Two labels
   sitting side by side in different styles read as two unrelated things. */
.share .submini .lbl { font: 700 9.5px var(--sans); letter-spacing: .16em; text-transform: uppercase;
  color: var(--mute); white-space: nowrap; }
.share .submini input { height: 32px; width: 172px; border: 1px solid var(--line); border-radius: 999px;
  padding: 0 13px; font: 400 12.5px var(--sans); color: var(--navy); background: #fff; }
.share .submini input::placeholder { color: #A9A296; }
.share .submini input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.share .submini button { height: 32px; border: 0; border-radius: 999px; padding: 0 15px;
  background: var(--gold); color: #fff; font: 600 12px var(--sans); cursor: pointer; white-space: nowrap; }
.share .submini button:hover { background: var(--navy); }

/* Below the point where both groups fit on one line, the form drops to its own row and stretches,
   rather than squeezing the email field down to something unusable. */
@media (max-width: 860px) {
  .share .submini { margin-left: 0; width: 100%; margin-top: 12px; }
  .share .submini input { flex: 1; width: auto; min-width: 0; }
}

/* ---------- "More by this author" rows ----------
   Title, then its pills on their own line, then the teaser — the pills belong to the book, not to
   the space beside its name, and stacking them keeps a long title from squeezing them. Everything
   centres against the row so the cover and the stars sit level with the middle of the text block. */
.arank { align-items: center; }
/* NOT `.meta` — proto.css line 521 already owns that name for the review header's pill row, where it
   is display:flex. Borrowing it turned the title, pills and teaser into three columns side by side,
   which is exactly what Greg was looking at while I insisted the markup stacked them. The markup did;
   the class name made it behave otherwise. Component internals get a prefixed name. */
.arank .abtext { min-width: 0; flex: 1; display: block; }
/* Stated explicitly. The markup already puts these in separate block divs, but this row is the one
   place two pill variants and three text lines meet, and a stray inline rule here is invisible until
   someone sees pills hanging off the end of a title. */
.arank .t { display: block; }
.arank .y { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 6px; }
/* Both pill variants lead with a left margin, meant for sitting after an author name. On their own
   line that pushes the first one out of alignment with the title above it. */
.arank .y > .ypill:first-child, .arank .y > .bopill:first-child { margin-left: 0; }
.arank .v { font-family: var(--serif); font-size: 13.5px; line-height: 1.5; color: #4A453E;
  margin-top: 7px; max-width: 62ch; }
.arank .s { margin-left: auto; }
.arank .an { flex: none; }
/* The row is taller now that it carries three stacked lines, so the cover grows with it rather than
   sitting as a stamp in the middle of a tall row. */
.arank img { width: 46px; height: 70px; }

/* ---------- authored "Similar titles" ----------
   Entries are written by hand, so a row may name a book with no review (no link, no stars) and may
   carry a one-line reason. Prefixed class on the text block — `.meta` taught me not to borrow a
   generic name for component internals. */
/* The note runs the full width of the card, on its own line beneath the stars.
   A wrapped flex line does that in three declarations. The grid version I tried first put the cover
   in a cell spanning every row, which stretched the first row to the cover's height and opened a
   40px hole between the title and the author — the layout was fighting the thing it was aligning. */
.cmp .r { flex-wrap: wrap; align-items: center; row-gap: 0; }
.cmp .cmpmeta { min-width: 0; flex: 1; }
.cmp .r > .s.stars { font-size: 11px; white-space: nowrap; }
.cmp .r > .why {
  flex: 0 0 100%;
  font-family: var(--serif); font-size: 12.5px; line-height: 1.45; color: #5A554E;
  /* Indented to the text column so it lines up with the title rather than under the cover. */
  margin: 6px 0 0 45px;
}
.cmp .r.unlinked { cursor: default; }
.cmp .r.unlinked:hover { background: none; }

/* The suggest block's CTA is a link on a review page and a span on the TBR page; proto.css styles it
   by class, so only the anchor's underline needs removing. */
.quiet a.go3 { text-decoration: none; }
.quiet a.go3:hover { background: var(--navy-d, #0d233c); }

/* ---------- subscribe result, written by subscribe.js ----------
   Hidden until there is something to say. On success the fields go and the message takes their place,
   so nobody submits twice; on error the fields stay so the address can be corrected. */
.submsg { display: none; }
form[data-state] .submsg { display: block; }
.submini[data-state="done"] .lbl,
.submini[data-state="done"] input,
.submini[data-state="done"] button { display: none; }
/* nowrap holds the one-line layout on the desktop share row. It is removed on a phone, where the row
   is stacked and "Thanks — you are on the list. The next digest goes out on the 1st." is 400px of
   unbreakable text inside a 375px screen. */
.submini .submsg { font: 500 12.5px var(--sans); color: var(--navy); white-space: nowrap; }
@media (max-width: 760px) { .submini .submsg { white-space: normal; } }
.submini[data-state="error"] .submsg { color: #8C1D18; white-space: normal; }
.submini[data-state="sending"] .submsg { color: var(--mute); }

.subctx[data-state="done"] form input,
.subctx[data-state="done"] form button { display: none; }
.subctx form { position: relative; flex-wrap: wrap; }
.subctx .submsg { font: 500 13.5px var(--sans); color: #fff; flex-basis: 100%; margin-top: 8px; }
.subctx form[data-state="done"] .submsg { margin-top: 0; }
.subctx form[data-state="error"] .submsg { color: #F5C4B3; }

/* ---------- suggest a book ----------
   The prototype never had a form page, so every rule here is new. The palette and type scale are the
   prototype's, taken through the same variables rather than re-picked, so the page reads as part of
   the site and not as a form bolted to the end of it.

   Two columns on a wide screen, one below 900px, with the aside second in the source so it lands
   under the form rather than above it when they stack. */
.sgrid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 44px; margin-top: 26px; }
@media (max-width: 900px) { .sgrid { grid-template-columns: 1fr; gap: 30px; } }

.sform { display: grid; gap: 20px; align-content: start; }
.sfield { display: grid; gap: 6px; }
.sfield label { font: 600 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--navy); }
/* "optional" rather than an asterisk on the one required field: an asterisk asks the reader to hunt
   for a legend, and four of the five fields are the optional ones. */
.sopt { font-weight: 500; letter-spacing: .04em; text-transform: none; color: var(--mute); }
/* The required marker. Red, because that is what an asterisk on a form means everywhere else, and a
   gold one would read as decoration on a page that already uses gold for emphasis. */
.sreq { color: #C5221F; font-weight: 700; margin-left: 1px; }
.shint { font: 400 13px var(--sans); color: #5A554E; line-height: 1.5; }
.sform input, .sform textarea {
  font: 400 15px var(--serif); color: var(--char); background: var(--paper);
  border: 1px solid var(--line); border-radius: 5px; padding: 11px 13px; width: 100%;
}
.sform textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.sform input:focus, .sform textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.sform input:disabled, .sform textarea:disabled { background: var(--paper-2); color: var(--mute); }

/* The mailing-list opt-in. Sits in the paper-2 well so it reads as a distinct offer rather than a
   sixth question, and the label is clickable along with the box. */
.scheck { display: flex; gap: 11px; align-items: flex-start; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
.scheck input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--gold); flex: none; }
.scheck label { font: 600 14px var(--sans); color: var(--navy); text-transform: none; letter-spacing: 0; cursor: pointer; }
.scheck .shint { margin-top: 3px; font-size: 12.5px; }

.sactions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sform button {
  background: var(--navy); color: #fff; border: 0; border-radius: 5px;
  padding: 13px 24px; font: 600 13px var(--sans); cursor: pointer;
}
.sform button:hover { background: var(--navy-d); }
.sform button:disabled { background: var(--mute); cursor: default; }
/* .submsg is hidden until a form carries data-state; that rule is shared with subscribe. */
.sform .submsg { font: 500 13.5px var(--sans); color: var(--navy); line-height: 1.5; }
.sform[data-state="sending"] .submsg { color: var(--mute); }
.sform[data-state="done"] .sfield, .sform[data-state="done"] button { display: none; }
.sform[data-state="done"] .submsg { font-family: var(--serif); font-size: 16px; }

.snote p { font: 400 14px var(--sans); color: #5A554E; line-height: 1.6; margin-top: 14px; }
.snote p b { color: var(--navy); font-weight: 600; }
.snote a { color: var(--gold-t); font-weight: 600; border-bottom: 1px solid var(--line); }
/* The quotation block, borrowed from the CTA that sends people here, stacked rather than in a row
   because this column is narrow. */
.quiet.sq { margin-top: 0; flex-direction: column; align-items: flex-start; gap: 10px; }
.quiet.sq blockquote { font-size: 20px; }

/* ---------- the hidden attribute must always win ----------
   The ranking toolbar filters by setting el.hidden, and nothing happened: the count updated while
   every row stayed on screen. `[hidden]{display:none}` is a UA rule at specificity (0,1,0) and
   `.lrow{display:grid}` is also (0,1,0) — same weight, later rule wins, and the author stylesheet
   comes last. So the class quietly out-ranked the attribute on every filterable row.

   !important is the right tool exactly here: `hidden` means hidden, and there is no case where a
   display rule should beat it. Site-wide rather than per-class, because the next component to be
   filtered would hit the same trap and look equally broken. */
[hidden] { display: none !important; }

/* ---------- the TBR chip on a book's own page ----------
   The same shape as the genre chips beside it, inverted: navy fill, white text, and the shelf it is
   on picked out so the useful half is the half that stands out.

   SAND, not the brand gold. #917237 on navy measures 3.1:1 and this is 12px bold — the same call as
   the wordmark, and for the same reason. Sand is the palette's gold for dark grounds. */
.chip.tbrchip { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.tbrchip b { color: var(--sand); font-weight: 700; }
