/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Ensure no horizontal overflow anywhere */
* {
    max-width: 100%;
}

/* ---- Height-based media queries ---- */

@media (max-height: 750px) {
    .hero-cta {
        max-height: 92vh;
        overflow-y: auto;
    }
    .cta-highlight {
        font-size: 1.5rem !important;
    }
}

@media (max-height: 700px) {
    .hero-section {
        padding: 90px 20px 30px !important;
    }
    .hero-cta {
        padding: 15px !important;
        max-height: 90vh;
    }
    .cta-title {
        font-size: 1.4rem !important;
        margin-bottom: 12px !important;
    }
    .cta-highlight {
        font-size: 1.3rem !important;
    }
    .hero-form input,
    .hero-form textarea {
        padding: 6px !important;
        margin-bottom: 8px !important;
        font-size: 0.85rem !important;
    }
    .hero-form textarea {
        min-height: 50px !important;
    }
    .btn-cta {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
    }
    .immediate-enquiry h3 {
        font-size: 0.9rem !important;
        margin-bottom: 8px !important;
    }
    .enquiry-phone,
    .enquiry-email {
        padding: 6px 10px !important;
        margin-bottom: 6px !important;
        font-size: 0.8rem !important;
    }
    .enquiry-phones {
        gap: 6px;
    }
    .enquiry-phones .enquiry-phone {
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
    }
}

@media (max-height: 600px) {
    .hero-section {
        padding: 80px 15px 20px !important;
    }
    .masonry-gallery {
        max-height: 250px !important;
    }
    .hero-cta {
        padding: 12px !important;
        max-height: 88vh;
    }
    .cta-title {
        font-size: 1.2rem !important;
        margin-bottom: 10px !important;
    }
    .cta-highlight {
        font-size: 1.1rem !important;
    }
    .hero-form textarea {
        min-height: 40px !important;
    }
    .immediate-enquiry h3 {
        font-size: 0.85rem !important;
        margin-bottom: 6px !important;
    }
}

@media (max-height: 500px) {
    .hero-section {
        padding: 70px 15px 15px !important;
    }
    .hero-cta {
        padding: 10px !important;
        max-height: 85vh;
    }
    .cta-title {
        font-size: 1.1rem !important;
        margin-bottom: 8px !important;
    }
    .cta-highlight {
        font-size: 1rem !important;
    }
    .hero-form input,
    .hero-form textarea {
        padding: 5px !important;
        margin-bottom: 6px !important;
        font-size: 0.8rem !important;
    }
    .hero-form textarea {
        min-height: 35px !important;
    }
    .btn-cta {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
    .immediate-enquiry h3 {
        font-size: 0.8rem !important;
        margin-bottom: 5px !important;
    }
    .enquiry-phone,
    .enquiry-email {
        padding: 5px 8px !important;
        margin-bottom: 5px !important;
        font-size: 0.75rem !important;
    }
    .enquiry-phones .enquiry-phone {
        padding: 5px 6px !important;
        font-size: 0.7rem !important;
    }
}

/* ---- Width-based media queries (large to small) ---- */

@media (max-width: 1366px) {
    .hero-section {
        padding: 120px 20px 60px !important;
    }
    .hero-left,
    .hero-right {
        flex: 1;
        min-width: 45%;
    }
    .hero-cta {
        padding: 25px !important;
    }
    .cta-title {
        font-size: 1.8rem !important;
        margin-bottom: 20px !important;
    }
    .hero-form input,
    .hero-form textarea {
        font-size: 0.9rem !important;
        padding: 10px !important;
    }
}

/* iPad Pro Portrait */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: portrait) {
    .container {
        max-width: 95%;
    }
    .hero-section {
        height: 85vh;
    }
    .hero-left {
        width: 55%;
    }
    .hero-right {
        width: 45%;
    }
    .stats-grid {
        max-width: 95%;
    }
    .about-content {
        gap: 3.5rem;
    }
    .industries-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .hero-section {
        flex-direction: column !important;
        padding: 100px 20px 40px !important;
    }
    .hero-left,
    .hero-right {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
    }
    .hero-left {
        margin-bottom: 30px;
    }
    .masonry-gallery {
        max-height: 400px !important;
    }
    .hero-cta {
        max-width: 600px;
        margin: 0 auto;
    }
    .cta-title {
        font-size: 1.6rem !important;
        text-align: center;
    }
    .nav-container {
        padding: 0 15px !important;
    }
    .logo {
        gap: 8px !important;
    }
    .logo-image {
        height: 60px !important;
    }
    .logo-divider {
        height: 45px !important;
    }
    .logo-text-wrapper {
        height: 60px !important;
    }
    .logo-text {
        font-size: 1.1rem !important;
    }
    .logo-tagline {
        font-size: 0.7rem !important;
    }
}

/* Landscape orientation fixes for tablets */
@media (max-width: 1024px) and (orientation: landscape) {
    .hero-section {
        height: auto;
        min-height: 100vh;
    }
    .hero-left {
        height: 70vh;
    }
    .masonry-gallery {
        grid-auto-rows: 23.33vh;
    }
}

/* iPad Pro and Tablets (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-container {
        max-width: 100%;
        padding: 0 2.5rem;
    }
    .logo {
        gap: 1.2rem;
    }
    .logo-image {
        height: 85px;
    }
    .logo-divider {
        height: 65px;
    }
    .logo-text-wrapper {
        height: 85px;
    }
    .logo-text {
        font-size: 1.5rem;
    }
    .logo-tagline {
        font-size: 0.95rem;
    }
    .nav-links {
        gap: 1.5rem;
        margin-bottom: 8px;
    }
    .nav-link {
        padding: 0.5rem 0.8rem;
        font-size: 0.95rem;
    }
    .hero-section {
        margin-top: 110px;
        min-height: calc(100vh - 110px);
    }
    .hero-left {
        width: 60%;
    }
    .hero-right {
        width: 40%;
        padding: 2.5rem;
    }
    .cta-title {
        font-size: 1.8rem;
    }
    .cta-highlight {
        font-size: 2rem;
    }
    .stats-section {
        padding: 50px 0;
    }
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    .stat-box {
        padding: 1.8rem;
    }
    .stat-icon {
        font-size: 2.8rem;
    }
    .stat-value {
        font-size: 3rem;
    }
    .about-section {
        padding: 80px 0;
    }
    .about-content {
        gap: 3rem;
    }
    .about-image-main {
        height: 450px;
    }
    .industries-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    .industry-item {
        padding: 2.2rem 1.8rem;
    }
    .industry-icon {
        font-size: 3.2rem;
    }
}

/* ---- Mobile (768px and below) ---- */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 10px !important;
        width: 100%;
    }
    .logo {
        flex: 1;
        gap: 6px !important;
        margin-left: 20px;
        align-items: flex-end;
    }
    .logo-image {
        height: 50px !important;
    }
    .logo-divider {
        height: 38px !important;
        margin: 0 0.3rem;
        margin-bottom: 0;
    }
    .logo-text-wrapper {
        height: 50px !important;
        padding-bottom: 2px;
    }
    .logo-text {
        font-size: 0.95rem !important;
        line-height: 1.1 !important;
        margin-bottom: 2px;
    }
    .logo-tagline {
        font-size: 0.6rem !important;
        line-height: 1.2 !important;
    }
    .hamburger {
        display: flex;
        z-index: 1003;
        align-self: flex-end;
        margin-bottom: 10px;
    }
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    .nav-links {
        position: fixed;
        top: 92px;
        right: -100%;
        flex-direction: column;
        background-color: #ffffff;
        width: 100%;
        max-width: 300px;
        padding: 2rem;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        gap: 0;
        overflow-y: auto;
        max-height: calc(100vh - 92px);
        z-index: 999;
        align-self: auto;
        margin-bottom: 0;
    }
    .nav-links.active {
        right: 0;
    }
    .nav-links li {
        width: 100%;
        margin-bottom: 1rem;
    }
    .nav-link {
        display: block;
        width: 100%;
        text-align: left;
        padding: 1rem;
        position: relative;
    }
    .nav-link::after {
        left: 1rem;
        transform: none;
        bottom: 0.5rem;
    }
    .nav-link:hover::after,
    .nav-link.active::after {
        width: 50%;
    }

    /* Hero */
    .hero-section {
        flex-direction: column;
        background: #001f3f;
        margin-top: 92px;
        height: auto;
        min-height: calc(100vh - 92px);
        position: relative;
        padding: 90px 15px 30px !important;
    }
    .hero-left {
        width: 100%;
        height: 60vh;
        flex-shrink: 0;
    }
    .hero-left::after {
        width: 100%;
        height: 110%;
        bottom: -5%;
        background: linear-gradient(to bottom, 
            rgba(0, 31, 63, 0) 0%, 
            rgba(0, 31, 63, 0) 25%,
            rgba(0, 31, 63, 0.2) 50%,
            rgba(0, 31, 63, 0.5) 70%,
            rgba(0, 31, 63, 0.8) 85%,
            rgba(0, 31, 63, 1) 92%,
            rgba(0, 31, 63, 1) 100%);
    }
    .hero-right {
        width: 100%;
        height: auto;
        padding: 2rem 1.5rem;
        margin-top: -10vh;
        position: relative;
        z-index: 20;
    }
    .hero-cta {
        max-width: 100%;
    }
    .cta-title {
        font-size: 1.4rem !important;
        margin-bottom: 1.5rem;
    }
    .cta-highlight {
        font-size: 1.7rem;
    }
    .hero-form {
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }
    .hero-form input,
    .hero-form textarea {
        padding: 0.8rem;
        font-size: 0.85rem !important;
    }
    .btn-cta {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    .immediate-enquiry {
        padding: 1rem;
        margin-top: 15px !important;
    }
    .immediate-enquiry h3 {
        font-size: 0.85rem;
        margin-bottom: 0.8rem;
    }
    .enquiry-phone,
    .enquiry-email {
        font-size: 0.85rem !important;
        padding: 8px 12px !important;
        gap: 0.6rem;
    }
    .enquiry-phones {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .enquiry-phones .enquiry-phone {
        min-width: 100% !important;
        width: 100% !important;
    }
    .masonry-gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 15vh;
        height: 100%;
        max-height: 350px !important;
    }
    .masonry-item:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
    }
    .masonry-item:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }
    .masonry-item:nth-child(3) {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }
    .masonry-item:nth-child(4) {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }
    .masonry-item:nth-child(5) {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
    }
    .masonry-item:nth-child(6) {
        grid-column: 2 / 3;
        grid-row: 4 / 5;
    }

    /* Stats */
    .stats-section {
        padding: 40px 0;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .stat-box {
        padding: 1.5rem;
    }
    .stat-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    .stat-value {
        font-size: 2.5rem;
    }
    .stat-value::after {
        font-size: 1.8rem;
    }
    .stat-rating .stat-value::after {
        font-size: 1.3rem;
    }
    .stat-label {
        font-size: 0.9rem;
    }

    /* About */
    .about-section {
        padding: 60px 0;
    }
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        margin-top: 2rem;
    }
    .about-left {
        max-width: 100%;
    }
    .about-image-main {
        height: 350px;
        width: 100%;
    }
    .about-badge {
        width: 140px;
        height: 140px;
        bottom: -20px;
        right: 20px;
    }
    .badge-content h3 {
        font-size: 2.2rem;
        color: #001f3f;
        margin-bottom: 0.3rem;
    }
    .badge-content p {
        font-size: 0.7rem;
        color: #001f3f;
    }
    .about-right {
        padding-left: 0;
        width: 100%;
    }
    .about-text-content {
        width: 100%;
    }
    .about-text-content h3 {
        font-size: 1.8rem;
    }
    .about-intro {
        font-size: 1.1rem;
    }
    .about-description {
        font-size: 1rem;
    }
    .about-highlights {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        margin-bottom: 2rem;
    }
    .highlight-item {
        padding: 0.5rem 0;
    }
    .highlight-item i {
        font-size: 1.2rem;
    }
    .highlight-item span {
        font-size: 0.95rem;
    }
    .btn-know-more {
        width: 100%;
        justify-content: center;
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    /* Industries */
    .industries-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .industry-item {
        padding: 2rem 1.5rem;
    }
    .industry-icon {
        font-size: 2.8rem;
        margin-bottom: 1rem;
    }
    .industry-item h4 {
        font-size: 1.1rem;
    }
    .industry-item p {
        font-size: 0.85rem;
    }

    /* Crew Portal mobile */
    .crew-portal-btn {
        display: inline-block !important;
        width: auto !important;
        text-align: center !important;
    }
}

/* ---- Small phones (480px) ---- */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 8px !important;
    }
    .logo {
        margin-left: 20px;
        gap: 5px !important;
    }
    .logo-image {
        height: 45px !important;
    }
    .logo-divider {
        height: 35px !important;
        margin-bottom: 0;
    }
    .logo-text-wrapper {
        height: 45px !important;
    }
    .logo-text {
        font-size: 0.85rem !important;
        line-height: 1.1 !important;
        margin-bottom: 2px;
    }
    .logo-tagline {
        font-size: 0.55rem !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .hero-section {
        margin-top: 92px;
        height: auto;
        min-height: calc(100vh - 92px);
    }
    .hero-left {
        height: 55vh;
    }
    .hero-right {
        height: auto;
        padding: 2rem 1rem;
        margin-top: -12vh;
    }
    .cta-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    .cta-highlight {
        font-size: 1.5rem;
    }
    .hero-form {
        gap: 0.7rem;
        margin-bottom: 1rem;
    }
    .enquiry-phone,
    .enquiry-email {
        font-size: 0.8rem;
    }
    .masonry-gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 13.75vh;
        height: 100%;
    }
    .masonry-item:nth-child(1) { grid-column: 1/2; grid-row: 1/3; }
    .masonry-item:nth-child(2) { grid-column: 2/3; grid-row: 1/2; }
    .masonry-item:nth-child(3) { grid-column: 2/3; grid-row: 2/3; }
    .masonry-item:nth-child(4) { grid-column: 1/3; grid-row: 3/4; }
    .masonry-item:nth-child(5) { grid-column: 1/2; grid-row: 4/5; }
    .masonry-item:nth-child(6) { grid-column: 2/3; grid-row: 4/5; }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .stat-box {
        padding: 1.2rem;
    }
    .stat-icon {
        font-size: 2rem;
        margin-bottom: 0.8rem;
    }
    .stat-value {
        font-size: 2rem;
    }
    .stat-value::after {
        font-size: 1.5rem;
    }
    .stat-rating .stat-value::after {
        font-size: 1.1rem;
    }
    .stat-label {
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }

    /* About */
    .about-section {
        padding: 50px 0;
    }
    .about-content {
        gap: 2rem;
        margin-top: 1.5rem;
    }
    .about-image-main {
        height: 280px;
    }
    .about-badge {
        width: 110px;
        height: 110px;
        bottom: -15px;
        right: 15px;
    }
    .badge-content h3 {
        font-size: 1.8rem;
        color: #001f3f;
        margin-bottom: 0.2rem;
    }
    .badge-content p {
        font-size: 0.6rem;
        color: #001f3f;
        letter-spacing: 0.3px;
    }
    .about-text-content h3 {
        font-size: 1.5rem;
    }
    .about-intro {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    .about-description {
        font-size: 0.95rem;
    }
    .highlight-item i {
        font-size: 1.1rem;
    }
    .highlight-item span {
        font-size: 0.9rem;
    }
    .btn-know-more {
        padding: 0.9rem 1.5rem;
        font-size: 0.95rem;
    }

    /* Industries */
    .industries-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .industry-item {
        padding: 1.5rem 1rem;
    }
    .industry-icon {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }
    .industry-item h4 {
        font-size: 1rem;
    }
    .industry-item p {
        font-size: 0.8rem;
    }
}

/* ---- Very Small Devices (400px and below) ---- */
@media (max-width: 400px) {
    .navbar {
        padding: 0.75rem 0;
    }
    .nav-container {
        padding: 0 0.75rem;
    }
    .logo {
        gap: 0.4rem;
        margin-left: 0;
    }
    .logo-image {
        height: 55px;
    }
    .logo-divider {
        height: 42px;
        margin: 0 0.2rem;
        margin-bottom: 0;
    }
    .logo-text-wrapper {
        height: 55px;
        padding-bottom: 1px;
    }
    .logo-text {
        font-size: 0.88rem;
        line-height: 1.1;
        margin-bottom: 1px;
    }
    .logo-tagline {
        font-size: 0.66rem;
        line-height: 1;
    }
    .hamburger {
        margin-bottom: 8px;
    }
    .hamburger span {
        width: 22px;
        height: 2.5px;
    }
    .nav-links {
        top: 77px;
        max-height: calc(100vh - 77px);
    }
    .hero-section {
        margin-top: 77px;
        min-height: calc(100vh - 77px);
    }
    .stats-section {
        padding: 30px 0;
    }
    .stats-grid {
        gap: 0.8rem;
    }
    .stat-box {
        padding: 1rem 0.8rem;
    }
    .stat-icon {
        font-size: 1.8rem;
        margin-bottom: 0.6rem;
    }
    .stat-value {
        font-size: 1.8rem;
    }
    .stat-value::after {
        font-size: 1.3rem;
    }
    .stat-rating .stat-value::after {
        font-size: 1rem;
    }
    .stat-label {
        font-size: 0.75rem;
        letter-spacing: 0.3px;
    }
}

/* ---- Tiny devices (360px) ---- */
@media (max-width: 360px) {
    .nav-container {
        padding: 0 5px !important;
    }
    .logo {
        gap: 4px !important;
    }
    .logo-image {
        height: 40px !important;
    }
    .logo-divider {
        height: 30px !important;
    }
    .logo-text-wrapper {
        height: 40px !important;
    }
    .logo-text {
        font-size: 0.75rem !important;
        line-height: 1 !important;
    }
    .logo-tagline {
        font-size: 0.5rem !important;
        line-height: 1.1 !important;
    }
}
