/* --- General Responsive Layout --- */

/* Tablets & Below (max-width: 991px) */
@media (max-width: 991px) {
    #navigation_bar .navbar .container {
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }

    .navbar .navbar-brand picture {
        width: clamp(40px, 12vw, 80px);
    }

    /* Offcanvas Styling */
    .offcanvas-end {
        width: 100% !important;
        background-color: var(--primary-color) !important;
        /* Matches Brand Theme */
        border-left: none;
        height: 100vh;
    }

    .offcanvas-header {
        padding: 1.5rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .offcanvas-header .btn-close {
        -webkit-filter: brightness(0) invert(1);
        filter: brightness(0) invert(1);
        font-size: 1.25rem;
        opacity: 0.8;
    }

    .offcanvas-header .navbar-brand img {
        height: 60px;
        /* Clean, proper logo size for mobile */
        width: auto;
    }

    .offcanvas-body {
        padding: 0 !important;
        /* Crucial for full-width borders */
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        height: 100%;
        overflow-x: hidden;
    }

    #navigation_bar .navbar-nav {
        -webkit-box-flex: 1;
        -ms-flex-positive: 1;
        flex-grow: 1;
        width: 100% !important;
        padding: 2.5rem 0 0 0 !important;
        margin: 0 !important;
    }

    #navigation_bar .navbar .nav-item {
        width: 100% !important;
        border-bottom: none;
        /* Removed from item, added to link */
    }

    /* Remove border from the last nav item */
    #navigation_bar .navbar-nav .nav-item:last-child .nav-link {
        border-bottom: none;
    }

    #navigation_bar .navbar .nav-link {
        color: rgba(255, 255, 255, 0.8) !important;
        font-size: 1.1rem;
        font-weight: 500;
        letter-spacing: 0.03em;
        padding: 1.1rem 1.5rem !important;
        /* Balanced padding for better spacing */
        width: 100%;
        -webkit-transition: all 0.3s ease;
        -o-transition: all 0.3s ease;
        transition: all 0.3s ease;
        display: block;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        /* Border on link for cleaner look */
    }

    #navigation_bar .navbar .nav-link:hover,
    #navigation_bar .navbar .nav-link.active {
        color: #fff !important;
        background-color: rgba(255, 255, 255, 0.1);
        -webkit-padding-start: 1.8rem !important;
        padding-inline-start: 1.8rem !important;
    }

    /* Proper Full Pill Action Button */
    #navigation_bar .navbar .main-btn {
        display: -webkit-box !important;
        display: -ms-flexbox !important;
        display: flex !important;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        background-color: var(--white-color) !important;
        width: calc(100% - 3rem) !important;
        padding: 0 !important;
        /* Reset padding on li */
        margin: 2rem 1.5rem !important;
        border-radius: 50px !important;
        overflow: hidden;
        -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        -o-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        -webkit-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important;
        border: none !important;
    }

    #navigation_bar .navbar .main-btn .nav-link {
        color: var(--primary-color) !important;
        width: 100%;
        padding: 1rem 1.5rem !important;
        text-align: center;
        font-weight: 700 !important;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        border-bottom: none !important;
    }

    #navigation_bar .navbar .main-btn:hover {
        background-color: var(--theme-color) !important;
        color: var(--primary-color) !important;
        -webkit-transform: translateY(-3px);
        -ms-transform: translateY(-3px);
        transform: translateY(-3px);
    }

    /* Cross-browser Fixes */
    .offcanvas {
        -webkit-overflow-scrolling: touch;
        -ms-touch-action: pan-y;
        touch-action: pan-y;
    }

    /* Prevent body scroll when menu is open */
    body.offcanvas-open {
        overflow: hidden !important;
    }

    .navbar-toggler:focus {
        -webkit-box-shadow: none;
        box-shadow: none;
        outline: none;
    }

    /* iOS Button Reset */
    input,
    button,
    select,
    textarea {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 12px; /* Restore rounded corners for premium feel */
        border: 1px solid rgba(0, 0, 0, 0.1);
        padding: 10px 15px; /* Ensure default padding exists if not specified */
    }

    .main-btn,
    .btn--explore {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    /* ── Our Foundation – Tablet & Mobile ────────────────────────── */
    .our-foundation {
        padding-top: 60px !important;
        padding-bottom: 50px !important;
        background-position: center;
    }

    .foundation-title-wrapper {
        gap: 8px !important;
    }

    .foundation-title-icon {
        width: 20px !important;
        image-rendering: -webkit-optimize-contrast !important;
    }

    .foundation-features {
        margin-top: 0 !important;
    }

    /* Stack image ABOVE text on mobile */
    .feature-row {
        -webkit-box-orient: vertical !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
        margin-bottom: 2.5rem !important;
        padding-bottom: 0.5rem !important;
        gap: 0 !important;
        margin-top: auto;
    }

    .section-two-path-one-object,
    .section-two-path-two-object {
        display: none !important;
    }

    .feature-text-col,
    .feature-image-col {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .feature-content {
        -webkit-box-orient: vertical !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
        -webkit-box-align: center !important;
        -ms-flex-align: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 0 0.2rem;
    }

    .feature-text {
        text-align: center !important;
        max-width: 100% !important;
        padding-top: 1rem !important;
    }

    .feature-title {
        -webkit-box-pack: center !important;
        -ms-flex-pack: center !important;
        justify-content: center !important;
    }

    .feature-icon-col {
        margin: 0 !important;
        display: none !important;
        /* Hide small feature icons on mobile to save space */
    }

    .watercolor-placeholder {
        max-width: 98%;
        margin: 0 auto;
        image-rendering: -webkit-optimize-contrast !important;
    }

    .feature-image-col {
        text-align: center !important;
    }

    .bottom-summary-text {
        font-size: 0.9rem;
        max-width: 95%;
        line-height: 1.3;
    }

    .bottom-summary-row {
        margin-top: 2rem !important;
        padding-bottom: 1rem !important;
    }

    /* Hide temple pillars on mobile/tablet */
    .temple-pillar {
        display: none !important;
    }

    /* .home-banner must NOT have a fixed height — its 500vh track drives the scroll animation */
}

@media (max-width: 480px) {
    .our-foundation {
        padding-top: 70px !important;
        padding-bottom: 60px !important;
    }

    .foundation-title {
        font-size: clamp(1.5rem, 6vw, 1.9rem);
    }

    .watercolor-placeholder {
        max-width: 100%;
    }

    .feature-text p {
        font-size: clamp(0.9rem, 4vw, 1rem);
    }

    .feature-text p br {
        display: none;
    }

    .highlight-text {
        font-size: clamp(1.8rem, 7vw, 2.2rem);
    }

    /* Hero Responsive */
    .hero-card {
        padding: 4vh 5vw !important;
        gap: 0.5vh !important;
        width: 100%;
        max-width: 95vw;
    }

    .hero-title-main {
        font-size: clamp(1.8rem, 6vw, 2.5rem) !important;
        line-height: 1.1;
    }

    .hero-title-top {
        font-size: 1.1rem !important;
    }

    .hero-subtitle {
        font-size: 1.2rem !important;
    }

    .hero-text {
        gap: 8px !important;
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }

    .hero-text p {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }

    .hero-ornament img {
        max-width: 80px;
    }

    .hero-actions {
        margin-top: 1.5rem !important;
    }

    .flex-lg-row-reverse .feature-text-col {
        padding-inline: 1rem !important;
    }

    /* Contact Us Page Mobile Resets */
    .connect-card {
        margin-top: 50px !important;
        /* Ensure it stays below the logo/nav */
        margin-bottom: 30px !important;
    }

    .custom-dropdown.open .dropdown-list {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important; /* Avoid conflicting with absolute centering */
        left: 0 !important;
        right: 0 !important;
    }

    .step-indicators {
        flex-wrap: nowrap !important;
        overflow-x: visible;
        gap: 15px !important;
    }

    .step-indicator {
        flex: 0 0 auto !important;
        width: 60px !important; /* Explicit width for Safari calculation */
    }
}

/* Tablet / iPad Specific */
@media (min-width: 768px) and (max-width: 1024px) {
    .hero-card {
        padding: 5vh 8vw !important;
    }

    .hero-title-main {
        font-size: 3rem !important;
    }

    .hero-text {
        max-width: 90%;
    }
}

/* Landscape orientation on mobile for better visibility */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-card {
        padding: 2vh 5vw !important;
        -webkit-box-orient: horizontal !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: row !important;
        flex-direction: row !important;
        -ms-flex-wrap: wrap !important;
        flex-wrap: wrap !important;
        -webkit-box-pack: center !important;
        -ms-flex-pack: center !important;
        justify-content: center !important;
        gap: 2vw !important;
    }

    .hero-titles {
        width: 100%;
    }

    .hero-text {
        display: none;
        /* Hide long text in small landscape to avoid overlap */
    }

    .hero-ornament {
        display: none;
    }

    .hero-actions {
        margin-top: 5px !important;
    }
}

/* ── Mobile landscape ─────────────────────────────────────────── */
@media (max-width: 767px) and (orientation: landscape) {
    .our-foundation {
        padding-top: 50px !important;
        padding-bottom: 50px !important;
    }

    .feature-row {
        -webkit-box-orient: horizontal !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: row !important;
        flex-direction: row !important;
        margin-bottom: 1.5rem !important;
    }

    .feature-image-col {
        max-width: 45%;
    }

    .feature-text-col {
        max-width: 55%;
    }

    .watercolor-placeholder {
        max-width: 100%;
    }

    .feature-text {
        text-align: left !important;
        padding-top: 0.5rem !important;
    }

    .feature-title {
        -webkit-box-pack: start !important;
        -ms-flex-pack: start !important;
        justify-content: flex-start !important;
    }

    /* Section 3 */
    .gurukul-tradition {
        padding: 40px 0 !important;
        margin-top: -30px !important;
    }

    .gurukul-title {
        font-size: 1.8rem !important;
    }

    .gurukul-subtitle {
        font-size: 0.95rem !important;
        padding: 0 10px;
    }

    .gurukul-cards-row {
        gap: 15px !important;
        padding-top: 1.5rem !important;
    }

    .gurukul-card {
        padding: 30px 20px !important;
        border-radius: 30px !important;
    }

    .gurukul-card-icon img {
        height: 50px !important;
    }
}

/* ── iPad / Tablet portrait (768px – 991px) ──────────────────── */
@media (min-width: 768px) and (max-width: 991px) {
    .our-foundation {
        padding-top: 90px !important;
        padding-bottom: 90px !important;
    }

    .gurukul-tradition {
        padding: 60px 0 !important;
    }

    .gurukul-cards-row {
        gap: 20px !important;
    }

    .feature-row {
        -webkit-box-orient: horizontal !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: row !important;
        flex-direction: row !important;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        margin-bottom: 3rem !important;
    }

    .feature-image-col {
        width: 50%;
        max-width: 50%;
        text-align: center !important;
    }

    .feature-text-col {
        width: 50%;
        max-width: 50%;
    }

    .feature-text {
        text-align: left !important;
        max-width: 100% !important;
        padding-top: 0 !important;
        padding-left: 1rem;
    }

    .feature-content {
        -webkit-box-orient: horizontal !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: row !important;
        flex-direction: row !important;
        -webkit-box-align: start !important;
        -ms-flex-align: start !important;
        align-items: flex-start !important;
        text-align: left !important;
        padding: 0 !important;
    }

    .feature-title {
        -webkit-box-pack: start !important;
        -ms-flex-pack: start !important;
        justify-content: flex-start !important;
    }

    .watercolor-placeholder {
        max-width: 100%;
    }

    .temple-pillar {
        display: none !important;
    }
}

/* ── iPad landscape / Small laptop (992px – 1199px) ─────────── */
@media (min-width: 992px) and (max-width: 1199px) {
    .our-foundation {
        padding-top: 100px;
        padding-bottom: 90px;
    }

    .feature-text {
        max-width: 300px;
        padding-top: 1.5rem;
    }

    .flame-pillar {
        height: 160px;
    }

    .temple-pillar {
        display: block;
        width: clamp(60px, 7vw, 100px);
    }
}

/* ── Large desktop (≥1400px) ─────────────────────────────────── */
@media (min-width: 1400px) {}

* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ======================================================
   Section 3 Responsive
======================================================= */

/* Tablet portrait */
@media (max-width: 991px) {
    .gurukul-tradition {
        padding-top: 70px;
    }

    .gurukul-inner {
        padding-bottom: 60px;
    }

    .gurukul-cards-row .col-md-6 {
        max-width: 480px;
        margin: 0 auto;
    }

    .gurukul-subtitle br {
        display: none;
    }
}

@media (max-width: 991px) {
    .gurukul-tradition {
        background-size: cover !important;
    }
}

@media (max-width: 991px) {
    .parampara-section {
        padding: 90px 0 120px;
    }
}

@media (max-width: 767px) {
    .parampara-description {
        br {
            display: none;
        }
    }
}

/* Mobile */
@media (max-width: 767px) {
    .gurukul-tradition {
        padding-top: 55px;
        padding-bottom: 200px;
    }

    .gurukul-inner {
        padding-bottom: 40px;
    }

    .gurukul-card {
        padding: 32px 24px 36px;
        border-radius: 14px;
        margin-bottom: 30px;
    }

    .gurukul-card-title {
        font-size: clamp(1.4rem, 6vw, 1.7rem);
    }

    .gurukul-border-strip {
        margin-top: 10px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .gurukul-title {
        font-size: clamp(1.5rem, 7vw, 1.9rem);
        margin-top: 4rem;
    }

    .gurukul-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    .gurukul-card {
        padding: 28px 20px 32px;
    }

    .gurukul-card-icon img {
        width: 48px;
        height: 48px;
    }
}

/* Section 4 Responsive */
@media (max-width: 991px) {
    .gurukul-matters-section {
        padding: 60px 0 80px;
        background-position: center;
    }

    .matters-col {
        padding: 40px 20px;
        border-bottom: 1px solid rgba(139, 65, 0, 0.1);
    }

    .matters-col:last-child {
        border-bottom: none;
    }

    .matters-grid-container {
        margin-top: 30px;
    }
}

@media (max-width: 767px) {
    .matters-title {
        font-size: 1.8rem;
    }

    .matters-item-title {
        font-size: 1.5rem;
    }

    .matters-icon {
        width: 55px;
        height: 55px;
    }
}

/* Cross-browser & Utility */
@supports not (height: 100dvh) {

    .sticky-wrapper,
    .sequence-canvas,
    .contact-banner,
    .origin-track {
        height: 100vh !important;
        height: 100dvh !important; /* Support for iOS dynamic bar */
    }
}

.dropdown-menu {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
}

.img-fluid {
    height: auto;
    max-width: 100%;
}

.container {
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}