/* Liora's Library: a warm, golden-hour reading room. */

:root {
    --bg: #110d09;
    --bg-2: #18120c;
    --card: rgba(255, 232, 196, 0.045);
    --card-hover: rgba(255, 232, 196, 0.08);
    --line: rgba(255, 210, 150, 0.13);
    --line-strong: rgba(255, 210, 150, 0.26);
    --text: #f7ecdb;
    --muted: #b9a88f;
    --gold: #ffb800;
    --gold-2: #ff8a1f;
    --ink: #2a1800;
    --danger: #ff7a6b;
    --ok: #74d99f;
    --shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
    --radius: 22px;
    --serif: "Fraunces", Georgia, "Times New Roman", serif;
    --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --spine: #ffb800;
    color-scheme: dark;
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f8f1e5;
    --bg-2: #fffaf2;
    --card: rgba(255, 252, 245, 0.85);
    --card-hover: #ffffff;
    --line: rgba(110, 72, 20, 0.14);
    --line-strong: rgba(110, 72, 20, 0.28);
    --text: #2c2116;
    --muted: #7b6a55;
    --gold: #e89a00;
    --gold-2: #e0680d;
    --shadow: 0 18px 40px rgba(110, 72, 20, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--sans);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

/* soft golden light in the room */
.glow { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; opacity: 0.55; }
.glow-a { width: 620px; height: 620px; top: -260px; left: 50%; transform: translateX(-50%); background: radial-gradient(circle, rgba(255, 184, 0, 0.35), transparent 70%); }
.glow-b { width: 520px; height: 520px; bottom: -240px; right: -160px; background: radial-gradient(circle, rgba(255, 120, 40, 0.18), transparent 70%); }
:root[data-theme="light"] .glow { opacity: 0.45; }

main, .topbar, .foot { position: relative; z-index: 1; }

/* --- top bar --- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1180px; margin: 0 auto; padding: 22px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1.25rem var(--serif); }
.brand em { font-style: italic; color: var(--gold); }
.top-links { display: flex; gap: 8px; align-items: center; }

.ghost {
    background: transparent; color: var(--text); border: 1px solid var(--line);
    padding: 8px 16px; border-radius: 999px; font: 500 0.92rem var(--sans); text-decoration: none;
    cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.ghost:hover { border-color: var(--line-strong); background: var(--card); }
.icon-btn { width: 40px; height: 40px; padding: 0; font-size: 1.1rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--ink);
    border: 0; padding: 10px 20px; border-radius: 999px; font: 700 0.95rem var(--sans);
    text-decoration: none; cursor: pointer; white-space: nowrap;
    box-shadow: 0 8px 20px rgba(255, 150, 0, 0.25);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(255, 150, 0, 0.35); }
.btn.busy { background: var(--card); color: var(--muted); box-shadow: none; border: 1px dashed var(--line-strong); cursor: default; }
.btn.busy:hover { transform: none; }

/* --- hero --- */
.hero { max-width: 760px; margin: 0 auto; padding: 24px 24px 12px; text-align: center; }
.hero-gem { position: relative; width: 160px; height: 160px; margin: 6px auto 18px; }
.hero-gem img { width: 100%; height: 100%; animation: bob 6s var(--ease) infinite; filter: drop-shadow(0 18px 30px rgba(255, 160, 0, 0.35)); }
.hero-gem::before {
    content: ""; position: absolute; inset: 18%; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 80, 0.5), transparent 70%); filter: blur(24px);
    animation: breathe 6s ease-in-out infinite;
}
.spark { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); opacity: 0; animation: twinkle 4.5s ease-in-out infinite; }
.s1 { top: 8%; left: 2%; animation-delay: 0.2s; }
.s2 { top: 22%; right: -4%; animation-delay: 1.4s; }
.s3 { bottom: 12%; left: -6%; animation-delay: 2.6s; width: 4px; height: 4px; }
.s4 { bottom: 2%; right: 8%; animation-delay: 3.4s; width: 5px; height: 5px; }

.eyebrow { margin: 0 0 6px; color: var(--gold); font: 500 0.82rem var(--sans); letter-spacing: 0.18em; text-transform: uppercase; }
h1 { margin: 0; font: 600 clamp(2.1rem, 5.4vw, 3.6rem)/1.08 var(--serif); letter-spacing: -0.02em; }
h1 .gold { font-style: italic; background: linear-gradient(120deg, var(--gold), var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { max-width: 600px; margin: 18px auto 26px; color: var(--muted); font-size: 1.05rem; }
.lede strong { color: var(--text); font-weight: 500; }

.search {
    display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto;
    padding: 6px 8px 6px 20px; border-radius: 999px; background: var(--bg-2);
    border: 1px solid var(--line-strong); box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 184, 0, 0.15), var(--shadow); }
.search input { flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; background: transparent; color: var(--text); font: 1rem var(--sans); }
.search input::placeholder { color: var(--muted); }
.totals { margin: 14px 0 0; color: var(--muted); font-size: 0.9rem; min-height: 1.4em; }

/* closed-beta note: why most cards say "Opens after beta" */
.beta-note {
    display: flex; gap: 14px; align-items: flex-start;
    max-width: 760px; margin: 8px auto 22px; padding: 16px 20px;
    background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold);
    border-radius: 16px; color: var(--muted); font-size: 0.95rem;
    position: relative; z-index: 1;
}
.beta-note-icon { width: 1.5rem; height: 1.5rem; margin-top: 2px; }
.beta-note strong { display: block; color: var(--text); font: 600 1.05rem var(--serif); margin-bottom: 4px; }
.beta-note p { margin: 0; }
.beta-note b { color: var(--text); font-weight: 600; }
@media (max-width: 720px) { .beta-note { margin: 4px 16px 18px; padding: 14px 16px; } }

/* --- shelves --- */
.shelves {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
    max-width: 1100px; margin: 26px auto 8px; padding: 0 24px;
}
.shelf {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--line); color: var(--text);
    font: 500 0.92rem var(--sans); cursor: pointer; transition: all 0.2s var(--ease);
}
.shelf:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.shelf[aria-pressed="true"] { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--ink); border-color: transparent; }
.shelf .count { opacity: 0.65; font-size: 0.8rem; }

/* --- featured --- */
.featured-wrap { max-width: 1100px; margin: 26px auto 0; padding: 0 24px; }
.section-label { margin: 0 0 12px; color: var(--gold); font: 600 0.8rem var(--sans); letter-spacing: 0.16em; text-transform: uppercase; }
.featured {
    position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 26px; align-items: center;
    padding: 30px 32px; border-radius: 28px; overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 184, 0, 0.14), rgba(255, 120, 30, 0.06) 55%, var(--card));
    border: 1px solid rgba(255, 184, 0, 0.35); box-shadow: var(--shadow);
}
.featured::after {
    content: "✦"; position: absolute; right: 26px; top: 14px; font-size: 5.5rem; line-height: 1;
    color: var(--gold); opacity: 0.08; pointer-events: none;
}
.featured .icon { width: 108px; height: 108px; border-radius: 30px; font-size: 2.6rem; }
.featured h2 { margin: 0 0 4px; font: 600 1.9rem/1.15 var(--serif); }
.featured .blurb { margin: 10px 0 12px; font: italic 400 1.15rem/1.5 var(--serif); color: var(--text); }

/* --- grid of books --- */
.grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
    max-width: 1100px; margin: 28px auto 0; padding: 0 24px;
    grid-auto-rows: 1fr;     /* every row as tall as the tallest card, so every card is the same size */
}
.book {
    --spine: var(--gold);
    position: relative; display: flex; flex-direction: column; gap: 12px;
    padding: 22px 22px 18px 30px; border-radius: var(--radius);
    background: var(--card); border: 1px solid var(--line);
    transition: transform 0.35s var(--ease), background 0.25s, border-color 0.25s, box-shadow 0.35s var(--ease);
    animation: rise 0.6s var(--ease) both;
}
.book::before {
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 6px;
    border-radius: 0 6px 6px 0; background: var(--spine);
    box-shadow: 0 0 18px color-mix(in srgb, var(--spine) 55%, transparent);
}
.book:hover { transform: translateY(-5px); background: var(--card-hover); border-color: var(--line-strong); box-shadow: var(--shadow); }
.book-head { display: flex; gap: 14px; align-items: center; }
.icon {
    flex: none; width: 58px; height: 58px; border-radius: 18px; object-fit: cover;
    display: grid; place-items: center; font: 600 1.5rem var(--serif); color: var(--ink);
    background: linear-gradient(135deg, color-mix(in srgb, var(--spine) 70%, #fff3d6), var(--spine));
    border: 1px solid var(--line);
}
.book h3 { margin: 0; font: 600 1.18rem/1.25 var(--serif); overflow-wrap: anywhere; }
.shelf-name { color: var(--muted); font-size: 0.84rem; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
/* who the server is for: every listing shows it */
.age {
    display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px;
    font: 700 0.74rem var(--sans); letter-spacing: 0.02em; line-height: 1.6;
    border: 1px solid currentColor;
}
.age-18 { color: #ff8f7a; background: rgba(255, 110, 90, 0.12); }
.age-16 { color: #c9a2ff; background: rgba(170, 120, 255, 0.12); }
.age-13 { color: var(--ok); background: rgba(116, 217, 159, 0.12); }
:root[data-theme="light"] .age-18 { color: #c43d25; }
:root[data-theme="light"] .age-16 { color: #7a45c9; }
:root[data-theme="light"] .age-13 { color: #1f8a4e; }
.blurb { margin: 0; color: var(--text); opacity: 0.92; font-size: 0.97rem; overflow-wrap: anywhere; }
.badges, .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font: 600 0.75rem var(--sans); background: rgba(255, 184, 0, 0.14); color: var(--gold); border: 1px solid rgba(255, 184, 0, 0.28); }
.badge.welcoming { background: rgba(116, 217, 159, 0.12); color: var(--ok); border-color: rgba(116, 217, 159, 0.3); }
.badge.home { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--ink); border-color: transparent; }
.badge.showcase { background: rgba(255, 184, 0, 0.06); color: var(--gold); border-color: var(--gold); }
.tag { padding: 2px 9px; border-radius: 8px; font-size: 0.78rem; color: var(--muted); border: 1px solid var(--line); }
.book-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 6px; }
.meta { color: var(--muted); font-size: 0.86rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); margin-right: 5px; }
.actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.report-link { background: none; border: 0; color: var(--muted); font: 0.8rem var(--sans); cursor: pointer; padding: 6px; border-radius: 8px; }
.report-link:hover { color: var(--danger); }

/* --- previews (only Bliss/Mother see these: opted in, not public yet) --- */
.book.preview { border-style: dashed; border-color: rgba(255, 184, 0, 0.45); }
.ribbon {
    align-self: flex-start; margin: -6px 0 -2px; padding: 3px 10px; border-radius: 999px;
    font: 700 0.72rem var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--ink); background: linear-gradient(135deg, var(--gold), var(--gold-2));
}
/* the preview's checklist folds away, so a preview card is the same size as the rest until Bliss opens it */
.todo { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(255, 184, 0, 0.07); border: 1px solid rgba(255, 184, 0, 0.2); color: var(--muted); font-size: 0.85rem; }
.todo summary { cursor: pointer; color: var(--gold); font-weight: 600; list-style: none; }
.todo summary::-webkit-details-marker { display: none; }
.todo summary::after { content: " ▾"; }
.todo[open] summary::after { content: " ▴"; }
.todo ul { margin: 6px 0 2px; padding-left: 18px; }
.todo li { margin: 2px 0; }

/* the hidden-theme gem (gem-secret.js, Library and Meet the team): a little glow when it's found */
.brand img, .hero-gem img { cursor: pointer; transition: filter 0.4s, transform 0.4s; -webkit-user-drag: none; user-select: none; }
.brand img.gem-found, .hero-gem img.gem-found { filter: drop-shadow(0 0 14px rgba(255, 184, 0, 0.95)); transform: scale(1.25) rotate(-8deg); }

/* --- empty, footer, modal, toast --- */
.empty { text-align: center; padding: 50px 24px 10px; color: var(--muted); }
.empty img { opacity: 0.9; animation: bob 6s var(--ease) infinite; }
.empty h2 { color: var(--text); font: 600 1.4rem var(--serif); margin: 10px 0 4px; }
.foot { max-width: 760px; margin: 70px auto 0; padding: 26px 24px 46px; text-align: center; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }
.foot strong { color: var(--text); font-weight: 500; }
.foot a { color: var(--gold, #ffb800); text-underline-offset: 3px; }

.modal { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 24px; padding: 26px; max-width: 460px; width: calc(100% - 32px); background: var(--bg-2); color: var(--text); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(8, 5, 2, 0.6); backdrop-filter: blur(4px); }
.modal h2 { margin: 0 0 6px; font: 600 1.35rem var(--serif); }
.muted { color: var(--muted); font-size: 0.92rem; margin: 0 0 14px; }
.modal textarea { display: block; width: 100%; resize: vertical; overflow-x: hidden; overflow-y: auto; min-height: 96px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: 0.95rem var(--sans); }
.modal textarea:focus { outline: 0; border-color: var(--gold); }
.form-msg { min-height: 1.3em; margin: 10px 0 0; font-size: 0.9rem; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.form-msg a { color: var(--gold); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10;
    padding: 12px 20px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow); font-size: 0.95rem; animation: rise 0.4s var(--ease);
}

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-12px) rotate(1.5deg); } }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(0.95); } 50% { opacity: 0.9; transform: scale(1.08); } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 45% { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
    .featured { grid-template-columns: 1fr; text-align: center; padding: 26px 20px; }
    .featured .icon { margin: 0 auto; }
    .featured .badges, .featured .tags { justify-content: center; }
    .grid { grid-template-columns: 1fr; padding: 0 16px; }
    .topbar { padding: 16px; }
    .brand span { font-size: 1.1rem; }
}
/* small phones: the links get a little smaller, and drop under the name rather than off the screen */
@media (max-width: 520px) {
    .topbar { flex-wrap: wrap; gap: 12px; }
    .top-links { flex-wrap: wrap; gap: 6px; }
    .top-links .ghost:not(.icon-btn) { padding: 7px 12px; font-size: 0.86rem; }
    .top-links .icon-btn { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- card magic (static/js/card-magic.js): 3D tilt, cursor glare, floating icons and Liora's golden sparks --- */
.spark-particle {
    position: fixed; top: 0; left: 0; height: 1.5px; width: 4px;
    pointer-events: none; z-index: 99999; opacity: 0;
    transform-origin: 0% 50%; border-radius: 1px;
    background: linear-gradient(90deg, #fff8e1 0%, #ffd54f 30%, #ffb800 65%, transparent 100%);
    filter: drop-shadow(0 0 2px rgba(255, 184, 0, 0.75));
    will-change: transform, width, opacity;
}
.magic-card, .magic-card .book-head { transform-style: preserve-3d; }
.magic-card { will-change: transform; }
.magic-card.magic-on {
    transition: transform 0.12s ease-out, background 0.25s, border-color 0.25s, box-shadow 0.35s var(--ease);
    box-shadow: 0 26px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 184, 0, 0.18);
}
.magic-glare {
    position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 226, 160, 0.16), transparent 48%);
    opacity: 0; transition: opacity 0.3s;
    mix-blend-mode: screen;
}
.magic-on > .magic-glare { opacity: 1; }
:root[data-theme="light"] .magic-glare { background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.55), transparent 50%); mix-blend-mode: normal; }
:root[data-theme="light"] .magic-card.magic-on { box-shadow: 0 22px 44px rgba(110, 72, 20, 0.22), 0 0 0 1px rgba(232, 154, 0, 0.25); }
/* the icon / photo floats a little above the card, so it shifts against it as the card tilts */
.magic-card .icon, .magic-card .member-photo { transition: transform 0.3s var(--ease); }
/* leaving: a slow, soft settle back to flat (0.8s, gentle ease-out) instead of a snap */
.magic-card.magic-leaving {
    transition: transform 0.8s cubic-bezier(0.33, 1, 0.68, 1), background 0.4s, border-color 0.4s, box-shadow 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}
.magic-card.magic-leaving .icon, .magic-card.magic-leaving .member-photo { transition: transform 0.8s cubic-bezier(0.33, 1, 0.68, 1); }
.magic-leaving > .magic-glare { transition: opacity 0.6s; }
.magic-card.magic-on .book-head .icon, .magic-card.magic-on .member-photo { transform: translateZ(34px); }
@media (prefers-reduced-motion: reduce) { .magic-glare { display: none; } }

/* golden emblems (emblems.css) */
.search .ico { width: 20px; height: 20px; }
.badge .ico { width: 14px; height: 14px; }
.shelf-label { display: inline-flex; align-items: center; gap: 6px; }
.shelf .ico { width: 17px; height: 17px; }
.shelf-name .ico { width: 16px; height: 16px; margin-right: -4px; }
/* the chosen shelf is solid gold: its emblem is drawn in the button's ink instead */
.shelf[aria-pressed="true"] .ico, .badge.home .ico { stroke: currentColor; }
.shelf[aria-pressed="true"] .ico .f, .badge.home .ico .f { fill: currentColor; fill-opacity: 0.2; }
.shelf[aria-pressed="true"] .ico .solid, .badge.home .ico .solid { fill: currentColor; }

/* Every card the same size (Bliss, 2026-10-03: "keep them all the same size... that gold standard feel"): each blurb
   gets the same six lines (the longest a 280-character blurb runs), trimmed with "..." if it ever runs over. */
#grid .blurb {
    line-height: 1.5; min-height: calc(1.5em * 6);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden;
}
