/* ═══════════════════════════════════════════════
   MOBILE OPTIMIZATIONS — KaplamaDiş
   Mükemmel mobil uyum için ek stiller
═══════════════════════════════════════════════ */

/* ── FONT DISPLAY SWAP (Lighthouse fix) ──
   Font Awesome & Poppins: prevents invisible text during load (FOIT)
   These @font-face blocks override the CDN font-display to 'swap' */
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-display: swap;
    src: local('Font Awesome 6 Free'),
         url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-solid-900.woff2') format('woff2');
    font-weight: 900;
}
@font-face {
    font-family: 'Font Awesome 6 Brands';
    font-display: swap;
    src: local('Font Awesome 6 Brands'),
         url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-brands-400.woff2') format('woff2');
    font-weight: 400;
}
@font-face {
    font-family: 'Poppins';
    font-display: swap;
    src: local('Poppins'),
         url('https://fonts.gstatic.com/s/poppins/v21/pxiEyp8kv8JHgFVrJJfecg.woff2') format('woff2');
}

/* ── GLOBAL ── */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

* {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent horizontal overflow */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

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

/* ── TYPOGRAPHY SCALE ── */
@media (max-width: 640px) {
    .text-5xl, .text-6xl, .text-7xl { font-size: 2.25rem !important; line-height: 1.1 !important; }
    .text-4xl { font-size: 1.875rem !important; line-height: 1.15 !important; }
    .text-3xl { font-size: 1.5rem !important; line-height: 1.25 !important; }
    .text-2xl { font-size: 1.25rem !important; line-height: 1.3 !important; }
    .text-xl  { font-size: 1.05rem !important; }
    /* Keep text-lg as is — readable on mobile */
}

/* ── HEADER ── */
header .container {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

@media (max-width: 1023px) {
    header .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Mobile menu — smooth slide */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    opacity: 0;
}

#mobile-menu.open {
    max-height: 600px;
    opacity: 1;
}

#mobile-menu li a, #mobile-menu li > div {
    border-bottom: 1px solid #f1f5f9;
}

#mobile-menu li:last-child a {
    border-bottom: none;
}

/* ── HERO SECTION ── */
@media (max-width: 640px) {
    /* Hero buttons — stack nicely */
    .hero-btns {
        flex-direction: column;
    }

    .hero-btns a {
        width: 100%;
        justify-content: center;
    }

    /* Hero stats section — show on mobile too but smaller */
    .hero-stats-mobile {
        display: flex !important;
    }

    /* Trust badges wrap */
    .trust-badges {
        gap: 0.75rem;
    }

    .trust-badges span {
        font-size: 0.8rem;
    }
}

/* ── SECTIONS PADDING ── */
@media (max-width: 640px) {
    section.py-20 { padding-top: 3.5rem !important; padding-bottom: 3.5rem !important; }
    section.py-24 { padding-top: 3.5rem !important; padding-bottom: 3.5rem !important; }
    section.py-16 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    section.py-14 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    section.py-12 { padding-top: 2rem !important; padding-bottom: 2rem !important; }

    .container {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }
}

/* ── CARDS ── */
@media (max-width: 640px) {
    .rounded-2xl, .rounded-3xl { border-radius: 1rem; }

    /* Card touch states */
    .card-hover:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ── IMAGES — Lazy loading placeholder ── */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

img[loading="lazy"].loaded {
    background: none;
    animation: none;
}

/* ── STEP CARDS (Tedavi Süreci) ── */
@media (max-width: 1023px) {
    /* Number overlay on steps — reposition for mobile */
    .step-num-overlay {
        top: -0.75rem !important;
        right: 1rem !important;
        left: auto !important;
        width: 3rem !important;
        height: 3rem !important;
        font-size: 1.25rem !important;
        border-radius: 0.75rem !important;
    }

    /* Step cards — reduce spacing */
    .space-y-16 > * + * { margin-top: 2rem !important; }
    .space-y-12 > * + * { margin-top: 1.5rem !important; }

    /* Step image — full width on mobile */
    .step-image-col {
        order: -1; /* Image first on mobile */
    }

    /* Step content */
    .step-content-col {
        order: 1;
    }
}

/* ── FLOAT BUTTONS ── */
@media (max-width: 640px) {
    /* Smaller FABs on mobile */
    .fixed.bottom-6.right-6 a {
        width: 3.25rem !important;
        height: 3.25rem !important;
        font-size: 1.1rem !important;
    }

    .fixed.bottom-6.right-6 {
        bottom: 1rem !important;
        right: 1rem !important;
        gap: 0.5rem !important;
    }
}

/* ── FOOTER ── */
@media (max-width: 640px) {
    footer .grid-cols-1 {
        gap: 2rem;
    }

    footer .pt-20 {
        padding-top: 3rem;
    }

    footer .pb-10 {
        padding-bottom: 2rem;
    }

    /* Footer bottom — center on mobile */
    footer .flex.flex-col.md\\:flex-row {
        align-items: center;
        text-align: center;
    }

    footer .flex.gap-6 {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ── KAPLAMA TURLERI ── */
@media (max-width: 640px) {
    /* Veneer type cards — horizontally scrollable on tiny screens => nope, stack */
    .veneer-grid {
        grid-template-columns: 1fr !important;
    }

    /* Detail page hero */
    .kaplama-hero {
        padding: 4rem 0 3rem;
    }

    .kaplama-hero h1 {
        font-size: 1.875rem !important;
    }
}

/* ── BLOG ── */
@media (max-width: 640px) {
    .blog-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── CONTACT PAGE ── */
@media (max-width: 640px) {
    .contact-grid {
        grid-template-columns: 1fr !important;
    }

    /* Map iframe */
    iframe[src*="maps"] {
        height: 220px !important;
    }
}

/* ── PERFORMANCE: Image sizing hints ── */
img {
    content-visibility: auto;
}

/* ── TOUCH TARGETS — min 44px ── */
@media (max-width: 1023px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* But don't apply to inline text links */
    p a, .prose a, .text-xs a, .text-sm a {
        min-height: unset;
        min-width: unset;
    }
}

/* ── MOBILE NAV ANIMATION ── */
#mobile-menu-btn {
    position: relative;
    overflow: hidden;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

#mobile-menu-btn:hover {
    background: #f1f5f9;
}

#mobile-menu-btn:active {
    background: #e2e8f0;
    transform: scale(0.95);
}

/* ── TESTIMONIALS ── */
@media (max-width: 640px) {
    .testimonials-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── BEFORE/AFTER/GALLERY ── */
@media (max-width: 640px) {
    .transformations-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── SECTION BACKGROUNDS — mobile contrast ── */
@media (max-width: 640px) {
    /* Better contrast on small screens */
    .text-white\/80 { color: rgba(255,255,255,0.9) !important; }
    .text-white\/70 { color: rgba(255,255,255,0.85) !important; }
}

/* ── SCROLL ANIMATIONS ── */
@media (prefers-reduced-motion: no-preference) {
    .fade-in-up {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.5s ease, transform 0.5s ease;
    }

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

@media (prefers-reduced-motion: reduce) {
    .fade-in-up { opacity: 1; transform: none; }
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── PROSE — mobile content ── */
@media (max-width: 640px) {
    .prose, .prose-lg {
        font-size: 0.9375rem !important;
        line-height: 1.75 !important;
    }

    .prose h1 { font-size: 1.5rem !important; }
    .prose h2 { font-size: 1.25rem !important; }
    .prose h3 { font-size: 1.1rem !important; }

    .prose table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── ADMIN PANEL — don't affect admin ── */
/* admin styles are separate and won't be affected by these global rules */

/* ── UX: Focus styles for accessibility ── */
:focus-visible {
    outline: 2px solid #025e73;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── HERO MOBILE STATS BAR ── */
@media (max-width: 1023px) {
    .hero-stats-card {
        display: none;
    }

    .hero-stats-mobile-bar {
        display: flex !important;
    }
}

/* ── BOTTOM STICKY CTA (mobile only) ── */
.mobile-sticky-cta {
    display: none;
}

@media (max-width: 640px) {
    .mobile-sticky-cta {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        background: white;
        border-top: 1px solid #e2e8f0;
        padding: 0.625rem 1rem;
        gap: 0.5rem;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }

    .mobile-sticky-cta a {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;
        padding: 0.625rem;
        border-radius: 0.75rem;
        font-size: 0.8125rem;
        font-weight: 700;
        text-align: center;
    }

    /* Move FABs up to not overlap sticky bar */
    .fixed.bottom-6.right-6 {
        bottom: 5rem !important;
    }

    /* Add bottom padding to body so content isn't hidden behind sticky CTA */
    body {
        padding-bottom: 4.5rem;
    }
}

/* ── MOBILE MENU OVERLAY ── */
@media (max-width: 1023px) {
    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 40;
        display: none;
    }

    .mobile-overlay.active {
        display: block;
    }
}
