* { box-sizing: border-box; }
html, body { overflow-x: hidden; } /* safety net */
img { max-width: 100%; height: auto; display: block; }

body {
  margin: 0;
  background-color: #F6F5F1;
  color: #333;
  font-family: "Old Standard TT", serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
}

p { 
  padding: 3rem; 
  font-family: "Forum", serif;
  font-weight: 400;
  font-style: normal;
}

/* ---------------- HEADER ---------------- */
header {
  background: #F6F5F1;
  color: black;
  letter-spacing: 0.25rem;
  border-bottom: var(--border-line);
}

/* All buttons */
.header-btn {
  background: #F6F5F1;
  color: black;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
  font-family: "Old Standard TT", serif;
  font-weight: 500;
  font-size: 1.5rem;
}

.header-btn:hover {
  background: #c04a7c;
  color: black;
}

/* HEADER STRUCTURE ------------------------------- */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 1rem 1rem 0 1rem;
}

/* LOGO ------------------------------------------- */
.logo img { height: 60px; }

/* DESKTOP BUTTON WRAPPER ------------------------- */
.desktop-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* HAMBURGER -------------------------------------- */
.hamburger {
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: black;
  display: none;  /* hidden on desktop */
  margin-top: -20px;
  margin-left: 20px;
}

/* MOBILE MENU PANEL ------------------------------ */
.menu-panel {
  position: absolute;
  top: 70px;
  left: 0;
  right: 0;
  width: 100%;
  background: #F6F5F1;
  margin: 0;
  padding: 15px 0 15px 15px;
  display: none;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid #ddd;
  z-index: 1000;
  align-items: flex-start;
  text-align: left;
}

/* DESKTOP BUTTONS */
.desktop-only {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Left & right navs: fix the long white bar issue */
.top-left {
  display: flex;
  gap: 1rem;
  justify-content: flex-start;
  background: none;
  border-bottom: solid black 1px;
  margin-right: 2rem;
  padding-bottom: 1rem;
}
.top-right {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  background: none;
  border-bottom: solid black 1px;
  margin-left: 2rem;
  padding-bottom: 1rem;
}

/* Right aligns right buttons */
.nav-right { justify-content: flex-end; }

/* Centered logo */
.logo img {
  max-height: 100px;
  display: block;
  margin: 0 auto;
}

/* NAVBAR */
nav {
  background-color: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 1rem 0.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  border-top: solid black 1px;
  border-bottom: solid black 1px;
}

nav button {
  background: none;
  border: none;
  color: #333;
  font-family: "Tangerine", cursive;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  transition: color 0.3s, border-bottom 0.3s;
  border-bottom: 2px solid transparent;
}

nav button:hover,
nav button.active {
  color: #d55d92;
  border-bottom: 0.1rem solid black;
  border-bottom-right-radius: 1rem;
  border-bottom-left-radius: 1rem;
}

article {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  border-bottom: solid black 2px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

article.fade-out { opacity: 0; }

.imageBox { flex: 1 1 40%; }
.imageBox img { width: 100%; height: auto; display: block; }

.infoBox {
  flex: 1 1 60%;
  padding: 1.5rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* PRODUCT SECTION */
#product-section {
  padding: 2rem 3rem;
  display: flex;
  justify-content: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
  max-width: 1800px;
  width: 100%;
}

/* PRODUCT CARD */
.product {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
  border: black 2px solid;
}

/* carousel area has a defined size */
.product-carousel{
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
}

/* the carousel image fills the carousel */
.product-carousel .product-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* (optional) if you have other imgs later, don’t force them to 250px */
.product-details img{
  width: auto;
  height: auto;
  object-fit: initial;
}

/* arrows */
.car-arrow{
  color: black;
  font-size: 1rem;
  background-color: #F6F5F1;
  border: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 9rem;
  cursor: pointer;
  z-index: 2;
}
.car-prev{ left: 0px; }
.car-next{ right: 0px; }

.product-details {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; 
  gap: 0.75rem;
  font-family: "Forum", serif;
  font-weight: 700;
  font-style: normal;
}

.product-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.product-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.4;
  margin-bottom: 0.8rem;
}

.product-price { 
  font-weight: 600; 
  font-size: 1rem; 
  margin-bottom: 1rem;
}

.flavours {
  display: flex;
  flex-direction: column; 
}

.dd-flavours {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f6f6f6;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: #756f6a solid 0.1rem;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.ta-flavours {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f6f6f6;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  margin-bottom: 1rem;
  border: #756f6a solid 0.1rem;
  width: 100%;
  resize: none;
  color: black;
}

.quantity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f6f6f6;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  margin-bottom: 1rem;
  border: #756f6a solid 0.1rem;
}

.quantity button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: black;
}

.quantity span { font-weight: 500; font-size: 1rem; }

.add-btn {
  background-color: #F6F5F1;
  color: black;
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
  font-family: "Forum", serif;
  font-weight: 400;
  font-style: normal;
  border: #756f6a solid 0.1rem;
}

.add-btn:hover { background-color: #c04a7c; }

.author { text-align: center; font-size: 1rem; }

footer {
  width: 100%;
  color: black;
  padding: 1rem;
  z-index: 10;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  padding-bottom: 4rem;
}

.footer-content h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
}

.footer-content h2 img {
  height: 28px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

footer p { padding: 0rem; }

.allergen-btn {
  position: fixed;
  bottom: 18px;
  left: 18px;
  background: #F6F5F1;
  color: black;
  border: solid 0.1rem black;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
  font-family: "Old Standard TT", serif;
  font-size: 1.5rem;
}
.allergen-btn:hover { background: #c04a7c; }

/* Hide on desktop */
.email-mobile,
.phone-mobile { display: none; }

/* Popup styles */
.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.popup-content {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  position: relative;
  width: 90%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s ease;
  align-items: center;
  max-height: 90vh;
  max-width: 90vw;
  overflow: auto;
}

.popup-content img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.contact-container {
  font-family: "Old Standard TT", serif;
  color: black;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.contact-item { margin: 1rem 0; }

.contact-label {
  font-weight: bold;
  margin-right: 0.5rem;
}

.contact-link {
  color: #c04a7c;
  text-decoration: none;
  font-weight: bold;
}

.contact-link:hover { text-decoration: underline; }

.close {
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* CART styles */
#cart-button {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c04a7c;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  z-index: 2000;
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
  border: none;
}

#cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #fff;
  color: #c04a7c;
  font-weight: 700;
  border-radius: 50%;
  border: solid black 1px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

#cart-icon {
  transition: color 0.15s ease, transform 0.15s ease;
}

#cart-button[title="Close cart"] #cart-icon {
  color: #756f6a; /* brown */
}

body.modal-open { overflow: hidden !important; }

#cart-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  overflow: hidden;
}

#cart-modal.open { display: flex; }

.cart-header-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-title{ margin: 1rem; }

#cart-panel {
  width: 50%;
  max-width: calc(100% - 40px);
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  font-family: inherit;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#cart-items { max-height: 320px; overflow: auto; margin-top: 6px; }

.cart-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  align-items: center;
}

.cart-item button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

#cart-total { margin-top: 12px; font-size: 18px; font-weight: 700; text-align: right; }
#checkout-form { margin-top: 12px; display: flex; gap: 8px; }

#checkout-btn {
  flex: 1;
  padding: 10px 12px;
  border: solid #645cff 2px;
  background: white;
  color: black;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  margin: 1rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#checkout-btn img { height: 28px; width: auto; display: inline-block; vertical-align: middle; }

#checkout-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

#clear-cart {
  background: white;
  color: black;
  border: solid black 1px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  height: 48px;
  margin: 1rem;
}

.cart-thumb {
  width: clamp(72px, 18vw, 130px);
  height: clamp(72px, 18vw, 130px);
  object-fit: cover;
  border-radius: 8px;
  display: block;
  flex: 0 0 auto;
  border: solid 1px black;
  margin-right: 1rem;
}

/* Delivery section */
#cart-delivery-section {
  margin: 1rem;
  padding: 10px;
  background: #f8f8f8;
  border-radius: 8px;
  border: 1px solid black;
}

.cart-delivery-title { margin: 1rem; }
.delivery-option { display: block; margin: 1.5rem; }

/* Let .is-hidden control visibility instead of hardcoding display:none here */
#cart-delivery-address-box { margin: 1rem; }

#cart-delivery-address,
#cart-delivery-full-address {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  line-height: 1.4;
  font-family: inherit;
  font-size: 1rem;
}

#cart-delivery-full-address { margin-top: 8px; resize: none; }

#delivery-availability { margin: 1rem; }
#cart-delivery-fee { margin: 1rem; }
#cart-grand-total { margin: 1rem; font-weight: 700; }

.cart-subtotal{ margin: 1rem; }

.is-hidden{ display: none; }

.delivery-date-label{ padding-left: 1rem; }

.terms-row{
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
  margin-left: 1rem;
}

.popup-padded-text{ padding: 1rem; }

/* CSP-friendly toggles */
.is-flex { display: flex !important; }

/* Delivery status colouring */
.delivery-ok { color: #0a7a2f; }
.delivery-bad { color: #b00020; }

/* Cart render helper classes (replaces inline style=...) */
.cart-info { flex: 1; }
.cart-name { font-weight: 700; }
.cart-meta { font-size: 13px; color: #444; white-space: pre-line; }
.cart-price-line { font-size: 13px; color: #666; margin-top: 4px; }
.cart-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-controls-row { display: flex; gap: 6px; }


/* Responsive */
@media (max-width: 1120px) {
  p { padding: 1rem; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .logo img { padding-bottom: 0.5rem; }

  .email-mobile,
  .phone-mobile { display: inline-block; }

  .header-btn { font-size: 1rem; }

  .top-left,
  .top-right {
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
  }

  nav { padding: 0rem; }
  nav button { font-size: 1.3rem; padding: 0.5rem 0.2rem; }
  nav button:hover, nav button.active { border-bottom: none; }

  article { flex-direction: column; text-align: center; border-bottom: none; }
  .imageBox img { display: none; }
  .infoBox { padding: 1rem 1rem 0rem 1rem; }
  #product-section { padding-top: 0rem; }

  .allergen-btn {
    font-size: 1rem;
    top: auto;
    bottom: 10px;
    left: 50%;
    right: auto;
    transform: translate(-50%, 0);
    z-index: 3000;
  }

  footer { height: 0.75rem; margin-bottom: 4rem; }

  .hamburger { display: block; }
  .header-content { justify-content: space-between; }
  .desktop-only { display: none; }

  #cart-panel{
    width: 92%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  #cart-items{
    flex: none;
    min-height: 0;
    overflow: visible;
    -webkit-overflow-scrolling: touch;
  }

  #cart-delivery-section{
    flex: 0 0 auto;
    margin: 0.5rem;
  }

  .cart-thumb {
    width: clamp(72px, 22vw, 110px);
    height: clamp(72px, 22vw, 110px);
  }

  #cart-button {
    top: 16px;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translate(-50%, 0);
    z-index: 3000;
    border: solid black 1px;
    background-color: #F6F5F1;
    width: 50px;
    height: 50px;
  }

  #cart-count { color: black; }

  .cart-delivery-title { margin: 0.5rem; }
  .delivery-option { margin: 1rem; }
  #cart-delivery-address-box { margin: 0.5rem; }
  #cart-delivery-fee { margin: 0.5rem; }
  #cart-grand-total { margin: 0.5rem; }
  #checkout-btn { margin: 0.5rem; }
  #clear-cart { margin: 0.5rem; }
}

/* Mobile phones */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0rem;
  }

  .product-carousel { height: 180px; }

  #product-section { padding: 0rem; }

  .product {
    background-color: transparent; 
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  #product-grid > .product:nth-child(5n + 2),
  #product-grid > .product:nth-child(5n + 3) {
    background-color: #756f6a;
    color: #fff;
  }

  #product-grid > .product:nth-child(5n + 2) *,
  #product-grid > .product:nth-child(5n + 3) * {
    color: #fff;
  }

  /* Keep carousel arrows black on brown cards */
  #product-grid > .product:nth-child(5n + 2) .car-arrow,
  #product-grid > .product:nth-child(5n + 3) .car-arrow {
    color: white;
    background-color: #756f6a;
  }

  /* Keep these controls black on the brown cards */
  #product-grid > .product:nth-child(5n + 2) .dd-flavours,
  #product-grid > .product:nth-child(5n + 3) .dd-flavours,
  #product-grid > .product:nth-child(5n + 2) .ta-flavours,
  #product-grid > .product:nth-child(5n + 3) .ta-flavours,
  #product-grid > .product:nth-child(5n + 2) .add-btn,
  #product-grid > .product:nth-child(5n + 3) .add-btn,
  #product-grid > .product:nth-child(5n + 2) .quantity,
  #product-grid > .product:nth-child(5n + 3) .quantity,
  #product-grid > .product:nth-child(5n + 2) .quantity button,
  #product-grid > .product:nth-child(5n + 3) .quantity button,
  #product-grid > .product:nth-child(5n + 2) .quantity span,
  #product-grid > .product:nth-child(5n + 3) .quantity span {
    color: #000;
    border: transparent 0.1rem solid;
  }

  #product-grid > .product:nth-child(5n + 2) .add-btn,
  #product-grid > .product:nth-child(5n + 3) .add-btn {
    background-color: #F6F5F1;
  }

  /* arrows */
  .car-arrow {
    height: 5rem;
    width: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
  }

  .car-prev { left: 0px; }
  .car-next { right: 0px; }
}
