/* Mayo Journal - Custom Styles */
/* ================================ */

/* Custom Font Smoothing */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: #F7DC6F;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #FFEAA7;
}

/* Smooth Animations */
.animate-fade-up {
    animation: fadeUp 0.6s ease-out forwards;
    opacity: 0;
    animation-fill-mode: both; /* Ensures animation end state is maintained */
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}

/* Force hero animations to complete */
#hero .animate-fade-up {
    animation-fill-mode: both !important;
}

/* Failsafe - make hero content visible after animation time */
@supports (animation: fadeUp) {
    #hero-content > * {
        animation-fill-mode: forwards !important;
    }
}

/* Prevent hero from being affected by scroll-fade animations */
#hero .scroll-fade {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Ensure hero content stays visible after initial load */
#hero.loaded,
#hero-content.loaded {
    opacity: 1 !important;
}

/* Prevent scroll-fade from being applied to hero */
#hero *:not(.animate-fade-up):not(.animate-float) {
    /* Don't let scroll observers add fade */
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Scroll-triggered animations */
.scroll-fade {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Feature Cards Hover Effects */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Button Hover Effects */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Navigation Styles */
nav {
    transition: all 0.3s ease;
}

nav.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

#mobile-menu.show {
    max-height: 400px;
}

/* How It Works Arrow Animation */
.arrow-animate {
    animation: arrowMove 1.5s ease-in-out infinite;
}

@keyframes arrowMove {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
}

/* Pricing Card Hover */
.pricing-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pricing-card:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 40px rgba(247, 220, 111, 0.2);
}

/* Newsletter Input Focus */
input[type="email"]:focus {
    box-shadow: 0 0 0 3px rgba(247, 220, 111, 0.2);
}

/* Loading State for Newsletter */
.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success Message Animation */
.success-message {
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #F7DC6F, #FFEAA7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Image Placeholder while loading */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Typography */
/* Extra Small Devices (320px - 375px) */
@media (max-width: 375px) {
    .text-5xl {
        font-size: 2rem;
        line-height: 1.2;
    }

    .text-6xl {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .text-7xl {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .text-2xl {
        font-size: 1.25rem;
    }

    .text-3xl {
        font-size: 1.5rem;
    }

    .text-4xl {
        font-size: 1.75rem;
    }
}

/* Small Mobile Devices (376px - 768px) */
@media (min-width: 376px) and (max-width: 768px) {
    .text-5xl {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .text-6xl {
        font-size: 3rem;
        line-height: 1.2;
    }

    .text-7xl {
        font-size: 3rem;
        line-height: 1.2;
    }
}

/* Mobile Spacing & Layout Improvements */
@media (max-width: 640px) {
    /* Hero Section Mobile Improvements */
    #hero {
        padding-top: 6rem;
        padding-bottom: 3rem;
    }

    #hero .space-y-8 {
        gap: 1.5rem;
    }

    /* Make CTA buttons full width on very small screens */
    #hero .flex-col a,
    #hero .flex-col button {
        width: 100%;
    }

    /* Reduce horizontal padding on very small screens */
    .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Feature cards - reduce padding */
    #features .p-8 {
        padding: 1.5rem;
    }

    /* How It Works cards - reduce padding */
    #how-it-works .p-8 {
        padding: 1.25rem;
    }

    /* Pricing cards - adjust padding */
    #pricing .p-8 {
        padding: 1.5rem;
    }

    /* Footer newsletter - stack input and button */
    #newsletter-form {
        flex-direction: column;
    }

    #newsletter-form input,
    #newsletter-form button {
        width: 100%;
    }
}

/* Mobile Touch Targets - Ensure minimum 44px */
@media (max-width: 768px) {
    /* Mobile menu items */
    #mobile-menu a {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    /* All buttons minimum height */
    button,
    a.inline-flex {
        min-height: 44px;
    }

    /* Navigation burger button */
    #mobile-menu-button {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-center;
    }

    /* Hero badges - stack vertically on small screens */
    #hero .flex.items-center.gap-8 {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Landscape Mobile Orientation */
@media (max-width: 768px) and (orientation: landscape) {
    #hero {
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 2rem;
    }

    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

/* Tablet Optimizations (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Footer - 2 column layout for tablets */
    footer .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    footer .col-span-2 {
        grid-column: span 1;
    }

    /* Pricing cards - ensure good spacing */
    #pricing .gap-8 {
        gap: 2rem;
    }

    /* How It Works callout box */
    #how-it-works .inline-flex {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Large Screens (1920px+) */
@media (min-width: 1920px) {
    section {
        padding-top: 6rem;
        padding-bottom: 6rem;
    }

    #hero {
        padding-top: 8rem;
        padding-bottom: 6rem;
    }
}

/* Extra Small Screens - Additional Spacing Fixes */
@media (max-width: 375px) {
    /* Reduce gaps */
    .gap-4 {
        gap: 0.75rem;
    }

    .gap-6 {
        gap: 1rem;
    }

    .gap-8 {
        gap: 1.5rem;
    }

    /* How It Works - make callout box full width */
    #how-it-works .inline-flex.bg-mayo-gold\/10 {
        width: 100%;
        justify-content: flex-start;
    }

    /* Circle explainer - reduce padding */
    #how-it-works .p-8.border {
        padding: 1.25rem;
    }

    /* Hero tagline spacing */
    #hero .mt-8 {
        margin-top: 1rem;
    }

    /* Reduce section vertical spacing */
    section.py-20 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Make feature icons smaller on very small screens */
    #features .w-14 {
        width: 3rem;
        height: 3rem;
    }
}

/* Improve readability on all mobile devices */
@media (max-width: 768px) {
    /* Better line heights for mobile */
    p {
        line-height: 1.6;
    }

    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Better spacing for list items */
    li {
        line-height: 1.5;
    }

    /* Pricing card buttons - ensure proper padding */
    #pricing button {
        padding-top: 0.875rem;
        padding-bottom: 0.875rem;
    }

    /* Privacy section - stack content on mobile */
    #privacy .grid {
        gap: 3rem;
    }
}

/* iPhone SE and similar small devices (320px - 360px) */
@media (max-width: 360px) {
    /* Further reduce hero spacing */
    #hero {
        padding-top: 5rem;
    }

    /* Make heading even smaller if needed */
    h1 {
        font-size: 1.875rem !important;
        line-height: 1.2;
    }

    /* Ensure buttons don't overflow */
    button,
    a.inline-flex {
        font-size: 0.875rem;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Print Styles */
@media print {
    nav, footer, .no-print {
        display: none;
    }

    body {
        font-size: 12pt;
    }
}

/* Accessibility - Focus Styles */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid #F7DC6F;
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2C3E50;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Smooth Parallax Effect */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Custom Selection Colors */
::selection {
    background-color: #FFF4E6;
    color: #2C3E50;
}

::-moz-selection {
    background-color: #FFF4E6;
    color: #2C3E50;
}

/* Feature Icon Hover */
.feature-icon {
    transition: all 0.3s ease;
}

.feature-icon:hover {
    transform: rotate(5deg) scale(1.1);
}

/* CTA Section Animation */
.cta-gradient {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Mobile Touch Feedback */
@media (hover: none) {
    button:active,
    a:active {
        transform: scale(0.95);
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .bg-mayo-cream {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}