/* Boutique: warm cream tones, serif headings, a terracotta accent. */
:root {
  --cream: #f8f2ea;
  --linen: #f1e7da;
  --sand: #e6d6c2;
  --paper: #fffdf9;
  --ink: #3d2e27;
  --muted: #7a685c;
  --accent: #9c5b3c;
  --accent-dark: #7f472d;
  --gold: #c9a77c;
  --ok: #5d7a4f;
  --warn: #b0712b;
  --radius: 14px;
  --serif: "Playfair Display", "Cormorant Garamond", Georgia, "Times New Roman", "Liberation Serif", serif;
  --sans: "Helvetica Neue", "Segoe UI", Roboto, "Liberation Sans", Arial, sans-serif;
  --shadow: 0 10px 30px rgba(61, 46, 39, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(248, 242, 234, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sand);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: .8rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-family: var(--serif); font-size: 1.45rem; letter-spacing: .04em; }
.brand-logo { width: 36px; height: 36px; }
.main-nav { display: flex; align-items: center; gap: 1.3rem; font-size: .95rem; }
.main-nav a { color: var(--ink); padding: .25rem 0; border-bottom: 1px solid transparent; }
.main-nav a:hover, .main-nav a.active { border-bottom-color: var(--accent); color: var(--accent-dark); }
.cart-link { position: relative; display: flex; align-items: center; }
.cart-count {
  position: absolute; top: -6px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: .72rem; line-height: 18px; text-align: center;
}
.cart-count:empty { display: none; }

/* Page */
.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.loading { color: var(--muted); font-style: italic; text-align: center; padding: 4rem 0; }
.back { display: inline-block; margin-bottom: 1.2rem; color: var(--muted); font-size: .9rem; }
.back:hover { color: var(--accent); }
.empty { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--linen), var(--sand));
  border-radius: calc(var(--radius) * 1.5);
  padding: clamp(2rem, 6vw, 4rem);
  margin-bottom: 2.2rem;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  border-radius: 50%; border: 1px solid var(--gold); opacity: .6;
}
.hero .eyebrow { text-transform: uppercase; letter-spacing: .25em; font-size: .75rem; color: var(--accent); margin-bottom: .8rem; }
.hero p { max-width: 560px; color: var(--muted); font-size: 1.05rem; margin: 0; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  border: 1px solid var(--sand); background: var(--paper); color: var(--ink);
  padding: .4rem 1rem; border-radius: 999px; cursor: pointer; font-size: .88rem;
}
.chip:hover { border-color: var(--gold); }
.chip.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.search {
  border: 1px solid var(--sand); background: var(--paper); border-radius: 999px;
  padding: .5rem 1rem; min-width: 240px;
}
.search:focus, .field input:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.6rem; }
.card {
  background: var(--paper); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(61, 46, 39, .13); }
.card-image { aspect-ratio: 4 / 5; background: var(--linen); display: block; overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 3rem; color: var(--gold); background: linear-gradient(160deg, var(--linen), var(--sand));
}
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.card-dept { text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; color: var(--muted); }
.card-title { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); }
.card-price { color: var(--accent-dark); font-weight: 600; margin-top: auto; padding-top: .4rem; }
.card .btn { margin-top: .6rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--ink); background: var(--ink); color: var(--cream);
  padding: .65rem 1.3rem; border-radius: 999px; cursor: pointer; font-size: .92rem; letter-spacing: .03em;
  transition: background .15s ease;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: var(--linen); color: var(--ink); border-color: var(--ink); }
.btn.big { padding: .9rem 2rem; font-size: 1rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: .2rem; font-size: .85rem; text-decoration: underline; }
.link-btn:hover { color: var(--accent); }

/* Product page */
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.product-image { border-radius: calc(var(--radius) * 1.3); overflow: hidden; background: var(--linen); aspect-ratio: 4 / 5; box-shadow: var(--shadow); }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-info .card-dept { margin-bottom: .4rem; }
.product-price { font-size: 1.6rem; color: var(--accent-dark); font-family: var(--serif); margin: .2rem 0 1.2rem; }
.product-desc { color: var(--muted); white-space: pre-line; margin-bottom: 1.6rem; }
.label { font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 1.2rem 0 .5rem; }
.sizes { display: flex; flex-wrap: wrap; gap: .5rem; }
.size {
  min-width: 48px; padding: .5rem .8rem; border-radius: 10px; border: 1px solid var(--sand);
  background: var(--paper); cursor: pointer; text-align: center;
}
.size:hover { border-color: var(--gold); }
.size.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.buy-row { display: flex; gap: 1rem; align-items: center; margin-top: 1.6rem; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--sand); border-radius: 999px; background: var(--paper); }
.stepper button { width: 38px; height: 38px; border: none; background: none; cursor: pointer; font-size: 1.15rem; color: var(--ink); border-radius: 50%; }
.stepper button:hover { background: var(--linen); }
.stepper span { min-width: 30px; text-align: center; }
.note { font-size: .85rem; color: var(--muted); margin-top: 1rem; }

/* Basket and checkout */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.basket-line { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--linen); }
.basket-line:last-child { border-bottom: none; }
.thumb { width: 84px; height: 104px; border-radius: 10px; overflow: hidden; background: var(--linen); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .placeholder { font-size: 1.6rem; }
.line-title { font-family: var(--serif); font-size: 1.05rem; }
.line-meta { color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }
.line-amount { text-align: right; font-weight: 600; color: var(--accent-dark); }
.sum-row { display: flex; justify-content: space-between; padding: .45rem 0; }
.sum-row.total { border-top: 1px solid var(--sand); margin-top: .6rem; padding-top: .9rem; font-family: var(--serif); font-size: 1.3rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.2rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.field input, .field textarea {
  border: 1px solid var(--sand); border-radius: 10px; background: #fff; padding: .65rem .8rem;
}
.field textarea { min-height: 90px; resize: vertical; }
.pay-hint { background: var(--linen); border-radius: 10px; padding: .9rem 1rem; font-size: .88rem; color: var(--muted); margin: 1rem 0; }

/* Orders */
.orders { display: flex; flex-direction: column; gap: .9rem; }
.order-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center;
  background: var(--paper); border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: var(--shadow); color: var(--ink);
}
.order-row:hover { color: var(--ink); box-shadow: 0 14px 32px rgba(61, 46, 39, .12); }
.order-no { font-family: var(--serif); font-size: 1.15rem; }
.badge { display: inline-block; padding: .2rem .75rem; border-radius: 999px; font-size: .78rem; background: var(--linen); color: var(--muted); white-space: nowrap; }
.badge.wait { background: #f6e3c8; color: var(--warn); }
.badge.paid { background: #e1ead8; color: var(--ok); }
.payment-box { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; align-items: center; border: 1px solid var(--gold); background: #fffaf2; }
.qr { width: 200px; height: 200px; background: #fff; border-radius: 10px; padding: 8px; }
.qr img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.kv { display: grid; grid-template-columns: max-content 1fr auto; gap: .4rem 1rem; align-items: center; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th { text-align: left; font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: .5rem .4rem; border-bottom: 1px solid var(--sand); }
.lines-table td { padding: .7rem .4rem; border-bottom: 1px solid var(--linen); }
.lines-table .num { text-align: right; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 1.5rem; }

/* Login */
.auth { max-width: 440px; margin: 2rem auto; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1.2rem; }
.auth .field { margin-bottom: 1rem; }

/* Footer, toast, dialog */
.site-footer { border-top: 1px solid var(--sand); background: var(--linen); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.25rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: .85rem; }
#footer-name { font-family: var(--serif); color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--cream); padding: .8rem 1.3rem; border-radius: 12px; box-shadow: var(--shadow);
  transition: opacity .25s ease, transform .25s ease; max-width: min(92vw, 520px); z-index: 50; white-space: pre-line;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8a3324; }
.dialog-layer { position: fixed; inset: 0; background: rgba(61, 46, 39, .35); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 1rem; }
.dialog-layer[hidden] { display: none; }
.dialog { background: var(--paper); border-radius: var(--radius); padding: 1.6rem; max-width: 440px; width: 100%; box-shadow: var(--shadow); }
.dialog p { white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }

@media (max-width: 860px) {
  .product, .two-col, .payment-box { grid-template-columns: 1fr; }
  .qr { margin: 0 auto; }
}
@media (max-width: 600px) {
  .main-nav { gap: .9rem; font-size: .88rem; }
  .brand span { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .card-body { padding: .8rem; }
  .form-grid { grid-template-columns: 1fr; }
  .search { min-width: 0; width: 100%; }
  .order-row { grid-template-columns: 1fr auto; }
  .order-row .order-amount { grid-column: 2; }
  .basket-line { grid-template-columns: 64px minmax(0, 1fr); }
  .thumb { width: 64px; height: 80px; }
  .line-amount { grid-column: 2; text-align: left; }
}
