/* Inline comments: a quiet mark in the margin, a small form below the block. */
.c-block { position: relative; }
.c-mark {
  position: absolute; right: -1.9rem; top: 0.15em;
  width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 4px;
  background: none; color: #9aa; cursor: pointer; opacity: 0;
  transition: opacity .15s;
}
.c-block:hover > .c-mark, .c-mark:focus { opacity: 1; }
/* No box behind the icon: it sits in the margin, where the content column's
   overflow clips anything with a background. The colour change is enough. */
.c-mark:hover { color: #2a6; }
.c-mine > .c-mark { opacity: .7; color: #2a6; }
pre.c-block > .c-mark { top: 0.5rem; }
@media (max-width: 991px) {
  /* No hover on a phone: the mark belongs to the blocks crossing the middle
     of the screen (comments.js sets .c-near), and fades with the scroll. */
  .c-mark { right: -0.25rem; top: -0.9rem; opacity: 0; transition: opacity .35s ease; }
  .c-block.c-near > .c-mark { opacity: .8; }
  .c-block:hover > .c-mark { opacity: 0; }
  .c-block.c-near:hover > .c-mark, .c-block.c-near > .c-mark:focus, .c-mine.c-near > .c-mark { opacity: .9; }
}
.c-pop {
  margin: .5rem 0 1rem; padding: .75rem .9rem; border: 1px solid #d8d8d8; border-radius: 8px;
  background: #fbfbf8; font-size: .92rem; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.c-quote { color: #666; font-style: italic; font-size: .85rem; margin-bottom: .5rem; border-left: 3px solid #ddd; padding-left: .5rem; }
.c-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.c-form input, .c-form textarea { flex: 1 1 10rem; font: inherit; padding: .35rem .5rem; border: 1px solid #ccc; border-radius: 5px; background: #fff; }
.c-form textarea { width: 100%; margin-top: .5rem; resize: vertical; }
.c-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.c-foot { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; margin-top: .5rem; }
.c-foot button { font: inherit; padding: .3rem .8rem; border-radius: 5px; border: 1px solid #bbb; background: #fff; cursor: pointer; }
/* The fine print: under the buttons, small, and in the UI face rather than the
   book's serif so it reads as the form's, not the page's. */
.c-fine { margin-top: .4rem; font: .75rem/1.4 -apple-system, "Segoe UI", system-ui, sans-serif; color: #777; text-align: right; }
.c-fine a { color: inherit; }
.c-send { background: #2a6 !important; color: #fff; border-color: #2a6 !important; }
.c-send:disabled { opacity: .6; }
.c-status { margin-top: .35rem; font-size: .85rem; color: #444; }
.c-status:empty { display: none; }   /* no reserved line under the form */
.cf-turnstile { margin-top: .5rem; }
@media (prefers-color-scheme: dark) {
  .c-pop { background: #1e1e1e; border-color: #444; }
  .c-form input, .c-form textarea { background: #2a2a2a; color: #eee; border-color: #555; }
  .c-quote { color: #aaa; }
}

/* The comment form: a modal in the middle of the screen, on every screen size.
   The page under it is not scrolled, resized or locked. */
.c-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 1040; }
.c-pop.c-modal {
  position: fixed; z-index: 1041; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(30rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto;
  margin: 0; padding: 1rem 1.2rem 1.1rem; box-sizing: border-box;
  border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.c-modal .c-fine { text-align: left; }

/* Author mode: a count on each commented block, a panel with the comments. */
.c-badge {
  position: absolute; right: -3.4rem; top: 0.35em; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem;
  border: 0; border-radius: 999px; background: #0a6ab5; color: #fff; font: 700 .62rem/1.05rem system-ui, sans-serif;
  cursor: pointer; opacity: .4; z-index: 2; transition: opacity .15s;
}
.c-badge:hover, .c-badge:focus, .c-block:hover > .c-badge { opacity: 1; }
.c-badge.c-badge-done { background: #9aa; }
/* The badge sits to the right of the mark, not on it: the mark still opens
   a new comment, the badge opens the ones already there. */
.c-author .c-block:has(.c-badge) > .c-mark { opacity: .5; }
@media (max-width: 991px) { .c-badge { right: -1.5rem; top: -0.9rem; } }
.c-panel {
  margin: .5rem 0 1rem; padding: .5rem .8rem; border: 1px solid #d8d8d8; border-left: 3px solid #0a6ab5;
  border-radius: 6px; background: #fbfbf8; font: .92rem/1.45 -apple-system, "Segoe UI", system-ui, sans-serif;
}
.c-item { padding: .45rem 0; border-bottom: 1px solid #e8e8e8; }
.c-item:last-of-type { border-bottom: 0; }
.c-item.resolved { opacity: .6; } .c-item.spam { opacity: .45; }
.c-item.spam p { text-decoration: line-through; }
.c-item p { margin: .25rem 0 0; font-family: inherit; }
.c-item-meta { font-size: .8rem; color: #555; display: flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: baseline; }
.c-st { font-weight: 600; color: #0a6ab5; }
.c-item.resolved .c-st { color: #4f9d69; } .c-item.spam .c-st { color: #d08a2e; }
.c-item-act { margin-left: auto; display: flex; gap: .3rem; }
.c-item-act a, .c-item-act button { font: 600 .74rem/1.4 system-ui, sans-serif; padding: .1rem .5rem; border: 1px solid #bbb; border-radius: 3px; background: #fff; color: #555; cursor: pointer; text-decoration: none; }
.c-item-act a:hover, .c-item-act button:hover { color: #0a6ab5; border-color: #0a6ab5; }
.c-replied { color: #4f9d69; font-style: italic; }
.c-panel-foot { font-size: .78rem; margin-top: .4rem; text-align: right; }
@media (prefers-color-scheme: dark) {
  .c-panel { background: #1e1e1e; border-color: #444; } .c-item { border-color: #333; } .c-item-meta { color: #aaa; }
  .c-item-act a, .c-item-act button { background: #2a2a2a; color: #ccc; border-color: #555; }
}
.c-replyform { margin-top: .4rem; }
.c-replyform textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .35rem .5rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; }
.c-replyform .c-item-act { justify-content: flex-end; margin-top: .3rem; }
.c-item-meta { row-gap: .35rem; }
@media (prefers-color-scheme: dark) { .c-replyform textarea { background: #2a2a2a; color: #eee; border-color: #555; } }

/* The subscribe dialog (subscribe.js): a modal in the middle of the screen,
   on every screen size. The page under it is not scrolled, resized or locked. */
.s-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 1040; }
.s-dialog {
  position: fixed; z-index: 1041; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(26rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto;
  padding: 1.1rem 1.3rem 1.2rem; box-sizing: border-box;
  background: #fbfbf8; border: 1px solid #d8d8d8; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18);
  font: .95rem/1.5 -apple-system, "Segoe UI", system-ui, sans-serif; color: #222;
}
.s-dialog h2 { margin: 0 1.5rem .6rem 0; font: 700 1.25rem/1.2 "Open Sans", system-ui, sans-serif; font-stretch: 75%; }
.s-close { position: absolute; top: .5rem; right: .6rem; border: 0; background: none; font-size: 1.4rem; line-height: 1; color: #888; cursor: pointer; }
.s-form label { display: block; margin-top: .6rem; font-size: .8rem; font-weight: 600; color: #666; }
.s-form label small { font-weight: 400; }
.s-form input { display: block; width: 100%; box-sizing: border-box; margin-top: .25rem; padding: .45rem .55rem; font: inherit; border: 1px solid #ccc; border-radius: 5px; background: #fff; }
.s-foot { display: flex; align-items: center; gap: .8rem; margin-top: .9rem; flex-wrap: wrap; }
.s-foot small { color: #777; font-size: .75rem; }
.s-send { font: 600 .9rem system-ui, sans-serif; padding: .45rem 1rem; border-radius: 5px; border: 0; background: #0a6ab5; color: #fff; cursor: pointer; }
.s-send:disabled { opacity: .6; }
.s-done { margin: .4rem 0; font-size: 1rem; }
@media (prefers-color-scheme: dark) {
  .s-dialog { background: #1e1e1e; border-color: #444; color: #ddd; }
  .s-form input { background: #2a2a2a; color: #eee; border-color: #555; }
}
