* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  color: #111827;
  background-color: #f3f4f6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background-color: #111827;
  color: #f9fafb;
}

.logo a {
  font-weight: 700;
  font-size: 1.25rem;
}

.logo span {
  color: #22c55e;
}

.main-nav {
  margin-right: 3rem; /* leave space for the shopping tab on the right */
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.main-nav a,
.shopping-list-link {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.main-nav a:hover,
.main-nav a:focus,
.shopping-list-link:hover,
.shopping-list-link:focus {
  background-color: #1f2937;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.user-greeting {
  color: #9ca3af;
}

.user-link {
  color: #f9fafb;
  background: none;
  border: 1px solid #374151;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: none;
}

.user-link:hover {
  background-color: #374151;
  text-decoration: none;
}

.breadcrumb {
  padding: 0.5rem 1.5rem;
  background-color: #e5e7eb;
  font-size: 0.875rem;
}

.breadcrumb ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.breadcrumb li + li::before {
  content: ">";
  margin: 0 0.25rem;
  color: #6b7280;
}

.hero {
  padding: 2.5rem 1.5rem;
  background: radial-gradient(circle at top left, #22c55e 0, #16a34a 30%, #111827 80%);
  color: #f9fafb;
}

.hero-content {
  max-width: 40rem;
}

.hero h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.hero p {
  margin: 0;
}

.product-section {
  padding: 2rem 1.5rem 1rem;
}

.product-section h2 {
  margin-top: 0;
}

.product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
}

.product-card {
  flex: 1 1 220px;
  max-width: 280px;
  background-color: #ffffff;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.product-info {
  padding: 0.75rem 1rem 1rem;
}

.product-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.product-price {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: #16a34a;
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.add-to-cart {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: none;
  background-color: #22c55e;
  color: #052e16;
  font-weight: 600;
  cursor: pointer;
}

.add-to-cart:hover,
.add-to-cart:focus {
  background-color: #16a34a;
}

/* Shopping list overlay */

.shopping-list-container {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
}

.shopping-list-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.shopping-list-tab {
  display: none; /* we now trigger the panel from a horizontal link in the header */
}

.shopping-list-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  box-shadow: -4px 0 10px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
}

.shopping-list-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shopping-list-close {
  font-size: 0.875rem;
  color: #6b7280;
  cursor: pointer;
  border: none;
  background: none;
}

.shopping-list-close:hover,
.shopping-list-close:focus {
  color: #111827;
  text-decoration: underline;
}

.shopping-list-form {
  padding: 0.75rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.shopping-list-items {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shopping-list-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.item-name {
  font-size: 0.875rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-qty-control {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.item-qty-input {
  width: 2.75rem;
  text-align: center;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  padding: 0.125rem;
  font-size: 0.875rem;
  -moz-appearance: textfield;
}

.item-qty-input::-webkit-outer-spin-button,
.item-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-btn {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}

.qty-btn:hover,
.qty-btn:focus {
  background-color: #e5e7eb;
}

.item-price {
  font-size: 0.8rem;
  color: #4b5563;
  min-width: 3.5rem;
  text-align: right;
}

.cart-empty {
  text-align: center;
  color: #6b7280;
  padding: 1rem 0;
  font-size: 0.875rem;
}

.shopping-list-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.shopping-list-total-value {
  color: #16a34a;
}

.remove-item {
  border: none;
  background: none;
  color: #b91c1c;
  font-size: 0.75rem;
  cursor: pointer;
}

.remove-item:hover,
.remove-item:focus {
  text-decoration: underline;
}

.checkout-button {
  align-self: flex-end;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  background-color: #111827;
  color: #f9fafb;
  font-weight: 600;
  cursor: pointer;
}

.checkout-button:hover,
.checkout-button:focus {
  background-color: #000000;
}

/* Hover behavior on larger screens */

@media (hover: hover) {
  .shopping-list-tab:hover + .shopping-list-panel,
  .shopping-list-panel:hover {
    transform: translateX(0);
  }
}

/* Click-to-open behavior for all devices */

.shopping-list-toggle:checked ~ .shopping-list-panel {
  transform: translateX(0);
}

.site-footer {
  padding: 1rem 1.5rem 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

/* Product detail page */

.product-detail-main {
  padding: 2rem 1.5rem 1.5rem;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 2rem;
  align-items: flex-start;
}

.product-media {
  background-color: #ffffff;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.product-media img {
  width: 57%;
  height: auto;
  max-height: 700px; /* adjust this value to make the image taller/shorter */
  object-fit: cover;
}

.product-summary {
  background-color: #ffffff;
  padding: 1.25rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.product-summary h1 {
  margin-top: 0;
}

.product-summary .product-price {
  font-size: 1.25rem;
}

.product-meta {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.product-features {
  padding-left: 1.25rem;
}

.product-features li {
  margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .product-detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .shopping-list-tab {
    top: auto;
    bottom: 1rem;
    transform: none;
    writing-mode: horizontal-tb;
    border-radius: 999px 0 0 999px;
  }
}
