/*
 * Sunflower Life Insurance - Responsive repair patch
 * Load this file AFTER assets/css/style.css and any page-specific styles.
 * Tested as a defensive mobile-first override for 360px, 375px, 390px,
 * tablet and desktop layouts.
 */

/* Global overflow and media safety */
html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
}
body {
    width: 100%;
    max-width: 100%;
    min-width: 320px;
    overflow-x: clip;
}
*, *::before, *::after { box-sizing: border-box; }
img, svg, video, canvas, iframe {
    max-width: 100%;
}
img { height: auto; }
iframe, video { display: block; }
.container, .container-fluid {
    min-width: 0;
}
.row {
    --bs-gutter-x: 1.5rem;
}
.row > * { min-width: 0; }
p, h1, h2, h3, h4, h5, h6, a, button, label, small, strong, span {
    overflow-wrap: anywhere;
}
pre, code { white-space: pre-wrap; }

/* Header and navigation */
.site-header { z-index: 1030; }
.site-header .navbar {
    min-height: 76px;
}
.site-header .navbar > .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.site-header .brand-banner-lockup {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(48vw, 480px);
}
.site-header .site-brand-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 68px;
    object-fit: contain;
    object-position: left center;
}
.site-header .navbar-toggler {
    flex: 0 0 auto;
    padding: .45rem .65rem;
    border: 1px solid rgba(38, 51, 45, .22);
    box-shadow: none;
}
.site-header .navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(22, 132, 71, .15);
}
.site-header .navbar-collapse {
    min-width: 0;
}
.site-header .navbar-nav {
    min-width: 0;
}
.site-header .nav-item {
    min-width: 0;
}
.site-header .nav-link {
    white-space: normal;
}
.topbar .container {
    min-width: 0;
}
.topbar-left, .topbar-right {
    min-width: 0;
    flex-wrap: wrap;
}
.topbar a { overflow-wrap: normal; }

/* Common sections, cards, forms and tables */
section, main, footer, header {
    min-width: 0;
}
.card, .product-card, .service-card, .info-card, .news-card,
.calculator-card, .contact-form-card, .branch-card, .notice-row {
    min-width: 0;
    max-width: 100%;
}
input, select, textarea, button {
    max-width: 100%;
}
.form-control, .form-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    font-size: 16px; /* prevents iOS focus zoom */
}
textarea.form-control { min-height: 120px; }
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table { max-width: 100%; }
.btn, .btn-primary-custom, .btn-outline-custom {
    white-space: normal;
    line-height: 1.35;
}
.section-padding { min-width: 0; }
.footer-bottom, .footer-bottom div {
    min-width: 0;
    flex-wrap: wrap;
}
.footer-contact { overflow-wrap: anywhere; }

/* Floating quick links / action buttons */
.floating-actions, .floating-buttons, .quick-floating-actions {
    max-width: calc(100vw - 20px);
}
.floating-actions a, .floating-buttons a, .quick-floating-actions a {
    max-width: 100%;
}

/* Tablet */
@media (max-width: 991.98px) {
    .site-header .navbar { padding: 9px 0; }
    .site-header .brand-banner-lockup {
        max-width: min(72vw, 440px);
        margin-right: auto;
    }
    .site-header .site-brand-banner { max-height: 60px; }
    .site-header .navbar-collapse {
        flex-basis: 100%;
        width: 100%;
        padding: 8px 0 14px;
        border-top: 1px solid rgba(38, 51, 45, .09);
        margin-top: 9px;
    }
    .site-header .navbar-nav {
        align-items: stretch !important;
        gap: 0;
        padding: 5px 0;
    }
    .site-header .navbar-nav .nav-item {
        width: 100%;
        margin-left: 0 !important;
    }
    .site-header .navbar-nav .nav-link {
        display: block;
        width: 100%;
        padding: 11px 5px !important;
        border-bottom: 1px solid rgba(38, 51, 45, .07);
        font-size: 14px;
    }
    .site-header .navbar-nav .btn-nav {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        margin: 12px 0 0;
    }
    .site-header .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        min-width: 0;
        margin: 0 0 8px;
        border-radius: 8px;
        box-shadow: none;
        transform: none !important;
    }
    .hero-section.hero-slider,
    .hero-section.hero-slider .hero-slides,
    .hero-section.hero-slider .hero-slide {
        min-height: 560px;
    }
    .hero-section.hero-slider .hero-slide .min-vh-hero {
        min-height: 560px;
        padding: 48px 28px 105px;
    }
    .hero-section.hero-slider .hero-copy {
        max-width: 720px;
        padding: 15px 8px;
    }
    .portal-panel {
        grid-template-columns: 34% 66%;
    }
    .portal-copy { padding: 35px 28px; }
    .footer-cta-inner { gap: 22px; }
}

/* Phones */
@media (max-width: 767.98px) {
    .container, .container-fluid {
        padding-left: 18px;
        padding-right: 18px;
    }
    .topbar { padding: 7px 0; }
    .topbar .container {
        gap: 7px;
        align-items: center;
    }
    .topbar-left, .topbar-right {
        gap: 7px 10px;
        font-size: 10px;
        line-height: 1.4;
    }
    .topbar-right { justify-content: flex-end; }
    .top-social { display: none; }

    .site-header .navbar { min-height: 66px; }
    .site-header .brand-banner-lockup {
        max-width: calc(100% - 64px);
    }
    .site-header .site-brand-banner {
        max-height: 48px;
        object-position: left center;
    }
    .site-header .navbar-toggler {
        padding: .35rem .55rem;
        font-size: 1rem;
    }

    .hero-section.hero-slider,
    .hero-section.hero-slider .hero-slides,
    .hero-section.hero-slider .hero-slide {
        min-height: 570px;
    }
    .hero-section.hero-slider .hero-slide .min-vh-hero {
        display: flex;
        align-items: center;
        min-height: 570px;
        padding: 42px 18px 108px;
    }
    .hero-section.hero-slider .hero-copy {
        width: 100%;
        max-width: 100%;
        padding: 8px 0;
    }
    .hero-section.hero-slider .hero-copy h1 {
        max-width: 100%;
        margin: 16px 0;
        font-size: clamp(34px, 9vw, 46px);
        line-height: 1.12;
        letter-spacing: -.6px;
    }
    .hero-section.hero-slider .hero-copy .eyebrow {
        font-size: 9px;
        letter-spacing: 1.2px;
    }
    .hero-section.hero-slider .hero-lead {
        max-width: 100%;
        font-size: 14px;
        line-height: 1.7;
    }
    .hero-section.hero-slider .hero-copy .d-flex {
        gap: 10px !important;
    }
    .hero-section.hero-slider .hero-copy .btn {
        min-height: 44px;
        padding: 11px 14px;
        font-size: 12px;
    }
    .hero-section.hero-slider .hero-trust {
        gap: 9px;
        margin-top: 22px;
    }
    .hero-section.hero-slider .hero-trust strong { font-size: 11px; }
    .hero-section.hero-slider .hero-trust small { font-size: 10px; }
    .hero-section.hero-slider .hero-slider-controls {
        left: 18px;
        right: 18px;
        bottom: 19px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .hero-section.hero-slider .hero-slider-arrows button {
        width: 34px;
        height: 34px;
    }

    .section-padding { padding: 52px 0; }
    .section-heading h2, .section-heading-row h2,
    .why-section h2, .calculator-section h2 {
        font-size: clamp(27px, 7vw, 34px);
        line-height: 1.2;
    }
    .section-heading p, .section-intro { font-size: 14px; }
    .product-card, .product-card-large, .service-card, .info-card {
        padding: 21px 18px;
    }
    .product-card p { min-height: 0; }
    .product-card h3 { font-size: 19px; }
    .product-card-large h3 { font-size: 22px; }
    .calculator-card, .contact-form-card { padding: 20px 16px; }
    .calc-card-head { gap: 12px; }
    .calc-card-head h3 { font-size: 18px; }
    .why-image {
        height: 270px;
        margin: 0 8px 15px 0;
    }
    .why-image-badge {
        right: -8px;
        bottom: 12px;
        max-width: 85%;
        padding: 10px 12px;
        font-size: 10px;
    }
    .why-grid {
        grid-template-columns: 1fr;
        gap: 17px;
    }
    .portal-panel { grid-template-columns: 1fr; }
    .portal-art { min-height: 155px; }
    .portal-copy { padding: 25px 20px 28px; }
    .portal-copy h2 { font-size: 27px; }
    .portal-copy .btn { white-space: normal; }
    .news-image { height: 155px; }
    .news-body { padding: 17px; }
    .news-body h3 { min-height: 0; }
    .footer-cta { padding: 32px 0; }
    .footer-cta-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }
    .footer-cta h2 { font-size: 24px; }
    .site-footer { padding: 45px 0 18px; }
    .site-footer .row { row-gap: 28px !important; }
    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        margin-top: 28px;
        font-size: 10px;
    }
    .footer-bottom div { gap: 12px; }
    .page-hero { padding: 42px 0 32px; }
    .page-hero h1 {
        font-size: clamp(30px, 8vw, 39px);
        line-height: 1.15;
    }
    .page-hero p { font-size: 13px; }
    .breadcrumb-line { flex-wrap: wrap; }
    .about-photo { height: 260px; }
    .notice-row { gap: 13px; padding: 16px; }
    .notice-row h3 { font-size: 15px; }
    .branch-card { padding: 22px 18px; }
    .map-placeholder { min-height: 250px; }
    .contact-detail { align-items: flex-start; }
}

/* Narrow phones: 360px and below */
@media (max-width: 390px) {
    .container, .container-fluid {
        padding-left: 14px;
        padding-right: 14px;
    }
    .topbar .container { flex-wrap: wrap; }
    .topbar-left, .topbar-right { font-size: 9px; }
    .site-header .site-brand-banner { max-height: 43px; }
    .hero-section.hero-slider,
    .hero-section.hero-slider .hero-slides,
    .hero-section.hero-slider .hero-slide,
    .hero-section.hero-slider .hero-slide .min-vh-hero {
        min-height: 590px;
    }
    .hero-section.hero-slider .hero-slide .min-vh-hero {
        padding: 35px 14px 105px;
    }
    .hero-section.hero-slider .hero-copy h1 {
        font-size: clamp(32px, 8.8vw, 37px);
    }
    .hero-section.hero-slider .hero-copy .btn {
        padding: 10px 11px;
        font-size: 11px;
    }
    .hero-section.hero-slider .hero-slider-controls {
        left: 14px;
        right: 14px;
    }
    .calculator-card, .contact-form-card { padding: 17px 14px; }
    .footer-bottom div { flex-wrap: wrap; }
}

/* Landscape phone and reduced motion */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section.hero-slider,
    .hero-section.hero-slider .hero-slides,
    .hero-section.hero-slider .hero-slide,
    .hero-section.hero-slider .hero-slide .min-vh-hero {
        min-height: 500px;
    }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
