:root {
  --green: #1F6F3E;
  --green-dark: #164B2A;
  --yellow: #F2C230;
  --brown: #5C4630;
  --parchment: #F5F1E6;
  --ink: #2B2417;
  --white: #FFFFFF;
  --red: #B23A2E;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(43,36,23,0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--parchment);
  color: var(--ink);
}

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--green-dark);
  margin: 0 0 0.4em;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--green);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; }
.brand-name small { font-size: 0.7em; font-weight: 400; }
.brand-tag { font-size: 0.75rem; opacity: 0.9; }

.cart-toggle {
  background: var(--yellow);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.cart-toggle:active { transform: scale(0.97); }

/* ---------- Hero ---------- */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 8px;
  text-align: center;
}
.hero h1 { font-size: 1.9rem; }
.hero p { color: var(--brown); margin: 0; }

/* ---------- Produkte ---------- */
.products-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.loading { grid-column: 1 / -1; text-align: center; color: var(--brown); }

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-image-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #EFE9D8;
  overflow: hidden;
}
.product-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-image-wrap .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}

.sold-out-ribbon {
  position: absolute;
  inset: 0;
  background: rgba(43,36,23,0.15);
}
.sold-out-ribbon span {
  position: absolute;
  top: 22px;
  left: -34px;
  width: 160px;
  transform: rotate(-38deg);
  background: var(--red);
  color: var(--white);
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 5px 0;
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-name { font-weight: 700; font-size: 1.05rem; }
.product-size {
  display: inline-block;
  align-self: flex-start;
  background: var(--parchment);
  border: 1px solid var(--brown);
  color: var(--brown);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}
.product-desc { font-size: 0.88rem; color: #4a4030; flex: 1; margin: 4px 0; }
.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product-price { font-size: 1.15rem; font-weight: 700; color: var(--green-dark); }
.stock-note { font-size: 0.75rem; color: var(--brown); }

.btn-add {
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn-add:disabled { background: #B9AF98; cursor: not-allowed; }

/* ---------- Warenkorb ---------- */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(43,36,23,0.45);
  z-index: 29;
  display: none;
}
.backdrop.open { display: block; }

.cart-drawer {
  position: fixed;
  top: 0; right: -100%;
  width: min(380px, 92vw);
  height: 100%;
  background: var(--white);
  z-index: 30;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
  box-shadow: -4px 0 16px rgba(0,0,0,0.2);
}
.cart-drawer.open { right: 0; }
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid #E7E1D2; }
.cart-header button { background: none; border: none; font-size: 1.2rem; cursor: pointer; }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 16px; }
.cart-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F0EBDD; align-items: center; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 0.92rem; }
.cart-item-size { font-size: 0.78rem; color: var(--brown); }
.qty-controls { display: flex; align-items: center; gap: 6px; }
.qty-controls button {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--brown);
  background: var(--white); cursor: pointer; font-weight: 700;
}
.cart-item-remove { background: none; border: none; color: var(--red); cursor: pointer; font-size: 0.8rem; }

.cart-summary { padding: 12px 16px; border-top: 1px solid #E7E1D2; }
.cart-summary .row { display: flex; justify-content: space-between; font-size: 0.92rem; padding: 3px 0; }
.cart-summary .row.total { font-weight: 700; font-size: 1.05rem; color: var(--green-dark); padding-top: 6px; border-top: 1px dashed #ddd; margin-top: 4px; }

.btn-primary {
  margin: 12px 16px 16px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:disabled { background: #B9AF98; cursor: not-allowed; }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(43,36,23,0.5);
  display: none;
  align-items: center; justify-content: center;
  z-index: 40;
  padding: 16px;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 460px;
  width: 100%;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 1.1rem; cursor: pointer; }
.modal-content .hint { font-size: 0.85rem; color: var(--brown); }
#checkout-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
#checkout-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; font-weight: 600; }
#checkout-form input, #checkout-form textarea {
  font-family: inherit; font-size: 0.95rem;
  padding: 9px 10px; border: 1px solid #ccc; border-radius: 6px;
}
.error { color: var(--red); font-size: 0.85rem; min-height: 1.2em; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--green-dark);
  color: #E9E4D6;
  text-align: center;
  padding: 20px 16px;
  font-size: 0.85rem;
}
.legal-links a { color: var(--yellow); text-decoration: none; margin: 0 2px; }
.legal-links a:hover { text-decoration: underline; }

@media (min-width: 700px) {
  .hero h1 { font-size: 2.4rem; }
}
