/**
 * IKIM Hero Block Styles
 */

.ikim-hero-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 500px;
    overflow: hidden;
    background-color: #f8f9fa; /* Default light gray */
    margin: 0;
}

/* Background image styling */
.ikim-hero-section.background-image {
    background-size: cover;
    background-position: center; /* Default fallback */
    background-repeat: no-repeat;
}

/* Background position will be set via inline styles but ensure fallback */
.ikim-hero-section[data-background-position] {
    background-position: var(--bg-position, center);
}

/* Background color styling */
.ikim-hero-section.background-color {
    background-image: none;
}

/* Background video styling */
.ikim-hero-section.background-video {
    background-color: #000;
}

.hero-background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Apply opacity from data attribute for frontend */
.ikim-hero-section[data-media-opacity] .hero-background-video,
.ikim-hero-section[data-media-opacity] .hero-image-side img,
.ikim-hero-section[data-media-opacity] .hero-image-side video,
.ikim-hero-section[data-media-opacity] .hero-side-video {
    opacity: var(--media-opacity, 1);
}

/* No background styling */
.ikim-hero-section.background-none {
    background: transparent;
}

/* Overlay for background images and videos */
.ikim-hero-section.background-image::before,
.ikim-hero-section.background-video::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.ikim-hero-section.background-image .hero-content,
.ikim-hero-section.background-video .hero-content {
    position: relative;
    z-index: 2;
    color: white;
}

/* Hero content container */
.hero-content {
    max-width: 800px;
    width: 100%;
    text-align: inherit;
    position: relative;
    z-index: 2;
}

/* Adjust vertical positioning when no CTA is present to fill the space better */
.ikim-hero-section:has(.hero-content:not(:has(.hero-cta))) {
    align-items: flex-end;
    padding-bottom: 6rem;
}

.hero-content:not(:has(.hero-cta)) {
    margin-bottom: 0;
}

/* Box Shadow Options */
.ikim-hero-section.shadow-none {
    box-shadow: none !important;
}

.ikim-hero-section.shadow-small {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.ikim-hero-section.shadow-medium {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.ikim-hero-section.shadow-large {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

/* Side by side layout */
.ikim-hero-section.layout-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: stretch;
    padding: 0;
    margin: 0;
    min-height: 400px;
}

.ikim-hero-section.layout-side-by-side .hero-content {
    max-width: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    text-align: left;
    min-height: 400px;
}

.ikim-hero-section.layout-side-by-side .hero-image-side {
    width: 100%;
    height: 100%;
    min-height: 400px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.ikim-hero-section.layout-side-by-side .hero-image-side img,
.ikim-hero-section.layout-side-by-side .hero-image-side video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 0;
    margin: 0;
    padding: 0;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* Side video specific styles */
.hero-side-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Centered layout */
.ikim-hero-section.layout-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

/* Hero title styling */
.hero-title {
    font-family: var(--font-heading, 'Montserrat', sans-serif);
    font-weight: 700;
    margin: 0 0 1rem 0;
    line-height: 1.2;
    color: inherit;
}

/* Unified font size system (Tailwind-inspired) */
/* Applied to both title and subtitle */
.hero-title.title-xs,
.hero-subtitle.subtitle-xs {
    font-size: 0.75rem !important; /* 12px */
}
.hero-title.title-sm,
.hero-subtitle.subtitle-sm {
    font-size: 0.875rem !important; /* 14px */
}
.hero-title.title-medium,
.hero-subtitle.subtitle-medium {
    font-size: 1rem !important; /* 16px */
}
.hero-title.title-lg,
.hero-subtitle.subtitle-lg {
    font-size: 1.125rem !important; /* 18px */
}
.hero-title.title-xl,
.hero-subtitle.subtitle-xl {
    font-size: 1.25rem !important; /* 20px */
}
.hero-title.title-2xl,
.hero-subtitle.subtitle-2xl {
    font-size: 1.5rem !important; /* 24px */
}
.hero-title.title-3xl,
.hero-subtitle.subtitle-3xl {
    font-size: 1.875rem !important; /* 30px */
}
.hero-title.title-4xl,
.hero-subtitle.subtitle-4xl {
    font-size: 2.25rem !important; /* 36px */
}
.hero-title.title-5xl,
.hero-subtitle.subtitle-5xl {
    font-size: 3rem !important; /* 48px */
}

/* Hero subtitle styling */
.hero-subtitle {
    font-family: var(--font-primary, 'Inter', sans-serif);
    font-weight: 300;
    margin: 0 0 2rem 0;
    line-height: 1.5;
    color: inherit;
}

/* Side-by-side specific title and subtitle styling */
.ikim-hero-section.layout-side-by-side .hero-title {
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

/* Default font size for side-by-side only if no inline style or data attribute */
.ikim-hero-section.layout-side-by-side .hero-title:not([style*="font-size"]) {
    font-size: 2.3rem;
}

.ikim-hero-section.layout-side-by-side .hero-subtitle {
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 90%;
}

/* Default font size for side-by-side only if no inline style or data attribute */
.ikim-hero-section.layout-side-by-side .hero-subtitle:not([style*="font-size"]) {
    font-size: 1.2rem;
}

/* Remove any ::after pseudo-elements that might be causing lines */
.ikim-hero-section .hero-subtitle::after,
.ikim-hero-section h2::after,
.ikim-hero-section p::after {
    display: none !important;
    content: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Hero CTA button styling */
.hero-cta {
    margin-top: 2rem;
}

/* Remove subtitle bottom margin when there's no CTA following it */
.hero-content .hero-subtitle:last-child,
.hero-content > .hero-subtitle:last-of-type {
    margin-bottom: 0 !important;
}

.hero-cta-button {
    background: var(--accent-blue, #002896);
    color: var(--white, #ffffff);
    border: none;
    border-radius: var(--border-radius, 8px);
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: var(--transition, all 0.3s ease);
    cursor: pointer;
    box-shadow: var(--box-shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
    padding: 1rem 2rem;
    font-size: 1.1rem;
    text-align: center;
}

/* Side-by-side CTA button styling */
.ikim-hero-section.layout-side-by-side .hero-cta-button {
    padding: 1.2rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.hero-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.hero-cta-button:focus {
    outline: 2px solid var(--accent-blue, #002896);
    outline-offset: 2px;
}

/* Text alignment variations */
.ikim-hero-section[style*="text-align: left"] .hero-content {
    text-align: left;
}

.ikim-hero-section[style*="text-align: center"] .hero-content {
    text-align: center;
}

.ikim-hero-section[style*="text-align: right"] .hero-content {
    text-align: right;
}

/* Responsive design */
@media (max-width: 768px) {
    .ikim-hero-section {
        padding: 3rem 1.5rem;
        min-height: 400px;
    }
    
    /* Side by side becomes stacked on mobile */
    .ikim-hero-section.layout-side-by-side {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .ikim-hero-section.layout-side-by-side .hero-image-side {
        min-height: 250px;
        order: 1;
    }
    
    .ikim-hero-section.layout-side-by-side .hero-content {
        order: 2;
        padding: 3rem 2rem;
        text-align: center;
    }
    
    .ikim-hero-section.layout-side-by-side .hero-subtitle {
        max-width: 100%;
    }

    /* Responsive font sizes - only if no inline style */
    .ikim-hero-section.layout-side-by-side .hero-title:not([style*="font-size"]) {
        font-size: 2rem;
    }

    .ikim-hero-section.layout-side-by-side .hero-subtitle:not([style*="font-size"]) {
        font-size: 1.1rem;
    }

    .hero-title:not([style*="font-size"]) {
        font-size: 2rem;
    }

    .hero-subtitle:not([style*="font-size"]) {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-cta-button {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .ikim-hero-section {
        padding: 2rem 1rem;
        min-height: 350px;
    }
    
    .ikim-hero-section.layout-side-by-side {
        gap: 1.5rem;
    }
    
    .ikim-hero-section.layout-side-by-side .hero-image-side {
        min-height: 200px;
    }
    
    .hero-title {
        margin-bottom: 0.75rem;
    }

    /* Responsive font sizes - only if no inline style */
    .hero-title:not([style*="font-size"]) {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        margin-bottom: 1.5rem;
    }

    .hero-subtitle:not([style*="font-size"]) {
        font-size: 1rem;
    }
    
    .hero-cta-button {
        font-size: 0.95rem;
        padding: 0.75rem 1.25rem;
    }
}

/* Block editor specific styles */
.wp-block-editor .ikim-hero-section {
    border: 1px dashed #ccc;
    margin: 1rem 0;
}

.wp-block-editor .ikim-hero-section:hover {
    border-color: #007cba;
}

/* Remove height constraints in editor for better editing experience */
.wp-block-editor .ikim-hero-section.layout-side-by-side {
    max-height: none;
    min-height: 400px;
}

.wp-block-editor .ikim-hero-section.layout-side-by-side .hero-content {
    min-height: 300px;
    padding: 3rem 2rem;
}

.wp-block-editor .ikim-hero-section.layout-side-by-side .hero-image-side {
    min-height: 300px;
    max-height: none;
}

.wp-block-editor .ikim-hero-section.layout-side-by-side .hero-image-side img,
.wp-block-editor .ikim-hero-section.layout-side-by-side .hero-image-side video {
    position: relative;
    min-height: 300px;
    max-height: none;
}

/* IKIM brand color presets */
.ikim-hero-section.brand-primary {
    background: linear-gradient(135deg, #002896 0%, #003bb3 100%);
    color: white;
}

.ikim-hero-section.brand-secondary {
    background: linear-gradient(135deg, #002B36 0%, #40464c 100%);
    color: white;
}

.ikim-hero-section.brand-light {
    background: linear-gradient(135deg, #E6F9F7 0%, #52D1DC 100%);
    color: #002B36;
}

/* Accessibility improvements */
.hero-title:focus,
.hero-subtitle:focus,
.hero-description:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ikim-hero-section.background-image::before {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .ikim-hero-section.background-image .hero-content {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ikim-hero-section * {
        animation: none !important;
        transition: none !important;
    }
}

/* Print styles */
@media print {
    .ikim-hero-section {
        background-image: none !important;
        background-color: white !important;
        color: black !important;
        min-height: auto;
        padding: 2rem 0;
    }
    
    .ikim-hero-section::before {
        display: none;
    }
}