/* papapahub — Neon-night identity
   Custom layer on top of Bootstrap. Loaded after bootstrap.min.css.
   Direction: warm near-black surfaces, a single confident rose accent,
   gold reserved for quality badges. */

:root {
    --pp-bg: #0e0a10;          /* warm near-black, faint magenta tint */
    --pp-surface: #181219;     /* nav, cards */
    --pp-surface-2: #221a24;   /* raised / hover surface */
    --pp-border: #2e2430;
    --pp-text: #f4eef1;
    --pp-muted: #9c8f96;
    --pp-brand: #ff2d6b;       /* hot rose — brand + interactive */
    --pp-brand-600: #e01f58;   /* pressed / darker */
    --pp-brand-soft: rgba(255, 45, 107, .14);
    --pp-gold: #ffc24b;        /* quality badges only */

    --pp-radius: 14px;
    --pp-radius-sm: 9px;
    --pp-shadow: 0 6px 22px rgba(0, 0, 0, .45);
    --pp-shadow-hover: 0 12px 30px rgba(0, 0, 0, .55), 0 0 0 1px var(--pp-brand);

    /* hand Bootstrap our tokens so its dark theme follows along */
    --bs-body-bg: var(--pp-bg);
    --bs-body-color: var(--pp-text);
    --bs-border-color: var(--pp-border);
}

/* ---------- Typography ---------- */
body {
    background: var(--pp-bg);
    color: var(--pp-text);
    font-family: "Plus Jakarta Sans", system-ui, "PingFang SC",
        "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: .1px;
}

h1, h2, h3, h4, h5, h6, .brand {
    font-family: "Sora", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    letter-spacing: -.01em;
}

h1 {
    font-weight: 800;
    font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem);
    line-height: 1.15;
}

/* ---------- Brand wordmark ---------- */
.brand {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -.02em;
    color: var(--pp-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .12em;
    white-space: nowrap;
}
.brand:hover { color: var(--pp-text); }
.brand .brand-hub { color: var(--pp-brand); }

/* ---------- Nav ---------- */
.navbar {
    background: linear-gradient(180deg, var(--pp-surface), var(--pp-bg)) !important;
    border-bottom: 1px solid var(--pp-border);
    backdrop-filter: blur(6px);
}
.navbar .nav-link {
    color: var(--pp-muted);
    font-weight: 500;
    font-size: .92rem;
    padding-inline: .6rem;
    border-radius: var(--pp-radius-sm);
    transition: color .15s ease, background .15s ease;
}
.navbar .nav-link:hover { color: var(--pp-text); }
.navbar .nav-link.active {
    color: var(--pp-text);
    background: var(--pp-brand-soft);
    box-shadow: inset 0 -2px 0 var(--pp-brand);
}

/* ---------- Header: top bar + sticky category bar (PC) ---------- */
.site-header { position: relative; z-index: 1030; }

.topbar {
    position: relative;
    z-index: 1031;        /* keep its open dropdown above the sticky catbar */
    background: linear-gradient(180deg, var(--pp-surface), var(--pp-bg));
    border-bottom: 1px solid var(--pp-border);
    padding: .55rem 0;
}

/* PC search: centered via auto inline margins, width tracks the viewport (50%)
   but is capped at 640px. min-width:0 lets it shrink on tight widths. Scoped to
   the flex top row so the mobile search (separate, non-flex row) stays full width. */
.topbar .d-flex .search-form {
    flex: 0 1 auto;
    width: 50%;
    max-width: 640px;
    min-width: 0;
    margin-inline: auto;
}
.search-form .btn-danger { display: inline-flex; align-items: center; }

/* Logged-in email label: quiet, compact, so it (and the sign-out button next to
   it) don't visually outweigh the rest of the bar. */
.topbar .navbar-text {
    font-size: .78rem;
    padding-block: 0;
    color: var(--pp-muted);
}

/* category strip — pinned to top on scroll, scrolls sideways when it overflows */
.catbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--pp-bg);
    border-bottom: 1px solid var(--pp-border);
}
.catbar-scroll {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-top: .3rem;
    padding-bottom: .3rem;
    -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
            mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.catbar-scroll::-webkit-scrollbar { display: none; }

.cat-link {
    flex: 0 0 auto;
    padding: .4rem .85rem;
    border-radius: 999px;
    color: var(--pp-muted);
    font-weight: 500;
    font-size: .9rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease, background .15s ease;
}
.cat-link:hover { color: var(--pp-text); background: var(--pp-surface-2); }
.cat-link.active {
    color: #fff;
    background: var(--pp-brand-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pp-brand) 50%, transparent);
}

/* ---------- Mobile: hamburger + offcanvas drawer ---------- */
.hamburger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 0 9px;
    background: var(--pp-surface-2);
    border: 1px solid var(--pp-border);
    border-radius: 10px;
    cursor: pointer;
}
.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--pp-text);
    border-radius: 2px;
}
.drawer {
    background: var(--pp-surface);
    color: var(--pp-text);
    border-right: 1px solid var(--pp-border);
    width: 290px;
    max-width: 80vw;
}
.drawer .offcanvas-header { border-bottom: 1px solid var(--pp-border); }
.drawer-link {
    display: block;
    padding: .7rem .9rem;
    margin-bottom: .15rem;
    border-radius: 10px;
    color: var(--pp-muted);
    text-decoration: none;
    font-weight: 500;
}
.drawer-link:hover { color: var(--pp-text); background: var(--pp-surface-2); }
.drawer-link.active {
    color: #fff;
    background: var(--pp-brand-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pp-brand) 50%, transparent);
}

/* Top bar language / sign-in / sign-up buttons: keep them compact so they don't
   dominate the bar. Scoped to the first row's direct buttons + the language
   dropdown button, so the full-width search button is never touched. */
.topbar .d-flex > .btn,
.topbar .d-flex > .dropdown > .btn {
    --bs-btn-padding-y: .24rem;
    --bs-btn-padding-x: .55rem;
    --bs-btn-font-size: .75rem;
    white-space: nowrap;        /* never let "注册" wrap to two lines */
}
/* only the search box flexes; the buttons keep their size when space is tight */
.topbar .d-flex > .btn,
.topbar .d-flex > .dropdown { flex-shrink: 0; }
@media (max-width: 575px) {
    .topbar .brand { font-size: 1.1rem; }
    .topbar .d-flex > .btn,
    .topbar .d-flex > .dropdown > .btn {
        --bs-btn-padding-y: .16rem;
        --bs-btn-padding-x: .42rem;
        --bs-btn-font-size: .68rem;
    }
}

/* ---------- Buttons: rose is the one loud color ---------- */
.btn-danger {
    --bs-btn-bg: var(--pp-brand);
    --bs-btn-border-color: var(--pp-brand);
    --bs-btn-hover-bg: var(--pp-brand-600);
    --bs-btn-hover-border-color: var(--pp-brand-600);
    --bs-btn-active-bg: var(--pp-brand-600);
    font-weight: 600;
}
.btn-outline-danger {
    --bs-btn-color: var(--pp-brand);
    --bs-btn-border-color: color-mix(in srgb, var(--pp-brand) 55%, transparent);
    --bs-btn-hover-bg: var(--pp-brand);
    --bs-btn-hover-border-color: var(--pp-brand);
    --bs-btn-hover-color: #fff;
    font-weight: 500;
}
/* language / utility button — keep it quiet, not bright cyan */
.btn-info {
    --bs-btn-bg: var(--pp-surface-2);
    --bs-btn-border-color: var(--pp-border);
    --bs-btn-color: var(--pp-text);
    --bs-btn-hover-bg: var(--pp-border);
    --bs-btn-hover-border-color: var(--pp-border);
    --bs-btn-hover-color: var(--pp-text);
}

.form-control {
    background: var(--pp-surface-2);
    border-color: var(--pp-border);
    color: var(--pp-text);
}
.form-control:focus {
    background: var(--pp-surface-2);
    color: var(--pp-text);
    border-color: var(--pp-brand);
    box-shadow: 0 0 0 .2rem var(--pp-brand-soft);
}

/* ---------- Video grid (replaces fixed col-3) ---------- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: clamp(.6rem, .4rem + .6vw, 1.1rem);
    margin: .75rem 0 1.25rem;
    width: 100%;
}
/* Desktop: larger, fewer cards per row (mobile keeps ~2 cols via the base rule).
   Tune the min width to change density: ~420px≈4/row, ~320px≈5/row, ~270px≈6/row. */
@media (min-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}
.video-grid > * {           /* neutralize Bootstrap col-* sizing */
    width: auto;
    max-width: none;
    flex: none;
    margin: 0;
    padding: 0;
}

.video-grid a { display: block; color: inherit; }

/* thumbnail frame: fixed 16:9 so the grid never reflows (no CLS) */
.video-grid .position-relative {
    aspect-ratio: 16 / 9;
    border-radius: var(--pp-radius);
    overflow: hidden;
    background: var(--pp-surface-2);
    box-shadow: var(--pp-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.video-grid .position-relative > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease, filter .25s ease;
}

/* dim + play affordance on hover */
.video-grid .position-relative::after {
    content: "►";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    padding-left: .15rem;
    border-radius: 50%;
    background: var(--pp-brand);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    opacity: 0;
    transform: scale(.6);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}
.video-grid a:hover .position-relative {
    transform: translateY(-4px);
    box-shadow: var(--pp-shadow-hover);
}
.video-grid a:hover .position-relative > img {
    transform: scale(1.06);
    filter: brightness(.62);
}
.video-grid a:hover .position-relative::after { opacity: 1; transform: scale(1); }

/* hub.papapahub.com is a catalogue (no playback): drop the play affordance and
   the hover dim, keep only the lift + zoom so cards still feel interactive. */
.site-hub .video-grid .position-relative::after { content: none; }
.site-hub .video-grid a:hover .position-relative > img { filter: none; }

/* badges: gold = quality, rose = views, keep them crisp over the thumb */
.video-grid .position-relative .bg-warning { background: var(--pp-gold) !important; }
.video-grid .position-relative [class*="bg-"] { font-weight: 600; }

/* title: allow two lines instead of a hard single-line truncate */
.video-grid .text-truncate {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.6em;
    margin-top: .5rem;
    font-size: .85rem;
    color: var(--pp-text);
}
.video-grid a:hover .text-truncate { color: var(--pp-brand); }
.video-grid .text-truncate + .text-center,
.video-grid .text-center small { color: var(--pp-muted); }

/* ---------- Star grid (portrait avatars) ---------- */
.star-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: clamp(.6rem, .4rem + .6vw, 1rem);
    margin: .75rem 0 1.25rem;
}
.star-grid > * { width: auto; max-width: none; flex: none; margin: 0; padding: 0; }
.star-grid img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--pp-radius);
    box-shadow: var(--pp-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.star-grid a:hover img {
    transform: translateY(-4px);
    box-shadow: var(--pp-shadow-hover);
}
.star-grid .text-truncate { margin-top: .4rem; font-weight: 600; }

/* ---------- Detail page: poster / player ---------- */
/* Cap the media so a wide cover or the player doesn't dominate the page. */
.detail-media .carousel { max-width: 900px; margin-inline: auto; }
.detail-media img {
    max-width: min(900px, 100%);
    max-height: 78vh;
    width: auto;
    height: auto;
    margin-inline: auto;
    border-radius: var(--pp-radius);
}
.detail-media video {
    max-width: 900px;
    max-height: 78vh;
    width: 100%;
    display: block;
    margin-inline: auto;
}

/* Custom centered play button over the poster (mirrors the list-card affordance);
   the script toggles it on play/pause. Hide the browser's own overlay button so
   they don't stack. The native control bar (scrub/volume) is left in place. */
.detail-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 4.5rem;
    height: 4.5rem;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--pp-brand);
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
    cursor: pointer;
    z-index: 2;
    transition: transform .15s ease, background .15s ease;
}
.detail-play:hover { background: var(--pp-brand-600); transform: scale(1.06); }
video::-webkit-media-controls-overlay-play-button { display: none; }

/* ---------- Detail page: metadata + chips ---------- */
.meta { margin: 1.1rem 0 .5rem; }
.meta-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: .35rem 1rem;
    align-items: start;
    padding: .65rem 0;
    border-top: 1px solid var(--pp-border);
}
.meta-row:last-child { border-bottom: 1px solid var(--pp-border); }
.meta dt {
    color: var(--pp-muted);
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding-top: .35rem;
}
.meta dd {
    margin: 0;
    color: var(--pp-text);
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    min-height: 1.9rem;
}
.meta-id { font-family: "Sora", ui-monospace, monospace; letter-spacing: .04em; }
@media (max-width: 575px) {
    .meta-row { grid-template-columns: 1fr; gap: .2rem; padding: .55rem 0; }
    .meta dt { padding-top: 0; }
}

/* taxonomy chips — one loud (actress), one quiet (tags), one accent (source) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .34rem .72rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease,
        color .15s ease, transform .12s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip-actress {
    background: var(--pp-brand-soft);
    color: #ffb3cb;
    border-color: color-mix(in srgb, var(--pp-brand) 40%, transparent);
}
.chip-actress::before { content: "\2640"; opacity: .65; }
.chip-actress:hover { background: var(--pp-brand); color: #fff; border-color: var(--pp-brand); }
.chip-tag {
    background: var(--pp-surface-2);
    color: var(--pp-muted);
    border-color: var(--pp-border);
}
.chip-tag:hover { color: var(--pp-text); border-color: var(--pp-brand); }
.chip-source {
    background: transparent;
    color: var(--pp-brand);
    border-color: color-mix(in srgb, var(--pp-brand) 55%, transparent);
}
.chip-source:hover { background: var(--pp-brand-soft); }

/* ---------- Search results: grouped sections ---------- */
.search-section-title {
    font-family: "Sora", system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.4rem 0 .25rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--pp-border);
}
.search-section-title span { font-weight: 500; font-size: .9rem; }

/* chip groups used on mobile detail (no meta table) */
.chip-group { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; width: 100%; }

/* ---------- Auth pages (sign in / sign up / verify) ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem 1.75rem 1.75rem;
    background: var(--pp-surface);
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius);
    box-shadow: var(--pp-shadow);
    text-align: center;
}
.auth-card .brand { font-size: 1.5rem; margin-bottom: 1.5rem; }
.auth-card h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}
.auth-card .form-floating { text-align: left; }
.auth-card .btn-danger {
    --bs-btn-padding-y: .6rem;
    --bs-btn-font-size: 1rem;
    font-weight: 600;
}
.auth-link { color: var(--pp-brand); text-decoration: none; font-weight: 600; }
.auth-link:hover { color: var(--pp-brand-600); }
.auth-home { color: var(--pp-muted); text-decoration: none; font-size: .85rem; }
.auth-home:hover { color: var(--pp-text); }

footer { border-color: var(--pp-border) !important; color: var(--pp-muted); }

/* ---------- Accessibility / motion ---------- */
a:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--pp-brand);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .video-grid .position-relative,
    .video-grid .position-relative > img,
    .video-grid .position-relative::after,
    .star-grid img { transition: none; }
    .video-grid a:hover .position-relative > img { transform: none; }
}
