/* Custom styles and animations - Mobile First Approach */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@300;400;600;800&display=swap');

/* ===== BASE STYLES ===== */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only:focus {
    position: absolute;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #0055FF;
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Hide scrollbar for gallery */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ===== MOBILE-FIRST TOUCH TARGETS ===== */
/* Ensure minimum 44x44px touch targets on mobile */
@media (pointer: coarse) {
    a, button, input, select, textarea {
        min-height: 44px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-width: 24px;
        min-height: 24px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-reveal {
    animation: fadeIn 1s ease-out forwards;
}

.animate-slide-up {
    animation: fadeIn 1s ease-out 0.3s forwards;
    opacity: 0;
}

/* Scroll Down Animation */
@keyframes scroll-down {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(8px);
    }
}

.animate-scroll-down {
    animation: scroll-down 1.5s ease-in-out infinite;
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(12deg);
    }
    50% {
        transform: translateY(-15px) rotate(12deg);
    }
}

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

/* Marquee Animation */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.animate-marquee {
    animation: marquee 25s linear infinite;
}

/* Slow bounce animation for logo */
@keyframes bounce-slow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* Menu badge pulse */
@keyframes badge-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.menu-item .bg-accent-red,
.menu-item .bg-pink-500 {
    animation: badge-pulse 2s ease-in-out infinite;
}

/* ===== HERO SECTION ===== */
/* Hero Line Animation (for GSAP) */
.hero-line {
    opacity: 0;
    transform: translateY(100px);
}

.hero-tag, .hero-tagline, .hero-cta, .hero-badge {
    opacity: 0;
}

/* Text stroke for hero */
.text-stroke-white {
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.9);
    -webkit-text-fill-color: transparent;
}

/* Vertical Writing */
.writing-vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* ===== MENU ITEMS ===== */
.menu-item:hover img,
.menu-item:focus-within img {
    filter: brightness(0.7);
}

/* ===== FLOATING BUTTON ===== */
#floatingBtn.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== STORE & FRANCHISE CARDS ===== */
.store-card {
    transition: all 0.3s ease;
}

.store-card:hover {
    transform: translateY(-4px);
}

.franchise-stat {
    transition: all 0.3s ease;
}

.franchise-stat:hover {
    transform: scale(1.02);
}

/* ===== GALLERY NAVIGATION ===== */
#galleryPrev:hover,
#galleryNext:hover {
    transform: translateY(-50%) scale(1.1);
}

/* ===== MOBILE MENU ===== */
#mobileMenu {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#mobileMenu.active {
    display: flex;
}

#mobileMenu a {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#mobileMenu.active a {
    transform: translateY(0);
    opacity: 1;
}

#mobileMenu.active a:nth-child(2) { transition-delay: 0.05s; }
#mobileMenu.active a:nth-child(3) { transition-delay: 0.1s; }
#mobileMenu.active a:nth-child(4) { transition-delay: 0.15s; }
#mobileMenu.active a:nth-child(5) { transition-delay: 0.2s; }
#mobileMenu.active a:nth-child(6) { transition-delay: 0.25s; }
#mobileMenu.active a:nth-child(7) { transition-delay: 0.3s; }

/* ===== DOUGH SECTION ===== */
#dough img {
    transition: transform 0.3s ease;
}

#dough img:hover {
    transform: scale(1.02);
}

/* ===== RESPONSIVE STYLES ===== */

/* Extra Small Mobile (320px) */
@media (max-width: 374px) {
    /* Tighter spacing for very small screens */
    .px-4 { padding-left: 0.75rem; padding-right: 0.75rem; }

    /* Smaller hero text */
    .hero-line { font-size: 14vw !important; }

    /* Smaller section padding */
    section { padding-top: 3rem; padding-bottom: 3rem; }
}

/* Mobile (default) */
@media (max-width: 639px) {
    /* Typography scaling for mobile */
    h1 { font-size: clamp(2rem, 8vw, 3rem); }
    h2 { font-size: clamp(1.5rem, 6vw, 2.5rem); }

    /* Marquee faster on mobile */
    .animate-marquee {
        animation-duration: 15s;
    }

    /* Floating button - icon only on very small screens */
    #floatingBtn a {
        padding: 0.875rem 1rem;
    }

    /* Gallery items wider on mobile */
    #storeGallery > div {
        width: 85vw;
    }

    /* Stack store cards on mobile */
    .store-card {
        padding: 1rem;
    }

    /* Form fields full width */
    form input,
    form select,
    form textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* 48 Dough section mobile adjustments */
    #dough .grid.grid-cols-2 {
        gap: 0.75rem;
    }

    /* Menu items mobile adjustments */
    .menu-item h3 {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }

    .menu-item p {
        font-size: 0.625rem;
    }

    .menu-item .absolute.inset-0 p {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .menu-item .bg-brand-blue\/20 {
        padding: 0.375rem 0.5rem;
        font-size: 0.625rem;
    }

    .menu-item .absolute.top-3 {
        top: 0.5rem;
        left: 0.5rem;
    }

    .menu-item .absolute.top-3 span {
        padding: 0.25rem 0.5rem;
        font-size: 0.625rem;
    }
}

/* Small Mobile Menu Items */
@media (min-width: 375px) and (max-width: 639px) {
    .menu-item h3 {
        font-size: 0.9375rem;
    }

    .menu-item p {
        font-size: 0.6875rem;
    }
}

/* Tablet */
@media (min-width: 640px) and (max-width: 1023px) {
    .animate-marquee {
        animation-duration: 20s;
    }
}

/* Desktop */
@media (min-width: 768px) {
    .text-stroke-white {
        -webkit-text-stroke: 3px rgba(255, 255, 255, 0.9);
    }
}

@media (min-width: 1024px) {
    /* Gallery navigation always visible on desktop */
    #galleryPrev,
    #galleryNext {
        opacity: 1;
    }
}

/* ===== REDUCED MOTION ===== */
@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;
    }

    .hero-line,
    .hero-tag,
    .hero-tagline,
    .hero-cta,
    .hero-badge {
        opacity: 1;
        transform: none;
    }
}

/* ===== DARK MODE SUPPORT (Optional) ===== */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here if needed */
}

/* ===== PRINT STYLES ===== */
@media print {
    #navbar,
    #floatingBtn,
    #mobileMenu,
    .animate-marquee,
    video,
    .hero-badge {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .text-stroke-white {
        -webkit-text-stroke: 3px white;
    }

    .border-gray-100,
    .border-gray-200,
    .border-gray-700 {
        border-color: currentColor;
    }
}

/* ===== SAFE AREA INSETS FOR NOTCHED DEVICES ===== */
@supports (padding: max(0px)) {
    #navbar {
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }

    #floatingBtn {
        bottom: max(1.5rem, env(safe-area-inset-bottom));
        right: max(1.5rem, env(safe-area-inset-right));
    }

    footer {
        padding-bottom: max(3rem, env(safe-area-inset-bottom));
    }
}
