/* rohin.me - Night Digest (js/scenes/digest.js). One screen: the shelf of nights, the edition's pages as an index, and a
   reading panel that scrolls inside itself. Tokens only. Wide: index beside the panel. 1000px and less: stacked, the
   index becomes a row of numbered tabs. */
.dg { position: absolute; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--s-3); min-width: 0; }

/* the five families of the shelf, from the data colours of the palette; where the browser can turn a hue, two of them are
   turned so no two families share one (in mono they stay steps of grey) */
#digest { --f-history: var(--c-yard); --f-news: var(--c-warn); --f-ideas: var(--c-sky); --f-place: var(--c-sea); --f-life: var(--c-quiet); --f-other: var(--ink-3); }
@supports (color: oklch(from red l c h)) {
  #digest { --f-news: oklch(from var(--c-warn) calc(l - .04) c calc(h - 50)); --f-life: oklch(from var(--c-sky) calc(l - .1) c calc(h + 55)); }
}

/* ---- the shelf (js/digest-shelf.js): every night's book, newest at the end. Soft 3D in CSS only: the strip that scrolls
   the books holds the perspective, seen from above the middle, so the books to either side show a side and every book
   the top edge of its pages. Colour: the night's family (--fam), always mixed soft with the panel colour. */
.dg-top { min-width: 0; max-height: 14rem; transition: max-height .4s var(--ease), opacity var(--med) var(--ease); }
.dg-shelf-box { min-width: 0; }
.dg-shelf { --book-h: 7.5rem; --book-w: 50px; --tap-px: 44px; --depth: 2.25rem; --plank: .625rem; --head: 1.25rem;
  position: relative; height: calc(var(--book-h) + var(--plank) + var(--head) + 1.125rem); min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 1.25rem, #000 calc(100% - 1.25rem), transparent); mask-image: linear-gradient(90deg, transparent, #000 1.25rem, #000 calc(100% - 1.25rem), transparent); }
.dg-shelf-sc { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; perspective: 560px; perspective-origin: 50% -120%; }
.dg-shelf-sc::-webkit-scrollbar { display: none; }
.dg-shelf-track { position: relative; height: 100%; min-width: 100%; transform-style: preserve-3d; }
.dg-plank { position: absolute; left: 0; right: 0; bottom: 1.125rem; height: var(--plank); border-radius: 2px; transform-style: preserve-3d;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--ink) 16%, var(--bg-raise)), color-mix(in srgb, var(--ink) 9%, var(--bg))); box-shadow: 0 10px 18px -12px var(--shade); }
.dg-plank::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: calc(var(--depth) + .5rem); transform-origin: bottom; transform: rotateX(90deg);
  background: linear-gradient(to top, color-mix(in srgb, var(--ink) 11%, var(--bg-raise)), color-mix(in srgb, var(--ink) 5%, var(--bg))); }
.dg-month { position: absolute; bottom: 0; height: 1.125rem; display: flex; align-items: flex-end; font-size: var(--t-tiny); line-height: 1; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.dg-book { --fam: var(--f-other); --spine: color-mix(in srgb, var(--fam) var(--tint, 34%), var(--bg-raise)); --side: color-mix(in srgb, var(--fam) 46%, var(--bg));
  position: absolute; bottom: calc(1.125rem + var(--plank)); height: var(--book-h); padding: 0; border-radius: 3px 3px 1px 1px; color: var(--ink); transform-style: preserve-3d;
  background: linear-gradient(90deg, color-mix(in srgb, var(--spine) 82%, var(--ink)) 0, var(--spine) 16%, color-mix(in srgb, var(--spine) 88%, var(--bg-raise)) 42%, var(--spine) 70%, color-mix(in srgb, var(--spine) 80%, var(--ink)) 100%);
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease); }
#digest [data-fam="history"] { --fam: var(--f-history); } #digest [data-fam="news"] { --fam: var(--f-news); } #digest [data-fam="ideas"] { --fam: var(--f-ideas); }
#digest [data-fam="place"] { --fam: var(--f-place); } #digest [data-fam="life"] { --fam: var(--f-life); }
/* the two covers (seen from the side) and the top edge of the pages, each a plane going back from an edge of the spine */
.dg-book::before, .dg-book::after { content: ''; position: absolute; top: 0; bottom: 0; width: var(--depth); background: var(--side); }
.dg-book::before { right: 100%; transform-origin: right; transform: rotateY(-90deg); }
.dg-book::after { left: 100%; transform-origin: left; transform: rotateY(90deg); }
.dg-b-top { position: absolute; left: 0; right: 0; bottom: 100%; height: var(--depth); transform-origin: bottom; transform: rotateX(90deg);
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, var(--bg-raise)) 0 2px, color-mix(in srgb, var(--ink) 14%, var(--bg-raise)) 2px 3px); border: 2px solid var(--side); }
:root[data-theme="dark"] .dg-book { --tint: 42%; }
.dg-b-band { position: absolute; left: 0; right: 0; top: .75rem; height: .3125rem; background: var(--fam); opacity: .85; }
.dg-b-t { position: absolute; top: 1.5rem; bottom: 1.625rem; left: 50%; translate: -50% 0; max-height: calc(100% - 3.125rem); writing-mode: vertical-rl; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-title); font-size: .75rem; font-weight: 600; line-height: 1.15; }
.dg-b-d { position: absolute; left: 0; right: 0; bottom: .375rem; text-align: center; font-family: var(--font-num); font-size: .75rem; line-height: 1; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dg-book:hover { transform: translateY(-3px); }
.dg-book[aria-pressed="true"] { transform: translateY(-.5rem); box-shadow: 0 .875rem 1rem -.75rem var(--shade), 0 0 0 2px var(--accent); }
.dg-book[aria-pressed="true"] .dg-b-d { color: var(--ink); font-weight: 600; }
.dg-book:focus-visible { outline-offset: 2px; }
.dg-book:active { transition-duration: var(--fast); }

.dg-steps { display: flex; gap: var(--s-1); }
.dg-step { flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: var(--ink); transition: border-color var(--fast), transform var(--fast) var(--ease); }
.dg-step:hover { border-color: var(--line-strong); }
.dg-step:active { transform: scale(.94); }
.dg-step:disabled { border-color: transparent; background: none; color: var(--ink-3); cursor: default; transform: none; }

.dg-head { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); min-width: 0; }
.dg-head .dg-steps { margin-right: auto; }
.dg-date { display: inline-flex; align-items: center; gap: .45rem; min-height: var(--tap); padding: 0 .85rem 0 1.05rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); font-size: var(--t-small); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; transition: border-color var(--fast); }
.dg-date:hover { border-color: var(--line-strong); }
.dg-date .ico { color: var(--ink-3); }
.dg-date:disabled { cursor: default; }
.dg-send-btn:disabled { opacity: .55; cursor: default; }

/* ---- the edition: index and reading panel */
.dg-body { display: grid; grid-template-columns: minmax(14rem, 19rem) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: var(--s-3) var(--s-4); min-width: 0; min-height: 0; }
.dg-read { grid-column: 2; grid-row: 2; }
.dg-index { grid-column: 1; grid-row: 1 / 3; display: grid; grid-template-rows: auto minmax(0, 1fr); align-content: start; gap: var(--s-2); min-width: 0; min-height: 0; }
.dg-index .side-title { padding-left: .75rem; }
.dg-ix-list { position: relative; display: grid; align-content: start; gap: 2px; min-height: 0; overflow-y: auto; touch-action: pan-y pinch-zoom; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.dg-ix { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: .35rem .75rem; border-radius: var(--r-2); text-align: left; color: var(--ink-2); transition: background var(--med) var(--ease), color var(--fast); }
.dg-ix:hover { color: var(--ink); }
.dg-ix:focus-visible { outline-offset: -2px; border-radius: var(--r-2); }
.dg-ix-n { font-size: var(--t-small); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-3); }
.dg-ix-t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-size: var(--t-small); line-height: 1.3; }
.dg-ix[aria-current="true"] { background: var(--accent-soft); color: var(--ink); }
.dg-ix[aria-current="true"] .dg-ix-n { color: var(--ink); font-weight: 600; }

.dg-read { position: relative; min-width: 0; min-height: 0; overflow-y: auto; touch-action: pan-y pinch-zoom;      /* up and down scrolls here; sideways is the page's swipe */ overscroll-behavior: contain; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--bg-raise); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.dg-read:focus-visible { outline-offset: -3px; border-radius: var(--r-3); }
.dg-doc { max-width: 40rem; margin: 0 auto; padding: var(--s-5) clamp(1.25rem, 5vw, 2.75rem) var(--s-6); transition: opacity var(--med); font-kerning: normal; font-variant-ligatures: common-ligatures; }
/* a new night comes in softly (still under reduced motion) */
.dg-doc.is-in { animation: dg-in .4s var(--ease) both; }
@keyframes dg-in { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dg-doc.is-in { animation: none; } }
.dg-read[aria-busy="true"] .dg-doc { opacity: .45; }
.dg-mast { padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.dg-title { font-family: var(--font-title); font-size: clamp(1.625rem, 1.3rem + 1.3vw, 2.375rem); font-weight: 500; letter-spacing: 0; line-height: 1.12; overflow-wrap: break-word; text-wrap: balance; }
.dg-author { margin-top: .55rem; font-size: 1.0625rem; color: var(--ink-2); }
.dg-why, .dg-meta { margin-top: .25rem; font-size: var(--t-small); color: var(--ink-2); }
.dg-page { padding-top: var(--s-6, 2.5rem); }
.dg-page + .dg-page { margin-top: var(--s-2); border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.dg-page h4 { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: .75rem; font-family: var(--font-title); font-size: 1.25rem; font-weight: 600; letter-spacing: 0; line-height: 1.28; text-wrap: balance; overflow-wrap: break-word; }
.dg-n { min-width: 1.35rem; font-size: .875rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.dg-page p { margin-top: .9rem; font-size: 1.0625rem; line-height: 1.72; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty; hanging-punctuation: first; }
.dg-page h4 + p { margin-top: 1rem; }
/* the end of an edition: the nights either side */
.dg-on { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: var(--s-2); margin-top: var(--s-6, 2.5rem); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.dg-on-b { --fam: var(--f-other); display: grid; align-content: start; gap: .3rem; min-width: 0; min-height: var(--tap); padding: .8rem 1rem .9rem; border: 1px solid var(--line); border-radius: var(--r-2); text-align: left; background: var(--glass); transition: border-color var(--fast), transform var(--fast) var(--ease); }
.dg-on-b:hover { border-color: var(--line-strong); }
.dg-on-b:active { transform: scale(.985); }
.dg-on-b + .dg-on-b { text-align: right; justify-items: end; }
.dg-on-b > .dg-dot { grid-row: 1; justify-self: end; margin-top: .3rem; }
.dg-on-b + .dg-on-b > .dg-dot { justify-self: start; }
.dg-on-b > * { grid-column: 1; }
.dg-on-b:only-child { text-align: left; justify-items: start; }
.dg-on-l { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--t-tiny); color: var(--ink-3); }
.dg-on-b b { font-family: var(--font-title); font-size: 1rem; font-weight: 600; line-height: 1.3; overflow-wrap: break-word; text-wrap: balance; }
.dg-on-d { font-size: var(--t-tiny); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dg-src { margin-top: var(--s-5); }
.dg-none { padding: var(--s-6) 0; text-align: center; color: var(--ink-2); }

/* pictures of the pages (black on white, made for an e-reader): they take the panel's colour instead of a white slab */
.dg-doc[data-kind="pages"] { display: grid; gap: var(--s-3); max-width: 33rem; padding: var(--s-3) clamp(.5rem, 3vw, 1.5rem) var(--s-5); }
/* each picture carries its own wide margins: the frame trims a little of them, so the words are larger on a phone */
.dg-shot { margin: 0; overflow: hidden; border-bottom: 1px solid var(--line); }
.dg-shot img { width: 111.2%; max-width: none; height: auto; margin: -6% 0 0 -5.6%; mix-blend-mode: multiply; -webkit-user-drag: none; }
:root[data-theme="dark"] .dg-shot img { filter: invert(1); mix-blend-mode: screen; opacity: .9; }
.dg-shot.is-lost { display: none; }
.dg-doc[data-kind="pages"] .dg-meta { margin: 0; padding: 0 .5rem; }
.dg-doc[data-kind="pages"] .dg-src { margin: 0; padding: 0 .5rem; }

/* ---- sheets: the list of nights, send */
.dg-nl { display: grid; gap: 2px; }
.dg-nl-row { display: grid; grid-template-columns: 5.75rem minmax(0, 1fr); align-items: baseline; gap: 0 var(--s-3); width: 100%; min-height: var(--tap); padding: .5rem .75rem; border-radius: var(--r-2); text-align: left; transition: background var(--med) var(--ease); }
.dg-nl-row:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dg-nl-row:focus-visible { outline-offset: -2px; border-radius: var(--r-2); }
.dg-nl-date { grid-row: span 2; font-size: var(--t-small); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dg-nl-row b { font-size: .9375rem; font-weight: 600; line-height: 1.3; overflow-wrap: break-word; }
.dg-nl-by { grid-column: 2; font-size: var(--t-small); color: var(--ink-2); }
.dg-nl-row[aria-current="true"] { background: var(--accent-soft); }
.dg-nl-row b .dg-dot { margin-right: .5rem; }
.dg-dot { --fam: var(--f-other); display: inline-block; width: .625rem; height: .625rem; border-radius: 2px; background: color-mix(in srgb, var(--fam) 75%, var(--bg-raise)); translate: 0 -.05em; }
.dg-nl > li { display: grid; gap: 1px; }
.dg-nl-hit { display: grid; grid-template-columns: 5.75rem minmax(0, 1fr); align-items: baseline; gap: 0 var(--s-3); width: 100%; min-height: var(--tap); padding: .4rem .75rem; border-radius: var(--r-2); text-align: left; font-size: var(--t-small); line-height: 1.45; color: var(--ink-2); transition: background var(--med) var(--ease); }
.dg-nl-hit:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dg-nl-hit:focus-visible { outline-offset: -2px; border-radius: var(--r-2); }
.dg-nl-p { justify-self: end; font-family: var(--font-num); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dg-nl mark, .dg-page mark.dg-hit { background: color-mix(in srgb, var(--accent) 26%, transparent); color: inherit; border-radius: 2px; }
.dg-find { display: grid; gap: var(--s-3); min-width: 0; }
.dg-q-row { position: sticky; top: calc(-1 * var(--s-4)); z-index: 1; display: flex; align-items: center; gap: .5rem; min-height: var(--tap); padding: 0 .85rem; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--bg-raise); }
.dg-q-row .ico { flex: none; color: var(--ink-3); }
.dg-q { flex: 1 1 auto; min-width: 0; min-height: var(--tap); border: 0; background: none; color: var(--ink); font: inherit; font-size: 1rem; outline: none; }
.dg-q::-webkit-search-cancel-button { cursor: pointer; }
.dg-q-row:focus-within { border-color: var(--accent); }
.dg-chips { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); }
.dg-chip { display: inline-flex; align-items: center; gap: .45rem; min-height: var(--tap); padding: 0 .9rem; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--glass); font-size: var(--t-small); color: var(--ink); transition: border-color var(--fast), background var(--fast); }
.dg-chip:hover { border-color: var(--line-strong); }
.dg-chip[aria-pressed="true"] { border-color: var(--fam); background: color-mix(in srgb, var(--fam) 18%, transparent); }
.dg-found { font-size: var(--t-small); color: var(--ink-2); }
.dg-found:empty { display: none; }

.dg-send-what { font-size: var(--t-small); color: var(--ink-2); overflow-wrap: break-word; }
.dg-send-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-4) var(--s-5); }
.dg-qr { flex: none; display: grid; justify-items: center; gap: .4rem; font-size: var(--t-tiny); color: var(--ink-2); }
.dg-qr-code { display: block; width: 9.5rem; height: 9.5rem; border-radius: var(--r-1); overflow: hidden; }
.dg-qr-code svg { width: 100%; height: 100%; }
.dg-send-btns { flex: 1 1 12rem; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.dg-send-btns [aria-disabled="true"], .dg-send-btns :disabled { opacity: .5; pointer-events: none; }
.dg-said { min-height: 1.5em; font-size: var(--t-small); color: var(--ink-2); overflow-wrap: anywhere; }
.dg-print { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; }

/* ---- phones only: the pages as one row (‹ 3 / 10 ›) and the slim row that stands in for the top while reading */
.dg-pager, .dg-slim { display: none; }
.dg-pl { display: grid; gap: 2px; }
.dg-pl-row { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); align-items: baseline; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: .55rem .75rem; border-radius: var(--r-2); text-align: left; font-size: .9375rem; line-height: 1.35; color: var(--ink); transition: background var(--med) var(--ease); }
.dg-pl-row:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dg-pl-row[aria-current="true"] { background: var(--accent-soft); }
.dg-pl-row .dg-ix-n { color: var(--ink-3); }

/* ---- upright tablets and phones: stacked; the index is a row of numbered tabs */
@media (max-width: 1000px) {
  .dg { gap: var(--s-2); }
  .dg-head { grid-column: 1; }
  .dg-head .dg-steps { margin-right: 0; }
  .dg-head .dg-date { margin-right: auto; }
  .dg-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); gap: var(--s-2); }
  .dg-index { grid-column: 1; grid-row: 2; }
  .dg-read { grid-column: 1; grid-row: 3; }
  .dg-index { grid-template-rows: auto; }
  .dg-index .side-title { display: none; }
  .dg-ix-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tap), 1fr)); gap: 2px; overflow: visible; }   /* 11-14: the numbers wrap to a second row instead of running off the side */
  .dg-ix { grid-template-columns: auto; justify-content: center; min-width: var(--tap); padding: 0 .4rem; }
  .dg-ix-t { display: none; }
  .dg-ix-n { font-size: .9375rem; text-align: center; color: var(--ink-2); }
}
@media (max-width: 720px) {
  /* the rows from the top: date row, pages row, slim row (only while reading), the reading panel. No grid gaps: each row
     carries its own space below, so a folded row takes none */
  .dg { gap: 0; }
  .dg-top { margin-bottom: var(--s-2); transition: max-height .4s var(--ease), opacity var(--med) var(--ease), margin-bottom .4s var(--ease); }
  .dg-body { grid-template-rows: auto auto auto minmax(0, 1fr); gap: 0; }
  .dg-index { display: none; }
  .dg-head { grid-row: 1; }
  .dg-pager.is-main { grid-row: 2; }
  .dg-slim { grid-row: 3; }
  .dg-read { grid-row: 4; }
  .dg-head, .dg-pager.is-main, .dg-slim { max-height: 4rem; margin: -4px 0 var(--s-2); padding: 4px; overflow: hidden;      /* room inside for the focus ring */
    transition: max-height .4s var(--ease), opacity var(--med) var(--ease), margin-bottom .4s var(--ease), padding .4s var(--ease); }
  .dg-pager { display: flex; align-items: center; gap: var(--s-1); min-width: 0; }
  .dg-pg-prev .ico { rotate: 90deg; } .dg-pg-next .ico { rotate: -90deg; }
  .dg-pg-now { flex: 1 1 auto; display: flex; align-items: center; gap: var(--s-3); min-width: 0; min-height: var(--tap); padding: 0 .6rem; border-radius: var(--r-pill); text-align: left; color: var(--ink); transition: background var(--fast); }
  @media (hover: hover) { .dg-pg-now:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); } }
  .dg-pg-now:disabled { color: var(--ink-3); }
  .dg-pg-t { line-height: 1.3; }
  .dg-pg-n { flex: none; font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
  .dg-pg-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-small); color: var(--ink-2); }
  .dg-slim { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); max-height: 0; margin-bottom: 0; padding-block: 0; opacity: 0; visibility: hidden;
    transition: max-height .4s var(--ease), opacity var(--med) var(--ease), margin-bottom .4s var(--ease), padding .4s var(--ease), visibility 0s .4s; }
  .dg-slim .dg-pager { flex: 0 1 auto; display: flex; }
  .dg-slim .dg-pg-now { flex: 0 0 auto; justify-content: center; padding: 0 .5rem; }
  .dg-slim .dg-pg-t { display: none; }
  .dg-unfold { flex: none; display: inline-flex; align-items: center; gap: .3rem; min-height: var(--tap); padding: 0 .7rem 0 .85rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); font-size: var(--t-small); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
  .dg-unfold .ico { color: var(--ink-3); }
  .dg-send2 { flex: none; }
  .dg-send2:disabled { opacity: .55; }
  /* reading under way: the shelf, the date row and the pages fold away; the slim row takes their place */
  .dg.is-deep .dg-top, .dg.is-deep .dg-head, .dg.is-deep .dg-pager.is-main { max-height: 0; margin-bottom: 0; padding-block: 0; opacity: 0; overflow: hidden; pointer-events: none; visibility: hidden;
    transition: max-height .4s var(--ease), opacity var(--med) var(--ease), margin-bottom .4s var(--ease), padding .4s var(--ease), visibility 0s .4s; }
  .dg.is-deep .dg-slim { max-height: 4rem; margin-bottom: var(--s-2); padding-block: 4px; opacity: 1; visibility: visible; transition: max-height .4s var(--ease), opacity var(--med) var(--ease) .1s, margin-bottom .4s var(--ease), padding .4s var(--ease); }
  .dg-shelf { --book-h: 6.5rem; --book-w: 46px; --depth: 1.75rem; --head: 1.25rem; }
  .dg-steps { display: none; }
  .dg-page p { font-size: 1.0625rem; line-height: 1.66; margin-top: .8rem; }
  .dg-page h4 { font-size: 1.1875rem; }
  .dg-page { padding-top: var(--s-5); }
  .dg-doc { padding-top: var(--s-4); }
  .dg-doc[data-kind="pages"] { padding: var(--s-1) .25rem var(--s-4); }
  .dg-qr-code { width: 8rem; height: 8rem; }
}
/* a phone on its side: the frame lets the page's area scroll; keep the reading panel a usable height */
@media (max-height: 520px) { .dg { position: relative; inset: auto; height: max(100%, 26rem); } }
@media (max-height: 520px) { .dg-shelf { --book-h: 5.5rem; --depth: 1.5rem; --head: 1rem; } }
.dg-on-b > .dg-on-l { grid-row: 1; } .dg-on-b > b { grid-row: 2; } .dg-on-b > .dg-on-d { grid-row: 3; }
/* send: the file buttons (js/digest-files.js); a button that does not apply to this night is left out */
.dg-send-btns [hidden] { display: none; }
.dg-send-btns .btn { min-width: 0; }
/* the smallest phones (320 px): the slim row keeps to the width (date, ‹ 3 / 10 ›, Send) */
@media (max-width: 360px) {
  .dg-unfold { padding: 0 .65rem; }
  .dg-unfold .ico { display: none; }
  .dg-slim { gap: 2px; }
  .dg-slim .dg-pg-now { padding: 0 .2rem; }
  .dg-send2 { padding-inline: .75rem; }
}
/* less motion: the rows fold and unfold at once (the frame shortens every transition; this also drops their delays) */
@media (prefers-reduced-motion: reduce) { .dg-top, .dg-head, .dg-pager, .dg-slim { transition: none !important; } }
/* Search is a word (UX plan #12): the date gives way first (it is cut with three dots, never pushed off the page), and on
   the narrowest phones Send is its word alone */
.dg-head .dg-date { min-width: 0; flex: 0 1 auto; }
.dg-date-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-find-btn, .dg-send-btn { flex: none; }
@media (max-width: 380px) { .dg-head { gap: var(--s-1, .25rem); } .dg-head .btn { padding-inline: .75rem; } .dg-send-btn .ico { display: none; } .dg-date { padding: 0 .6rem 0 .8rem; gap: .25rem; } }
/* short phones (320 x 568): the slim row sits a little tighter, so the reading keeps as much as it can */
@media (max-width: 720px) and (max-height: 640px) {
  .dg.is-deep .dg-slim { margin-bottom: var(--s-1); padding-block: 2px; }
}
