/* comments.css — inline selection comments.
 * Brutalist: 1px solid black, white background, monospace chrome, serif body.
 * No shadows, no gradients, no rounded corners. */

/* ── Affordance button ─────────────────────────────────────────── */
.inline-comment-affordance {
    position: absolute;
    z-index: 9001;
    padding: 4px 10px;
    background: #fff;
    color: #000;
    border: 1px solid #000;
    border-radius: 0;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: none;
    line-height: 1.2;
}
.inline-comment-affordance:hover,
.inline-comment-affordance:focus {
    background: #000;
    color: #fff;
    outline: none;
}

/* ── Comment form ──────────────────────────────────────────────── */
.inline-comment-form {
    position: absolute;
    z-index: 9002;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 12px;
    font-family: "Times New Roman", Times, serif;
}
.inline-comment-form .icf-head {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #000;
}
.inline-comment-form .icf-quote {
    font-style: italic;
    font-size: 14px;
    line-height: 1.45;
    padding: 6px 10px;
    border-left: 3px solid #000;
    margin-bottom: 10px;
    color: #333;
    background: #f7f7f7;
    max-height: 90px;
    overflow: auto;
}
.inline-comment-form .icf-textarea {
    width: 100%;
    min-height: 80px;
    padding: 7px 9px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font-family: "Times New Roman", Times, serif;
    font-size: 15px;
    line-height: 1.45;
    resize: vertical;
    border-radius: 0;
    box-shadow: none;
}
.inline-comment-form .icf-textarea:focus {
    outline: 2px solid #000;
    outline-offset: -1px;
}
.inline-comment-form .icf-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}
.inline-comment-form .icf-actions button {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 0;
}
.inline-comment-form .icf-cancel {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}
.inline-comment-form .icf-cancel:hover { background: #fffacd; }
.inline-comment-form .icf-send {
    background: #000;
    color: #fff;
    border: 1px solid #000;
}
.inline-comment-form .icf-send:hover { background: #fffacd; color: #000; }
.inline-comment-form .icf-send:disabled {
    opacity: 0.6;
    cursor: wait;
}
.inline-comment-form .icf-status {
    margin-top: 8px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    color: #b91c1c;
    min-height: 14px;
}

/* ── Toast ─────────────────────────────────────────────────────── */
.inline-comment-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9100;
    padding: 8px 14px;
    background: #000;
    color: #fff;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    border: 1px solid #000;
    transition: opacity 0.4s linear;
}
.inline-comment-toast.is-leaving { opacity: 0; }

/* ── Marker on the prose ───────────────────────────────────────── */
/* Distinct from glossary's hairline dotted underline: thicker dotted,
 * cooler color (steel blue), so the two annotations don't read alike. */
.inline-comment-marker {
    background: transparent;
    color: inherit;
    text-decoration: underline dotted #1e40af;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    cursor: pointer;
    padding: 0;
}
.inline-comment-marker:hover {
    background: #fef9c3;
}
.inline-comment-marker .icm-badge {
    display: inline-block;
    margin-left: 3px;
    padding: 0 4px;
    border: 1px solid #1e40af;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10px;
    font-weight: 700;
    color: #1e40af;
    background: #fff;
    vertical-align: super;
    line-height: 1.2;
    text-decoration: none;
}

/* ── Comment card (when clicking a marker badge) ───────────────── */
.inline-comment-card {
    position: absolute;
    z-index: 9050;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 12px;
    font-family: "Times New Roman", Times, serif;
}
.inline-comment-card .icc-head {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #000;
}
.inline-comment-card .icc-item {
    padding: 8px 0;
    border-bottom: 1px dashed #000;
}
.inline-comment-card .icc-item:last-of-type {
    border-bottom: 0;
}
.inline-comment-card .icc-ts {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10px;
    color: #666;
    margin-bottom: 4px;
}
.inline-comment-card .icc-body {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.inline-comment-card .icc-foot {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}
.inline-comment-card .icc-close {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    background: #fff;
    color: #000;
    border: 1px solid #000;
    cursor: pointer;
    border-radius: 0;
}
.inline-comment-card .icc-close:hover { background: #fffacd; }

/* ── In-card edit/delete affordance ─────────────────────────────── */
.inline-comment-card .icc-item {
    position: relative;
}
.inline-comment-card .icc-actions {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.inline-comment-card .icc-action {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    cursor: pointer;
    border-radius: 0;
    line-height: 1.3;
}
.inline-comment-card .icc-action:hover,
.inline-comment-card .icc-action:focus {
    background: #fffacd;
    outline: none;
}
.inline-comment-card .icc-action.is-confirm {
    background: #000;
    color: #fff;
}
.inline-comment-card .icc-action.is-confirm:hover { background: #fffacd; color: #000; }
.inline-comment-card .icc-action[disabled] { opacity: 0.5; cursor: wait; }

.inline-comment-card .icc-edit-area {
    width: 100%;
    min-height: 70px;
    padding: 6px 8px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font-family: "Times New Roman", Times, serif;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
    border-radius: 0;
    box-shadow: none;
    margin-top: 6px;
}
.inline-comment-card .icc-edit-area:focus {
    outline: 2px solid #000;
    outline-offset: -1px;
}
.inline-comment-card .icc-status {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10.5px;
    color: #b91c1c;
    min-height: 12px;
    margin-top: 3px;
}

/* ── History panel (per-row collapsible prior-version timeline) ──── */
/* Mirrors templates/inline_comments.html ic-history-panel styling but scoped
 * to the floating in-page card. The panel is hidden by default and toggled
 * via the per-row "history" button; entries are fetched lazily on first open. */
.inline-comment-card .icc-history-panel {
    margin-top: 6px;
    padding: 6px 8px;
    border: 1px dashed #000;
    background: #fafafa;
    font-family: "Times New Roman", Times, serif;
    font-size: 13px;
    line-height: 1.45;
}
.inline-comment-card .icc-history-panel[hidden] { display: none; }
.inline-comment-card .icc-history-loading {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10.5px;
    color: #666;
    font-style: italic;
}
.inline-comment-card .icc-history-error {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10.5px;
    color: #b91c1c;
}
.inline-comment-card .icc-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.inline-comment-card .icc-history-entry {
    padding: 4px 0;
    border-top: 1px dotted #aaa;
}
.inline-comment-card .icc-history-entry:first-child { border-top: 0; }
.inline-comment-card .icc-history-entry.is-current {
    background: #fffacd;
    padding: 4px 6px;
    margin: 0 -6px;
}
.inline-comment-card .icc-history-ts {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 10px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}
.inline-comment-card .icc-history-entry.is-current .icc-history-ts {
    color: #000;
    font-weight: 700;
}
.inline-comment-card .icc-history-text { white-space: pre-wrap; }

/* ── Marker flash when scrolled-to from rail / toolbar ─────────── */
.inline-comment-marker.icm-flash {
    background: #fffacd;
    outline: 2px solid #1e40af;
    outline-offset: 2px;
    transition: outline-color 0.6s linear;
}

/* ── Rail "YOUR COMMENTS ON THIS PAGE" section ─────────────────── */
/* Visual contract: same chrome as .glossary-pinned-section (sub-head, item
 * list with 1px black borders), but distinct via a blue-tinted accent. */
.rail-comments-section {
    border-bottom: 1px solid #000;
    background: #fff;
}
.rail-comments-section .gr-sub-head {
    /* Reuse the .gr-sub-head selector from glossary.css for consistency.
     * This rule isn't strictly necessary, but keeps the file self-documenting. */
    background: #eef2ff; /* faint blue tint to differentiate from pinned glossary */
    color: #1e40af;
}
.rail-comments-section .rail-comments-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.rail-comments-section .rail-comment-item {
    padding: 8px 10px;
    border-bottom: 1px solid #000;
    cursor: pointer;
}
.rail-comments-section .rail-comment-item:last-child { border-bottom: 0; }
.rail-comments-section .rail-comment-item:hover,
.rail-comments-section .rail-comment-item:focus {
    background: #fffacd;
    outline: none;
}
.rail-comments-section .rail-comment-item:focus-visible {
    outline: 2px solid #000;
    outline-offset: -2px;
}
.rail-comments-section .rci-quote {
    font-family: "Times New Roman", Times, serif;
    font-style: italic;
    font-size: 12px;
    line-height: 1.45;
    color: #333;
    margin-bottom: 3px;
}
.rail-comments-section .rci-comment {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    line-height: 1.45;
    color: #111;
}

/* ── Chapter-toolbar comment-count badge ───────────────────────── */
.toolbar-comment-count {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11.5px;
    font-weight: 700;
    color: #1e40af;
    text-decoration: underline;
}
.toolbar-comment-count:hover { background: #fffacd; }

/* ── Mobile tightening ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .inline-comment-form { padding: 10px; }
    .inline-comment-form .icf-quote { font-size: 13px; }
    .inline-comment-card { padding: 10px; }
    .inline-comment-card .icc-edit-area { font-size: 13px; }
}
