/* ═══════════════════════════════════════════════════════════════
   HarshalOS — manuscript reading view
   The Book → Novel (2) · The Grand River Foundation.
   Reading-room typesetting inside the desktop shell: a contents rail
   and a measured text column. Palette follows css/os.css.
   ═══════════════════════════════════════════════════════════════ */

.ms-app { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }

/* ── header ─────────────────────────────────────────────────── */
.ms-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.ms-head-main { min-width: 0; }
.ms-eyebrow {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.ms-title { font-size: 20px; font-weight: 700; letter-spacing: 0.01em; margin: 4px 0 2px; }
.ms-subtitle { color: var(--text-dim); font-size: 12.5px; font-style: italic; }
.ms-meta { color: var(--text-faint); font-size: 10px; margin-top: 6px; letter-spacing: 0.04em; }
.ms-head-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ms-fontstep { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(4, 8, 15, 0.4); }
.ms-tool {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(11, 19, 36, 0.7);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.ms-fontstep .ms-tool { border-color: transparent; background: none; }
.ms-tool:hover:not([disabled]) { border-color: var(--line-hi); color: var(--text); }
.ms-tool:focus-visible { outline: 1px solid var(--ice); outline-offset: 1px; }
.ms-tool[disabled] { opacity: 0.4; cursor: default; }
.ms-tool-wide { font-family: var(--mono); }
.ms-source { color: var(--text-faint); font-size: 9.5px; line-height: 1.6; border-bottom: 1px solid var(--line); padding-bottom: 10px; }

/* ── body: contents rail + reader ───────────────────────────── */
.ms-body { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ms-rail { position: sticky; top: 0; max-height: 100%; }
.ms-rail-head { font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; color: var(--text-faint); margin-bottom: 8px; }
.ms-rail-list { list-style: none; display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow: auto; scrollbar-width: thin; padding-right: 4px; }
.ms-rail-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 12px;
}
.ms-rail-item:hover { background: rgba(111, 211, 255, 0.05); color: var(--text); }
.ms-rail-item.active { border-color: var(--line-hi); background: rgba(111, 211, 255, 0.08); color: var(--text); }
.ms-rail-item:focus-visible { outline: 1px solid var(--ice); outline-offset: 1px; }
.ms-rail-num { color: var(--gold); font-size: 10px; }
.ms-rail-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-rail-words { color: var(--text-faint); font-size: 9px; letter-spacing: 0.06em; }
.ms-rail-item.active .ms-rail-words { color: var(--ice); }

/* ── the reading column ─────────────────────────────────────── */
.ms-reader {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(9, 15, 29, 0.92), rgba(6, 10, 20, 0.92));
  padding: 26px clamp(18px, 4vw, 44px) 20px;
  max-width: 74ch;
  outline: none;
}
.ms-reader:focus-visible { border-color: var(--line-hi); }
.ms-chapter-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 20px; }
.ms-chapter-eyebrow { color: var(--gold-deep); font-size: 9px; letter-spacing: 0.2em; }
.ms-chapter-title { font-size: 22px; font-weight: 600; letter-spacing: 0.01em; margin: 8px 0 6px; line-height: 1.25; }
.ms-chapter-file { color: var(--text-faint); font-size: 9.5px; }

.ms-text { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; color: #e4ecf8; line-height: 1.72; font-size: inherit; }
.ms-text .ms-p { margin: 0 0 1.05em; text-align: justify; hyphens: auto; }
.ms-text .ms-p:first-of-type { text-indent: 0; }
.ms-h3 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ice);
  margin: 2em 0 0.9em;
}
.ms-quote {
  margin: 1.1em 0 1.3em;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--line-hi);
  color: var(--text-dim);
  font-style: italic;
}
.ms-break { text-align: center; color: var(--gold-deep); letter-spacing: 0.5em; margin: 1.6em 0; font-size: 0.95em; }

.ms-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }
.ms-nav-state { color: var(--text-faint); font-size: 10px; letter-spacing: 0.12em; }

/* ── notices: empty, error, loading ─────────────────────────── */
.ms-notice { border: 1px solid var(--line); border-radius: 10px; padding: 22px; background: rgba(9, 15, 29, 0.8); max-width: 74ch; }
.ms-notice.empty { border-color: var(--line-hi); }
.ms-notice.error { border-color: rgba(255, 92, 122, 0.45); }
.ms-notice .ms-eyebrow { color: var(--gold-deep); }
.ms-notice-body { color: var(--text-dim); font-size: 13px; margin: 10px 0; }
.ms-notice-detail { color: var(--text-faint); font-size: 10px; word-break: break-word; }
.ms-notice .ms-head-tools { justify-content: flex-start; margin-top: 12px; }
.ms-empty { color: var(--text-faint); font-size: 12px; }

@media (max-width: 760px) {
  .ms-head { flex-direction: column; }
  .ms-head-tools { justify-content: flex-start; }
  .ms-body { grid-template-columns: minmax(0, 1fr); }
  .ms-rail { position: static; }
  .ms-rail-list { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 6px; }
  .ms-rail-item { grid-template-columns: 22px auto; white-space: nowrap; }
  .ms-rail-words { display: none; }
  .ms-reader { padding: 20px 18px 16px; }
  .ms-text .ms-p { text-align: left; }
}
