/* USFM Compare — "reading room".
   Chrome recedes (graphite); paper columns lead; scripture set in a serif for
   long multi-script reading; red is spent only on chapter/verse numerals, after
   the rubrication tradition the text comes from. Structure lives in Python;
   all appearance is here. Self-contained: system font stacks, no external calls. */

:root {
  --ink: #1f2430;          /* graphite chrome */
  --ink-soft: #2b3242;     /* raised chrome elements */
  --chrome-text: #dcdee6;  /* text on graphite */
  --chrome-dim: #9aa1b2;   /* secondary text on graphite */

  --ground: #e7e4dd;       /* desk behind the columns */
  --paper: #fbfaf7;        /* column reading surface */
  --rail: #f2f0ea;         /* marker rail */
  --text: #23262b;         /* body ink */
  --muted: #767a85;        /* secondary text on paper */
  --rule: #e4e2db;         /* hairlines */

  --rubric: #9e2b25;       /* chapter & verse numerals only */
  --content: #2f5aa8;      /* content markers */
  --format: #3e7a57;       /* formatting markers */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* -- top bar ---------------------------------------------------------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .7rem 1.25rem;
  background: var(--ink);
  color: var(--chrome-text);
  border-bottom: 1px solid #000;
}
.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: .01em;
}

#upload { display: flex; align-items: center; gap: .6rem; }
.file-input {                            /* hidden; opened by the "Open" button */
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}
.btn-open {
  font: inherit; font-size: .82rem;
  padding: .34rem .95rem;
  background: #e9e6df; color: #1f2430;
  border: 0; border-radius: 5px; cursor: pointer;
}
.btn-open:hover { background: #fff; }
#upload.at-cap .btn-open { opacity: .35; pointer-events: none; }
.cap-note { color: var(--chrome-dim); font-size: .78rem; }

.syncs { margin-left: auto; display: flex; gap: 1.1rem; }
.syncs label {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--chrome-dim); cursor: pointer; user-select: none;
}
.syncs input { accent-color: #7f9cd0; }

/* -- reading stage ---------------------------------------------------- */
.stage { flex: 1 1 auto; min-height: 0; position: relative; padding: 1rem 1.25rem; }
.columns {
  display: flex; gap: 1rem; height: 100%;
  align-items: stretch; overflow-x: auto;
}

.col {
  flex: 0 0 31rem; max-width: 92vw; height: 100%;
  display: flex;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(30, 36, 48, .10), 0 6px 16px rgba(30, 36, 48, .06);
  overflow: hidden;
}

/* marker rail on the leading edge (right in RTL, via flex + dir) */
.col-bar {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 3px;
  padding: .55rem .4rem;
  background: var(--rail);
  border-inline-end: 1px solid var(--rule);
  overflow-y: auto;
}
.mbtn {
  font-family: var(--mono); font-size: .72rem; line-height: 1.4;
  text-align: start; cursor: pointer;
  padding: 1px 6px; border-radius: 4px;
  color: var(--content);
  background: color-mix(in srgb, var(--content) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--content) 30%, transparent);
}
.mbtn[data-kind="fmt"] {
  color: var(--format);
  background: color-mix(in srgb, var(--format) 12%, transparent);
  border-color: color-mix(in srgb, var(--format) 32%, transparent);
}
.mbtn.struck { text-decoration: line-through; color: var(--muted);
               background: transparent; border-color: var(--rule); }

/* column body — the reading surface */
.col-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.col-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .45rem .85rem;
  border-bottom: 1px solid var(--rule);
}
.col-name {
  font-size: .8rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.col-close {
  border: 0; background: none; color: #b7b3aa;
  font-size: 1.15rem; line-height: 1; padding: 0 .2rem; cursor: pointer;
}
.col-close:hover { color: var(--rubric); }

.col-body {
  flex: 1 1 auto; overflow-y: auto;
  padding: .8rem 1.4rem 2.5rem;
  font-family: var(--serif);
  font-size: 1.12rem; line-height: 1.62;
  color: var(--text);
}

/* -- rendered scripture ---------------------------------------------- */
.hidden { display: none; }                             /* marker content toggled off */
.para { text-indent: 1ch; margin: 0 0 .15rem; }        /* plain: one-space first line */
.plain { text-indent: 1ch !important; padding-inline-start: 0 !important;
         text-align: start !important; display: block !important; }

.book-title { font-family: var(--serif); font-size: 1.5rem; margin: .2rem 0 .6rem;
              text-indent: 0; }
.section-heading {                                     /* editorial, so set in sans */
  font-family: var(--sans); font-weight: 600; font-size: .92rem;
  color: #3c4150; margin: 1.35em 0 .35em; text-indent: 0;
}
.chapter-number {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.9rem; line-height: 1; color: var(--rubric);
  margin: 1.1em 0 .35em; text-indent: 0;
}
.verse-number {
  font-family: var(--sans); font-size: .62em; font-weight: 700;
  vertical-align: .35em; color: var(--rubric);
  margin-inline-end: 2px; letter-spacing: .02em;
}
.meta { color: var(--muted); font-style: italic; text-indent: 0; }
.id-line { color: #a7a49b; font-family: var(--mono); font-size: .78rem;
           text-indent: 0; }

/* -- empty state (invitation) ---------------------------------------- */
.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem; pointer-events: none;
}
.empty-lead { font-family: var(--serif); font-size: 1.6rem; color: #4a4e5a; margin: 0; }
.empty-sub { font-size: .95rem; color: var(--muted); margin: .5rem 0 0; }

@media (prefers-reduced-motion: no-preference) {
  .col { transition: box-shadow .2s ease; }
}
