:root {
  --brand: #CE1B2C;
  --ink: #1a1a1a;
  --muted: #666;
  --bg: #faf7f5;
}
* { box-sizing: border-box; }
/* Ensure the hidden attribute always wins over element display rules
   (e.g. .cart-panel { display: flex }), so the cart panel/overlay hide. */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 1.25rem 1rem;
}
.site-title { margin: 0; font-size: clamp(1.6rem, 5vw, 2.4rem); color: var(--brand); }
.site-sub { margin: 0.25rem 0 0; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.status { text-align: center; min-height: 1.2em; color: var(--brand); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}
.card__img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; background: #eee; }
.card__title { margin: 0.9rem 1rem 0.2rem; font-size: 1.1rem; }
.card__desc { margin: 0 1rem; color: var(--muted); font-size: 0.9rem; flex: 1 0 auto; }
.card__price { margin: 0.6rem 1rem 0; font-weight: 700; }
.card__buy {
  margin: 0.8rem 1rem 1.1rem;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.card__buy:hover:not(:disabled) { background: #a8131f; }
.card__buy:disabled { background: #c9c9c9; cursor: not-allowed; }

.site-headings { text-align: left; }
.cart-toggle {
  min-height: 44px; padding: 0 1rem; font-weight: 700; color: #fff; background: var(--brand);
  border: none; border-radius: 8px; cursor: pointer;
}
.cart-count { background: #fff; color: var(--brand); border-radius: 999px; padding: 0 0.5rem; margin-left: 0.4rem; }
.card__stock { margin: 0.3rem 1rem 0; color: var(--muted); font-size: 0.85rem; }

.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); }
.cart-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(380px, 92vw);
  background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,0.2); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;
}
.cart-panel__head { display: flex; align-items: center; justify-content: space-between; }
.cart-close { font-size: 1.6rem; line-height: 1; background: none; border: none; cursor: pointer; }
.cart-lines { display: flex; flex-direction: column; gap: 0.75rem; flex: 1 0 auto; }
.cart-line { display: grid; grid-template-columns: 1fr 64px auto; align-items: center; gap: 0.5rem; }
.cart-line__qty { width: 60px; min-height: 40px; padding: 0.3rem; }
.cart-empty { color: var(--muted); }
.cart-foot { border-top: 1px solid #eee; padding-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.cart-subtotal { font-weight: 700; margin: 0; }
.cart-checkout {
  min-height: 48px; font-size: 1.05rem; font-weight: 700; color: #fff; background: var(--brand);
  border: none; border-radius: 10px; cursor: pointer;
}
.cart-checkout:disabled { background: #c9c9c9; cursor: not-allowed; }

.link { color: var(--brand); }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }

.success-box {
  max-width: 520px;
  margin: 3rem auto;
  padding: 2rem 1.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  text-align: center;
}
