html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* prevent any horizontal scroll that could reveal side gaps */
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    color: #333;
}
body.modal-open {
    overflow: hidden;
    touch-action: none;
}

header {
    background: #2c3e50;
    color: white;
    text-align: center;
    /* Add the iOS safe-area inset so the header fills the full screen width on devices with a notch */
    padding: calc(env(safe-area-inset-top, 0px) + 0.5rem) 1rem 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Let the height be driven by content + padding so we don't get extra white bars */
    min-height: 4.2rem;
    position: relative;
    width: 100vw;  /* guarantee full viewport width */
    left: 0;
    right: 0;
}

header h1 {
    font-size: 2.8rem;
}

header p {
    font-size: 1.4rem;
}

.brand {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-weight: bold;
    font-size: 1rem;
}

.container {
    flex: 1 0 auto;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    box-sizing: border-box;
}

.products-section {
    margin: 2rem 0;
}

.products {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.product {
    flex: 1;
    text-align: center;
    background: #f5f6fa;
    padding: 1rem;
    border-radius: 8px;
    transition: transform 0.3s;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.product:hover {
    transform: translateY(-5px);
}

/* Disable product hover effects when modal is open */
body.modal-open .product:hover {
    transform: none;
    cursor: default;
}

.carousel {
    position: relative;
    max-width: 300px;
    margin: 0 auto;
    min-height: 400px;
    overflow: hidden;
    touch-action: pan-y; /* allow vertical scroll, JS handles horizontal */
}

.carousel img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    display: none;
}

.carousel img.active {
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 3px;
    z-index: 10;
}

.prev {
    left: 5px;
}

.next {
    right: 5px;
}

.cta {
    background: #e74c3c;
    color: white;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 5px;
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.cta:hover {
    background: #c0392b;
}

footer {
    flex-shrink: 0;
    background: #2c3e50;
    color: white;
    text-align: center;
    /* Keep content above browser UI from first paint */
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)) 1rem;
    width: 100%;
    /* removed sticky positioning so footer is only at page end */
}

footer p {
    margin: 0 auto;          /* center horizontally */
    display: inline-block;   /* shrink to content */
    max-width: calc(100% - 2rem); /* keep 1rem gaps */
    padding: 0 1rem;
    box-sizing: border-box;
    white-space: normal;     /* allow wrapping */
    overflow-wrap: break-word;
    word-break: break-word;  /* break long email/urls if necessary */
    position: relative;
    left: calc(max(0px, (100vw - 100%)) - 1rem); /* shift by scrollbar width (if any) plus 1rem to balance left gap */
}

.product p {
    margin-top: 1.5rem;
}

h1, h2, h3 {
    color: #2c3e50;
    margin: 0.5rem 0;
}

p {
    margin: 0.5rem 0;
}

.product h3 {
    min-height: 3.2rem;
}

/* Responsive styles for mobile and medium screens */
@media (max-width: 1100px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    .products {
        flex-direction: column;
        gap: 1rem;
    }
    .product {
        margin: 0 8px 0 8px;
        width: auto;
        min-width: 0;
        max-width: 100%;
    }
    .carousel {
        max-width: 100%;
        min-height: 250px;
    }
}

/* Modal styles */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    position: relative;
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
}

.modal-content .close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    z-index: 50; /* make sure it stays above images and nav buttons */
}

.modal-carousel {
    position: relative;
    text-align: center;
    overflow: hidden;
    touch-action: none;   /* block browser scrolling entirely in popup */
}

.modal-carousel img {
    max-width: 100%;
    max-height: 80vh;
    display: none;
    border-radius: 4px;
}

.modal-carousel img.active {
    display: block;
}

.modal-carousel .carousel-btn {
    background: rgba(255, 255, 255, 0.6);
    color: #000;
}

.modal-carousel .prev {
    left: 10px;
}

.modal-carousel .next {
    right: 10px;
}

/* Add sliding track layout for carousels */
.carousel-track,
.modal-carousel .carousel-track {
    display: flex;
    transition: transform 0.4s ease-in-out;
    will-change: transform;
}

/* Each image takes full viewport width and is always displayed so track can slide */
.carousel-track picture,
.carousel-track img,
.modal-carousel .carousel-track picture,
.modal-carousel .carousel-track img {
    flex: 0 0 100%;
    max-width: 100%;
    height: auto;
    display: block !important; /* override earlier display:none rule */
}

/* Add left spacing to the lead headline+subtext block */
main > section:first-child {
    padding-left: 1rem;
}
