/* Ohana Library: shared look for every page (colors, type, buttons, footer, toast).
   Token names follow the hub style (hub.css) so the site can move onto it later.
   Page-specific CSS stays in the page. */
:root { --bg:#fafaf7; --card-bg:#ffffff; --card-hover:#f1f0ea; --text:#1d2321; --muted:#5d6763; --line:rgba(60,70,60,.14);
        --accent:#2f7d6b; --danger:#b3412e; --wood:#a9744a; --r-card:18px; --maxw:1080px; --shadow:0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.06); }
@media (prefers-color-scheme: dark) {
  :root { --bg:#141917; --card-bg:#1c2321; --card-hover:#232b28; --text:#e8ece9; --muted:#9aa6a1; --line:rgba(200,215,205,.12);
          --accent:#6cc3ad; --danger:#e58a78; --wood:#7a5233; --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); }
}
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--text);
       font:16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width:var(--maxw); margin:0 auto; padding:0 16px; }
a { color:inherit; }

.logo { width:56px; height:56px; display:block; margin:0 auto 10px; }
.logo .lean { transform-origin:47px 54px; animation:lean 6s ease-in-out 1.5s infinite; }
h1 { font-size:clamp(1.9rem, 6vw, 2.7rem); margin:0; letter-spacing:-.015em; }
.tagline { margin:.3rem 0 0; color:var(--muted); }

.btn { font:inherit; font-weight:600; border-radius:999px; padding:10px 18px; border:1px solid var(--line); background:transparent;
       color:var(--text); cursor:pointer; text-decoration:none; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:var(--bg); }
.btn.danger { color:var(--danger); border-color:color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.danger.solid { background:var(--danger); border-color:var(--danger); color:var(--bg); }

.toast { position:fixed; left:50%; bottom:24px; transform:translate(-50%, 20px); opacity:0; pointer-events:none;
         background:var(--text); color:var(--bg); padding:10px 18px; border-radius:999px; font-size:.95rem;
         transition:opacity .25s ease, transform .25s ease; max-width:calc(100% - 32px); text-align:center; }
.toast.show { opacity:1; transform:translate(-50%, 0); }

/* Footer */
footer { border-top:1px solid var(--line); margin-top:8px; padding:28px 0 40px; color:var(--muted); font-size:.92rem; }
.foot { display:flex; flex-wrap:wrap; gap:18px 28px; align-items:center; justify-content:space-between; }
.foot nav { display:flex; flex-wrap:wrap; gap:6px 20px; }
.foot a { text-decoration:none; } .foot a:hover { color:var(--text); }
.coffee { display:inline-flex; align-items:center; gap:8px; padding:9px 16px; border-radius:999px; font-weight:600;
          color:var(--text); background:var(--card-bg); border:1px solid var(--line); box-shadow:var(--shadow); }
.coffee:hover { border-color:var(--accent); }
.coffee .cup { display:inline-block; transition:transform .3s ease; } .coffee:hover .cup { transform:rotate(-12deg); }
.motto { margin:18px 0 0; font-size:.85rem; }
@media (max-width:560px) { .foot { flex-direction:column; text-align:center; } .foot nav { justify-content:center; } .motto { text-align:center; } }

@keyframes lean { 0%,40%,100% { transform:rotate(0); } 55%,80% { transform:rotate(-12deg); } }
@keyframes fade { from { opacity:0; transform:translateY(-4px); } }
@keyframes pop { from { opacity:0; transform:scale(.94); } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation:none !important; transition:none !important; } }

/* Family book count: "1,028 books on 4 family shelves", counts up once on load. */
.count { margin:.7rem 0 0; color:var(--muted); font-size:.95rem; }
.count b { color:var(--text); font-variant-numeric:tabular-nums; }

/* Made-up book covers (covers.js) until real Open Library covers exist. */
.cover { aspect-ratio:2/3; border-radius:4px 8px 8px 4px; overflow:hidden; position:relative; box-shadow:var(--shadow), inset 4px 0 rgba(0,0,0,.18);
         transition:transform .2s ease; display:flex; flex-direction:column; justify-content:center; padding:14% 12%; text-align:center;
         background:var(--c); color:#fffaf0; font-family:Georgia, "Times New Roman", serif; }
.book:hover .cover { transform:translateY(-4px) rotate(-1.2deg); }
.cover .ct { font-size:clamp(.85rem, 3.6vw, 1.05rem); line-height:1.2; font-weight:700; overflow-wrap:anywhere; hyphens:auto; -webkit-hyphens:auto; }
.cover .ca { position:absolute; left:10%; right:10%; bottom:8%; font-size:.72rem; letter-spacing:.06em; text-transform:uppercase; opacity:.85; }
.cover.s1::before { content:""; position:absolute; left:0; right:0; top:22%; height:3px; background:#fffaf0; opacity:.5; }
.cover.s2 { outline:2px solid rgba(255,250,240,.5); outline-offset:-10px; }
.cover.s3 .ct { font-style:italic; font-weight:400; font-size:clamp(.95rem, 4vw, 1.2rem); }

/* Pop-up sheets: slide up from the bottom on phones, centered panel on wider screens. */
.sheet-dlg { border:0; padding:0; background:var(--card-bg); color:var(--text); width:min(30rem, calc(100% - 32px)); max-height:85vh;
             border-radius:var(--r-card); box-shadow:0 20px 60px rgba(0,0,0,.35); }
.sheet-dlg::backdrop { background:rgba(10,14,12,.5); backdrop-filter:blur(3px); }
.sheet-dlg[open] { animation:pop .25s ease; }
@media (max-width:640px) {
  .sheet-dlg { margin:auto 0 0; max-width:100%; width:100%; border-radius:var(--r-card) var(--r-card) 0 0; padding-bottom:env(safe-area-inset-bottom); }
  .sheet-dlg[open] { animation:sheet-up .3s cubic-bezier(.2,1.1,.4,1); }
}
@keyframes sheet-up { from { transform:translateY(100%); } }
.sheet { padding:20px; display:grid; gap:14px; }
.sheet h3 { margin:0; display:flex; justify-content:space-between; align-items:center; font-size:1.2rem; }
.sheet .x { font:inherit; font-size:26px; line-height:1; border:0; background:none; color:var(--muted); cursor:pointer; padding:0 4px; }
.sheet input[type=search], .sheet textarea { font:inherit; font-size:16px; color:var(--text); background:var(--bg); border:1px solid var(--line);
                                             border-radius:12px; padding:10px 12px; outline:none; width:100%; }
.sheet input:focus, .sheet textarea:focus { border-color:var(--accent); }
.sheet textarea { min-height:96px; resize:vertical; }
.sheet .hint { margin:0; font-size:.82rem; color:var(--muted); }
.sheet [hidden] { display:none !important; }

/* Pills: a row of choices (radio inputs hidden behind rounded labels). Used by the book editor and the library sheets. */
.opts { display:flex; flex-wrap:wrap; gap:6px; }
.opts label { position:relative; cursor:pointer; font-weight:400; }   /* relative keeps the hidden input inside the pill (no sideways scroll) */
.opts input { position:absolute; opacity:0; pointer-events:none; }
.opts span { display:inline-block; font-size:.9rem; padding:7px 12px; border-radius:999px; border:1px solid var(--line); }
.opts input:checked + span { background:var(--accent); border-color:var(--accent); color:var(--bg); font-weight:600; }
.opts input:focus-visible + span { outline:2px solid var(--accent); outline-offset:2px; }
.picks { display:grid; gap:2px; }
.picks button { font:inherit; text-align:left; border:0; background:none; color:var(--text); padding:9px 10px; border-radius:10px; cursor:pointer; }
.picks button:hover { background:var(--card-hover); }
.picks span { color:var(--muted); font-size:.88rem; }
.rate { display:flex; gap:6px; justify-content:center; }
.rate button { border:0; background:none; font-size:36px; line-height:1; color:var(--line); cursor:pointer; transition:transform .15s ease, color .15s ease; }
.rate button.on { color:#e0a83a; transform:scale(1.12); }

/* Pills with a count badge ("New books 7"); the badge pulses once when there is something new. */
.pill { flex:none; font:inherit; font-size:.92rem; font-weight:600; display:inline-flex; align-items:center; gap:6px; height:40px; padding:0 14px;
        border-radius:999px; border:1px solid var(--line); background:var(--card-bg); color:var(--text); cursor:pointer; text-decoration:none; }
.pill:hover { border-color:var(--accent); }
.pill.primary { background:var(--accent); border-color:var(--accent); color:var(--bg); }
.pill .n { min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--accent); color:var(--bg); font-size:.75rem; display:grid; place-items:center; }
.pill .n:empty { display:none; }
.pill .n.fresh { background:#e0a83a; color:#1d2321; animation:pulse 1.4s ease 2; }
@keyframes pulse { 0%,100% { box-shadow:0 0 0 0 rgba(224,168,58,.6); } 50% { box-shadow:0 0 0 8px rgba(224,168,58,0); transform:scale(1.15); } }

/* Reviews and newly added books */
.review { padding:14px 0; border-bottom:1px solid var(--line); }
.review:last-child { border-bottom:0; }
.review .who { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:.92rem; }
.review .who svg { width:28px; height:28px; }
.review .when { color:var(--muted); font-size:.82rem; margin-left:auto; }
.review .rbook { display:block; margin:6px 0 0; font-family:Georgia, "Times New Roman", serif; font-weight:700; text-decoration:none; }
.review p { margin:4px 0 0; }
.review .mine-acts { display:flex; gap:14px; margin:6px 0 0; }
.review .mine-acts button { font:inherit; font-size:.82rem; border:0; background:none; padding:0; color:var(--muted); cursor:pointer; text-decoration:underline; }
.review .mine-acts [data-delete] { color:var(--danger); }
.confirm-btns { display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; }
.stars-ro { color:#e0a83a; letter-spacing:1px; font-size:.9rem; } .stars-ro i { font-style:normal; color:var(--line); }
.newbook { display:flex; gap:12px; align-items:center; padding:8px 0; text-decoration:none; }
.newbook .cover { flex:0 0 46px; padding:6px 4px; border-radius:2px 4px 4px 2px; }
.newbook .cover .ct { font-size:.5rem; } .newbook .cover .ca { display:none; }
.newbook b { display:block; font-family:Georgia, "Times New Roman", serif; }
.newbook .by { display:block; color:var(--muted); font-size:.88rem; }
.newbook .whose { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:.82rem; margin-top:2px; }
.newbook .whose svg { width:20px; height:20px; }
.feed { overflow-y:auto; max-height:60vh; margin:0 -4px; padding:0 4px; }
.tabs2 { display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:4px; border-radius:999px; background:var(--card-hover); }
.tabs2 button { font:inherit; font-weight:600; border:0; border-radius:999px; padding:8px; background:transparent; color:var(--muted); cursor:pointer; }
.tabs2 button[aria-selected=true] { background:var(--card-bg); color:var(--text); box-shadow:var(--shadow); }
