/* ===================== Read a little (js/readLittle.js) =====================
   A warm peach corner of DHUT: a compact entry card at the end of Diary › More (not on Today — the
   garden quote is Today's), and one reading sheet (a native <dialog>: bottom sheet on phones, a centred
   card on desktop). Tokens from css/app.css only. Contrast (AA): --peach-strong on --peach-light 5.4:1,
   --text-secondary on every surface here ≥ 5.2:1, --accent-strong on --accent-light 6.4:1, each
   --*-ink on its --*-light ≥ 5:1. Motion: one short slide/fade, off with reduced motion. */

.rl-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- the pick card (Diary › More) ---------- */
button.rl-card { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; margin: 0; padding: 8px 8px 8px 10px; border: 0; border-radius: var(--radius-lg);
  background: var(--surface-soft); color: var(--text-primary); text-align: left; font-size: var(--text-sm); font-weight: 400; line-height: var(--lh-tight); box-shadow: none; cursor: pointer; }
button.rl-card:hover { background: color-mix(in srgb, var(--peach-light) 70%, var(--surface)); color: var(--text-primary); }
button.rl-card:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
/* Which languages a piece has (js/readings.js languageNote): "English only", "Vietnamese + gloss". */
.rl-lang { display: inline-block; padding: 0 6px; border-radius: var(--radius-pill); background: var(--surface-muted); color: var(--text-secondary); font-size: 11.5px; font-weight: 700; line-height: 18px; white-space: nowrap; vertical-align: 1px; }
.rl-lang-note { margin: -4px 0 12px; font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.45; }
.rl-card-icon, .rl-type-icon, .rl-sec-icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.rl-card-icon { width: 34px; height: 34px; border-radius: 12px; background: var(--surface); color: var(--peach-strong); box-shadow: 0 0 0 1px color-mix(in srgb, var(--peach) 28%, transparent); }
.rl-card-icon svg, .rl-type-icon svg { width: var(--icon-md); height: var(--icon-md); }
.rl-card-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rl-kicker { font-size: var(--text-2xs); font-weight: 800; letter-spacing: 0.02em; color: var(--peach-strong); }
.rl-card-title { font-family: var(--font-display); font-size: 15px; font-weight: 800; letter-spacing: var(--tracking-display); color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rl-card-meta { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.4; overflow-wrap: anywhere; }
.rl-chev { flex: 0 0 auto; display: inline-flex; color: var(--text-secondary); }
.rl-chev svg { width: 18px; height: 18px; }

/* Types: one pastel pair each (icon chips, pills). */
.rl-type--quote { background: var(--lavender-light); color: var(--lavender-ink); }
.rl-type--reflection { background: var(--accent-light); color: var(--accent-strong); }
.rl-type--reading { background: var(--yellow-light); color: var(--yellow-ink); }

/* ---------- Diary › More: the entry card (compact: pick, two buttons, one line) ---------- */
.read-entry .rl-sec-head { background: var(--peach-light); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--peach) 24%, transparent); }
/* Inside the Diary the section bands use a --dh-tone gradient and reserve room for the plant on the right;
   this card has no plant slot, so the band keeps normal padding and the icon sits before the words. */
#tab-diary .dh-sec-head.rl-sec-head { --dh-tone: var(--peach-light); padding-right: 14px; }
#tab-diary .dh-sec-head.rl-sec-head > span:first-child { flex: 0 0 auto; }
#tab-diary .dh-sec-head.rl-sec-head > span:last-child { flex: 1 1 auto; min-width: 0; }
.rl-sec-icon { width: 22px; height: 22px; color: var(--peach-strong); }
.rl-sec-icon svg { width: 20px; height: 20px; }
.rl-sec-sub { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; color: var(--text-secondary); margin-left: 4px; }
.rl-card--entry .rl-card-icon { box-shadow: none; }
.rl-entry-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
button.rl-btn { flex: 1 1 120px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); margin: 0; padding: 0 10px; border-radius: 14px; font-size: 15px; font-weight: 700; white-space: nowrap; }
button.rl-btn svg { width: 18px; height: 18px; }
button.rl-btn--soft { background: var(--peach-light); color: var(--peach-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--peach) 26%, transparent); }
button.rl-btn--soft:hover { background: color-mix(in srgb, var(--peach-light) 80%, var(--peach) 20%); color: var(--peach-strong); }
.rl-count { font-variant-numeric: tabular-nums; font-weight: 800; opacity: 0.85; }
.rl-entry-note { margin: 6px 2px 0; font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.4; }
#read-entry { padding: 12px; }
#read-entry .rl-entry-pick { margin-top: 8px; }

/* ---------- the reading sheet ---------- */
dialog.read-sheet { box-sizing: border-box; width: 100%; max-width: 680px; max-height: 90vh; max-height: min(90vh, 90dvh); margin: 0 auto; padding: 0; border: 0; inset: auto 0 0 0;
  border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-3); overflow: hidden; overscroll-behavior: contain; }
dialog.read-sheet:modal { max-width: 680px; max-height: 90vh; max-height: min(90vh, 90dvh); }
dialog.read-sheet[open] { display: flex; flex-direction: column; animation: rl-up 220ms ease; }
dialog.read-sheet::backdrop { background: rgba(30, 26, 20, 0.38); }
/* Browsers without showModal(): the same sheet, fixed, with a painted backdrop. */
dialog.read-sheet.rl-fallback { position: fixed; z-index: 95; box-shadow: 0 0 0 100vmax rgba(30, 26, 20, 0.38), var(--shadow-3); }
@keyframes rl-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rl-pop { from { transform: translateY(8px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  dialog.read-sheet, dialog.read-sheet:modal { inset: 0; margin: auto; max-width: 600px; max-height: min(86vh, 820px); border-radius: 24px; }
  dialog.read-sheet[open] { animation-name: rl-pop; }
}
@media (prefers-reduced-motion: reduce) { dialog.read-sheet[open] { animation: none; } }
html[data-motion="reduced"] dialog.read-sheet[open], html[data-motion="off"] dialog.read-sheet[open] { animation: none; }

.rl-sheet-inner { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.rl-sheet-head { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line-soft); }
.rl-sheet-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: var(--tracking-display); color: var(--text-primary); }
dialog.read-sheet[data-view="read"] .rl-sheet-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog.read-sheet[data-view="read"] .rl-sheet-head { justify-content: space-between; padding-left: 6px; }
button.rl-head-btn { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); margin: 0; padding: 0 10px 0 4px; border-radius: 12px; background: none; color: var(--accent-strong); font-size: 15px; font-weight: 700; box-shadow: none; }
button.rl-head-btn:hover { background: var(--accent-light); color: var(--accent-strong); }
button.rl-head-btn svg { width: 20px; height: 20px; }
.rl-close { min-height: var(--tap); padding: 0 8px; margin-left: auto; }
.rl-offline { flex: 0 0 auto; margin: 0; padding: 6px 16px; background: var(--peach-light); color: var(--peach-strong); font-size: var(--text-xs); font-weight: 700; }
.rl-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }

/* List view */
.rl-list-title { margin: 12px 0 10px; font-size: 17px; }
.rl-list-title:focus { outline: none; }
.rl-list-title:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; border-radius: 6px; }
.rl-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rl-label { font-size: var(--text-xs); font-weight: 700; color: var(--text-secondary); margin-right: 2px; }
button.rl-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; margin: 0; padding: 0 13px; border: 0; border-radius: var(--radius-pill); background: var(--surface);
  color: var(--text-primary); font-size: 14px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong); }
button.rl-chip:hover { background: var(--accent-light); color: var(--text-primary); }
button.rl-chip[aria-pressed="true"] { background: var(--accent-light); color: var(--accent-strong); box-shadow: inset 0 0 0 1.5px var(--accent); }
button.rl-chip[aria-pressed="true"]::before { content: ""; width: 9px; height: 5px; margin: -3px 2px 0 -2px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.rl-hint { margin: 6px 0 10px; font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.45; }
button.link-btn.rl-inline { min-height: 0; padding: 0 2px; font-size: inherit; }
.rl-seg { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-muted); }
button.rl-seg-btn { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; margin: 0; padding: 0 10px; border-radius: var(--radius-pill);
  background: transparent; color: var(--text-secondary); font-size: 14.5px; font-weight: 700; box-shadow: none; }
button.rl-seg-btn:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--text-primary); }
button.rl-seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-1); }
button.rl-seg-btn svg { width: 16px; height: 16px; }
.rl-list { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 6px; }
.rl-item { display: flex; justify-content: flex-start; align-items: center; gap: 2px; padding: 0; border: 0; border-radius: 16px; background: var(--surface-soft); font-size: inherit; }
.rl-item--today { background: linear-gradient(135deg, var(--peach-light), var(--surface-soft) 80%); }
button.rl-item-open { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 56px; margin: 0; padding: 8px 4px 8px 10px; border-radius: 16px;
  background: none; color: var(--text-primary); text-align: left; font-size: var(--text-sm); font-weight: 400; box-shadow: none; }
button.rl-item-open:hover { background: color-mix(in srgb, var(--accent-light) 55%, transparent); color: var(--text-primary); }
.rl-type-icon { width: 34px; height: 34px; border-radius: 12px; }
.rl-type-icon svg { width: 18px; height: 18px; }
.rl-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rl-item-title { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.rl-item-meta { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.35; overflow-wrap: anywhere; }
.rl-today-badge { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface); color: var(--peach-strong); font-size: 11px; font-weight: 800; vertical-align: 1px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--peach) 30%, transparent); }
button.rl-fav { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: var(--tap); height: var(--tap); margin: 0 4px 0 0; padding: 0; border-radius: 12px;
  background: none; color: var(--text-secondary); box-shadow: none; }
button.rl-fav:hover { background: var(--peach-light); color: var(--peach-strong); }
button.rl-fav svg { width: 22px; height: 22px; }
button.rl-fav[aria-pressed="true"] { color: var(--peach-strong); }
button.rl-fav[aria-pressed="true"] svg, button.rl-seg-btn svg, button.rl-btn--soft svg { fill: currentColor; fill-opacity: 0.18; }
button.rl-fav[aria-pressed="true"] svg { fill-opacity: 1; }
.rl-empty { margin: 12px 0; padding: 18px 14px; border-radius: 16px; background: var(--surface-soft); color: var(--text-secondary); font-size: var(--text-sm); text-align: center; }
.rl-disc { margin-top: 12px; }
.rl-about { padding: 8px 4px 0; }
.rl-about p { margin: 0 0 8px; font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
.rl-about b { color: var(--text-primary); }
.rl-sync { margin: 10px 2px 0; font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.4; }
.rl-sync[data-state="offline"] { color: var(--peach-strong); }

/* Reader view: comfortable measure and rhythm */
.rl-article { max-width: 36em; margin: 0 auto; padding-top: 12px; }
.rl-art-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rl-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: var(--radius-pill); background: var(--surface-muted); color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.rl-pill--type.rl-type--quote { background: var(--lavender-light); color: var(--lavender-ink); }
.rl-pill--type.rl-type--reflection { background: var(--accent-light); color: var(--accent-strong); }
.rl-pill--type.rl-type--reading { background: var(--yellow-light); color: var(--yellow-ink); }
.rl-mins { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.rl-art-title { margin: 10px 0 12px; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.rl-art-title:focus { outline: none; }
.rl-art-title:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; border-radius: 6px; }
.rl-cn { margin: 0 0 12px; padding: 6px 10px; border-radius: 10px; background: var(--peach-light); color: var(--peach-strong); font-size: var(--text-xs); font-weight: 600; }
.rl-quote { margin: 0 0 8px; padding: 14px 16px; border-left: 4px solid var(--peach); border-radius: 4px 16px 16px 4px; background: color-mix(in srgb, var(--peach-light) 70%, var(--surface)); }
.rl-quote p { margin: 0; font-size: 19px; line-height: 1.55; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.rl-quote--verse p { font-size: 18px; line-height: 1.7; font-weight: 600; }
.rl-attrib { margin: 0 0 14px; font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.45; }
.rl-attrib cite { font-style: normal; font-weight: 700; color: var(--text-primary); }
.rl-gloss { margin: 0 0 16px; padding: 10px 14px; border-radius: 14px; background: var(--surface-soft); }
.rl-gloss p:last-child { margin: 0; font-size: 15.5px; line-height: 1.65; color: var(--text-primary); }
.rl-lede { margin: 0 0 10px; font-size: 18px; line-height: 1.55; font-weight: 600; color: var(--text-primary); }
.rl-body-label { margin: 0 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-strong); }
.rl-body p:not(.rl-body-label) { margin: 0 0 12px; font-size: 16.5px; line-height: 1.7; color: var(--text-primary); }
button.rl-pair { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k c" "t c"; align-items: center; column-gap: 8px; width: 100%; min-height: 56px; margin: 4px 0 6px; padding: 10px 12px 10px 14px;
  border-radius: 16px; background: var(--accent-light); color: var(--text-primary); text-align: left; box-shadow: none; }
button.rl-pair:hover { background: color-mix(in srgb, var(--accent-light) 80%, var(--accent-2)); color: var(--text-primary); }
.rl-pair-k { grid-area: k; font-size: var(--text-2xs); font-weight: 800; letter-spacing: 0.03em; color: var(--accent-strong); }
.rl-pair-t { grid-area: t; font-size: 15px; font-weight: 700; }
button.rl-pair svg { grid-area: c; width: 18px; height: 18px; color: var(--accent-strong); }
.rl-art-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
button.rl-fav.rl-fav--wide { width: auto; padding: 0 16px 0 12px; margin: 0; background: var(--surface-muted); color: var(--text-primary); font-size: 15px; font-weight: 700; }
button.rl-fav.rl-fav--wide:hover { background: var(--peach-light); color: var(--peach-strong); }
button.rl-fav.rl-fav--wide[aria-pressed="true"] { background: var(--peach-light); color: var(--peach-strong); }
a.rl-link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: 12px; color: var(--accent-strong); font-size: 15px; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
a.rl-link:hover { background: var(--accent-light); text-decoration-color: currentColor; }
a.rl-link svg { width: 16px; height: 16px; flex: 0 0 auto; }
.rl-src { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 2px 4px; font-size: var(--text-xs); line-height: 1.45; }
.rl-src dt { font-weight: 700; color: var(--text-secondary); }
.rl-src dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }

/* Phones: 44 px targets for the small controls. */
@media (pointer: coarse) {
  button.rl-chip, button.rl-seg-btn { min-height: var(--tap); }
  button.link-btn.rl-inline { min-height: var(--tap); }
}
@media (max-width: 380px) {
  .rl-scroll { padding-left: 12px; padding-right: 12px; }
  button.rl-chip { padding: 0 11px; font-size: 13.5px; }
  .rl-art-title { font-size: 20px; }
  .rl-quote p { font-size: 18px; }
  .rl-quote { padding: 12px 12px 12px 14px; }
  .rl-quote--verse p { font-size: 16.5px; }
}

/* Night: the page is navy and the cards stay light; the reading surface turns a soft lavender milk
   (text stays ≥ 7:1) and the backdrop is a little deeper. */
html[data-period="night"] dialog.read-sheet { background: #F7F6FC; }
html[data-period="night"] dialog.read-sheet::backdrop { background: rgba(10, 14, 32, 0.55); }
html[data-period="night"] .rl-quote { border-left-color: var(--lavender); background: var(--lavender-light); }
