/* Header Component Styles */

:root { 
    --header-h: 70px; /* keep header height in one place */
}

/* Ensure proper viewport handling */

/* CSS for flip effect */
.rotate-y-180 {
    transform: rotateY(180deg);
    transition: transform 0.5s ease;
}

/* Use Tailwind's .relative (position) but keep perspective scoped to the flip-card only */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

/* Add a transition for the image flip */
.object-cover {
    transition: transform 0.5s ease-in-out;
}

/* Flip card structure */
.flip-card {
    perspective: 1000px;
    min-width: 0;
    /* allow flex children to shrink properly on small screens */
    min-height: 338px;
}

.flip-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

/* Smooth transform for the slider inner wrapper; improves desktop animation.
   For mobile, scrollLeft updates are used instead of transform; scroll-behavior
   provides a smooth transition for programmatic scroll operations. */
.slider-inner {
    will-change: transform, scroll-left;
    transition: transform 0.16s linear;
    scroll-behavior: smooth;
}

/* Scroll snap: make mobile swipe snap to one card per viewport */
.slider-viewport {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.flip-card {
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

/* Keep card size/shape on mobile; centering is handled by JS padding so one
   card sits centered per swipe without forcing full-viewport widths. */

.flip-card-inner.flipped {
    transform: rotateY(180deg);
}

/* Ensure the front face stacks above the back when not flipped. This prevents
   the flipped-back overlay from visually covering the front image on mobile
   or in some browsers where stacking contexts can behave unexpectedly. */
.flip-card-front {
    z-index: 20;
}

.flip-card-back {
    z-index: 10;
}

/* Make sure images are visible and fill the card area */
.flip-card-front img,
.flip-card-back video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ensure the front has a solid background so white/transparent SVGs are still visible on white pages */
.flip-card-front {
    background-color: #ffffff;
}

.flip-card-back {
    z-index: 10;
    position: absolute;
    overflow: hidden;
}

/* Ensure video sits behind the overlay */
.flip-card-back video {
    z-index: 1;
    /* keep the video under the overlay */
    position: absolute;
    /* ensure consistent stacking */
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay to show background gradient/colour above the video */
.flip-card-back::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 10;
    /* show above the video */
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.20) 100%);
    transition: opacity .25s ease-in-out;
    opacity: 1;
}

/* Lighter overlay for cards which have video (so the video is more visible) */
.flip-card-back.has-video::before {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.10) 100%);
}

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    position: absolute;
    inset: 0;
}

.flip-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.6) 100%);
}

/* Hover flip on pointer devices */
@media (hover: hover) and (pointer: fine) {
    .flip-card:hover .flip-card-inner {
        transform: rotateY(180deg);
    }
}

/* Disable the 3D flip animation on small screens — show the back as an overlay instead
This keeps the card responsive on mobile while allowing taps to show the back content. */
@media (max-width: 640px) {
    .flip-card-inner.flipped {
        transform: none !important;
    }

    .flip-card-back {
        /* Remove the 3D rotation and make sure the back face sits above the front */
        transform: none !important;
        z-index: 20 !important;
        position: absolute !important;
        inset: 0 !important;
        opacity: 0;
        transition: opacity 0.28s ease-in-out;
    }

    /* When flipped on mobile, show the back face with fade-in */
    .flip-card-inner.flipped .flip-card-back {
        opacity: 1;
    }

    .flip-card-front {
        z-index: 1 !important;
    }

    .flip-card-back video {
        z-index: 18 !important;
        /* below the overlay but above the front */
    }

    /* Avoid hover-based flipping on devices that may claim hover incorrectly */
    .flip-card:hover .flip-card-inner {
        transform: none !important;
    }
}

/* Hide scrollbar utility class */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.scrollbar-thin {
    scrollbar-width: thin;
}

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

/* Ensure text wraps properly in dropdown menus */
.break-words {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Force whitespace wrapping */
.whitespace-normal {
    white-space: normal !important;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* -------------------------------
     Zoom / overflow fixes
     - make flex children able to shrink (prevents a single child from forcing
         the entire header wider at browser zoom levels like 125%)
     - replace strict fixed widths with max-width so CTAs can shrink when needed
     - use header height variable for sticky/top offsets so values remain
         consistent at different zoom levels
     ------------------------------- */

:root {
        /* expose header height for use in inline utilities that use 70px now */
        --header-h: 70px;
}

header {
        box-sizing: border-box;
        height: var(--header-h);
        min-height: var(--header-h);
        width: 100%;
}

/* allow flex children to shrink instead of overflowing the header */
header .container,
header nav,
header .flex-1,
.header-nav-buttons,
.header-cta {
        min-width: 0;
}

/* Make the For Business / Instructor CTA responsive: allow shrinking but
     keep an upper bound so layout does not collapse on large screens */
.header-cta {
        max-width: 326px;
        width: 100%;
        flex-shrink: 1;
        box-sizing: border-box;
        height: 45px;
        font-size: 17px;
        font-weight: 500;
        margin-top: -10px;
}
.header-cta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap; /* keep CTAs on a single line */
    /* don't grow to fill remaining space; allow shrinking when needed */
    flex: 0 1 auto;
    margin-left: 0.75rem; /* keep a consistent gap from nav buttons */
}

.header-cta a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1; /* allow truncation before wrapping */
    min-width: 0; /* allow to shrink inside flexbox */
    height: 100%;
    padding: 0.5rem 0.75rem;
    max-width: 230px; /* prevent a single CTA from forcing layout */
    justify-content: center;
}

.header-cta a img {
    flex-shrink: 0; /* keep the icon visible */
    width: 20px;
    height: 20px;
}

.header-instructor-cta {
    background: #FFD914;
    color: #111827 !important;
    border: 1px solid rgba(202, 138, 4, 0.28);
    box-shadow: 0 8px 22px rgba(234, 179, 8, 0.18);
    font-weight: 700;
}

.header-instructor-cta:hover {
    background: #facc15;
    color: #111827 !important;
}

.header-instructor-cta img {
    filter: saturate(1.05);
}

.header-cta-pair {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    max-width: calc(100% - 1.5rem);
    margin-left: auto;
    margin-right: auto;
    background: #ffffff;
    border: 1px solid #111827;
    border-radius: 0.85rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    padding: 0.28rem;
}

.header-business-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0.42rem 0.95rem;
    border-radius: 0.7rem;
    /* border: 1px solid rgba(17, 24, 39, 0.35); */
    background: #ffffff;
    color: #111827 !important;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease;
}

.header-business-cta:hover {
    background: #f9fafb;
    color: #111827 !important;
}

.header-cta-pair .header-instructor-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0.42rem 0.95rem;
    border-radius: 0.7rem;
    box-shadow: none;
    flex-shrink: 0;
}

/* Ensure the nav buttons don't overflow into the CTA area */
.header-nav-buttons {
    min-width: 0;
    flex: 0 1 auto;
}

/* Slightly reduce font-size on small high-zoom screens to avoid overflow */
@media (min-width: 1200px) {
    @media (max-width: 1400px) {
        .header-cta a { font-size: 15px; }
    }
}

/* Ensure sticky/top offsets that were using 70px in markup stay in sync */
.fixed.top-\[70px\] {
        top: var(--header-h) !important;
}

/* Small screens: prefer stacked layout rather than forcing overflow */
@media (max-width: 1024px) {
        .header-cta { max-width: none; }
}

/* Very small mobile screens: shrink the CTA pills to fit gracefully without wrapping */
@media (max-width: 400px) {
    .header-cta-pair {
        font-size: 14px !important;
        gap: 0.25rem !important;
    }
    .header-business-cta, .header-cta-pair .header-instructor-cta {
        padding: 0.3rem 0.5rem !important;
    }
}
