/* Final responsive layer. Loaded after the template and page styles. */
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; overflow-x: clip; }
img, video, iframe, svg { max-width: 100%; height: auto; }
.container, .container-fluid, .row, main, section { min-width: 0; }

.hebe-history-back {
    position: fixed;
    left: 18px;
    bottom: 20px;
    z-index: 1055;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 999px;
    color: #FFFFFF;
    background: rgba(0,0,0,.9);
    box-shadow: 0 12px 30px rgba(0,0,0,.24);
    backdrop-filter: blur(10px);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, background .2s ease;
}
.hebe-history-back:hover {
    color: #FFFFFF;
    background: #fe0202;
    transform: translateX(-3px);
}
.hebe-history-back span { font-size: 19px; line-height: 1; }

@media (max-width: 991.98px) {
    .hebe-nav-shell .container { width: 100%; max-width: none; padding-inline: 18px; }
    .hebe-nav-shell .navbar { min-height: 68px; }
    .hebe-nav-shell .navbar-collapse {
        max-height: calc(100svh - 72px);
        padding: 14px 0 20px;
        overflow-y: auto;
        background: #FFFFFF;
    }
    .hebe-nav-shell .navbar-nav,
    .hebe-account-nav { width: 100%; }
    .hebe-nav-shell .nav-link,
    .hebe-account-nav a {
        display: block;
        width: 100%;
        margin: 2px 0;
        padding: 11px 12px !important;
    }
    .hebe-account-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .hebe-account-nav a { text-align: center; }

    .section-head { align-items: flex-start; flex-direction: column; gap: 18px; }
    .filters { grid-template-columns: 1fr !important; gap: 10px; padding: 14px !important; }
    .filters input, .filters select, .filters button { width: 100%; min-height: 50px; }
    .cards-grid, .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .detail-layout, .content-grid.two-col, .contact-layout { grid-template-columns: 1fr !important; }
    .detail-panel { position: static !important; }

    .hebe-template-hero { padding-top: 42px !important; }
    .hebe-template-hero .row { row-gap: 28px; }
    .hebe-template-carousel { width: 100%; }
    .hebe-template-features > [class*="col-"] { width: 50%; }

    .about-principles-grid, .about-process-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
    .about-hero-grid, .about-story-grid { grid-template-columns: 1fr !important; }

    .admin-layout { grid-template-columns: 1fr !important; gap: 20px !important; }
    .admin-layout .sidebar { position: static !important; }
    .stats { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
    .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 767.98px) {
    body { font-size: 15px; }
    .container { width: 100% !important; max-width: none !important; padding-inline: 16px; }
    section { scroll-margin-top: 74px; }

    .hebe-istudio-brand span { font-size: 27px; }
    .hebe-istudio-brand small { font-size: 9px; }
    .hebe-account-nav { grid-template-columns: 1fr; }

    .hebe-template-hero { margin-bottom: 34px !important; padding-top: 28px !important; }
    .hebe-template-hero .display-1 {
        font-size: clamp(38px, 11vw, 52px) !important;
        line-height: 1.02;
        overflow-wrap: anywhere;
    }
    .hebe-template-hero .lead { font-size: 16px; line-height: 1.6; }
    .hebe-template-carousel { min-height: 350px !important; padding: 0 !important; }
    .hebe-template-slide { inset: 0 34px 0 0 !important; }
    .hebe-template-slide img { width: 100%; height: 100% !important; object-fit: cover; }
    .hebe-template-dots { right: 5px !important; }
    .hebe-hero-details { margin-top: 18px; }

    .py-5 { padding-top: 2.75rem !important; padding-bottom: 2.75rem !important; }
    .mb-5 { margin-bottom: 2.25rem !important; }
    .display-3, .display-4, .page-hero h1, .blog-hero h1 {
        font-size: clamp(34px, 10vw, 48px) !important;
        line-height: 1.08;
    }

    .hebe-template-features > [class*="col-"] { width: 100%; }
    .cards-grid, .blog-grid, .related-grid,
    .about-principles-grid, .about-process-grid,
    .stats { grid-template-columns: 1fr !important; }
    .card img, .blog-card img { width: 100%; object-fit: cover; }

    .hebe-category-portrait { height: 390px !important; }
    .hebe-category-grid { grid-template-columns: 1fr !important; }

    .page-hero, .blog-hero { padding: 72px 0 58px !important; }
    .page-hero p, .blog-hero p { font-size: 15px !important; line-height: 1.6; }

    .hebe-register-shell {
        width: calc(100% - 28px) !important;
        margin: 28px auto 54px !important;
        min-height: 0 !important;
    }
    .hebe-register-visual { min-height: 350px !important; padding: 30px 24px !important; }
    .istudio-hebe .hebe-register-form { padding: 30px 22px !important; }

    .footer-grid { width: 100% !important; padding: 42px 20px 28px !important; grid-template-columns: 1fr !important; gap: 28px !important; }
    .footer-links a { min-height: 44px; }

    .admin-layout { padding-block: 28px; }
    .admin-layout .sidebar { padding: 18px !important; }
    .admin-layout .sidebar a { min-height: 44px; }
    .form-wrap { padding: 22px !important; }
    table { min-width: 680px; }
    .hebe-history-back {
        left: 12px;
        bottom: 12px;
        min-height: 42px;
        padding: 9px 14px;
    }
}

@media (max-width: 420px) {
    .container, .hebe-nav-shell .container { padding-inline: 13px; }
    .hebe-template-carousel { min-height: 310px !important; }
    .hebe-template-slide { right: 28px !important; }
    .hebe-category-portrait { height: 340px !important; }
    .btn { width: 100%; text-align: center; }
    .section-head .section-link { width: 100%; justify-content: center; }
}

/* Final cross-device hardening */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body { min-width: 320px; }
img, video, iframe { max-width: 100%; }
.row > *, .grid > *, .cards-grid > *, .blog-grid > * { min-width: 0; }
button, a, input, select, textarea { touch-action: manipulation; }

@media (max-width: 1199.98px) {
    .detail {
        grid-template-columns: minmax(0, 1fr) 360px !important;
        gap: 34px !important;
    }
    .hebe-exact-project { min-height: 610px !important; }
}

@media (max-width: 991.98px) {
    .detail {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 28px !important;
    }
    .detail-panel {
        width: 100%;
        max-width: none;
    }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .cta-row { flex-wrap: wrap; }
    .hebe-exact-project { min-height: 520px !important; }
    .hebe-exact-project img { width: 100%; height: 100%; object-fit: cover; }
    .newsletter .row { row-gap: 18px; }
}

@media (max-width: 767.98px) {
    input, select, textarea { font-size: 16px !important; }
    .grid { grid-template-columns: minmax(0, 1fr) !important; }

    .detail,
    .detail-layout {
        width: 100%;
        gap: 22px !important;
    }
    .detail-image-wrap,
    .detail-viewer,
    .detail-main-image { width: 100% !important; }
    .detail-panel { padding: 24px 20px !important; }
    .detail-panel h1 { font-size: clamp(28px, 9vw, 40px) !important; }
    .cta-row,
    .cta-row form {
        display: grid !important;
        width: 100%;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .cta-row .btn,
    .cta-row button,
    .cta-row a { width: 100%; justify-content: center; text-align: center; }

    .breadcrumbs {
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .hebe-page-back { max-width: 100%; }

    .hebe-exact-project { min-height: 410px !important; }
    .hebe-exact-project .p-5 { padding: 28px 22px !important; }
    .newsletter { text-align: center; }
    .newsletter .btn,
    .newsletter button { width: 100%; }

    .blog-featured,
    .blog-featured-card { grid-template-columns: minmax(0, 1fr) !important; }
    .blog-featured img { min-height: 240px; object-fit: cover; }

    .section-head > *,
    .admin-layout main,
    .admin-layout .content { width: 100%; }
    .section-head .btn,
    .admin-layout .section-head .btn { width: 100%; text-align: center; }
}

@media (max-width: 420px) {
    h1, .h1 { overflow-wrap: anywhere; }
    h2, .h2 { font-size: clamp(27px, 8.5vw, 36px) !important; }
    .hebe-template-hero .display-1 { font-size: clamp(35px, 10.5vw, 44px) !important; }
    .hebe-hero-details { grid-template-columns: minmax(0, 1fr) !important; }
    .hebe-exact-project { min-height: 350px !important; }
    .hebe-category-portrait { height: 320px !important; }
    .detail-panel { padding: 21px 16px !important; }
    .page-hero, .blog-hero { padding: 58px 0 46px !important; }
    .hebe-register-visual { min-height: 300px !important; }
}

@media (max-width: 359.98px) {
    .container, .hebe-nav-shell .container { padding-inline: 11px; }
    .hebe-istudio-brand span { font-size: 24px; }
    .hebe-template-carousel { min-height: 285px !important; }
    .hebe-template-slide { right: 24px !important; }
    .hebe-category-portrait { height: 290px !important; }
}

@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    .hebe-template-hero { min-height: auto !important; }
    .hebe-template-carousel { min-height: 300px !important; }
    .hebe-nav-shell .navbar-collapse { max-height: calc(100vh - 68px); }
}
