/* ==========================================================================
   Hanioo Frontend - Responsive Layout Configuration
   Precision desktop-first breakpoints covering:
   - Mobile Phones: 320px, 360px, 375px, 390px, 414px, 430px, 480px
   - Tablets: 600px, 640px, 768px, 820px, 900px, 1024px
   - Laptops & Desktops: 1024px, 1280px, 1366px, 1440px, 1600px, 1920px
   ========================================================================== */

/* ---------- Global Overflow Safeguards ---------- */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

p, h1, h2, h3, h4, h5, h6, span, a, li {
    overflow-wrap: break-word;
}

/* ==========================================================================
   1. LAPTOPS & DESKTOPS (<= 1100px)
   ========================================================================== */
@media (max-width: 1100px) {
    .site-header__inner {
        gap: var(--space-3);
    }

    .site-nav__list a {
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }

    .site-nav__actions {
        gap: var(--space-2);
    }

    .lang-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .card-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer__grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==========================================================================
   2. TABLETS & SMALL LAPTOPS (<= 992px)
   ========================================================================== */
@media (max-width: 992px) {
    .section {
        padding-block: var(--space-7);
    }

    .site-header {
        position: sticky;
        top: 0;
        z-index: 10000;
    }

    .site-header__inner {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .brand {
        display: inline-flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }

    .brand img {
        max-height: 42px !important;
        width: auto !important;
    }

    /* Mobile / Tablet Navigation Toggle */
    .nav-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
        width: 44px !important;
        height: 44px !important;
        background: #ffffff !important;
        border: 1.5px solid #1769aa !important;
        border-radius: 10px !important;
        color: #1769aa !important;
        box-shadow: 0 2px 8px rgba(23, 105, 170, 0.12) !important;
    }

    .nav-toggle[aria-expanded="true"] {
        background: #1769aa !important;
        border-color: #1769aa !important;
        color: #ffffff !important;
        box-shadow: 0 4px 14px rgba(23, 105, 170, 0.3) !important;
    }

    .site-nav {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        width: 100%;
        z-index: 10000;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
        padding: 16px 20px 24px;
        background: #ffffff;
        border-top: 1px solid #edf2f7;
        border-bottom: 2px solid #1769aa;
        box-shadow: 0 16px 36px rgba(15, 27, 51, 0.14);
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .site-nav.is-open {
        display: flex !important;
        animation: hnNavSlideDown 0.22s ease-out;
    }

    .site-nav__list {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 6px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .site-nav__list li {
        width: 100%;
        list-style: none;
    }

    .site-nav__list a {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        font-size: 1.02rem;
        font-weight: 600;
        color: #1e293b;
        border-radius: 10px;
        transition: background 0.18s ease, color 0.18s ease;
    }

    .site-nav__list a:hover {
        background: #f1f5f9;
        color: #1769aa;
    }

    .site-nav__list a[aria-current="page"] {
        background: #eaf2fc;
        color: #1769aa;
        font-weight: 700;
    }

    .site-nav__actions {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: var(--space-3);
        padding-top: var(--space-3);
        border-top: 1px solid #eef2f6;
        width: 100%;
    }

    .hero__inner {
        grid-template-columns: 1fr !important;
        gap: var(--space-6) !important;
    }

    .hero__visual {
        order: -1;
        margin-bottom: var(--space-4);
    }

    .card-grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lang-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .detail,
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .stats__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dropdown__toggle {
        width: 100%;
        justify-content: space-between;
    }

    .dropdown__menu {
        position: static;
        box-shadow: none;
        margin-top: var(--space-2);
    }
}

/* ==========================================================================
   3. TABLET PORTRAIT (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .container {
        padding-inline: var(--space-4);
    }

    .contact-container {
        grid-template-columns: 1fr !important;
        gap: 36px !important;
    }

    .site-footer .footer__bottom-inner {
        flex-wrap: wrap !important;
        gap: 14px !important;
    }

    .site-footer .footer__copyright {
        white-space: normal !important;
    }

    .hn-service-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .hn-booking-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .service-grid,
    .service-steps {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   4. LARGE & MEDIUM MOBILE PHONES (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
    .container {
        padding-inline: var(--space-4);
    }

    .topbar a,
    .topbar a .icon,
    .topbar__note {
        color: #ffffff !important;
        stroke: #ffffff !important;
    }

    .topbar__note {
        margin-left: 0;
    }

    .topbar__inner {
        gap: var(--space-1) var(--space-4);
    }

    .section {
        padding-block: var(--space-6);
    }

    .page-hero {
        padding-block: var(--space-7) var(--space-6);
    }

    .hero {
        min-height: auto !important;
        padding-block: var(--space-5) var(--space-7) !important;
    }

    /* Floating badges become clean centered static blocks on mobile */
    .float-badge {
        position: static !important;
        margin: 12px auto 0 !important;
        width: 100% !important;
        max-width: 290px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
    }

    .hero__visual {
        flex-direction: column;
        align-items: center;
        padding: var(--space-2);
    }

    .phone {
        width: min(100%, 290px);
    }

    .check-list {
        grid-template-columns: 1fr;
    }

    .card-grid--3,
    .card-grid--4 {
        grid-template-columns: 1fr;
    }

    .lang-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lang-card {
        padding: var(--space-3);
    }

    .lang-card__code {
        width: 38px;
        height: 38px;
    }

    .timeline__item {
        grid-template-columns: 1fr;
        padding: var(--space-4);
    }

    .timeline__marker {
        width: 52px;
        height: 52px;
    }

    .tabs__list {
        display: flex;
        width: 100%;
    }

    .tabs__tab {
        flex: 1;
        padding-inline: var(--space-3);
    }

    .contact-form-card,
    .auth__card,
    .modal__panel {
        padding: var(--space-4);
    }

    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .btn-row .btn {
        flex: 1 1 100%;
    }

    .whatsapp-fab span {
        display: none;
    }

    .whatsapp-fab {
        padding: 0.7rem;
    }
}

/* ==========================================================================
   5. STANDARD MOBILE PHONES (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
    h1, .hero__copy h1 {
        font-size: 1.85rem !important;
        line-height: 1.25 !important;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

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

    .service-hero__actions .btn,
    .btn-row .btn {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }

    .service-nav-bar__list {
        flex-direction: column !important;
    }

    .service-nav-bar__link {
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .site-nav__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hn-store-badge {
        display: inline-flex;
        justify-content: center;
    }

    /* Google reCAPTCHA v2 Scale Override */
    .g-recaptcha {
        transform: scale(0.84);
        transform-origin: 0 0;
        -webkit-transform: scale(0.84);
        -webkit-transform-origin: 0 0;
    }
}

/* ==========================================================================
   6. ULTRA-COMPACT MOBILE PHONES (320px - 360px)
   ========================================================================== */
@media (max-width: 360px) {
    .container {
        padding-inline: 12px !important;
    }

    h1, .hero__copy h1 {
        font-size: 1.65rem !important;
    }

    h2 {
        font-size: 1.35rem !important;
    }

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

    .phone {
        width: 100% !important;
        max-width: 270px !important;
    }

    .phone__call {
        min-height: 220px !important;
    }

    .lang-grid {
        grid-template-columns: 1fr;
    }

    .stats__grid {
        gap: var(--space-4);
    }

    .stats__item dd {
        font-size: 1.35rem;
    }

    .contact-detail {
        padding: 10px !important;
    }

    .contact-detail-icon {
        width: 40px !important;
        height: 40px !important;
        flex: 0 0 40px !important;
    }

    /* Google reCAPTCHA v2 Scale for 320px */
    .g-recaptcha {
        transform: scale(0.74) !important;
        transform-origin: 0 0 !important;
        -webkit-transform: scale(0.74) !important;
        -webkit-transform-origin: 0 0 !important;
    }

    .brand img {
        max-height: 36px !important;
    }

    .nav-toggle {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ---------- Mobile Menu Slide-Down Animation ---------- */
@keyframes hnNavSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
