/* Lumin Reader: You, Read home, Family overview, What your parents can see, profile lock, and the shared Phase B helpers
   from ui.js (popover, bottom card, stepper).
   Copyright (C) 2026 B7 Collective LLC. Licensed under AGPL-3.0-only.
   Owner: PB-U6. Uses the tokens in app.css :root. Text is never under 12 px (13 px for labels). */

/* ---- Read home: Back to my page ---------------------------------------------------------------------------------- */
.app[data-route="home"] .hinner:has(.backcard) { justify-content: flex-end; }
.backcard { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s4); width: 100%; max-width: 560px; margin: 0 auto;
  padding: var(--s4); border-radius: var(--r-l); text-align: left; color: #fff; }
.backcard .bcover { display: block; border-radius: 10px; flex-shrink: 0; }
.backcard .bcover .cover { width: clamp(76px, 22vw, 104px); }
.backcard .kicker { color: rgba(255, 255, 255, .82); font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.backcard .ct2 { font-family: var(--serif); font-size: var(--t-xl); line-height: 1.15; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.backcard .bwhere { font-size: var(--t-s); color: rgba(255, 255, 255, .9); }
.backcard .bprog { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); overflow: hidden; margin: 2px 0 var(--s2); }
.backcard .bprog i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.backcard .btn { align-self: flex-start; min-height: 48px; margin-bottom: 0; }
@media (max-width: 339px) { .backcard { grid-template-columns: minmax(0, 1fr); text-align: left; } .backcard .bcover { display: none; } .backcard .btn { align-self: stretch; } }

/* ---- Read home: Your lists, collection of the day, family overview ----------------------------------------------- */
.shelf-head .sec-title:has(> .kicker) { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.shelf-head .sec-title .kicker { display: block; color: var(--berry); font-family: var(--sans); font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.shelf-head .textlink { white-space: nowrap; }
.listchips { display: flex; flex-wrap: wrap; gap: var(--s3); }
.listchip { display: flex; flex-direction: column; gap: 2px; min-width: 140px; max-width: 100%; padding: var(--s3) var(--s4); border-radius: var(--r-m); background: var(--card);
  box-shadow: inset 4px 0 0 var(--lc, var(--accent)), var(--shadow); color: var(--ink); text-decoration: none; }
.listchip .lname { font-weight: 700; overflow-wrap: anywhere; }
.cotd { display: flex; align-items: center; gap: var(--s4); padding: var(--s4); border-radius: var(--r-l); text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--cc, var(--teal)) 14%, var(--card)); box-shadow: var(--shadow); }
.cotd .kicker { color: var(--muted); font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cotd-t { font-family: var(--serif); font-weight: 400; font-size: var(--t-l); line-height: 1.2; }
.cotd-h { color: var(--muted); font-size: var(--t-s); }
.cotd-covers { display: flex; flex-shrink: 0; }
.cotd-covers .cover { width: 56px; box-shadow: 0 4px 10px rgb(0 0 0 / .18); }
.cotd-covers .cover + .cover { margin-left: -28px; }
.cotd .icon { color: var(--muted); flex-shrink: 0; }
@media (max-width: 379px) { .cotd { flex-wrap: wrap; } .cotd > .icon { display: none; } }

/* ---- You ---------------------------------------------------------------------------------------------------------- */
.you .stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.you .stat span { font-size: var(--t-xs); }
@media (max-width: 339px) { .you .stats.three { grid-template-columns: minmax(0, 1fr); } }
.menu .yrow { width: 100%; font: inherit; color: var(--ink); cursor: pointer; }
.menu .yrow > span:not(.chev) { display: flex; flex-direction: column; min-width: 0; }
.linkrow { text-decoration: none; color: var(--ink); }
.linkrow .icon:last-child { color: var(--muted); }
.rolehelp { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--t-s); }
.rolehelp li.on { color: var(--ink); }

/* ---- Family overview and What your parents can see (one card for both) ----------------------------------------------- */
.ovgrid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.ovcard { background: var(--card); border-radius: var(--r-l); box-shadow: var(--shadow); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.ovhead { display: flex; align-items: center; gap: var(--s3); }
.ovrows { display: flex; flex-direction: column; gap: var(--s3); }
.ovrow { display: flex; flex-direction: column; gap: 4px; }
.ovrow.inline { flex-direction: row; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.ovk { font-size: var(--t-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ovv { font-weight: 700; }
.ovv.muted { font-weight: 400; }
.ovbooks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.ovbooks li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s3); align-items: baseline; }
.ovbooks .ovt { font-family: var(--serif); overflow-wrap: anywhere; }
.ovbooks .ovpct { font-size: var(--t-s); color: var(--muted); }
.ovbooks .bprog { grid-column: 1 / -1; display: block; height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; margin-top: 4px; }
.ovbooks .bprog i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.ovbooks.plain li { grid-template-columns: minmax(0, 1fr); }
.ovbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; height: 56px; align-items: end; }
.ovbar { height: 100%; display: flex; align-items: flex-end; }
.ovbar i { display: block; width: 100%; border-radius: 3px 3px 1px 1px; background: var(--teal); }
.ovcard.off p { margin: 0; }
.ovminis { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.ovmini { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-m); background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; min-width: 0; }
.ovmini .grow { min-width: 0; }
.ovmini .muted { overflow-wrap: anywhere; }

/* ---- ui.js helpers: popover, bottom card, stepper ------------------------------------------------------------------- */
.popover { position: fixed; z-index: 40; background: var(--card); color: var(--ink); border-radius: var(--r-m); box-shadow: var(--float); padding: var(--s4); max-height: calc(100dvh - 16px); overflow: auto; outline: none; }
.bottomcard { position: fixed; z-index: 30; left: max(8px, calc(50% - 300px)); right: max(8px, calc(50% - 300px)); bottom: calc(8px + var(--safe-bottom)); overflow: auto;
  background: var(--card); color: var(--ink); border-radius: var(--r-l); box-shadow: var(--float); padding: var(--s4); }
.app.has-nav ~ #layer .bottomcard, #layer .bottomcard.above-nav { bottom: calc(84px + var(--safe-bottom)); }
@media (min-width: 900px) { .app.has-nav ~ #layer .bottomcard { bottom: calc(16px + var(--safe-bottom)); } }
.stepper { display: inline-flex; align-items: center; gap: var(--s2); }
.stepper .iconbtn { width: var(--tap); height: var(--tap); }
.stepper .stepsign { font-size: 22px; line-height: 1; }
.stepper .stepval { min-width: 7ch; text-align: center; font-weight: 700; font-size: var(--t-s); }

/* ---- The tab bar on cover screens ------------------------------------------------------------------------------------ */
/* reader.css's cover-screen rule (max-width 320px) shrinks the tab labels to 11 px; tab labels are 13 px at every width
   (build-plan 5.10), and app.css fits them at 280 px. This wins over it until that rule goes. */
@media (max-width: 339px) {
  .bottomnav { left: 4px !important; right: 4px !important; }
  .bottomnav a { font-size: var(--label-nav); padding-inline: 0; }
}
/* A 280 px cover screen: five equal places of about 51 px. The current place's label is bold, so it sets a little
   tighter there, and "Notebook" fits whole instead of "Notebo…" */
@media (max-width: 339px) { .bottomnav a[aria-current="page"] .lbl { letter-spacing: -.07em; } }

/* ---- The page background (build plan 5.12) ----------------------------------------------------------------------- */
/* Its three loops drift at most 18 px (the blobs are soft, so the drift is a gentle breathing, not travel), rest 60 s
   after the last input (app.js sets html.amb-rest), and stay still on the screens that keep their own budget (the
   Journey and the collection screens), under the explorer's Still, and with reduced motion */
.ambient i:nth-child(1) { animation-name: ramb1; }
.ambient i:nth-child(2) { animation-name: ramb2; }
.ambient i:nth-child(3) { animation-name: ramb3; }
@keyframes ramb1 { to { transform: translate(14px, 10px) scale(1.02); } }
@keyframes ramb2 { to { transform: translate(-12px, 12px) scale(.98); } }
@keyframes ramb3 { to { transform: translate(10px, -14px) scale(1.02); } }
html.amb-rest .ambient i, html.still .ambient i,
body:has(#app[data-route="journey"]) .ambient i, body:has(#app[data-route="collections"]) .ambient i, body:has(#app[data-route="collection"]) .ambient i { animation-play-state: paused; }
html.calm .ambient i:nth-child(n) { animation: none; }
@media (prefers-reduced-motion: reduce) { html .ambient i:nth-child(n) { animation: none; } }

/* ---- Toasts beside an open side sheet ----------------------------------------------------------------------------- */
/* From 720 px a sheet stands on the right, and a toast in the middle of the screen could cover its buttons (a toast
   over "Save" at 841 px). While a sheet is open, a toast goes to the top of the screen, or, where there is room, into
   the space left of the sheet. */
@media (min-width: 720px) {
  body:has(#layer .sheet) .toast { top: calc(16px + var(--safe-top)); bottom: auto; }
}
@media (min-width: 1000px) {
  body:has(#layer .sheet:not(.wide)) .toast { top: auto; bottom: calc(32px + var(--safe-bottom)); left: calc((100vw - 520px) / 2); max-width: calc(100vw - 520px - 2 * var(--gutter)); }
}

/* ---- When this device can't save (data-spec 4.2, 4.4) --------------------------------------------------------------- */
.savebar { position: fixed; z-index: 45; left: 8px; right: 8px; top: calc(8px + var(--safe-top)); margin: 0 auto; max-width: 640px; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4); border-radius: var(--r-m); background: var(--ink); color: var(--bg); box-shadow: 0 16px 30px -12px rgba(0,0,0,.45); font-size: var(--t-s); }
.savebar span { flex: 1 1 220px; min-width: 0; }
.savebar .btn { min-height: 40px; }
.savebar .btn.quiet { color: var(--bg); }

/* Screen-reader lines at the end of the page (ui.js's #live, the reader's #rd-live) sit at the top, so they never make a
   screen a pixel taller than the window (a 1 px scroll on phones) */
body > .sr { top: 0; left: 0; }
