/* --------- Reset --------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* --------- Base Theme --------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background: #f4f5f7;
  background-image: radial-gradient(circle at top left, rgba(0,0,0,0.05), transparent 55%),
                    radial-gradient(circle at bottom right, rgba(0,0,0,0.04), transparent 55%);
  color: #111827;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Slight fade in */
.page, .site-header, .site-footer {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.page {
  animation-delay: 0.12s;
}

.site-footer {
  animation-delay: 0.2s;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* --------- Layout Shell --------- */
.site-header,
.site-footer {
  padding: 16px 20px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.page {
  flex: 1;
  padding: 8px 20px 24px;
  max-width: 960px;
  margin: 0 auto;
}

/* --------- Header / Brand --------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 14px rgba(15,23,42,0.4);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.tagline {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: #6b7280;
}

/* Dark mode toggle button */
#theme-toggle {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 1.05rem;
  cursor: pointer;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* --------- Hero --------- */
.hero {
  margin: 8px 0 24px;
  padding: 18px 18px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 8px 18px rgba(0,0,0,0.04);
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.hero p {
  margin: 0;
  color: #4b5563;
}

/* --------- Products Grid --------- */
.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

/* Product Card */
.product-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 12px 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Product Image */
.product-image {
  position: relative;
  border-radius: 10px;
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.placeholder-text {
  opacity: 0.8;
}

/* Product Body */
.product-body h3 {
  margin: 0;
  font-size: 1rem;
}

.product-meta {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.product-price {
  margin: 6px 0 4px;
  font-weight: 600;
  font-size: 0.98rem;
}

.product-desc {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #4b5563;
}

/* Buy Button */
.buy-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: #111827;
  color: #f9fafb;
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.buy-button:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15,23,42,0.45);
}

/* --------- Note Section --------- */
.note {
  font-size: 0.85rem;
  color: #6b7280;
  background: rgba(255,255,255,0.8);
  border-radius: 10px;
  padding: 10px 12px;
}

.note code {
  background: #e5e7eb;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* --------- Footer --------- */
.site-footer {
  font-size: 0.8rem;
  color: #6b7280;
  text-align: center;
}

/* --------- Dark Mode --------- */
.dark-mode {
  background: #020617;
  background-image: radial-gradient(circle at top left, rgba(148,163,184,0.18), transparent 55%),
                    radial-gradient(circle at bottom right, rgba(15,23,42,0.5), transparent 60%);
  color: #e5e7eb;
}

.dark-mode .hero {
  background: rgba(15,23,42,0.85);
  box-shadow: 0 8px 18px rgba(0,0,0,0.6);
}

.dark-mode .hero p {
  color: #cbd5f5;
}

.dark-mode .product-card {
  background: #020617;
  box-shadow: 0 10px 26px rgba(0,0,0,0.7);
}

.dark-mode .product-image {
  background: linear-gradient(135deg, #111827, #0f172a);
  color: #9ca3af;
}

.dark-mode .product-desc,
.dark-mode .product-meta,
.dark-mode .product-price {
  color: #e5e7eb;
}

.dark-mode .buy-button {
  background: #e5e7eb;
  color: #020617;
}

.dark-mode .buy-button:hover {
  background: #ffffff;
}

.dark-mode .note {
  background: rgba(15,23,42,0.8);
  color: #e5e7eb;
}

.dark-mode .note code {
  background: #111827;
}

.dark-mode .brand-mark {
  background: #e5e7eb;
  color: #020617;
}

.dark-mode #theme-toggle {
  background: #111827;
  color: #e5e7eb;
}

/* --------- Responsive (Mobile / Tablet) --------- */
@media (max-width: 900px) {
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {

  .site-header,
  .page,
  .site-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-text h1 {
    font-size: 1.2rem;
  }

  .products {
    grid-template-columns: 1fr;
  }

  .product-image {
    height: 160px;
  }
}