/* =========================================================
   AR-TEK Global Responsive Fix
   Berlaku untuk semua halaman frontend
========================================================= */

/* Base safety */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

img,
video,
iframe {
    max-width: 100%;
}

img {
    height: auto;
}

table {
    width: 100%;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

/* Hindari elemen melebar keluar layar */
section,
.section,
.page-hero,
.blog-hero,
.blog-page,
.detail-content,
.detail-sidebar,
.sidebar-card,
.blog-card,
.service-card,
.card,
.cms-card {
    max-width: 100%;
}

/* Text wrapping */
h1,
h2,
h3,
h4,
h5,
h6,
p,
a,
span,
li,
strong {
    overflow-wrap: anywhere;
}

/* Hero global */
.page-hero,
.blog-hero {
    padding-left: 0;
    padding-right: 0;
}

.page-hero h1,
.blog-hero h1 {
    font-size: clamp(34px, 6vw, 72px);
    line-height: 1.08;
}

.page-hero p,
.blog-hero p {
    font-size: clamp(15px, 2vw, 18px);
    line-height: 1.75;
}

/* Grid umum */
.detail-grid,
.blog-content-grid,
.service-detail-grid,
.contact-grid,
.about-grid,
.home-grid,
.cms-grid,
.feature-grid,
.stats-grid,
.footer-grid {
    display: grid;
    gap: 28px;
}

/* Default desktop yang masih aman */
.detail-grid,
.blog-content-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.blog-grid,
.regular-grid,
.service-grid,
.card-grid,
.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* Card image */
.blog-card img,
.regular-card img,
.service-card img,
.article-card img,
.featured-media img,
.blog-detail-cover {
    width: 100%;
    object-fit: cover;
}

/* Form global */
input,
select,
textarea,
button {
    max-width: 100%;
}

input,
select,
textarea {
    font-size: 16px;
}

/* Button wrapping */
.btn,
.btn-primary,
.btn-secondary,
.full-btn,
.banner-btn-light,
.banner-btn-outline {
    max-width: 100%;
    text-align: center;
    white-space: normal;
}

/* =========================================================
   Tablet
========================================================= */
@media (max-width: 1200px) {
    .container {
        width: min(100% - 32px, 1040px);
    }

    .blog-grid,
    .regular-grid,
    .service-grid,
    .card-grid,
    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .featured-slide {
        grid-template-columns: 1fr !important;
    }

    .featured-media {
        min-height: 340px !important;
    }

    .blog-banner {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 992px) {
    .detail-grid,
    .blog-content-grid,
    .service-detail-grid,
    .contact-grid,
    .about-grid,
    .home-grid,
    .footer-grid {
        grid-template-columns: 1fr !important;
    }

    .detail-sidebar,
    .blog-sidebar {
        width: 100%;
    }

    .sidebar-card {
        width: 100%;
    }

    .page-hero,
    .blog-hero {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .section {
        padding-top: 56px;
        padding-bottom: 56px;
    }

    .featured-wrapper,
    .regular-wrapper,
    .sidebar-card,
    .blog-banner {
        border-radius: 22px !important;
    }
}

/* =========================================================
   Mobile
========================================================= */
@media (max-width: 768px) {
    .container {
        width: calc(100% - 24px);
    }

    .topbar,
    .header-top,
    .site-topbar {
        font-size: 12px;
    }

    .page-hero,
    .blog-hero {
        padding-top: 58px;
        padding-bottom: 58px;
        text-align: left;
    }

    .page-hero h1,
    .blog-hero h1 {
        font-size: clamp(34px, 11vw, 46px);
    }

    .page-hero p,
    .blog-hero p {
        font-size: 15px;
    }

    .section {
        padding-top: 44px;
        padding-bottom: 44px;
    }

    .section-heading,
    .section-head {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
    }

    .section-heading h2,
    .section-head h2 {
        font-size: 28px !important;
        line-height: 1.2;
    }

    .blog-grid,
    .regular-grid,
    .service-grid,
    .card-grid,
    .article-grid,
    .stats-grid,
    .feature-grid {
        grid-template-columns: 1fr !important;
        gap: 18px;
    }

    .blog-card,
    .regular-card,
    .service-card,
    .article-card,
    .sidebar-card,
    .regular-wrapper,
    .featured-wrapper {
        border-radius: 18px !important;
    }

    .featured-content {
        padding: 26px 20px !important;
    }

    .featured-content h3 {
        font-size: 28px !important;
    }

    .featured-media {
        min-height: 240px !important;
    }

    .blog-banner {
        padding: 26px 20px !important;
    }

    .blog-banner h3 {
        font-size: 26px !important;
    }

    .blog-banner-actions,
    .featured-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .banner-btn-light,
    .banner-btn-outline,
    .btn-featured-primary,
    .btn-featured-outline {
        width: 100%;
    }

    .regular-media,
    .blog-card-image,
    .article-card-image {
        height: 220px !important;
    }

    .blog-detail-cover {
        border-radius: 18px;
    }

    .blog-gallery-slide {
        height: 240px !important;
    }

    .blog-gallery-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 24px !important;
    }

    .sidebar-card form {
        flex-direction: column !important;
    }

    .sidebar-card input,
    .sidebar-card button {
        width: 100% !important;
    }

    .category-item {
        padding: 12px 14px;
    }

    .table-responsive,
    .responsive-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table,
    .responsive-table table {
        min-width: 720px;
    }
}

/* =========================================================
   Small Mobile
========================================================= */
@media (max-width: 480px) {
    .container {
        width: calc(100% - 20px);
    }

    .page-hero,
    .blog-hero {
        padding-top: 48px;
        padding-bottom: 48px;
    }

    .page-hero h1,
    .blog-hero h1 {
        font-size: 34px;
    }

    .section-heading h2,
    .section-head h2 {
        font-size: 25px !important;
    }

    .featured-content h3,
    .regular-card h3,
    .blog-card h3 {
        font-size: 23px !important;
    }

    .featured-media,
    .regular-media,
    .blog-card-image,
    .article-card-image {
        height: 210px !important;
        min-height: 210px !important;
    }

    .featured-wrapper,
    .regular-wrapper {
        padding: 16px !important;
    }

    .regular-body {
        padding: 18px !important;
    }

    .blog-banner h3 {
        font-size: 23px !important;
    }

    .blog-gallery-slide {
        height: 210px !important;
    }
}

.mobile-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #edf4ff;
    padding: 10px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #0d4c9d;
    border-radius: 999px;
    margin: 5px 0;
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: inline-block;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(320px, 86vw);
        height: 100vh;
        background: #ffffff;
        z-index: 9999;
        padding: 90px 24px 24px;
        box-shadow: -18px 0 50px rgba(10, 33, 74, .16);
        transition: right .28s ease;
        overflow-y: auto;
    }

    .main-nav.is-open {
        right: 0;
    }

    .main-nav ul,
    .main-nav .nav-menu {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .main-nav a {
        display: block;
        width: 100%;
        padding: 12px 14px;
        border-radius: 12px;
    }

    .main-nav a:hover,
    .main-nav a.active {
        background: #edf4ff;
    }

    body.menu-open {
        overflow: hidden;
    }
}