/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

:root {
    --accent: #00a1e2;
    --accent-rgb: 0, 161, 226;
    --text-dark: #0f1635;
    --muted-shadow: rgba(15, 22, 53, 0.08);
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    /* Background: white at top, sky-blue at bottom */
    background: linear-gradient(to bottom, #ffffff 0%, #87CEEB 100%);
    color: var(--text-dark);
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 10%, rgba(135, 206, 235, 0.08), transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* =========================
   LAYOUT
========================= */

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================
   HEADER
========================= */

.header-top {
    position: sticky;
    top: 0;
    z-index: 1000;

    /* Light translucent header for bright background */
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    border-bottom: 1px solid rgba(15, 22, 53, 0.06);
    padding: 12px 0;

    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.header-top.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 25px var(--muted-shadow);
}

.header-grid {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
}

.header-grid .item {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.95;
}

.map-wrap {
    position: absolute;
    /* place to the right; top is adjusted via JS to avoid overlapping copyright */
    top: 80px;
    right: 4%;
    width: 45%;
    max-width: 960px;
    display: block;
    margin: 0;
    margin-right: 240px;
    transition: all 300ms ease;
    z-index: 2;
}

.map-overlay {
    position: absolute;
    inset: 0;
    cursor: zoom-in;
    z-index: 3;
    /* subtle hint for interactivity */
    background: linear-gradient(to top, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.02));
}

.map-close {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
}

/* when not expanded, render the iframe smaller (resize rather than crop) */
.map-wrap:not(.expanded) .footer-map {
    height: 660px;
    /* half of desktop default */
    width: 150%;
    border-radius: 12px;
}

/* expanded: overlay the viewport with a small margin */
.map-wrap.expanded {
    position: fixed;
    top: 3vh;
    left: 3vw;
    right: 3vw;
    bottom: 3vh;
    width: auto;
    height: auto;
    max-width: none;
    z-index: 99999;
    display: block;

    /* remove any page-dim/backdrop feel */
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.map-wrap.expanded .footer-map {
    width: 100%;
    height: 100%;

    /* strip visual effects */
    box-shadow: none;
    border-radius: 0;
}

/* disable overlay while expanded */
.map-wrap.expanded .map-overlay {
    display: none;
}

.map-wrap.expanded .map-close {
    display: block;
}

/* Prevent page scroll while map is expanded */
.no-scroll-footer {
    overflow: hidden;
}

.footer-map {
    width: 100%;
    max-width: 1920px;
    height: 560px;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

@media (max-width: 768px) {

    /* on small screens fall back to document flow and full width */
    .map-wrap {
        position: static;
        width: 100%;
        margin-top: 14px;
    }

    .map-overlay {
        display: none;
    }

    .map-close {
        display: none;
    }

    .footer-map {
        height: 440px;
        max-width: 960px;
    }
}

@media (max-width: 480px) {
    .footer-map {
        height: 340px;
        max-width: 480px;
    }
}

.header-grid img {
    width: 16px;
    height: 16px;
}

.header-grid a {
    color: var(--text-dark);
    text-decoration: none;
    transition: 0.2s ease;
}

.header-grid a:hover {
    color: var(--accent);
}

/* =========================
   LOGO
========================= */

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 35px 0 15px;
    border-radius: 120px;
}

.logo-container img {
    max-width: 260px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 6px 18px rgba(15, 22, 53, 0.12));
    border-radius: 120px;
}

/* =========================
   HERO
========================= */

.hero {
    display: flex;
    justify-content: center;
    text-align: center;
    padding: 55px 0 40px;
}

.hero .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.hero img {
    max-width: 360px;
    width: 100%;
    height: auto;
}

.hero p {
    max-width: 820px;
    font-size: 17px;
    opacity: 0.92;
    line-height: 1.7;
}

/* =========================
   NAVIGATION
========================= */

.products {
    padding: 25px 0 55px;
}

.product-list {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: scroll;
    overflow-y: hidden;
    padding: 0 0 24px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar Styling */
.product-list::-webkit-scrollbar {
    height: 10px;
}

.product-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 5px;
}

.product-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 5px;
    border: 2px solid #f0f0f0;
    min-height: 40px;
}

.product-list::-webkit-scrollbar-thumb:hover {
    background: #0087b8;
}

.product-list {
    scrollbar-color: var(--accent) #f0f0f0;
    scrollbar-width: thin;
}

.product-list a {
    padding: 9px 15px;
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text-dark);
    background: rgba(15, 22, 53, 0.06);
    border: 1px solid rgba(15, 22, 53, 0.10);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: max-content;
}

.product-list a:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.25);
}

/* =========================
   PRODUCT SECTIONS
========================= */

.product-section {
    padding: 65px 0;
    text-align: center;
    border-top: 1px solid rgba(15, 22, 53, 0.06);
}

.product-section img {
    width: 100%;
    max-width: 960px;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(15, 22, 53, 0.25);
    transition: transform 0.25s ease;
    display: block;
    margin: 0 auto;
}

.product-section img:hover {
    transform: scale(1.015);
}

.product-section p {
    margin-top: 16px;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    font-size: 15px;
    opacity: 0.9;
}

/* =========================
   FOOTER
========================= */

.footer {
    margin-top: 60px;
    padding: 28px 0;
    background: rgba(10, 15, 30, 0.95);
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    padding-top: 30px;
    padding-bottom: 30px;
    /* match cropped image aspect ratio (width 815 x height 326); ensure at least 640px for larger map */
    min-height: max(calc(100vw * 326 / 815), 640px);
    display: flex;
    align-items: flex-start;
    /* place content at top */
    justify-content: center;
    background-repeat: no-repeat;
    background-size: 100% auto;
    /* scale image to full width, preserve aspect ratio */
    background-position: center bottom;
    position: relative;
}

.footer .container {
    width: 100%;
    padding: 12px 20px 0;
    /* small top padding so text sits near top */
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer p {
    margin: 0;
    font-size: 16px;
    color: #f3f7fb;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
    background: rgba(0, 0, 0, 0.06);
    padding: 6px 12px;
    border-radius: 6px;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.footer::before {
    content: "";
    position: absolute;
    inset: 0;
    /* lighter overlay so the background image is more visible */
    background: linear-gradient(to top, rgba(10, 15, 30, 0.45), rgba(10, 15, 30, 0.10));
    z-index: 0;
}

/* background image (cropped) */
.footer {
    background-image: url('../assets/alaybeyoglu-background.png');
}

@media (max-width: 600px) {
    .footer .container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .footer img {
        max-width: 160px;
    }

    .footer p {
        text-align: center;
    }
}

/* =========================
   WHATSAPP BUTTON
========================= */

.whatsapp-float {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.14);
    z-index: 9999;
    transition: all 0.25s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.08);
    box-shadow: 0 16px 40px rgba(37, 211, 102, 0.18);
}

.whatsapp-float:active {
    transform: scale(0.95);
}

.whatsapp-float svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* =========================
   MICRO POLISH
========================= */

a,
img {
    transition: all 0.2s ease;
}

img {
    display: block;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {

    /* Let the footer wrap its content naturally */
    .footer {
        height: auto;
        min-height: auto;
        padding-bottom: 40px;
        background-size: cover;
    }

    .header-grid {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Reset the map layout to sit perfectly below the text */
    .map-wrap {
        position: relative !important;
        /* Overrides the absolute positioning */
        width: 90%;
        margin: 30px auto 0;
        /* Centers it with space above */
        top: auto !important;
        /* Neutralizes the JS height calculation */
        right: auto;
    }

    .map-overlay {
        display: none;
    }

    .map-close {
        display: none;
    }

    .footer-map {
        height: 300px !important;
        /* A clean, tap-friendly height for mobile */
        max-width: 100%;
    }

    /* Adjust hero and products for mobile */
    .hero {
        padding: 40px 0 30px;
    }

    .product-section {
        padding: 45px 0;
    }

    .product-list {
        gap: 8px;
    }

    /* Scale down the WhatsApp button */
    .whatsapp-float {
        width: 52px;
        height: 52px;
        bottom: 18px;
        right: 18px;
    }

    .whatsapp-float svg {
        width: 24px;
        height: 24px;
    }
}

/* The auto-scaling CSS Grid for the products (Keep this as is, just ensuring it's here) */
main.product-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px 0 60px;
}

/* 1. Update the section to use Flexbox */
.product-section {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Pushes the text to the bottom uniformly */
    height: 100%;
    /* Forces the card to stretch to the grid's maximum row height */
    padding: 25px;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(15, 22, 53, 0.06);
    border-radius: 16px;
    box-shadow: 0 8px 24px var(--muted-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* 2. Update the image to have a uniform bounding box */
.product-section img {
    width: 100%;
    height: 240px;
    /* The uniform height for all images */
    object-fit: contain;
    /* Ensures tall or wide images fit perfectly without distortion */
    border-radius: 12px;
    margin: 0 auto 16px auto;
    /* Adds breathing room between the image and the title */
}

.product-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(15, 22, 53, 0.12);
}

/* =========================
   SCROLL ANIMATIONS
========================= */

.product-section,
.hero,
.products {
    opacity: 0;
    transform: translateY(25px);
    animation: fadeUp 0.8s ease forwards;
}

.hero {
    animation-delay: 0.1s;
}

.products {
    animation-delay: 0.2s;
}

.product-section:nth-of-type(odd) {
    animation-delay: 0.25s;
}

.product-section:nth-of-type(even) {
    animation-delay: 0.35s;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}