/* MangaPulse — le site public, distinct de la coquille de chat.

   Les pages catalogue, accueil, recherche et « après l'anime » défilent comme un document.
   L'assistant (`body.chat-page`) ignore ce fichier : il garde le panneau et le composeur. */

body.site-page {
    overflow: auto;
    height: auto;
    min-height: 100%;
}
body.site-page .app,
body.site-page.discover-page .app {
    display: block;
    height: auto;
    min-height: calc(100vh - 4.2rem);
    overflow: visible;
}
body.site-page .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(var(--sidebar-w), 86vw);
    height: 100%;
    box-shadow: 24px 0 60px -30px var(--shadow);
}
body.site-page .app:not(.mobile-open) .sidebar {
    margin-left: calc(-1 * min(var(--sidebar-w), 86vw));
}
body.site-page .app.mobile-open .backdrop {
    opacity: 1;
    pointer-events: auto;
}
body.site-page .topbar,
body.site-page .legal-topbar { display: none; }
body.site-page .chat.discover,
body.site-page .chat.home,
body.site-page .legal-shell,
body.site-page .day {
    display: block;
    height: auto;
    max-height: none;
    overflow: visible;
    min-height: 0;
}
body.site-page .scroll,
body.site-page .discover-scroll {
    overflow: visible;
    height: auto;
    max-height: none;
    min-height: 0;
}
body.site-page .home-article,
body.site-page .discover-article,
body.site-page .library-article {
    width: min(1120px, 100%);
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.4rem 1.4rem 4.5rem;
}

/* ------------------------------------------------------------------ barre de site */

.site-bar {
    display: none;
}
body.site-page .site-bar {
    display: flex;
    align-items: center;
    gap: .85rem;
    position: sticky;
    top: 0;
    z-index: 15;
    padding: .7rem 1.15rem;
    padding-left: max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-soft);
}
.site-bar .brand { margin-right: .4rem; }
.site-nav {
    display: flex;
    gap: .15rem;
    flex: 1 1 auto;
    min-width: 0;
}
.site-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: .86rem;
    font-weight: 600;
    padding: .4rem .7rem;
    border-radius: 999px;
    white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.is-on { color: var(--text); background: var(--surface-2); }
.site-search {
    display: flex;
    position: relative;
    flex: 0 1 16rem;
    min-width: 0;
}
.site-search input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: .45rem .85rem;
    font: inherit;
    font-size: .86rem;
}
.site-search input::placeholder { color: var(--faint); }
.site-account {
    color: var(--text);
    text-decoration: none;
    font-size: .84rem;
    font-weight: 650;
    padding: .4rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
}
.site-account:hover { border-color: var(--accent); }
.site-account.is-signup {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}
.site-account.is-signup:hover { filter: brightness(1.08); border-color: transparent; }
.site-account.is-quiet {
    border-color: transparent;
    background: transparent;
    font-weight: 500;
    color: var(--muted);
    padding-left: .35rem;
    padding-right: .2rem;
}
.site-account.is-quiet:hover { color: var(--text); border-color: transparent; }
.account-menu { position: relative; flex: 0 0 auto; }
.account-label {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.account-menu > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    cursor: pointer;
    user-select: none;
}
.account-menu > summary::-webkit-details-marker,
.account-menu > summary::marker { display: none; }
.account-initial {
    width: 1.5rem;
    height: 1.5rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.account-menu[open] > summary { border-color: var(--accent); }
.account-menu > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + .4rem);
    min-width: 12.8rem;
    padding: .35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 18px 40px -18px var(--shadow);
    z-index: 30;
    display: grid;
}
.account-menu-panel a,
.account-menu-panel button {
    display: block;
    width: 100%;
    text-align: left;
    padding: .55rem .7rem;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: .86rem;
    font-weight: 550;
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
}
.account-menu-panel a:hover,
.account-menu-panel button:hover { background: var(--surface-2); }
.account-menu-panel form {
    margin: .2rem 0 0;
    padding-top: .2rem;
    border-top: 1px solid var(--border-soft);
}
.account-menu-panel form button { color: var(--muted); }
.account-menu-panel form button:hover { color: var(--text); }
.site-foot .foot-signout { margin: 0; }
.site-foot .foot-signout button {
    display: block;
    width: 100%;
    padding: .18rem 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: .86rem;
    text-align: left;
    cursor: pointer;
}
.site-foot .foot-signout button:hover { color: var(--text); }
.site-menu { display: none; }

/* --------------------------------------------------------------------- pied */

.site-foot {
    display: none;
}
body.site-page .site-foot {
    display: block;
    border-top: 1px solid var(--border-soft);
    background: var(--sidebar);
    padding: 2rem 1.4rem calc(2.4rem + env(safe-area-inset-bottom));
}
.site-foot-inner {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: 1.4rem 1.8rem;
}
.site-foot strong { display: block; margin-bottom: .55rem; font-size: .92rem; }
.site-foot a {
    display: block;
    color: var(--muted);
    text-decoration: none;
    font-size: .86rem;
    padding: .18rem 0;
}
.site-foot a:hover { color: var(--text); }
.site-foot p { color: var(--faint); font-size: .84rem; line-height: 1.5; margin: .35rem 0 0; max-width: 28ch; }
.site-foot .brand-name { font-family: var(--display); font-size: 1.15rem; }

/* --------------------------------------------------------------- typo site */

body.site-page h1,
body.site-page h2,
body.site-page .spot-copy h1 {
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: -.02em;
}

/* ---------------------------------------------------------- affiches / rails */

.poster {
    display: block;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    background:
        linear-gradient(165deg, color-mix(in srgb, var(--accent) 12%, var(--surface-2)), var(--surface));
    overflow: hidden;
    box-shadow: 0 22px 40px -28px var(--shadow);
}
.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
body.site-page .rail-track {
    grid-auto-columns: 9.4rem;
    gap: .85rem;
}
body.site-page .rail-card {
    padding: 0;
    min-height: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    width: 9.4rem;
}
body.site-page .rail-card:hover { background: transparent; }
body.site-page .rail-card:hover .poster { transform: translateY(-3px); }
body.site-page .poster { transition: transform .18s ease; }
body.site-page .rail-card strong {
    font-size: .82rem;
    margin-top: .45rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
body.site-page .rail-cover { border-radius: 0; box-shadow: none; }

body.site-page .lib-card .poster { margin-bottom: .45rem; }
body.site-page .lib-card-cover { border-radius: 0; }

/* ---------------------------------------------------------------- à la une */

.spot {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: 1.4rem 1.8rem;
    align-items: center;
    margin: .4rem 0 1.6rem;
    padding: 1.2rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
    background:
        radial-gradient(90% 80% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
        radial-gradient(70% 70% at 0% 100%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%),
        var(--surface);
}
.spot-copy h1 {
    font-size: clamp(1.85rem, 4vw, 2.7rem);
    line-height: 1.08;
    margin: .15rem 0 .55rem;
}
.spot-meta { color: var(--muted); margin: 0 0 .4rem; font-size: .95rem; }
.spot-tags { color: var(--faint); margin: 0; font-size: .88rem; max-width: 46ch; }

.home-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .7rem;
    list-style: none;
    margin: 0 0 1.6rem;
    padding: 0;
}
.home-stats li {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: .85rem .95rem;
}
.home-stats strong {
    display: block;
    font-family: var(--display);
    font-size: 1.55rem;
    line-height: 1.1;
    margin-bottom: .15rem;
}
.home-stats span { color: var(--faint); font-size: .8rem; }

.home-join {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.4rem;
    margin: 0 0 1.6rem;
    padding: 1.15rem 1.2rem 1.2rem;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border-soft));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.home-join h2 {
    margin: .2rem 0 .4rem;
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
}
.home-join p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.45; max-width: 36rem; }
.home-join .home-cta { margin-top: 0; }

.home-dest {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .7rem;
    margin: 0 0 1.8rem;
}
.home-dest a {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .95rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    min-height: 6.4rem;
}
.home-dest a:hover { border-color: var(--accent); }
.home-dest strong { font-family: var(--display); font-size: 1.12rem; }
.home-dest span { color: var(--faint); font-size: .82rem; line-height: 1.35; }

body.site-page .home-search {
    display: flex;
    gap: .55rem;
    margin: 1.1rem 0 0;
    max-width: 40rem;
}
body.site-page .home-hero h1 {
    font-size: clamp(2rem, 5vw, 3.1rem);
    max-width: 16ch;
}

.home-ai, .home-community {
    padding: 1.2rem 1.25rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.bridge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .8rem;
    margin: 1rem 0 0;
}
.bridge-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: .75rem;
    padding: .7rem;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}
.bridge-card:hover { border-color: var(--border); }
.bridge-card .poster { width: 72px; border-radius: 8px; box-shadow: none; }
.bridge-card strong { display: block; font-size: .95rem; margin-bottom: .2rem; }
.bridge-card span { color: var(--faint); font-size: .8rem; line-height: 1.35; }

body.site-page .lib-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: .9rem 1rem;
}
body.site-page .lib-card {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    gap: .4rem;
}
body.site-page .lib-card:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}
body.site-page .lib-card:hover .poster { transform: translateY(-3px); }
body.site-page .lib-card-tags { display: none; }
body.site-page .lib-az {
    margin-top: 2rem;
    opacity: .92;
}

.shelf-row:has(.shelf-poster) {
    grid-template-columns: 48px 1fr auto auto auto;
    column-gap: .7rem;
}
.shelf-poster {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 48px;
    box-shadow: none;
    border-radius: 6px;
}
.shelf-row:has(.shelf-poster) .shelf-title { grid-column: 2; }
.shelf-row:has(.shelf-poster) .shelf-meta { grid-column: 2; }
.shelf-row:has(.shelf-poster) .shelf-star { grid-column: 3; }
.shelf-row:has(.shelf-poster) .shelf-pick { grid-column: 4; }
.shelf-row:has(.shelf-poster) .shelf-forget { grid-column: 5; }

.onboard-chip { padding: 0 0 .75rem; overflow: hidden; }
.onboard-chip .poster { border-radius: 12px 12px 0 0; box-shadow: none; }
.onboard-chip > span:last-of-type { display: block; padding: .65rem .75rem 0; }

.search-poster {
    width: 48px;
    flex: 0 0 48px;
    box-shadow: none;
    border-radius: 6px;
}

body.site-page .access {
    max-width: 28rem;
    margin: 2.2rem auto 4rem;
}
body.site-page .access h1 { font-family: var(--display); }

@media (max-width: 900px) {
    .home-dest { grid-template-columns: repeat(2, 1fr); }
    .site-foot-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
    .site-nav { display: none; }
    .site-search { flex-basis: 1; max-width: 12rem; }
    .site-account.is-quiet { display: none; }
    .site-menu { display: block; }
    .spot { grid-template-columns: 120px 1fr; padding: 1rem; }
    .home-stats { grid-template-columns: 1fr; }
    body.site-page .home-article,
    body.site-page .discover-article { padding-bottom: 6rem; }
    body.site-page .site-foot {
        padding-bottom: calc(5.4rem + env(safe-area-inset-bottom));
    }
}
@media (max-width: 560px) {
    .site-search { display: flex; flex: 1 1 8rem; max-width: none; }
    .site-account.is-signup,
    .site-account.is-quiet { display: none; }
    .account-menu { display: block; }
    .account-menu .account-label { display: none; }
    .site-account.is-member {
        padding: .28rem;
        width: 2.15rem;
        height: 2.15rem;
        justify-content: center;
    }
    .site-foot-inner { grid-template-columns: 1fr; }
    .home-dest { grid-template-columns: 1fr; }
    .spot { grid-template-columns: 1fr; }
    .spot .poster { width: 140px; }
}
