/**
 * HUBLIQ GLOBAL SCALE CAP — viewport width ≥ 801px
 *
 * Hard guarantee: type, spacing tokens, radii, feed cards, avatars, and hubliq primitives
 * do NOT grow beyond the visual density of ~800px width (same tier as responsive.css @768px,
 * before @1024px / @1440px enlargements).
 *
 * Layout stays professional on large screens via existing max-width shells (.container,
 * .hubliq-content-shell); this file does NOT shrink the whole page to 800px — it caps scale only.
 *
 * MUST load LAST in <head> (after responsive.css, hubliq-layout.css, feed CSS, hubliq-touch-safe.css).
 */

@media (min-width: 801px) {
    /* Tablet-tier design tokens (matches responsive.css @media (min-width: 768px) :root) */
    :root {
        --hubliq-page-gutter: 1.25rem;
        --spacing-xs: 0.375rem;
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --radius-sm: 6px;
        --radius-md: 10px;
        --radius-lg: 14px;
        --radius-xl: 18px;
    }

    html {
        font-size: 100% !important;
    }

    body {
        font-size: 1rem !important;
    }

    /* Headings: same as responsive tablet tier — blocks 1024px / 1440px bumps */
    h1,
    .h1 {
        font-size: 1.875rem !important;
    }
    h2,
    .h2 {
        font-size: 1.625rem !important;
    }
    h3,
    .h3 {
        font-size: 1.375rem !important;
    }
    h4,
    .h4 {
        font-size: 1.25rem !important;
    }
    h5,
    .h5 {
        font-size: 1.125rem !important;
    }
    h6,
    .h6 {
        font-size: 1rem !important;
    }

    /* Bootstrap display — fixed ceiling (no vw growth from other bundles) */
    .display-1 {
        font-size: 2.5rem !important;
    }
    .display-2 {
        font-size: 2.25rem !important;
    }
    .display-3 {
        font-size: 2rem !important;
    }
    .display-4 {
        font-size: 1.75rem !important;
    }
    .display-5 {
        font-size: 1.5rem !important;
    }
    .display-6 {
        font-size: 1.25rem !important;
    }

    .lead {
        font-size: 1.125rem !important;
    }

    /* Buttons: reset min-width jumps from responsive desktop tiers; keep readable type */
    .btn {
        font-size: 1rem !important;
        min-width: unset !important;
    }
    .btn-sm,
    .btn-group-sm > .btn {
        font-size: 0.875rem !important;
    }
    .btn-lg,
    .btn-group-lg > .btn {
        font-size: 1.125rem !important;
    }

    /*
     * Home / Discovery 2026 deal cards: global .btn cap above must NOT apply here — it blew up
     * Book / Info past ~1440px. Tags in the Info overlay must stay fixed (beat span inherit + hubliq-pill vw).
     */
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-actions {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        contain: none !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-actions .btn,
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-actions button {
        font-size: 11px !important;
        line-height: 1.25 !important;
        font-weight: 700 !important;
        letter-spacing: 0.06em !important;
        text-transform: uppercase !important;
        padding: 7px 8px !important;
        min-height: 0 !important;
        max-height: none !important;
        min-width: 0 !important;
        flex: 1 1 0 !important;
        box-sizing: border-box !important;
        border-radius: 10px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22) !important;
        white-space: nowrap !important;
    }

    /* Face category rows: wrap, max ~3 lines */
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card:not(.details-open) > .content > .hubliq-pill-row,
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card:not(.details-open) > .content > .deal-card-chip-strip {
        flex-wrap: wrap !important;
        align-content: flex-start !important;
        max-height: 5.25rem !important;
        overflow: hidden !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card:not(.details-open) > .content > .hubliq-pill-row .hubliq-pill,
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card:not(.details-open) > .content > .hubliq-pill-row .hubliq-pill--sm {
        font-size: 11px !important;
        font-weight: 500 !important;
        line-height: 1.25 !important;
        padding: 4px 7px !important;
        flex: 0 1 auto !important;
        max-width: min(48%, 9rem) !important;
        box-sizing: border-box !important;
    }

    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card:not(.details-open) > .content > .deal-card-chip-strip > span {
        font-size: 11px !important;
        font-weight: 500 !important;
        line-height: 1.25 !important;
        padding: 4px 7px !important;
        flex: 0 1 auto !important;
        max-width: min(48%, 9rem) !important;
        box-sizing: border-box !important;
    }

    /* Info overlay: horizontal chip scroller */
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-info .hubliq-pill-row,
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-info .deal-info-chip-strip {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-info .deal-info-book-btn {
        font-size: 12px !important;
        line-height: 1.25 !important;
        font-weight: 700 !important;
        letter-spacing: 0.06em !important;
        text-transform: uppercase !important;
        padding: 8px 14px !important;
        min-height: 0 !important;
        max-height: none !important;
        border-radius: 10px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    }

    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-info .deal-info-tag,
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-info .deal-info-tag.hubliq-pill,
    #page-scaling-wrapper .screen.mobile-home-page-2026 .deal-card .deal-info .hubliq-pill.hubliq-pill--sm {
        font-size: 11px !important;
        line-height: 1.25 !important;
        padding: 4px 8px !important;
        max-width: min(100%, 10rem) !important;
        border-radius: 6px !important;
        font-weight: 500 !important;
    }

    .form-control,
    .form-select {
        font-size: 1rem !important;
    }
    .form-control-sm {
        font-size: 0.875rem !important;
    }
    .form-label {
        font-size: 1rem !important;
    }

    /* Containers: stay readable — avoid 1400px-wide text rivers */
    .container {
        max-width: min(1200px, 100%) !important;
    }

    /* Global avatar helpers from responsive.css — lock to tablet size */
    img[class*="avatar"]:not([class*="hubliq"]):not(.feed-card-avatar),
    .avatar:not(.feed-card-avatar) {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
    }

    /* Feed column (responsive grows card width at 1440px) */
    .feed-card {
        flex: 0 0 300px !important;
        width: 300px !important;
        max-width: 300px !important;
        min-width: 300px !important;
    }

    .feed-card-title {
        font-size: 1.125rem !important;
    }
    .feed-card-content {
        font-size: 1rem !important;
    }
    .feed-card-meta {
        font-size: 0.9375rem !important;
    }

    .feed-card-avatar,
    .feed-card-avatar-placeholder {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
    }

    .feed-card-image-placeholder i {
        font-size: 1.75rem !important;
    }

    /* ---- Hubliq primitives (same as former hubliq-layout 801 block) ---- */
    .hubliq-pill {
        font-size: 0.58rem !important;
    }
    .hubliq-pill--sm {
        font-size: 0.54rem !important;
    }

    .chips.hubliq-chip-scroll .chip,
    .chips.hubliq-chip-scroll a.chip {
        font-size: 0.6875rem !important;
        padding: 0.28rem 0.72rem !important;
    }

    .hubliq-detail-doc-layout .breadcrumb-item,
    .hubliq-detail-doc-layout .breadcrumb-item a {
        font-size: 0.86rem !important;
    }

    .hubliq-detail-doc-layout .nav.nav-tabs.card-header-tabs:not(.hubliq-main-tabs) .nav-link {
        font-size: 0.88rem !important;
    }

    .hubliq-detail-doc-layout .nav.nav-tabs.card-header-tabs.hubliq-main-tabs .nav-link {
        font-size: 0.82rem !important;
    }

    .hubliq-content-shell {
        padding-bottom: max(1.25rem, calc(env(safe-area-inset-bottom, 0px) + 1rem)) !important;
    }

    .hubliq-detail-doc-layout .hubliq-detail-scroll-body {
        padding-bottom: max(2rem, calc(env(safe-area-inset-bottom, 0px) + 1.25rem)) !important;
    }

    main.hubliq-main-shell {
        padding-bottom: max(var(--bottom-safe, 24px), calc(env(safe-area-inset-bottom, 0px) + 1.25rem)) !important;
    }

    /*
     * Home / Discovery 2026 — global h2–h4 + .form-select bumps break compact app chrome
     * (section titles balloon; city/category <select> text can clip or inherit wrong metrics).
     */
    .mobile-home-page-2026 .mobile-home-brand-banner__title {
        font-size: clamp(1.08rem, 2.35vw, 1.32rem) !important;
        line-height: 1.18 !important;
        letter-spacing: 0.02em !important;
    }

    .mobile-home-page-2026 .mobile-home-brand-banner__tagline {
        font-size: clamp(0.72rem, 1.55vw, 0.82rem) !important;
    }

    .mobile-home-page-2026 .mobile-home-brand-banner__hint-text {
        font-size: clamp(0.68rem, 1.45vw, 0.76rem) !important;
    }

    .mobile-home-page-2026 .sectionHead h2 {
        font-size: 1rem !important;
        line-height: 1.2 !important;
    }

    .mobile-home-page-2026 .mobile-home-section-2026 > div > h3,
    .mobile-home-page-2026 .mobile-home-section-2026 > h3,
    .mobile-home-page-2026 .mobile-home-app-section-head .mobile-home-app-title {
        font-size: 0.9375rem !important;
        line-height: 1.25 !important;
    }

    .home-search-fixed select.discovery-nav-select,
    .mobile-home-page-2026 select.discovery-nav-select {
        font-size: 11px !important;
        line-height: 1.25 !important;
        min-height: 34px !important;
        height: 34px !important;
        max-height: 34px !important;
        padding: 0 28px 0 10px !important;
        text-align: left !important;
        text-align-last: left !important;
        color: rgba(255, 255, 255, 0.96) !important;
        -webkit-text-fill-color: rgba(255, 255, 255, 0.96) !important;
        flex: 1 1 auto !important;
        min-width: 8.75rem !important;
        max-width: none !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: block !important;
    }

    .mobile-home-page-2026 #allCategoriesSelect.discovery-nav-select {
        min-width: 10.5rem !important;
    }

    .mobile-home-page-2026 #mobileCityFilterForm {
        flex-wrap: nowrap !important;
    }

    /* Category / type chip strips — keep app density (do not inherit other chip bundles) */
    .chips.hubliq-chip-scroll .chip,
    .chips.hubliq-chip-scroll a.chip,
    .mobile-home-page-2026 #catRow .chip,
    .mobile-home-page-2026 #typeRow .chip,
    .mobile-home-page-2026 #catRowBookings .chip {
        font-size: 11px !important;
        padding: 0.32rem 0.75rem !important;
        line-height: 1.2 !important;
    }

    /*
     * Bookings / unified calendar — fixed sticky header (≥801px only).
     * Prevents 1024px/1440px responsive tiers + vw from bloating nav / view toggles on wide viewports.
     *
     * #page-scaling-wrapper prefix: base.html applies a very-specific universal *:not(...) {
     * overflow-x: hidden !important } to div.calendar-header, which clips M/W/D and sync controls
     * on wide rows. ID + class beats that selector and restores intentional horizontal panning.
     */
    #page-scaling-wrapper .calendar-header {
        flex-wrap: nowrap !important;
        align-items: center !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
    }

    #page-scaling-wrapper .calendar-header .header-left,
    #page-scaling-wrapper .calendar-header .header-right {
        min-width: 0 !important;
    }

    #page-scaling-wrapper .calendar-header .header-center {
        display: flex !important;
        min-width: 0 !important;
        flex: 1 1 0% !important;
    }

    #page-scaling-wrapper .calendar-header .calendar-title {
        font-size: 1rem !important;
        line-height: 1.25 !important;
        font-weight: 700 !important;
    }

    #page-scaling-wrapper .calendar-header .nav-btn {
        font-size: 0.8125rem !important;
        font-weight: 500 !important;
        padding: 6px 10px !important;
        min-width: 32px !important;
        width: auto !important;
        max-width: 11rem !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 36px !important;
        line-height: 1.2 !important;
        box-sizing: border-box !important;
    }

    #page-scaling-wrapper .calendar-header select.nav-btn,
    #page-scaling-wrapper .calendar-header #professionalFilter {
        font-size: 0.75rem !important;
        max-width: min(200px, 28vw) !important;
        padding: 4px 8px !important;
        height: 32px !important;
        min-height: 32px !important;
        max-height: 36px !important;
        line-height: 1.2 !important;
    }

    #page-scaling-wrapper .calendar-header .view-btn {
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
        min-width: 28px !important;
        max-width: 48px !important;
        height: 28px !important;
        min-height: 28px !important;
        max-height: 32px !important;
        line-height: 1.2 !important;
        box-sizing: border-box !important;
    }

    #page-scaling-wrapper .calendar-header .view-btn i {
        font-size: 0.75rem !important;
    }

    #page-scaling-wrapper .calendar-header .calendar-sync-btn {
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
        min-width: 28px !important;
        width: 32px !important;
        max-width: 36px !important;
        height: 32px !important;
        max-height: 36px !important;
        box-sizing: border-box !important;
    }

    #page-scaling-wrapper .calendar-header .calendar-sync-btn i {
        font-size: 0.8125rem !important;
    }

    #page-scaling-wrapper .calendar-header .google-calendar-controls {
        margin-right: 4px !important;
    }

    /* Browse & Book (globalcalendar) — keep top strip density on large screens */
    .booking-header .back-button {
        font-size: 1.25rem !important;
        line-height: 1 !important;
    }

    .booking-header .booking-title {
        font-size: 1.0625rem !important;
        line-height: 1.3 !important;
    }

    /* Freelance booking month chrome (white card section) */
    .calendar-section .calendar-month {
        font-size: 1.0625rem !important;
    }

    .calendar-section .calendar-nav-btn {
        font-size: 1.05rem !important;
        padding: 4px 8px !important;
        line-height: 1 !important;
    }
}

/* Wide gutters: hubliq-layout used clamp(1rem, 2vw, 1.5rem) — freeze to tablet feel */
@media (min-width: 1280px) {
    .hubliq-content-shell {
        padding-left: max(1.25rem, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(1.25rem, env(safe-area-inset-right, 0px)) !important;
    }
}

/* Browsers without overflow: clip — overflow-x:hidden forces overflow-y to clip tab pills */
@supports not (overflow: clip) {
    .hubliq-detail-doc-layout .hubliq-detail-sticky-head {
        padding-bottom: 1.1rem !important;
    }

    .hubliq-detail-doc-layout .nav.nav-tabs.card-header-tabs.hubliq-main-tabs {
        padding-bottom: 2.1rem !important;
    }

    .hubliq-detail-doc-layout .nav.nav-tabs.card-header-tabs:not(.hubliq-main-tabs) {
        padding-bottom: 1rem !important;
    }
}
