/* ==========================================================================
   Bookify public site — design system
   Used by the landing page and the legal pages via Views/Shared/_PublicLayout.
   The admin/publisher portal keeps styles.css; only the login screen borrows
   the tokens below so the entry point matches the public site.
   ========================================================================== */

:root {
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --paper: #fbfcfe;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --line: #e7ecf3;
    --brand: #2563eb;
    --brand-ink: #1d4ed8;
    --brand-2: #7c3aed;
    --grad: linear-gradient(120deg,#2563eb 0%,#6d3aed 55%,#7c3aed 100%);
    --shadow: 0 1px 2px rgba(15,23,42,.04),0 12px 30px -12px rgba(15,23,42,.18);
    --radius: 16px;
    --serif: "Iowan Old Style","Palatino Linotype",Palatino,Georgia,"Times New Roman",serif;
    --sans: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,system-ui,"Helvetica Neue",Arial,sans-serif;
    --maxw: 1120px;
}

/* Follow the OS by default; the toggle below overrides it and persists. */
@media (prefers-color-scheme:dark) {
    :root {
        --ink: #e8edf5;
        --ink-soft: #c3ccda;
        --muted: #8b97a9;
        --paper: #0a1120;
        --surface: #0f1830;
        --surface-2: #111d38;
        --line: rgba(255,255,255,.08);
        --brand: #5b8bff;
        --brand-ink: #7aa2ff;
        --brand-2: #a78bfa;
        --shadow: 0 1px 2px rgba(0,0,0,.4),0 18px 40px -16px rgba(0,0,0,.6);
    }
}

:root[data-theme="dark"] {
    --ink: #e8edf5;
    --ink-soft: #c3ccda;
    --muted: #8b97a9;
    --paper: #0a1120;
    --surface: #0f1830;
    --surface-2: #111d38;
    --line: rgba(255,255,255,.08);
    --brand: #5b8bff;
    --brand-ink: #7aa2ff;
    --brand-2: #a78bfa;
    --shadow: 0 1px 2px rgba(0,0,0,.4),0 18px 40px -16px rgba(0,0,0,.6);
}

:root[data-theme="light"] {
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --paper: #fbfcfe;
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --line: #e7ecf3;
    --brand: #2563eb;
    --brand-ink: #1d4ed8;
    --brand-2: #7c3aed;
    --shadow: 0 1px 2px rgba(15,23,42,.04),0 12px 30px -12px rgba(15,23,42,.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion:reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
}

body.bk {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.bk a { color: inherit; }
body.bk img { max-width: 100%; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-ink); }

body.bk h1, body.bk h2, body.bk h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -.01em;
    text-wrap: balance;
    margin: 0;
}

body.bk p { margin: 0; }

/* ---------- Header ---------- */
header.site {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(1.4) blur(12px);
    background: color-mix(in srgb,var(--paper) 82%,transparent);
    border-bottom: 1px solid var(--line);
}

.nav { display: flex; align-items: center; gap: 18px; height: 64px; }

.brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--serif); font-weight: 600; font-size: 21px;
    letter-spacing: -.02em; text-decoration: none; color: var(--ink);
}

.mark {
    width: 32px; height: 32px; border-radius: 9px; background: var(--grad);
    display: grid; place-items: center; box-shadow: var(--shadow); flex: none;
}

.mark svg { width: 18px; height: 18px; }
.nav .spacer { flex: 1; }
.nav a.link { text-decoration: none; color: var(--ink-soft); font-size: 14px; font-weight: 600; padding: 8px 6px; }
.nav a.link:hover { color: var(--ink); }

/* ---------- Mobile menu ----------
   Below the breakpoint the inline links are hidden and reached through the
   toggle instead; previously they simply vanished with nothing in their place. */
.navtoggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    flex: none;
}

.navtoggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
    transition: transform .18s ease, opacity .18s ease;
}

.navtoggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navtoggle.active span:nth-child(2) { opacity: 0; }
.navtoggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width:820px) {
    .navtoggle { display: flex; }

    header.site .nav {
        flex-wrap: wrap;
        height: auto;
        min-height: 64px;
        align-items: center;
    }

    .nav a.link { display: none; }

    /* Opened: each link takes a full row beneath the brand bar. */
    .nav.open { padding-bottom: 8px; }

    .nav.open a.link {
        display: block;
        flex: 0 0 100%;
        padding: 13px 4px;
        font-size: 15px;
        border-top: 1px solid var(--line);
    }
}

.btn {
    display: inline-flex; align-items: center; gap: 9px;
    font-weight: 700; font-size: 14px; text-decoration: none;
    padding: 10px 16px; border-radius: 11px; border: 1px solid transparent;
    cursor: pointer; transition: transform .12s ease;
}

.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }

.themetoggle {
    background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
    width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
    display: grid; place-items: center;
}

.themetoggle:hover { color: var(--ink); }
body.bk a:focus-visible, body.bk button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 64px 0 40px; }
.hero .grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }

@media (max-width:900px) {
    .hero .grid { grid-template-columns: 1fr; gap: 36px; }
}

.hero h1 { font-size: clamp(38px,6vw,62px); }
.hero .lede { margin-top: 20px; font-size: 19px; color: var(--ink-soft); max-width: 34ch; }
.badges { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

.store {
    display: inline-flex; align-items: center; gap: 11px; text-decoration: none;
    color: #fff; background: #0b1220; border: 1px solid rgba(255,255,255,.12);
    padding: 11px 16px; border-radius: 13px; min-width: 180px; box-shadow: var(--shadow);
}

:root[data-theme="light"] .store { background: #0f172a; }

@media (prefers-color-scheme:light) {
    .store { background: #0f172a; }
}

/* The badge always sits on a near-black plate, so its text is white in both
   themes. Needs to outrank `body.bk a { color: inherit }` — under that rule the
   badge inherited the page text colour, which in light mode is the same near-black
   as the plate itself, making the label invisible. */
body.bk .store,
body.bk .store .st,
body.bk .store .st b,
body.bk .store .st small { color: #fff; }

.store:hover { filter: brightness(1.08); }
.store svg { width: 22px; height: 22px; flex: none; }
.store .st { display: flex; flex-direction: column; line-height: 1.1; }
.store .st small { font-size: 10px; opacity: .8; font-weight: 600; letter-spacing: .02em; }
.store .st b { font-size: 16px; font-weight: 700; font-family: var(--sans); }

.trust { margin-top: 22px; display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; font-weight: 600; }
.trust span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }

/* ---------- Phone mockup ---------- */
.device { justify-self: center; width: 300px; max-width: 78vw; aspect-ratio: 300/610; position: relative; }

.phone {
    position: absolute; inset: 0; border-radius: 44px;
    background: linear-gradient(180deg,#141c30,#0c1322); padding: 12px;
    box-shadow: 0 40px 80px -30px rgba(37,60,120,.55),0 2px 0 rgba(255,255,255,.06) inset;
    border: 1px solid rgba(255,255,255,.08);
}

.screen { position: absolute; inset: 12px; border-radius: 34px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.notch { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 120px; height: 24px; background: #0c1322; border-radius: 0 0 16px 16px; z-index: 3; }
.app { position: absolute; inset: 0; display: flex; flex-direction: column; font-family: var(--sans); }
.appbar { padding: 34px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.appbar b { font-family: var(--serif); font-size: 17px; }
.search { margin: 0 16px 12px; height: 32px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; padding: 0 10px; gap: 8px; color: var(--muted); font-size: 11px; }
.books { flex: 1; overflow: hidden; padding: 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }

.book {
    border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); position: relative;
    aspect-ratio: 3/4; background: linear-gradient(150deg,var(--c1),var(--c2));
    display: flex; align-items: flex-end;
}

.book span { font-size: 9px; font-weight: 700; color: #fff; padding: 8px; line-height: 1.15; text-shadow: 0 1px 3px rgba(0,0,0,.4); }

.book.ai::after {
    content: "AI"; position: absolute; top: 6px; left: 6px; font-size: 8px; font-weight: 800; color: #fff;
    background: linear-gradient(120deg,#7c3aed,#db2777); padding: 2px 6px; border-radius: 20px;
}

.aichip { margin: 12px 16px 16px; border-radius: 14px; padding: 11px 13px; background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.aichip small { opacity: .85; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.aichip p { font-size: 11px; margin-top: 3px; line-height: 1.35; }
.tabbar { height: 52px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-around; color: var(--muted); }
.tabbar .t { width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); }
.tabbar .t.on { background: var(--brand); }

/* ---------- Sections ---------- */
body.bk section { padding: 64px 0; }
.sec-head { max-width: 640px; }
.sec-head h2 { font-size: clamp(28px,4vw,40px); margin-top: 12px; }
.sec-head p { margin-top: 14px; color: var(--ink-soft); font-size: 18px; }

.features { margin-top: 40px; display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }

@media (max-width:860px) {
    .features { grid-template-columns: 1fr 1fr; }
}

@media (max-width:560px) {
    .features { grid-template-columns: 1fr; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb,var(--brand) 12%,transparent); color: var(--brand-ink); margin-bottom: 14px; }
.ic svg { width: 22px; height: 22px; }
.card h3 { font-family: var(--sans); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.card p { margin-top: 8px; color: var(--muted); font-size: 15px; }

.band { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; margin-top: 36px; }

@media (max-width:760px) {
    .steps { grid-template-columns: 1fr; }
}

.step .n { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--brand-ink); border: 1px solid var(--line); background: var(--surface); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow); }
.step h3 { font-family: var(--sans); font-size: 18px; font-weight: 700; margin-top: 14px; }
.step p { margin-top: 6px; color: var(--muted); font-size: 15px; }

/* ---------- CTA ---------- */
.cta { position: relative; overflow: hidden; border-radius: 24px; margin: 0 0 8px; padding: 52px 40px; color: #fff; background: var(--grad); box-shadow: var(--shadow); }
.cta h2 { font-size: clamp(28px,4vw,42px); color: #fff; }
.cta p { margin-top: 12px; color: rgba(255,255,255,.9); font-size: 18px; max-width: 46ch; }
.cta .badges { margin-top: 26px; }
.cta .store { background: rgba(0,0,0,.28); border-color: rgba(255,255,255,.2); }

/* ---------- Footer ---------- */
footer.site { padding: 52px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.fgrid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
footer .brand { font-size: 19px; }
.flinks { display: flex; gap: 26px; flex-wrap: wrap; }
.flinks a { text-decoration: none; color: var(--ink-soft); font-weight: 600; }
.flinks a:hover { color: var(--brand-ink); }
.fnote { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease,transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion:reduce) {
    .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Legal pages (privacy policy, terms). Narrower measure for long-form reading.
   ========================================================================== */

body.bk.legal { line-height: 1.7; }

/* Narrow measure for the reading column only. Scoping this to `.wrap` globally
   also shrank the header and footer to 760px, so the whole site chrome looked
   like a phone layout on a desktop screen. */
body.bk.legal main .wrap,
body.bk.legal .hero .wrap { max-width: 760px; }
body.bk.legal a { color: var(--brand-ink); }
body.bk.legal .hero { padding: 56px 0 26px; overflow: visible; }
body.bk.legal h1 { font-size: clamp(32px,5vw,46px); line-height: 1.1; margin: 12px 0 0; }
body.bk.legal .updated { margin-top: 14px; color: var(--muted); font-size: 14px; font-weight: 600; }
body.bk.legal .note { margin: 22px 0 0; padding: 16px 18px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; color: var(--ink-soft); font-size: 14.5px; }

body.bk.legal .toc { margin: 26px 0 8px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
body.bk.legal .toc b { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
body.bk.legal .toc ol { margin: 10px 0 0; padding-left: 20px; columns: 2; gap: 24px; }

@media (max-width:560px) {
    body.bk.legal .toc ol { columns: 1; }
}

body.bk.legal .toc a { text-decoration: none; font-weight: 600; font-size: 14.5px; }
body.bk.legal .toc a:hover { text-decoration: underline; }

body.bk.legal main { padding: 12px 0 40px; }
body.bk.legal section { padding: 26px 0; border-top: 1px solid var(--line); }
body.bk.legal h2 { font-family: var(--sans); font-weight: 700; font-size: 22px; letter-spacing: -.01em; margin: 0 0 10px; scroll-margin-top: 78px; }
body.bk.legal h3 { font-family: var(--sans); font-weight: 700; font-size: 16px; margin: 18px 0 6px; }
body.bk.legal p { margin: 0 0 14px; color: var(--ink-soft); }
body.bk.legal ul { margin: 0 0 14px; padding-left: 22px; color: var(--ink-soft); }
body.bk.legal li { margin: 6px 0; }
body.bk.legal strong { color: var(--ink); }
body.bk.legal footer.site { padding: 36px 0; }
