/* ═══════════════════════════════════════════════════════════════════════════
   modules/reader-shell/shell.css — Mithlayn V2 reader shell (v185-isk28)
   ─────────────────────────────────────────────────────────────────────────
   V2 chrome only — thin topbar, mode strip, sidebar shell, context pill,
   bottom sheet, overlay. Empty list/content panes; later phases (v186+)
   wire the data.

   Token mapping: the v006 locked spec referred to standalone token names
   (--bg, --ink, --card, --line, --accent, --shadow…). The project's
   canonical tokens live in styles/tokens.css under the --ms-* prefix.
   This file maps the spec onto the existing token vocabulary; it does
   NOT introduce new color tokens (theme cascade is sacred).

     spec --bg       → --ms-bg
     spec --bg-2     → --ms-bg-2
     spec --ink      → --ms-ink
     spec --muted    → --ms-ink-3
     spec --line     → --ms-hair-2
     spec --card     → --ms-bg-1
     spec --accent   → --ms-mint
     spec --good     → --ms-mint
     spec --warn     → --ms-gold
     spec --bad      → --ms-clay   (project has no red token; clay is closest)
     spec --ease     → --ms-ease

   Drop shadows have no named tokens in the project; values are inlined.

   CSS scoping: every class uses the `rs-` prefix to avoid collisions
   with existing .topbar/.sidebar/.card in the spine. The shell mounts
   inside #rs-shell, which is display:none by default and revealed only
   when body has the `rs-active` class (set by shell.js when the
   feature flag is on).
═══════════════════════════════════════════════════════════════════════════ */

#rs-shell { display: none; }

body.rs-active #rs-shell {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--ms-bg, #0E1418);
  color: var(--ms-ink, #E8DDD0);
  font-family: var(--ms-body, 'Manrope', system-ui, -apple-system, sans-serif);
  font-size: 14px;
  overflow: hidden;
}

/* ── Row 1 · thin topbar (brand · search · profile) ─────────────────── */
.rs-topbar-thin {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  min-height: 60px;
  background: var(--ms-bg-1);
  border-bottom: 1px solid var(--ms-hair-2);
  flex-shrink: 0;
}
.rs-brand {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ms-ink);
  letter-spacing: 0.02em;
}
.rs-search {
  flex: 1;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ms-bg-2);
  border: 1px solid var(--ms-hair-2);
  border-radius: 8px;
}
.rs-search-icon { color: var(--ms-ink-3); font-size: 14px; line-height: 1; }
.rs-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ms-ink);
  font: inherit;
}
.rs-search-input::placeholder { color: var(--ms-ink-3); }
.rs-spacer { flex: 1; }
.rs-profile-chip {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--ms-bg-2);
  border: 1px solid var(--ms-hair-2);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ms-ink-3);
  cursor: pointer;
}

/* ── Row 2 · mode strip (Text · Mushaf · ✦ Memorize) ────────────────── */
.rs-topbar-modes {
  display: flex;
  justify-content: center;
  padding: 10px 18px;
  background: var(--ms-bg-2);
  border-bottom: 1px solid var(--ms-hair-2);
  flex-shrink: 0;
}
.rs-mode-pill {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--ms-bg-1);
  border: 1px solid var(--ms-hair-2);
  border-radius: 999px;
}
.rs-mode-btn {
  padding: 9px 18px;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--ms-ink-3);
  font: 500 13px/1 var(--ms-body, 'Manrope', system-ui, sans-serif);
  cursor: pointer;
  transition: var(--ms-quick, background .18s, color .18s);
}
.rs-mode-btn:hover { color: var(--ms-ink); }
.rs-mode-btn[aria-selected="true"] {
  background: var(--ms-mint);
  color: #fff;
}

/* ── Main row · sidebar (≥900) + content ────────────────────────────── */
.rs-main-row {
  display: flex;
  flex: 1;
  min-height: 0;
}
.rs-sidebar {
  width: 260px;
  background: var(--ms-bg-1);
  border-right: 1px solid var(--ms-hair-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.rs-sidebar.rs-collapsed { display: none; }

.rs-sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ms-hair-2);
}
.rs-sb-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ms-ink);
}
.rs-sb-collapse {
  background: transparent;
  border: 1px solid var(--ms-hair-2);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--ms-ink-3);
  font-size: 12px;
  cursor: pointer;
  line-height: 1.4;
}
.rs-sb-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ms-hair-2);
}
.rs-sb-ring { width: 44px; height: 44px; flex-shrink: 0; }
.rs-sb-ring-track { stroke: var(--ms-hair-2); fill: none; }
.rs-sb-ring-arc   { stroke: var(--ms-mint); fill: none; stroke-linecap: round; }
.rs-sb-progress-text { display: flex; flex-direction: column; gap: 2px; }
.rs-sb-progress-text strong { color: var(--ms-ink); font-size: 13px; font-weight: 600; }
.rs-sb-progress-text small  { color: var(--ms-ink-3); font-size: 11px; }

.rs-sb-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ms-hair-2);
}
.rs-sb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--ms-bg-2);
  border: 1px solid var(--ms-hair-2);
  border-radius: 999px;
  color: var(--ms-ink-3);
  font-size: 11px;
  cursor: pointer;
}
.rs-sb-chip[aria-pressed="true"] {
  background: var(--ms-mint-soft);
  border-color: var(--ms-mint-rim);
  color: var(--ms-mint-2);
}
.rs-sb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ms-hair-2);
  display: inline-block;
}
.rs-sb-dot.is-memorized { background: var(--ms-mint); }
.rs-sb-dot.is-progress  { background: var(--ms-gold); }
.rs-sb-dot.is-review    { background: var(--ms-clay); }

.rs-sb-filter-input {
  margin: 10px 12px;
  padding: 8px 10px;
  background: var(--ms-bg-2);
  border: 1px solid var(--ms-hair-2);
  border-radius: 6px;
  color: var(--ms-ink);
  font: inherit;
  outline: none;
}
.rs-sb-filter-input:focus { border-color: var(--ms-mint-rim); }
.rs-sb-filter-input::placeholder { color: var(--ms-ink-3); }

.rs-sb-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 12px;
}
.rs-sb-list-placeholder {
  padding: 18px 14px;
  color: var(--ms-ink-3);
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
}

/* ── Content area · per-mode placeholder ────────────────────────────── */
.rs-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 24px;
}
.rs-content-placeholder {
  margin: auto;
  text-align: center;
  color: var(--ms-ink-3);
  font-size: 14px;
  line-height: 1.7;
  max-width: 420px;
}
.rs-content-placeholder h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  color: var(--ms-ink);
  margin: 0 0 8px;
  font-weight: 600;
}
.rs-content-placeholder p { margin: 6px 0; }
.rs-content-placeholder code {
  color: var(--ms-mint-2);
  font-family: var(--ms-mono, 'JetBrains Mono', monospace);
  font-size: 12px;
  background: var(--ms-bg-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Pattern 3 · context pill (visible <900) ───────────────────────── */
.rs-context-pill {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1030;
  display: none; /* media query reveals when <900 */
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: var(--ms-bg-1);
  color: var(--ms-ink);
  border: 1px solid var(--ms-hair-3);
  border-radius: 999px;
  box-shadow: 0 12px 36px rgba(0,0,0,.45);
  font: 500 14px/1 var(--ms-body, 'Manrope', system-ui, sans-serif);
  min-width: 200px;
  justify-content: center;
  cursor: pointer;
}
.rs-cp-num {
  padding: 2px 7px;
  background: var(--ms-bg-2);
  border-radius: 5px;
  color: var(--ms-ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.rs-cp-name {
  font-family: var(--font-ar, 'Amiri', serif);
  font-size: 20px;
  color: var(--ms-ink);
  line-height: 1;
}
.rs-cp-caret { color: var(--ms-ink-3); font-size: 10px; }

/* ── Overlay + bottom sheet ─────────────────────────────────────────── */
.rs-overlay {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ms-ease, cubic-bezier(.4,0,.2,1));
}
body.rs-sheet-open .rs-overlay {
  opacity: 1;
  pointer-events: auto;
}
.rs-bottom-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 78vh;
  z-index: 1050;
  background: var(--ms-bg-1);
  border-top: 1px solid var(--ms-hair-3);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 36px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 400ms var(--ms-ease, cubic-bezier(.4,0,.2,1));
}
body.rs-sheet-open .rs-bottom-sheet { transform: translateY(0); }

.rs-bs-grip {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}
.rs-bs-grip-bar {
  width: 42px;
  height: 5px;
  background: var(--ms-hair-3);
  border-radius: 999px;
}
.rs-bs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 12px;
  border-bottom: 1px solid var(--ms-hair-2);
}
.rs-bs-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ms-ink);
}
.rs-bs-close {
  background: transparent;
  border: 1px solid var(--ms-hair-2);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  color: var(--ms-ink-3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

/* ── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .rs-bottom-sheet, .rs-overlay { transition: none; }
}

/* ── Responsive breakpoint ──────────────────────────────────────────── */
@media (max-width: 899.98px) {
  body.rs-active .rs-sidebar       { display: none; }
  body.rs-active .rs-context-pill  { display: inline-flex; }
}
@media (min-width: 900px) {
  body.rs-active .rs-context-pill  { display: none !important; }
  body.rs-active.rs-sheet-open .rs-overlay,
  body.rs-active.rs-sheet-open .rs-bottom-sheet { display: none !important; }
}
