*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    color: #0f1111;
    background-color: #3c045f;
    line-height: 1.4;
}

input,
select,
button {
    font: inherit;
}

/* Header: three rows on phones; one row on desktop. */
.navbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto;
    grid-template-areas:
        "logo sign cart"
        "search search search"
        "address returns returns";
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background-color: #141c25;
    color: #fff;
}

.navbar > * {
    min-width: 0;
}

.border {
    border: 1px solid transparent;
    padding: 0.375rem 0.4375rem;
}

.border:focus-within {
    border-color: #fff;
}

.nav-logo {
    grid-area: logo;
    width: 8rem;
    max-width: 100%;
    height: 3rem;
    padding: 0;
}

.logo,
.amazon-logo {
    background-image: url("images/amazon-logo.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.logo {
    width: 100%;
    height: 100%;
}

/* Delivery address */
.nav_address {
    grid-area: address;
    justify-self: start;
}

.add-first {
    margin-left: 1rem;
    color: #ccc;
    font-size: 0.8125rem;
}

.add-icon {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.add-second {
    font-size: 1rem;
}

/* Search: can shrink within the header without pushing the page wider. */
.nav-search {
    grid-area: search;
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    border-radius: 5px;
    background-color: #fff;
}

.select-search {
    flex: 0 0 3.25rem;
    width: 3.25rem;
    min-width: 0;
    border: 0;
    border-radius: 5px 0 0 5px;
    background-color: #e6e6e6;
    color: #0f1111;
    font-size: 0.875rem;
    text-align: center;
}

.input-search {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    border: 0;
    border-radius: 0;
    outline: none;
    background-color: #fff;
    color: #0f1111;
    /* 16px at the default font size also avoids focus zoom on iPhones. */
    font-size: 1rem;
}

.search-icon {
    display: flex;
    flex: 0 0 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 0 5px 5px 0;
    background-color: #febd68;
    color: #0f1111;
    font-size: 1.25rem;
}

/* A focus ring does not resize the search bar when someone types. */
.nav-search:focus-within {
    box-shadow: 0 0 0 3px #f3a847;
}

/* Account, orders, and cart */
.nav-sign {
    grid-area: sign;
}

.navbar span {
    font-size: 0.8125rem;
    font-weight: 400;
}

.nav-second {
    font-size: 0.875rem;
    font-weight: 700;
}

.account {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.account .nav-second {
    min-width: 0;
    overflow-wrap: anywhere;
}

.account select {
    flex: 0 0 0.875rem;
    width: 0.875rem;
    border: 0;
    background-color: transparent;
    color: #fff;
}

.nav-return {
    grid-area: returns;
    justify-self: end;
}

.nav-cart {
    grid-area: cart;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
}

.nav-cart i {
    font-size: 1.75rem;
}

/* Only this navigation strip scrolls sideways on smaller screens. */
.panel {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    padding: 0 0.75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #8296ac #222f3d;
    background-color: #222f3d;
    color: #fff;
}

.panel-all,
.panel-deals,
.panel-items p {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.panel-items {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    gap: 0.25rem;
}

.panel-deals {
    font-weight: 700;
}

/* On phones, scale the banner to the screen width and put the notice below. */
.hero-section {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: max(8rem, 35vw) 0.75rem 0;
    background-color: #3c045f;
    background-image: url("images/hero_image.jpg");
    background-position: center top;
    background-size: 100% auto;
    background-repeat: no-repeat;
}

.hero-text {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: #fff;
    color: #0f1111;
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.hero-text a {
    color: #007185;
}

/* Products: one column on phones, two on tablets, four on desktop. */
.shop-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem 0.75rem 1.5rem;
    background-color: #3c045f;
    border-bottom: 1px solid #ddd;
}

.box {
    display: flex;
    min-width: 0;
    background-color: #fff;
}

.box-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    padding: 1.125rem;
}

.box-content h2 {
    font-size: clamp(1.125rem, 1.7vw, 1.35rem);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

/* Both original image classes now size themselves consistently. */
.box-img,
.boxx-img {
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-top: auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.box-content p {
    color: #007185;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Footer sections grow with their text instead of using fixed heights. */
.foot-panel1 {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.5rem;
    padding: 1rem;
    background-color: #37475a;
    color: #fff;
    font-size: 0.875rem;
    text-align: center;
}

.foot-panel2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem 1.5rem;
    padding: 2rem 1.25rem;
    background-color: #222f3d;
    color: #fff;
}

.foot-panel2 ul {
    min-width: 0;
    list-style: none;
    overflow-wrap: anywhere;
}

.foot-panel2 p {
    margin-bottom: 0.625rem;
    font-size: 1rem;
    font-weight: 700;
}

.foot-panel2 a {
    display: block;
    padding: 0.375rem 0;
    color: #ddd;
    font-size: 0.875rem;
    line-height: 1.5;
    text-decoration: none;
}

.panel-line {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 5rem;
    padding: 1rem;
    border-top: 1px solid #56616e;
    background-color: #222f3d;
}

.amazon-logo {
    width: 130px;
    height: 50px;
}

.foot-panel3 {
    padding: 1.25rem 1rem;
    background-color: #131a22;
    color: #ddd;
    font-size: 0.8125rem;
    line-height: 1.6;
    text-align: center;
    overflow-wrap: anywhere;
}

.foot-panel3 a {
    display: inline-block;
    max-width: 100%;
    margin: 0.25rem 0.5rem;
    color: inherit;
    text-decoration: none;
}

.foot-panel3 p {
    margin-top: 0.625rem;
}

/* Keep footer headings comfortable on particularly narrow phones. */
@media (max-width: 23.4375rem) {
    .foot-panel2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Larger phones in landscape and tablets: two product columns. */
@media (min-width: 36rem) {
    .shop-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Larger tablets: restore the banner's desktop composition. */
@media (min-width: 48rem) {
    .navbar {
        padding-inline: 1.25rem;
    }

    .panel {
        padding-inline: 1.25rem;
    }

    .hero-section {
        min-height: 21.875rem;
        padding: 1.5rem;
        background-size: cover;
    }

    .shop-section {
        gap: 1.25rem;
        padding: 1.5rem;
    }
}

/* Desktop: keep the original single header row and four product columns. */
@media (min-width: 64rem) {
    .navbar {
        grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
        grid-template-areas: "logo address search sign returns cart";
        gap: 0.75rem;
        min-height: 4.0625rem;
        padding: 0.5rem 1rem;
    }

    .nav-logo {
        width: 130px;
    }

    .shop-section {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .foot-panel2 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 2rem;
        padding: 2.5rem clamp(1.5rem, 4vw, 5rem);
    }
}

/* Hover effects apply only to devices that actually support hovering. */
@media (hover: hover) {
    .border:hover {
        border-color: #fff;
    }

    .nav-search:hover .search-icon {
        background-color: #f6af45;
    }

    .box-content p:hover {
        color: #0c3353;
    }

    .foot-panel2 a:hover,
    .foot-panel3 a:hover {
        text-decoration: underline;
    }
}