/**
 * Hero component styles (from Figma node 39:2)
 *
 * @package ASI_Solutions
 */

/* ========================================
   HERO SECTION BACKGROUND
   Based on Figma design node 39:2
   ======================================== */

.hero {
    position: relative;
    display: block;
    width: 100%;
    background: #131F35;
    overflow: hidden;
    margin-top: -200px; /* Further increased to completely eliminate gap */
    padding-top: 200px; /* Increased to maintain content positioning */
    z-index: 1;
}

.hero__inner {
    position: relative;
    max-width: 1920px;
    margin: 0 auto;
    min-height: 100vh;
    padding: calc(var(--spacing-16) + 60px) var(--spacing-8) var(--spacing-24); /* Added 60px to top padding */
    display: flex;
    align-items: stretch;
}

/* Limit hero height on larger screens to prevent excessive spacing */
@media (min-width: 1025px) {
    .hero__inner {
        min-height: 80vh; /* Reduce to 80% of viewport height on desktop */
    }
}

@media (min-width: 1440px) {
    .hero__inner {
        min-height: 70vh; /* Further reduce to 70% on very large screens */
    }
}

.hero__background {
    position: absolute;
    inset: 0;
    pointer-events: none;
    max-width: 1640px; /* Match testimonials container width */
    left: 50%;
    transform: translateX(-50%);
}

.hero__layer {
    position: absolute;
    inset: 0;
}

.hero__layer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.hero__layer--gradient-left {
    top: -220px;
    left: -25%;
    width: 780px;
    height: 780px;
    filter: blur(12px);
}

.hero__layer--gradient-bottom {
    bottom: -120px;
    left: 0;
    width: 100%;
    height: 520px;
    filter: blur(30px);
}

.hero__layer--grid {
    top: 10%;
    left: 6%;
    width: 520px;
    height: 520px;
    opacity: 0.7;
}

.hero__layer--halo {
    mix-blend-mode: screen;
    opacity: 0.85;
}

.hero__layer--halo-large {
    top: -6%;
    right: 14%;
    width: 800px;
    height: 800px;
}

.hero__layer--halo-medium {
    top: 18%;
    right: 22%;
    width: 520px;
    height: 520px;
}

.hero__layer--halo-small {
    top: 32%;
    right: 28%;
    width: 360px;
    height: 360px;
}

.hero__layer--map {
    overflow: hidden;
}

.hero__layer--map-base {
    left: 35%;
    top: -20%;
    width: 900px;
    height: 900px;
}

.hero__layer--map-base img {
    object-fit: cover;
    object-position: center;
    opacity: 0.65;
}

.hero__layer--map-overlay {
    left:47%;
    top: -15%;
    width: 900px;
    height: 900px;
}

.hero__layer--map-overlay img {
    object-fit: contain;
    object-position: center right;
}

.hero__surface {
    position: absolute;
    bottom: -12%;
    left: -5%;
    width: 110%;
    height: 340px;
    border-radius: 50% 50% 0 0;
    background: #131F35;
    filter: blur(18px);
    opacity: 0.9;
}

/* ========================================
   HERO CONTENT STYLES
   ======================================== */

.hero__content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    max-width: 1640px; /* Match testimonials container width */
    width: calc(100% - 72px); /* Match header width calculation */
    margin: 0 auto; /* Center like header */
    padding: var(--spacing-8) 20px; /* Match header container padding */
    margin-top: -60px;
}

.hero__text {
    margin-bottom: var(--spacing-12);
    /* Constrain width so text does not overlap the New Zealand map graphic */
    max-width: 520px;
}

.hero__title {
    margin: 0 0 var(--spacing-8) 0;
    line-height: 0.9;
}

.hero__title-line {
    display: block;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); /* 40px → 72px */
    line-height: 1.1;
    word-wrap: break-word;
}

.hero__title-line--1 {
    color: white;
}

.hero__title-line--2 {
    color: #41C16A;
}

.hero__title-line--3 {
    color: white;
}

.hero__subtitle {
    margin-bottom: var(--spacing-8);
}

.hero__subtitle-line {
    display: block;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 0.875rem + 0.5vw, 1.125rem); /* 16px → 18px */
    line-height: 1.5;
    text-transform: uppercase;
    word-wrap: break-word;
}

.hero__subtitle-line--1 {
    color: #40B45F;
}

.hero__subtitle-line--2 {
    color: white;
}

.hero__description {
    color: #9EAFC6;
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: clamp(0.875rem, 0.8125rem + 0.25vw, 1rem); /* 14px → 16px */
    line-height: 1.6;
    word-wrap: break-word;
    margin: 0 0 var(--spacing-8) 0;
}

.hero__cta {
    margin-bottom: var(--spacing-8);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-4);
    align-items: center;
}

.hero__button {
    display: inline-block;
    background-color: #41C16A;
    color: black;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem); /* 12px → 14px */
    text-transform: uppercase;
    letter-spacing: 0.42px;
    word-wrap: break-word;
    padding: var(--spacing-4) var(--spacing-8);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all 0.3s ease;
}

.hero__button:hover {
    background-color: #40B45F;
    transform: translateY(-2px);
}

.hero__button--secondary {
    background-color: transparent;
    color: #F0F3F8;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.hero__button--secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.5);
    color: #FFFFFF;
}

/* Responsive styles for hero content */
@media (max-width: 1280px) {
    /* Font sizes now handled by fluid typography */
}

@media (max-width: 992px) {
    .hero__title-line {
        margin-bottom: var(--spacing-2);
    }

    .hero__subtitle-line {
        margin-bottom: var(--spacing-1);
    }

    .hero__description {
        margin-bottom: var(--spacing-6);
    }

    .hero__button {
        padding: var(--spacing-4) var(--spacing-6);
        min-height: 48px;
    }
}

@media (max-width: 768px) {
    .hero__title-line {
        margin-bottom: var(--spacing-2);
    }

    .hero__subtitle-line {
        margin-bottom: var(--spacing-1);
    }

    .hero__description {
        margin-bottom: var(--spacing-6);
    }
    
    .hero__content {
        max-width: 100%;
        width: calc(100% - 40px); /* Match header mobile width calculation */
        margin: 0 auto; /* Center like header */
        padding: var(--spacing-8) 16px; /* Match header mobile container padding */
    }

    .hero__button {
        padding: var(--spacing-4) var(--spacing-6);
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .hero__title-line {
        margin-bottom: var(--spacing-2);
        font-weight: 600;
        letter-spacing: -1.76px;
    }

    .hero__title-line--1 {
        color: white;
    }

    .hero__title-line--2 {
        color: #f0f3f8;
    }

    .hero__title-line--3 {
        color: #40b45f;
    }

    .hero__subtitle-line {
        margin-bottom: var(--spacing-1);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: -0.72px;
    }

    .hero__subtitle-line--1 {
        color: #40b45f;
    }

    .hero__subtitle-line--2 {
        color: white;
    }

    .hero__description {
        margin-bottom: var(--spacing-6);
        color: #9EAFC6;
    }
    
    .hero__button {
        font-weight: 600;
        padding: var(--spacing-4) var(--spacing-6);
        min-height: 44px;
        background-color: #42b45f;
        color: black;
        text-transform: uppercase;
        letter-spacing: 0.42px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-lg);
        transition: all 0.2s ease;
        text-decoration: none;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        white-space: normal;
        line-height: 1.25;
        text-align: center;
        margin: 0 auto;
        margin-top: var(--spacing-4);
    }

    .hero__button:active {
        transform: translateY(1px);
        background-color: #40B45F;
    }

    /* Mobile-specific layout improvements */
    .hero__content {
        text-align: center;
        padding: var(--spacing-8) var(--spacing-4);
    }

    .hero__title {
        margin-bottom: var(--spacing-6);
    }

    .hero__subtitle {
        margin-bottom: var(--spacing-6);
    }

    /* Improve text readability on mobile */
    .hero__title-line--1,
    .hero__title-line--2,
    .hero__title-line--3 {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .hero__subtitle-line--1,
    .hero__subtitle-line--2 {
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }

    .hero__description {
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 1280px) {
    .hero__inner {
        min-height: 100vh;
        padding: calc(var(--spacing-12) + 40px) var(--spacing-6) var(--spacing-20); /* Added 40px to top padding for tablet */
    }

    .hero__layer--map-base {
        left: 42%;
        top: -15%;
        width: 700px;
        height: 700px;
    }

    .hero__layer--map-overlay {
        left: 42%;
        top: -15%;
        width: 700px;
        height: 700px;
    }

    .hero__layer--halo-large {
        right: 0;
    }

    .hero__text {
        max-width: 460px;
    }
}

@media (max-width: 992px) {
    .hero__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-12);
        min-height: 100vh;
    }

    .hero__layer--map-base {
        left: 48%;
        top: -10%;
        width: 600px;
        height: 600px;
    }

    .hero__layer--map-overlay {
        left: 48%;
        top: -10%;
        width: 600px;
        height: 600px;
    }

    .hero__text {
        max-width: 420px;
    }

    .hero__layer--grid {
        left: 0;
        top: 12%;
        width: 440px;
        height: 440px;
    }
}

@media (max-width: 768px) {
    .hero {
        margin-top: -180px; /* Adjusted for mobile header positioning */
        padding-top: 180px;
    }
    
    .hero__inner {
        min-height: 100vh;
        padding: calc(var(--spacing-10) + 30px) var(--spacing-5) var(--spacing-16); /* Added 30px to top padding for mobile */
    }

    .hero__layer--gradient-left {
        top: -140px;
        left: -40%;
        width: 540px;
        height: 540px;
    }

    .hero__layer--map-base {
        left: 52%;
        top: -5%;
        width: 500px;
        height: 500px;
        opacity: 0.7;
    }

    .hero__layer--map-overlay {
        left: 52%;
        top: -5%;
        width: 500px;
        height: 500px;
        opacity: 0.7;
    }

    .hero__text {
        max-width: 380px;
    }

    .hero__layer--halo-large,
    .hero__layer--halo-medium,
    .hero__layer--halo-small {
        opacity: 0.6;
    }
}

@media (max-width: 480px) {
    .hero__inner {
        min-height: 100vh;
        padding: var(--spacing-12) var(--spacing-4) var(--spacing-16);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .hero__content {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
        text-align: center;
    }

    .hero__text {
        margin-bottom: var(--spacing-8);
    }

    .hero__title {
        margin-bottom: var(--spacing-6);
    }

    .hero__subtitle {
        margin-bottom: var(--spacing-6);
    }

    .hero__layer--grid {
        display: none;
    }

    .hero__layer--map-base {
        display: none;
    }

    .hero__layer--map-overlay {
        display: none;
    }

    .hero__layer--halo-large,
    .hero__layer--halo-medium,
    .hero__layer--halo-small {
        opacity: 0.3;
    }

    .hero__layer--gradient-left {
        top: -100px;
        left: -50%;
        width: 300px;
        height: 300px;
    }

    .hero__layer--gradient-bottom {
        bottom: -50px;
        height: 200px;
    }

    .hero__surface {
        bottom: -16%;
        height: 280px;
        background: #131F35;
    }
}

/* ========================================
   MOBILE MAP STYLES
   ======================================== */

/* Mobile map - hidden by default */
.hero__mobile-map {
    display: none;
}

/* Show mobile map only on small screens */
@media (max-width: 480px) {
    .hero__mobile-map {
        display: block;
        position: relative;
        width: 100%;
        max-width: 400px;
        height: 300px; /* Set explicit height for proper display */
        margin: var(--spacing-8) auto 0;
        border-radius: var(--radius-lg);
        overflow: hidden;
    }
    
    /* Use pseudo-elements with background-image to reference same URLs as background images */
    /* This allows browser to reuse cached images from the background layer */
    .hero__mobile-map::before,
    .hero__mobile-map::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    /* Base map layer - uses CSS custom property set inline */
    .hero__mobile-map::before {
        background-image: var(--map-base-url);
        opacity: 0.65;
        z-index: 1;
    }
    
    /* Overlay map layer - uses CSS custom property set inline */
    .hero__mobile-map::after {
        background-image: var(--map-overlay-url);
        z-index: 2;
    }
}
