/* Selah. A printed page that happens to be software.
   Light first, warm paper, one reading column, nothing that blinks. */

@font-face {
  font-family: 'Literata';
  src: url('assets/fonts/literata-latin.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'Jakarta';
  src: url('assets/fonts/jakarta-latin.woff2') format('woff2-variations');
  font-weight: 300 800;
  font-style: normal;
  font-display: optional;
}

:root {
  --paper: #fbf6ec;
  --paper-2: #f4ecdd;
  --paper-3: #ece1cd;
  --ink: #1e1a15;
  --ink-2: #5f564a;
  --ink-3: #8d8375;
  --rule: #e2d6c0;
  --rule-soft: #ece2d1;
  --gold: #9c7434;
  --gold-soft: #c9a56a;
  --clay: #9b4f33;
  --field: #fffdf8;
  --shadow-1: 0 1px 2px rgba(58, 44, 24, .05), 0 6px 20px rgba(58, 44, 24, .07);
  --shadow-2: 0 2px 6px rgba(38, 28, 14, .08), 0 26px 60px rgba(38, 28, 14, .18);
  --measure: 34rem;
  --fs: 1;
  --ui: 'Jakarta', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: light;
}

:root[data-theme="dark"], .scene-on {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* placeholder so the cascade below is explicit */
}

/* Dark reading mode. Warm, not blue. Paper at night, not a terminal. */
:root[data-theme="dark"] {
  --paper: #14120e;
  --paper-2: #1c1913;
  --paper-3: #262119;
  --ink: #ece3d3;
  --ink-2: #a89c89;
  --ink-3: #7d7364;
  --rule: #322c22;
  --rule-soft: #262119;
  --gold: #c7a163;
  --gold-soft: #8d723f;
  --clay: #cf8460;
  --field: #1a1712;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 26px 60px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120e;
    --paper-2: #1c1913;
    --paper-3: #262119;
    --ink: #ece3d3;
    --ink-2: #a89c89;
    --ink-3: #7d7364;
    --rule: #322c22;
    --rule-soft: #262119;
    --gold: #c7a163;
    --gold-soft: #8d723f;
    --clay: #cf8460;
    --field: #1a1712;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 26px 60px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1rem;
  line-height: 1.5;
  overflow-x: hidden;
  /* The grain. Three soft washes, no image, invisible until you look. */
  background-image:
    radial-gradient(120% 90% at 12% -10%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(80% 60% at 100% 0%, rgba(201, 165, 106, .12), transparent 65%),
    radial-gradient(90% 70% at 50% 110%, rgba(155, 79, 51, .05), transparent 70%);
  background-attachment: fixed;
}

:root[data-theme="dark"] body,
:root:not([data-theme="light"]) body { }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    background-image:
      radial-gradient(120% 90% at 12% -10%, rgba(255, 245, 225, .045), transparent 60%),
      radial-gradient(80% 60% at 100% 0%, rgba(199, 161, 99, .07), transparent 65%);
  }
}
:root[data-theme="dark"] body {
  background-image:
    radial-gradient(120% 90% at 12% -10%, rgba(255, 245, 225, .045), transparent 60%),
    radial-gradient(80% 60% at 100% 0%, rgba(199, 161, 99, .07), transparent 65%);
}

::selection { background: rgba(156, 116, 52, .22); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: .6em 1em;
  background: var(--field);
  color: var(--ink);
  border-radius: 0 0 .4em 0;
  font: 600 .8rem/1 var(--ui);
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ------------------------------------------------------------------ header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem clamp(1rem, 4vw, 2.4rem);
  background: color-mix(in srgb, var(--paper) 93%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--rule-soft);
}

.mark {
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: lowercase;
  color: var(--ink);
  text-decoration: none;
  padding-right: .2em;
  flex: 0 0 auto;
}
.mark::after {
  content: '';
  display: block;
  height: 1px;
  margin-top: .28em;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.ref-nav {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-inline: auto;
  flex: 0 1 auto;
}
/* The chapter picker belongs to the reader. Named as one rule rather than a
   list of routes, because the list was already missing two of them and would
   miss the next one. Hidden, not removed, so the header keeps its size. */
body:not([data-route="read"]) .ref-nav { visibility: hidden; }

.stepper {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 1.3rem;
  line-height: 1;
  padding: .25em .5em;
  cursor: pointer;
  border-radius: .4em;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.stepper:hover { color: var(--ink); background: var(--paper-2); }
.stepper[disabled] { opacity: .3; cursor: default; }

.ref {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 500;
  color: var(--ink);
  padding: .3em .55em;
  border-radius: .45em;
  display: inline-flex;
  /* Centered, not baseline: with an empty label there is no baseline yet, and
     the caret would drop into place when the book name arrived. */
  align-items: center;
  justify-content: center;
  gap: .45em;
  white-space: nowrap;
  /* The reference is empty until the chapter is known, so its box is held at the
     size it will end up. Nothing moves when the name arrives. */
  min-width: 8em;
  min-height: 2.1em;
  transition: background .18s var(--ease);
}
.ref:hover { background: var(--paper-2); }

.caret {
  width: .42em;
  height: .42em;
  border-right: 1.5px solid var(--gold);
  border-bottom: 1.5px solid var(--gold);
  transform: rotate(45deg) translate(-.05em, -.05em);
}

/* The toolbar never wraps. A button arriving a frame late would otherwise add a
   row to the header and push the whole page down. */
.tools {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: nowrap;
  flex: 0 1 auto;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
}
.tools::-webkit-scrollbar { display: none; }

.tool, .explorers button {
  appearance: none;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-2);
  font: 500 .74rem/1 var(--ui);
  letter-spacing: .04em;
  padding: .55em .7em;
  border-radius: .5em;
  cursor: pointer;
  white-space: nowrap;
  transition: color .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.tool:hover, .explorers button:hover {
  color: var(--ink);
  background: var(--paper-2);
}
.explorers button[aria-expanded="true"],
.tool[aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper-3);
  border-color: var(--rule);
}
.tool-type { font-family: var(--serif); font-size: .86rem; }
.tool-theme .glyph {
  display: block;
  width: .78em;
  height: .78em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  font-size: 1.1rem;
}
.tool-rule {
  width: 1px;
  height: 1.1rem;
  background: var(--rule);
  margin: 0 .3rem;
}

.explorers {
  display: flex;
  gap: .1rem;
  flex-wrap: nowrap;
}
/* The scene toggle only exists on the chapters that have art, so its slot is
   held open. A toolbar that resizes after the text has painted is a layout
   shift, and this is the only control whose presence depends on the data. */
.scene-slot {
  display: flex;
  justify-content: flex-end;
  min-width: 4.6rem;
  flex: 0 0 auto;
}
body:not([data-route="read"]) .scene-slot { display: none; }
body:not([data-route="read"]) .explorers,
body:not([data-route="read"]) .tool-rule,
body:not([data-route="read"]) .tool-type { display: none; }

.type-bar {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding-top: .5rem;
}
.type-bar button {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--field);
  color: var(--ink);
  border-radius: .5em;
  cursor: pointer;
  font: 500 .85rem/1 var(--serif);
  padding: .45em .8em;
}
.type-bar button:hover { border-color: var(--gold-soft); }
.type-readout {
  font: 500 .74rem/1 var(--ui);
  color: var(--ink-2);
  min-width: 3.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: transparent;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  transition: width .12s linear;
}

/* -------------------------------------------------------------------- main */

#app {
  display: block;
  padding: clamp(1.6rem, 5vw, 3.4rem) clamp(1.35rem, 4vw, 2.4rem) 8rem;
  position: relative;
  z-index: 1;
}
#app:focus { outline: none; }

.column {
  max-width: 44rem;
  margin: 0 auto;
}

.boot-note {
  max-width: var(--measure);
  margin: 4rem auto;
  color: var(--ink-3);
  font-size: .9rem;
}

/* ------------------------------------------------------------------ reader */

.chapter-head {
  max-width: var(--measure);
  margin: 0 auto clamp(2rem, 5vw, 3.2rem);
  text-align: center;
}
.eyebrow {
  font: 600 .7rem/1 var(--ui);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1.1rem;
}
.chapter-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 5.2vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  margin: 0;
  color: var(--ink);
}
.chapter-sub {
  margin: .9rem auto 0;
  max-width: 30rem;
  color: var(--ink-2);
  font-size: .95rem;
  line-height: 1.65;
}
.rule-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin: 1.8rem auto 0;
  max-width: 12rem;
  color: var(--gold-soft);
}
.rule-ornament::before,
.rule-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
}
.rule-ornament i {
  width: .34rem;
  height: .34rem;
  background: currentColor;
  transform: rotate(45deg);
}

.passage {
  max-width: var(--measure);
  margin: 0 auto;
  font-family: var(--serif);
  font-size: calc(1.16rem * var(--fs));
  line-height: 1.78;
  color: var(--ink);
  hanging-punctuation: first last;
  text-wrap: pretty;
}

.verse {
  display: inline;
  cursor: pointer;
  border-radius: .25em;
  transition: background .18s var(--ease);
  scroll-margin-top: 7rem;
}
.verse:hover { background: color-mix(in srgb, var(--gold) 9%, transparent); }
.verse.open {
  background: color-mix(in srgb, var(--gold) 15%, transparent);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: .06em .16em;
  margin: 0 -.16em;
}
.verse .n {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 .1em 0 0;
  font-family: var(--ui);
  font-size: .56em;
  font-weight: 600;
  vertical-align: .62em;
  color: var(--gold);
  letter-spacing: .02em;
  margin-right: .18em;
  font-variant-numeric: tabular-nums;
  user-select: none;
  cursor: pointer;
  line-height: 1;
}
.verse .n:hover { color: var(--clay); }
/* Verse one of a drop cap paragraph keeps its button for the keyboard and the
   screen reader, and gives its space to the letter. */
.verse .n.quiet {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.verse .n.quiet:focus-visible {
  position: static;
  width: auto;
  height: auto;
  clip-path: none;
  margin-right: .18em;
}
.verse .t { }

/* A verse another surface asked the reader to light, through selah:highlight.
   The journey map does it as the camera walks the chapter. */
.verse.lit .t {
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--gold-soft) 45%, transparent) 0);
  border-radius: .1rem;
}

.para { margin: 0 0 1.25em; }
.dropcap {
  float: left;
  font-size: 3.5em;
  line-height: .78;
  margin: .06em .09em -.06em 0;
  color: var(--gold);
  font-weight: 500;
}

.poem { margin: 0 0 1.5em; }
.poem .line {
  display: block;
  padding-left: 1.4em;
  text-indent: -1.4em;
}
.poem .line.i2 { padding-left: 3.2em; }
.poem .verse {
  display: block;
  margin-bottom: .45em;
  padding-left: 1.5em;
  text-indent: -1.5em;
}
.poem .verse .t { display: inline; }
/* The first line keeps company with its verse number; the rest break away. */
.poem .line:first-child { display: inline; padding-left: 0; text-indent: 0; }

.verse-heading {
  font-family: var(--ui);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 2.4em 0 1.1em;
  text-align: center;
}

.invite {
  max-width: var(--measure);
  margin: 1.6em auto;
  padding-left: 1.1rem;
  border-left: 2px solid var(--gold-soft);
  font-family: var(--ui);
  font-size: .88rem;
  color: var(--ink-2);
}
.invite button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--gold);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.colophon {
  max-width: var(--measure);
  margin: 4rem auto 0;
  text-align: center;
  color: var(--ink-3);
}
.colophon .selah-word {
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: .3em;
  color: var(--gold-soft);
  text-transform: lowercase;
}
.colophon .next {
  display: inline-block;
  margin-top: 1.6rem;
  font: 500 .8rem/1 var(--ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .35em;
}
.colophon .next:hover { color: var(--ink); border-color: var(--gold); }
.colophon .source {
  margin-top: 2.4rem;
  font-size: .72rem;
  color: var(--ink-3);
  letter-spacing: .02em;
}

/* --------------------------------------------------------------- verse tray */

.tray {
  display: block;
  margin: 1.1em 0 1.4em;
  padding: 1rem 1.1rem;
  background: var(--field);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--gold-soft);
  border-radius: .1em .1em .7em .7em;
  box-shadow: var(--shadow-1);
  font-family: var(--ui);
  animation: tray-in .22s var(--ease) both;
}
@keyframes tray-in {
  from { opacity: 0; transform: translateY(-.4rem); }
  to { opacity: 1; transform: none; }
}
.tray .tray-ref {
  font: 600 .68rem/1 var(--ui);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 .75rem;
}
.tray-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.tray-actions button {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font: 500 .78rem/1 var(--ui);
  padding: .6em .85em;
  border-radius: 2em;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.tray-actions button:hover { border-color: var(--gold-soft); background: var(--paper-2); }

/* -------------------------------------------------------------- book picker */

.picker {
  position: fixed;
  z-index: 45;
  top: 4.6rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(46rem, calc(100vw - 2rem));
  max-height: min(70vh, 40rem);
  overflow: auto;
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: .9rem;
  box-shadow: var(--shadow-2);
  padding: 1.2rem;
  animation: pop-in .2s var(--ease) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-.5rem); }
  to { opacity: 1; transform: translateX(-50%); }
}
.picker h2 {
  font: 600 .7rem/1 var(--ui);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .9rem;
}
.picker .books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: .2rem;
  margin-bottom: 1.2rem;
}
.picker .books button,
.picker .chapters button {
  appearance: none;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-2);
  font: 500 .84rem/1.2 var(--ui);
  text-align: left;
  padding: .5em .6em;
  border-radius: .4em;
  cursor: pointer;
}
.picker .books button:hover,
.picker .chapters button:hover { background: var(--paper-2); color: var(--ink); }
.picker .books button[aria-current="true"] { color: var(--gold); font-weight: 700; }
.picker .chapters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr));
  gap: .2rem;
}
.picker .chapters button {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--serif);
}
.picker .chapters button[aria-current="true"] {
  background: var(--gold);
  color: var(--paper);
}

/* -------------------------------------------------------------------- panel */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(28, 20, 8, .3);
  backdrop-filter: blur(2px);
  animation: fade-in .2s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.panel {
  position: fixed;
  z-index: 46;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(27rem, 100vw);
  background: var(--paper);
  border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  animation: panel-in .28s var(--ease) both;
}
@keyframes panel-in {
  from { transform: translateX(1.5rem); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--rule-soft);
}
.panel-head h2 {
  margin: 0;
  font: 600 .74rem/1 var(--ui);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
}
.panel-close {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 1.4rem;
  line-height: 1;
  padding: .1em .35em;
  border-radius: .4em;
  cursor: pointer;
}
.panel-close:hover { background: var(--paper-2); color: var(--ink); }
.panel-body {
  padding: 1.6rem 1.4rem 3rem;
  overflow: auto;
  color: var(--ink-2);
  font-size: .92rem;
  line-height: 1.7;
}
.panel-body .placeholder-mark {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--ink);
  margin: 0 0 .7rem;
}
.panel-body textarea {
  width: 100%;
  margin-top: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: .6rem;
  background: var(--field);
  color: var(--ink);
  font: 1rem/1.65 var(--serif);
  resize: vertical;
}
.panel-body textarea:focus { border-color: var(--gold-soft); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.pending {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule-soft);
  font-size: .78rem;
  color: var(--ink-3);
  letter-spacing: .02em;
}

/* -------------------------------------------------------------------- cards */

.card {
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: .9rem;
  padding: clamp(1.3rem, 3vw, 2rem);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 1rem; }

.day-line {
  font: 600 .7rem/1 var(--ui);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 .5rem;
}
.today-date {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4.4vw, 2.2rem);
  font-weight: 400;
  margin: 0 0 2rem;
  letter-spacing: -.01em;
}
.card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  margin: 0 0 .5rem;
}
.card p { margin: 0 0 1rem; color: var(--ink-2); }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.1rem;
  font: 500 .74rem/1 var(--ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1.4rem;
}
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: .5em;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: 600 .82rem/1 var(--ui);
  letter-spacing: .04em;
  padding: .85em 1.4em;
  border-radius: 2em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn.ghost {
  background: none;
  color: var(--ink);
  border-color: var(--rule);
}
.btn.ghost:hover { border-color: var(--gold-soft); }

.presence {
  display: flex;
  gap: .32rem;
  flex-wrap: wrap;
  margin: 2.4rem 0 0;
}
.presence i {
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: var(--rule);
}
.presence i.on { background: var(--gold); }
.presence-label {
  font: 500 .7rem/1 var(--ui);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 2.6rem 0 .8rem;
}

.empty {
  color: var(--ink-3);
  font-size: .92rem;
  padding: 2rem 0;
}

/* ------------------------------------------------------------------- start */

.start {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 46rem;
  margin: 0 auto;
  animation: rise .6s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: none; }
}
.start .question {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 .8rem;
  max-width: 18ch;
}
.start .sub {
  color: var(--ink-2);
  margin: 0 0 3rem;
  max-width: 34ch;
}
.start .after {
  margin: 2.2rem 0 0;
  font: 500 .74rem/1.6 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.choices {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.choice {
  appearance: none;
  text-align: left;
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: .9rem;
  padding: 1.4rem 1.3rem 1.5rem;
  cursor: pointer;
  color: var(--ink);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  animation: rise .5s var(--ease) both;
}
.choice:nth-child(2) { animation-delay: .07s; }
.choice:nth-child(3) { animation-delay: .14s; }
.choice:hover {
  transform: translateY(-3px);
  border-color: var(--gold-soft);
  box-shadow: var(--shadow-1);
}
.choice .k {
  display: block;
  font: 600 .68rem/1 var(--ui);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .9rem;
}
.choice .h {
  display: block;
  font-family: var(--serif);
  font-size: 1.3rem;
  margin-bottom: .45rem;
}
.choice .d {
  display: block;
  font-size: .85rem;
  color: var(--ink-2);
  line-height: 1.55;
}

/* ------------------------------------------------------------------ journal */

.entry {
  border-top: 1px solid var(--rule-soft);
  padding: 1.1rem 0;
}
.entry:first-of-type { border-top: 0; }
.entry .when {
  font: 500 .7rem/1 var(--ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .4rem;
}
.entry .where {
  font-family: var(--serif);
  color: var(--gold);
  font-size: .95rem;
  margin: 0 0 .3rem;
}
.entry .what {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--serif);
  line-height: 1.6;
}

/* -------------------------------------------------------------- scene mode */

#scene-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .7s var(--ease);
}
body.scene-on #scene-layer { opacity: 1; }

#scene-layer .plate {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.08);
  will-change: transform;
}
#scene-layer img.plate {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#scene-layer .plate.lqip { filter: blur(24px); transform: scale(1.16); }
#scene-layer .plate.full {
  opacity: 0;
  transition: opacity .9s var(--ease);
  animation: ken-burns 48s var(--ease) infinite alternate;
}
#scene-layer .plate.full.shown { opacity: 1; }
@keyframes ken-burns {
  from { transform: scale(1.06) translate3d(0, 0, 0); }
  to { transform: scale(1.17) translate3d(-1.6%, -1.2%, 0); }
}
#scene-layer .scrim-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 8, 6, .88) 0%, rgba(10, 8, 6, .74) 26%, rgba(10, 8, 6, .78) 62%, rgba(10, 8, 6, .92) 100%),
    radial-gradient(70% 55% at 50% 42%, rgba(10, 8, 6, .28), transparent 75%);
}

body.scene-on {
  --paper: #100d0a;
  --paper-2: #1a1611;
  --paper-3: #241f18;
  --ink: #f4ece0;
  --ink-2: #cfc3b1;
  --ink-3: #a2968a;
  --rule: rgba(244, 236, 224, .2);
  --rule-soft: rgba(244, 236, 224, .12);
  --gold: #e2bd83;
  --gold-soft: #c19f6d;
  --field: rgba(24, 20, 15, .74);
  background-image: none;
  background-color: #100d0a;
}
body.scene-on .topbar {
  background: linear-gradient(180deg, rgba(10, 8, 6, .97), rgba(10, 8, 6, .95));
  backdrop-filter: blur(16px);
  border-bottom-color: transparent;
}
/* The fade below the bar is drawn, never laid out, so switching scene mode on
   cannot move a single line of text. */
body.scene-on .topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 1.4rem;
  background: linear-gradient(180deg, rgba(10, 8, 6, .95), rgba(10, 8, 6, 0));
  pointer-events: none;
}
body.scene-on .passage {
  text-shadow: 0 1px 22px rgba(0, 0, 0, .55);
}
body.scene-on .chapter-title,
body.scene-on .chapter-sub { text-shadow: 0 2px 30px rgba(0, 0, 0, .6); }
body.scene-on .card,
body.scene-on .tray {
  backdrop-filter: blur(12px);
}
body.scene-on .chapter-head { animation: title-in 1.5s var(--ease) both; }
@keyframes title-in {
  from { opacity: 0; transform: translateY(1.2rem); letter-spacing: .04em; }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translate(-50%, 1.5rem);
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  font: 500 .82rem/1 var(--ui);
  padding: .9em 1.3em;
  border-radius: 2em;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.up { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 46rem) {
  .topbar {
    gap: .5rem;
    padding: .7rem 1rem;
  }
  .mark { font-size: .95rem; }

  /* On a phone the toolbar is a strip you push sideways, so it says so: the
     row fades at whichever end still has buttons on it, and the fade is a mask
     on the strip itself rather than an element, so nothing moves after paint.
     The whole strip is one row on its own line and the buttons never wrap. */
  .tools {
    width: 100%;
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
  }
  .tools > * { scroll-snap-align: start; }
  .explorers { flex-wrap: nowrap; }

  /* Every control in the header is a real tap target on a phone. The text keeps
     its size; the box around it grows. 44 px is the floor everywhere. */
  .tool, .explorers button, .stepper, .ref, .mark, .mark-link, .sync-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .stepper, .tool { min-width: 44px; }
  .ref-nav { margin-left: auto; margin-right: 0; }
  .panel { width: 100vw; border-left: 0; }
  .picker { top: auto; bottom: 0; left: 0; transform: none; width: 100vw; border-radius: .9rem .9rem 0 0; max-height: 80vh; }
  @keyframes pop-in {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: none; }
  }
}

/* A link that nobody styled is the browser's blue, which is off every palette
   in this app and unreadable over a scene backdrop. This is the floor for any
   link inside a rendered screen; a component that wants its own look still
   sets it. */
#app a:not([class]),
#app a.plain,
#panel-body a:not([class]) {
  color: var(--gold);
  text-decoration-color: color-mix(in srgb, var(--gold) 45%, transparent);
  text-underline-offset: .18em;
}
#app a:not([class]):hover,
#panel-body a:not([class]):hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
