/* Layout base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #222;
}

/* Semantic layout */
header {
  background: #111827;
  color: #f9fafb;
  padding: 1rem 2rem;
}

header .site-title {
  font-size: 1.5rem;
  font-weight: 600;
}

nav.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

nav.main-nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.95rem;
}

nav.main-nav a:hover {
  text-decoration: underline;
}

/* Breadcrumbs (hierarchical nav) */
nav.breadcrumbs {
  background: #e5e7eb;
  padding: 0.5rem 2rem;
  font-size: 0.9rem;
}

nav.breadcrumbs a {
  color: #2563eb;
  text-decoration: none;
}

nav.breadcrumbs span.sep {
  margin: 0 0.25rem;
}

/* Layout: main + cart panel */
.page-layout {
  display: flex;
  align-items: flex-start;
}

/* Main content */
main {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
}

/* Product grid (CSS tableless layout using flexbox) */
section.products {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

article.product-card {
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  flex: 1 1 calc(25% - 1.5rem);
  min-width: 220px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.product-thumb {
  display: block;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-body {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.product-name {
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
  text-decoration: none;
}

.product-name:hover {
  text-decoration: underline;
}

.product-price {
  font-size: 0.95rem;
  color: #16a34a;
  font-weight: 600;
}

.product-actions {
  margin-top: 0.5rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #f9fafb;
}

.btn-primary:hover {
  background: #1d4ed8;
}

/* Hover / click shopping list (cart) */
aside.cart-panel {
  position: relative;
}

/* Desktop: cart hidden at right, appears on hover */
.cart-trigger {
  position: sticky;
  top: 1.5rem;
  margin-right: 1.5rem;
}

.cart-trigger button {
  background: #111827;
  color: #f9fafb;
  border-radius: 999px;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.cart-panel-inner {
  position: fixed;
  top: 0;
  right: -320px;           /* hide off-screen by default */
  width: 320px;
  height: 100vh;
  background: #111827;
  color: #f9fafb;
  box-shadow: -4px 0 12px rgba(0,0,0,0.3);
  padding: 1.5rem 1.25rem;
  transition: right 0.25s ease-out;
  z-index: 1000;
}

.cart-panel:hover .cart-panel-inner,
.cart-panel-inner:hover {
  right: 0;                 /* slide in on hover */
}

/* Responsive: show cart on click (no hover) */
@media (max-width: 768px) {
  .page-layout {
    flex-direction: column;
  }

  .cart-trigger {
    position: static;
    margin: 0 0 1rem 0;
    padding: 0 1rem;
  }

  .cart-panel-inner {
    width: 100%;
    height: auto;
    max-height: 70vh;
    bottom: 0;
    top: auto;
    right: 0;
    transform: translateY(100%);
  }

  .cart-panel-inner.open {
    transform: translateY(0);
  }
}

/* Cart content */
.cart-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.cart-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.cart-item-label {
  flex: 1;
  padding-right: 0.5rem;
}

.cart-item-qty {
  width: 60px;
}

.cart-item-qty input[type="number"] {
  width: 100%;
  padding: 0.2rem 0.3rem;
  border-radius: 0.35rem;
  border: 1px solid #4b5563;
  background: #111827;
  color: #f9fafb;
}

.cart-footer {
  margin-top: 1rem;
}

.cart-footer .btn-primary {
  width: 100%;
}

/* Product page layout */
.product-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: flex-start;
}

.product-media {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.product-media img {
  width: 100%;
  border-radius: 0.5rem;
}

.product-info-panel {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.product-info-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.product-info-panel .product-price {
  font-size: 1.1rem;
}

.product-description {
  font-size: 0.95rem;
  margin: 0.75rem 0 1rem;
  line-height: 1.6;
}

.category-btn {
  background: transparent;
  border: 1px solid #4b5563;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
}

.category-btn:hover {
  background: #f9fafb;
  color: #111827;
}


/* Footer */
footer {
  background: #111827;
  color: #9ca3af;
  font-size: 0.85rem;
  padding: 1rem 2rem;
  text-align: center;
  margin-top: auto;
}
