/**
 * Palavi Library - Public Site Stylesheet
 * ------------------------------------------------------------------
 * Loaded ONLY by the public pages (books.php, about.php, contact.php,
 * portfolio.php) via includes/public/header.php. Every rule is scoped
 * to a palavi-home-* class or to body.palavi-home, so nothing here can
 * leak into admin/ or user/ (which never load this file anyway).
 *
 * Builds on glass.css's brand tokens (--brand-primary etc.) and adds a
 * --ph-* layer for this site's surfaces/typography, redefined for
 * [data-theme="dark"] (set by assets/js/common/theme-switcher.js).
 */

/* =========================================================
   Tokens
   ========================================================= */
.palavi-home {
    --ph-navy: #0F3570;
    --ph-blue: #1E5AA8;
    --ph-blue-hover: #174A8E;
    --ph-sky: #6FC3E8;
    --ph-teal: #0E9F9A;
    --ph-teal-soft: #E3F6F5;
    --ph-amber: #F59E0B;

    --ph-bg: #FFFFFF;
    --ph-bg-alt: #F3F7FC;
    --ph-surface: #FFFFFF;
    --ph-surface-2: #F7FAFD;
    --ph-text: #0E1C33;
    --ph-text-2: #3E4E69;
    --ph-muted: #66768F;
    --ph-border: #E1E8F1;
    --ph-border-strong: #C9D6E6;
    --ph-chip: #EAF2FC;
    --ph-focus: #2F7BE0;

    --ph-radius-sm: 10px;
    --ph-radius: 16px;
    --ph-radius-lg: 24px;
    --ph-shadow-sm: 0 1px 2px rgba(15, 40, 80, 0.06), 0 2px 8px rgba(15, 40, 80, 0.05);
    --ph-shadow: 0 6px 20px rgba(15, 40, 80, 0.08);
    --ph-shadow-lg: 0 18px 44px rgba(15, 40, 80, 0.14);
    --ph-ease: cubic-bezier(0.22, 1, 0.36, 1);

    --ph-font: 'Plus Jakarta Sans', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .palavi-home {
    --ph-bg: #0B1322;
    --ph-bg-alt: #0F1A2D;
    --ph-surface: #14213A;
    --ph-surface-2: #182844;
    --ph-text: #EAF1FB;
    --ph-text-2: #B7C4D9;
    --ph-muted: #8C9BB4;
    --ph-border: #22324F;
    --ph-border-strong: #2E4366;
    --ph-chip: #1B2E4F;
    --ph-teal-soft: #113736;
    --ph-blue: #3B7FD6;
    --ph-blue-hover: #4E8EE0;
    --ph-focus: #7DB4FF;
    --ph-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --ph-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    --ph-shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.45);
}

/* =========================================================
   Base
   ========================================================= */
html:has(body.palavi-home) {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
}

body.palavi-home {
    margin: 0;
    background: var(--ph-bg);
    color: var(--ph-text);
    font-family: var(--ph-font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.palavi-home h1,
body.palavi-home h2,
body.palavi-home h3 {
    color: var(--ph-text);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

body.palavi-home a {
    color: var(--ph-blue);
}

body.palavi-home :focus-visible {
    outline: 3px solid var(--ph-focus);
    outline-offset: 2px;
    border-radius: 6px;
}

body.palavi-home img {
    max-width: 100%;
}

body.palavi-home [hidden] {
    display: none !important;
}

body.palavi-home.palavi-home-menu-open {
    overflow: hidden;
}

.palavi-home-container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.palavi-home-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 2000;
    padding: 10px 16px;
    background: var(--ph-navy);
    color: #fff !important;
    border-radius: 10px;
    font-weight: 600;
}

.palavi-home-skip:focus {
    top: 12px;
}

.palavi-home-muted {
    color: var(--ph-muted);
    font-size: 0.92rem;
}

.palavi-home-center {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

/* =========================================================
   Buttons
   ========================================================= */
.palavi-home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.18s var(--ph-ease), border-color 0.18s, color 0.18s, transform 0.18s var(--ph-ease), box-shadow 0.18s;
}

.palavi-home-btn:hover {
    transform: translateY(-1px);
}

.palavi-home-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.palavi-home-btn-sm {
    padding: 7px 13px;
    font-size: 0.85rem;
    border-radius: 10px;
}

.palavi-home-btn-lg {
    padding: 14px 26px;
    font-size: 1rem;
    border-radius: 14px;
}

body.palavi-home .palavi-home-btn-primary {
    background: var(--ph-blue);
    color: #fff;
    box-shadow: 0 6px 16px rgba(30, 90, 168, 0.22);
}

body.palavi-home .palavi-home-btn-primary:hover {
    background: var(--ph-blue-hover);
    color: #fff;
}

body.palavi-home .palavi-home-btn-outline {
    background: transparent;
    border-color: var(--ph-blue);
    color: var(--ph-blue);
}

body.palavi-home .palavi-home-btn-outline:hover {
    background: var(--ph-chip);
}

body.palavi-home .palavi-home-btn-ghost {
    background: var(--ph-surface);
    border-color: var(--ph-border-strong);
    color: var(--ph-text);
}

body.palavi-home .palavi-home-btn-ghost:hover {
    border-color: var(--ph-blue);
    color: var(--ph-blue);
}

body.palavi-home .palavi-home-btn-light {
    background: #fff;
    color: var(--ph-navy);
}

body.palavi-home .palavi-home-btn-light:hover {
    background: #EAF2FC;
    color: var(--ph-navy);
}

body.palavi-home .palavi-home-btn-outline-light {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

body.palavi-home .palavi-home-btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

body.palavi-home .palavi-home-btn-play {
    background: #111827;
    color: #fff;
}

body.palavi-home .palavi-home-btn-play:hover {
    background: #000;
    color: #fff;
}

.palavi-home-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
    border-radius: 12px;
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    color: var(--ph-text) !important;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s, background-color 0.18s;
}

.palavi-home-icon-btn:hover {
    border-color: var(--ph-blue);
}

.palavi-home-lang-btn {
    font-size: 0.85rem;
}

.palavi-home-lang-btn i {
    font-size: 1rem;
}

.palavi-home-link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
}

.palavi-home-link-arrow i {
    transition: transform 0.18s var(--ph-ease);
}

.palavi-home-link-arrow:hover i {
    transform: translateX(3px);
}

.palavi-home-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--ph-teal-soft);
    color: var(--ph-teal);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.palavi-home-eyebrow.is-light {
    background: rgba(255, 255, 255, 0.14);
    color: #CFEFFF;
}

/* =========================================================
   Header
   ========================================================= */
/* The blur lives on ::before, not the header itself: backdrop-filter on
   the header would make it the containing block for the position:fixed
   mobile menu panel, collapsing that panel to the header's own height. */
.palavi-home-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    border-bottom: 1px solid var(--ph-border);
    transition: box-shadow 0.2s;
}

.palavi-home-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: color-mix(in srgb, var(--ph-surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.palavi-home-header.is-scrolled {
    box-shadow: var(--ph-shadow);
}

.palavi-home-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 76px;
}

.palavi-home-logo {
    flex-shrink: 0;
    display: inline-flex;
    padding: 3px 6px;
    border-radius: 12px;
    background: #fff;
}

.palavi-home-logo img {
    height: 52px;
    width: auto;
    display: block;
}

.palavi-home-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.palavi-home-nav-list {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.palavi-home .palavi-home-nav-link {
    display: block;
    padding: 9px 13px;
    border-radius: 10px;
    color: var(--ph-text-2);
    font-weight: 600;
    font-size: 0.94rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, background-color 0.15s;
}

body.palavi-home .palavi-home-nav-link:hover {
    color: var(--ph-blue);
    background: var(--ph-chip);
}

body.palavi-home .palavi-home-nav-link.is-active {
    color: var(--ph-blue);
    background: var(--ph-chip);
}

.palavi-home-nav-mobile-actions {
    display: none;
}

.palavi-home-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.palavi-home-header-account {
    display: flex;
    gap: 8px;
}

.palavi-home-menu-btn {
    display: none;
}

.palavi-home-cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #E11D48;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

body.palavi-home .dropdown-menu {
    border: 1px solid var(--ph-border);
    border-radius: 12px;
    background: var(--ph-surface);
    box-shadow: var(--ph-shadow-lg);
    padding: 6px;
}

body.palavi-home .dropdown-item {
    border-radius: 8px;
    color: var(--ph-text);
    font-weight: 600;
    padding: 8px 12px;
}

body.palavi-home .dropdown-item:hover,
body.palavi-home .dropdown-item.active {
    background: var(--ph-chip);
    color: var(--ph-blue);
}

@media (max-width: 1199.98px) {
    .palavi-home-header-play {
        display: none;
    }
}

@media (max-width: 1099.98px) {
    .palavi-home-menu-btn {
        display: inline-flex;
    }

    .palavi-home-header-account {
        display: none;
    }

    .palavi-home-header-actions {
        margin-left: auto;
    }

    .palavi-home-nav {
        position: fixed;
        top: 77px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1029;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 16px;
        padding: 16px 20px 32px;
        background: var(--ph-surface);
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.2s, transform 0.2s var(--ph-ease), visibility 0.2s;
    }

    .palavi-home-nav.is-open {
        visibility: visible;
        opacity: 1;
        transform: none;
    }

    .palavi-home-nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    body.palavi-home .palavi-home-nav-link {
        padding: 14px 16px;
        font-size: 1.05rem;
        border: 1px solid var(--ph-border);
    }

    .palavi-home-nav-mobile-actions {
        display: grid;
        gap: 10px;
    }

    .palavi-home-nav-mobile-actions .palavi-home-btn {
        padding: 14px;
    }
}

@media (max-width: 575.98px) {
    .palavi-home-container {
        padding: 0 16px;
    }

    .palavi-home-header-inner {
        gap: 10px;
        min-height: 68px;
    }

    .palavi-home-nav {
        top: 69px;
    }

    .palavi-home-logo img {
        height: 44px;
    }

    .palavi-home-lang-btn .lang-selector-current {
        display: none;
    }

    .palavi-home-header-actions {
        gap: 6px;
    }
}

/* =========================================================
   Hero
   ========================================================= */
.palavi-home-hero {
    position: relative;
    overflow: hidden;
    padding: 56px 0 72px;
    background:
        radial-gradient(900px 420px at 85% -10%, rgba(111, 195, 232, 0.28), transparent 70%),
        radial-gradient(700px 380px at -10% 110%, rgba(14, 159, 154, 0.12), transparent 70%),
        linear-gradient(180deg, var(--ph-bg-alt) 0%, var(--ph-bg) 100%);
}

.palavi-home-hero-inner {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    gap: 56px;
}

.palavi-home-hero h1 {
    font-size: clamp(2.1rem, 4.1vw, 3.35rem);
    margin: 0 0 18px;
}

.palavi-home-hero-lead {
    font-size: 1.12rem;
    color: var(--ph-text-2);
    max-width: 560px;
    margin: 0 0 26px;
}

.palavi-home-hero-search {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 560px;
    margin-bottom: 22px;
    padding: 6px 6px 6px 18px;
    border-radius: 16px;
    background: var(--ph-surface);
    border: 1.5px solid var(--ph-border-strong);
    box-shadow: var(--ph-shadow);
    transition: border-color 0.18s;
}

.palavi-home-hero-search:focus-within {
    border-color: var(--ph-blue);
}

.palavi-home-hero-search > i {
    color: var(--ph-muted);
    font-size: 1.1rem;
}

.palavi-home-hero-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0 !important;
    background: transparent;
    padding: 10px 12px;
    font: inherit;
    font-size: 1rem;
    color: var(--ph-text);
}

.palavi-home-hero-search input::placeholder {
    color: var(--ph-muted);
}

.palavi-home-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    box-shadow: var(--ph-shadow-lg);
}

body.palavi-home .palavi-home-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--ph-text);
    text-decoration: none;
}

.palavi-home-suggest-item img,
.palavi-home-suggest-thumb {
    width: 36px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: cover;
    background: var(--ph-chip);
}

.palavi-home-suggest-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ph-blue);
}

.palavi-home-suggest-item strong {
    display: block;
    font-size: 0.94rem;
    line-height: 1.3;
}

.palavi-home-suggest-item small {
    color: var(--ph-muted);
}

.palavi-home-suggest-item:hover,
.palavi-home-suggest-item.is-active,
.palavi-home-suggest-all:hover,
.palavi-home-suggest-all.is-active {
    background: var(--ph-chip);
}

.palavi-home-suggest-all {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    border: 0;
    border-top: 1px solid var(--ph-border);
    border-radius: 0 0 10px 10px;
    background: transparent;
    color: var(--ph-blue);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.palavi-home-suggest-empty {
    margin: 0;
    padding: 12px;
    color: var(--ph-muted);
    font-size: 0.92rem;
}

.palavi-home-hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.palavi-home-hero-stats {
    display: flex;
    gap: 28px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
    color: var(--ph-muted);
    font-size: 0.92rem;
}

.palavi-home-hero-stats strong {
    display: block;
    color: var(--ph-text);
    font-size: 1.6rem;
    font-weight: 800;
}

.palavi-home-hero-media {
    position: relative;
}

.palavi-home-hero-frame {
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--ph-shadow-lg);
    aspect-ratio: 4 / 3;
    background: var(--ph-chip);
}

.palavi-home-hero-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 40% 60%;
    display: block;
}

.palavi-home-hero-note {
    position: absolute;
    left: -24px;
    bottom: -26px;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 360px;
    padding: 14px 18px;
    border-radius: 18px;
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    box-shadow: var(--ph-shadow-lg);
}

.palavi-home-hero-note > i {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--ph-blue);
    color: #fff;
    font-size: 1.25rem;
}

.palavi-home-hero-note strong {
    display: block;
    font-size: 0.98rem;
    line-height: 1.4;
}

.palavi-home-hero-note span {
    display: block;
    color: var(--ph-muted);
    font-size: 0.84rem;
    line-height: 1.4;
}

@media (max-width: 991.98px) {
    .palavi-home-hero {
        padding: 36px 0 64px;
    }

    .palavi-home-hero-inner {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .palavi-home-hero-note {
        left: 12px;
        right: 12px;
        bottom: -28px;
        max-width: none;
    }
}

@media (max-width: 575.98px) {
    .palavi-home-hero-lead {
        font-size: 1.02rem;
    }

    .palavi-home-hero-search {
        padding-left: 14px;
    }

    .palavi-home-hero-search .palavi-home-btn {
        padding: 10px 14px;
    }

    .palavi-home-hero-cta .palavi-home-btn {
        flex: 1 1 100%;
    }
}

/* =========================================================
   Sections
   ========================================================= */
.palavi-home-section {
    padding: 64px 0;
}

.palavi-home-section-tint {
    background: var(--ph-bg-alt);
}

.palavi-home-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.palavi-home-section-head h2 {
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    margin: 0 0 6px;
}

.palavi-home-section-head p {
    margin: 0;
    color: var(--ph-muted);
}

.palavi-home-section-head-center {
    justify-content: center;
    text-align: center;
}

@media (max-width: 767.98px) {
    .palavi-home-section {
        padding: 44px 0;
    }

    .palavi-home-section-head {
        margin-bottom: 20px;
    }
}

/* =========================================================
   Categories
   ========================================================= */
.palavi-home-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.palavi-home .palavi-home-cat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 16px;
    border-radius: var(--ph-radius);
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    color: var(--ph-text);
    text-decoration: none;
    box-shadow: var(--ph-shadow-sm);
    transition: transform 0.2s var(--ph-ease), border-color 0.2s, box-shadow 0.2s;
}

body.palavi-home .palavi-home-cat-card:hover {
    transform: translateY(-3px);
    border-color: var(--cat-color, var(--ph-blue));
    box-shadow: var(--ph-shadow);
}

.palavi-home-cat-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--cat-color, #1E5AA8) 14%, transparent);
    color: var(--cat-color, #1E5AA8);
    font-size: 1.35rem;
}

.palavi-home-cat-text {
    min-width: 0;
}

.palavi-home-cat-name {
    display: block;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.palavi-home-cat-count {
    display: block;
    color: var(--ph-muted);
    font-size: 0.85rem;
}

@media (max-width: 575.98px) {
    .palavi-home-cat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    body.palavi-home .palavi-home-cat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px;
    }

    .palavi-home-cat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }
}

/* =========================================================
   Book cards
   ========================================================= */
.palavi-home-book-row,
.palavi-home-book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
    gap: 22px;
}

/* Mobile: curated rows scroll sideways (a shelf), the full catalog
   stays a two-column grid. */
@media (max-width: 639.98px) {
    .palavi-home-book-row {
        display: flex;
        gap: 14px;
        margin: 0 -16px;
        padding: 4px 16px 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 16px;
        -webkit-overflow-scrolling: touch;
    }

    .palavi-home-book-row > .palavi-home-card {
        flex: 0 0 158px;
        scroll-snap-align: start;
    }

    .palavi-home-book-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
}

.palavi-home-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: var(--ph-radius);
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    box-shadow: var(--ph-shadow-sm);
    overflow: hidden;
    transition: transform 0.22s var(--ph-ease), box-shadow 0.22s, border-color 0.22s;
}

.palavi-home-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ph-shadow-lg);
    border-color: var(--ph-border-strong);
}

.palavi-home-card-cover {
    position: relative;
    display: block;
    aspect-ratio: 2 / 3;
    background: linear-gradient(135deg, #E8F0FB, #D6E6F7);
    overflow: hidden;
}

.palavi-home-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s var(--ph-ease);
}

.palavi-home-card:hover .palavi-home-card-cover img {
    transform: scale(1.04);
}

.palavi-home-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.palavi-home-badge.is-new { background: var(--ph-teal); }
.palavi-home-badge.is-trending { background: #E4572E; }
.palavi-home-badge.is-featured { background: var(--ph-navy); }

.palavi-home-card-access {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(9, 22, 44, 0.72);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
}

.palavi-home-card-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.94);
    color: #475569;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    transition: transform 0.15s, color 0.15s;
}

.palavi-home-card-fav:hover {
    transform: scale(1.08);
    color: #E11D48;
}

.palavi-home-card-fav.is-favorited {
    color: #E11D48;
}

.palavi-home-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 12px 14px 14px;
}

.palavi-home-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 22px;
    margin-bottom: 6px;
}

.palavi-home-card-cat {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ph-teal);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.palavi-home-card-rating {
    flex-shrink: 0;
    color: var(--ph-text);
    font-size: 0.8rem;
    font-weight: 700;
}

.palavi-home-card-rating i {
    color: var(--ph-amber);
}

.palavi-home-card-rating span {
    color: var(--ph-muted);
    font-weight: 500;
}

body.palavi-home .palavi-home-card-title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

body.palavi-home .palavi-home-card-title a {
    color: var(--ph-text);
    text-decoration: none;
}

body.palavi-home .palavi-home-card-title a:hover {
    color: var(--ph-blue);
}

/* Whole-card click target without nesting interactive elements. */
body.palavi-home .palavi-home-card-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.palavi-home-card-author {
    margin: 0 0 8px;
    color: var(--ph-muted);
    font-size: 0.86rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palavi-home-card-stock {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.palavi-home-card-stock.is-available { color: #0F8A5F; }
.palavi-home-card-stock.is-out { color: var(--ph-muted); }

[data-theme="dark"] .palavi-home-card-stock.is-available { color: #34D399; }

.palavi-home-card-actions {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: auto;
}

.palavi-home-card-actions .palavi-home-btn {
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
}

@media (max-width: 639.98px) {
    .palavi-home-card-actions .palavi-home-btn {
        font-size: 0.8rem;
    }
}

/* Designed fallback cover for books with no cover image. */
.palavi-home-cover-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    padding: 30px 16px 16px 22px;
    color: #fff;
    background: linear-gradient(160deg, #1E5AA8, #0F3570);
    overflow: hidden;
}

.palavi-home-cover-fallback::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    background: rgba(0, 0, 0, 0.18);
}

.palavi-home-cover-fallback::after {
    content: '';
    position: absolute;
    left: 22px;
    right: 16px;
    top: 16px;
    height: 2px;
    background: rgba(255, 255, 255, 0.45);
}

.palavi-home-cover-fallback-title {
    font-family: Georgia, 'Noto Sans Devanagari', serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    padding-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.palavi-home-cover-fallback-author {
    font-size: 0.78rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.palavi-home-cover-fallback i {
    position: absolute;
    right: 14px;
    bottom: 34px;
    font-size: 2.2rem;
    opacity: 0.35;
}

.palavi-home-cover-tone-1 { background: linear-gradient(160deg, #0E9F9A, #0B5E68); }
.palavi-home-cover-tone-2 { background: linear-gradient(160deg, #4F46E5, #262A7A); }
.palavi-home-cover-tone-3 { background: linear-gradient(160deg, #2B6CB0, #6FC3E8); }
.palavi-home-cover-tone-4 { background: linear-gradient(160deg, #334155, #0F172A); }
.palavi-home-cover-tone-5 { background: linear-gradient(160deg, #B45309, #78350F); }

/* BookGrid's loading skeleton (assets/js/user/library.js) */
.palavi-home-book-grid > .book-card {
    padding: 0;
}

/* =========================================================
   Delivery banner
   ========================================================= */
.palavi-home-delivery {
    padding-top: 8px;
    padding-bottom: 8px;
}

.palavi-home-delivery-inner {
    position: relative;
    min-height: 340px;
    border-radius: var(--ph-radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: var(--ph-shadow);
}

.palavi-home-delivery-inner > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
}

.palavi-home-delivery-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(90deg, rgba(10, 33, 70, 0.92) 0%, rgba(10, 33, 70, 0.72) 45%, rgba(10, 33, 70, 0.08) 80%);
}

.palavi-home-delivery-copy {
    position: relative;
    z-index: 2;
    max-width: 480px;
    padding: 40px 44px;
    color: #E6EEF9;
}

body.palavi-home .palavi-home-delivery-copy h2 {
    color: #fff;
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    margin: 0 0 10px;
}

.palavi-home-delivery-copy p {
    margin: 0 0 20px;
}

@media (max-width: 767.98px) {
    .palavi-home-delivery-inner {
        min-height: 380px;
        align-items: flex-end;
    }

    .palavi-home-delivery-inner::before {
        background: linear-gradient(0deg, rgba(10, 33, 70, 0.94) 0%, rgba(10, 33, 70, 0.7) 55%, rgba(10, 33, 70, 0.1) 100%);
    }

    .palavi-home-delivery-copy {
        padding: 28px 22px;
    }
}

/* =========================================================
   Browse toolbar / catalog
   ========================================================= */
.palavi-home-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--ph-radius);
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    box-shadow: var(--ph-shadow-sm);
}

.palavi-home-toolbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--ph-border-strong);
    background: var(--ph-surface-2);
}

.palavi-home-toolbar-search:focus-within {
    border-color: var(--ph-blue);
}

.palavi-home-toolbar-search i {
    color: var(--ph-muted);
}

.palavi-home-toolbar-search input {
    flex: 1;
    min-width: 0;
    height: 46px;
    border: 0;
    outline: 0 !important;
    background: transparent;
    font: inherit;
    color: var(--ph-text);
}

.palavi-home-select {
    width: 100%;
    height: 48px;
    padding: 0 36px 0 14px;
    border-radius: 12px;
    border: 1px solid var(--ph-border-strong);
    background-color: var(--ph-surface-2);
    color: var(--ph-text);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2366768F' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    cursor: pointer;
}

.palavi-home-select:focus {
    border-color: var(--ph-blue);
    outline: 0;
}

.palavi-home-results-info {
    margin: 0 0 18px;
    color: var(--ph-muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.palavi-home-empty {
    padding: 48px 20px;
    text-align: center;
    border-radius: var(--ph-radius);
    border: 1px dashed var(--ph-border-strong);
    background: var(--ph-surface);
    color: var(--ph-text-2);
}

.palavi-home-empty > i {
    display: block;
    margin-bottom: 10px;
    font-size: 2rem;
    color: var(--ph-blue);
}

.palavi-home-pagination {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

body.palavi-home .pagination {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

body.palavi-home .page-link {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    color: var(--ph-text);
    font-weight: 600;
}

body.palavi-home .page-item.active .page-link {
    background: var(--ph-blue);
    border-color: var(--ph-blue);
    color: #fff;
}

body.palavi-home .page-item.disabled .page-link {
    background: var(--ph-surface);
    color: var(--ph-muted);
    opacity: 0.6;
}

@media (max-width: 767.98px) {
    .palavi-home-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .palavi-home-toolbar-search {
        grid-column: 1 / -1;
    }
}

@media (max-width: 479.98px) {
    .palavi-home-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    #catalogSort {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   App promotion
   ========================================================= */
.palavi-home-app {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 40px;
    padding: 56px 60px;
    border-radius: 28px;
    overflow: hidden;
    color: #D9E6F7;
    background:
        radial-gradient(600px 300px at 100% 0%, rgba(111, 195, 232, 0.35), transparent 70%),
        linear-gradient(135deg, #0F3570 0%, #1E5AA8 100%);
    box-shadow: var(--ph-shadow-lg);
}

body.palavi-home .palavi-home-app h2 {
    color: #fff;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    margin: 0 0 14px;
}

.palavi-home-app-copy > p {
    font-size: 1.08rem;
    max-width: 520px;
}

.palavi-home-app-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin: 24px 0 28px;
    padding: 0;
    list-style: none;
}

.palavi-home-app-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #fff;
}

.palavi-home-app-features i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #CFEFFF;
}

.palavi-home-app-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.palavi-home-play-badge {
    display: inline-block;
    line-height: 0;
}

/* The official badge PNG has built-in transparent padding; the negative
   margin trims it so the visible badge lines up with neighbouring content. */
.palavi-home-play-badge img {
    height: 84px;
    width: auto;
    margin: -13px;
}

.palavi-home-footer .palavi-home-play-badge img {
    height: 64px;
    margin: -10px;
}

.palavi-home-qr {
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    line-height: 0;
}

.palavi-home-qr img,
.palavi-home-qr canvas {
    width: 112px;
    height: 112px;
}

.palavi-home-dev-note {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.92rem;
}

.palavi-home-phone {
    justify-self: center;
    width: 250px;
    padding: 12px;
    border-radius: 40px;
    background: #0A1426;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 0 0 2px #26344F;
    transform: rotate(4deg);
}

.palavi-home-phone-screen {
    display: flex;
    flex-direction: column;
    height: 470px;
    border-radius: 30px;
    overflow: hidden;
    background: #F4F7FB;
    color: #0E1C33;
}

.palavi-home-phone-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px 18px 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.palavi-home-phone-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 12px;
    background: #fff;
    border-bottom: 1px solid #E1E8F1;
}

.palavi-home-phone-top img {
    width: 40px;
    height: auto;
}

.palavi-home-phone-search {
    flex: 1;
    padding: 7px 10px;
    border-radius: 999px;
    background: #EEF3FA;
    color: #66768F;
    font-size: 0.72rem;
}

.palavi-home-phone-label {
    margin: 12px 12px 8px;
    font-size: 0.82rem;
    font-weight: 800;
}

.palavi-home-phone-covers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0 12px;
    flex: 1;
    align-content: start;
}

.palavi-home-phone-covers img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Stand-in tile when a mockup cover fails to load (palavi-home.js). */
.palavi-home-phone-tile {
    display: block;
    aspect-ratio: 2 / 3;
    border-radius: 6px;
    background: linear-gradient(160deg, #1E5AA8, #0F3570);
}

.palavi-home-phone-tile:nth-child(3n+2) { background: linear-gradient(160deg, #0E9F9A, #0B5E68); }
.palavi-home-phone-tile:nth-child(3n) { background: linear-gradient(160deg, #6FC3E8, #2B6CB0); }

.palavi-home-phone-nav {
    display: flex;
    justify-content: space-around;
    padding: 12px 8px 16px;
    background: #fff;
    border-top: 1px solid #E1E8F1;
    color: #8C9BB4;
    font-size: 1.1rem;
}

.palavi-home-phone-nav i:first-child {
    color: #1E5AA8;
}

@media (max-width: 991.98px) {
    .palavi-home-app {
        grid-template-columns: 1fr;
        padding: 40px 28px;
    }

    .palavi-home-phone {
        transform: none;
    }
}

@media (max-width: 479.98px) {
    .palavi-home-app {
        padding: 32px 20px;
        border-radius: 22px;
    }

    .palavi-home-app-features {
        grid-template-columns: 1fr;
    }

    .palavi-home-phone {
        width: 220px;
    }

    .palavi-home-phone-screen {
        height: 410px;
    }
}

/* =========================================================
   Split (About) + photo stack
   ========================================================= */
.palavi-home-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 64px;
}

.palavi-home-split-copy h2 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    margin: 0 0 18px;
}

.palavi-home-split-copy > p {
    color: var(--ph-text-2);
    font-size: 1.05rem;
}

.palavi-home-photo-stack {
    position: relative;
    padding-bottom: 60px;
    padding-right: 18%;
}

/* height:auto so the width/height attributes (kept for layout
   stability) don't override aspect-ratio below. */
.palavi-home-photo-stack img {
    display: block;
    height: auto;
    object-fit: cover;
}

.palavi-home-photo-main {
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: var(--ph-radius-lg);
    box-shadow: var(--ph-shadow-lg);
}

.palavi-home-photo-inset {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 52%;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    border: 6px solid var(--ph-bg);
    box-shadow: var(--ph-shadow-lg);
}

.palavi-home-checks {
    display: grid;
    gap: 10px;
    margin: 22px 0 28px;
    padding: 0;
    list-style: none;
}

.palavi-home-checks li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
}

.palavi-home-checks i {
    color: var(--ph-teal);
    font-size: 1.2rem;
    line-height: 1.4;
}

.palavi-home-motto {
    margin: 26px 0 0;
    padding: 20px 24px;
    border-left: 4px solid var(--ph-sky);
    border-radius: 0 16px 16px 0;
    background: var(--ph-bg-alt);
}

.palavi-home-motto p {
    margin: 0 0 4px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ph-navy);
}

[data-theme="dark"] .palavi-home-motto p {
    color: #CFEFFF;
}

.palavi-home-motto footer {
    color: var(--ph-muted);
}

@media (max-width: 991.98px) {
    .palavi-home-split {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .palavi-home-split-media {
        max-width: 520px;
        width: 100%;
        margin: 0 auto;
    }
}

/* =========================================================
   Portfolio grid
   ========================================================= */
.palavi-home-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.palavi-home-portfolio-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: var(--ph-radius);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--ph-chip);
    box-shadow: var(--ph-shadow-sm);
    cursor: zoom-in;
    text-align: left;
}

.palavi-home-portfolio-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    display: block;
    transition: transform 0.5s var(--ph-ease);
}

.palavi-home-portfolio-card:hover img,
.palavi-home-portfolio-card:focus-visible img {
    transform: scale(1.05);
}

.palavi-home-portfolio-overlay {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 48px 18px 16px;
    color: #fff;
    background: linear-gradient(0deg, rgba(6, 20, 44, 0.9) 0%, rgba(6, 20, 44, 0.55) 60%, transparent 100%);
}

.palavi-home-portfolio-tag {
    align-self: flex-start;
    margin-bottom: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(111, 195, 232, 0.25);
    color: #CFEFFF;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.palavi-home-portfolio-title {
    font-weight: 800;
    font-size: 1.05rem;
}

.palavi-home-portfolio-text {
    font-size: 0.86rem;
    opacity: 0.88;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.palavi-home-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.palavi-home-chip {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--ph-border-strong);
    background: var(--ph-surface);
    color: var(--ph-text-2);
    font: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

.palavi-home-chip:hover {
    border-color: var(--ph-blue);
    color: var(--ph-blue);
}

.palavi-home-chip.is-active {
    background: var(--ph-blue);
    border-color: var(--ph-blue);
    color: #fff;
}

@media (max-width: 991.98px) {
    .palavi-home-portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .palavi-home-portfolio-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Denser 4-up grid for the categorised galleries. */
.palavi-home-portfolio-grid.is-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.palavi-home-portfolio-grid.is-compact .palavi-home-portfolio-text {
    -webkit-line-clamp: 2;
    font-size: 0.82rem;
}

@media (max-width: 1199.98px) {
    .palavi-home-portfolio-grid.is-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .palavi-home-portfolio-grid.is-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    /* Two-up on phones: keep just the title on the photo. */
    .palavi-home-portfolio-grid.is-compact .palavi-home-portfolio-text,
    .palavi-home-portfolio-grid.is-compact .palavi-home-portfolio-tag {
        display: none;
    }

    .palavi-home-portfolio-grid.is-compact .palavi-home-portfolio-overlay {
        padding: 32px 10px 10px;
    }

    .palavi-home-portfolio-grid.is-compact .palavi-home-portfolio-title {
        font-size: 0.85rem;
        line-height: 1.3;
    }
}

.palavi-home-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.palavi-home-chip-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--ph-chip);
    color: var(--ph-blue);
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
}

.palavi-home-chip.is-active .palavi-home-chip-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* Tabs scroll sideways on phones instead of wrapping into 3 rows. */
@media (max-width: 767.98px) {
    .palavi-home-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-left: -16px;
        margin-right: -16px;
        padding: 2px 16px 6px;
        scrollbar-width: none;
    }

    .palavi-home-chips::-webkit-scrollbar {
        display: none;
    }

    .palavi-home-chip {
        flex-shrink: 0;
    }
}

.palavi-home-chips-sticky {
    position: sticky;
    top: 77px;
    z-index: 5;
    padding-top: 10px;
    padding-bottom: 10px;
    background: var(--ph-bg);
}

@media (max-width: 575.98px) {
    .palavi-home-chips-sticky {
        top: 69px;
    }
}

/* Inside a category group the heading already names the category. */
.palavi-home-pf-group .palavi-home-portfolio-tag {
    display: none;
}

.palavi-home-pf-group + .palavi-home-pf-group {
    margin-top: 48px;
}

.palavi-home-pf-group-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.palavi-home-pf-group-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 2px;
    font-size: clamp(1.3rem, 2.2vw, 1.7rem);
}

.palavi-home-pf-group-head p {
    margin: 0;
    color: var(--ph-muted);
}

.palavi-home-pf-group-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: var(--ph-chip);
    color: var(--ph-blue);
    font-size: 1.35rem;
}

.palavi-home-pf-group-count {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--ph-teal-soft);
    color: var(--ph-teal);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0;
}

.palavi-home-pf-stats {
    display: flex;
    gap: 28px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
    color: var(--ph-muted);
}

.palavi-home-pf-stats strong {
    color: var(--ph-text);
    font-size: 1.5rem;
    font-weight: 800;
    margin-right: 4px;
}

.palavi-home-lightbox {
    position: relative;
    background: transparent;
    border: 0;
}

.palavi-home-lightbox-stage {
    position: relative;
}

.palavi-home-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #0E1C33;
    font-size: 1.3rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.palavi-home-lightbox-nav:hover {
    background: #fff;
}

.palavi-home-lightbox-nav.is-prev { left: 12px; }
.palavi-home-lightbox-nav.is-next { right: 12px; }

.palavi-home-lightbox-counter {
    margin-left: 8px;
    opacity: 0.7;
    font-size: 0.85rem;
    white-space: nowrap;
}

.palavi-home-lightbox img {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 16px;
    background: #000;
}

.palavi-home-lightbox p {
    margin: 12px 4px 0;
    color: #fff;
    text-align: center;
}

.palavi-home-lightbox .btn-close {
    position: absolute;
    top: -40px;
    right: 0;
    opacity: 1;
}

/* =========================================================
   Contact
   ========================================================= */
.palavi-home-contact {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    border-radius: var(--ph-radius-lg);
    overflow: hidden;
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    box-shadow: var(--ph-shadow);
}

.palavi-home-contact-info {
    padding: 44px 40px;
    color: #D9E6F7;
    background:
        radial-gradient(420px 240px at 100% 100%, rgba(111, 195, 232, 0.3), transparent 70%),
        linear-gradient(160deg, #0F3570 0%, #1E5AA8 100%);
}

body.palavi-home .palavi-home-contact-info h2 {
    color: #fff;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    margin: 0 0 12px;
}

.palavi-home-contact-list {
    display: grid;
    gap: 18px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.palavi-home-contact-list li {
    display: flex;
    gap: 14px;
}

.palavi-home-contact-list strong {
    display: block;
    color: #fff;
    font-size: 0.85rem;
}

body.palavi-home .palavi-home-contact-list a {
    color: #E6F3FF;
    overflow-wrap: anywhere;
}

.palavi-home-contact-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.1rem;
}

.palavi-home-contact-form {
    padding: 44px 40px;
}

body.palavi-home .form-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ph-text);
}

body.palavi-home .form-control {
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid var(--ph-border-strong);
    background: var(--ph-surface-2);
    color: var(--ph-text);
    font: inherit;
}

body.palavi-home .form-control:focus {
    border-color: var(--ph-blue);
    background: var(--ph-surface);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ph-blue) 18%, transparent);
    color: var(--ph-text);
}

body.palavi-home .form-control.is-invalid {
    border-color: #DC3545;
}

.palavi-home-hp {
    position: absolute !important;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .palavi-home-contact {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .palavi-home-contact-info,
    .palavi-home-contact-form {
        padding: 28px 20px;
    }

    .palavi-home-contact-form .palavi-home-btn {
        width: 100%;
    }
}

/* =========================================================
   Sub-page hero, features, trust, CTA band
   ========================================================= */
.palavi-home-page-hero {
    padding: 48px 0 44px;
    background:
        radial-gradient(800px 300px at 90% 0%, rgba(111, 195, 232, 0.25), transparent 70%),
        var(--ph-bg-alt);
    border-bottom: 1px solid var(--ph-border);
}

.palavi-home-page-hero h1 {
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
    margin: 0 0 10px;
    max-width: 820px;
}

.palavi-home-page-hero p {
    margin: 0;
    max-width: 680px;
    color: var(--ph-text-2);
    font-size: 1.08rem;
}

.palavi-home-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ph-muted);
}

.palavi-home-breadcrumb li + li::before {
    content: '/';
    margin-right: 8px;
    color: var(--ph-border-strong);
}

.palavi-home-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.palavi-home-feature {
    padding: 28px 24px;
    border-radius: var(--ph-radius);
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    box-shadow: var(--ph-shadow-sm);
}

.palavi-home-feature h3 {
    font-size: 1.1rem;
    margin: 16px 0 8px;
}

.palavi-home-feature p {
    margin: 0;
    color: var(--ph-text-2);
    font-size: 0.95rem;
}

.palavi-home-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--ph-chip);
    color: var(--ph-blue);
    font-size: 1.4rem;
}

@media (max-width: 991.98px) {
    .palavi-home-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .palavi-home-feature-grid {
        grid-template-columns: 1fr;
    }
}

.palavi-home-trust {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 40px;
    align-items: start;
}

.palavi-home-trust h2 {
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    margin: 0 0 8px;
}

.palavi-home-trust > div > p {
    color: var(--ph-muted);
}

.palavi-home-trust-list {
    display: grid;
    gap: 0;
    margin: 0;
    border-radius: var(--ph-radius);
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    overflow: hidden;
}

.palavi-home-trust-list > div {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ph-border);
}

.palavi-home-trust-list > div:last-child {
    border-bottom: 0;
}

.palavi-home-trust-list dt {
    color: var(--ph-muted);
    font-weight: 700;
    font-size: 0.9rem;
}

.palavi-home-trust-list dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
    .palavi-home-trust {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .palavi-home-trust-list > div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

.palavi-home-cta-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 40px 48px;
    border-radius: var(--ph-radius-lg);
    background: linear-gradient(135deg, #0F3570 0%, #1E5AA8 100%);
    box-shadow: var(--ph-shadow-lg);
}

body.palavi-home .palavi-home-cta-band h2 {
    color: #fff;
    margin: 0;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
}

.palavi-home-cta-band-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 575.98px) {
    .palavi-home-cta-band {
        padding: 28px 22px;
    }

    .palavi-home-cta-band-actions,
    .palavi-home-cta-band-actions .palavi-home-btn {
        width: 100%;
    }
}

/* =========================================================
   Modal (login/register)
   ========================================================= */
body.palavi-home .palavi-home-modal {
    border: 1px solid var(--ph-border);
    border-radius: 20px;
    background: var(--ph-surface);
    color: var(--ph-text);
    box-shadow: var(--ph-shadow-lg);
}

[data-theme="dark"] .palavi-home-modal .btn-close {
    filter: invert(1);
}

.palavi-home-auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 18px;
    padding: 4px;
    border-radius: 12px;
    background: var(--ph-bg-alt);
}

.palavi-home-auth-tabs .catalog-auth-tab {
    padding: 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ph-text-2);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.palavi-home-auth-tabs .catalog-auth-tab.active {
    background: var(--ph-surface);
    color: var(--ph-blue);
    box-shadow: var(--ph-shadow-sm);
}

body.palavi-home .catalog-auth-pane {
    display: none;
}

body.palavi-home .catalog-auth-pane.active {
    display: block;
}

/* =========================================================
   Footer
   ========================================================= */
.palavi-home-footer {
    padding: 64px 0 28px;
    background: #081C3A;
    color: #A9BAD3;
    font-size: 0.94rem;
}

.palavi-home-footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr 0.9fr 1.3fr;
    gap: 40px;
}

.palavi-home-footer-logo {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 14px;
    background: #fff;
    margin-bottom: 16px;
}

.palavi-home-footer-logo img {
    height: 64px;
    width: auto;
}

.palavi-home-footer-motto {
    color: #CFEFFF;
    font-weight: 700;
}

body.palavi-home .palavi-home-footer h2 {
    margin: 4px 0 16px;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

.palavi-home-footer ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.palavi-home .palavi-home-footer a {
    color: #C6D4E8;
    text-decoration: none;
}

body.palavi-home .palavi-home-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.palavi-home-footer-contact li {
    display: flex;
    gap: 10px;
    overflow-wrap: anywhere;
}

.palavi-home-footer-contact i {
    color: var(--ph-sky);
    margin-top: 2px;
}

.palavi-home-footer .palavi-home-play-badge {
    margin-top: 18px;
}

.palavi-home-footer-social {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

body.palavi-home .palavi-home-footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.1rem;
}

.palavi-home-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 48px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.86rem;
}

.palavi-home-footer-bottom p {
    margin: 0;
}

.palavi-home-footer-bottom nav {
    display: flex;
    gap: 20px;
}

@media (max-width: 991.98px) {
    .palavi-home-footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 575.98px) {
    .palavi-home-footer {
        padding-top: 44px;
    }

    .palavi-home-footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .palavi-home-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================================
   Back to top
   ========================================================= */
.palavi-home-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1020;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 0;
    background: var(--ph-blue);
    color: #fff;
    font-size: 1.2rem;
    box-shadow: var(--ph-shadow-lg);
    cursor: pointer;
}

.palavi-home-to-top:hover {
    background: var(--ph-blue-hover);
}

@media (prefers-reduced-motion: reduce) {
    html:has(body.palavi-home) {
        scroll-behavior: auto;
    }

    .palavi-home-card:hover,
    .palavi-home-cat-card:hover,
    .palavi-home-btn:hover {
        transform: none;
    }
}
